Skip to content

Commit 42a2dfe

Browse files
committed
Small changes to FontDrawMessageMtx custom command handler
1 parent 02c7450 commit 42a2dfe

File tree

4 files changed

+17
-16
lines changed

4 files changed

+17
-16
lines changed

ttyd-tools/rel/include/assembly.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ void asmFixEvtMapBlendSetFlagPartnerCrash();
2121
void asmFixEvtMapBlendSetFlagFollowerCrash();
2222
void asmFallThroughMostObjectsStandard();
2323
void asmFallThroughMostObjectsBowser();
24-
void asmFontDrawMessageMtxHandleCol();
24+
void asmFontDrawMessageMtxHandleCommand();
2525

2626
#ifdef TTYD_JP
2727
void asmBacktraceScreenIncrementYPos();
@@ -53,7 +53,7 @@ void *fallThroughMostObjects(void *ptr);
5353

5454
// draw.cpp
5555
bool disableDPadOptionsDisplay(uint16_t unkVar);
56-
bool fontDrawMessageMtxHandleCol(const char *command, const char *colorString);
56+
bool fontDrawMessageMtxHandleCommand(const char *command, const char *commandValueString);
5757

5858
// Misc assembly functions
5959
bool asmErrorHandlerCheckPairedSinglesEnabled();

ttyd-tools/rel/source/assembly/FontDrawMessageMtxHandleCol.s renamed to ttyd-tools/rel/source/assembly/FontDrawMessageMtxHandleCommand.s

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.global asmFontDrawMessageMtxHandleCol
1+
.global asmFontDrawMessageMtxHandleCommand
22

33
#ifdef TTYD_US
44
AddressToJumpTo = 0x80075D84
@@ -8,17 +8,17 @@ AddressToJumpTo = 0x80074AC0
88
AddressToJumpTo = 0x80077040
99
#endif
1010

11-
asmFontDrawMessageMtxHandleCol:
11+
asmFontDrawMessageMtxHandleCommand:
1212
# Restore the original instruction
1313
mr %r24,%r0
1414

1515
stwu %sp,-0x10(%sp)
1616
mflr %r0
1717
stw %r0,0x14(%sp)
1818

19-
addi %r3,%sp,0x180 # command
20-
addi %r4,%sp,0x100 # colorString
21-
bl fontDrawMessageMtxHandleCol
19+
addi %r3,%sp,0x180 # command # -> 0x170 + 0x10
20+
addi %r4,%sp,0x100 # commandValueString # -> 0xF0 + 0x10
21+
bl fontDrawMessageMtxHandleCommand
2222

2323
# Check the returned value
2424
cmpwi %r3,0 # False
@@ -28,7 +28,7 @@ mtlr %r0
2828
addi %sp,%sp,0x10
2929
bne- jumpPastOtherCommands
3030

31-
# r3 is needed, so restore the original value for that
31+
# r3 is needed, so restore the original value for it
3232
addi %r3,%sp,0x170
3333
blr
3434

ttyd-tools/rel/source/draw.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,12 @@ bool disableDPadOptionsDisplay(uint16_t unkVar)
6060
return (unkVar & (1 << 8)); // Check the 8 bit
6161
}
6262

63-
bool fontDrawMessageMtxHandleCol(const char *command, const char *colorString)
63+
bool fontDrawMessageMtxHandleCommand(const char *command, const char *commandValueString)
6464
{
65-
uint32_t Color;
66-
6765
if (strcmp(command, "col") == 0)
6866
{
69-
sscanf(colorString, "%" PRIx32, &Color);
67+
uint32_t Color;
68+
sscanf(commandValueString, "%" PRIx32, &Color);
7069
ttyd::fontmgr::FontDrawColor(reinterpret_cast<uint8_t *>(&Color));
7170
}
7271
else if (strcmp(command, "/col") == 0)
@@ -75,9 +74,11 @@ bool fontDrawMessageMtxHandleCol(const char *command, const char *colorString)
7574
}
7675
else
7776
{
77+
// Command not found
7878
return false;
7979
}
8080

81+
// Command found
8182
return true;
8283
}
8384

ttyd-tools/rel/source/main.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,7 @@ void initAddressOverwrites()
903903
void *AutoMashThroughText1Address = reinterpret_cast<void *>(0x80080FCC);
904904
void *AutoMashThroughText2Address = reinterpret_cast<void *>(0x80080FF0);
905905
void *AutoMashThroughText3Address = reinterpret_cast<void *>(0x80084268);
906-
void *FontDrawMessageMtxHandleColAddress = reinterpret_cast<void *>(0x800759E0);
906+
void *FontDrawMessageMtxHandleCommandAddress = reinterpret_cast<void *>(0x800759E0);
907907
#elif defined TTYD_JP
908908
void *AllowRunningFromBattlesAddress = reinterpret_cast<void *>(0x8011E7DC);
909909
void *ForceNPCItemDropAddress = reinterpret_cast<void *>(0x8004DFB0);
@@ -932,7 +932,7 @@ void initAddressOverwrites()
932932
void *AutoMashThroughText1Address = reinterpret_cast<void *>(0x8008047C);
933933
void *AutoMashThroughText2Address = reinterpret_cast<void *>(0x800804A0);
934934
void *AutoMashThroughText3Address = reinterpret_cast<void *>(0x80083390);
935-
void *FontDrawMessageMtxHandleColAddress = reinterpret_cast<void *>(0x8007471C);
935+
void *FontDrawMessageMtxHandleCommandAddress = reinterpret_cast<void *>(0x8007471C);
936936
#elif defined TTYD_EU
937937
void *AllowRunningFromBattlesAddress = reinterpret_cast<void *>(0x80124BE4);
938938
void *ForceNPCItemDropAddress = reinterpret_cast<void *>(0x8004ECDC);
@@ -962,7 +962,7 @@ void initAddressOverwrites()
962962
void *AutoMashThroughText1Address = reinterpret_cast<void *>(0x80082288);
963963
void *AutoMashThroughText2Address = reinterpret_cast<void *>(0x800822AC);
964964
void *AutoMashThroughText3Address = reinterpret_cast<void *>(0x800855BC);
965-
void *FontDrawMessageMtxHandleColAddress = reinterpret_cast<void *>(0x80076C9C);
965+
void *FontDrawMessageMtxHandleCommandAddress = reinterpret_cast<void *>(0x80076C9C);
966966
void *JumpOnWaterAddress = reinterpret_cast<void *>(0x80093CF0);
967967
#endif
968968

@@ -985,7 +985,7 @@ void initAddressOverwrites()
985985
patch::writeBranchBL_Template(AutoMashThroughText1Address, autoMashText);
986986
patch::writeBranchBL_Template(AutoMashThroughText2Address, autoMashText);
987987
patch::writeBranchBL_Template(AutoMashThroughText3Address, autoMashText);
988-
patch::writeBranchBL_Template(FontDrawMessageMtxHandleColAddress, asmFontDrawMessageMtxHandleCol);
988+
patch::writeBranchBL_Template(FontDrawMessageMtxHandleCommandAddress, asmFontDrawMessageMtxHandleCommand);
989989

990990
#ifdef TTYD_EU
991991
patch::writeBranchBL_Template(JumpOnWaterAddress, asmJumpOnWater);

0 commit comments

Comments
 (0)