diff --git a/Common/System/System.h b/Common/System/System.h index 741ccce696..b0fcb59a05 100644 --- a/Common/System/System.h +++ b/Common/System/System.h @@ -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, diff --git a/SDL/SDLMain.cpp b/SDL/SDLMain.cpp index f07fe6af58..b437fc78d1 100644 --- a/SDL/SDLMain.cpp +++ b/SDL/SDLMain.cpp @@ -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"; diff --git a/UI/MiscScreens.cpp b/UI/MiscScreens.cpp index 3c2e9cc6ab..ee58537ad6 100644 --- a/UI/MiscScreens.cpp +++ b/UI/MiscScreens.cpp @@ -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; } diff --git a/ios/main.mm b/ios/main.mm index 6c8b1920a1..60613c3b69 100644 --- a/ios/main.mm +++ b/ios/main.mm @@ -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 ""; }