mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-01 22:30:42 -07:00
iidx, sdvx: bi2x hook fix (attempt 2) (#499)
## Link to GitHub Issue, if one exists see my previous attempt #496, which has been reverted by #500 ## Description of change Two issues: 1. the original implementation of bi2x_hook for iidx misunderstood what `aioNMgrIob2_Create` does. In the original I/O code it returns a pointer to a C++ class instance, which would also have a vptr (pointer to a vtable) in the beginning. The original author of this code of the hook in spice thought that `aioNMgrIob2_Create` returns a pointer to a pointer. This may happen to work but it's not 100% accurate, so this has been fixed by separating out the class and the vtable allocation. Without this, the game could have accessed memory outside this buffer. 2. And then the SDVX implementation blindly copy-pasted the IIDX `bi2x_hook`. Along with the issue above, they also forgot to check the I/O DLLs to see how much memory needs to be allocated and change that. Instead, they kept the same value as IIDX, which was too small. Fix that as well. ## Testing Doing some extensive testing with IIDX (27-33) and SDVX versions (EG).
This commit is contained in:
@@ -251,6 +251,8 @@ namespace games::iidx {
|
||||
}
|
||||
}
|
||||
|
||||
#if SPICE64
|
||||
|
||||
typedef void* (*aioIob2Bi2x_CreateWriteFirmContext_t)(unsigned int, int);
|
||||
static aioIob2Bi2x_CreateWriteFirmContext_t aioIob2Bi2x_CreateWriteFirmContext_orig = nullptr;
|
||||
|
||||
@@ -269,6 +271,8 @@ namespace games::iidx {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
IIDXGame::IIDXGame() : Game("Beatmania IIDX") {
|
||||
logger::hook_add(log_hook, this);
|
||||
}
|
||||
@@ -319,6 +323,8 @@ namespace games::iidx {
|
||||
devicehook_add(new IIDXFMSerialHandle());
|
||||
}
|
||||
|
||||
#if SPICE64
|
||||
|
||||
// check for new I/O DLL
|
||||
auto aio = libutils::try_library("libaio.dll");
|
||||
if (aio != nullptr) {
|
||||
@@ -384,6 +390,8 @@ namespace games::iidx {
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
if (hooks::audio::ENABLED) {
|
||||
apply_audio_hacks();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user