@@ -364,6 +364,69 @@ uint32_t Mod::pauseArtAttackTimer()
364
364
return mPFN_scissor_timer_main_trampoline ();
365
365
}
366
366
367
+ void performRELPatches ()
368
+ {
369
+ // Only run during screen transitions
370
+ if (!checkForSpecificSeq (ttyd::seqdrv::SeqIndex::kMapChange ))
371
+ {
372
+ return ;
373
+ }
374
+
375
+ // Make sure a REL file is currently loaded
376
+ uint32_t Current_REL_Loaded_Pointer = *reinterpret_cast <uint32_t *>(
377
+ *reinterpret_cast <uint32_t *>(GlobalWorkPointer) + 0x15C );
378
+
379
+ if (Current_REL_Loaded_Pointer == 0 )
380
+ {
381
+ return ;
382
+ }
383
+
384
+ #ifdef TTYD_US
385
+ const uint32_t LAS = 0x10 ;
386
+ const uint32_t SQ_Cutscene_Spawn_Textboxes_Script_Offset = 0x36FBC ;
387
+ const uint32_t SQ_Cutscene_Spawn_Textboxes_Script_Loop_Offset = 0x64 ;
388
+ const uint32_t SQ_Cutscene_Spawn_Textboxes_Script_WaitMS_Offset = 0x114 ;
389
+ #elif defined TTYD_JP
390
+ const uint32_t LAS = 0x11 ;
391
+ const uint32_t SQ_Cutscene_Spawn_Textboxes_Script_Offset = 0x36FC0 ;
392
+ const uint32_t SQ_Cutscene_Spawn_Textboxes_Script_Loop_Offset = 0x58 ;
393
+ const uint32_t SQ_Cutscene_Spawn_Textboxes_Script_WaitMS_Offset = 0xD4 ;
394
+ #elif defined TTYD_EU
395
+ const uint32_t LAS = 0x11 ;
396
+ const uint32_t SQ_Cutscene_Spawn_Textboxes_Script_Offset = 0x36FBC ;
397
+ const uint32_t SQ_Cutscene_Spawn_Textboxes_Script_Loop_Offset = 0x64 ;
398
+ const uint32_t SQ_Cutscene_Spawn_Textboxes_Script_WaitMS_Offset = 0x114 ;
399
+ #endif
400
+
401
+ uint32_t CurrentREL = *reinterpret_cast <uint32_t *>(Current_REL_Loaded_Pointer);
402
+ switch (CurrentREL)
403
+ {
404
+ case LAS:
405
+ {
406
+ if (compareStringToNextMap (" las_29" ))
407
+ {
408
+ // Make changes to the function that spawns the textboxes, to prevent the standard heap from being corrupted
409
+ // Change the loop count from 10 to 5
410
+ *reinterpret_cast <uint32_t *>(
411
+ Current_REL_Loaded_Pointer +
412
+ SQ_Cutscene_Spawn_Textboxes_Script_Offset +
413
+ SQ_Cutscene_Spawn_Textboxes_Script_Loop_Offset) = 5 ;
414
+
415
+ // Wait for 400ms instead of 200ms at the end of the loop
416
+ *reinterpret_cast <uint32_t *>(
417
+ Current_REL_Loaded_Pointer +
418
+ SQ_Cutscene_Spawn_Textboxes_Script_Offset +
419
+ SQ_Cutscene_Spawn_Textboxes_Script_WaitMS_Offset) = 400 ;
420
+ }
421
+ return ;
422
+ }
423
+ default :
424
+ {
425
+ return ;
426
+ }
427
+ }
428
+ }
429
+
367
430
void addTextToHeapArray (char *text)
368
431
{
369
432
char *tempHeapBuffer = HeapBuffer;
@@ -692,6 +755,9 @@ void Mod::run()
692
755
displayStickAngle ();
693
756
displayMemoryWatches ();
694
757
758
+ // Perform any necessaery REL patches
759
+ performRELPatches ();
760
+
695
761
// Check the heaps
696
762
checkHeaps ();
697
763
}
0 commit comments