diff --git a/dist/config.toml b/dist/config.toml index 8a5e5de..e4d5d0b 100644 --- a/dist/config.toml +++ b/dist/config.toml @@ -24,4 +24,7 @@ card = "" data = { serial = "", type = 0, song_no = [] } [drum] -wait_period = 4 \ No newline at end of file +wait_period = 4 + +[controller] +analog = false \ No newline at end of file diff --git a/src/bnusio.cpp b/src/bnusio.cpp index bb06394..40a7720 100644 --- a/src/bnusio.cpp +++ b/src/bnusio.cpp @@ -20,26 +20,26 @@ u64 touchData; callbackAttach attachCallback; i32 *attachData; -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_1 = {}; -Keybindings CARD_INSERT_2 = {}; -Keybindings QR_CARD_READ = {}; -Keybindings QR_DATA_READ = {.keycodes = {'Q'}}; -Keybindings P1_LEFT_BLUE = {.keycodes = {'D'}, .axis = {SDL_AXIS_LEFT_DOWN}}; -Keybindings P1_LEFT_RED = {.keycodes = {'F'}, .axis = {SDL_AXIS_LEFT_RIGHT}}; -Keybindings P1_RIGHT_RED = {.keycodes = {'J'}, .axis = {SDL_AXIS_RIGHT_RIGHT}}; -Keybindings P1_RIGHT_BLUE = {.keycodes = {'K'}, .axis = {SDL_AXIS_RIGHT_DOWN}}; -Keybindings P2_LEFT_BLUE = {}; -Keybindings P2_LEFT_RED = {}; -Keybindings P2_RIGHT_RED = {}; -Keybindings P2_RIGHT_BLUE = {}; -CardKeybindings *QRCODE_CARDS = new CardKeybindings[] { +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_1 = {}; +Keybindings CARD_INSERT_2 = {}; +Keybindings QR_CARD_READ = {}; +Keybindings QR_DATA_READ = {.keycodes = {'Q'}}; +Keybindings P1_LEFT_BLUE = {.keycodes = {'D'}, .axis = {SDL_AXIS_LEFT_DOWN}}; +Keybindings P1_LEFT_RED = {.keycodes = {'F'}, .axis = {SDL_AXIS_LEFT_RIGHT}}; +Keybindings P1_RIGHT_RED = {.keycodes = {'J'}, .axis = {SDL_AXIS_RIGHT_RIGHT}}; +Keybindings P1_RIGHT_BLUE = {.keycodes = {'K'}, .axis = {SDL_AXIS_RIGHT_DOWN}}; +Keybindings P2_LEFT_BLUE = {}; +Keybindings P2_LEFT_RED = {}; +Keybindings P2_RIGHT_RED = {}; +Keybindings P2_RIGHT_BLUE = {}; +CardKeybindings *QRCODE_CARDS = new CardKeybindings[]{ {.keybindings = {.keycodes = {'W'}}, .card = "BNTTCNID1"}, {.keybindings = {.keycodes = {'E'}}, .card = "BNTTCNID2"}, }; @@ -109,8 +109,8 @@ std::queue buttonQueueP2; bool useTaikoController; SDLAxis analogBindings[] = { - SDL_AXIS_LEFT_LEFT, SDL_AXIS_LEFT_RIGHT, SDL_AXIS_LEFT_DOWN, SDL_AXIS_LEFT_UP, // P1: LB, LR, RR, RB - SDL_AXIS_RIGHT_LEFT, SDL_AXIS_RIGHT_RIGHT, SDL_AXIS_RIGHT_DOWN, SDL_AXIS_RIGHT_UP, // P2: LB, LR, RR, RB + SDL_AXIS_LEFT_LEFT, SDL_AXIS_LEFT_RIGHT, SDL_AXIS_LEFT_DOWN, SDL_AXIS_LEFT_UP, // P1: LB, LR, RR, RB + SDL_AXIS_RIGHT_LEFT, SDL_AXIS_RIGHT_RIGHT, SDL_AXIS_RIGHT_DOWN, SDL_AXIS_RIGHT_UP, // P2: LB, LR, RR, RB }; u16 @@ -118,9 +118,7 @@ bnusio_GetAnalogIn (u8 which) { u16 analogValue; if (useTaikoController) { analogValue = (u16)(32768 * ControllerAxisIsDown (analogBindings[which])); - if (analogValue > 100) { - return analogValue; - } + if (analogValue > 100) return analogValue; return 0; } auto button = analogButtons[which]; @@ -243,6 +241,7 @@ u16 __fastcall bnusio_GetCoin (i32 a1) { patches::Qr::Update (); + if (attachCallback) attachCallback (0, 0, attachData); return coin_count; } @@ -335,9 +334,7 @@ Init () { auto taikoController = openConfigSection (config, "controller"); if (taikoController) { useTaikoController = readConfigBool (taikoController, "analog", useTaikoController); - if (useTaikoController) { - printf("Using analog input mode. All the keyboard drum inputs have been disabled.\n"); - } + if (useTaikoController) printf ("Using analog input mode. All the keyboard drum inputs have been disabled.\n"); } toml_free (config); } @@ -368,7 +365,7 @@ Init () { SetConfigValue (keyconfig, "P2_RIGHT_RED", &P2_RIGHT_RED); SetConfigValue (keyconfig, "P2_RIGHT_BLUE", &P2_RIGHT_BLUE); - SetCardConfigValue (keyconfig, "QRCODE_CARD", &QRCODE_CARDS, &QRCODE_CARDS_LENG); + SetCardConfigValue (keyconfig, "QRCODE_CARD", &QRCODE_CARDS, &QRCODE_CARDS_LENG); toml_free (keyconfig); } diff --git a/src/dllmain.cpp b/src/dllmain.cpp index d317bfc..410cb6f 100644 --- a/src/dllmain.cpp +++ b/src/dllmain.cpp @@ -9,9 +9,10 @@ std::vector plugins; const char *server = "127.0.0.1"; const char *port = "54430"; -const char *chassisId = "000000000000"; +const char *chassisId = "284111080000"; const char *shopId = "TAIKO ARCADE LOADER"; const char *gameVerNum = "00.00"; +char fullAddress[256] = {'\0'}; char accessCode1[21] = "00000000000000000001"; char accessCode2[21] = "00000000000000000002"; char chipId1[33] = "00000000000000000000000000000001"; @@ -108,6 +109,10 @@ DllMain (HMODULE module, DWORD reason, LPVOID reserved) { chassisId = readConfigString (amauth, "chassis_id", chassisId); shopId = readConfigString (amauth, "shop_id", shopId); gameVerNum = readConfigString (amauth, "game_ver", gameVerNum); + + std::strcat (fullAddress, server); + std::strcat (fullAddress, ":"); + std::strcat (fullAddress, port); } auto patches = openConfigSection (config, "patches"); if (patches) version = readConfigString (patches, "version", version); diff --git a/src/patches/amauth.cpp b/src/patches/amauth.cpp index 8f18bfb..45dcda1 100644 --- a/src/patches/amauth.cpp +++ b/src/patches/amauth.cpp @@ -21,6 +21,7 @@ extern const char *port; extern const char *chassisId; extern const char *shopId; extern const char *gameVerNum; +extern char fullAddress[256]; namespace patches::AmAuth { const GUID IID_CAuth{0x045A5150, 0xD2B3, 0x4590, {0xA3, 0x8B, 0xC1, 0x15, 0x86, 0x78, 0xE1, 0xAC}}; @@ -397,14 +398,14 @@ public: // printf("IAuth_GetVersionInfo called\n"); memset (version, 0, sizeof (*version)); strcpy_s (version->game_rev, "1"); - strcpy_s (version->auth_type, "CHARGE_NORMAL"); - strcpy_s (version->game_id, "S122"); + strcpy_s (version->auth_type, "ALL.NET"); + strcpy_s (version->game_id, "SBWY"); strcpy_s (version->game_ver, "12.20"); - strcpy_s (version->game_cd, "TAL0"); + strcpy_s (version->game_cd, "S121"); strcpy_s (version->cacfg_game_ver, gameVerNum); strcpy_s (version->game_board_type, "0"); strcpy_s (version->game_board_id, "PCB"); - strcpy_s (version->auth_url, server); + strcpy_s (version->auth_url, fullAddress); return 0; } @@ -421,8 +422,8 @@ public: virtual int32_t IAuth_GetAuthServerResp (amcus_auth_server_resp_t *resp) { // printf("IAuth_GetAuthServerResp called\n"); memset (resp, 0, sizeof (*resp)); - strcpy_s (resp->uri, server); - strcpy_s (resp->host, server); + strcpy_s (resp->uri, fullAddress); + strcpy_s (resp->host, fullAddress); strcpy_s (resp->shop_name, shopId); strcpy_s (resp->shop_nickname, shopId); @@ -460,12 +461,6 @@ public: // printf("IAuth_GetMuchaAuthResponse called\n"); memset (arr, 0, sizeof (*arr)); - - char fullAddress[256] = {'\0'}; - std::strcat (fullAddress, server); - std::strcat (fullAddress, ":"); - std::strcat (fullAddress, port); - strcpy_s (arr->shop_name, sizeof (arr->shop_name), shopId); strcpy_s (arr->shop_name_en, sizeof (arr->shop_name_en), shopId); strcpy_s (arr->shop_nickname, sizeof (arr->shop_nickname), shopId); diff --git a/src/patches/jp_apr_2023.cpp b/src/patches/jp_apr_2023.cpp index 1ca21d7..d9c1111 100644 --- a/src/patches/jp_apr_2023.cpp +++ b/src/patches/jp_apr_2023.cpp @@ -5,6 +5,13 @@ namespace patches::JP_APR_2023 { HOOK_DYNAMIC (char, __fastcall, AMFWTerminate, i64) { return 0; } +HOOK_DYNAMIC (i64, __fastcall, curl_easy_setopt, i64 a1, i64 a2, i64 a3, i64 a4, i64 a5) { + // printf ("garmc curl_easy_setopt\n"); + originalcurl_easy_setopt (a1, 64, 0, 0, 0); + originalcurl_easy_setopt (a1, 81, 0, 0, 0); + return originalcurl_easy_setopt (a1, a2, a3, a4, a5); +} + void Init () { i32 xRes = 1920; @@ -52,7 +59,7 @@ Init () { WRITE_MEMORY (ASLR (0x140CD4DC0), char, ".\\Setting1.bin"); WRITE_MEMORY (ASLR (0x140CD4DB0), char, ".\\Setting2.bin"); WRITE_MEMORY (ASLR (0x140C95B40), char, ".\\TournamentData\\PlayData\\TournamentPlayData.dat"); - WRITE_MEMORY (ASLR (0x140CD4DC0), char, ".\\TournamentData\\InfoData\\TournamentInfoData.dat"); + WRITE_MEMORY (ASLR (0x140C95BB0), char, ".\\TournamentData\\InfoData\\TournamentInfoData.dat"); WRITE_MEMORY (ASLR (0x140CC0508), char, ".\\Garmc\\BillingData\\GarmcBillingData.dat"); WRITE_MEMORY (ASLR (0x140CC0580), char, ".\\Garmc\\ErrorLogData\\GarmcOErrorLogData.dat"); WRITE_MEMORY (ASLR (0x140CC05E0), char, ".\\Garmc\\BillingNetIdLocationId\\GarmcBillingNetIdLocationId.dat"); @@ -72,6 +79,10 @@ Init () { auto amHandle = (u64)GetModuleHandle ("AMFrameWork.dll"); INSTALL_HOOK_DYNAMIC (AMFWTerminate, (void *)(amHandle + 0x42DE0)); + // Redirect garmc requests + auto garmcHandle = (u64)GetModuleHandle ("garmc.dll"); + INSTALL_HOOK_DYNAMIC (curl_easy_setopt, (void *)(garmcHandle + 0x1FBBB0)); + patches::Qr::Init (); patches::AmAuth::Init (); }