mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-11-30 02:56:42 -08:00
Initial commit for GitHub migration based on spice2x-25-03-03
This commit is contained in:
1 parent
94af8d32c9
commit
ed8c72852f
1008 files changed
+296815
No files matched your search
@@ -0,0 +1,51 @@
|
||||
#include "bc.h"
|
||||
|
||||
#include "hooks/setupapihook.h"
|
||||
#include "util/libutils.h"
|
||||
#include "acio2emu/handle.h"
|
||||
#include "acioemu/handle.h"
|
||||
#include "hooks/graphics/graphics.h"
|
||||
#include "util/detour.h"
|
||||
#include "node.h"
|
||||
|
||||
namespace games::bc {
|
||||
|
||||
static decltype(ShowCursor) *ShowCursor_orig = nullptr;
|
||||
|
||||
static int WINAPI ShowCursor_hook(BOOL bShow) {
|
||||
// log_misc("bsac", "ShowCursor {}", bShow);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void BCGame::attach() {
|
||||
Game::attach();
|
||||
|
||||
setupapihook_init(libutils::load_library("libaio.dll"));
|
||||
|
||||
SETUPAPI_SETTINGS settings {};
|
||||
const char hwid[] = "USB\\VID_1CCF&PID_8050\\0000";
|
||||
memcpy(settings.property_hardwareid, hwid, sizeof(hwid));
|
||||
const char comport[] = "COM3";
|
||||
memcpy(settings.interface_detail, comport, sizeof(comport));
|
||||
setupapihook_add(settings);
|
||||
|
||||
auto iob = new acio2emu::IOBHandle(L"COM3");
|
||||
iob->register_node(std::make_unique<TBSNode>());
|
||||
|
||||
if (GRAPHICS_SHOW_CURSOR) {
|
||||
detour::trampoline_try(
|
||||
"user32.dll", "ShowCursor",
|
||||
(void*)ShowCursor_hook, (void**)&ShowCursor_orig);
|
||||
}
|
||||
|
||||
devicehook_init();
|
||||
devicehook_add(iob);
|
||||
devicehook_add(new acioemu::ACIOHandle(L"COM1"));
|
||||
}
|
||||
|
||||
void BCGame::detach() {
|
||||
Game::detach();
|
||||
|
||||
devicehook_dispose();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user