From 47fcfd19ec3f15f3cc33bdfe1b280a67ad23038d Mon Sep 17 00:00:00 2001 From: lifegpc Date: Wed, 11 Dec 2024 22:31:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=80=89=E9=A1=B9=E7=BF=BB?= =?UTF-8?q?=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dllmain.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dllmain.cpp b/dllmain.cpp index cdeb3a3..e432a3f 100644 --- a/dllmain.cpp +++ b/dllmain.cpp @@ -2,10 +2,13 @@ #include "detours.h" #include #include "wchar_util.h" +#include static HFONT(WINAPI *TrueCreateFontW)(int nHeight, int nWidth, int nEscapement, int nOrientation, int fnWeight, DWORD dwItalic, DWORD dwUnderline, DWORD dwStrikeOut, DWORD dwCharSet, DWORD dwOutPrecision, DWORD dwClipPrecision, DWORD dwQuality, DWORD dwPitchAndFamily, LPCWSTR lpFaceName) = CreateFontW; static HFONT(WINAPI *TrueCreateFontA)(int nHeight, int nWidth, int nEscapement, int nOrientation, int fnWeight, DWORD dwItalic, DWORD dwUnderline, DWORD dwStrikeOut, DWORD dwCharSet, DWORD dwOutPrecision, DWORD dwClipPrecision, DWORD dwQuality, DWORD dwPitchAndFamily, LPCSTR lpFaceName) = CreateFontA; +static std::unordered_map transTable; + char* to_utf8(char* target, const char* source, UINT cp) { int count = MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, source, -1, NULL, 0); if (!count) return nullptr; @@ -28,6 +31,10 @@ char* WINAPI jis_to_utf8(char* target, const char* source) { char* result = to_utf8(target, source, CP_UTF8); if (!result) { result = to_utf8(target, source, 932); + if (transTable.find(result) != transTable.end()) { + auto& v = transTable[result]; + strcpy(result, v.c_str()); + } } return result; } @@ -65,6 +72,10 @@ HFONT WINAPI HookedCreateFontA(int nHeight, int nWidth, int nEscapement, int nOr } extern "C" __declspec(dllexport) void Attach() { + transTable["ミリアエッチシーン"] = "米莉亚的H场景"; + transTable["プリリッコエッチシーン"] = "普里利科的H场景"; + transTable["マスターエッチシーン"] = "队长的H场景"; + transTable["カーラエッチシーン"] = "卡拉的H场景"; DetourTransactionBegin(); DetourUpdateThread(GetCurrentThread()); h = GetHandle();