Jump to content
AVIC411.com

printing strings from language (.LNG) files


Recommended Posts

wrote a script to dump strings out from the various LNG (language) files. (Still in progress - but functional)

This prints the hex "index" along with the string. Some (most?) strings are referenced by calling AL_SystemLanguage::GetString(int, char* &), where index of the string is first arg (R1) passed. Frequently in the code, this is passed by OR'ing two parts together, e.g.:

MOV R2, #0xb00

ORR R1, R2, #0x23

to get 0xb23

 

You can then look up strings:

 

./printstrings.pl EUGBENG.LNG | grep ^0b23
0b23: Call <name><type>

 

 

currently im looking for the strings that populate system menu with 017b. I think it's possible to enable the safemode on/off switch in settings menu (aka soft-PKB-mod) of UC devices.

The problem, is that at least frequently, R1 is passed in from some calling routine, or many levels up, or from a memory location. (still working on mapping out the SetupBKUP.dat map ;)

 

 

./printstrings.pl EUGBENG.LNG |grep ^017
0170: None
0171: Delete
0172: Settings Menu
0173: Navi Settings
0174: System Settings
0175: AV Settings
0176: AV Sound
0177: Map Settings
0178: Bluetooth Settings
0179: Setting Replicator
017a: Screen Off
017b: Safe Mode
017c: On
017d: Off
017e: MSN Direct
017f: Gas Prices

 

 

update:

Anyhow - found where "Safe Mode" switch in menu is disabled/enabled - yay!

Now onto that pesky "Caution" screen... I suspect it will be trickier to find...

 


# usage: printstrings.pl LANGFILE.LNG

my $filename = shift;
open(my $fh, $filename) or die $!;
binmode($fh);

my $cnt = 0;
my @mapkeys;
my $strlen;
my $stroffset;

# skip header
seek($fh, 0x40, 0);

# loop through map
while ( read($fh, my $bytes, 4) )
{
$currdword = unpack('L*', $bytes);
if ($cnt == 0)
{
$prevdword = $currdword;
$start = $currdword;
$cnt++;
next;
}
$stroffset = ($prevdword - $start) * 2;
$strlen = ($currdword - $prevdword) * 2;
$cnt++;
$prevdword = $currdword;
push @mapkeys, $stroffset;
if ( $currdword == 0 )
{
last;
}
}

# skip null dword marker?
seek($fh, 4, 1);

# loop through strings
my $strcnt = 0;
my $strout = "";
while ( read($fh, my $word, 2))
{
$char = unpack ('U*', $word);
if ($char != 0x0)
{
$strout = $strout . chr($char);
}
else
{
# end of string, print out
printf("%4.4x: %-.80s\n", $strcnt, $strout);
$strcnt++;
$strout = "";
}
}

close $fh;

Edited by pionara
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...