Skip to content

Commit 0bb7636

Browse files
committed
Prevent crash with spawning items
The crash occurs specifically with boot and hammer upgrades. The game tries to play a cutscene to tell you about them. If you're not in the proper room for said cutscene, then the game crashes.
1 parent 4ca5bf1 commit 0bb7636

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

ttyd-tools/rel/include/mod.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ class Mod
109109
void spawnItem();
110110
uint8_t spawnItemNameCounter;
111111
bool spawnItemDisable = false;
112+
void spawnItemPreventCrash();
112113

113114
// Enable Debug Mode
114115
void enableDebugMode();
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#include "mod.h"
2+
3+
#include <cstdio>
4+
5+
namespace mod {
6+
7+
void Mod::spawnItemPreventCrash()
8+
{
9+
#ifdef TTYD_US
10+
uint32_t itemseq_GetItem_address = 0x800ABCD8;
11+
#elif defined TTYD_JP
12+
uint32_t itemseq_GetItem_address = 0x800AA01C;
13+
#elif defined TTYD_EU
14+
uint32_t itemseq_GetItem_address = 0x800AD0A8;
15+
#endif
16+
17+
// This also prevents cutscenes from playing when collecting a boot or hammer upgrade
18+
*reinterpret_cast<uint32_t *>(itemseq_GetItem_address) = 0x48000030; // b 0x30
19+
}
20+
21+
}

ttyd-tools/rel/source/mod.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ void Mod::init()
5252
Mod::disableBattles();
5353
Mod::infiniteItemUsage();
5454
Mod::artAttackHitboxes();
55+
Mod::spawnItemPreventCrash();
5556
}
5657

5758
void Mod::updateEarly()

0 commit comments

Comments
 (0)