Skip to content

Commit 90a6492

Browse files
committed
Cheats menu - New option
Added an option to manually change GSWs, GSWFs, GWs, GFs, LSWs, and LSWFs.
1 parent a986fff commit 90a6492

File tree

15 files changed

+772
-37
lines changed

15 files changed

+772
-37
lines changed

USER_MANUAL.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ This menu allows you to modify your entire inventory, including standard items,
5656
17. **Disable Pause Menu/Z Menu Sounds** disables the sound effects that play when the pause menu and the Z menu are opened/closed.
5757
18. **Bobbery Early** clears some values, which allows you to perform Bobbery Early more than once on a save file without the need to reload.
5858
19. **Force NPC Item Drop** forces any defeared enemy to drop a specified item. The item can be changed at will.
59-
20. **Clear Area Flags** allows you to clear most of the flags for a specified area. A confirmation message is displayed when trying to do so, to prevent accidently clearing flags. The flags will be cleared on the next screen transition.
59+
20. **Manage Flags** allows you to manually change a lot of the important flags in the game.
60+
21. **Clear Area Flags** allows you to clear most of the flags for a specified area. A confirmation message is displayed when trying to do so, to prevent accidently clearing flags. The flags will be cleared on the next screen transition.
6061

6162
### Stats
6263
This menu allows you to modify Mario's stats, all of your partner's stats, whether or not partners are enabled or not, whether a partner is out or not, and whether or not a follower is out or not.

ttyd-tools/rel/include/commonfunctions.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22

33
#include <ttyd/seqdrv.h>
4+
#include <ttyd/evtmgr.h>
45

56
#include <cstdint>
67

@@ -37,6 +38,7 @@ bool checkIfBadgeEquipped(int16_t badge);
3738
void recheckJumpAndHammerLevels();
3839
uint32_t getCurrentPitFloor();
3940
void clearGSWFsRange(uint32_t lowerBound, uint32_t upperBound);
41+
ttyd::evtmgr::EvtWork *getCurrentEventWork();
4042
void *getLastPointerFromPath(void *address, int32_t *offset, uint32_t offsetAmount);;
4143

4244
}

ttyd-tools/rel/include/draw.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ void drawCheatsBool(int32_t posY);
9595
void drawButtonCombo(uint16_t buttonCombo, int32_t posY, const char *description);
9696
void drawChangeButtonCombo(uint16_t &currentButtonCombo);
9797
void drawCheatsForcedDropItem();
98+
void drawCheatsManageFlagsMain(uint32_t currentMenu);
9899
void drawCheatsClearArea();
99100
void drawWarpsOptions();
100101
void drawOnScreenTimerButtonCombos();

ttyd-tools/rel/include/global.h

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ enum MENU_NAMES
2222
CHEATS_STANDARD,
2323
CHEATS_NO_BUTTON_COMBO,
2424
CHEATS_NPC_FORCE_DROP,
25+
CHEATS_MANAGE_FLAGS,
26+
CHEATS_MANAGE_FLAGS_MAIN,
2527
CHEATS_CLEAR_AREA_FLAGS,
2628
STATS_MARIO,
2729
STATS_PARTNERS,
@@ -79,6 +81,7 @@ enum CHEATS_OPTIONS
7981
DISABLE_MENU_SOUNDS,
8082
BOBBERY_EARLY,
8183
FORCE_ITEM_DROP,
84+
MANAGE_FLAGS,
8285
CLEAR_AREA_FLAGS,
8386
};
8487

@@ -99,6 +102,29 @@ enum CHEATS_FORCE_ITEM_DROP_SELECTION
99102
ITEM_DROP_CHANGE_BY_ID,
100103
};
101104

