Update to spice2x-25-04-25 (pre-apply)
> broken commit
This commit is contained in:
@@ -4,9 +4,19 @@
|
||||
#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();
|
||||
|
||||
@@ -22,6 +32,12 @@ namespace games::bc {
|
||||
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"));
|
||||
|
||||
@@ -26,3 +26,24 @@ std::vector<Button> &games::bc::get_buttons() {
|
||||
|
||||
return buttons;
|
||||
}
|
||||
|
||||
std::string games::bc::get_buttons_help() {
|
||||
// keep to max 100 characters wide
|
||||
return "";
|
||||
}
|
||||
|
||||
std::vector<Analog> &games::bc::get_analogs() {
|
||||
static std::vector<Analog> analogs;
|
||||
|
||||
if (analogs.empty()) {
|
||||
analogs = GameAPI::Analogs::getAnalogs("Busou Shinki: Armored Princess Battle Conductor");
|
||||
|
||||
GameAPI::Analogs::sortAnalogs(
|
||||
&analogs,
|
||||
"Stick X",
|
||||
"Stick Y"
|
||||
);
|
||||
}
|
||||
|
||||
return analogs;
|
||||
}
|
||||
@@ -23,5 +23,14 @@ namespace games::bc {
|
||||
};
|
||||
}
|
||||
|
||||
namespace Analogs {
|
||||
enum {
|
||||
StickX,
|
||||
StickY,
|
||||
};
|
||||
}
|
||||
|
||||
std::vector<Button> &get_buttons();
|
||||
std::string get_buttons_help();
|
||||
std::vector<Analog> &get_analogs();
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace games::bc {
|
||||
|
||||
bool read_input(std::vector<uint8_t> &buffer) {
|
||||
auto &buttons = get_buttons();
|
||||
auto &analogs = get_analogs();
|
||||
coins_ += eamuse_coin_consume_stock();
|
||||
|
||||
buffer.reserve(buffer.size() + 10);
|
||||
@@ -57,6 +58,9 @@ namespace games::bc {
|
||||
if (GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::Right])) {
|
||||
joy -= INT16_MAX;
|
||||
}
|
||||
if (analogs[Analogs::StickX].isSet()) {
|
||||
joy = 65535 - (uint16_t) (GameAPI::Analogs::getState(RI_MGR, analogs[Analogs::StickX]) * 65535);
|
||||
}
|
||||
buffer.push_back(static_cast<uint8_t>(joy >> 8));
|
||||
buffer.push_back(static_cast<uint8_t>(joy));
|
||||
|
||||
@@ -67,6 +71,9 @@ namespace games::bc {
|
||||
if (GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::Up])) {
|
||||
joy -= INT16_MAX;
|
||||
}
|
||||
if (analogs[Analogs::StickY].isSet()) {
|
||||
joy = 65535 - (uint16_t) (GameAPI::Analogs::getState(RI_MGR, analogs[Analogs::StickY]) * 65535);
|
||||
}
|
||||
buffer.push_back(static_cast<uint8_t>(joy >> 8));
|
||||
buffer.push_back(static_cast<uint8_t>(joy));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user