Add QR emulation

This commit is contained in:
esuo1198
2023-09-19 00:10:54 +09:00
parent 510556643b
commit 90b0c890b6
12 changed files with 285 additions and 51 deletions
+24 -42
View File
@@ -1,9 +1,14 @@
#include "helpers.h"
#include "poll.h"
#include "patches/patches.h"
#include <xxhash.h>
#include "keyconfig.h"
#include "constants.h"
extern std::vector<HMODULE> plugins;
extern char accessCode[21];
extern char chipId[33];
extern GameVersion version;
namespace bnusio {
#define RETURN_FALSE(returnType, functionName, ...) \
@@ -56,22 +61,21 @@ bnusio_GetFirmwareVersion () {
return 126;
}
Keybindings EXIT = {.keycodes = {VK_ESCAPE}};
Keybindings TEST = {.keycodes = {VK_F1}};
Keybindings SERVICE = {.keycodes = {VK_F2}};
Keybindings DEBUG_UP = {.keycodes = {VK_UP}};
Keybindings DEBUG_DOWN = {.keycodes = {VK_DOWN}};
Keybindings DEBUG_ENTER = {.keycodes = {VK_RETURN}};
Keybindings COIN_ADD = {.keycodes = {VK_RETURN}, .buttons = {SDL_CONTROLLER_BUTTON_START}};
Keybindings CARD_INSERT = {.keycodes = {'P'}};
Keybindings P1_LEFT_BLUE = {.keycodes = {'D'}, .axis = {SDL_AXIS_LTRIGGER_DOWN}};
Keybindings P1_LEFT_RED = {.keycodes = {'F'}, .buttons = {SDL_CONTROLLER_BUTTON_LEFTSTICK}};
Keybindings P1_RIGHT_RED = {.keycodes = {'J'}, .buttons = {SDL_CONTROLLER_BUTTON_RIGHTSTICK}};
Keybindings P1_RIGHT_BLUE = {.keycodes = {'K'}, .axis = {SDL_AXIS_RTRIGGER_DOWN}};
Keybindings P2_LEFT_BLUE = {};
Keybindings P2_LEFT_RED = {};
Keybindings P2_RIGHT_RED = {};
Keybindings P2_RIGHT_BLUE = {};
extern Keybindings EXIT;
extern Keybindings TEST;
extern Keybindings SERVICE;
extern Keybindings DEBUG_UP;
extern Keybindings DEBUG_DOWN;
extern Keybindings DEBUG_ENTER;
extern Keybindings COIN_ADD;
extern Keybindings P1_LEFT_BLUE;
extern Keybindings P1_LEFT_RED;
extern Keybindings P1_RIGHT_RED;
extern Keybindings P1_RIGHT_BLUE;
extern Keybindings P2_LEFT_BLUE;
extern Keybindings P2_LEFT_RED;
extern Keybindings P2_RIGHT_RED;
extern Keybindings P2_RIGHT_BLUE;
u16 drumMin = 10000;
u16 drumMax = 20000;
@@ -160,6 +164,8 @@ u16 __fastcall bnusio_GetCoin (i32 a1) {
if (updateEvent) updateEvent ();
}
if (version == GameVersion::CN_JUN_2023) patches::Qr::Update();
return coin_count;
}
@@ -217,32 +223,8 @@ Init () {
INSTALL_HOOK (bngrw_ReqSendUrl);
INSTALL_HOOK (bngrw_ReqSetLedPower);
INSTALL_HOOK (bngrw_reqCancel);
INSTALL_HOOK (bngrw_Init);
INSTALL_HOOK (bngrw_Init)
auto configPath = std::filesystem::current_path () / "keyconfig.toml";
toml_table_t *config = openConfig (configPath);
if (config) {
SetConfigValue (config, "EXIT", &EXIT);
SetConfigValue (config, "TEST", &TEST);
SetConfigValue (config, "SERVICE", &SERVICE);
SetConfigValue (config, "DEBUG_UP", &DEBUG_UP);
SetConfigValue (config, "DEBUG_DOWN", &DEBUG_DOWN);
SetConfigValue (config, "DEBUG_ENTER", &DEBUG_ENTER);
SetConfigValue (config, "COIN_ADD", &COIN_ADD);
SetConfigValue (config, "CARD_INSERT", &CARD_INSERT);
SetConfigValue (config, "P1_LEFT_BLUE", &P1_LEFT_BLUE);
SetConfigValue (config, "P1_LEFT_RED", &P1_LEFT_RED);
SetConfigValue (config, "P1_RIGHT_RED", &P1_RIGHT_RED);
SetConfigValue (config, "P1_RIGHT_BLUE", &P1_RIGHT_BLUE);
SetConfigValue (config, "P2_LEFT_BLUE", &P2_LEFT_BLUE);
SetConfigValue (config, "P2_LEFT_RED", &P2_LEFT_RED);
SetConfigValue (config, "P2_RIGHT_RED", &P2_RIGHT_RED);
SetConfigValue (config, "P2_RIGHT_BLUE", &P2_RIGHT_BLUE);
toml_free (config);
}
KeyConfig::Init();
}
} // namespace bnusio