105+
enum CHEATS_MANAGE_FLAGS_SELECTION
106+
{
107+
SET_GSW = 1,
108+
SET_GSWF,
109+
SET_GW,
110+
SET_GF,
111+
SET_LSW,
112+
SET_LSWF,
113+
};
114+
115+
enum CHEATS_MANAGE_GLOBAL_WORDS_SELECTION
116+
{
117+
CHANGE_GLOBAL_WORD = 1,
118+
CHANGE_GLOBAL_WORD_VALUE,
119+
SET_GLOBAL_WORD_VALUE,
120+
};
121+
122+
enum CHEATS_MANAGE_GLOBAL_FLAGS_SELECTION
123+
{
124+
CHANGE_GLOBAL_FLAG = 1,
125+
SET_GLOBAL_FLAG,
126+
};
127+
102128
enum CHEATS_CLEAR_AREA_FLAGS_SELECTION
103129
{
104130
SELECT_AREA = 1,
@@ -462,6 +488,12 @@ struct CheatsHandleDisplayButtons
462488
uint8_t CheatsCurrentButtonsHeld[14]; // Extra spot for a 0 at the end of the array
463489
};
464490

491+
struct CheatsManageFlags
492+
{
493+
uint16_t FlagToSet;
494+
int32_t ValueToSet;
495+
};
496+
465497
struct MarioPartnerPositionsStruct
466498
{
467499
float MarioPosition[4];
@@ -571,8 +603,8 @@ struct SettingsStruct
571603
MemoryWatchStruct MemoryWatchSettings[30];
572604
};
573605

574-
extern Menus Menu[24];
575-
extern Cheats Cheat[19];
606+
extern Menus Menu[26];
607+
extern Cheats Cheat[20];
576608
extern bool Displays[9];
577609
extern char DisplayBuffer[256];
578610
extern MemoryWatchStruct MemoryWatch[30];
@@ -581,6 +613,7 @@ extern AutoIncrement AdjustableValueMenu;
581613
extern AutoIncrement MemoryWatchAdjustableValueMenu;
582614
extern AutoIncrementCoordinates MemoryWatchPosition;
583615
extern CheatsHandleDisplayButtons CheatsDisplayButtons;
616+
extern CheatsManageFlags ManageFlags;
584617
extern MarioPartnerPositionsStruct MarioPartnerPositions;
585618
extern SaveAnywhereStruct SaveAnywhere;
586619
extern SpeedUpMarioStruct SpeedUpMario;
@@ -600,6 +633,8 @@ extern const char *CheatsLines[];
600633
extern const char *CheatsForceItemDropAreas[];
601634
extern uint8_t CheatsForceItemDropAreasSize;
602635
extern const char *CheatsForceItemDropAreasFullNames[];
636+
extern const char *CheatsManageGlobalWordsOptions[];
637+
extern const char *CheatsManageGlobalFlagsOptions[];
603638
extern const char *StatsMarioOptionsLines[];
604639
extern uint8_t StatsMarioOptionsLinesSize;
605640
extern uint16_t StatsMarioIcons[];

ttyd-tools/rel/include/menufunctions.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ void setAddByIconValue(void *address);
5151
void duplicateCurrentItem(void *address);
5252
void deleteItem();
5353
int32_t changeItem();
54+
int32_t getGW(uint32_t gw);
55+
void setGW(uint32_t gw, uint32_t value);
56+
bool getGF(uint32_t gf);
57+
void setGF(uint32_t gf);
58+
int32_t getGlobalFlagValue(uint32_t currentMenu, uint32_t flag);
5459
void cheatClearAreaFlags(uint32_t currentMenuOption);
5560

5661
// uint8_t *getButtonsPressedDynamic(uint8_t *buttonArray, uint16_t currentButtonCombo);
@@ -64,6 +69,7 @@ uint32_t checkButtonSingleFrame();
6469
// void correctPageSingleColumn(uint32_t button, uint8_t &currentPage)
6570
void default_DPAD_Actions(uint32_t button);
6671
void adjustCheatsSubMenu(uint32_t button);
72+
void adjustCheatsManageFlagsMainMenu(uint32_t button);
6773
void adjustMenuSelectionInventory(uint32_t button);
6874
void adjustCheatClearAreaFlagSelection(uint32_t button);
6975
void adjustMarioStatsSelection(uint32_t button);

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@
212212
// 80037898:evtmgrReInit
213213
// 80037904:evtmgrInit
214214
// 80037A1C:make_pri_table
215-
// 80037B48:evtGetWork
215+
80037B48:evtGetWork
216216

