Code fixes/edits to the previous commit

* nonEngLang didn't get set when using Mash's HRP.
This commit is contained in:
NovaRain
2025-08-27 10:33:25 +08:00
parent 6f5ebe76fc
commit 0b6a058dff
2 changed files with 10 additions and 17 deletions
+7 -16
View File
@@ -577,15 +577,6 @@ artNotExist:
}
}
static __declspec(naked) void game_splash_screen_hack() {
__asm {
mov nonEngLang, 1;
// overwritten engine code
mov ecx, [esp + 0xA4 - 0x24 + 4];
retn;
}
}
static __declspec(naked) void game_splash_screen_hook() {
__asm {
call fo::funcoffs::db_fopen_;
@@ -614,7 +605,7 @@ noFile:
static fo::DbFile* __fastcall LoadFont(const char* font, const char* mode) {
char file[128];
const char* lang;
if (fo::func::get_game_config_string(&lang, "system", "language") && nonEngLang) {
if (fo::func::get_game_config_string(&lang, "system", "language")) {
std::sprintf(file, "fonts\\%s\\%s", lang, font);
return fo::func::db_fopen(file, mode);
}
@@ -623,16 +614,18 @@ static fo::DbFile* __fastcall LoadFont(const char* font, const char* mode) {
static __declspec(naked) void load_font_hook() {
__asm {
mov ebp, edx;
mov ebx, eax;
mov ebp, edx; // keep mode
mov ebx, eax; // keep font
cmp nonEngLang, 0;
je default;
mov ecx, eax;
call LoadFont;
test eax, eax;
jz default;
retn;
default:
mov edx, ebp;
mov eax, ebx;
mov edx, ebp; // mode
mov eax, ebx; // font
jmp fo::funcoffs::db_fopen_;
}
}
@@ -708,8 +701,6 @@ void LoadOrder::init() {
MakeCall(0x47FB80, SlotMap2Game_hack); // load game
MakeCall(0x47FBBF, SlotMap2Game_hack_attr, 1);
// Set sfall global boolean if the game language is not English
MakeCall(0x4443F2, game_splash_screen_hack, 2);
// Load splash screens from the default path if not found in the art\<language>\splash\ directory
HookCall(0x44444E, game_splash_screen_hook);
+3 -1
View File
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "IniReader.h"
#include "main.h"
#include "Translate.h"
@@ -57,6 +57,8 @@ static void MakeLangTranslationPath(const char* config) {
IniReader::GetString("system", "language", "english", language, 32, fileConfig);
IniReader::GetString("system", "master_patches", "data", patches, 65, fileConfig);
nonEngLang = (_stricmp(language, "english") != 0); // check if the game language is non-English
const char* iniDef = translationIni.def;
while (*iniDef == '\\' || *iniDef == '/' || *iniDef == '.') iniDef++; // skip first characters
sprintf(translationIni.lang, "%s\\text\\%s\\%s", patches, language, iniDef);