diff --git a/src/hook.cpp b/src/hook.cpp index 991c6e0..dfc2441 100644 --- a/src/hook.cpp +++ b/src/hook.cpp @@ -550,6 +550,37 @@ namespace } } + bool isCancelTryOn = false; + void* LiveCostumeChangeView_setTryOnMode_orig; + void LiveCostumeChangeView_setTryOnMode_hook(void* _this, void* idol, bool isTryOn) { + if (!isTryOn) isCancelTryOn = true; + reinterpret_cast(LiveCostumeChangeView_setTryOnMode_orig)(_this, idol, isTryOn); + isCancelTryOn = false; + } + + void* LiveCostumeChangeView_setIdolCostume_orig; + void LiveCostumeChangeView_setIdolCostume_hook(void* _this, void* idol, int category, int costumeId) { + if (g_allow_use_tryon_costume) { + static auto iidol_klass = il2cpp_symbols::get_class_from_instance(idol); + static auto get_CharacterId_mtd = il2cpp_class_get_method_from_name(iidol_klass, "get_CharacterId", 0); + if (get_CharacterId_mtd) { + const auto idolId = reinterpret_cast(get_CharacterId_mtd->methodPointer)(idol); + printf("LiveCostumeChangeView_setIdolCostume idol: %d, category: %d, costumeId: %d\n", idolId, category, costumeId); + } + if (isCancelTryOn) return; + } + + return reinterpret_cast(LiveCostumeChangeView_setIdolCostume_orig)(_this, idol, category, costumeId); + } + + void* LiveMVUnit_GetMemberChangeRequestData_orig; + void* LiveMVUnit_GetMemberChangeRequestData_hook(void* _this, int position, void* idol, int exchangePosition) { + if (g_allow_same_idol) { + exchangePosition = -1; + } + return reinterpret_cast(LiveMVUnit_GetMemberChangeRequestData_orig)(_this, position, idol, exchangePosition); + } + void* CriWareErrorHandler_HandleMessage_orig; void CriWareErrorHandler_HandleMessage_hook(void* _this, Il2CppString* msg) { // wprintf(L"CriWareErrorHandler_HandleMessage: %ls\n%ls\n\n", msg->start_char, environment_get_stacktrace()->start_char); @@ -1005,6 +1036,20 @@ namespace "PRISM.Legacy.dll", "PRISM", "LiveScene", "Update", 0 ); + auto LiveCostumeChangeView_setTryOnMode_addr = il2cpp_symbols::get_method_pointer( + "PRISM.Interactions.Live.dll", "PRISM.Interactions", + "LiveCostumeChangeView", "_setTryOnMode", 2 + ); + auto LiveCostumeChangeView_setIdolCostume_addr = il2cpp_symbols::get_method_pointer( + "PRISM.Interactions.Live.dll", "PRISM.Interactions", + "LiveCostumeChangeView", "_setIdolCostume", 3 + ); + + auto LiveMVUnit_GetMemberChangeRequestData_addr = il2cpp_symbols::get_method_pointer( + "PRISM.Legacy.dll", "PRISM.Live", + "LiveMVUnit", "GetMemberChangeRequestData", 3 + ); + auto CriWareErrorHandler_HandleMessage_addr = il2cpp_symbols::get_method_pointer( "CriMw.CriWare.Runtime.dll", "CriWare", "CriWareErrorHandler", "HandleMessage", 1 @@ -1062,6 +1107,9 @@ namespace ADD_HOOK(InvokeMoveNext, "InvokeMoveNext at %p"); ADD_HOOK(Live_SetEnableDepthOfField, "Live_SetEnableDepthOfField at %p"); ADD_HOOK(Live_Update, "Live_Update at %p"); + ADD_HOOK(LiveCostumeChangeView_setTryOnMode, "LiveCostumeChangeView_setTryOnMode at %p"); + ADD_HOOK(LiveCostumeChangeView_setIdolCostume, "LiveCostumeChangeView_setIdolCostume at %p"); + ADD_HOOK(LiveMVUnit_GetMemberChangeRequestData, "LiveMVUnit_GetMemberChangeRequestData at %p"); ADD_HOOK(CriWareErrorHandler_HandleMessage, "CriWareErrorHandler_HandleMessage at %p"); ADD_HOOK(GGIregualDetector_ShowPopup, "GGIregualDetector_ShowPopup at %p"); ADD_HOOK(DMMGameGuard_NPGameMonCallback, "DMMGameGuard_NPGameMonCallback at %p"); diff --git a/src/main.cpp b/src/main.cpp index 2f9beb4..5967aa4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -36,6 +36,8 @@ char hotKey = 'u'; bool g_enable_free_camera = false; bool g_block_out_of_focus = false; float g_free_camera_mouse_speed = 35; +bool g_allow_use_tryon_costume = false; +bool g_allow_same_idol = false; std::filesystem::path g_localify_base("scsp_localify"); constexpr const char ConfigJson[] = "scsp-config.json"; @@ -154,6 +156,13 @@ namespace } } } + + if (document.HasMember("allowUseTryOnCostume")) { + g_allow_use_tryon_costume = document["allowUseTryOnCostume"].GetBool(); + } + if (document.HasMember("allowSameIdol")) { + g_allow_same_idol = document["allowSameIdol"].GetBool(); + } } diff --git a/src/scgui/scGUILoop.cpp b/src/scgui/scGUILoop.cpp index 84101f8..04376d8 100644 --- a/src/scgui/scGUILoop.cpp +++ b/src/scgui/scGUILoop.cpp @@ -19,6 +19,8 @@ namespace SCGUILoop { void mainLoop() { if (ImGui::Begin("SC Plugin Config")) { ImGui::Checkbox("Waiting Extract Text", &SCGUIData::needExtractText); + ImGui::Checkbox("Live Allow Same Idol (Dangerous)", &g_allow_same_idol); + ImGui::Checkbox("Live Allow Use Try On Costume (Dangerous)", &g_allow_use_tryon_costume); if (ImGui::CollapsingHeader("Resolution Settings", ImGuiTreeNodeFlags_DefaultOpen)) { if (ImGui::Button("720P")) { diff --git a/src/scgui/scGUIMain.cpp b/src/scgui/scGUIMain.cpp index 89ca3d5..a211992 100644 --- a/src/scgui/scGUIMain.cpp +++ b/src/scgui/scGUIMain.cpp @@ -26,7 +26,7 @@ bool guiDone = true; bool attachToGame = false; HWND hwnd; -RECT cacheRect{ 100, 100, 730, 730 }; +RECT cacheRect{ 100, 100, 730, 790 }; void SetGuiDone(bool isDone) { guiDone = isDone; diff --git a/src/stdinclude.hpp b/src/stdinclude.hpp index c82947f..4ce91c9 100644 --- a/src/stdinclude.hpp +++ b/src/stdinclude.hpp @@ -59,3 +59,5 @@ extern char hotKey; extern bool g_enable_free_camera; extern bool g_block_out_of_focus; extern float g_free_camera_mouse_speed; +extern bool g_allow_use_tryon_costume; +extern bool g_allow_same_idol;