* Add a set of palettes contributed by Nitrofurano. Thanks !
* Add a small python script to convert palettes back to the old .PAL format if you ever need it. * Update wiki page about palette to link to the new palettes ( I din't know where to put that) * also moved "translation" tools to the "tools" folder along with the convert script git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1283 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
32
tools/hexdump2grafxpal.py
Normal file
32
tools/hexdump2grafxpal.py
Normal file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: latin-1 -*-
|
||||
import os,sys
|
||||
def hexvl(a_st):
|
||||
a_st=a_st.lower();tmpr=0;hx_st="0123456789abcdef";hx_st=hx_st.lower()
|
||||
for i in range(0,len(a_st),1):
|
||||
tmpr=(tmpr*16)+hx_st.find(a_st[i])
|
||||
return tmpr
|
||||
finp_st=sys.argv[1];fout_st=finp_st+".pal"
|
||||
if finp_st.lower()=="--help".lower():
|
||||
print "hexdump2grafxpal - 201001261202 - Paulo Silva (GPL licence)"
|
||||
print "converts a text hexdump file into a .pal file used on Grafx2"
|
||||
print "usage: python hexdump2grafxpal.py yourfile.hex"
|
||||
print "the result will be a neighbour file named yourfile.hex.pal"
|
||||
print "bug: the result may not have 768 bytes, which may not be"
|
||||
print "loadable by Grafx2, if so please fill remaining '0x00' bytes"
|
||||
print "with a hex editor like KHexEdit or any other."
|
||||
else:
|
||||
finp_fl=open(finp_st,"r");fout_fl=open(fout_st,"w");ctr=0
|
||||
while True:
|
||||
text_st=finp_fl.readline()
|
||||
if len(text_st)==0:break
|
||||
text_st=text_st.replace("\n","")
|
||||
while len(text_st)>0:
|
||||
bytecrop=hexvl(text_st[:2])
|
||||
bc2=int(bytecrop/4)
|
||||
fout_fl.write(chr(bc2));ctr+=1
|
||||
text_st=text_st[2:]
|
||||
for j in range(ctr,768,1):
|
||||
fout_fl.write(chr(0))
|
||||
finp_fl.close();fout_fl.close()
|
||||
|
||||
13
tools/translat/Readme_translate.txt
Normal file
13
tools/translat/Readme_translate.txt
Normal file
@@ -0,0 +1,13 @@
|
||||
List functions and global variables
|
||||
nm -Cg --defined-only obj/win32/*.o | grep "^0" | cut -c 12- | sort -u
|
||||
|
||||
List variables, parameters, struct members. Requires french.txt to remove duplicates.
|
||||
perl -ne 'while ($_ =~ /\b(int|char|word|byte|float|double|short|long|Fenetre_Bouton_dropdown|Composantes|S_Mode_video|Fenetre_Bouton_normal|Fenetre_Bouton_palette|Fenetre_Bouton_scroller|Fenetre_Bouton_special|T_Shade|T_Degrade_Tableau|Element_de_liste_de_fileselect|S_ConfigTouche|T_Format|Table_conversion|Table_occurence|cluster|ClusterSet|Degrade|DegradeSet|T_Palette|Bouton_dropdown_choix|T_TABLEAIDE|Section_d_aide|T_Degrade_Tableau|T_Shade|Config_Mode_video|Config_Header|Config_Chunk|Config_Infos_touche|S_Page|S_Liste_de_pages|T_FONTE|statfs|S_Libelle_touche|POLYGON_EDGE)\s+(\*)?(\s)*(\w+)/g) { print "$4\n";}' *.c *.h | sort -u | comm -2 -3 - french.txt
|
||||
|
||||
List macros (not starting with _)
|
||||
perl -ne 'if ($_ =~ /^\s*#define ([^_]\w+)/) { print "$1\n"; }' *.h *.c | sort -u
|
||||
|
||||
Translate some source files
|
||||
./translate.pl *.c *.h
|
||||
|
||||
|
||||
3107
tools/translat/english.txt
Normal file
3107
tools/translat/english.txt
Normal file
File diff suppressed because it is too large
Load Diff
3107
tools/translat/french.txt
Normal file
3107
tools/translat/french.txt
Normal file
File diff suppressed because it is too large
Load Diff
52
tools/translat/translate.pl
Normal file
52
tools/translat/translate.pl
Normal file
@@ -0,0 +1,52 @@
|
||||
#!/usr/bin/perl
|
||||
# Translate words in file(s) given on command-line. Saves older as .bak
|
||||
# The dictionary is read as 2 files, french.txt and english.txt
|
||||
# Method: regexp search, ^word then ^non-word then ^word then ...
|
||||
# Each word is translated according to a hash dictionary
|
||||
|
||||
# Released to public domain.
|
||||
|
||||
unless ( open (FRENCH, "french.txt")) {
|
||||
die "Impossible to open 'french.txt' file.\n";
|
||||
}
|
||||
unless ( open (ENGLISH, "english.txt")) {
|
||||
die "Impossible to open 'english.txt' file.\n";
|
||||
}
|
||||
|
||||
# Build french->english dictionary (a hash)
|
||||
while(($french = <FRENCH>) & ($english=<ENGLISH>)){
|
||||
chop($french);
|
||||
chop($english);
|
||||
if ("$french" ne "$english")
|
||||
{
|
||||
$dictionary{$french} = $english;
|
||||
}
|
||||
}
|
||||
|
||||
#foreach $name (@ARGV) {
|
||||
#print "$name";
|
||||
|
||||
$^I = ".bak";
|
||||
# Read input
|
||||
while ($line = <>){
|
||||
chop $line;
|
||||
while ($line ne "") {
|
||||
# word
|
||||
if ($line =~ m/^(\w+)(.*)$/) {
|
||||
if (defined $dictionary{$1}) {
|
||||
print $dictionary{$1};
|
||||
}
|
||||
else {
|
||||
print "$1";
|
||||
}
|
||||
$line=$2;
|
||||
}
|
||||
# non-word
|
||||
if ($line =~ m/^([^\w]+)(.*)$/) {
|
||||
print "$1";
|
||||
$line=$2;
|
||||
}
|
||||
}
|
||||
print "\n";
|
||||
}
|
||||
#}
|
||||
BIN
tools/translat/translations.xls
Normal file
BIN
tools/translat/translations.xls
Normal file
Binary file not shown.
Reference in New Issue
Block a user