diff --git a/gms083-libs/ezorsia/ReplacementFuncs.h b/gms083-libs/ezorsia/ReplacementFuncs.h index 4ed9a0e8e6e16e8c4d84419d04c85896a94abec8..f4071128bc0a2963eed872d8d672dad909c50f25 100644 --- a/gms083-libs/ezorsia/ReplacementFuncs.h +++ b/gms083-libs/ezorsia/ReplacementFuncs.h @@ -1,6 +1,6 @@ #pragma once #include "AutoTypes.h" - +#include "Translation.h" static bool ownLoginFrame; static bool ownCashShopFrame; static bool EzorsiaV2WzIncluded; @@ -230,6 +230,23 @@ bool Hook_StringPool__GetString(bool bEnable) //hook stringpool modification //t }; return Memory::SetHook(bEnable, reinterpret_cast(&_StringPool__GetString), _StringPool__GetString_Hook); } +// 拦截字符串转为中文 +bool Hook_Translation_Chinese(bool bEnable) +{ + _StringPool__GetString_t _StringPool__GetString_Hook = [](void* pThis, void* edx, ZXString* result, unsigned int nIdx, char formal) -> ZXString* + { + auto ret = _StringPool__GetString(pThis, edx, result, nIdx, formal); + if (hasChineseString(nIdx)) { + auto chnieseString = getChineseString(nIdx); + *ret = chnieseString; + } else { + printf("not found chinese string for %d", nIdx); + } + return ret; + }; + + return Memory::SetHook(bEnable, reinterpret_cast(&_StringPool__GetString), _StringPool__GetString_Hook); +} bool HookMyTestHook(bool bEnable) { return Memory::SetHook(bEnable, reinterpret_cast(&_CWndCreateWnd), _CWndCreateWnd_Hook); } diff --git a/gms083-libs/ezorsia/Translation.h b/gms083-libs/ezorsia/Translation.h new file mode 100644 index 0000000000000000000000000000000000000000..b163563f80510235308efabb100d0f6103305d37 --- /dev/null +++ b/gms083-libs/ezorsia/Translation.h @@ -0,0 +1,89 @@ +#pragma once +// vs2019支持的map +#include +#include +#include "AutoTypes.h" + +// 1 对应 一个字符串 2对应一个字符串 +std::map> chinese_string_map = { + {0,("http://passport.nexon.net/?PART=/Registration/AgeCheck")}, + {1,("http://passport.nexon.net/WZ.ASPX?PART=/Accounts/ForgotId")}, + {2,("http://passport.nexon.net/WZ.ASPX?PART=/Accounts/ForgotPassword")}, + {3,("http://maplestory.nexon.net/WZ.ASPX?PART=/Downloads/GamePatches")}, + {4,("http://maplestory.nexon.net/?PART=/News/Notice&bbsidx=3255")}, + {5,("http://billing.nexon.net/WZ.ASPX?PART=/Purchasing/Account")}, + {6,("http://nxcache.nexon.net/maplestory/ending/ending_ms.html")}, + {7,("http://passport.nexon.net/?PART=/MyMaple/Verifycode")}, + {8,("Tahoma")}, + {9,("Arial Narrow")}, + {10,("装备")}, + {11,("设置")}, + {12,("新手")}, + {13,("战士")}, + {14,("弓箭手")}, + {15,("飞侠")}, + {16,("海盗")}, + {17,("概聪历")}, + {18,("骑士团")}, + {19,("可以")}, + {20,("SuperGM")}, + {21,("MWLB")}, + {22,("战士")}, + {23,("剑客")}, + {24,("勇士")}, + {25,("英雄")}, + {26,("准骑士")}, + {27,("骑士")}, + {28,("圣骑士")}, + {29,("枪战士")}, + {30,("龙骑士")}, + {31,("黑骑士")}, + {32,("法师")}, + {33,("巫师")}, + {34,("魔导师")}, + {35,("法师(火)")}, + {36,("巫师(火)")}, + {37,("魔导师(火)")}, + {38,("法师(冰)")}, + {39,("巫师(冰)")}, + {40,("魔导师(冰)")}, + {41,("牧师")}, + {42,("祭司")}, + {43,("主教")}, + {44,("弓箭手")}, + {45,("猎手")}, + {46,("射手")}, + {47,("神射手")}, + {48,("弩弓手")}, + {49,("游侠")}, + {50,("箭神")}, + {51,("飞侠")}, + {52,("刺客")}, + {53,("无影人")}, + {54,("隐士")}, + {55,("侠客")}, + {56,("独行客")}, + {57,("侠盗")}, + {58,("拳手")}, + {59,("斗士")}, + {60,("冲锋队长")}, + {61,("火枪手")}, + {62,("大副")}, + {63,("船长")}, + {64,("初心者")}, +}; + +bool hasChineseString(int nIndx) { + if (chinese_string_map.find(nIndx) != chinese_string_map.end()) { + return true; + } + return false; +} + +// 返回字符串 +ZXString getChineseString(int nIndx) { + if (chinese_string_map.find(nIndx) != chinese_string_map.end()) { + return chinese_string_map[nIndx]; + } + return (""); +} \ No newline at end of file diff --git a/gms083-libs/ezorsia/dllmain.cpp b/gms083-libs/ezorsia/dllmain.cpp index d7fe450de93ff4d317f40a533143e92f7f537a24..69b058193c5eb0cb7643b8aa34c826fb123fecff 100644 --- a/gms083-libs/ezorsia/dllmain.cpp +++ b/gms083-libs/ezorsia/dllmain.cpp @@ -67,7 +67,8 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReser //std::cout << "Applying resolution " << Client::m_nGameWidth << "x" << Client::m_nGameHeight << std::endl; Client::UpdateResolution(); - + // 汉化测试 + Hook_Translation_Chinese(true); //std::cout << "GetModuleFileName hook created" << std::endl; ijl15::CreateHook(); //NMCO::CreateHook(); //std::cout << "NMCO hook initialized" << std::endl;