This commit is contained in:
恍兮惚兮 2024-11-09 15:13:27 +08:00
parent 4427d28613
commit ac7843ee40
5 changed files with 67 additions and 19 deletions

View File

@ -912,7 +912,7 @@ namespace
}
void F0100B0601852A000(TextBuffer *buffer, HookParam *hp)
{
auto s = buffer->strW();
auto s = buffer->viewW();
static std::wstring last;
if (last == s)
return buffer->clear();
@ -920,7 +920,7 @@ namespace
}
void F010027100C79A000(TextBuffer *buffer, HookParam *hp)
{
auto s = buffer->strA();
auto s = buffer->viewA();
static std::string last;
if (last == s)
return buffer->clear();
@ -1775,6 +1775,18 @@ namespace
s = std::regex_replace(s, std::regex("@[0-9]"), "");
buffer->from(s);
}
void F01000EA00B23C000(TextBuffer *buffer, HookParam *hp)
{
auto s = buffer->strW();
s = std::regex_replace(s, std::wregex(L"[`@](.*?)@"), L"$1");
s = std::regex_replace(s, std::wregex(L"\\$\\[(.*?)\\$/(.*?)\\$\\]"), L"$1");
s = std::regex_replace(s, std::wregex(L"\\$K\\d+(.*?)\\$K\\d+"), L"$1");
s = std::regex_replace(s, std::wregex(L"\\$A\\d+"), L"");
strReplace(s, L"$2", L"");
strReplace(s, L"$1", L"山田");
strReplace(s, L"$(3)", L"");
buffer->from(s);
}
void F010060301588A000(TextBuffer *buffer, HookParam *hp)
{
auto s = buffer->strA();
@ -2059,7 +2071,24 @@ namespace
namespace
{
#pragma optimize("", off)
// 必须禁止优化这个函数,或者引用一下参数,否则参数被优化没了。
void TT0100A4700BC98000(const char *_) {}
#pragma optimize("", on)
void T0100A4700BC98000(TextBuffer *buffer, HookParam *)
{
auto s = buffer->strA();
HookParam hp;
hp.address = (uintptr_t)TT0100A4700BC98000;
hp.offset = GETARG1;
hp.type = CODEC_UTF8 | USING_STRING;
static auto _ = NewHook(hp, "0100A4700BC98000");
TT0100A4700BC98000(s.c_str());
// buffer->clear();
}
}
namespace
{
#pragma optimize("", off)
void F01006530151F0000_collect(const wchar_t *_) {}
#pragma optimize("", on)
void F01006530151F0000(TextBuffer *buffer, HookParam *)
@ -3284,6 +3313,15 @@ namespace
// Money Parasite ~Usotsuki na Onna~
{0x2169ac, {0, 0, 0, 0, F0100A250191E8000<false>, "0100A250191E8000", "1.0.0"}},
{0x217030, {0, 0, 0, 0, F0100A250191E8000<true>, "0100A250191E8000", "1.0.0"}},
// 三国恋戦記~オトメの兵法!~
{0x800644A0, {CODEC_UTF16, 1, 0, 0, F01000EA00B23C000, "01000EA00B23C000", "1.0.0"}},
// 三国恋戦記~思いでがえし~+学園恋戦記
{0x80153B20, {CODEC_UTF16, 8, 0, 0, F01000EA00B23C000, "01003B6014B38000", "1.0.0"}},
// 殺人探偵ジャック・ザ・リッパー
{0x8000ED30, {CODEC_UTF8, 0, 0, 0, T0100A4700BC98000, "0100A4700BC98000", "1.0.0"}}, // 1.0.0有漏的
{0x8000ED1C, {CODEC_UTF8, 0, 0, 0, T0100A4700BC98000, "0100A4700BC98000", "1.0.0"}},
{0x8000ED3C, {CODEC_UTF8, 0, 0, 0, T0100A4700BC98000, "0100A4700BC98000", "1.0.0"}},
{0x8003734C, {CODEC_UTF8, 2, 0, 0, F010027100C79A000, "0100A4700BC98000", "1.0.2"}}, // 完整
};
return 1;
}();

View File

@ -94,20 +94,23 @@ struct WindowInfo
};
std::vector<WindowInfo> get_proc_windows();
template <typename StringT>
auto allocateString(const StringT &s) -> typename StringT::value_type *
{
size_t t = s.size();
typename StringT::value_type *_data = new typename StringT::value_type[t + 1];
strcpyEx(_data, s.data());
return _data;
}
template <typename StringT>
size_t strSize(const StringT &s)
{
return s.size() * sizeof(StringT::value_type);
}
template <typename StringT>
auto allocateString(const StringT &s) -> typename StringT::value_type *
{
size_t t = s.size();
typename StringT::value_type *_data = new typename StringT::value_type[t + 1];
strcpyEx(_data, s.data());
memcpy(_data, s.data(), strSize(s));
_data[t] = 0;
return _data;
}
bool IsShiftjisWord(WORD w);
bool IsShiftjisLeadByte(BYTE b);

View File

@ -101,7 +101,7 @@ std::optional<std::wstring> StringToWideString(const std::string &text, UINT enc
std::optional<std::wstring> StringToWideString(std::string_view text, UINT encoding)
{
std::vector<wchar_t> buffer(text.size() + 1);
std::vector<wchar_t> buffer(text.size());
if (disable_mbwc)
{
int _s = text.size();
@ -122,8 +122,8 @@ std::optional<std::wstring> StringToWideString(std::string_view text, UINT encod
}
else
{
if (int length = MultiByteToWideChar(encoding, 0, text.data(), text.size() + 1, buffer.data(), buffer.size()))
return std::wstring(buffer.data(), length - 1);
if (int length = MultiByteToWideChar(encoding, 0, text.data(), text.size(), buffer.data(), buffer.size()))
return std::wstring(buffer.data(), length);
return {};
}
}
@ -157,7 +157,7 @@ std::string WideStringToString(const wchar_t *text, UINT cp)
}
std::string WideStringToString(std::wstring_view text, UINT cp)
{
std::vector<char> buffer((text.size() + 1) * 4);
std::vector<char> buffer((text.size()) * 4);
if (disable_wcmb)
{
int _s = text.size();
@ -178,7 +178,7 @@ std::string WideStringToString(std::wstring_view text, UINT cp)
}
else
{
WideCharToMultiByte(cp, 0, text.data(), -1, buffer.data(), buffer.size(), nullptr, nullptr);
WideCharToMultiByte(cp, 0, text.data(), text.size(), buffer.data(), buffer.size(), nullptr, nullptr);
return buffer.data();
}
}

View File

@ -1,6 +1,6 @@
set(VERSION_MAJOR 5)
set(VERSION_MINOR 56)
set(VERSION_PATCH 5)
set(VERSION_PATCH 6)
include(${CMAKE_CURRENT_LIST_DIR}/version/generate_product_version.cmake)

View File

@ -378,9 +378,16 @@ def findgameuidofpath(gamepath, findall=False):
use = savehook_new_list
else:
use = sub["games"]
minidx = len(use)
minuid = None
for uid in uids:
if uid in use:
return uid, use
idx = use.index(uid)
if minidx > idx:
minidx = idx
minuid = uid
if minuid:
return minuid, use
if findall:
return collect
else: