@@ -585,6 +585,8 @@ __declspec(naked) void LoadOrder::art_get_name_hack() {
585585 }
586586}
587587
588+ // //////////////////////////////////////////////////////////////////////////////
589+
588590static __declspec (naked) void game_splash_screen_hook() {
589591 __asm {
590592 call fo::funcoffs::db_fopen_;
@@ -610,6 +612,58 @@ static __declspec(naked) void game_splash_screen_hook() {
610612 }
611613}
612614
615+ static DWORD hrpLoadRIX_func;
616+ static DWORD hrpLoadBMP_func;
617+
618+ static __declspec (naked) void game_splash_screen_hook_rix_HRP() {
619+ static DWORD retAddr;
620+ __asm {
621+ pop retAddr;
622+ call hrpLoadRIX_func;
623+ test al, al
624+ jnz end;
625+ add esp, 24 ;
626+ mov eax, [esp + 0x114 - 0x108 ]; // splash value
627+ push eax;
628+ push 0x5023E8 ; // "art\splash\"
629+ push 0x502404 ; // "%ssplash%d.rix"
630+ lea edx, [esp + 0x120 - 0x80 ]; // fullname
631+ push edx;
632+ call fo::funcoffs::sprintf_;
633+ lea eax, [esp + 0x124 - 0x80 ];
634+ push eax;
635+ push esi; // IMAGE8 data
636+ call hrpLoadRIX_func;
637+ end:
638+ jmp retAddr;
639+ }
640+ }
641+
642+ static __declspec (naked) void game_splash_screen_hook_bmp_HRP() {
643+ static const char * splashFmt = " %ssplash%d.bmp" ;
644+ static DWORD retAddr;
645+ __asm {
646+ pop retAddr;
647+ call hrpLoadBMP_func;
648+ test al, al
649+ jnz end;
650+ add esp, 24 ;
651+ mov eax, [esp + 0x114 - 0x108 ]; // splash value
652+ push eax;
653+ push 0x5023E8 ; // "art\splash\"
654+ push splashFmt;
655+ lea edx, [esp + 0x120 - 0x80 ]; // fullname
656+ push edx;
657+ call fo::funcoffs::sprintf_;
658+ lea eax, [esp + 0x124 - 0x80 ];
659+ push eax;
660+ push esi; // IMAGE8 data
661+ call hrpLoadBMP_func;
662+ end:
663+ jmp retAddr;
664+ }
665+ }
666+
613667static fo::DbFile* __fastcall LoadFont (const char * font, const char * mode) {
614668 char file[128 ];
615669 const char * lang;
@@ -711,6 +765,12 @@ void LoadOrder::init() {
711765
712766 // Load splash screens from the default path if not found in the art\<language>\splash\ directory
713767 HookCall (0x44444E , game_splash_screen_hook);
768+ if (HRP::Setting::VersionIsValid) { // for HRP 4.1.8
769+ hrpLoadRIX_func = HRP::Setting::GetAddress (0x1001A530 );
770+ hrpLoadBMP_func = HRP::Setting::GetAddress (0x1001A610 );
771+ HookCall (HRP::Setting::GetAddress (0x1001B0F6 ), game_splash_screen_hook_rix_HRP);
772+ HookCall (HRP::Setting::GetAddress (0x1001B0C5 ), game_splash_screen_hook_bmp_HRP);
773+ }
714774
715775 // Load fonts based on the game language
716776 HookCalls (load_font_hook, {
0 commit comments