Skip to content

Commit

Permalink
Update original usio hook
Browse files Browse the repository at this point in the history
  • Loading branch information
esuo1198 committed Oct 17, 2024
1 parent cd6261b commit 78f4dd8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ unlock_songs = true
mode_collabo026 = false

[emulation]
# If usio emulation is disabled, card_reader emulation, qr emulation and plugins will also stop working
# Also, you need to place bnusio_original.dll (unmodified bnusio.dll) in the executable folder
# If usio emulation is disabled, you need to place bnusio_original.dll (unmodified bnusio.dll) in the executable folder
usio = true
card_reader = true
qr = true
Expand Down
12 changes: 10 additions & 2 deletions src/bnusio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,14 @@ FUNCTION_PTR (u16, bnusio_GetAnalogIn_Original, PROC_ADDRESS ("bnusio_original.d
FUNCTION_PTR (u16, bnusio_GetCoin_Original, PROC_ADDRESS ("bnusio_original.dll", "bnusio_GetCoin"), i32 a1);
FUNCTION_PTR (u32, bnusio_GetSwIn_Original, PROC_ADDRESS ("bnusio_original.dll", "bnusio_GetSwIn"));
FUNCTION_PTR (i64, bnusio_Close_Original, PROC_ADDRESS ("bnusio_original.dll", "bnusio_Close"));
HOOK (u16, bnusio_GetCoin_Hook, bnusio_GetCoin, i32 a1) {
originalbnusio_GetCoin_Hook (a1);
return bnusio_GetCoin_Original (a1);
}
HOOK (i64, bnusio_Close_Hook, bnusio_Close) {
originalbnusio_Close_Hook ();
return bnusio_Close_Original ();
}

HOOK (u64, bngrw_DevReset, PROC_ADDRESS ("bngrw.dll", "BngRwDevReset")) { return 1; }
HOOK (u64, bngrw_ReadMifare, PROC_ADDRESS ("bngrw.dll", "BngRwExReadMifareAllBlock")) { return 0xFFFFFF9C; }
Expand Down Expand Up @@ -452,9 +460,9 @@ Init () {
INSTALL_HOOK_DIRECT (bnusio_DecCoin, bnusio_DecCoin_Original);
INSTALL_HOOK_DIRECT (bnusio_GetFirmwareVersion, bnusio_GetFirmwareVersion_Original);
INSTALL_HOOK_DIRECT (bnusio_GetAnalogIn, bnusio_GetAnalogIn_Original);
INSTALL_HOOK_DIRECT (bnusio_GetCoin, bnusio_GetCoin_Original);
INSTALL_HOOK_DIRECT (bnusio_GetSwIn, bnusio_GetSwIn_Original);
INSTALL_HOOK_DIRECT (bnusio_Close, bnusio_Close_Original);
INSTALL_HOOK (bnusio_GetCoin_Hook);
INSTALL_HOOK (bnusio_Close_Hook);

std::cout << "[Init] USIO emulation disabled" << std::endl;
}
Expand Down

0 comments on commit 78f4dd8

Please sign in to comment.