Compare commits

...

13 Commits
v2.0 ... master

Author SHA1 Message Date
Martin Johnson
4d5bbb3b02 print translations and rename dictionary files 2019-05-09 22:33:19 +12:00
Martin Johnson
a6cb80a2fa don't need libunistring-dev on 14.04 2018-10-12 14:50:38 +13:00
Martin Johnson
9fbc19b471 add travis CI file 2018-10-12 14:47:57 +13:00
Martin Johnson
994778ef41 add untranslated_110.txt file 2018-10-12 14:36:21 +13:00
Martin Johnson
4741c395de new translate code to use a dictionary of known phrases 2018-10-12 14:32:46 +13:00
Martin Johnson
d15a69813b update russian for mrz0047 2017-04-03 23:04:16 +12:00
Martin Johnson
3ade145261 add russian translations for mrz99 and mrz0047 2017-03-27 17:03:22 +13:00
Martin Johnson
08144fe341 update makefile 2017-03-25 17:13:14 +13:00
Martin Johnson
96817edfda updates 2017-03-24 23:36:23 +13:00
Martin Johnson
11230eb6ed allow parameters to recode 2017-03-24 23:05:22 +13:00
Martin Johnson
7d9fc63c51 Allow unicode utf8 chars in the translation. 2017-03-23 13:38:43 +13:00
Martin Johnson
80863dc1ae Add translations for mrz0047 and update recode so it doesn't need the original. 2017-03-22 16:20:00 +13:00
Martin Johnson
50106cff5e update the packed images 2017-02-07 12:41:06 +13:00
18 changed files with 27061 additions and 156 deletions

7
.travis.yml Normal file
View File

@ -0,0 +1,7 @@
language: c
script:
- make
#before_install:
# - sudo apt install libunistring-dev

View File

@ -1,7 +1,23 @@
all: decode recode recode110 extractbmp makever fixbmpheader CFLAGS=-std=c99
all: decode recode extractbmp makever fixbmpheader
decode: decode:
recode: recode: recode.c
recode110: gcc recode.c -o recode -l unistring
translate: translate.c
gcc translate.c -o translate -l unistring
extractbmp: extractbmp:
makever: makever:
fixbmpheader: fixbmpheader:
clean:
rm -f fixbmpheader extractbmp recode decode makever
trans: PF090JPJPN.LNG PF110JPJPN.LNG PF090JPJPN_0047.LNG PF090JPJPN_0047_RU.LNG PF090JPJPN_RU.LNG
PF090JPJPN.LNG: translated.txt recode
./recode translated.txt PF090JPJPN.LNG
PF110JPJPN.LNG: translated_110.txt recode
./recode translated_110.txt PF110JPJPN.LNG
PF090JPJPN_0047.LNG: translated_0047.txt recode
./recode translated_0047.txt PF090JPJPN_0047.LNG
PF090JPJPN_0047_RU.LNG: translated_0047_ru.txt recode
./recode translated_0047_ru.txt PF090JPJPN_0047_RU.LNG
PF090JPJPN_RU.LNG: translated_ru.txt recode
./recode translated_ru.txt PF090JPJPN_RU.LNG

Binary file not shown.

Binary file not shown.

View File

