mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-05 00:00:42 -07:00
popn: implement bi3a-hook (bio3) (#626)
## Link to GitHub Issue or related Pull Request, if one exists #618 ## Description of change Turns out running this with bi2x doesn't process buttons properly, so we have to use bi3a. ## Testing Seems playable now.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#include "avs/game.h"
|
||||
#include "popn.h"
|
||||
#include "bi2x_hook.h"
|
||||
#include "bi3a_hook.h"
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include "rawinput/rawinput.h"
|
||||
@@ -89,6 +89,8 @@ namespace games::popn {
|
||||
|
||||
#endif
|
||||
|
||||
#if !SPICE64
|
||||
|
||||
static int __cdecl usbCheckAlive() {
|
||||
return 1;
|
||||
}
|
||||
@@ -299,6 +301,8 @@ namespace games::popn {
|
||||
return MMSYSERR_NOERROR;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static bool log_hook(void *user, const std::string &data, logger::Style style, std::string &out) {
|
||||
|
||||
// get rid of the log spam
|
||||
@@ -321,6 +325,8 @@ namespace games::popn {
|
||||
void POPNGame::pre_attach() {
|
||||
Game::pre_attach();
|
||||
|
||||
#if !SPICE64
|
||||
|
||||
// only needed for older versions (19-21, inclusive) but create them anyway since 21 and above are all M39
|
||||
fileutils::dir_create_recursive_log("popn", "dev\\raw\\bookkeeping");
|
||||
fileutils::dir_create_recursive_log("popn", "dev\\raw\\ranking");
|
||||
@@ -329,11 +335,15 @@ namespace games::popn {
|
||||
// load without resolving references
|
||||
// makes game not trigger DLLMain which results in an error due to missing EZUSB device
|
||||
LoadLibraryExW((MODULE_PATH / "ezusb.dll").c_str(), nullptr, DONT_RESOLVE_DLL_REFERENCES);
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void POPNGame::attach() {
|
||||
Game::attach();
|
||||
|
||||
#if !SPICE64
|
||||
/*
|
||||
* Fast Boot (TM) Patch
|
||||
* Game tries to create some directories and if it fails it will sleep for 1 second
|
||||
@@ -393,29 +403,47 @@ namespace games::popn {
|
||||
libutils::try_proc(ezusb, "?usbWdtStartDone@@YAHXZ"));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if SPICE64 && !SPICE_XP
|
||||
|
||||
if (is_pikapika_model()) {
|
||||
// monitor hook
|
||||
DisplayConfigGetDeviceInfo_orig = detour::iat_try("DisplayConfigGetDeviceInfo", DisplayConfigGetDeviceInfo_hook, avs::game::DLL_INSTANCE);
|
||||
// monitor hook
|
||||
DisplayConfigGetDeviceInfo_orig =
|
||||
detour::iat_try("DisplayConfigGetDeviceInfo",
|
||||
DisplayConfigGetDeviceInfo_hook, avs::game::DLL_INSTANCE);
|
||||
|
||||
// TODO: io emulation
|
||||
SETUPAPI_SETTINGS settings{};
|
||||
settings.class_guid[0] = 0x86E0D1E0;
|
||||
settings.class_guid[1] = 0x11D08089;
|
||||
settings.class_guid[2] = 0x0008E49C;
|
||||
settings.class_guid[3] = 0x731F303E;
|
||||
const char property[] = "1CCF(8050)_000";
|
||||
const char property_hardwareid[] = "USB\\VID_1CCF&PID_8050&MI_00\\000";
|
||||
memcpy(settings.property_devicedesc, property, sizeof(property));
|
||||
memcpy(settings.property_hardwareid, property_hardwareid, sizeof(property_hardwareid));
|
||||
setupapihook_init(avs::game::DLL_INSTANCE);
|
||||
setupapihook_add(settings);
|
||||
// GUID_DEVCLASS_USB = {86E0D1E0-11D0-89B0-00A0C9054129}
|
||||
SETUPAPI_SETTINGS settings{};
|
||||
settings.class_guid[0] = 0x86E0D1E0;
|
||||
settings.class_guid[1] = 0x11D08089;
|
||||
settings.class_guid[2] = 0x0008E49C;
|
||||
settings.class_guid[3] = 0x731F303E;
|
||||
|
||||
// test/service/coin buttons, lights
|
||||
bi2x_hook_init();
|
||||
}
|
||||
// BIO3 - 8058 (maybe U region cabs with more lights?)
|
||||
// BIO3 - 8054 (probably J region?)
|
||||
// BIO2 - 8050 (need bi2x_hook, everything will work except buttons 1-9)
|
||||
|
||||
const char property[] = "1CCF(8058)_000";
|
||||
const char property_hardwareid[] = "USB\\VID_1CCF&PID_8058&MI_00\\000";
|
||||
memcpy(settings.property_devicedesc, property, sizeof(property));
|
||||
memcpy(settings.property_hardwareid, property_hardwareid, sizeof(property_hardwareid));
|
||||
setupapihook_init(avs::game::DLL_INSTANCE);
|
||||
setupapihook_add(settings);
|
||||
|
||||
bi3a_hook_init();
|
||||
|
||||
// note: if for whatever reason you want to use BIO2, the game needs to be patched
|
||||
// check popn.dll and look for static table that looks like this:
|
||||
// 00000001 00000003 00000001 (button 1)
|
||||
// 00000002 00000004 00000001 (button 2)
|
||||
// 00000004 00000005 00000001 (button 3)
|
||||
// 00000008 00000006 00000001 (button 4)
|
||||
// 00000010 00000007 00000001 (button 5)
|
||||
// 00000020 00000008 00000001 (button 6)
|
||||
// 00000040 00000009 00000001 (button 7)
|
||||
// 00000080 0000000A 00000001 (button 8)
|
||||
// 00000100 0000000B 00000001 (button 9)
|
||||
// set third column to 0 and it will work with BIO2
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user