fixed wide string adapt

This commit is contained in:
chinosk
2026-06-13 17:59:58 +08:00
parent 2d05557bdf
commit 43da4e8313
2 changed files with 8 additions and 1 deletions
+7
View File
@@ -1512,6 +1512,13 @@ public:
if (mode_ == Mode::Il2Cpp) return UnityResolve::Invoke<String*, const char*>("il2cpp_string_new", str.c_str()); if (mode_ == Mode::Il2Cpp) return UnityResolve::Invoke<String*, const char*>("il2cpp_string_new", str.c_str());
return UnityResolve::Invoke<String*, void*, const char*>("mono_string_new", UnityResolve::Invoke<void*>("mono_get_root_domain"), str.c_str()); return UnityResolve::Invoke<String*, void*, const char*>("mono_string_new", UnityResolve::Invoke<void*>("mono_get_root_domain"), str.c_str());
} }
static auto New(const std::wstring& str) -> String* {
auto len = static_cast<int32_t>(str.length());
if (mode_ == Mode::Il2Cpp) return UnityResolve::Invoke<String*, const wchar_t*, int32_t>("il2cpp_string_new_utf16", str.c_str(), len);
return UnityResolve::Invoke<String*, void*, const wchar_t*, int32_t>("mono_string_new_utf16", UnityResolve::Invoke<void*>("mono_get_root_domain"), str.c_str(), len);
}
}; };
template <typename T> template <typename T>
+1 -1
View File
@@ -207,7 +207,7 @@ namespace GakumasLocal::WinHooks {
void* LoadAssetBundle(const std::string& path) { void* LoadAssetBundle(const std::string& path) {
std::filesystem::path abs_path = std::filesystem::absolute(path).lexically_normal(); std::filesystem::path abs_path = std::filesystem::absolute(path).lexically_normal();
Il2cppString* bundlePath = Il2cppString::New(abs_path.string()); Il2cppString* bundlePath = Il2cppString::New(abs_path.wstring());
static auto LoadFromFileAsync = Il2cppUtils::GetMethod("UnityEngine.AssetBundleModule.dll", "UnityEngine", "AssetBundle", "LoadFromFileAsync"); static auto LoadFromFileAsync = Il2cppUtils::GetMethod("UnityEngine.AssetBundleModule.dll", "UnityEngine", "AssetBundle", "LoadFromFileAsync");
static auto get_assetBundle = Il2cppUtils::GetMethod("UnityEngine.AssetBundleModule.dll", "UnityEngine", "AssetBundleCreateRequest", "get_assetBundle"); static auto get_assetBundle = Il2cppUtils::GetMethod("UnityEngine.AssetBundleModule.dll", "UnityEngine", "AssetBundleCreateRequest", "get_assetBundle");