genlang: More fixes

rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]>
Newsgroups gmane.comp.systems.archos.rockbox.cvs
Message-ID <[email protected]>
commit 98a182a19fcec2a998fe98d9dc9d330c7e1b16b2
Author: Solomon Peachy <[email protected]>
Date:   Thu Jan 8 08:17:20 2026 -0500

    genlang:  More fixes
    
     * "english.list" started the VOICE_* enumeration at the wrong number
     * vstrings file had the wrong string count
    
    There is still one remaining issue; Currently the vstrings header is
    generated with a section size that is consistently 6 bytes shorter than
    the actual data. However, the non-voice .lng file has correct size.
    
    Change-Id: I01f9622399cf3f3ac4c62ddea1deeb19a7b028ba

diff --git a/tools/genlang b/tools/genlang
index 378ed7c154..95dfaddfbc 100755
--- a/tools/genlang
+++ b/tools/genlang
@@ -214,7 +214,7 @@ sub readenglish {
     # do it before we read the translated file.
 
     my @idnum = ((0));       # start with a true number
-    my @vidnum = ((0x8000)); # first voice id
+    my @vidnum = ((0x8001)); # first voice id
 
     if ($binary and file_is_newer("$binpath/english.list", $english)) {
         open(ENG, "<$binpath/english.list") ||
@@ -256,7 +256,6 @@ sub readenglish {
                     # Assign an ID number to this entry
                     $idmap[$user]{$id}=$idnum[$user];
                     $idnum[$user]++;
-   #                 print STDERR "DEST: bumped idnum to $idnum[$user]\n";
                 }
 
                 # this is the end of a phrase, add it to the english hash
@@ -624,21 +623,25 @@ elsif($binary || $binvoice) {
 	    my $sizeb = 0;
 	    for $n (0 .. $idcount[$_]-1) {
 		$sizeb += length(trim($dest{$idnum[$_][$n]})) + 1;
-	    }
-
+            }
             printf OUTF ("%c%c%c%c%c%c", ($idcount[$_] >> 8), ($idcount[$_] & 0xff),
 			 ($sizeb >> 8), ($sizeb & 0xff), ($foffsetb >> 8), ($foffsetb & 0xff));
 	    $foffsetb += $sizeb;
         }
         if($binvoice) {
 	    my $sizev = 0;
+	    my $count = 0;
+
+	    # All LANG_* and all VOICE_*
 	    for $n (0 .. $idcount[$_]-1) {
 		$sizev += length(trim($voice{$idnum[$_][$n]})) + 1;
+		$count++;
 	    }
 	    for $n (0x8001 .. $voiceid[$_]-1) {
 		$sizev += length(trim($voice{$idnum[$_][$n]})) + 1;
+		$count++;
 	    }
-            printf OUTV ("%c%c%c%c%c%c", ($idcount[$_] >> 8), ($idcount[$_] & 0xff),
+            printf OUTV ("%c%c%c%c%c%c", ($count >> 8), ($count & 0xff),
 			 ($sizev >> 8), ($sizev & 0xff), ($foffsetv >> 8), ($foffsetv & 0xff));
 	    $foffsetv += $sizev;
         }
-- 
rockbox-cvs mailing list
[email protected]
https://lists.haxx.se/mailman/listinfo/rockbox-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.