217217
// evt_sub.o
218218
// 80053830:mail_evt_gor_04_keyoff_check
@@ -448,11 +448,11 @@
448448
// 80085C8C:msgInit
449449

450450
// swdrv.o
451-
// 80086A98:_swByteGet
452-
// 80086AA8:_swByteSet
453-
// 80086AB8:_swClear
454-
// 80086AF8:_swGet
455-
// 80086B40:_swSet
451+
80086A98:_swByteGet
452+
80086AA8:_swByteSet
453+
80086AB8:_swClear
454+
80086AF8:_swGet
455+
80086B40:_swSet
456456
80086B80:swByteGet
457457
80086BA4:swByteSet
458458
80086BC8:swClear

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@
210210
// 80037114:evtmgrReInit
211211
// 80037180:evtmgrInit
212212
// 80037298:make_pri_table
213-
// 800373C4:evtGetWork
213+
800373C4:evtGetWork
214214

215215
// evt_sub.o
216216
// 80052AFC:mail_evt_gor_04_keyoff_check
@@ -443,11 +443,11 @@
443443
// 800839B0:msgInit
444444

445445
// swdrv.o
446-
// 800847B8:_swByteGet
447-
// 800847C8:_swByteSet
448-
// 800847D8:_swClear
449-
// 80084818:_swGet
450-
// 80084860:_swSet
446+
800847B8:_swByteGet
447+
800847C8:_swByteSet
448+
800847D8:_swClear
449+
80084818:_swGet
450+
80084860:_swSet
451451
800848A0:swByteGet
452452
800848C4:swByteSet
453453
800848E8:swClear

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@
212212
// 800377B0:evtmgrReInit
213213
// 8003781C:evtmgrInit
214214
// 80037934:make_pri_table
215-
// 80037A60:evtGetWork
215+
80037A60:evtGetWork
216216

217217
// evt_sub.o
218218
// 80053764:mail_evt_gor_04_keyoff_check
@@ -447,11 +447,11 @@
447447
// 80084938:msgInit
448448

449449
// swdrv.o
450-
// 80085744:_swByteGet
451-
// 80085754:_swByteSet
452-
// 80085764:_swClear
453-
// 800857A4:_swGet
454-
// 800857EC:_swSet
450+
80085744:_swByteGet
451+
80085754:_swByteSet
452+
80085764:_swClear
453+
800857A4:_swGet
454+
800857EC:_swSet
455455
8008582C:swByteGet
456456
80085850:swByteSet
457457
80085874:swClear

ttyd-tools/rel/include/ttyd/evtmgr.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@
44

55
namespace ttyd::evtmgr {
66

7+
struct EvtWork
8+
{
9+
uint32_t maxEventCount;
10+
uint32_t gwData[32];
11+
uint32_t gfData[3]; // 96 flags total
12+
// EvtContext *pContextBuffer;
13+
void *pContextBuffer;
14+
uint32_t unk_94;
15+
uint64_t currentEventTime;
16+
} __attribute__((__packed__));
17+
718
extern "C" {
819

920
// evtGetPtrID
@@ -32,7 +43,7 @@ uint32_t evtEntryType(void *script, uint32_t unk1, uint32_t unk2, uint32_t unk3)
3243
// evtmgrReInit
3344
// evtmgrInit
3445
// make_pri_table
35-
// evtGetWork
46+
EvtWork *evtGetWork(); // Gets current work
3647

3748
}
3849

ttyd-tools/rel/include/ttyd/swdrv.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ namespace ttyd::swdrv {
66

77
extern "C" {
88

9-
// _swByteGet
10-
// _swByteSet
11-
// _swClear
12-
// _swGet
13-
// _swSet
9+
uint8_t _swByteGet(uint32_t lsw);
10+
void _swByteSet(uint32_t lsw, uint32_t value);
11+
void _swClear(uint32_t lswf);
12+
bool _swGet(uint32_t lswf);
13+
void _swSet(uint32_t lswf);
1414
uint32_t swByteGet(uint32_t gsw);
1515
void swByteSet(uint32_t gsw, uint32_t value);
1616
void swClear(uint32_t gswf);

0 commit comments

Comments
 (0)