diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 35891d6..a2f6ff8 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -25,6 +25,10 @@ android:name="xposedsharedprefs" android:value="true" /> + + loadHistory{}; DEFINE_HOOK(void*, AssetBundle_LoadAssetAsync, (void* _this, Il2cppString* name, void* type)) { @@ -365,6 +370,8 @@ namespace GakumasLocal::HookMain { "UnityEngine.Transform::set_position_Injected(UnityEngine.Vector3&)")); ADD_HOOK(Unity_set_rotation_Injected, Il2cppUtils::il2cpp_resolve_icall( "UnityEngine.Transform::set_rotation_Injected(UnityEngine.Quaternion&)")); + ADD_HOOK(Unity_set_targetFrameRate, Il2cppUtils::il2cpp_resolve_icall( + "UnityEngine.Application::set_targetFrameRate(System.Int32)")); } // 77 2640 5000 diff --git a/app/src/main/cpp/GakumasLocalify/config/Config.cpp b/app/src/main/cpp/GakumasLocalify/config/Config.cpp index 0f6aa71..cb5658c 100644 --- a/app/src/main/cpp/GakumasLocalify/config/Config.cpp +++ b/app/src/main/cpp/GakumasLocalify/config/Config.cpp @@ -7,12 +7,14 @@ namespace GakumasLocal::Config { bool enabled = true; bool enableFreeCamera = false; + int targetFrameRate = 0; void LoadConfig(const std::string& configStr) { try { const auto config = nlohmann::json::parse(configStr); enabled = config["enabled"]; + targetFrameRate = config["targetFrameRate"]; enableFreeCamera = config["enableFreeCamera"]; } diff --git a/app/src/main/cpp/GakumasLocalify/config/Config.hpp b/app/src/main/cpp/GakumasLocalify/config/Config.hpp index 1d05ca7..edf2d73 100644 --- a/app/src/main/cpp/GakumasLocalify/config/Config.hpp +++ b/app/src/main/cpp/GakumasLocalify/config/Config.hpp @@ -7,6 +7,7 @@ namespace GakumasLocal::Config { extern bool enabled; extern bool enableFreeCamera; + extern int targetFrameRate; void LoadConfig(const std::string& configStr); } diff --git a/app/src/main/java/io/github/chinosk/gakumas/localify/MainActivity.kt b/app/src/main/java/io/github/chinosk/gakumas/localify/MainActivity.kt index 6487058..26c9241 100644 --- a/app/src/main/java/io/github/chinosk/gakumas/localify/MainActivity.kt +++ b/app/src/main/java/io/github/chinosk/gakumas/localify/MainActivity.kt @@ -4,6 +4,7 @@ package io.github.chinosk.gakumas.localify import android.content.Intent import androidx.appcompat.app.AppCompatActivity import android.os.Bundle +import android.util.Log import android.widget.Toast import androidx.databinding.DataBindingUtil import com.google.gson.Gson @@ -17,6 +18,7 @@ interface ConfigListener { fun onClickStartGame() fun onEnabledChanged(value: Boolean) fun onEnableFreeCameraChanged(value: Boolean) + fun onTargetFpsChanged(s: CharSequence, start: Int, before: Int, count: Int) } class MainActivity : AppCompatActivity(), ConfigListener { @@ -83,6 +85,23 @@ class MainActivity : AppCompatActivity(), ConfigListener { saveConfig() } + override fun onTargetFpsChanged(s: CharSequence, start: Int, before: Int, count: Int) { + try { + val valueStr = s.toString() + + val value = if (valueStr == "") { + 0 + } else { + valueStr.toInt() + } + config.targetFrameRate = value + saveConfig() + } + catch (e: Exception) { + return + } + } + override fun onClickStartGame() { val intent = Intent().apply { setClassName("com.bandainamcoent.idolmaster_gakuen", "com.google.firebase.MessagingUnityPlayerActivity") diff --git a/app/src/main/java/io/github/chinosk/gakumas/localify/models/GakumasConfig.kt b/app/src/main/java/io/github/chinosk/gakumas/localify/models/GakumasConfig.kt index 425e6c5..23309b4 100644 --- a/app/src/main/java/io/github/chinosk/gakumas/localify/models/GakumasConfig.kt +++ b/app/src/main/java/io/github/chinosk/gakumas/localify/models/GakumasConfig.kt @@ -2,6 +2,7 @@ package io.github.chinosk.gakumas.localify.models data class GakumasConfig( var enabled: Boolean = true, - var enableFreeCamera: Boolean = false + var enableFreeCamera: Boolean = false, + var targetFrameRate: Int = 0 ) diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 0408900..0d64364 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -1,6 +1,8 @@ - + + + + + + + + + + + @@ -68,6 +95,7 @@ android:onCheckedChanged="@{(view, value) -> listener.onEnableFreeCameraChanged(value)}" android:text="@string/enable_free_camera" /> + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 1d39acb..e4446de 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -4,4 +4,5 @@ 启用插件 (不可热重载) 启用自由视角(可热重载; 需使用实体键盘) 以上述配置启动游戏/重载配置 + 最大 FPS (0 为保持游戏原设置) \ No newline at end of file