MergeFrom(IMessage, ReadOnlySpan<byte>, bool, ExtensionRegistry)统一固定为4参数

This commit is contained in:
pm chihya committed 2026-10-08 15:32:24 +08:00
1 parent 76037b26f1
commit 66522f57e7
1 file changed
+43 -3
+43 -3
View File
@@ -1385,8 +1385,8 @@ namespace GakumasLocal::HookMain {
}
// 用于本地化 MasterDB
DEFINE_HOOK(void, MessageExtensions_MergeFrom, (void* message, void* span, void* mtd)) {
MessageExtensions_MergeFrom_Orig(message, span, mtd);
DEFINE_HOOK(void, MessageExtensions_MergeFrom, (void* message, void* span, bool discardUnknownFields, void* registry, void* mtd)) {
MessageExtensions_MergeFrom_Orig(message, span, discardUnknownFields, registry, mtd);
if (message) {
auto ret_klass = Il2cppUtils::get_class_from_instance(message);
if (ret_klass) {
@@ -2180,6 +2180,39 @@ namespace GakumasLocal::HookMain {
return LiveSceneContentView_SetLyricsTextActive_Orig(self, value, mtd);
}
// Debug auto photography: expose 10/20/30 instead of the game's original choices.
DEFINE_HOOK(void*, LiveUtility_AutoPhotoCountTypeValues, (void* mtd)) {
auto* counts = reinterpret_cast<UnityResolve::UnityType::Array<int>*>(
LiveUtility_AutoPhotoCountTypeValues_Orig(mtd));
if (!Config::dbgMode || !counts) return counts;
if (counts->max_length < 3) {
static std::atomic_bool warned{ false };
if (!warned.exchange(true)) {
Log::ErrorFmt("Auto photo count array has insufficient length (array=%p, length=%llu)",
counts, static_cast<unsigned long long>(counts->max_length));
}
return counts;
}
counts->At(0) = 10;
counts->At(1) = 20;
counts->At(2) = 30;
static std::atomic_bool logged{ false };
if (!logged.exchange(true)) Log::Info("Auto photo count options set to 10/20/30");
return counts;
}
// Keep existing settings meaningful after replacing the old 10/5/1 choices.
DEFINE_HOOK(int, LiveUtility_GetAutoPhotoLimitCount, (void* mtd)) {
const int count = LiveUtility_GetAutoPhotoLimitCount_Orig(mtd);
if (!Config::dbgMode) return count;
if (count == 1 || count == 3) return 30;
if (count == 5) return 20;
return count;
}
// std::string lastMusicId;
#ifdef GKMS_WINDOWS
DEFINE_HOOK(void*, PictureBookLiveSelectScreenPresenter_OnSelectMusic, (void* retstr, void* self, void* itemModel, void* ct, void* mtd)) {
@@ -2827,7 +2860,7 @@ namespace GakumasLocal::HookMain {
// "EffectGroup", ".ctor"));
ADD_HOOK(MessageExtensions_MergeFrom, Il2cppUtils::GetMethodPointer("Google.Protobuf.dll", "Google.Protobuf",
"MessageExtensions", "MergeFrom", {"Google.Protobuf.IMessage", "System.ReadOnlySpan<System.Byte>"}));
"MessageExtensions", "MergeFrom", {"Google.Protobuf.IMessage", "System.ReadOnlySpan<System.Byte>", "System.Boolean", "Google.Protobuf.ExtensionRegistry"}));
ADD_HOOK(ExamExtensions_ExchangeSpToNormal,
Il2cppUtils::GetMethodPointer(
@@ -2960,6 +2993,13 @@ namespace GakumasLocal::HookMain {
Il2cppUtils::GetMethodPointer("Assembly-CSharp.dll", "Campus.Live",
"LiveSceneContentView", "SetLyricsTextActive", { "*" }));
ADD_HOOK(LiveUtility_AutoPhotoCountTypeValues,
Il2cppUtils::GetMethodPointer("Assembly-CSharp.dll", "Campus.Live",
"LiveUtility", "AutoPhotoCountTypeValues"));
ADD_HOOK(LiveUtility_GetAutoPhotoLimitCount,
Il2cppUtils::GetMethodPointer("Assembly-CSharp.dll", "Campus.Live",
"LiveUtility", "GetAutoPhotoLimitCount"));
// ADD_HOOK(PictureBookLiveSelectScreenPresenter_OnSelectMusic,
// Il2cppUtils::GetMethodPointer("Assembly-CSharp.dll", "Campus.OutGame",
// "PictureBookLiveSelectScreenPresenter", "OnSelectMusicAsync"));