fix mouse scroll | high res Don Model | clean extra space

This commit is contained in:
ptmaster
2025-01-11 18:55:56 +08:00
parent 7967dfd845
commit c1961ec67d
16 changed files with 177 additions and 107 deletions
+6 -3
View File
@@ -46,7 +46,7 @@ mode_collabo026 = false # Enable ai soshina mode
[emulation]
usio = true # If usio emulation is disabled, you need to place bnusio_original.dll (unmodified bnusio.dll) in the executable folder.
card_reader = true # Disable this if you have an original namco card reader
accept_invalid = false # Enable this if you want to accept cards incompatible with the original readers
accept_invalid = false # Enable this if you want to accept cards incompatible with the original readers
qr = true # Disable this if you have an original namco qr code scanner
@@ -56,6 +56,9 @@ windowed = false # not windowed will automatically fullscreen
cursor = true # fullscreen will automatically hide cursor
vsync = false # enable this if you are using a 120fps screen (and use "Let Application Decide" in Nvidia panel)
# fpslimit = 0 # temporoly remove it, limit it to 120 in Nvidia panel instead!!!
model_res_rate = 1.0 # Don-Model resolution rate (currently JPN39 only)
# | rate <= 0: default 1280x720
# | rate > 0: current resolution * rate
[audio]
wasapi_shared = false # Wasapi shared mode, allows you to have multiple audio sources at once at a cost of having higher latency.
@@ -85,8 +88,8 @@ jp_layout = false # Use jp layout scan code (if using jp layout keyboa
[layeredfs]
enabled = false # Replace assets from the game using a layered file system.
# | For example if you want to edit the wordlist, add your edited version like so:
# | .\Data_mods\x64\datatable\wordlist.json
# | You can provide both unencrypted and encrypted files.
# | .\Data_mods\x64\datatable\wordlist.json
# | You can provide both unencrypted and encrypted files.
[logging]
log_level = "INFO" # Log level, Can be either "NONE", "ERROR", "WARN", "INFO", "DEBUG" and "HOOKS"
+6 -3
View File
@@ -26,7 +26,7 @@ mode_collabo026 = false # Enable ai soshina mode
[emulation]
usio = true # Disable this if you want to use an original Namco USIO board. you need to place bnusio_original.dll (unmodified bnusio.dll) in the executable folder.
card_reader = true # Disable this if you want to use an original Namco card reader
accept_invalid = false # Enable this if you want to accept cards incompatible with the original readers
accept_invalid = false # Enable this if you want to accept cards incompatible with the original readers
qr = true # Disable this if you want to use an original Namco QR code scanner
@@ -36,6 +36,9 @@ windowed = false # not windowed will automatically fullscreen
cursor = true # fullscreen will automatically hide cursor
vsync = false # enable this if you are using a 120fps screen (and use "Let Application Decide" in Nvidia panel)
# fpslimit = 0 # temporoly remove it, limit it to 120 in Nvidia panel instead!!!
model_res_rate = 1.0 # Don-Model resolution rate (currently JPN39 only)
# | rate <= 0: default 1280x720
# | rate > 0: current resolution * rate
[audio]
@@ -71,8 +74,8 @@ jp_layout = false # Use jp layout scan code (if using jp layout keyboa
[layeredfs]
enabled = false # Replace assets from the game using a layered file system.
# | For example if you want to edit the wordlist, add your edited version like so:
# | .\Data_mods\x64\datatable\wordlist.json
# | You can provide both unencrypted and encrypted files.
# | .\Data_mods\x64\datatable\wordlist.json
# | You can provide both unencrypted and encrypted files.
[logging]
+1 -1
View File
@@ -21,7 +21,7 @@ P2_LEFT_RED = ["X"]
P2_RIGHT_RED = ["C"]
P2_RIGHT_BLUE = ["V"]
# ESCAPE F1 through F12
# ESCAPE F1 through F12
# ` 1 through 0 -= BACKSPACE ^ YEN
# TAB QWERTYUIOP [ ] BACKSLASH @
# CAPS_LOCK ASDFGHJKL ;' ENTER :
+6 -9
View File
@@ -37,9 +37,6 @@ Keybindings P2_LEFT_BLUE = {.keycodes = {'Z'}};
Keybindings P2_LEFT_RED = {.keycodes = {'X'}};
Keybindings P2_RIGHT_RED = {.keycodes = {'C'}};
Keybindings P2_RIGHT_BLUE = {.keycodes = {'V'}};
// Keybindings ALL[] = { EXIT, TEST, SERVICE, DEBUG_UP, DEBUG_DOWN, DEBUG_ENTER, COIN_ADD,
// CARD_INSERT_1, CARD_INSERT_2, QR_DATA_READ, QR_IMAGE_READ, P1_LEFT_BLUE, P1_LEFT_RED,
// P1_RIGHT_RED, P1_RIGHT_BLUE, P2_LEFT_BLUE, P2_LEFT_RED, P2_RIGHT_RED, P2_RIGHT_BLUE };
const int exitWait = 100;
int exited = 0;
@@ -80,7 +77,7 @@ BNUSIO_EXPORT (u16, bnusio_GetRegisterU16, i16 a1) CALL_BNUSIO
BNUSIO_EXPORT (u8, bnusio_GetRegisterU8, u16 a1) CALL_BNUSIO_FALSE (bnusio_GetRegisterU8, a1)
BNUSIO_EXPORT (void *, bnusio_GetBuffer, u16 a1, i64 a2, i16 a3) CALL_BNUSIO_FALSE (bnusio_GetBuffer, a1, a2, a3)
BNUSIO_EXPORT (i64, bnusio_SetRegisterU16, u16 a1, u16 a2) CALL_BNUSIO_FALSE (bnusio_SetRegisterU16, a1, a2)
BNUSIO_EXPORT (i64, bnusio_SetRegisterU8, u16 a1, u8 a2) CALL_BNUSIO_FALSE (bnusio_SetRegisterU8, a1, a2)
BNUSIO_EXPORT (i64, bnusio_SetRegisterU8, u16 a1, u8 a2) CALL_BNUSIO_FALSE (bnusio_SetRegisterU8, a1, a2)
BNUSIO_EXPORT (i64, bnusio_SetBuffer, u16 a1, i32 a2, i16 a3) CALL_BNUSIO_FALSE (bnusio_SetBuffer, a1, a2, a3)
BNUSIO_EXPORT (void *, bnusio_GetSystemError) CALL_BNUSIO_FALSE (bnusio_GetSystemError)
BNUSIO_EXPORT (i64, bnusio_SetSystemError, i16 a1) CALL_BNUSIO_FALSE (bnusio_SetSystemError, a1)
@@ -236,6 +233,10 @@ Init () {
// fpsLimit = (int)readConfigInt (graphics, "fpslimit", fpsLimit);
// }
}
updateByCoin = fpsLimit == 0;
// if (updateByCoin) {
// LogMessage (LogLevel::INFO, "fpsLimit is set to 0, bnusio::Update() will invoke in getCoin callback");
// }
if (analogInput) {
LogMessage (LogLevel::WARN, "[Analog Type] Axis: All the keyboard drum inputs have been disabled");
@@ -251,10 +252,6 @@ Init () {
analogMethod = AnalogInputSimple;
}
updateByCoin = fpsLimit == 0;
// if (updateByCoin) {
// LogMessage (LogLevel::INFO, "fpsLimit is set to 0, bnusio::Update() will invoke in getCoin callback");
// }
const auto keyConfigPath = std::filesystem::current_path () / "keyconfig.toml";
const std::unique_ptr<toml_table_t, void (*) (toml_table_t *)> keyConfig_ptr (openConfig (keyConfigPath), toml_free);
if (keyConfig_ptr) {
@@ -285,7 +282,7 @@ Init () {
SetConfigValue (keyConfig, "P2_RIGHT_BLUE", &P2_RIGHT_BLUE, &inputState);
}
LogMessage (LogLevel::INFO, "Finish Loading keyconfig.toml useKeyboard={} useMouse={} useController={}",
LogMessage (LogLevel::INFO, "Finish Loading keyconfig.toml useKeyboard={} useMouse={} useController={}",
(inputState & 1) ? "true" : "false", (inputState & (1 << 1)) ? "true" : "false", (inputState & (1 << 2)) ? "true" : "false");
if (!emulateUsio && !exists (std::filesystem::current_path () / "bnusio_original.dll")) {
+20
View File
@@ -42,6 +42,22 @@ bool logToFile = true;
HWND hGameWnd;
FAST_HOOK (i32, ShowMouse, PROC_ADDRESS ("user32.dll", "ShowCursor"), bool) { return originalShowMouse.stdcall<i32> (true); }
FAST_HOOK (i32, ExitWindows, PROC_ADDRESS ("user32.dll", "ExitWindowsEx")) { ExitProcess (0); }
// FAST_HOOK (ATOM, HookRegisterClassA, PROC_ADDRESS ("winuser.h", "RegisterClassA"), WNDCLASSA *lpWndClass) {
// LogMessage (LogLevel::DEBUG, "RegisterClassA name={}", lpWndClass->lpszClassName);
// return originalHookRegisterClassA.call<ATOM> (lpWndClass);
// }
// FAST_HOOK (ATOM, HookRegisterClassW, PROC_ADDRESS ("winuser.h", "RegisterClassW"), WNDCLASSW *lpWndClass) {
// LogMessage (LogLevel::DEBUG, L"RegisterClassW name={}", lpWndClass->lpszClassName);
// return originalHookRegisterClassW.call<ATOM> (lpWndClass);
// }
// FAST_HOOK (ATOM, HookRegisterClassExA, PROC_ADDRESS ("winuser.h", "RegisterClassExA"), WNDCLASSEXA *lpWndClass) {
// LogMessage (LogLevel::DEBUG, "RegisterClassExA name={}", lpWndClass->lpszClassName);
// return originalHookRegisterClassExA.call<ATOM> (lpWndClass);
// }
// FAST_HOOK (ATOM, HookRegisterClassExW, PROC_ADDRESS ("winuser.h", "RegisterClassExW"), WNDCLASSEXW *lpWndClass) {
// LogMessage (LogLevel::DEBUG, L"RegisterClassExW name={}", lpWndClass->lpszClassName);
// return originalHookRegisterClassExW.call<ATOM> (lpWndClass);
// }
FAST_HOOK (HWND, CreateWindow, PROC_ADDRESS ("user32.dll", "CreateWindowExW"), DWORD dwExStyle, LPCWSTR lpClassName, LPCWSTR lpWindowName, DWORD dwStyle,
i32 X, i32 Y, i32 nWidth, i32 nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam) {
if (lpWindowName != nullptr) {
@@ -284,6 +300,10 @@ DllMain (HMODULE module, const DWORD reason, LPVOID reserved) {
if (windowed && cursor) INSTALL_FAST_HOOK (ShowMouse);
INSTALL_FAST_HOOK (ExitWindows);
INSTALL_FAST_HOOK (CreateWindow);
// INSTALL_FAST_HOOK (HookRegisterClassA);
// INSTALL_FAST_HOOK (HookRegisterClassW);
// INSTALL_FAST_HOOK (HookRegisterClassExA);
// INSTALL_FAST_HOOK (HookRegisterClassExW);
INSTALL_FAST_HOOK (SetWindowPosition);
INSTALL_FAST_HOOK (ExitProcessHook);
+11 -1
View File
@@ -73,6 +73,16 @@ readConfigInt (const toml_table_t *table, const std::string &key, const i64 notF
return u.i;
}
double
readConfigDouble (const toml_table_t *table, const std::string &key, const double notFoundValue) {
const auto [ok, u] = toml_double_in (table, key.c_str ());
if (!ok) {
LogMessage (LogLevel::WARN, ("Could not find Int named " + key).c_str ());
return notFoundValue;
}
return u.d;
}
std::string
readConfigString (const toml_table_t *table, const std::string &key, const std::string &notFoundValue) {
const auto [ok, u] = toml_string_in (table, key.c_str ());
@@ -184,7 +194,7 @@ AreAllBytesZero (const u8 *array, const size_t offset, const size_t length) {
return true;
}
void
void
withFile (const char *fileName, std::function<void (u8 *)> callback) {
FILE *file = fopen (fileName, "rb");
if (file == nullptr) return;
+1
View File
@@ -172,6 +172,7 @@ toml_table_t *openConfig (const std::filesystem::path &path);
toml_table_t *openConfigSection (const toml_table_t *config, const std::string &sectionName);
bool readConfigBool (const toml_table_t *table, const std::string &key, bool notFoundValue);
i64 readConfigInt (const toml_table_t *table, const std::string &key, i64 notFoundValue);
double readConfigDouble (const toml_table_t *table, const std::string &key, const double notFoundValue);
std::string readConfigString (const toml_table_t *table, const std::string &key, const std::string &notFoundValue);
std::vector<i64> readConfigIntArray (const toml_table_t *table, const std::string &key, std::vector<i64> notFoundValue);
std::wstring replace (const std::wstring orignStr, const std::wstring &oldStr, const std::wstring &newStr);
+1 -2
View File
@@ -121,8 +121,7 @@ typedef struct amcus_state {
/* Offset: 8 */ i32 allnet_auth_state;
/* Offset: 12 */ i32 allnet_auth_count;
/* Offset: 16 */ i32 allnet_last_error;
/* Offset: 24 */
mucha_state mucha_state;
/* Offset: 24 */ mucha_state mucha_state;
/* Offset: 176 */ i64 clock_status;
/* Offset: 184 */ i64 name_resolution_timeout;
/* Offset: 192 */ /* ENUM32 */ u32 auth_type;
+12 -12
View File
@@ -41,7 +41,7 @@ typedef struct {
void *languageData = nullptr;
const size_t languageOffset = languages.size () * 560;
// jp_64, jp_30, jp_32, en_64, en_30, en_32, tw_64, tw_30, tw_32, ko_64, ko_30, ko_32, cn_64, cn_30, cn_32
const float upA[15] = { -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
const float upA[15] = { -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
const float upB[15] = { -0.265625f, 0.15f, 0.078125f, -0.21875f, 0.2329999f, 0.140625f, -0.0625f, 0.333f, 0.28125f, -0.109375f, 0.333f, 0.28125f, -0.09375f, 0.30000001f, 0.25f };
const float downA[15] = { -0.25f, 0.167f, 0.125f, -0.21875f, 0.233f, 0.140625f, -0.0625f, 0.333f, 0.25f, -0.125f, 0.333f, 0.28125f, -0.09375f, 0.30000001f, 0.25f };
const float downB[15] = { 50.5f, 10.0f, 13.0f, 46.0f, 8.0f, 11.5f, 36.0f, 5.0f, 7.0f, 39.0f, 5.0f, 7.0f, 38.0f, 6.0f, 8.0f };
@@ -78,7 +78,7 @@ FAST_HOOK_DYNAMIC (int, initial_load_setting) {
*(u32 *)(basicOffset + 0x68) = lang == 0 ? 0 : (3 * lang + shapeIndex + 1);
}
}
}
}
return 0;
}
@@ -102,7 +102,7 @@ void
Init () {
bool fontExistAll = true;
const char *fontToCheck[]{
"cn_30.nutexb", "cn_30.xml", "cn_32_EB.nutexb", "cn_32_EB.xml", "cn_32_B.nutexb",
"cn_30.nutexb", "cn_30.xml", "cn_32_EB.nutexb", "cn_32_EB.xml", "cn_32_B.nutexb",
"cn_32_B.xml", "cn_32_DB.nutexb", "cn_32_DB.xml", "cn_64.nutexb", "cn_64.xml"
};
for (int i = 0; i < 6; i++) {
@@ -123,7 +123,7 @@ Init () {
node.attribute (L"max").set_value (L"4");
node.attribute (L"replace-text").set_value (L"0:JPN, 1:ENG, 2:zh-tw, 3:KOR, 4:zh-cn");
}, [&](){
// load_setting
// load_setting
INSTALL_FAST_HOOK_DYNAMIC (initial_load_setting, ASLR (0x14001B010));
// SceneBoot::LoadFont
language_patch.push_back (safetyhook::create_mid (ASLR (0x140464235), [](SafetyHookContext &ctx){
@@ -131,12 +131,12 @@ Init () {
ctx.rax = (uintptr_t)languageData;
ctx.rip = ASLR (0x140464243);
}));
language_patch.push_back (safetyhook::create_mid (ASLR (0x14046426C), [](SafetyHookContext &ctx){
language_patch.push_back (safetyhook::create_mid (ASLR (0x14046426C), [](SafetyHookContext &ctx){
ctx.r15 = ctx.rbp + languageOffset;
ctx.rip = ASLR (0x140464273);
}));
// SceneBoot::SetFontShift
language_patch.push_back (safetyhook::create_mid (ASLR (0x1404644AF), [](SafetyHookContext &ctx){
language_patch.push_back (safetyhook::create_mid (ASLR (0x1404644AF), [](SafetyHookContext &ctx){
ctx.rdi = ctx.rcx * languageOffset;
ctx.rax = (uintptr_t)languageData;
ctx.rdi += ctx.rax;
@@ -203,7 +203,7 @@ MID_HOOK_DYNAMIC (WordlistLanguageType, SafetyHookContext &ctx) {
u64 *data = jsonGetMember (json, languageTexts[0].c_str ());
if ((*((u16 *)data + 7) & 0x1000) == 0) data = (u64 *)(data[1] & 0xFFFFFFFFFFFF);
taiko_assign ((void *)(ctx.rsp + 0x60), (char *)data, strlen ((char *)data));
} else taiko_assign ((void *)(ctx.rsp + 0x60), "", 0);
} else taiko_assign ((void *)(ctx.rsp + 0x60), "", 0);
if (fallback != -1) {
if (jsonHasMember (json, languageFontTypes[fallback].c_str ())) {
@@ -393,7 +393,7 @@ Init () {
LogMessage (LogLevel::INFO, "Detected onpu_cn files, install onp patches!");
INSTALL_MID_HOOK_DYNAMIC (ChangeOnpFile, ASLR (0x140134D16));
}
language_patch.push_back (safetyhook::create_mid (ASLR (0x140134E22), [](SafetyHookContext &ctx){
language_patch.push_back (safetyhook::create_mid (ASLR (0x140134E22), [](SafetyHookContext &ctx){
if (ctx.rcx == 4) *(int *)(ctx.r15 + 0x3100) = 2;
else *(int *)(ctx.r15 + 0x3100) = (int)ctx.rcx;
ctx.rip = ASLR (0x140134E29);
@@ -436,14 +436,14 @@ Init () {
if (!maidNutexb.starts_with ("..\\") && std::filesystem::exists (prefix + maidNutexb)) maidNutexb = prefix + maidNutexb;
}
if (!maidNulm.starts_with ("..\\") || !maidNutexb.starts_with ("..\\")) titleExistMaid = false;
if (titleExistSeason || (titleExistMaid && titleExistMaidCn)) {
TestMode::RegisterItem (
L"<select-item label=\"TITLE SCREEN(NEED FILES)\" param-offset-x=\"35\" replace-text=\"0:DEFAULT, 1:SEASON(CHN), "
L"2:MAID\" group=\"Setting\" id=\"ModTitleScreen\" max=\"2\" min=\"0\" default=\"0\"/>",
[&](){
LayeredFs::RegisterBefore ([&] (const std::string &originalFileName, const std::string &currentFileName) -> std::string {
if (currentFileName.starts_with ("F:\\lumen\\") || currentFileName.find ("title") == std::string::npos) return "";
if (currentFileName.starts_with ("F:\\lumen\\") || currentFileName.find ("title") == std::string::npos) return "";
if (currentFileName.ends_with ("\\title.nulm")) {
if (language == 4 && titleScreen->Read () == 1 && titleExistSeason) return seasonNulm;
if (language == 4 && titleScreen->Read () == 2 && titleExistMaidCn) return maidNulmCn;
@@ -634,7 +634,7 @@ Init () {
LogMessage (LogLevel::INFO, "Detected voice files, install voice patches!");
TestMode::RegisterItemAfter(
L"/root/menu[@id='OthersMenu']/layout[@type='Center']/select-item[@id='LanguageItem']",
L"<select-item label=\"VOICE\" param-offset-x=\"35\" replace-text=\"0:JPN, 1:CHN\" group=\"Setting\" "
L"<select-item label=\"VOICE\" param-offset-x=\"35\" replace-text=\"0:JPN, 1:CHN\" group=\"Setting\" "
L"id=\"VoiceLanguageItem\" max=\"1\" min=\"0\" default=\"0\"/>",
[&](){
INSTALL_FAST_HOOK_DYNAMIC (PlaySoundMain, ASLR (0x1404C6DC0));
@@ -649,7 +649,7 @@ Init () {
}
}
boolean
boolean
CnFontPatches () {
return cnFontPatches;
}
+2 -2
View File
@@ -279,7 +279,7 @@ FAST_HOOK (HANDLE, CreateFileAHook, PROC_ADDRESS ("kernel32.dll", "CreateFileA")
LPCSTR pFinalFileName = changed ? currentFileName.c_str () : lpFileName;
if (changed) LogMessage (LogLevel::HOOKS, "Final Redirect: {}", currentFileName);
return originalCreateFileAHook.stdcall<HANDLE> (pFinalFileName, dwDesiredAccess, dwShareMode,
return originalCreateFileAHook.stdcall<HANDLE> (pFinalFileName, dwDesiredAccess, dwShareMode,
lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile);
}
@@ -293,7 +293,7 @@ Init () {
}
register_cipher (&aes_desc);
if (useLayeredFs || !beforeHandlers.empty () || !afterHandlers.empty ()) {
LogMessage (LogLevel::INFO, "using LayeredFs! Data_mods={} beforHandlers={} afterHandlers={}",
LogMessage (LogLevel::INFO, "using LayeredFs! Data_mods={} beforHandlers={} afterHandlers={}",
useLayeredFs ? "enabled" : "disabled", beforeHandlers.size (), afterHandlers.size ());
INSTALL_FAST_HOOK (CreateFileAHook);
}
+4 -4
View File
@@ -40,7 +40,7 @@ namespace patches::Plugins {
}
}
// Card API
void
void
WaitTouch (CallBackTouchCard callback, uint64_t touchData) {
for (auto plugin : plugins) {
auto event = GetProcAddress (plugin, "WaitTouch");
@@ -48,7 +48,7 @@ namespace patches::Plugins {
}
}
// QR API (deprecated)
void
void
InitQr (GameVersion gameVersion) {
for (auto plugin : plugins) {
auto event = GetProcAddress (plugin, "InitQr");
@@ -62,7 +62,7 @@ namespace patches::Plugins {
if (event) ((BasicEvent)event) ();
}
}
void *
void *
CheckQr () {
for (auto plugin : plugins) {
auto event = GetProcAddress (plugin, "UsingQr");
@@ -70,7 +70,7 @@ namespace patches::Plugins {
}
return nullptr;
}
size_t
size_t
GetQr (void *plugin, size_t size, uint8_t *buffer) {
auto event = GetProcAddress (*(HMODULE *)plugin, "GetQr");
if (event) return ((CopyDataEvent)event) (size, buffer);
+5 -5
View File
@@ -120,7 +120,7 @@ namespace Card {
patches::Scanner::Card::Internal::InsertCard (cardData, internalInvoke);
return true;
}
}
}
FAST_HOOK (u64, bngrw_Init, PROC_ADDRESS ("bngrw.dll", "BngRwInit")) { return 0; }
FAST_HOOK (void, bngrw_Fin, PROC_ADDRESS ("bngrw.dll", "BngRwFin")) { return; }
@@ -140,7 +140,7 @@ namespace Card {
FAST_HOOK (i32, bngrw_ReqLatchID, PROC_ADDRESS ("bngrw.dll", "BngRwReqLatchID")) { return 1; }
FAST_HOOK (u64, bngrw_ReqAiccAuth, PROC_ADDRESS ("bngrw.dll", "BngRwReqAiccAuth")) { return 1; }
FAST_HOOK (u64, bngrw_DevReset, PROC_ADDRESS ("bngrw.dll", "BngRwDevReset")) { return 1; } // Invoke when enter testmode
FAST_HOOK (i32, bngrw_ReqCancel, PROC_ADDRESS ("bngrw.dll", "BngRwReqCancel")) {
FAST_HOOK (i32, bngrw_ReqCancel, PROC_ADDRESS ("bngrw.dll", "BngRwReqCancel")) {
if (state != State::Disable) {
state = State::Disable;
patches::Scanner::Card::Internal::Commit0 (accessCodeTemplate, chipIdTemplate, true);
@@ -161,7 +161,7 @@ namespace Card {
return 1;
}
HOOK (i64, bngrw_ReqCancelOfficial, PROC_ADDRESS ("bngrw.dll", "BngRwReqCancel"), u32 a1) {
HOOK (i64, bngrw_ReqCancelOfficial, PROC_ADDRESS ("bngrw.dll", "BngRwReqCancel"), u32 a1) {
if (state != State::Disable) {
state = State::Disable;
patches::Plugins::UpdateStatus (StatusType::CardStatus, false);
@@ -312,7 +312,7 @@ namespace Qr {
}
if (scanQueue.empty() || *scanQueue.back() != buffer) {
std::vector<uint8_t> *scanData = new std::vector<uint8_t> ();
for (uint8_t byte_data : buffer)
for (uint8_t byte_data : buffer)
scanData->push_back (byte_data);
scanQueue.push (scanData);
}
@@ -328,7 +328,7 @@ namespace Qr {
}
std::vector<uint8_t> buffer = {};
std::string accessQRDataBase = "BNTTCNID";
if (!accessCode.starts_with (accessQRDataBase))
if (!accessCode.starts_with (accessQRDataBase))
for (char word : accessQRDataBase) buffer.push_back (word);
for (char word : accessCode) buffer.push_back (word);
return patches::Scanner::Qr::Commit (buffer);
+29 -29
View File
@@ -216,8 +216,8 @@ public:
}
int
Read (int value) override {
if (reset) {
this->value = ReadTestModeValue (key.c_str ());
if (reset) {
this->value = ReadTestModeValue (key.c_str ());
if (this->value != -1) {
LogMessage (LogLevel::DEBUG, L"TestMode Value({}) got val: {}", this->key, this->value);
reset = false;
@@ -359,58 +359,58 @@ LocalizationCHT () {
);
TestMode::RegisterModify(
L"/root/menu[@id='ModManagerMenu']/layout[@type='Center']/select-item[@id='ModFixLanguage']",
[&](pugi::xml_node &node) {
node.attribute(L"label").set_value(L"修復語言");
node.attribute(L"replace-text").set_value(L"0:關閉, 1:開啓");
[&](pugi::xml_node &node) {
node.attribute(L"label").set_value(L"修復語言");
node.attribute(L"replace-text").set_value(L"0:關閉, 1:開啓");
}, [](){}
);
TestMode::RegisterModify(
L"/root/menu[@id='ModManagerMenu']/layout[@type='Center']/select-item[@id='ModUnlockSongs']",
[&](pugi::xml_node &node) {
node.attribute(L"label").set_value(L"解鎖歌曲");
node.attribute(L"replace-text").set_value(L"0:關閉, 1:開啓, 2:強制");
[&](pugi::xml_node &node) {
node.attribute(L"label").set_value(L"解鎖歌曲");
node.attribute(L"replace-text").set_value(L"0:關閉, 1:開啓, 2:強制");
}, [](){}
);
TestMode::RegisterModify(
L"/root/menu[@id='ModManagerMenu']/layout[@type='Center']/select-item[@id='ModFreezeTimer']",
[&](pugi::xml_node &node) {
node.attribute(L"label").set_value(L"凍結計時");
node.attribute(L"replace-text").set_value(L"0:關閉, 1:開啓");
[&](pugi::xml_node &node) {
node.attribute(L"label").set_value(L"凍結計時");
node.attribute(L"replace-text").set_value(L"0:關閉, 1:開啓");
}, [](){}
);
TestMode::RegisterModify(
L"/root/menu[@id='ModManagerMenu']/layout[@type='Center']/select-item[@id='ModModeCollabo024']",
[&](pugi::xml_node &node) {
node.attribute(L"label").set_value(L"鬼滅之刃模式");
node.attribute(L"replace-text").set_value(L"0:黙認, 1:啓用, 2:僅登入");
[&](pugi::xml_node &node) {
node.attribute(L"label").set_value(L"鬼滅之刃模式");
node.attribute(L"replace-text").set_value(L"0:黙認, 1:啓用, 2:僅登入");
}, [](){}
);
TestMode::RegisterModify(
L"/root/menu[@id='ModManagerMenu']/layout[@type='Center']/select-item[@id='ModModeCollabo025']",
[&](pugi::xml_node &node) {
node.attribute(L"label").set_value(L"航海王模式");
node.attribute(L"replace-text").set_value(L"0:黙認, 1:啓用, 2:僅登入");
[&](pugi::xml_node &node) {
node.attribute(L"label").set_value(L"航海王模式");
node.attribute(L"replace-text").set_value(L"0:黙認, 1:啓用, 2:僅登入");
}, [](){}
);
TestMode::RegisterModify(
L"/root/menu[@id='ModManagerMenu']/layout[@type='Center']/select-item[@id='ModModeCollabo026']",
[&](pugi::xml_node &node) {
node.attribute(L"label").set_value(L"AI粗品模式");
node.attribute(L"replace-text").set_value(L"0:黙認, 1:啓用, 2:僅登入");
[&](pugi::xml_node &node) {
node.attribute(L"label").set_value(L"AI粗品模式");
node.attribute(L"replace-text").set_value(L"0:黙認, 1:啓用, 2:僅登入");
}, [](){}
);
TestMode::RegisterModify(
L"/root/menu[@id='ModManagerMenu']/layout[@type='Center']/select-item[@id='ModModeAprilFool001']",
[&](pugi::xml_node &node) {
node.attribute(L"label").set_value(L"青春之達人模式");
node.attribute(L"replace-text").set_value(L"0:黙認, 1:啓用, 2:僅登入");
[&](pugi::xml_node &node) {
node.attribute(L"label").set_value(L"青春之達人模式");
node.attribute(L"replace-text").set_value(L"0:黙認, 1:啓用, 2:僅登入");
}, [](){}
);
TestMode::RegisterModify(
L"/root/menu[@id='ModManagerMenu']/layout[@type='Center']/select-item[@id='ModInstantResult']",
[&](pugi::xml_node &node) {
node.attribute(L"label").set_value(L"即時保存");
node.attribute(L"replace-text").set_value(L"0:關閉, 1:開啓");
[&](pugi::xml_node &node) {
node.attribute(L"label").set_value(L"即時保存");
node.attribute(L"replace-text").set_value(L"0:關閉, 1:開啓");
}, [](){}
);
TestMode::RegisterModify(
@@ -419,9 +419,9 @@ LocalizationCHT () {
);
TestMode::RegisterModify(
L"/root/menu[@id='OthersMenu']/layout[@type='Center']/select-item[@id='AttractDemoItem']",
[&](pugi::xml_node &node) {
node.attribute(L"label").set_value(L"演示遊玩影片");
node.attribute(L"replace-text").set_value(L"0:關閉, 1:開啓");
[&](pugi::xml_node &node) {
node.attribute(L"label").set_value(L"演示遊玩影片");
node.attribute(L"replace-text").set_value(L"0:關閉, 1:開啓");
}, [](){}
);
}
+43 -19
View File
@@ -62,11 +62,6 @@ FAST_HOOK (i64, DeviceCheck, ASLR (0x140464FC0), i64 a1, i64 a2, i64 a3) {
return originalDeviceCheck.fastcall<i64> (a1, a2, a3);
}
FAST_HOOK (void, SetupCoinUser, ASLR (0x1403F0CA0), void *a1, void *a2, int a3) {
LogMessage (LogLevel::ERROR, "SetupCoinUser side={}", a3);
originalSetupCoinUser.fastcall<void> (a1, a2, a3);
}
i64
GetPlayererCount () {
if (appAccessor) {
@@ -303,12 +298,13 @@ MID_HOOK (AttractDemo, ASLR (0x14045A720), SafetyHookContext &ctx) {
if (attractDemo->Read () == 1) ctx.r14 = 0;
}
// HOOK (DWORD*, AcquireMostCompatibleDisplayMode, ASLR (0x14064C870), i64 a1, DWORD *a2, DWORD *a3) {
// LogMessage (LogLevel::DEBUG, "AcquireMostCompatibleDisplayMode {:d} {:d} {:f} {:f}", a3[0], a3[1], (float)(int)a3[2], (float)(int)a3[3]);
// a3[2] = (DWORD)(int)120.0f;
// LogMessage (LogLevel::DEBUG, "AcquireMostCompatibleDisplayMode {:d} {:d} {:f} {:f}", a3[0], a3[1], (float)(int)a3[2], (float)(int)a3[3]);
// return originalAcquireMostCompatibleDisplayMode (a1, a2, a3);
// }
FAST_HOOK (DWORD*, AcquireMostCompatibleDisplayMode, ASLR (0x14064C870), i64 a1, DWORD *a2, DWORD *a3) {
LogMessage (LogLevel::DEBUG, "AcquireMostCompatibleDisplayMode {:d} {:d} {:f} {:f}", a3[0], a3[1], (float)(int)a3[2], (float)(int)a3[3]);
// a3[0] = xRes;
// a3[1] = yRes;
// LogMessage (LogLevel::DEBUG, "AcquireMostCompatibleDisplayMode {:d} {:d} {:f} {:f}", a3[0], a3[1], (float)(int)a3[2], (float)(int)a3[3]);
return originalAcquireMostCompatibleDisplayMode.fastcall<DWORD *> (a1, a2, a3);
}
constexpr i32 datatableBufferSize = 1024 * 1024 * 12;
uint8_t *datatableBuffer[3] = { nullptr };
@@ -337,6 +333,7 @@ void
Init () {
LogMessage (LogLevel::INFO, "Init JPN39 patches");
bool unlockSongs = true;
double modelResRate = 1.0;
auto configPath = std::filesystem::current_path () / "config.toml";
std::unique_ptr<toml_table_t, void (*) (toml_table_t *)> config_ptr (openConfig (configPath), toml_free);
@@ -344,18 +341,45 @@ Init () {
if (auto patches = openConfigSection (config_ptr.get (), "patches")) {
unlockSongs = readConfigBool (patches, "unlock_songs", unlockSongs);
}
if (auto graphics = openConfigSection (config_ptr.get (), "graphics")) {
modelResRate = readConfigDouble (graphics, "model_res_rate", modelResRate);
}
}
// Hook to get AppAccessor and ComponentAccessor
INSTALL_FAST_HOOK (DeviceCheck);
INSTALL_FAST_HOOK (luaL_newstate);
// INSTALL_HOOK (AcquireMostCompatibleDisplayMode);
// INSTALL_FAST_HOOK (AcquireMostCompatibleDisplayMode);
INSTALL_FAST_HOOK (SetupCoinUser);
// Apply graphic patch
// Window Size
WRITE_MEMORY (ASLR (0x140494533), i32, xRes);
WRITE_MEMORY (ASLR (0x14049453A), i32, yRes);
// DonSystem::DonModelRenderer::DonModelRenderer
if (modelResRate > 0) {
i32 donModelX = (i32)(xRes * modelResRate);
i32 donModelY = (i32)(yRes * modelResRate);
LogMessage (LogLevel::INFO, "Patch DonModel use resolution {}x{}", donModelX, donModelY);
WRITE_MEMORY (ASLR (0x1404F3D5B), i32, donModelX);
WRITE_MEMORY (ASLR (0x1404F3D62), i32, donModelY);
}
// // DonSystem::Renderer::Renderer
// WRITE_MEMORY (ASLR (0x1404FBF33), i32, xRes);
// WRITE_MEMORY (ASLR (0x1404FBF3A), i32, yRes);
// // DonSystem::Renderer::CreateOnpuPass
// WRITE_MEMORY (ASLR (0x1404FCF77), i32, xRes);
// WRITE_MEMORY (ASLR (0x1404FCF81), i32, yRes / 2);
// // nu::LightManager::LightManager
// WRITE_MEMORY (ASLR (0x1406BED7A), i32, xRes);
// WRITE_MEMORY (ASLR (0x1406BED82), i32, yRes);
// WRITE_MEMORY (ASLR (0x1406BEF26), i32, xRes);
// WRITE_MEMORY (ASLR (0x1406BEF33), i32, yRes);
// // google::protobuf::TextFormat::Parser::ParserImpl::ConsumeField
// WRITE_MEMORY (ASLR (0x1406F7E47), i32, xRes);
// // google::protobuf::DescriptorBuilder::AddSymbol
// WRITE_MEMORY (ASLR (0x140719191), i32, xRes);
// nuscDecoderCalcObjectSize
// WRITE_MEMORY (ASLR (0x140719191), i32, xRes);
if (!vsync) WRITE_MEMORY (ASLR (0x14064C7E9), u8, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x90);
// Bypass errors
@@ -396,10 +420,10 @@ Init () {
TestMode::RegisterItem (
L"<select-item label=\"UNLOCK SONGS\" param-offset-x=\"35\" replace-text=\"0:OFF, 1:ON, "
L"2:FORCE\" group=\"Setting\" id=\"ModUnlockSongs\" max=\"2\" min=\"0\" default=\"1\"/>",
[&]() {
INSTALL_FAST_HOOK (IsSongRelease);
INSTALL_FAST_HOOK (IsSongReleasePlayer);
INSTALL_MID_HOOK (DifficultyPanelCrown);
[&]() {
INSTALL_FAST_HOOK (IsSongRelease);
INSTALL_FAST_HOOK (IsSongReleasePlayer);
INSTALL_MID_HOOK (DifficultyPanelCrown);
}
);
// Freeze Timer
+4 -4
View File
@@ -40,10 +40,10 @@ struct SDLAxisState {
enum Scroll { MOUSE_SCROLL_INVALID, MOUSE_SCROLL_UP, MOUSE_SCROLL_DOWN };
struct Keybindings {
u8 keycodes[255];
SDL_GamepadButton buttons[255];
SDLAxis axis[255];
Scroll scroll[2];
u8 keycodes[255] = { '\0' };
SDL_GamepadButton buttons[255] = { SDL_GAMEPAD_BUTTON_INVALID };
SDLAxis axis[255] = { SDL_AXIS_NULL };
Scroll scroll[2] = { MOUSE_SCROLL_INVALID };
};
enum EnumType { none, keycode, button, axis, scroll };
+26 -13
View File
@@ -70,6 +70,7 @@ SetConfigValue (const toml_table_t *table, const char *key, Keybindings *key_bin
switch (value.type) {
case keycode: {
LogMessage (LogLevel::DEBUG, "config {} type=keycode value={}", key, (int)value.keycode);
*inputState |= 1;
for (int i = 0; i < std::size (key_bind->keycodes); i++) {
if (key_bind->keycodes[i] == 0) {
@@ -80,6 +81,7 @@ SetConfigValue (const toml_table_t *table, const char *key, Keybindings *key_bin
break;
}
case button: {
LogMessage (LogLevel::DEBUG, "config {} type=button value={}", key, (int)value.button);
*inputState |= (1 << 2);
for (int i = 0; i < std::size (key_bind->buttons); i++) {
if (key_bind->buttons[i] == SDL_GAMEPAD_BUTTON_INVALID) {
@@ -90,6 +92,7 @@ SetConfigValue (const toml_table_t *table, const char *key, Keybindings *key_bin
break;
}
case axis: {
LogMessage (LogLevel::DEBUG, "config {} type=axis value={}", key, (int)value.axis);
*inputState |= (1 << 2);
for (int i = 0; i < std::size (key_bind->axis); i++) {
if (key_bind->axis[i] == 0) {
@@ -97,8 +100,10 @@ SetConfigValue (const toml_table_t *table, const char *key, Keybindings *key_bin
break;
}
}
break;
}
case scroll: {
LogMessage (LogLevel::DEBUG, "config {} type=scroll value={}", key, (int)value.scroll);
*inputState |= (1 << 1);
for (int i = 0; i < std::size (key_bind->scroll); i++) {
if (key_bind->scroll[i] == 0) {
@@ -303,11 +308,11 @@ CorrectButton (uint32_t which, uint8_t button) {
void
CleanPoll () {
if (usingKeyboard && keyboardClean) {
keyboardClean = false;
for (int i=0; i<0xFF; i++) keyboardCount[i] -= (bool)keyboardDiff[i];
if (usingKeyboard) {
for (int i=0; i<0xFF; i++) keyboardCount[i] -= (bool)keyboardDiff[i];
memset (keyboardDiff, 0, 0XFF);
}
if (usingMouse) {
currentMouseState.ScrolledUp = false;
currentMouseState.ScrolledDown = false;
@@ -326,7 +331,7 @@ CleanPoll () {
void
UpdatePoll (HWND windowHandle) {
if (!CheckForegroundWindow (windowHandle)) return;
if (!CheckForegroundWindow (windowHandle)) return;
if (!emulateUsio) return;
CleanPoll ();
if (usingSDLEvent) {
@@ -363,7 +368,7 @@ UpdatePoll (HWND windowHandle) {
uint8_t button = CorrectButton (event.gbutton.which, event.gbutton.button);
currentControllerButtonsState[button] = false;
} break;
case SDL_EVENT_GAMEPAD_BUTTON_DOWN:
case SDL_EVENT_GAMEPAD_BUTTON_DOWN:
if (wndForeground) {
uint8_t button = CorrectButton (event.gbutton.which, event.gbutton.button);
LogMessage (LogLevel::DEBUG, "Controller {}: button {} pressed, remapped to {}", event.gbutton.which, event.gbutton.button, button);
@@ -395,7 +400,7 @@ UpdatePoll (HWND windowHandle) {
currentControllerAxisState[button] = sensorValue;
} break;
} break;
}
}
}
}
}
@@ -520,20 +525,28 @@ ControllerAxisIsTapped (const SDLAxis axis) {
bool
IsButtonTapped (const Keybindings &bindings) {
for (size_t i = 0; i < ConfigKeyboardButtonsCount; i++) {
if (bindings.keycodes[i] == 0) continue;
if (KeyboardIsTapped (bindings.keycodes[i])) return true;
if (bindings.keycodes[i] == '\0') continue;
if (KeyboardIsTapped (bindings.keycodes[i])) {
return true;
}
}
for (size_t i = 0; i < std::size (ConfigControllerButtons); i++) {
if (bindings.buttons[i] == SDL_GAMEPAD_BUTTON_INVALID) continue;
if (ControllerButtonIsTapped (bindings.buttons[i])) return true;
if (ControllerButtonIsTapped (bindings.buttons[i])) {
return true;
}
}
for (size_t i = 0; i < std::size (ConfigControllerAXIS); i++) {
if (bindings.axis[i] == 0) continue;
if (float val = ControllerAxisIsTapped (bindings.axis[i]); val > 0) return true;
if (bindings.axis[i] == SDL_AXIS_NULL) continue;
if (ControllerAxisIsTapped (bindings.axis[i])) {
return true;
}
}
for (size_t i = 0; i < std::size (ConfigMouseScroll); i++) {
if (bindings.scroll[i] == 0) continue;
if (GetMouseScrollIsTapped (bindings.scroll[i])) return true;
if (bindings.scroll[i] == MOUSE_SCROLL_INVALID) continue;
if (GetMouseScrollIsTapped (bindings.scroll[i])) {
return true;
}
}
return false;
}