From 311a38a474710ba7c40d948dd04b9e5e1fd5966f Mon Sep 17 00:00:00 2001 From: test123456654321 <16307130148@fudan.edu.cn> Date: Fri, 25 Oct 2024 16:57:02 +0800 Subject: [PATCH] flags --- CMakeLists.txt | 2 +- LunaHook/embed_util.cc | 13 +++---------- LunaHook/engine32/Siglus.cpp | 6 +++--- LunaHost/LunaHostDll.cpp | 3 +-- include/const.h | 2 ++ include/texthook.h | 1 - 6 files changed, 10 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 25aa248..2c3c322 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,7 +62,7 @@ include(generate_product_version) set(VERSION_MAJOR 3) set(VERSION_MINOR 16) -set(VERSION_PATCH 0) +set(VERSION_PATCH 1) set(VERSION_REVISION 0) if(BUILD_CORE) diff --git a/LunaHook/embed_util.cc b/LunaHook/embed_util.cc index 7f5345a..ee772a8 100644 --- a/LunaHook/embed_util.cc +++ b/LunaHook/embed_util.cc @@ -165,18 +165,11 @@ static std::wstring insertSpacesAfterUnencodableSTD(const std::wstring &text, Ho } std::wstring adjustSpacesSTD(const std::wstring &text, HookParam hp) { - - switch (embedsharedmem->spaceadjustpolicy) - { - case 0: - return text; - case 1: + if (hp.type & EMBED_INSERT_SPACE_ALWAYS) return alwaysInsertSpacesSTD(text); - case 2: + else if (hp.type & EMBED_INSERT_SPACE_AFTER_UNENCODABLE) return insertSpacesAfterUnencodableSTD(text, hp); - default: - return text; - } + return text; } bool isPauseKeyPressed() { diff --git a/LunaHook/engine32/Siglus.cpp b/LunaHook/engine32/Siglus.cpp index 97db843..97fdee3 100644 --- a/LunaHook/engine32/Siglus.cpp +++ b/LunaHook/engine32/Siglus.cpp @@ -227,7 +227,7 @@ namespace 0x8b, 0xcf, // 0042cf31 8bcf mov ecx,edi 0x50, // 0042cf33 50 push eax 0xe8 // XX4 // 0042cf34 e8 e725f6ff call .0038f520 - // hook here + // hook here }; enum { @@ -1786,7 +1786,7 @@ namespace // return Private::oldHookFun = (Private::hook_fun_t)winhook::replace_fun(addr, (ULONG)Private::newHookFun); HookParam hp; hp.address = addr; - hp.type = EMBED_ABLE | CODEC_UTF16; // 0x41 + hp.type = EMBED_ABLE | CODEC_UTF16 | EMBED_INSERT_SPACE_AFTER_UNENCODABLE; // 0x41 hp.hook_before = Private::text_fun; hp.hook_after = Private::hookafter; hp.hook_font = F_GetGlyphOutlineW; @@ -1878,7 +1878,7 @@ namespace OtherHook return false; HookParam hp; hp.address = addr; - hp.type = EMBED_ABLE | CODEC_UTF16; // 0x41 + hp.type = EMBED_ABLE | CODEC_UTF16 | EMBED_INSERT_SPACE_AFTER_UNENCODABLE; // 0x41 hp.hook_before = Private::hookBefore; hp.hook_after = Private::hookafter2; hp.hook_font = F_GetGlyphOutlineW; diff --git a/LunaHost/LunaHostDll.cpp b/LunaHost/LunaHostDll.cpp index 825e43f..93aae2f 100644 --- a/LunaHost/LunaHostDll.cpp +++ b/LunaHost/LunaHostDll.cpp @@ -102,7 +102,7 @@ C_LUNA_API void Luna_FindHooks(DWORD pid, SearchParam sp, findhookcallback_t fin wcscpy_s(hookcode,HOOKCODE_LEN, hp.hookcode); findhookcallback(hookcode,text.c_str()); }); } -C_LUNA_API void Luna_EmbedSettings(DWORD pid, UINT32 waittime, UINT8 fontCharSet, bool fontCharSetEnabled, wchar_t *fontFamily, UINT32 spaceadjustpolicy, UINT32 keeprawtext, bool fastskipignore) +C_LUNA_API void Luna_EmbedSettings(DWORD pid, UINT32 waittime, UINT8 fontCharSet, bool fontCharSetEnabled, wchar_t *fontFamily, UINT32 keeprawtext, bool fastskipignore) { auto sm = Host::GetEmbedSharedMem(pid); if (!sm) @@ -111,7 +111,6 @@ C_LUNA_API void Luna_EmbedSettings(DWORD pid, UINT32 waittime, UINT8 fontCharSet sm->fontCharSet = fontCharSet; sm->fontCharSetEnabled = fontCharSetEnabled; wcscpy_s(sm->fontFamily, 100, fontFamily); - sm->spaceadjustpolicy = spaceadjustpolicy; sm->keeprawtext = keeprawtext; sm->fastskipignore = fastskipignore; } diff --git a/include/const.h b/include/const.h index 3031e4a..3c4b7b0 100644 --- a/include/const.h +++ b/include/const.h @@ -83,6 +83,8 @@ enum HookParamType : uint64_t NEXT_MASK(EMBED_AFTER_NEW), NEXT_MASK(EMBED_AFTER_OVERWRITE), NEXT_MASK(EMBED_CODEC_UTF16), + NEXT_MASK(EMBED_INSERT_SPACE_ALWAYS), + NEXT_MASK(EMBED_INSERT_SPACE_AFTER_UNENCODABLE), DECLARE_VALUE(NORMAL_INLINEHOOK, 0), NEXT_MASK(BREAK_POINT), diff --git a/include/texthook.h b/include/texthook.h index b127837..56d8b88 100644 --- a/include/texthook.h +++ b/include/texthook.h @@ -19,7 +19,6 @@ struct EmbedSharedMem uint64_t ctx1[10]; uint64_t ctx2[10]; UINT32 waittime; - UINT32 spaceadjustpolicy; UINT32 keeprawtext; uint64_t hash; wchar_t text[1000];