Skip to content

Commit

Permalink
Revert "Allow setting starting resources in all games"
Browse files Browse the repository at this point in the history
This reverts commit f3b8ad5.
  • Loading branch information
32th-System committed Jul 18, 2024
1 parent 9bf802d commit 17ce5e6
Show file tree
Hide file tree
Showing 13 changed files with 12 additions and 214 deletions.
32 changes: 0 additions & 32 deletions thprac/src/thprac/thprac_games.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,6 @@ struct IDirect3DDevice8;

namespace THPrac {

struct THRelayUI : public Gui::GameGuiWnd {
int lives = 2;
int bombs = 3;

bool has_bombs = true;

THRelayUI() noexcept
{
SetTitle("Relay Resources");
SetWndFlag(ImGuiWindowFlags_NoCollapse);
SetSizeRel(0.5f, 0.25f);
SetFade(0.8f, 0.8f);
Open();
}

virtual void OnContentUpdate()
{
ImGui::SliderInt("Lives", &lives, 0, 32);
if (!has_bombs)
ImGui::BeginDisabled();
ImGui::SliderInt("Bombs", &bombs, 0, 32);
if (!has_bombs)
ImGui::EndDisabled();
ImGui::NewLine();
if (ImGui::Button("Close (Press Ins to re-open)")) {
Close();
}
}

SINGLETON(THRelayUI);
};

struct Float2 {
float x;
float y;
Expand Down
17 changes: 1 addition & 16 deletions thprac/src/thprac/thprac_th06.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1855,14 +1855,6 @@ namespace TH06 {
pCtx->Eip = 0x42d839;
}
HOOKSET_DEFINE(THMainHook)
EHOOK_DY(relay_patch_main, 0x436DFB)
{
auto& r = THRelayUI::singleton();
*(char*)0x69D4BA = r.lives;
*(char*)0x69D4BB = r.bombs;
r.Close();
}

PATCH_DY(th06_reacquire_input, 0x41dc58, "\x00\x00\x00\x00\x74", 5);
EHOOK_DY(th06_activateapp, 0x420D96)
{
Expand Down Expand Up @@ -2066,14 +2058,7 @@ namespace TH06 {
THGuiRep::singleton().Update();
THOverlay::singleton().Update();

if (Gui::KeyboardInputGetRaw(VK_INSERT)) {
THRelayUI::singleton().Open();
}

THRelayUI::singleton().Update();


GameGuiEnd(THAdvOptWnd::StaticUpdate() || THGuiPrac::singleton().IsOpen() || THPauseMenu::singleton().IsOpen() || THRelayUI::singleton().IsOpen());
GameGuiEnd(THAdvOptWnd::StaticUpdate() || THGuiPrac::singleton().IsOpen() || THPauseMenu::singleton().IsOpen());
}
EHOOK_DY(th06_render, 0x41cb6d)
{
Expand Down
16 changes: 1 addition & 15 deletions thprac/src/thprac/thprac_th07.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1656,13 +1656,6 @@ namespace TH07 {
}

HOOKSET_DEFINE(THMainHook)
EHOOK_DY(relay_patch_main, 0x42EA41)
{
auto& r = THRelayUI::singleton();
*GetMemAddr<float*>(0x00626278, 0x5C) = r.lives;
*GetMemAddr<float*>(0x00626278, 0x68) = r.bombs;
r.Close();
}
PATCH_DY(th07_reacquire_input, 0x430f03, "\x00\x00\x00\x00\x74", 5);
EHOOK_DY(th07_everlasting_bgm, 0x44d2f0)
{
Expand Down Expand Up @@ -1842,14 +1835,7 @@ namespace TH07 {
THGuiPrac::singleton().Update();
THGuiRep::singleton().Update();
THOverlay::singleton().Update();

if (Gui::KeyboardInputGetRaw(VK_INSERT)) {
THRelayUI::singleton().Open();
}

THRelayUI::singleton().Update();

bool drawCursor = THAdvOptWnd::StaticUpdate() || THGuiPrac::singleton().IsOpen() || THRelayUI::singleton().IsOpen();
bool drawCursor = THAdvOptWnd::StaticUpdate() || THGuiPrac::singleton().IsOpen();

GameGuiEnd(drawCursor);
}
Expand Down
15 changes: 1 addition & 14 deletions thprac/src/thprac/thprac_th08.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2110,12 +2110,6 @@ namespace TH08 {
}

HOOKSET_DEFINE(THMainHook)
EHOOK_DY(relay_patch_main, 0x43AE67) {
auto& r = THRelayUI::singleton();
*GetMemAddr<float*>(0x160F510, 0x74) = r.lives;
*GetMemAddr<float*>(0x160F510, 0x80) = r.bombs;
r.Close();
}
EHOOK_ST(th08_familiar, 0x42a55f)
{
uint32_t target = *(uint32_t*)(pCtx->Ebp - 8);
Expand Down Expand Up @@ -2295,14 +2289,7 @@ namespace TH08 {
THGuiPrac::singleton().Update();
THGuiRep::singleton().Update();
THOverlay::singleton().Update();

if (Gui::KeyboardInputGetRaw(VK_INSERT)) {
THRelayUI::singleton().Open();
}

THRelayUI::singleton().Update();

bool drawCursor = THAdvOptWnd::StaticUpdate() || THGuiPrac::singleton().IsOpen() || THRelayUI::singleton().IsOpen();
bool drawCursor = THAdvOptWnd::StaticUpdate() || THGuiPrac::singleton().IsOpen();

GameGuiEnd(drawCursor);
}
Expand Down
17 changes: 1 addition & 16 deletions thprac/src/thprac/thprac_th10.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2143,13 +2143,6 @@ namespace TH10 {
}
PATCH_ST(th10_real_bullet_sprite, 0x406e03, "\x0F\x84\x13\x05\x00\x00", 6);
HOOKSET_DEFINE(THMainHook)
EHOOK_DY(relay_patch_main, 0x417976)
{
auto& r = THRelayUI::singleton();
*(int32_t*)0x474C70 = r.lives;
r.Close();
}

EHOOK_DY(th10_everlasting_bgm, 0x43e460)
{
int32_t retn_addr = ((int32_t*)pCtx->Esp)[0];
Expand Down Expand Up @@ -2284,14 +2277,7 @@ namespace TH10 {
THGuiPrac::singleton().Update();
THGuiRep::singleton().Update();
THOverlay::singleton().Update();

if (Gui::KeyboardInputGetRaw(VK_INSERT)) {
THRelayUI::singleton().Open();
}

THRelayUI::singleton().Update();

bool drawCursor = THAdvOptWnd::StaticUpdate() || THGuiPrac::singleton().IsOpen() || THRelayUI::singleton().IsOpen();
bool drawCursor = THAdvOptWnd::StaticUpdate() || THGuiPrac::singleton().IsOpen();

GameGuiEnd(drawCursor);
}
Expand Down Expand Up @@ -2320,7 +2306,6 @@ namespace TH10 {

// Reset thPracParam
thPracParam.Reset();
THRelayUI::singleton().has_bombs = false;
}
static __declspec(noinline) void THInitHookDisable()
{
Expand Down
16 changes: 1 addition & 15 deletions thprac/src/thprac/thprac_th11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1659,12 +1659,6 @@ namespace TH11 {
}

HOOKSET_DEFINE(THMainHook)
EHOOK_DY(relay_patch_main, 0x41FA60)
{
auto& r = THRelayUI::singleton();
*(int32_t*)0x4A5718 = r.lives;
r.Close();
}
EHOOK_DY(th11_everlasting_bgm, 0x44a9c0)
{
int32_t retn_addr = ((int32_t*)pCtx->Esp)[0];
Expand Down Expand Up @@ -1809,14 +1803,7 @@ namespace TH11 {
THGuiPrac::singleton().Update();
THGuiRep::singleton().Update();
THOverlay::singleton().Update();

if (Gui::KeyboardInputGetRaw(VK_INSERT)) {
THRelayUI::singleton().Open();
}

THRelayUI::singleton().Update();

bool drawCursor = THAdvOptWnd::StaticUpdate() || THGuiPrac::singleton().IsOpen() || THRelayUI::singleton().IsOpen();
bool drawCursor = THAdvOptWnd::StaticUpdate() || THGuiPrac::singleton().IsOpen();

GameGuiEnd(drawCursor);
}
Expand Down Expand Up @@ -1847,7 +1834,6 @@ namespace TH11 {

// Reset thPracParam
thPracParam.Reset();
THRelayUI::singleton().has_bombs = false;
}
static __declspec(noinline) void THInitHookDisable()
{
Expand Down
16 changes: 1 addition & 15 deletions thprac/src/thprac/thprac_th12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1438,13 +1438,6 @@ namespace TH12 {
}

HOOKSET_DEFINE(THMainHook)
EHOOK_DY(relay_patch_main, 0x421EA9)
{
auto& r = THRelayUI::singleton();
*(int32_t*)0x4B0C98 = r.lives;
*(int32_t*)0x4B0CA0 = r.bombs;
r.Close();
}
EHOOK_DY(th12_everlasting_bgm, 0x454960)
{
int32_t retn_addr = ((int32_t*)pCtx->Esp)[0];
Expand Down Expand Up @@ -1559,14 +1552,7 @@ namespace TH12 {
THGuiPrac::singleton().Update();
THGuiRep::singleton().Update();
THOverlay::singleton().Update();

if (Gui::KeyboardInputGetRaw(VK_INSERT)) {
THRelayUI::singleton().Open();
}

THRelayUI::singleton().Update();

bool drawCursor = THAdvOptWnd::StaticUpdate() || THGuiPrac::singleton().IsOpen() || THRelayUI::singleton().IsOpen();
bool drawCursor = THAdvOptWnd::StaticUpdate() || THGuiPrac::singleton().IsOpen();

GameGuiEnd(drawCursor);
}
Expand Down
16 changes: 1 addition & 15 deletions thprac/src/thprac/thprac_th13.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1494,13 +1494,6 @@ namespace TH13 {
bool th13ElBgmFlag = false;

HOOKSET_DEFINE(THMainHook)
EHOOK_DY(relay_patch_main, 0x42BC3E)
{
auto& r = THRelayUI::singleton();
*(int32_t*)0x4BE7F4 = r.lives;
*(int32_t*)0x4BE800 = r.bombs;
r.Close();
}
EHOOK_ST(th13_dump_rep, 0x448d8c)
{
auto filePtr = (void*)pCtx->Eax;
Expand Down Expand Up @@ -1647,14 +1640,7 @@ namespace TH13 {
THGuiPrac::singleton().Update();
THGuiRep::singleton().Update();
THOverlay::singleton().Update();

if (Gui::KeyboardInputGetRaw(VK_INSERT)) {
THRelayUI::singleton().Open();
}

THRelayUI::singleton().Update();

bool drawCursor = THAdvOptWnd::StaticUpdate() || THGuiPrac::singleton().IsOpen() || THRelayUI::singleton().IsOpen();
bool drawCursor = THAdvOptWnd::StaticUpdate() || THGuiPrac::singleton().IsOpen();

THAdvOptWnd::singleton().FpsUpd();
GameGuiEnd(drawCursor);
Expand Down
16 changes: 1 addition & 15 deletions thprac/src/thprac/thprac_th14.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2247,13 +2247,6 @@ namespace TH14 {
}

HOOKSET_DEFINE(THMainHook)
EHOOK_DY(relay_patch_main, 0x435D68)
{
auto& r = THRelayUI::singleton();
*(int32_t*)0x4F5864 = r.lives;
*(int32_t*)0x4F5870 = r.bombs;
r.Close();
}
EHOOK_DY(th14_everlasting_bgm, 0x46ef90)
{
int32_t retn_addr = ((int32_t*)pCtx->Esp)[0];
Expand Down Expand Up @@ -2396,14 +2389,7 @@ namespace TH14 {
THGuiRep::singleton().Update();
THOverlay::singleton().Update();
THGuiSP::singleton().Update();

if (Gui::KeyboardInputGetRaw(VK_INSERT)) {
THRelayUI::singleton().Open();
}

THRelayUI::singleton().Update();

bool drawCursor = THAdvOptWnd::StaticUpdate() || THGuiPrac::singleton().IsOpen() || THGuiSP::singleton().IsOpen() || THRelayUI::singleton().IsOpen() || THRelayUI::singleton().IsOpen();
bool drawCursor = THAdvOptWnd::StaticUpdate() || THGuiPrac::singleton().IsOpen() || THGuiSP::singleton().IsOpen();

GameGuiEnd(drawCursor);
}
Expand Down
17 changes: 1 addition & 16 deletions thprac/src/thprac/thprac_th15.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1743,13 +1743,6 @@ namespace TH15 {
static bool frameStarted = false;

HOOKSET_DEFINE(THMainHook)
EHOOK_DY(relay_patch_main, 0x43C2D9)
{
auto& r = THRelayUI::singleton();
*(int32_t*)0x4E7450 = r.lives;
*(int32_t*)0x4E745C = r.bombs;
r.Close();
}
EHOOK_DY(th15_everlasting_bgm, 0x476f10)
{
int32_t retn_addr = ((int32_t*)pCtx->Esp)[0];
Expand Down Expand Up @@ -1858,15 +1851,7 @@ namespace TH15 {
THGuiPrac::singleton().Update();
THGuiRep::singleton().Update();
THOverlay::singleton().Update();


if (Gui::KeyboardInputGetRaw(VK_INSERT)) {
THRelayUI::singleton().Open();
}

THRelayUI::singleton().Update();

bool drawCursor = THAdvOptWnd::StaticUpdate() || THGuiPrac::singleton().IsOpen() || THRelayUI::singleton().IsOpen();
bool drawCursor = THAdvOptWnd::StaticUpdate() || THGuiPrac::singleton().IsOpen();
GameGuiEnd(drawCursor);
}
EHOOK_DY(th15_render, 0x40170a)
Expand Down
16 changes: 1 addition & 15 deletions thprac/src/thprac/thprac_th16.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2132,13 +2132,6 @@ namespace TH16 {
}

HOOKSET_DEFINE(THMainHook)
EHOOK_DY(relay_patch_main, 0x42CE1A)
{
auto& r = THRelayUI::singleton();
*(int32_t*)0x4A57F4 = r.lives;
*(int32_t*)0x4A5800 = r.bombs;
r.Close();
}
EHOOK_DY(th16_spbugfix, 0x4214fa)
{
char* sub_str;
Expand Down Expand Up @@ -2410,14 +2403,7 @@ namespace TH16 {
THGuiRep::singleton().Update();
THOverlay::singleton().Update();
THGuiSP::singleton().Update();

if (Gui::KeyboardInputGetRaw(VK_INSERT)) {
THRelayUI::singleton().Open();
}

THRelayUI::singleton().Update();

bool drawCursor = THAdvOptWnd::StaticUpdate() || THGuiPrac::singleton().IsOpen() || THGuiSP::singleton().IsOpen() || THRelayUI::singleton().IsOpen();
bool drawCursor = THAdvOptWnd::StaticUpdate() || THGuiPrac::singleton().IsOpen() || THGuiSP::singleton().IsOpen();
GameGuiEnd(drawCursor);
}
EHOOK_DY(th16_render, 0x40168a)
Expand Down
16 changes: 1 addition & 15 deletions thprac/src/thprac/thprac_th17.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1783,13 +1783,6 @@ namespace TH17 {
#define TH17AddGoast(goast_id) asm_call<0x40f980, Thiscall>(GetMemContent(0x4b7684), goast_id)

HOOKSET_DEFINE(THMainHook)
EHOOK_DY(relay_patch_main, 0x430474)
{
auto& r = THRelayUI::singleton();
*(int32_t*)0x4B5A40 = r.lives;
*(int32_t*)0x4B5A4C = r.bombs;
r.Close();
}
EHOOK_DY(th17_window_mousedown, 0x46198b) {
auto& adv_opt = THAdvOptWnd::singleton();

Expand Down Expand Up @@ -2006,14 +1999,7 @@ namespace TH17 {
THGuiPrac::singleton().Update();
THOverlay::singleton().Update();
THGuiSP::singleton().Update();

if (Gui::KeyboardInputGetRaw(VK_INSERT)) {
THRelayUI::singleton().Open();
}

THRelayUI::singleton().Update();

bool drawCursor = THAdvOptWnd::StaticUpdate() || THGuiPrac::singleton().IsOpen() || THGuiSP::singleton().IsOpen() || THRelayUI::singleton().IsOpen();
bool drawCursor = THAdvOptWnd::StaticUpdate() || THGuiPrac::singleton().IsOpen() || THGuiSP::singleton().IsOpen();
GameGuiEnd(drawCursor);
}
EHOOK_DY(th17_render, 0x4014d0)
Expand Down
Loading

0 comments on commit 17ce5e6

Please sign in to comment.