Compare commits
1 Commits
release-v4
...
trial2
| Author | SHA1 | Date | |
|---|---|---|---|
| 47fcfd19ec |
13
dllmain.cpp
13
dllmain.cpp
@@ -2,10 +2,13 @@
|
||||
#include "detours.h"
|
||||
#include <stdio.h>
|
||||
#include "wchar_util.h"
|
||||
#include <unordered_map>
|
||||
|
||||
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<std::string, std::string> 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,13 +31,17 @@ 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;
|
||||
}
|
||||
|
||||
PVOID GetHandle() {
|
||||
HMODULE hModule = GetModuleHandleA(NULL);
|
||||
return (char*)hModule + 0xf40e0;
|
||||
return (char*)hModule + 0xf3c20;
|
||||
}
|
||||
|
||||
static PVOID h = nullptr;
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user