Skip to content

Commit 330fae1

Browse files
committed
Added the ability to pause the Art Attack timer
1 parent ea2ab83 commit 330fae1

File tree

8 files changed

+158
-0
lines changed

8 files changed

+158
-0
lines changed

USER_MANUAL.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,4 @@ This menu allows you to warp to various places around the game. A description fo
9999
There are several other changes that have been made outside of the menu:
100100
1. The current Sequence value is displayed in the pause menu next to Mario's stats.
101101
2. The unused Mega badges can be used in battles without the need for a boot/hammer upgrade.
102+
3. Holding Y while using Art Attack will pause the timer that is used to check how long you are able to use it for.

ttyd-tools/rel/include/mod.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class Mod
1818
bool performPreBattleActions();
1919
int32_t preventMenuSounds(int32_t, uint32_t, uint32_t, uint32_t);
2020
const char *getCustomMessage(const char *);
21+
uint32_t pauseArtAttackTimer();
2122

2223
private:
2324
void (*mPFN_makeKey_trampoline)() = nullptr;
@@ -28,6 +29,7 @@ class Mod
2829
int32_t (*mPFN_SoundEfxPlayEx_trampoline)(int32_t, uint32_t,
2930
uint32_t, uint32_t) = nullptr;
3031
const char *(*mPFN_msgSearch_trampoline)(const char *) = nullptr;
32+
uint32_t (*mPFN_scissor_timer_main_trampoline)() = nullptr;
3133
};
3234

3335
}

ttyd-tools/rel/include/ttyd.eu.lst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1406,6 +1406,35 @@
14061406
// 801AB220:marioResetCamShiftRate
14071407
// 801AB284:marioResetCamShift
14081408

1409+
// sac_scissor.o
1410+
// 80234D0C:wait_star_standby
1411+
// 80234D44:star_stone_appear
1412+
// 80234D70:scissor_end
1413+
// 80234DE0:scissor_init
1414+
// 80234E54:scissor_disp_region
1415+
// 80235154:scissor_offscreen
1416+
// 80235194:scissor_disp_control
1417+
// 802353CC:scissor_capture
1418+
// 80235434:scissor_ofscreen_ok
1419+
// 80235498:scissor_damage_sub2
1420+
// 802355B4:scissor_damage_sub
1421+
// 8023581C:scissor_damage
1422+
// 80235AA8:scissor_control
1423+
80235EC4:scissor_timer_main
1424+
// 8023602C:scissor_timer_get
1425+
// 80236088:star_disp2D_sub
1426+
// 80236230:star_disp2D
1427+
// 802362A0:star_control
1428+
// 8023673C:weaponGetPower_Scissor
1429+
// 802367C8:tess
1430+
// 80236A14:scissor_tess
1431+
// 80236A84:scissor_cross
1432+
// 80236EB0:scissor_intersection4
1433+
// 80236F50:scissor_intersection3
1434+
// 80236FEC:scissor_intersection2
1435+
// 8023706C:scissor_intersection
1436+
802376C4:GetScissorPtr
1437+
14091438
// runtime.c
14101439
8026849C:_savefpr_14
14111440
802684A0:_savefpr_15

ttyd-tools/rel/include/ttyd.jp.lst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1398,6 +1398,35 @@
13981398
// 801A3578:marioResetCamShiftRate
13991399
// 801A35DC:marioResetCamShift
14001400

1401+
// sac_scissor.o
1402+
// 8022BBCC:wait_star_standby
1403+
// 8022BC04:star_stone_appear
1404+
// 8022BC30:scissor_end
1405+
// 8022BCA0:scissor_init
1406+
// 8022BD14:scissor_disp_region
1407+
// 8022C014:scissor_offscreen
1408+
// 8022C054:scissor_disp_control
1409+
// 8022C28C:scissor_capture
1410+
// 8022C2F4:scissor_ofscreen_ok
1411+
// 8022C358:scissor_damage_sub2
1412+
// 8022C474:scissor_damage_sub
1413+
// 8022C6DC:scissor_damage
1414+
// 8022C968:scissor_control
1415+
8022CD84:scissor_timer_main
1416+
// 8022CEEC:scissor_timer_get
1417+
// 8022CF48:star_disp2D_sub
1418+
// 8022D0F0:star_disp2D
1419+
// 8022D160:star_control
1420+
// 8022D5FC:weaponGetPower_Scissor
1421+
// 8022D688:tess
1422+
// 8022D8D4:scissor_tess
1423+
// 8022D944:scissor_cross
1424+
// 8022DD70:scissor_intersection4
1425+
// 8022DE10:scissor_intersection3
1426+
// 8022DEAC:scissor_intersection2
1427+
// 8022DF2C:scissor_intersection
1428+
8022E584:GetScissorPtr
1429+
14011430
// runtime.c
14021431
8025E90C:_savefpr_14
14031432
8025E910:_savefpr_15

