-
Notifications
You must be signed in to change notification settings - Fork 44
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
Fixes for Portuguese Carmageddon #353
Conversation
A possibly related problem: the French version of Carmageddon has text file translations in which accentuated characters over ASCII value 127 are used. This is clearly a mistake from the translator as no corresponding glyphs can represent these characters, but it makes an assertion fail in src/DETHRACE/common/utility.c in the GetALineWithNoPossibleService() function:
When ignoring the assertion, the game runs, but these characters are displayed as blank in the game messages (note that this is consistent with the DOS version). |
Using current dethrace master, I don't see glyph related issues with dethrace, using this French game data from archive.org. (I see a crash on Linux because the audio backend cannot handle audio files with wrong cases) |
French Carmageddon provides DATA/SOUND/fyeah1.WAV where it expects DATA/SOUND/FYEAH1.WAV
The last commit fixes the crash due to some French audio files having a wrong casing. |
Don't you see missing characters in the menu dialogs where accentuated
characters should be used ?
https://freeimage.host/i/J7zfjYQ
On my version, accentuated characters are missed out, and the
"unbreakable space" used by the translator before colons (such as in
"xxx<here>: yyy" yields a black block. Another character provokes a
carriage return and sometimes a crash.
If you don't see such things, then I guess there were several releases
of the game in french and I have an early one...
… Message ID: ***@***.***>
|
I was wrong, the |
Good point. But there's more to it than just this occurence.
See for example DATA/RACES.TXT line 102 (fourth race)
situation<A0>: mine du
canyon du diable
This will display a black block instead of the non-breakable space.
And other characters in other places... As soon as the character gets
over 0x80 it's likely to not be rendered correctly.
… Message ID: ***@***.***>
|
I see the missing whitespace before the colon for the 4th race. |
TBH I don’t care as I already patched all my French data files. I was just reporting the problem as it’s something I’ve come across and I thought other people would encounter too.
Anyway, defaulting a character to a space (or to nothing) and emitting a console warning when it’s not among the drawable glyphs of the selected font is a quick fix, and would improve the robustness of the app. That’s the way I’d choose in my own code.
|
Printing a warning is not unreasonable, but we need to be careful to not spam the console. |
src/BRSRC13/CORE/FW/datafile.c
Outdated
cp = BrScratchString(); | ||
int a = BrFileGetLine(cp, 256, df->h); | ||
a = BrFileGetLine(cp, 256, df->h); | ||
(void)a; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this doing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I silences a warning about setting a variable, but not using it.
It's probably better to just remove the a =
thing.
@@ -672,6 +672,9 @@ void StripControls(unsigned char* pStr) { | |||
if (pStr[i] < ' ') { | |||
memmove(&pStr[i], &pStr[i + 1], (len - i) * sizeof(char)); | |||
len--; | |||
#ifdef DETHRACE_FIX_BUGS | |||
i--; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what behavior does this fix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes StripControls
for localized Carmageddon.
e.g. the French version calls this function with the input [NON ATTRIB]\r\n
(for the key names in the controls menu).
When you remove the control character at location 12, in the next loop iteration the length of the string is reduced by 1, but you need to also retest the same i
index (because it now contains the next character).
Without the fix, this function returns [NON ATTRIB]\n
instead of [NON ATTRIB]
.
This results in the following:
Including this fix, the following options menu is displayed:
The actual behavior is undefined, since the address sanitizer triggers due to buffer overflow.
Co-authored-by: Dethrace Engineering Department <78985374+dethrace-labs@users.noreply.github.com>
The Portuguese Carmageddon segfaulted because its character set caused signed characters to access out-of-bounds memory.
I also added a few fixes for warnings/errors seen in rec2.
Fixes #352