Skip to content

Commit cd7f843

Browse files
committed
Added a display for showing the total amount of effs currently active
1 parent cdcd51c commit cd7f843

File tree

11 files changed

+173
-2
lines changed

11 files changed

+173
-2
lines changed

ttyd-tools/rel/include/codes.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ void displayPalaceSkipDetails();
3737
void displayBridgeSkipDetails();
3838
void displayBlimpTicketSkipDetails();
3939
void displayActionCommandsTiming();
40+
void displayEffsActive();
4041

4142
int32_t warpToMap(uint32_t value);
4243
int32_t warpToMapByEvent(int32_t index);

ttyd-tools/rel/include/draw.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ void drawPalaceSkipDetails();
122122
void drawBridgeSkipDetails();
123123
void drawBlimpTicketSkipDetails();
124124
void drawActionCommandsTiming();
125+
void drawEffsActive();
125126
void drawSettingsCurrentWork();
126127

127128
void drawHeapArrayErrors();

ttyd-tools/rel/include/global.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ enum DISPLAYS_OPTIONS
346346
DPAD_OPTIONS_DISPLAY,
347347
GUARD_SUPERGUARD_TIMINGS,
348348
ART_ATTACK_HITBOXES,
349+
EFFS_ACTIVE,
349350
YOSHI_SKIP,
350351
PALACE_SKIP,
351352
BRIDGE_SKIP,
@@ -864,7 +865,7 @@ struct NpcNameToPtrErrorStruct
864865
extern MenuVars MenuVar;
865866
extern Menus Menu[31];
866867
extern Cheats Cheat[25];
867-
extern bool Displays[14];
868+
extern bool Displays[15];
868869
extern char DisplayBuffer[256];
869870
extern char HeapBuffer[512];
870871
extern MemoryWatchStruct MemoryWatch[60];

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,29 @@
722722
8005E1E8:marioGetColor
723723
8005E1F8:marioGetPtr
724724

725+
// effdrv.o
726+
// text
727+
// 8005E200:effDrawMayaPoly
728+
// 8005E3C0:effCalcMayaAnim
729+
// 8005E514:effPlayMayaAnim
730+
// 8005E5A0:effDeleteMayaAnim
731+
// 8005E5C8:effMayaAnimAlloc
732+
// 8005E62C:effCalcMayaAnimMatrix
733+
// 8005E9D8:effGetSet
734+
// 8005EA60:effNameToPtr
735+
// 8005EAF8:effSoftDelete
736+
// 8005EB68:effDelete
737+
// 8005EBB4:effMain
738+
// 8005ED24:effSetName
739+
// 8005EDA0:effEntry
740+
// 8005EE08:effAutoRelease
741+
// 8005EE90:effGetTexObj
742+
// 8005EF44:effTexSetup
743+
// 8005F058:effInit
744+
// 8005F0E0:_callback_tpl
745+
// data
746+
80422720:effWorkPointer
747+
725748
// mariost.o
726749
// text
727750
// unused:gcResetDone

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,29 @@
719719
8005D204:marioGetColor
720720
8005D214:marioGetPtr
721721

722+
// effdrv.o
723+
// text
724+
// 8005D21C:effDrawMayaPoly
725+
// 8005D3DC:effCalcMayaAnim
726+
// 8005D530:effPlayMayaAnim
727+
// 8005D5BC:effDeleteMayaAnim
728+
// 8005D5E4:effMayaAnimAlloc
729+
// 8005D648:effCalcMayaAnimMatrix
730+
// 8005D9F4:effGetSet
731+
// 8005DA7C:effNameToPtr
732+
// 8005DB14:effSoftDelete
733+
// 8005DB84:effDelete
734+
// 8005DBD0:effMain
735+
// 8005DD40:effSetName
736+
// 8005DDBC:effEntry
737+
// 8005DE24:effAutoRelease
738+
// 8005DEAC:effGetTexObj
739+
// 8005DF60:effTexSetup
740+
// 8005E058:effInit
741+
// 8005E0E0:_callback_tpl
742+
// data
743+
80410220:effWorkPointer
744+
722745
// mariost.o
723746
// text
724747
// unused:gcResetDone

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,29 @@
721721
8005E0B0:marioGetColor
722722
8005E0C0:marioGetPtr
723723

