diff --git a/LunaHook/engine32/Elf.cpp b/LunaHook/engine32/Elf.cpp index f25aeff..3ad9132 100644 --- a/LunaHook/engine32/Elf.cpp +++ b/LunaHook/engine32/Elf.cpp @@ -334,6 +334,7 @@ namespace{ //flutter of birds~鳥達の羽ばたき~ //https://vndb.org/v2379 //需要注意的是,不能把文本跳到最快,不然2~4行无法显示。 +//这个有一大堆候选 bool elf3(){ bool succ=false; BYTE sig[]={ diff --git a/LunaHook/engine32/Elf.h b/LunaHook/engine32/Elf.h index 6560a8d..2c2a580 100644 --- a/LunaHook/engine32/Elf.h +++ b/LunaHook/engine32/Elf.h @@ -3,9 +3,14 @@ class Elf:public ENGINE{ public: Elf(){ - - check_by=CHECK_BY::FILE_ALL; - check_by_target=check_by_list{L"data.arc",L"effect.arc",L"mes.arc"}; + check_by=CHECK_BY::CUSTOM; + check_by_target=[](){ + //flutter of birds~鳥達の羽ばたき~ + //https://vndb.org/v2379 + //很奇怪,FindFirstFileW在win7上true,在win11上false,但PathFileExists在两者都是true + auto paks={L"data.arc",L"effect.arc",L"mes.arc"}; + return std::all_of(paks.begin(),paks.end(),[](auto f){return Util::CheckFile_exits(f,true);}) ; + }; //Util::CheckFile(L"Silkys.exe") || // It might or might not have Silkys.exe // data, effect, layer, mes, music }; diff --git a/LunaHook/util/util.cc b/LunaHook/util/util.cc index 891f012..d0b3d5a 100644 --- a/LunaHook/util/util.cc +++ b/LunaHook/util/util.cc @@ -221,10 +221,14 @@ DWORD FindImportEntry(DWORD hModule, DWORD fun) #endif bool CheckFile(LPCWSTR name) +{ + return CheckFile_exits(name,false); +} +bool CheckFile_exits(LPCWSTR name,bool if_exits_also_ok) { WIN32_FIND_DATAW unused; HANDLE file = FindFirstFileW(name, &unused); - if (file != INVALID_HANDLE_VALUE) + if ((file != INVALID_HANDLE_VALUE)||(if_exits_also_ok &&PathFileExists(name))) { FindClose(file); return true; @@ -234,7 +238,7 @@ bool CheckFile(LPCWSTR name) while (*(--end) != L'\\'); wcscpy_s(end + 1, MAX_PATH, name); file = FindFirstFileW(path, &unused); - if (file != INVALID_HANDLE_VALUE) + if ((file != INVALID_HANDLE_VALUE)||(if_exits_also_ok &&PathFileExists(path))) { FindClose(file); return true; diff --git a/LunaHook/util/util.h b/LunaHook/util/util.h index 13dc957..990727e 100644 --- a/LunaHook/util/util.h +++ b/LunaHook/util/util.h @@ -33,6 +33,7 @@ DWORD FindCallAndEntryRel(DWORD fun, DWORD size, DWORD pt, DWORD sig); DWORD FindImportEntry(DWORD hModule, DWORD fun); #endif +bool CheckFile_exits(LPCWSTR name, bool if_exits_also_ok); bool CheckFile(LPCWSTR name); bool SearchResourceString(LPCWSTR str);