Outputs: Name the device in the menu message

"In menus on Henrik's iPhone" if the platform gives us the name the user
gave the device, otherwise "In menus on your iPhone" (or Mac). iOS only
gives the name with an entitlement Apple has to grant, so for now it's
the model there.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-10-22 18:42:53 +02:00
1 parent 3ca76c674c
commit 014f6dceea
4 files changed
+24 -1

No files matched your search

+2
View File
@@ -137,6 +137,8 @@ enum SystemKeyboardLayout {
enum SystemProperty {
SYSPROP_NAME,
SYSPROP_DEVICE_NAME, // The name the user gave the device, like "Henrik's iPhone". Empty if we can't get it.
SYSPROP_DEVICE_MODEL, // What kind of device it is, like "iPhone" or "Mac". Empty if unknown.
SYSPROP_SYSTEMBUILD,
SYSPROP_LANGREGION,
SYSPROP_CPUINFO,
+4
View File
@@ -1117,6 +1117,10 @@ void System_LaunchUrl(LaunchUrlType urlType, std::string_view url) {
std::string System_GetProperty(SystemProperty prop) {
switch (prop) {
#if PPSSPP_PLATFORM(MAC)
case SYSPROP_DEVICE_MODEL:
return "Mac";
#endif
case SYSPROP_NAME:
#ifdef _WIN32
return "SDL:Windows";
+11 -1
View File
@@ -104,9 +104,19 @@ bool BackgroundScreen::renderOutput(const OutputDisplay &output) {
}
UIContext &dc = *screenManager()->getUIContext();
auto di = GetI18NCategory(I18NCat::DIALOG);
std::string text;
const std::string deviceName = System_GetProperty(SYSPROP_DEVICE_NAME);
const std::string deviceModel = System_GetProperty(SYSPROP_DEVICE_MODEL);
if (!deviceName.empty()) {
text = ApplySafeSubstitutions(di->T("In menus on %1"), deviceName);
} else if (!deviceModel.empty()) {
text = ApplySafeSubstitutions(di->T("In menus on your %1"), deviceModel);
} else {
text = di->T("In menus on your device");
}
const Bounds &bounds = dc.GetBounds();
dc.Begin();
dc.DrawText(di->T("Menus are on your device"), bounds.centerX(), bounds.centerY(), 0xFF505050, ALIGN_CENTER);
dc.DrawText(text, bounds.centerX(), bounds.centerY(), 0xFF505050, ALIGN_CENTER);
dc.Flush();
return true;
}
+7
View File
@@ -266,6 +266,13 @@ std::string System_GetProperty(SystemProperty prop) {
return [[[NSLocale currentLocale] objectForKey:NSLocaleIdentifier] UTF8String];
case SYSPROP_BUILD_VERSION:
return PPSSPP_GIT_VERSION;
case SYSPROP_DEVICE_NAME: {
// Since iOS 16, without the user-assigned-device-name entitlement this is just the model.
UIDevice *device = [UIDevice currentDevice];
return [device.name isEqualToString:device.model] ? "" : device.name.UTF8String;
}
case SYSPROP_DEVICE_MODEL:
return [UIDevice currentDevice].model.UTF8String;
default:
return "";
}