Compare commits
1 Commits
release-v4
...
trial2
| Author | SHA1 | Date | |
|---|---|---|---|
| 47fcfd19ec |
11
dllmain.cpp
11
dllmain.cpp
@@ -2,10 +2,13 @@
|
|||||||
#include "detours.h"
|
#include "detours.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "wchar_util.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 *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 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) {
|
char* to_utf8(char* target, const char* source, UINT cp) {
|
||||||
int count = MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, source, -1, NULL, 0);
|
int count = MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, source, -1, NULL, 0);
|
||||||
if (!count) return nullptr;
|
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);
|
char* result = to_utf8(target, source, CP_UTF8);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
result = to_utf8(target, source, 932);
|
result = to_utf8(target, source, 932);
|
||||||
|
if (transTable.find(result) != transTable.end()) {
|
||||||
|
auto& v = transTable[result];
|
||||||
|
strcpy(result, v.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -65,6 +72,10 @@ HFONT WINAPI HookedCreateFontA(int nHeight, int nWidth, int nEscapement, int nOr
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern "C" __declspec(dllexport) void Attach() {
|
extern "C" __declspec(dllexport) void Attach() {
|
||||||
|
transTable["ミリアエッチシーン"] = "米莉亚的H场景";
|
||||||
|
transTable["プリリッコエッチシーン"] = "普里利科的H场景";
|
||||||
|
transTable["マスターエッチシーン"] = "队长的H场景";
|
||||||
|
transTable["カーラエッチシーン"] = "卡拉的H场景";
|
||||||
DetourTransactionBegin();
|
DetourTransactionBegin();
|
||||||
DetourUpdateThread(GetCurrentThread());
|
DetourUpdateThread(GetCurrentThread());
|
||||||
h = GetHandle();
|
h = GetHandle();
|
||||||
|
|||||||
Reference in New Issue
Block a user