@ -18,17 +18,22 @@ int main(int argc,char *argv[]) {
offset=0; offset=0;
fread(&offset, 2, 1, f); fread(&offset, 2, 1, f);
offset=offset*2+0x40; offset=offset*2+0x40;
next=0; /* next=0;
fread(&next, 2, 1, f); fread(&next, 2, 1, f);
next=next*2+0x40; next=next*2+0x40;
*/
ch=1; ch=1;
putchar('"'); putchar('"');
putchar(0); putchar(0);
fseek(f,offset,SEEK_SET); fseek(f,offset,SEEK_SET);
while(offset<next-2) { int ch1=1;
while(1) {
fread(&ch,1,1,f); fread(&ch,1,1,f);
offset++; fread(&ch1,1,1,f);
if(ch==0 && ch1==0)
break;
putchar(ch&255); putchar(ch&255);
putchar(ch1&255);
} }
putchar('"'); putchar('"');
putchar(0); putchar(0);

Binary file not shown.

111
recode.c
View File

@ -1,36 +1,47 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <unistr.h>
#include <stdlib.h>
void readstring(FILE *f, char *p) { void readstring(FILE *f, char *p) {
char c; char c;
c=fgetc(f); c=fgetc(f);
if(c!='\"') if(feof(f)) return;
puts("ERRRRRRRR"); if(c!='\"') {
puts("ERROR: mismatched quotes");
exit(1);
}
while((c=fgetc(f))!='"' && !feof(f)) while((c=fgetc(f))!='"' && !feof(f))
*p++=c; *p++=c;
*p++=0; *p++=0;
while((c=fgetc(f))!=10 && !feof(f)); // c=fgetc(f);
if((c=fgetc(f))!=10 && !feof(f)) {
puts("ERROR: mismatched quotes");
exit(1);
}
} }
unsigned short crc16(const unsigned char *data, int len) { unsigned short crc16(const unsigned char *data, int len) {
unsigned short crc = 0xFFFF; unsigned short crc = 0xFFFF;
int i; int i;
if (len) do { if (len) do {
crc ^= *data++; crc ^= *data++;
for (i=0; i<8; i++) { for (i=0; i<8; i++) {
if (crc & 1) crc = (crc >> 1) ^ 0x8408; if (crc & 1) crc = (crc >> 1) ^ 0x8408;
else crc >>= 1; else crc >>= 1;
} }
} while (--len); } while (--len);
return(~crc); return(~crc);
} }
int main(int argc,char *argv[]) { int main(int argc,char *argv[]) {
char data[200000]; char data[200000];
char st[10240]; char st[1024];
short st_u16[1024];
char *infile="translated.txt",*outfile="PF090JPJPN.LNG";
FILE *f,*g; FILE *f,*g;
int i; int i;
unsigned *id=(unsigned *) data; unsigned *id=(unsigned *) data;
id[0]=0xa55a5aa5; id[0]=0xa55a5aa5;
id[1]=0x01000001; id[1]=0x01000001;
id[2]=0x39304650; id[2]=0x39304650;
@ -48,52 +59,55 @@ int main(int argc,char *argv[]) {
id[14]=0xaaaaaaaa; id[14]=0xaaaaaaaa;
id[15]=0xaaaaaaaa; id[15]=0xaaaaaaaa;
g=fopen("translated.txt","rb"); if(argc>1)
f=fopen("PF090JPENG.LNG","rb"); infile=argv[1];
if(argc>2)
outfile=argv[2];
g=fopen(infile,"rb");
int start=0x40; int start=0x40;
unsigned short *idx=(unsigned short *)(data+0x40); unsigned short *idx=(unsigned short *)(data+0x40);
fseek(f,0x40,SEEK_SET); short nstrings=0;
short nstrings;
int offset=0; int offset=0;
int next=0; int next=0;
short ch; short ch;
fread(&nstrings, 2, 1, f); while(!feof(g)) {
readstring(g,st);
// printf("%d %s\n",nstrings,st);
nstrings++;
}
nstrings+=2;
rewind(g);
nstrings=nstrings-3; nstrings=nstrings-3;
printf("Found %d strings\n",nstrings);
unsigned short *strptr=idx+nstrings; unsigned short *strptr=idx+nstrings;
int off=0x40+(nstrings+3)*2; int off=0x40+(nstrings+3)*2;
int ntrans=0; int ntrans=0;
char **strings=malloc(sizeof(char *)*nstrings);
for(i=0;i<nstrings;i++) { for(i=0;i<nstrings;i++) {
/*
fseek(f,0x40+i*2,SEEK_SET);
offset=0;
fread(&offset, 2, 1, f);
offset=offset*2+0x40;
next=0;
fread(&next, 2, 1, f);
next=next*2+0x40;
ch=1;
putchar('"');
fseek(f,offset,SEEK_SET);
while(offset<next-2) {
fread(&ch,2,1,f);
offset+=2;
putchar(ch&127);
}
putchar('"');
putchar(10);
*/
readstring(g,st); readstring(g,st);
puts(st); strings[i]=malloc(strlen(st)+1);
strcpy(strings[i],st);
int j;
for(j=0;j<i;j++)
if(!strcmp(st,strings[j]))
break;
if(j<i) {
idx[i]=idx[j];
} else {
// puts(st);
idx[i]=(off-0x40)/2; idx[i]=(off-0x40)/2;
if((off-0x40)/2>65535) if((off-0x40)/2>65535) {
printf("Error index too large %x\n",(off-0x40)/2); printf("ERROR: index too large %x\n",(off-0x40)/2);
int j=0; exit(1);
for(j=0;st[j]!=0;j++) {
data[off++]=st[j];
data[off++]=0;
} }
size_t sz=512;
u8_to_u16(st,strlen(st),(short *)(data+off),&sz);
off+=sz*2;
data[off++]=0; data[off++]=0;
data[off++]=0; data[off++]=0;
}
} }
idx[i]=(off-0x40)/2; idx[i]=(off-0x40)/2;
id[8]=off; id[8]=off;
@ -104,8 +118,9 @@ int main(int argc,char *argv[]) {
data[off++]=0x8d; // it doesn't seem to matter if it's wrong data[off++]=0x8d; // it doesn't seem to matter if it's wrong
id[6]=off; id[6]=off;
printf("%d strings\n",nstrings); printf("%d strings\n",nstrings);
f=fopen("PF090JPJPN.LNG","wb"); f=fopen(outfile,"wb");
fwrite(data,off,1,f); fwrite(data,off,1,f);
fclose(f); fclose(f);
return(0);
} }

View File

@ -1,98 +0,0 @@
#include <stdio.h>
#include <string.h>
void readstring(FILE *f, char *p) {
char c;
c=fgetc(f);
if(c!='\"')
puts("ERRRRRRRR");
while((c=fgetc(f))!='"' && !feof(f))
*p++=c;
*p++=0;
while((c=fgetc(f))!=10 && !feof(f));
}
int main(int argc,char *argv[]) {
char data[200000];
char st[10240];
FILE *f,*g;
int i;
unsigned *id=(unsigned *) data;
id[0]=0xa55a5aa5;
id[1]=0x01000001;
id[2]=0x39304650;
id[3]=0x45504a30;
id[4]=0;
id[5]=0;
id[6]=0;// len
id[7]=0x40;
id[8]=0;//last
id[9]=0xaaaaaa02;
id[10]=0xaaaaaaaa;
id[11]=0xaaaaaaaa;
id[12]=0xaaaaaaaa;
id[13]=0xaaaaaaaa;
id[14]=0xaaaaaaaa;
id[15]=0xaaaaaaaa;
g=fopen("translated_110.txt","rb");
f=fopen("PF110JPJPN.LNG","rb");
int start=0x40;
unsigned short *idx=(unsigned short *)(data+0x40);
fseek(f,0x40,SEEK_SET);
short nstrings;
int offset=0;
int next=0;
short ch;
fread(&nstrings, 2, 1, f);
nstrings=nstrings-3;
unsigned short *strptr=idx+nstrings;
int off=0x40+(nstrings+3)*2;
int ntrans=0;
for(i=0;i<nstrings;i++) {
fseek(f,0x40+i*2,SEEK_SET);
offset=0;
fread(&offset, 2, 1, f);
offset=offset*2+0x40;
next=0;
fread(&next, 2, 1, f);
next=next*2+0x40;
ch=1;
putchar('"');
fseek(f,offset,SEEK_SET);
while(offset<next-2) {
fread(&ch,2,1,f);
offset+=2;
putchar(ch&127);
}
putchar('"');
putchar(10);
readstring(g,st);
puts(st);
idx[i]=(off-0x40)/2;
if((off-0x40)/2>65535)
printf("Error index too large %x\n",(off-0x40)/2);
int j=0;
for(j=0;st[j]!=0;j++) {
data[off++]=st[j];
data[off++]=0;
}
data[off++]=0;
data[off++]=0;
}
idx[i]=(off-0x40)/2;
id[8]=off;
strcpy(data+off,"RG_VOICE_DATA");
off+=strlen("RG_VOICE_DATA");
data[off++]=0xf1; // this looks like a checksum at the end of the file but
data[off++]=0x8d; // it doesn't seem to matter if it's wrong
id[6]=off;
printf("%d strings\n",nstrings);
f=fopen("PF110JPJPN1.LNG","wb");
fwrite(data,off,1,f);
fclose(f);
}

186
translate.c Normal file
View File

@ -0,0 +1,186 @@
#include <stdio.h>
#include <string.h>
#include <unistr.h>
#include <stdlib.h>
#define MAX_STRING_LENGTH 2048
#define MAX_STRINGS 8192
void readstring(FILE *f, char *p) {
char c;
int i;
char *op=p;
c=fgetc(f);
if(feof(f)) return;
if(c!='\"') {
puts("ERROR: mismatched quotes");
exit(1);
}
for(i=0;i<MAX_STRING_LENGTH;i++) {
p[i]=fgetc(f);
if(i>0 && p[i]<15 && p[i-1]==34)
break;
}
if(i>0)
p[i-1]=0;
c=p[i];
if(c==13)
c=fgetc(f);
if(c!=10 && !feof(f)) {
printf("ERROR: mismatched eol quotes %d %s\n",c, op);
}
// printf("read(%s)\n",op);
}
unsigned short crc16(const unsigned char *data, int len) {
unsigned short crc = 0xFFFF;
int i;
if (len) do {
crc ^= *data++;
for (i=0; i<8; i++) {
if (crc & 1) crc = (crc >> 1) ^ 0x8408;
else crc >>= 1;
}
} while (--len);
return(~crc);
}
int nstrings=0;
char **original=0;
char **translation=0;
void load_dictionary(char *untran,char *tran) {
FILE *f,*g;
if(original==0) {
original=malloc(MAX_STRINGS*sizeof(char *));
translation=malloc(MAX_STRINGS*sizeof(char *));
}
g=fopen(untran,"rb");
f=fopen(tran,"rb");
char st[MAX_STRING_LENGTH],st1[MAX_STRING_LENGTH];
int j;
while(!feof(g)) {
readstring(g,st);
readstring(f,st1);
printf("[%s -> %s]\n",st,st1);
for(j=0;j<nstrings;j++)
if(!strcmp(st,original[j]))
break;
if(j==nstrings) {
original[j]=malloc(strlen(st)+1);
translation[j]=malloc(strlen(st1)+1);
strcpy(original[j],st);
strcpy(translation[j],st1);
nstrings++;
}// else printf("Done Already %d\n",nstrings);
}
}
char *get_translation(char *s) {
int j;
for(j=0;j<nstrings;j++)
if(!strcmp(s,original[j]))
return translation[j];
printf("%s could not be translated\n",s);
return s;
}
int main(int argc,char *argv[]) {
char data[200000];
char st[MAX_STRING_LENGTH];
short st_u16[MAX_STRING_LENGTH];
char *infile="untranslated.txt",*outfile="PF090JPJPN.LNG";
FILE *f,*g;
int i;
unsigned *id=(unsigned *) data;
id[0]=0xa55a5aa5;
id[1]=0x01000001;
id[2]=0x39304650;
id[3]=0x45504a30;
id[4]=0;
id[5]=0;
id[6]=0;// len
id[7]=0x40;
id[8]=0;//last
id[9]=0xaaaaaa02;
id[10]=0xaaaaaaaa;
id[11]=0xaaaaaaaa;
id[12]=0xaaaaaaaa;
id[13]=0xaaaaaaaa;
id[14]=0xaaaaaaaa;
id[15]=0xaaaaaaaa;
if(argc>1)
infile=argv[1];
if(argc>2)
outfile=argv[2];
g=fopen(infile,"rb");
int start=0x40;
unsigned short *idx=(unsigned short *)(data+0x40);
short nstrings=0;
int offset=0;
int next=0;
short ch;
load_dictionary("untranslated_090.txt","translated_090.txt");
load_dictionary("untranslated_110.txt","translated_110.txt");
while(!feof(g)) {
readstring(g,st);
// printf("%d %s\n",nstrings,st);
nstrings++;
}
nstrings+=2;
rewind(g);
nstrings=nstrings-3;
printf("Found %d strings\n",nstrings);
unsigned short *strptr=idx+nstrings;
int off=0x40+(nstrings+3)*2;
int ntrans=0;
char *tr;
char **strings=malloc(sizeof(char *)*nstrings);
for(i=0;i<nstrings;i++) {
readstring(g,st);
tr=get_translation(st);
printf("%s -> %s\n",st,tr);
strings[i]=malloc(strlen(tr)+1);
strcpy(strings[i],tr);
int j;
for(j=0;j<i;j++)
if(!strcmp(tr,strings[j]))
break;
if(j<i) {
idx[i]=idx[j];
} else {
// puts(st);
idx[i]=(off-0x40)/2;
if((off-0x40)/2>65535) {
printf("ERROR: index too large %x\n",(off-0x40)/2);
exit(1);
}
size_t sz=512;
u8_to_u16(tr,strlen(tr),(short *)(data+off),&sz);
off+=sz*2;
data[off++]=0;
data[off++]=0;
}
}
idx[i]=(off-0x40)/2;
id[8]=off;
strcpy(data+off,"RG_VOICE_DATA");
off+=strlen("RG_VOICE_DATA");
data[off++]=0xf1; // this looks like a checksum at the end of the file but
data[off++]=0x8d; // it doesn't seem to matter if it's wrong
id[6]=off;
printf("%d strings\n",nstrings);
f=fopen(outfile,"wb");
fwrite(data,off,1,f);
fclose(f);
return(0);
}

View File

@ -12,8 +12,8 @@
"" ""
"Destination" "Destination"
"Configuration" "Configuration"
"communication" "Communication"
"info" "Info"
"Configuration" "Configuration"
"Edit" "Edit"
"Destination" "Destination"
@ -24,7 +24,7 @@
"Surroundings" "Surroundings"
"Registered" "Registered"
"Search history" "Search history"
"Return Home" "Home"
"Root erase" "Root erase"
"Info" "Info"
"Congestion info" "Congestion info"

4365
translated_0047.txt Normal file

File diff suppressed because it is too large Load Diff

4365
translated_0047_ru.txt Normal file

File diff suppressed because it is too large Load Diff

4352
translated_090.txt Normal file

File diff suppressed because it is too large Load Diff

View File

@ -4246,7 +4246,7 @@ OK?"
"Connection fees will occur. OK?" "Connection fees will occur. OK?"
"Using data %s "Using data %s
%s %s
%s" %s"
"Data version" "Data version"
"display" "display"
"Delete" "Delete"
@ -4538,3 +4538,69 @@ Call %s?"
"No" "No"
"Delete probe, OK?" "Delete probe, OK?"
"AUX Volume with FM ref" "AUX Volume with FM ref"
"menu"
"This screen will not be displayed."
"Startup lock setting"
"When replacing the battery"
"When the engine switch is on"
"Not set"
"-"
"Password authentication timing"
"Change Password"
"When ON is selected,
A password input screen is displayed each time."
"Password changed."
"Please enter a new password."
"For confirmation, please re-enter the same password
Please enter. "
"Passwords do not match.
Please try again from the beginning. "
"Set startup lock.
Please enter the password.
* When setting for the first time
Please enter your initial password. "
"The password is in correct.
Letters of the alphabet are
Please check whether it is wrong. "
"Change Password"
"Password confirmation"
"The activation lock is on."
"Failed to unlock.
Whether the upper and lower case letters of the alphabet are incorrect
please confirm. "
"Reset the internal memory to the factory default settings.
Data such as registered location and password etc.
All setting contents are erased. Is it OK? "
"Password authentication"
"Startup lock setting"
"Destination search"
"(Outing Menu)"
"Data excluding home such as registered places and history,
The setting is deleted. Is it OK? "
"Data including registered places and history including home,
The setting is deleted. Is it OK? "
"Latitude longitude (Japan geodetic system)"
"Latitude and longitude (world geodetic system)"
"Northern latitude %c%c.%c%c%c%c%c%c degree east longitude %c%c%c.%c%c%c%c%c%c degrees"
"Degree input"
"Degrees minute and second"
"Datum"
"Data used%s
[Map data:%s]
[Search data:%s]
Model information Corporate model B1 "
"Data used%s
[Map data:%s]
[Search data:%s]
Model information Corporate model B2 "
"Data used%s
[Map data:%s]
[Search data:%s]
Model information Corporate model B3 "
"Data used%s
[Map data:%s]
[Search data:%s]
Model information Corporate model B4 "
"I did a route search without considering time regulation.
Please follow the actual road signs. "
"Destination search"

4352
translated_ru.txt Normal file

File diff suppressed because it is too large Load Diff

4534
untranslated_090.txt Normal file

File diff suppressed because it is too large Load Diff

4740
untranslated_110.txt Normal file

File diff suppressed because it is too large Load Diff

BIN
updated/b225.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 KiB