Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stringtable: rapify #842

Merged
merged 7 commits into from
Dec 13, 2024
Merged

stringtable: rapify #842

merged 7 commits into from
Dec 13, 2024

Conversation

PabstMirror
Copy link
Collaborator

@PabstMirror PabstMirror commented Dec 3, 2024

"Binerize" stringtable.xml to stringtable.bin

struct XmlbLayout {
    //  4 byte numbers, little end?, nul term strings
    header: Vec<u8>,            // Version
    languages: Vec<u8>,         // Language Count, [Languages]
    offsets: Vec<u8>,           // Offset Count, [Offsets]
    keys: Vec<u8>,              // Key Count, [Keys]
    translations: Vec<Vec<u8>>, // [Translation Count, [Translations], ...] (size may be less than lang count)
  • All possible languages have to be in the list or the user gets nothing (there is no fallback)
  • The number of translation arrays can be less (e.g. just one) so we aren't wasting size
  • If a stringtable doesn't have a good "default" language (e.g. just Dutch/Chinese) we'll just skip it

Copy link

codecov bot commented Dec 3, 2024

Codecov Report

Attention: Patch coverage is 77.56410% with 35 lines in your changes missing coverage. Please review.

Project coverage is 67.0%. Comparing base (b0fa7c3) to head (f189506).
Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
libs/stringtable/src/rapify.rs 79.3% 30 Missing ⚠️
bin/src/modules/stringtables/mod.rs 0.0% 5 Missing ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
libs/stringtable/src/key.rs 98.8% <100.0%> (+85.7%) ⬆️
libs/stringtable/src/lib.rs 92.5% <ø> (+2.7%) ⬆️
bin/src/modules/stringtables/mod.rs 42.8% <0.0%> (-2.0%) ⬇️
libs/stringtable/src/rapify.rs 79.3% <79.3%> (ø)

... and 16 files with indirect coverage changes

all_translations[index].push(english.into());
} else {
// If we don't have some kind of default value to use, we should just not do the conversion
return false;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BI's binarizer places an empty string here.
But for HEMTT its definitely better if it complains, but it should say where the missing string is? Probably the stringtable linter already does that?

libs/stringtable/src/rapify.rs Outdated Show resolved Hide resolved
libs/stringtable/src/rapify.rs Outdated Show resolved Hide resolved
libs/stringtable/src/rapify.rs Outdated Show resolved Hide resolved
@BrettMayson
Copy link
Owner

BrettMayson commented Dec 12, 2024

Anything outstanding here? (Ready to not be a draft?)

@PabstMirror PabstMirror marked this pull request as ready for review December 12, 2024 19:01
@PabstMirror
Copy link
Collaborator Author

I think it's ready

if someone has a stringtable that's just Dutch/Chinese we'll just skip it
this should ensure that binned stringtable always work exactly the same as non-binned
IMHO this doesn't need to be a warning

@BrettMayson BrettMayson merged commit 6fc5a80 into main Dec 13, 2024
37 checks passed
@BrettMayson BrettMayson deleted the stringbin branch December 13, 2024 01:39
@PabstMirror
Copy link
Collaborator Author

this breaks escaped symbols like &apos; &amp; &quot; &lt; &gt; &#...;
localize "STR_ACE_Arsenal_statVisionMode_intPrimTi"= "Thermal &amp; Primary integrated"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants