Android Achievements - Hardcore disables

Disables state loading and emulation speeds below 100% when RetroAchievements hardcore mode is enabled.
This commit is contained in:
LillyJadeKatrin 2025-05-31 00:24:39 -04:00
parent f4f26a26d2
commit 1e0f6a557e
4 changed files with 17 additions and 1 deletions

View File

@ -12,6 +12,9 @@ object AchievementModel {
@JvmStatic
external fun logout()
@JvmStatic
external fun isHardcoreModeActive(): Boolean
@JvmStatic
external fun shutdown()
}

View File

@ -251,7 +251,7 @@ class SettingsFragmentPresenter(
FloatSetting.MAIN_EMULATION_SPEED,
R.string.speed_limit,
0,
0f,
if (AchievementModel.isHardcoreModeActive()) 100f else 0f,
200f,
"%",
1f,

View File

@ -19,6 +19,7 @@ import org.dolphinemu.dolphinemu.NativeLibrary
import org.dolphinemu.dolphinemu.R
import org.dolphinemu.dolphinemu.activities.EmulationActivity
import org.dolphinemu.dolphinemu.databinding.FragmentIngameMenuBinding
import org.dolphinemu.dolphinemu.features.settings.model.AchievementModel
import org.dolphinemu.dolphinemu.features.settings.model.BooleanSetting
import org.dolphinemu.dolphinemu.features.settings.model.IntSetting
import org.dolphinemu.dolphinemu.utils.InsetsHelper
@ -114,11 +115,16 @@ class MenuFragment : Fragment(), View.OnClickListener {
override fun onResume() {
super.onResume()
val savestatesEnabled = BooleanSetting.MAIN_ENABLE_SAVESTATES.boolean
val hardcoreEnabled = AchievementModel.isHardcoreModeActive()
val savestateVisibility = if (savestatesEnabled) View.VISIBLE else View.GONE
binding.menuQuicksave.visibility = savestateVisibility
binding.menuQuickload.visibility = savestateVisibility
binding.menuEmulationSaveRoot.visibility = savestateVisibility
binding.menuEmulationLoadRoot.visibility = savestateVisibility
// While technically the option is still enabled, AchievementManager
// will block the load and send a message to the screen.
binding.menuQuickload.paint.isStrikeThruText = hardcoreEnabled
binding.menuEmulationLoadRoot.paint.isStrikeThruText = hardcoreEnabled
}
override fun onDestroyView() {

View File

@ -27,6 +27,13 @@ Java_org_dolphinemu_dolphinemu_features_settings_model_AchievementModel_logout(J
AchievementManager::GetInstance().Logout();
}
JNIEXPORT jboolean JNICALL
Java_org_dolphinemu_dolphinemu_features_settings_model_AchievementModel_isHardcoreModeActive(
JNIEnv* env, jclass)
{
return AchievementManager::GetInstance().IsHardcoreModeActive();
}
JNIEXPORT void JNICALL
Java_org_dolphinemu_dolphinemu_features_settings_model_AchievementModel_shutdown(JNIEnv* env,
jclass)