From 2d116a5b76aca5787807faec85a21f696cb49a7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Wed, 21 Oct 2026 19:52:38 +0200 Subject: [PATCH] sceReg: Let a key read a bool setting, use it for VSH UMD autoboot KeyValue gets an optional pointer to a g_Config bool, which the key reads as 0/1. The setting wins over guest writes: since category_version is kept low, the VSH upgrades the registry at every boot and rewrites every key with its default. /CONFIG/SYSTEM/umd_autoboot reads the new SystemParam VshUmdAutoboot (default true, as before). Turned off, --vsh --mount stays in the XMB with the disc in the Game column instead of starting it. Co-Authored-By: Claude Opus 5.5 (1M context) --- Core/Config.cpp | 1 + Core/Config.h | 2 ++ Core/HLE/sceReg.cpp | 12 +++++++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Core/Config.cpp b/Core/Config.cpp index eaee0d4ec4..53a4862374 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -1121,6 +1121,7 @@ static const ConfigSetting systemParamSettings[] = { ConfigSetting("BypassOSKWithKeyboard", SETTING(g_Config, bBypassOSKWithKeyboard), false, CfgFlag::PER_GAME), ConfigSetting("WlanPowerSave", SETTING(g_Config, bWlanPowerSave), (bool) PSP_SYSTEMPARAM_WLAN_POWERSAVE_OFF, CfgFlag::PER_GAME), ConfigSetting("EncryptSave", SETTING(g_Config, bEncryptSave), true, CfgFlag::PER_GAME | CfgFlag::REPORT), + ConfigSetting("VshUmdAutoboot", SETTING(g_Config, bVshUmdAutoboot), true, CfgFlag::DEFAULT), ConfigSetting("MemStickSize", SETTING(g_Config, iMemStickSizeGB), 16, CfgFlag::DEFAULT), ConfigSetting("FuseID", SETTING(g_Config, sFuseID), "", CfgFlag::DEFAULT), }; diff --git a/Core/Config.h b/Core/Config.h index d746b7227b..3b4bab60e1 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -594,6 +594,8 @@ public: int iButtonPreference; int iLockParentalLevel; bool bEncryptSave; + // /CONFIG/SYSTEM/umd_autoboot: whether the VSH starts an inserted disc by itself. + bool bVshUmdAutoboot; // Networking bool bEnableAdhocServer; diff --git a/Core/HLE/sceReg.cpp b/Core/HLE/sceReg.cpp index a8156576dd..5d1b27c7f0 100644 --- a/Core/HLE/sceReg.cpp +++ b/Core/HLE/sceReg.cpp @@ -8,6 +8,7 @@ #include "Common/Serialize/Serializer.h" #include "Common/Serialize/SerializeMap.h" #include "Common/StringUtils.h" +#include "Core/Config.h" #define SYSTEM_REGISTRY "/system" #define REG_KEYNAME_SIZE 27 @@ -58,6 +59,9 @@ struct KeyValue { const char *strValue; // also can be used for bin. Note: can't be std::string/string_view, will cut off the length. int intValue; const KeyValue *dirContents; // intValue is the count. + // If set, an INT key reads this setting (as 0 or 1), even after the guest writes it: the VSH + // rewrites every key with its default at each boot, since category_version is below its schema. + const bool *boolSetting = nullptr; }; // Guest-written registry values (sceRegCreateKey / sceRegSetKeyValue), keyed by category path @@ -764,7 +768,7 @@ static const KeyValue tree_CONFIG_SYSTEM_CHARACTER_SET[] = { static const KeyValue tree_CONFIG_SYSTEM[] = { { "owner_name", ValueType::STR, "P939", 5 }, { "backlight_brightness", ValueType::INT, "", (int)0x3 }, // decimal: 3 - { "umd_autoboot", ValueType::INT, "", (int)0x1 }, // decimal: 1 + { "umd_autoboot", ValueType::INT, "", (int)0x1, nullptr, &g_Config.bVshUmdAutoboot }, // decimal: 1 { "usb_charge", ValueType::INT, "", (int)0x1 }, // decimal: 1 { "umd_cache", ValueType::INT, "", (int)0x1 }, // decimal: 1 { "usb_auto_connect", ValueType::INT, "", (int)0x1 }, // decimal: 1 @@ -1090,6 +1094,12 @@ static const MergedCategory &GetMergedCategory(const std::string &path) { } } + for (auto &kv : merged.keyvals) { + if (kv.boolSetting) { + kv.intValue = *kv.boolSetting ? 1 : 0; + } + } + return merged; }