@@ -443,57 +443,91 @@ bool Mod::performRelPatches(gc::OSModule::OSModuleInfo *newModule, void *bss)
443
443
return Result;
444
444
}
445
445
446
- // Make sure a REL file is currently loaded
447
- gc::OSModule::OSModuleInfo *CurrentRelModuleInfo = getCurrentRelModuleInfo ();
448
- if (!CurrentRelModuleInfo)
449
- {
450
- return Result;
451
- }
452
-
453
446
#ifdef TTYD_US
454
- const uint32_t LAS = 0x10 ;
455
- const uint32_t SQ_Cutscene_Spawn_Textboxes_Script_Offset = 0x36FBC ;
456
- const uint32_t SQ_Cutscene_Spawn_Textboxes_Script_Loop_Offset = 0x64 ;
457
- const uint32_t SQ_Cutscene_Spawn_Textboxes_Script_WaitMS_Offset = 0x114 ;
447
+ // BOM
448
+ constexpr uint32_t minnnanokoe_evt_bom_Offset = 0xD2FC ;
449
+ constexpr uint32_t minnnanokoe_evt_bom_WaitMS_Offset = 0x674 ;
450
+
451
+ // LAS
452
+ constexpr uint32_t last_evt_3_2_Offset = 0x36FBC ;
453
+ constexpr uint32_t last_evt_3_2_Loop_Offset = 0x64 ;
454
+ constexpr uint32_t last_evt_3_2_WaitMS_Offset = 0x114 ;
455
+
456
+ // MRI
457
+ constexpr uint32_t minnnanokoe_evt_mri_Offset = 0x2BE80 ;
458
+ constexpr uint32_t minnnanokoe_evt_mri_WaitMS_Offset = 0x968 ;
458
459
#elif defined TTYD_JP
459
- const uint32_t LAS = 0x11 ;
460
- const uint32_t SQ_Cutscene_Spawn_Textboxes_Script_Offset = 0x36FC0 ;
461
- const uint32_t SQ_Cutscene_Spawn_Textboxes_Script_Loop_Offset = 0x58 ;
462
- const uint32_t SQ_Cutscene_Spawn_Textboxes_Script_WaitMS_Offset = 0xD4 ;
460
+ // BOM
461
+ constexpr uint32_t minnnanokoe_evt_bom_Offset = 0xD2C4 ;
462
+ constexpr uint32_t minnnanokoe_evt_bom_WaitMS_Offset = 0x634 ;
463
+
464
+ // LAS
465
+ constexpr uint32_t last_evt_3_2_Offset = 0x36FC0 ;
466
+ constexpr uint32_t last_evt_3_2_Loop_Offset = 0x58 ;
467
+ constexpr uint32_t last_evt_3_2_WaitMS_Offset = 0xD4 ;
468
+
469
+ // MRI
470
+ constexpr uint32_t minnnanokoe_evt_mri_Offset = 0x2BA98 ;
471
+ constexpr uint32_t minnnanokoe_evt_mri_WaitMS_Offset = 0x968 ;
463
472
#elif defined TTYD_EU
464
- const uint32_t LAS = 0x11 ;
465
- const uint32_t SQ_Cutscene_Spawn_Textboxes_Script_Offset = 0x36FBC ;
466
- const uint32_t SQ_Cutscene_Spawn_Textboxes_Script_Loop_Offset = 0x64 ;
467
- const uint32_t SQ_Cutscene_Spawn_Textboxes_Script_WaitMS_Offset = 0x114 ;
473
+ // BOM
474
+ constexpr uint32_t minnnanokoe_evt_bom_Offset = 0xD35C ;
475
+ constexpr uint32_t minnnanokoe_evt_bom_WaitMS_Offset = 0x634 ;
476
+
477
+ // LAS
478
+ constexpr uint32_t last_evt_3_2_Offset = 0x36FBC ;
479
+ constexpr uint32_t last_evt_3_2_Loop_Offset = 0x64 ;
480
+ constexpr uint32_t last_evt_3_2_WaitMS_Offset = 0x114 ;
481
+
482
+ // MRI
483
+ constexpr uint32_t minnnanokoe_evt_mri_Offset = 0x2BE80 ;
484
+ constexpr uint32_t minnnanokoe_evt_mri_WaitMS_Offset = 0x968 ;
468
485
#endif
469
486
470
- uint32_t CurrentRelModuleInfoRaw = reinterpret_cast <uint32_t >(CurrentRelModuleInfo );
471
- switch (CurrentRelModuleInfo ->id )
487
+ uint32_t CurrentRelPtrRaw = reinterpret_cast <uint32_t >(newModule );
488
+ switch (newModule ->id )
472
489
{
473
- case LAS :
490
+ case ttyd::seq_mapchange::REL_ID::BOM :
474
491
{
475
- if (compareStringToNextMap (" las_29" ))
476
- {
477
- // Make changes to the function that spawns the textboxes, to prevent the standard heap from being corrupted
478
- // Change the loop count from 10 to 5
479
- *reinterpret_cast <uint32_t *>(
480
- CurrentRelModuleInfoRaw +
481
- SQ_Cutscene_Spawn_Textboxes_Script_Offset +
482
- SQ_Cutscene_Spawn_Textboxes_Script_Loop_Offset) = 5 ;
483
-
484
- // Wait for 400ms instead of 200ms at the end of the loop
485
- *reinterpret_cast <uint32_t *>(
486
- CurrentRelModuleInfoRaw +
487
- SQ_Cutscene_Spawn_Textboxes_Script_Offset +
488
- SQ_Cutscene_Spawn_Textboxes_Script_WaitMS_Offset) = 400 ;
489
- }
490
- return Result;
492
+ // Shadow Queen cutscene fix, just before 2nd fight
493
+ // Make changes to the script that spawns the textboxes, to prevent the standard heap from being corrupted
494
+ // Wait 400ms instead of 300ms at the end of the loop
495
+ *reinterpret_cast <uint32_t *>(CurrentRelPtrRaw +
496
+ minnnanokoe_evt_bom_Offset + minnnanokoe_evt_bom_WaitMS_Offset) = 400 ;
497
+
498
+ break ;
499
+ }
500
+ case ttyd::seq_mapchange::REL_ID::LAS:
501
+ {
502
+ // Shadow Queen cutscene fix, just before 2nd fight
503
+ // Make changes to the script that spawns the textboxes, to prevent the standard heap from being corrupted
504
+ // Change the loop count from 10 to 5
505
+ *reinterpret_cast <uint32_t *>(CurrentRelPtrRaw +
506
+ last_evt_3_2_Offset + last_evt_3_2_Loop_Offset) = 5 ;
507
+
508
+ // Wait 400ms instead of 200ms at the end of the loop
509
+ *reinterpret_cast <uint32_t *>(CurrentRelPtrRaw +
510
+ last_evt_3_2_Offset + last_evt_3_2_WaitMS_Offset) = 400 ;
511
+
512
+ break ;
513
+ }
514
+ case ttyd::seq_mapchange::REL_ID::MRI:
515
+ {
516
+ // Shadow Queen cutscene fix, just before 2nd fight
517
+ // Make changes to the script that spawns the textboxes, to prevent the standard heap from being corrupted
518
+ // Wait 400ms instead of 300ms at the end of the loop
519
+ *reinterpret_cast <uint32_t *>(CurrentRelPtrRaw +
520
+ minnnanokoe_evt_mri_Offset + minnnanokoe_evt_mri_WaitMS_Offset) = 400 ;
521
+
522
+ break ;
491
523
}
492
524
default :
493
525
{
494
- return Result ;
526
+ break ;
495
527
}
496
528
}
529
+
530
+ return Result;
497
531
}
498
532
499
533
void clearHeapCorruptionBuffer ()
0 commit comments