ttyd-tools/rel/include/ttyd.us.lst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1404,6 +1404,35 @@
14041404
// 801A9544:marioResetCamShiftRate
14051405
// 801A95A8:marioResetCamShift
14061406

1407+
// sac_scissor.o
1408+
// 8023127C:wait_star_standby
1409+
// 802312B4:star_stone_appear
1410+
// 802312E0:scissor_end
1411+
// 80231350:scissor_init
1412+
// 802313C4:scissor_disp_region
1413+
// 802316C4:scissor_offscreen
1414+
// 80231704:scissor_disp_control
1415+
// 8023193C:scissor_capture
1416+
// 802319A4:scissor_ofscreen_ok
1417+
// 80231A08:scissor_damage_sub2
1418+
// 80231B24:scissor_damage_sub
1419+
// 80231D8C:scissor_damage
1420+
// 80232018:scissor_control
1421+
80232434:scissor_timer_main
1422+
// 8023259C:scissor_timer_get
1423+
// 802325F8:star_disp2D_sub
1424+
// 802327A0:star_disp2D
1425+
// 80232810:star_control
1426+
// 80232CAC:weaponGetPower_Scissor
1427+
// 80232D38:tess
1428+
// 80232F84:scissor_tess
1429+
// 80232FF4:scissor_cross
1430+
// 80233420:scissor_intersection4
1431+
// 802334C0:scissor_intersection3
1432+
// 8023355C:scissor_intersection2
1433+
// 802335DC:scissor_intersection
1434+
80233C34:GetScissorPtr
1435+
14071436
// runtime.c
14081437
802648BC:_savefpr_14
14091438
802648C0:_savefpr_15
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#pragma once
2+
3+
#include <cstdint>
4+
5+
namespace ttyd::sac_scissor {
6+
7+
extern "C" {
8+
9+
// wait_star_standby
10+
// star_stone_appear
11+
// scissor_end
12+
// scissor_init
13+
// scissor_disp_region
14+
// scissor_offscreen
15+
// scissor_disp_control
16+
// scissor_capture
17+
// scissor_ofscreen_ok
18+
// scissor_damage_sub2
19+
// scissor_damage_sub
20+
// scissor_damage
21+
// scissor_control
22+
uint32_t scissor_timer_main();
23+
// scissor_timer_get
24+
// star_disp2D_sub
25+
// star_disp2D
26+
// star_control
27+
// weaponGetPower_Scissor
28+
// tess
29+
// scissor_tess
30+
// scissor_cross
31+
// scissor_intersection4
32+
// scissor_intersection3
33+
// scissor_intersection2
34+
// scissor_intersection
35+
void *GetScissorPtr();
36+
37+
}
38+
39+
}

ttyd-tools/rel/source/main.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <ttyd/evt_sub.h>
1313
#include <ttyd/mario_pouch.h>
1414
#include <ttyd/OSCache.h>
15+
#include <ttyd/sac_scissor.h>
1516

1617
#include <cstdio>
1718

@@ -372,6 +373,27 @@ const char *Mod::getCustomMessage(const char *msgKey)
372373
return mPFN_msgSearch_trampoline(msgKey);
373374
}
374375

376+
uint32_t Mod::pauseArtAttackTimer()
377+
{
378+
// Prevent the function from running if Y is being held
379+
if (checkButtonComboEveryFrame(PAD_Y))
380+
{
381+
// Make sure the timer is not at 59 or lower, as pausing it then will cause issues
382+
void *ArtAttackPointer = ttyd::sac_scissor::GetScissorPtr();
383+
384+
int32_t ArtAttackTimer = *reinterpret_cast<int32_t *>(
385+
reinterpret_cast<uint32_t>(ArtAttackPointer) + 0x104);
386+
387+
if (ArtAttackTimer > 59)
388+
{
389+
return 0;
390+
}
391+
}
392+
393+
// Call original function
394+
return mPFN_scissor_timer_main_trampoline();
395+
}
396+
375397
void writeStandardBranch(void *address, void functionStart(), void functionBranchBack())
376398
{
377399
void *tempFunctionStart = reinterpret_cast<void *>(functionStart);

ttyd-tools/rel/source/mod.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <ttyd/seq_battle.h>
1111
#include <ttyd/sound.h>
1212
#include <ttyd/msgdrv.h>
13+
#include <ttyd/sac_scissor.h>
1314
#include <ttyd/fontmgr.h>
1415
#include <ttyd/windowdrv.h>
1516
#include <ttyd/seq_logo.h>
@@ -79,6 +80,12 @@ void Mod::init()
7980
{
8081
return gMod->getCustomMessage(msgKey);
8182
});
83+
84+
mPFN_scissor_timer_main_trampoline = patch::hookFunction(
85+
ttyd::sac_scissor::scissor_timer_main, []()
86+
{
87+
return gMod->pauseArtAttackTimer();
88+
});
8289

8390
// Initialize typesetting early
8491
ttyd::fontmgr::fontmgrTexSetup();

0 commit comments

Comments
 (0)