724+
// effdrv.o
725+
// text
726+
// 8005E0C8:effDrawMayaPoly
727+
// 8005E288:effCalcMayaAnim
728+
// 8005E3DC:effPlayMayaAnim
729+
// 8005E468:effDeleteMayaAnim
730+
// 8005E490:effMayaAnimAlloc
731+
// 8005E4F4:effCalcMayaAnimMatrix
732+
// 8005E8A0:effGetSet
733+
// 8005E928:effNameToPtr
734+
// 8005E9C0:effSoftDelete
735+
// 8005EA30:effDelete
736+
// 8005EA7C:effMain
737+
// 8005EBEC:effSetName
738+
// 8005EC68:effEntry
739+
// 8005ECD0:effAutoRelease
740+
// 8005ED58:effGetTexObj
741+
// 8005EE0C:effTexSetup
742+
// 8005EF20:effInit
743+
// 8005EFA8:_callback_tpl
744+
// data
745+
80415EE0:effWorkPointer
746+
724747
// mariost.o
725748
// text
726749
// unused:gcResetDone
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#pragma once
2+
3+
#include <cstdint>
4+
5+
namespace ttyd::effdrv {
6+
7+
struct EffEntry
8+
{
9+
uint32_t wFlags;
10+
uint32_t wbBattle;
11+
uint32_t field_8;
12+
void *pEffAllocation;
13+
void *pfnMainFunc;
14+
char *typeName;
15+
char wName[16];
16+
} __attribute__((__packed__));
17+
18+
static_assert(sizeof(EffEntry) == 0x28);
19+
20+
struct EffWork
21+
{
22+
uint32_t effCount;
23+
EffEntry *entries;
24+
uint8_t unk_8[16];
25+
} __attribute__((__packed__));
26+
27+
static_assert(sizeof(EffWork) == 0x18);
28+
29+
extern "C" {
30+
31+
// effDrawMayaPoly
32+
// effCalcMayaAnim
33+
// effPlayMayaAnim
34+
// effDeleteMayaAnim
35+
// effMayaAnimAlloc
36+
// effCalcMayaAnimMatrix
37+
// effGetSet
38+
// effNameToPtr
39+
// effSoftDelete
40+
// effDelete
41+
// effMain
42+
// effSetName
43+
// effEntry
44+
// effAutoRelease
45+
// effGetTexObj
46+
// effTexSetup
47+
// effInit
48+
// _callback_tpl
49+
50+
extern EffWork *effWorkPointer;
51+
52+
}
53+
54+
}

ttyd-tools/rel/source/codes.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,6 +1528,16 @@ void displayActionCommandsTiming()
15281528
}
15291529
}
15301530

1531+
void displayEffsActive()
1532+
{
1533+
if (!Displays[EFFS_ACTIVE])
1534+
{
1535+
return;
1536+
}
1537+
1538+
drawFunctionOnDebugLayerWithOrder(drawEffsActive, 1.f);
1539+
}
1540+
15311541
int32_t warpToMap(uint32_t value)
15321542
{
15331543
// Make sure the player is currently in the game

ttyd-tools/rel/source/draw.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <ttyd/npcdrv.h>
3131
#include <ttyd/itemdrv.h>
3232
#include <ttyd/battle_ac.h>
33+
#include <ttyd/effdrv.h>
3334
#include <ttyd/battle_unit.h>
3435
#include <ttyd/battle_disp.h>
3536
#include <ttyd/pmario_sound.h>
@@ -4553,6 +4554,37 @@ void drawActionCommandsTiming()
45534554
DisplayActionCommands.DisplayTimer--;
45544555
}
45554556

4557+
void drawEffsActive()
4558+
{
4559+
uint32_t Color = 0xFFFFFFFF;
4560+
uint8_t Alpha = 0xFF;
4561+
int32_t PosX = -232;
4562+
int32_t PosY = 60;
4563+
float Scale = 0.75;
4564+
4565+
// Get the total amount of effs active
4566+
ttyd::effdrv::EffWork *EffWrk = ttyd::effdrv::effWorkPointer;
4567+
uint32_t MaxCount = EffWrk->effCount;
4568+
uint32_t CurrentCount = 0;
4569+
4570+
for (uint32_t i = 0; i < MaxCount; i++)
4571+
{
4572+
if (EffWrk->entries[i].wFlags)
4573+
{
4574+
CurrentCount++;
4575+
}
4576+
}
4577+
4578+
// Draw the total amount of effs active out of the max
4579+
char *tempDisplayBuffer = DisplayBuffer;
4580+
sprintf(tempDisplayBuffer,
4581+
"Effs Active: %" PRIu32 "/%" PRIu32,
4582+
CurrentCount,
4583+
MaxCount);
4584+
4585+
drawText(tempDisplayBuffer, PosX, PosY, Alpha, Color, Scale);
4586+
}
4587+
45564588
void drawSettingsCurrentWork()
45574589
{
45584590
const char *String;

ttyd-tools/rel/source/global.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1518,6 +1518,7 @@ const char *DisplaysLines[] =
15181518
"D-Pad Options",
15191519
"Guard/Superguard Timings",
15201520
"Art Attack Hitboxes",
1521+
"Effs Active",
15211522
"Yoshi Skip",
15221523
"Palace Skip",
15231524
"Bridge Skip",
@@ -1849,12 +1850,13 @@ uint8_t DisplaysOrder[] =
18491850
BLIMP_TICKET_SKIP,
18501851
ONSCREEN_TIMER_FRAME_COUNTER,
18511852
BRIDGE_SKIP,
1853+
EFFS_ACTIVE,
18521854
};
18531855

18541856
struct MenuVars MenuVar;
18551857
struct Menus Menu[31];
18561858
struct Cheats Cheat[25];
1857-
bool Displays[14];
1859+
bool Displays[15];
18581860
char DisplayBuffer[256];
18591861
char HeapBuffer[512];
18601862
struct MemoryWatchStruct MemoryWatch[60];

0 commit comments

Comments
 (0)