-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a "Game.DeleteForgeItem" command (bind it to a key using the "b…
…ind" command)
- Loading branch information
Showing
5 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#include "Forge.hpp" | ||
|
||
#include "../Patch.hpp" | ||
|
||
namespace | ||
{ | ||
bool shouldDelete = false; | ||
void UpdateForgeInputHook(); | ||
} | ||
|
||
namespace Patches | ||
{ | ||
namespace Forge | ||
{ | ||
void ApplyAll() | ||
{ | ||
Hook(0x19D482, UpdateForgeInputHook, HookFlags::IsCall).Apply(); | ||
} | ||
|
||
void SignalDelete() | ||
{ | ||
shouldDelete = true; | ||
} | ||
} | ||
} | ||
|
||
namespace | ||
{ | ||
__declspec(naked) void UpdateForgeInputHook() | ||
{ | ||
__asm | ||
{ | ||
mov al, shouldDelete | ||
test al, al | ||
jnz del | ||
|
||
// Not deleting - just call the original function | ||
push esi | ||
mov eax, 0x59F0E0 | ||
call eax | ||
retn 4 | ||
|
||
del: | ||
mov shouldDelete, 0 | ||
|
||
// Simulate a Y button press | ||
mov eax, 0x244D1F0 // Controller data | ||
mov byte ptr [eax + 0x9E], 1 // Ticks = 1 | ||
and byte ptr [eax + 0x9F], 0xFE // Clear the "handled" flag | ||
|
||
// Call the original function | ||
push esi | ||
mov eax, 0x59F0E0 | ||
call eax | ||
|
||
// Make sure nothing else gets the fake press | ||
mov eax, 0x244D1F0 // Controller data | ||
or byte ptr [eax + 0x9F], 1 // Set the "handled" flag | ||
retn 4 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#pragma once | ||
|
||
namespace Patches | ||
{ | ||
namespace Forge | ||
{ | ||
void ApplyAll(); | ||
|
||
// Signal to delete the current item, if any | ||
void SignalDelete(); | ||
} | ||
} |