2013-09-07 11:38:37 +00:00
// Copyright (c) 2013- PPSSPP Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0 or later versions.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
2022-01-26 12:28:59 +00:00
// Hack around name collisions between UI and xlib
// Only affects this file.
# undef VK_USE_PLATFORM_XLIB_KHR
# undef VK_USE_PLATFORM_XCB_KHR
# undef VK_USE_PLATFORM_DIRECTFB_EXT
# undef VK_USE_PLATFORM_XLIB_XRANDR_EXT
2013-10-03 20:13:16 +00:00
# include <algorithm>
2021-08-17 14:48:47 +00:00
# include <cstring>
2013-10-11 23:20:10 +00:00
2020-08-29 15:45:50 +00:00
# include "ppsspp_config.h"
2020-10-10 13:09:32 +00:00
2022-01-30 23:49:02 +00:00
# include "Common/Common.h"
2020-10-04 08:10:55 +00:00
# include "Common/System/Display.h"
2020-10-04 08:30:18 +00:00
# include "Common/System/NativeApp.h"
# include "Common/System/System.h"
2023-06-30 15:15:49 +00:00
# include "Common/System/OSD.h"
2020-10-04 21:24:14 +00:00
# include "Common/GPU/OpenGL/GLFeatures.h"
2022-01-26 13:33:09 +00:00
2021-07-17 17:50:36 +00:00
# include "Common/File/AndroidStorage.h"
2020-10-01 11:05:04 +00:00
# include "Common/Data/Text/I18n.h"
2023-08-06 09:35:13 +00:00
# include "Common/Data/Encoding/Utf8.h"
2021-01-31 12:13:42 +00:00
# include "Common/Net/HTTPClient.h"
2020-10-04 18:48:47 +00:00
# include "Common/UI/Context.h"
# include "Common/UI/View.h"
# include "Common/UI/ViewGroup.h"
# include "Common/UI/UI.h"
2023-06-18 12:18:45 +00:00
# include "Common/UI/IconCache.h"
# include "Common/Data/Text/Parsers.h"
2020-10-04 08:04:01 +00:00
# include "Common/Profiler/Profiler.h"
2014-07-20 14:32:56 +00:00
2024-07-21 10:20:23 +00:00
# include "Common/Log/LogManager.h"
2014-07-20 14:32:56 +00:00
# include "Common/CPUDetect.h"
2020-09-29 10:19:22 +00:00
# include "Common/StringUtils.h"
2014-07-20 14:32:56 +00:00
2013-11-07 12:37:19 +00:00
# include "Core/MemMap.h"
2013-09-07 11:38:37 +00:00
# include "Core/Config.h"
2018-06-17 01:42:31 +00:00
# include "Core/ConfigValues.h"
2013-12-29 23:11:29 +00:00
# include "Core/System.h"
2020-10-10 13:09:32 +00:00
# include "Core/Reporting.h"
2013-11-15 12:11:44 +00:00
# include "Core/CoreParameter.h"
2024-05-12 16:01:25 +00:00
# include "Core/HLE/sceKernel.h" // GPI/GPO
2013-09-29 11:39:25 +00:00
# include "Core/MIPS/MIPSTables.h"
2016-04-30 23:20:21 +00:00
# include "Core/MIPS/JitCommon/JitBlockCache.h"
2013-09-29 11:39:25 +00:00
# include "Core/MIPS/JitCommon/JitCommon.h"
2019-02-04 12:00:08 +00:00
# include "Core/MIPS/JitCommon/JitState.h"
2023-08-24 10:52:00 +00:00
# include "GPU/Debugger/Record.h"
2013-11-15 15:49:13 +00:00
# include "GPU/GPUInterface.h"
# include "GPU/GPUState.h"
2014-07-20 14:32:56 +00:00
# include "UI/MiscScreens.h"
# include "UI/DevScreens.h"
2021-01-31 13:42:40 +00:00
# include "UI/MainScreen.h"
2019-10-02 20:03:02 +00:00
# include "UI/ControlMappingScreen.h"
2014-07-20 14:32:56 +00:00
# include "UI/GameSettingsScreen.h"
2024-06-05 10:13:10 +00:00
# include "UI/JitCompareScreen.h"
2013-09-07 18:54:11 +00:00
2015-02-02 08:27:27 +00:00
# ifdef _WIN32
// Want to avoid including the full header here as it includes d3dx.h
2019-05-12 03:15:45 +00:00
int GetD3DCompilerVersion ( ) ;
# endif
2015-02-02 08:27:27 +00:00
2021-02-27 10:49:38 +00:00
# include "android/jni/app-android.h"
2013-10-17 16:23:57 +00:00
static const char * logLevelList [ ] = {
" Notice " ,
" Error " ,
" Warn " ,
" Info " ,
" Debug " ,
" Verb. "
} ;
2023-08-02 11:02:44 +00:00
static const char * g_debugOverlayList [ ] = {
" Off " ,
" Debug stats " ,
" Draw Frametimes Graph " ,
2023-08-02 09:38:31 +00:00
" Frame timing " ,
2023-08-02 11:02:44 +00:00
# ifdef USE_PROFILER
" Frame profile " ,
# endif
2023-08-02 11:13:41 +00:00
" Control Debug " ,
" Audio Debug " ,
2023-08-02 11:02:44 +00:00
" GPU Profile " ,
" GPU Allocator Viewer " ,
2023-12-02 13:07:31 +00:00
" Framebuffer List " ,
2023-08-02 11:02:44 +00:00
} ;
void AddOverlayList ( UI : : ViewGroup * items , ScreenManager * screenManager ) {
using namespace UI ;
auto dev = GetI18NCategory ( I18NCat : : DEVELOPER ) ;
int numOverlays = ARRAY_SIZE ( g_debugOverlayList ) ;
if ( ! ( g_Config . iGPUBackend = = ( int ) GPUBackend : : VULKAN | | g_Config . iGPUBackend = = ( int ) GPUBackend : : OPENGL ) ) {
numOverlays - = 2 ; // skip the last 2.
}
items - > Add ( new PopupMultiChoice ( ( int * ) & g_Config . iDebugOverlay , dev - > T ( " Debug overlay " ) , g_debugOverlayList , 0 , numOverlays , I18NCat : : DEVELOPER , screenManager ) ) ;
}
2022-09-16 08:14:00 +00:00
void DevMenuScreen : : CreatePopupContents ( UI : : ViewGroup * parent ) {
2013-09-07 18:54:11 +00:00
using namespace UI ;
2023-04-05 22:34:50 +00:00
auto dev = GetI18NCategory ( I18NCat : : DEVELOPER ) ;
auto sy = GetI18NCategory ( I18NCat : : SYSTEM ) ;
2014-12-09 20:50:51 +00:00
2017-12-30 09:10:17 +00:00
ScrollView * scroll = new ScrollView ( ORIENT_VERTICAL , new LinearLayoutParams ( FILL_PARENT , WRAP_CONTENT , 1.0f ) ) ;
2015-12-23 04:46:31 +00:00
LinearLayout * items = new LinearLayout ( ORIENT_VERTICAL ) ;
2015-01-05 00:23:03 +00:00
# if !defined(MOBILE_DEVICE)
2022-09-16 08:14:00 +00:00
items - > Add ( new Choice ( dev - > T ( " Log View " ) ) ) - > OnClick . Handle ( this , & DevMenuScreen : : OnLogView ) ;
2015-01-05 00:23:03 +00:00
# endif
2022-09-16 08:14:00 +00:00
items - > Add ( new Choice ( dev - > T ( " Logging Channels " ) ) ) - > OnClick . Handle ( this , & DevMenuScreen : : OnLogConfig ) ;
2024-11-21 13:36:31 +00:00
items - > Add ( new Choice ( dev - > T ( " Debugger " ) ) ) - > OnClick . Add ( [ ] ( UI : : EventParams & e ) {
g_Config . bShowImDebugger = ! g_Config . bShowImDebugger ;
return UI : : EVENT_DONE ;
} ) ;
2022-09-16 08:14:00 +00:00
items - > Add ( new Choice ( sy - > T ( " Developer Tools " ) ) ) - > OnClick . Handle ( this , & DevMenuScreen : : OnDeveloperTools ) ;
2023-12-08 11:29:24 +00:00
// Debug overlay
AddOverlayList ( items , screenManager ( ) ) ;
2022-09-16 08:14:00 +00:00
items - > Add ( new Choice ( dev - > T ( " Jit Compare " ) ) ) - > OnClick . Handle ( this , & DevMenuScreen : : OnJitCompare ) ;
items - > Add ( new Choice ( dev - > T ( " Shader Viewer " ) ) ) - > OnClick . Handle ( this , & DevMenuScreen : : OnShaderView ) ;
2022-11-24 21:03:17 +00:00
2023-08-02 11:02:44 +00:00
items - > Add ( new Choice ( dev - > T ( " Toggle Freeze " ) ) ) - > OnClick . Add ( [ ] ( UI : : EventParams & e ) {
if ( PSP_CoreParameter ( ) . frozen ) {
PSP_CoreParameter ( ) . frozen = false ;
} else {
PSP_CoreParameter ( ) . freezeNext = true ;
}
2023-03-31 18:12:48 +00:00
return UI : : EVENT_DONE ;
} ) ;
2023-08-02 11:02:44 +00:00
2023-08-24 10:52:00 +00:00
items - > Add ( new Choice ( dev - > T ( " Reset limited logging " ) ) ) - > OnClick . Handle ( this , & DevMenuScreen : : OnResetLimitedLogging ) ;
2024-05-12 16:01:25 +00:00
items - > Add ( new Choice ( dev - > T ( " GPI/GPO switches/LEDs " ) ) ) - > OnClick . Add ( [ = ] ( UI : : EventParams & e ) {
screenManager ( ) - > push ( new GPIGPOScreen ( dev - > T ( " GPI/GPO switches/LEDs " ) ) ) ;
return UI : : EVENT_DONE ;
} ) ;
2023-08-24 10:52:00 +00:00
items - > Add ( new Choice ( dev - > T ( " Create frame dump " ) ) ) - > OnClick . Add ( [ ] ( UI : : EventParams & e ) {
GPURecord : : RecordNextFrame ( [ ] ( const Path & dumpPath ) {
2024-07-14 12:42:59 +00:00
NOTICE_LOG ( Log : : System , " Frame dump created at '%s' " , dumpPath . c_str ( ) ) ;
2023-08-24 10:52:00 +00:00
if ( System_GetPropertyBool ( SYSPROP_CAN_SHOW_FILE ) ) {
System_ShowFileInFolder ( dumpPath ) ;
} else {
g_OSD . Show ( OSDType : : MESSAGE_SUCCESS , dumpPath . ToVisualString ( ) , 7.0f ) ;
}
} ) ;
2023-03-31 18:12:48 +00:00
return UI : : EVENT_DONE ;
} ) ;
2023-08-24 10:52:00 +00:00
// This one is not very useful these days, and only really on desktop. Hide it on other platforms.
if ( System_GetPropertyInt ( SYSPROP_DEVICE_TYPE ) = = DEVICE_TYPE_DESKTOP ) {
items - > Add ( new Choice ( dev - > T ( " Dump next frame to log " ) ) ) - > OnClick . Add ( [ ] ( UI : : EventParams & e ) {
gpu - > DumpNextFrame ( ) ;
return UI : : EVENT_DONE ;
} ) ;
}
2015-01-05 00:23:03 +00:00
2015-12-23 04:46:31 +00:00
scroll - > Add ( items ) ;
parent - > Add ( scroll ) ;
2015-01-05 00:23:03 +00:00
RingbufferLogListener * ring = LogManager : : GetInstance ( ) - > GetRingbufferListener ( ) ;
if ( ring ) {
2017-03-18 09:47:10 +00:00
ring - > SetEnabled ( true ) ;
2015-01-05 00:23:03 +00:00
}
}
2022-09-16 08:14:00 +00:00
UI : : EventReturn DevMenuScreen : : OnResetLimitedLogging ( UI : : EventParams & e ) {
2020-10-10 13:09:32 +00:00
Reporting : : ResetCounts ( ) ;
return UI : : EVENT_DONE ;
}
2015-01-29 11:55:49 +00:00
2022-09-16 08:14:00 +00:00
UI : : EventReturn DevMenuScreen : : OnLogView ( UI : : EventParams & e ) {
2015-01-05 00:23:03 +00:00
UpdateUIState ( UISTATE_PAUSEMENU ) ;
screenManager ( ) - > push ( new LogScreen ( ) ) ;
return UI : : EVENT_DONE ;
2013-09-07 18:54:11 +00:00
}
2022-09-16 08:14:00 +00:00
UI : : EventReturn DevMenuScreen : : OnLogConfig ( UI : : EventParams & e ) {
2014-10-11 16:28:52 +00:00
UpdateUIState ( UISTATE_PAUSEMENU ) ;
2013-09-07 18:54:11 +00:00
screenManager ( ) - > push ( new LogConfigScreen ( ) ) ;
return UI : : EVENT_DONE ;
}
2022-09-16 08:14:00 +00:00
UI : : EventReturn DevMenuScreen : : OnDeveloperTools ( UI : : EventParams & e ) {
2014-10-11 16:28:52 +00:00
UpdateUIState ( UISTATE_PAUSEMENU ) ;
2022-11-22 21:53:54 +00:00
screenManager ( ) - > push ( new DeveloperToolsScreen ( gamePath_ ) ) ;
2013-09-07 18:54:11 +00:00
return UI : : EVENT_DONE ;
}
2022-09-16 08:14:00 +00:00
UI : : EventReturn DevMenuScreen : : OnJitCompare ( UI : : EventParams & e ) {
2014-10-11 16:28:52 +00:00
UpdateUIState ( UISTATE_PAUSEMENU ) ;
2013-09-29 11:39:25 +00:00
screenManager ( ) - > push ( new JitCompareScreen ( ) ) ;
return UI : : EVENT_DONE ;
}
2022-09-16 08:14:00 +00:00
UI : : EventReturn DevMenuScreen : : OnShaderView ( UI : : EventParams & e ) {
2015-10-14 15:45:21 +00:00
UpdateUIState ( UISTATE_PAUSEMENU ) ;
2018-03-17 00:53:19 +00:00
if ( gpu ) // Avoid crashing if chosen while the game is being loaded.
screenManager ( ) - > push ( new ShaderListScreen ( ) ) ;
2015-10-14 15:45:21 +00:00
return UI : : EVENT_DONE ;
}
2022-09-16 08:14:00 +00:00
void DevMenuScreen : : dialogFinished ( const Screen * dialog , DialogResult result ) {
2015-01-29 11:55:49 +00:00
UpdateUIState ( UISTATE_INGAME ) ;
2013-09-07 20:02:55 +00:00
// Close when a subscreen got closed.
// TODO: a bug in screenmanager causes this not to work here.
2017-03-20 00:43:03 +00:00
// TriggerFinish(DR_OK);
2013-09-07 20:02:55 +00:00
}
2024-05-12 16:01:25 +00:00
void GPIGPOScreen : : CreatePopupContents ( UI : : ViewGroup * parent ) {
using namespace UI ;
auto dev = GetI18NCategory ( I18NCat : : DEVELOPER ) ;
parent - > Add ( new CheckBox ( & g_Config . bShowGPOLEDs , dev - > T ( " Show GPO LEDs " ) ) ) ;
for ( int i = 0 ; i < 8 ; i + + ) {
std : : string name = ApplySafeSubstitutions ( dev - > T ( " GPI switch %1 " ) , i ) ;
parent - > Add ( new BitCheckBox ( & g_GPIBits , 1 < < i , name ) ) ;
}
}
2015-01-05 00:23:03 +00:00
void LogScreen : : UpdateLog ( ) {
using namespace UI ;
RingbufferLogListener * ring = LogManager : : GetInstance ( ) - > GetRingbufferListener ( ) ;
if ( ! ring )
return ;
vert_ - > Clear ( ) ;
for ( int i = ring - > GetCount ( ) - 1 ; i > = 0 ; i - - ) {
TextView * v = vert_ - > Add ( new TextView ( ring - > TextAt ( i ) , FLAG_DYNAMIC_ASCII , false ) ) ;
uint32_t color = 0xFFFFFF ;
switch ( ring - > LevelAt ( i ) ) {
2023-08-25 09:33:48 +00:00
case LogLevel : : LDEBUG : color = 0xE0E0E0 ; break ;
case LogLevel : : LWARNING : color = 0x50FFFF ; break ;
case LogLevel : : LERROR : color = 0x5050FF ; break ;
case LogLevel : : LNOTICE : color = 0x30FF30 ; break ;
case LogLevel : : LINFO : color = 0xFFFFFF ; break ;
case LogLevel : : LVERBOSE : color = 0xC0C0C0 ; break ;
2015-01-05 00:23:03 +00:00
}
v - > SetTextColor ( 0xFF000000 | color ) ;
}
toBottom_ = true ;
}
2017-03-15 05:01:18 +00:00
void LogScreen : : update ( ) {
UIDialogScreenWithBackground : : update ( ) ;
2015-01-05 00:23:03 +00:00
if ( toBottom_ ) {
toBottom_ = false ;
scroll_ - > ScrollToBottom ( ) ;
}
}
void LogScreen : : CreateViews ( ) {
using namespace UI ;
2023-04-05 22:34:50 +00:00
auto di = GetI18NCategory ( I18NCat : : DIALOG ) ;
2015-01-05 00:23:03 +00:00
LinearLayout * outer = new LinearLayout ( ORIENT_VERTICAL , new LinearLayoutParams ( FILL_PARENT , WRAP_CONTENT ) ) ;
root_ = outer ;
scroll_ = outer - > Add ( new ScrollView ( ORIENT_VERTICAL , new LinearLayoutParams ( 1.0 ) ) ) ;
LinearLayout * bottom = outer - > Add ( new LinearLayout ( ORIENT_HORIZONTAL , new LayoutParams ( FILL_PARENT , WRAP_CONTENT ) ) ) ;
bottom - > Add ( new Button ( di - > T ( " Back " ) ) ) - > OnClick . Handle < UIScreen > ( this , & UIScreen : : OnBack ) ;
2021-02-22 00:38:02 +00:00
cmdLine_ = bottom - > Add ( new TextEdit ( " " , " Command " , " Command Line " , new LinearLayoutParams ( 1.0 ) ) ) ;
2015-01-05 00:23:03 +00:00
cmdLine_ - > OnEnter . Handle ( this , & LogScreen : : OnSubmit ) ;
bottom - > Add ( new Button ( di - > T ( " Submit " ) ) ) - > OnClick . Handle ( this , & LogScreen : : OnSubmit ) ;
vert_ = scroll_ - > Add ( new LinearLayout ( ORIENT_VERTICAL , new LinearLayoutParams ( FILL_PARENT , WRAP_CONTENT ) ) ) ;
vert_ - > SetSpacing ( 0 ) ;
UpdateLog ( ) ;
}
UI : : EventReturn LogScreen : : OnSubmit ( UI : : EventParams & e ) {
std : : string cmd = cmdLine_ - > GetText ( ) ;
// TODO: Can add all sorts of fun stuff here that we can't be bothered writing proper UI for, like various memdumps etc.
2024-07-14 12:42:59 +00:00
NOTICE_LOG ( Log : : System , " Submitted: %s " , cmd . c_str ( ) ) ;
2015-01-05 00:23:03 +00:00
UpdateLog ( ) ;
cmdLine_ - > SetText ( " " ) ;
cmdLine_ - > SetFocus ( ) ;
return UI : : EVENT_DONE ;
}
2013-09-07 20:02:55 +00:00
2013-09-07 11:38:37 +00:00
void LogConfigScreen : : CreateViews ( ) {
using namespace UI ;
2023-04-05 22:34:50 +00:00
auto di = GetI18NCategory ( I18NCat : : DIALOG ) ;
auto dev = GetI18NCategory ( I18NCat : : DEVELOPER ) ;
2013-09-07 11:38:37 +00:00
root_ = new ScrollView ( ORIENT_VERTICAL ) ;
2013-09-07 18:54:11 +00:00
2013-09-07 11:38:37 +00:00
LinearLayout * vert = root_ - > Add ( new LinearLayout ( ORIENT_VERTICAL , new LinearLayoutParams ( FILL_PARENT , WRAP_CONTENT ) ) ) ;
vert - > SetSpacing ( 0 ) ;
2013-09-07 18:54:11 +00:00
LinearLayout * topbar = new LinearLayout ( ORIENT_HORIZONTAL ) ;
2014-12-09 20:50:51 +00:00
topbar - > Add ( new Choice ( di - > T ( " Back " ) ) ) - > OnClick . Handle < UIScreen > ( this , & UIScreen : : OnBack ) ;
topbar - > Add ( new Choice ( di - > T ( " Toggle All " ) ) ) - > OnClick . Handle ( this , & LogConfigScreen : : OnToggleAll ) ;
2017-03-06 12:50:22 +00:00
topbar - > Add ( new Choice ( di - > T ( " Enable All " ) ) ) - > OnClick . Handle ( this , & LogConfigScreen : : OnEnableAll ) ;
topbar - > Add ( new Choice ( di - > T ( " Disable All " ) ) ) - > OnClick . Handle ( this , & LogConfigScreen : : OnDisableAll ) ;
2015-06-30 03:28:31 +00:00
topbar - > Add ( new Choice ( dev - > T ( " Log Level " ) ) ) - > OnClick . Handle ( this , & LogConfigScreen : : OnLogLevel ) ;
2013-09-07 18:54:11 +00:00
vert - > Add ( topbar ) ;
2015-06-30 03:28:31 +00:00
vert - > Add ( new ItemHeader ( dev - > T ( " Logging Channels " ) ) ) ;
2013-09-07 11:38:37 +00:00
LogManager * logMan = LogManager : : GetInstance ( ) ;
2013-09-07 20:02:55 +00:00
int cellSize = 400 ;
UI : : GridLayoutSettings gridsettings ( cellSize , 64 , 5 ) ;
gridsettings . fillCells = true ;
2021-02-22 02:41:08 +00:00
GridLayout * grid = vert - > Add ( new GridLayoutList ( gridsettings , new LayoutParams ( FILL_PARENT , WRAP_CONTENT ) ) ) ;
2013-09-07 20:02:55 +00:00
2013-09-07 11:38:37 +00:00
for ( int i = 0 ; i < LogManager : : GetNumChannels ( ) ; i + + ) {
2024-07-14 12:42:59 +00:00
Log type = ( Log ) i ;
2013-09-07 11:38:37 +00:00
LogChannel * chan = logMan - > GetLogChannel ( type ) ;
2013-09-07 20:02:55 +00:00
LinearLayout * row = new LinearLayout ( ORIENT_HORIZONTAL , new LinearLayoutParams ( cellSize - 50 , WRAP_CONTENT ) ) ;
row - > SetSpacing ( 0 ) ;
2017-03-18 09:47:10 +00:00
row - > Add ( new CheckBox ( & chan - > enabled , " " , " " , new LinearLayoutParams ( 50 , WRAP_CONTENT ) ) ) ;
2023-04-05 22:34:50 +00:00
row - > Add ( new PopupMultiChoice ( ( int * ) & chan - > level , chan - > m_shortName , logLevelList , 1 , 6 , I18NCat : : NONE , screenManager ( ) , new LinearLayoutParams ( 1.0 ) ) ) ;
2013-09-07 20:02:55 +00:00
grid - > Add ( row ) ;
2013-09-07 11:38:37 +00:00
}
2013-09-07 18:54:11 +00:00
}
UI : : EventReturn LogConfigScreen : : OnToggleAll ( UI : : EventParams & e ) {
LogManager * logMan = LogManager : : GetInstance ( ) ;
for ( int i = 0 ; i < LogManager : : GetNumChannels ( ) ; i + + ) {
2024-07-14 12:42:59 +00:00
LogChannel * chan = logMan - > GetLogChannel ( ( Log ) i ) ;
2017-03-18 09:47:10 +00:00
chan - > enabled = ! chan - > enabled ;
2013-09-07 18:54:11 +00:00
}
2017-03-06 12:50:22 +00:00
return UI : : EVENT_DONE ;
}
2013-09-07 11:38:37 +00:00
2017-03-06 12:50:22 +00:00
UI : : EventReturn LogConfigScreen : : OnEnableAll ( UI : : EventParams & e ) {
LogManager * logMan = LogManager : : GetInstance ( ) ;
for ( int i = 0 ; i < LogManager : : GetNumChannels ( ) ; i + + ) {
2024-07-14 12:42:59 +00:00
LogChannel * chan = logMan - > GetLogChannel ( ( Log ) i ) ;
2017-03-18 09:47:10 +00:00
chan - > enabled = true ;
2017-03-06 12:50:22 +00:00
}
return UI : : EVENT_DONE ;
}
UI : : EventReturn LogConfigScreen : : OnDisableAll ( UI : : EventParams & e ) {
LogManager * logMan = LogManager : : GetInstance ( ) ;
for ( int i = 0 ; i < LogManager : : GetNumChannels ( ) ; i + + ) {
2024-07-14 12:42:59 +00:00
LogChannel * chan = logMan - > GetLogChannel ( ( Log ) i ) ;
2017-03-18 09:47:10 +00:00
chan - > enabled = false ;
2017-03-06 12:50:22 +00:00
}
2013-09-07 18:54:11 +00:00
return UI : : EVENT_DONE ;
2013-09-07 11:38:37 +00:00
}
2013-10-17 16:23:57 +00:00
UI : : EventReturn LogConfigScreen : : OnLogLevelChange ( UI : : EventParams & e ) {
RecreateViews ( ) ;
return UI : : EVENT_DONE ;
}
UI : : EventReturn LogConfigScreen : : OnLogLevel ( UI : : EventParams & e ) {
2023-04-05 22:34:50 +00:00
auto dev = GetI18NCategory ( I18NCat : : DEVELOPER ) ;
2014-12-10 22:01:09 +00:00
2015-06-30 03:28:31 +00:00
auto logLevelScreen = new LogLevelScreen ( dev - > T ( " Log Level " ) ) ;
2013-10-17 16:23:57 +00:00
logLevelScreen - > OnChoice . Handle ( this , & LogConfigScreen : : OnLogLevelChange ) ;
2017-03-22 01:27:57 +00:00
if ( e . v )
logLevelScreen - > SetPopupOrigin ( e . v ) ;
2013-10-17 16:23:57 +00:00
screenManager ( ) - > push ( logLevelScreen ) ;
return UI : : EVENT_DONE ;
}
2024-01-19 12:44:49 +00:00
LogLevelScreen : : LogLevelScreen ( std : : string_view title ) : ListPopupScreen ( title ) {
2013-10-17 16:23:57 +00:00
int NUMLOGLEVEL = 6 ;
std : : vector < std : : string > list ;
2017-03-22 01:27:57 +00:00
for ( int i = 0 ; i < NUMLOGLEVEL ; + + i ) {
2013-10-17 16:23:57 +00:00
list . push_back ( logLevelList [ i ] ) ;
}
adaptor_ = UI : : StringVectorListAdaptor ( list , - 1 ) ;
2024-10-22 09:59:41 +00:00
// CreateViews takes care of, well, that.
2013-10-17 16:23:57 +00:00
}
void LogLevelScreen : : OnCompleted ( DialogResult result ) {
if ( result ! = DR_OK )
return ;
int selected = listView_ - > GetSelected ( ) ;
LogManager * logMan = LogManager : : GetInstance ( ) ;
for ( int i = 0 ; i < LogManager : : GetNumChannels ( ) ; + + i ) {
2024-07-14 12:42:59 +00:00
Log type = ( Log ) i ;
2013-10-17 16:23:57 +00:00
LogChannel * chan = logMan - > GetLogChannel ( type ) ;
2017-03-18 09:47:10 +00:00
if ( chan - > enabled )
2023-08-25 09:33:48 +00:00
chan - > level = ( LogLevel ) ( selected + 1 ) ;
2013-10-17 16:23:57 +00:00
}
}
2019-02-04 12:00:08 +00:00
struct JitDisableFlag {
MIPSComp : : JitDisable flag ;
const char * name ;
} ;
// Please do not try to translate these :)
static const JitDisableFlag jitDisableFlags [ ] = {
{ MIPSComp : : JitDisable : : ALU , " ALU " } ,
{ MIPSComp : : JitDisable : : ALU_IMM , " ALU_IMM " } ,
{ MIPSComp : : JitDisable : : ALU_BIT , " ALU_BIT " } ,
{ MIPSComp : : JitDisable : : MULDIV , " MULDIV " } ,
{ MIPSComp : : JitDisable : : FPU , " FPU " } ,
{ MIPSComp : : JitDisable : : FPU_COMP , " FPU_COMP " } ,
{ MIPSComp : : JitDisable : : FPU_XFER , " FPU_XFER " } ,
{ MIPSComp : : JitDisable : : VFPU_VEC , " VFPU_VEC " } ,
2019-06-03 21:03:37 +00:00
{ MIPSComp : : JitDisable : : VFPU_MTX_VTFM , " VFPU_MTX_VTFM " } ,
{ MIPSComp : : JitDisable : : VFPU_MTX_VMSCL , " VFPU_MTX_VMSCL " } ,
{ MIPSComp : : JitDisable : : VFPU_MTX_VMMUL , " VFPU_MTX_VMMUL " } ,
{ MIPSComp : : JitDisable : : VFPU_MTX_VMMOV , " VFPU_MTX_VMMOV " } ,
2019-02-04 12:00:08 +00:00
{ MIPSComp : : JitDisable : : VFPU_COMP , " VFPU_COMP " } ,
{ MIPSComp : : JitDisable : : VFPU_XFER , " VFPU_XFER " } ,
{ MIPSComp : : JitDisable : : LSU , " LSU " } ,
{ MIPSComp : : JitDisable : : LSU_UNALIGNED , " LSU_UNALIGNED " } ,
{ MIPSComp : : JitDisable : : LSU_FPU , " LSU_FPU " } ,
{ MIPSComp : : JitDisable : : LSU_VFPU , " LSU_VFPU " } ,
{ MIPSComp : : JitDisable : : SIMD , " SIMD " } ,
{ MIPSComp : : JitDisable : : BLOCKLINK , " Block Linking " } ,
{ MIPSComp : : JitDisable : : POINTERIFY , " Pointerify " } ,
{ MIPSComp : : JitDisable : : STATIC_ALLOC , " Static regalloc " } ,
{ MIPSComp : : JitDisable : : CACHE_POINTERS , " Cached pointers " } ,
2019-06-02 14:06:10 +00:00
{ MIPSComp : : JitDisable : : REGALLOC_GPR , " GPR Regalloc across instructions " } ,
{ MIPSComp : : JitDisable : : REGALLOC_FPR , " FPR Regalloc across instructions " } ,
2019-02-04 12:00:08 +00:00
} ;
void JitDebugScreen : : CreateViews ( ) {
using namespace UI ;
2023-04-05 22:34:50 +00:00
auto di = GetI18NCategory ( I18NCat : : DIALOG ) ;
auto dev = GetI18NCategory ( I18NCat : : DEVELOPER ) ;
2019-02-04 12:00:08 +00:00
root_ = new ScrollView ( ORIENT_VERTICAL ) ;
LinearLayout * vert = root_ - > Add ( new LinearLayout ( ORIENT_VERTICAL , new LinearLayoutParams ( FILL_PARENT , WRAP_CONTENT ) ) ) ;
vert - > SetSpacing ( 0 ) ;
LinearLayout * topbar = new LinearLayout ( ORIENT_HORIZONTAL ) ;
topbar - > Add ( new Choice ( di - > T ( " Back " ) ) ) - > OnClick . Handle < UIScreen > ( this , & UIScreen : : OnBack ) ;
topbar - > Add ( new Choice ( di - > T ( " Disable All " ) ) ) - > OnClick . Handle ( this , & JitDebugScreen : : OnDisableAll ) ;
topbar - > Add ( new Choice ( di - > T ( " Enable All " ) ) ) - > OnClick . Handle ( this , & JitDebugScreen : : OnEnableAll ) ;
vert - > Add ( topbar ) ;
vert - > Add ( new ItemHeader ( dev - > T ( " Disabled JIT functionality " ) ) ) ;
for ( auto flag : jitDisableFlags ) {
// Do not add translation of these.
vert - > Add ( new BitCheckBox ( & g_Config . uJitDisableFlags , ( uint32_t ) flag . flag , flag . name ) ) ;
}
}
UI : : EventReturn JitDebugScreen : : OnEnableAll ( UI : : EventParams & e ) {
g_Config . uJitDisableFlags & = ~ ( uint32_t ) MIPSComp : : JitDisable : : ALL_FLAGS ;
return UI : : EVENT_DONE ;
}
UI : : EventReturn JitDebugScreen : : OnDisableAll ( UI : : EventParams & e ) {
g_Config . uJitDisableFlags | = ( uint32_t ) MIPSComp : : JitDisable : : ALL_FLAGS ;
return UI : : EVENT_DONE ;
}
2023-07-31 21:13:52 +00:00
void SystemInfoScreen : : update ( ) {
TabbedUIDialogScreenWithGameBackground : : update ( ) ;
g_OSD . NudgeSidebar ( ) ;
}
2023-06-18 10:22:36 +00:00
void SystemInfoScreen : : CreateTabs ( ) {
2016-12-25 17:18:19 +00:00
using namespace Draw ;
2016-12-26 16:03:01 +00:00
using namespace UI ;
2023-04-05 22:34:50 +00:00
auto di = GetI18NCategory ( I18NCat : : DIALOG ) ;
auto si = GetI18NCategory ( I18NCat : : SYSINFO ) ;
2023-08-25 14:32:39 +00:00
auto sy = GetI18NCategory ( I18NCat : : SYSTEM ) ;
2023-04-05 22:34:50 +00:00
auto gr = GetI18NCategory ( I18NCat : : GRAPHICS ) ;
2013-10-11 23:20:10 +00:00
2023-06-18 10:22:36 +00:00
LinearLayout * deviceSpecs = AddTab ( " Device Info " , si - > T ( " Device Info " ) ) ;
2013-10-11 23:20:10 +00:00
2023-07-16 23:11:37 +00:00
CollapsibleSection * systemInfo = deviceSpecs - > Add ( new CollapsibleSection ( si - > T ( " System Information " ) ) ) ;
systemInfo - > Add ( new InfoItem ( si - > T ( " System Name " , " Name " ) , System_GetProperty ( SYSPROP_NAME ) ) ) ;
2019-09-02 22:05:18 +00:00
# if PPSSPP_PLATFORM(ANDROID)
2023-07-16 23:11:37 +00:00
systemInfo - > Add ( new InfoItem ( si - > T ( " System Version " ) , StringFromInt ( System_GetPropertyInt ( SYSPROP_SYSTEMVERSION ) ) ) ) ;
2024-09-03 11:58:35 +00:00
# elif PPSSPP_PLATFORM(WINDOWS)
2024-09-03 16:42:34 +00:00
std : : string sysVersion = System_GetProperty ( SYSPROP_SYSTEMBUILD ) ;
2024-09-03 11:58:35 +00:00
if ( ! sysVersion . empty ( ) ) {
systemInfo - > Add ( new InfoItem ( si - > T ( " OS Build " ) , sysVersion ) ) ;
}
2019-09-02 22:05:18 +00:00
# endif
2023-07-16 23:11:37 +00:00
systemInfo - > Add ( new InfoItem ( si - > T ( " Lang/Region " ) , System_GetProperty ( SYSPROP_LANGREGION ) ) ) ;
2017-05-26 10:29:27 +00:00
std : : string board = System_GetProperty ( SYSPROP_BOARDNAME ) ;
if ( ! board . empty ( ) )
2023-07-16 23:11:37 +00:00
systemInfo - > Add ( new InfoItem ( si - > T ( " Board " ) , board ) ) ;
systemInfo - > Add ( new InfoItem ( si - > T ( " ABI " ) , GetCompilerABI ( ) ) ) ;
2023-10-11 21:40:07 +00:00
if ( System_GetPropertyBool ( SYSPROP_DEBUGGER_PRESENT ) ) {
2023-07-16 23:11:37 +00:00
systemInfo - > Add ( new InfoItem ( si - > T ( " Debugger Present " ) , di - > T ( " Yes " ) ) ) ;
2017-05-21 15:24:40 +00:00
}
2023-07-16 23:11:37 +00:00
CollapsibleSection * cpuInfo = deviceSpecs - > Add ( new CollapsibleSection ( si - > T ( " CPU Information " ) ) ) ;
2021-08-09 07:22:55 +00:00
// Don't bother showing the CPU name if we don't have one.
2021-08-17 07:19:30 +00:00
if ( strcmp ( cpu_info . brand_string , " Unknown " ) ! = 0 ) {
2023-07-16 23:11:37 +00:00
cpuInfo - > Add ( new InfoItem ( si - > T ( " CPU Name " , " Name " ) , cpu_info . brand_string ) ) ;
2021-08-09 07:22:55 +00:00
}
2013-10-16 20:39:53 +00:00
int totalThreads = cpu_info . num_cores * cpu_info . logical_cpu_count ;
2024-01-19 12:44:49 +00:00
std : : string cores = StringFromFormat ( si - > T_cstr ( " %d (%d per core, %d cores) " ) , totalThreads , cpu_info . logical_cpu_count , cpu_info . num_cores ) ;
2023-07-16 23:11:37 +00:00
cpuInfo - > Add ( new InfoItem ( si - > T ( " Threads " ) , cores ) ) ;
2021-02-22 08:31:18 +00:00
# if PPSSPP_PLATFORM(IOS)
2023-07-16 23:11:37 +00:00
cpuInfo - > Add ( new InfoItem ( si - > T ( " JIT available " ) , System_GetPropertyBool ( SYSPROP_CAN_JIT ) ? di - > T ( " Yes " ) : di - > T ( " No " ) ) ) ;
2021-02-22 08:31:18 +00:00
# endif
2023-07-16 23:11:37 +00:00
CollapsibleSection * gpuInfo = deviceSpecs - > Add ( new CollapsibleSection ( si - > T ( " GPU Information " ) ) ) ;
2014-08-22 18:48:35 +00:00
2017-01-30 13:33:38 +00:00
DrawContext * draw = screenManager ( ) - > getDrawContext ( ) ;
2014-08-22 18:48:35 +00:00
2018-11-10 15:47:50 +00:00
const std : : string apiNameKey = draw - > GetInfoString ( InfoField : : APINAME ) ;
2024-01-19 12:44:49 +00:00
std : : string_view apiName = gr - > T ( apiNameKey ) ;
2023-07-16 23:11:37 +00:00
gpuInfo - > Add ( new InfoItem ( si - > T ( " 3D API " ) , apiName ) ) ;
2022-09-18 08:10:48 +00:00
// TODO: Not really vendor, on most APIs it's a device name (GL calls it vendor though).
std : : string vendorString ;
if ( draw - > GetDeviceCaps ( ) . deviceID ! = 0 ) {
vendorString = StringFromFormat ( " %s (%08x) " , draw - > GetInfoString ( InfoField : : VENDORSTRING ) . c_str ( ) , draw - > GetDeviceCaps ( ) . deviceID ) ;
} else {
vendorString = draw - > GetInfoString ( InfoField : : VENDORSTRING ) ;
}
2023-07-16 23:11:37 +00:00
gpuInfo - > Add ( new InfoItem ( si - > T ( " Vendor " ) , vendorString ) ) ;
2017-03-16 08:48:10 +00:00
std : : string vendor = draw - > GetInfoString ( InfoField : : VENDOR ) ;
if ( vendor . size ( ) )
2023-07-16 23:11:37 +00:00
gpuInfo - > Add ( new InfoItem ( si - > T ( " Vendor (detected) " ) , vendor ) ) ;
gpuInfo - > Add ( new InfoItem ( si - > T ( " Driver Version " ) , draw - > GetInfoString ( InfoField : : DRIVER ) ) ) ;
2014-07-31 05:21:37 +00:00
# ifdef _WIN32
2024-09-25 16:36:20 +00:00
if ( GetGPUBackend ( ) ! = GPUBackend : : VULKAN ) {
2023-07-16 23:11:37 +00:00
gpuInfo - > Add ( new InfoItem ( si - > T ( " Driver Version " ) , System_GetProperty ( SYSPROP_GPUDRIVER_VERSION ) ) ) ;
2024-09-25 16:36:20 +00:00
}
2017-02-24 23:25:46 +00:00
# if !PPSSPP_PLATFORM(UWP)
2016-01-06 06:37:28 +00:00
if ( GetGPUBackend ( ) = = GPUBackend : : DIRECT3D9 ) {
2023-07-16 23:11:37 +00:00
gpuInfo - > Add ( new InfoItem ( si - > T ( " D3DCompiler Version " ) , StringFromFormat ( " %d " , GetD3DCompilerVersion ( ) ) ) ) ;
2015-02-02 08:27:27 +00:00
}
2017-02-24 23:25:46 +00:00
# endif
2014-07-31 05:21:37 +00:00
# endif
2017-12-26 23:55:24 +00:00
if ( GetGPUBackend ( ) = = GPUBackend : : OPENGL ) {
2023-07-16 23:11:37 +00:00
gpuInfo - > Add ( new InfoItem ( si - > T ( " Core Context " ) , gl_extensions . IsCoreContext ? di - > T ( " Active " ) : di - > T ( " Inactive " ) ) ) ;
2018-10-20 11:22:14 +00:00
int highp_int_min = gl_extensions . range [ 1 ] [ 5 ] [ 0 ] ;
int highp_int_max = gl_extensions . range [ 1 ] [ 5 ] [ 1 ] ;
2020-11-11 22:09:48 +00:00
int highp_float_min = gl_extensions . range [ 1 ] [ 2 ] [ 0 ] ;
int highp_float_max = gl_extensions . range [ 1 ] [ 2 ] [ 1 ] ;
2018-10-20 11:22:14 +00:00
if ( highp_int_max ! = 0 ) {
2023-09-06 15:40:42 +00:00
char temp [ 128 ] ;
snprintf ( temp , sizeof ( temp ) , " %d-%d " , highp_int_min , highp_int_max ) ;
2023-07-16 23:11:37 +00:00
gpuInfo - > Add ( new InfoItem ( si - > T ( " High precision int range " ) , temp ) ) ;
2020-11-11 22:09:48 +00:00
}
if ( highp_float_max ! = 0 ) {
2023-09-06 15:40:42 +00:00
char temp [ 128 ] ;
snprintf ( temp , sizeof ( temp ) , " %d-%d " , highp_int_min , highp_int_max ) ;
2023-07-16 23:11:37 +00:00
gpuInfo - > Add ( new InfoItem ( si - > T ( " High precision float range " ) , temp ) ) ;
2018-10-20 11:22:14 +00:00
}
2017-12-07 16:02:00 +00:00
}
2023-07-16 23:11:37 +00:00
gpuInfo - > Add ( new InfoItem ( si - > T ( " Depth buffer format " ) , DataFormatToString ( draw - > GetDeviceCaps ( ) . preferredDepthBufferFormat ) ) ) ;
2023-03-12 11:18:55 +00:00
std : : string texCompressionFormats ;
// Simple non-detailed summary of supported tex compression formats.
if ( draw - > GetDataFormatSupport ( Draw : : DataFormat : : ETC2_R8G8B8_UNORM_BLOCK ) ) texCompressionFormats + = " ETC2 " ;
if ( draw - > GetDataFormatSupport ( Draw : : DataFormat : : ASTC_4x4_UNORM_BLOCK ) ) texCompressionFormats + = " ASTC " ;
2023-03-12 12:30:28 +00:00
if ( draw - > GetDataFormatSupport ( Draw : : DataFormat : : BC1_RGBA_UNORM_BLOCK ) ) texCompressionFormats + = " BC1-3 " ;
if ( draw - > GetDataFormatSupport ( Draw : : DataFormat : : BC4_UNORM_BLOCK ) ) texCompressionFormats + = " BC4-5 " ;
2023-03-12 11:18:55 +00:00
if ( draw - > GetDataFormatSupport ( Draw : : DataFormat : : BC7_UNORM_BLOCK ) ) texCompressionFormats + = " BC7 " ;
2023-07-16 23:11:37 +00:00
gpuInfo - > Add ( new InfoItem ( si - > T ( " Compressed texture formats " ) , texCompressionFormats ) ) ;
2023-03-12 11:18:55 +00:00
2023-07-16 23:11:37 +00:00
CollapsibleSection * osInformation = deviceSpecs - > Add ( new CollapsibleSection ( si - > T ( " OS Information " ) ) ) ;
2024-01-19 12:44:49 +00:00
osInformation - > Add ( new InfoItem ( si - > T ( " Memory Page Size " ) , StringFromFormat ( si - > T_cstr ( " %d bytes " ) , GetMemoryProtectPageSize ( ) ) ) ) ;
2023-07-16 23:11:37 +00:00
osInformation - > Add ( new InfoItem ( si - > T ( " RW/RX exclusive " ) , PlatformIsWXExclusive ( ) ? di - > T ( " Active " ) : di - > T ( " Inactive " ) ) ) ;
2020-05-16 15:46:21 +00:00
# if PPSSPP_PLATFORM(ANDROID)
2023-07-16 23:11:37 +00:00
osInformation - > Add ( new InfoItem ( si - > T ( " Sustained perf mode " ) , System_GetPropertyBool ( SYSPROP_SUPPORTS_SUSTAINED_PERF_MODE ) ? di - > T ( " Supported " ) : di - > T ( " Unsupported " ) ) ) ;
2017-11-13 14:27:06 +00:00
# endif
2015-01-11 10:40:53 +00:00
2024-01-19 12:44:49 +00:00
std : : string_view build = si - > T ( " Release " ) ;
2017-02-28 00:47:13 +00:00
# ifdef _DEBUG
2017-12-10 18:57:57 +00:00
build = si - > T ( " Debug " ) ;
2017-02-28 00:47:13 +00:00
# endif
2023-07-16 23:11:37 +00:00
osInformation - > Add ( new InfoItem ( si - > T ( " PPSSPP build " ) , build ) ) ;
2017-02-28 00:47:13 +00:00
2023-07-16 23:11:37 +00:00
CollapsibleSection * audioInformation = deviceSpecs - > Add ( new CollapsibleSection ( si - > T ( " Audio Information " ) ) ) ;
2024-01-19 12:44:49 +00:00
audioInformation - > Add ( new InfoItem ( si - > T ( " Sample rate " ) , StringFromFormat ( si - > T_cstr ( " %d Hz " ) , System_GetPropertyInt ( SYSPROP_AUDIO_SAMPLE_RATE ) ) ) ) ;
2020-05-16 17:03:15 +00:00
int framesPerBuffer = System_GetPropertyInt ( SYSPROP_AUDIO_FRAMES_PER_BUFFER ) ;
if ( framesPerBuffer > 0 ) {
2023-07-16 23:11:37 +00:00
audioInformation - > Add ( new InfoItem ( si - > T ( " Frames per buffer " ) , StringFromFormat ( " %d " , framesPerBuffer ) ) ) ;
2020-05-16 17:03:15 +00:00
}
2020-05-16 15:46:21 +00:00
# if PPSSPP_PLATFORM(ANDROID)
2024-01-19 12:44:49 +00:00
audioInformation - > Add ( new InfoItem ( si - > T ( " Optimal sample rate " ) , StringFromFormat ( si - > T_cstr ( " %d Hz " ) , System_GetPropertyInt ( SYSPROP_AUDIO_OPTIMAL_SAMPLE_RATE ) ) ) ) ;
2023-07-16 23:11:37 +00:00
audioInformation - > Add ( new InfoItem ( si - > T ( " Optimal frames per buffer " ) , StringFromFormat ( " %d " , System_GetPropertyInt ( SYSPROP_AUDIO_OPTIMAL_FRAMES_PER_BUFFER ) ) ) ) ;
2020-05-16 15:46:21 +00:00
# endif
2017-12-10 18:57:57 +00:00
2023-07-16 23:11:37 +00:00
CollapsibleSection * displayInfo = deviceSpecs - > Add ( new CollapsibleSection ( si - > T ( " Display Information " ) ) ) ;
2023-04-28 19:22:17 +00:00
# if PPSSPP_PLATFORM(ANDROID) || PPSSPP_PLATFORM(UWP)
2023-08-31 21:28:29 +00:00
displayInfo - > Add ( new InfoItem ( si - > T ( " Native resolution " ) , StringFromFormat ( " %dx%d " ,
2015-01-13 23:45:12 +00:00
System_GetPropertyInt ( SYSPROP_DISPLAY_XRES ) ,
System_GetPropertyInt ( SYSPROP_DISPLAY_YRES ) ) ) ) ;
2023-08-30 15:36:29 +00:00
# endif
2023-08-31 21:28:29 +00:00
displayInfo - > Add ( new InfoItem ( si - > T ( " UI resolution " ) , StringFromFormat ( " %dx%d (%s: %0.2f) " ,
2023-02-25 12:09:44 +00:00
g_display . dp_xres ,
g_display . dp_yres ,
2024-01-19 12:44:49 +00:00
si - > T_cstr ( " DPI " ) ,
2023-02-25 12:09:44 +00:00
g_display . dpi ) ) ) ;
2023-08-31 21:28:29 +00:00
displayInfo - > Add ( new InfoItem ( si - > T ( " Pixel resolution " ) , StringFromFormat ( " %dx%d " ,
2023-08-30 15:36:29 +00:00
g_display . pixel_xres ,
g_display . pixel_yres ) ) ) ;
const float insets [ 4 ] = {
System_GetPropertyFloat ( SYSPROP_DISPLAY_SAFE_INSET_LEFT ) ,
System_GetPropertyFloat ( SYSPROP_DISPLAY_SAFE_INSET_TOP ) ,
System_GetPropertyFloat ( SYSPROP_DISPLAY_SAFE_INSET_RIGHT ) ,
System_GetPropertyFloat ( SYSPROP_DISPLAY_SAFE_INSET_BOTTOM ) ,
} ;
if ( insets [ 0 ] ! = 0.0f | | insets [ 1 ] ! = 0.0f | | insets [ 2 ] ! = 0.0f | | insets [ 3 ] ! = 0.0f ) {
displayInfo - > Add ( new InfoItem ( si - > T ( " Screen notch insets " ) , StringFromFormat ( " %0.1f %0.1f %0.1f %0.1f " , insets [ 0 ] , insets [ 1 ] , insets [ 2 ] , insets [ 3 ] ) ) ) ;
}
2020-02-16 01:47:10 +00:00
// Don't show on Windows, since it's always treated as 60 there.
2024-01-19 12:44:49 +00:00
displayInfo - > Add ( new InfoItem ( si - > T ( " Refresh rate " ) , StringFromFormat ( si - > T_cstr ( " %0.2f Hz " ) , ( float ) System_GetPropertyFloat ( SYSPROP_DISPLAY_REFRESH_RATE ) ) ) ) ;
2023-08-13 11:33:38 +00:00
std : : string presentModes ;
if ( draw - > GetDeviceCaps ( ) . presentModesSupported & Draw : : PresentMode : : FIFO ) presentModes + = " FIFO, " ;
if ( draw - > GetDeviceCaps ( ) . presentModesSupported & Draw : : PresentMode : : IMMEDIATE ) presentModes + = " IMMEDIATE, " ;
if ( draw - > GetDeviceCaps ( ) . presentModesSupported & Draw : : PresentMode : : MAILBOX ) presentModes + = " MAILBOX, " ;
if ( ! presentModes . empty ( ) ) {
presentModes . pop_back ( ) ;
presentModes . pop_back ( ) ;
}
displayInfo - > Add ( new InfoItem ( si - > T ( " Present modes " ) , presentModes ) ) ;
2015-01-11 10:40:53 +00:00
2023-07-16 23:11:37 +00:00
CollapsibleSection * versionInfo = deviceSpecs - > Add ( new CollapsibleSection ( si - > T ( " Version Information " ) ) ) ;
2015-07-23 12:00:02 +00:00
std : : string apiVersion ;
2016-01-06 06:37:28 +00:00
if ( GetGPUBackend ( ) = = GPUBackend : : OPENGL ) {
2015-09-05 23:45:17 +00:00
if ( gl_extensions . IsGLES ) {
apiVersion = StringFromFormat ( " v%d.%d.%d ES " , gl_extensions . ver [ 0 ] , gl_extensions . ver [ 1 ] , gl_extensions . ver [ 2 ] ) ;
} else {
apiVersion = StringFromFormat ( " v%d.%d.%d " , gl_extensions . ver [ 0 ] , gl_extensions . ver [ 1 ] , gl_extensions . ver [ 2 ] ) ;
}
2024-09-25 16:36:20 +00:00
versionInfo - > Add ( new InfoItem ( si - > T ( " API Version " ) , apiVersion ) ) ;
2015-07-23 12:00:02 +00:00
} else {
2017-01-30 13:33:38 +00:00
apiVersion = draw - > GetInfoString ( InfoField : : APIVERSION ) ;
2015-07-23 12:00:02 +00:00
if ( apiVersion . size ( ) > 30 )
apiVersion . resize ( 30 ) ;
2024-09-25 16:36:20 +00:00
versionInfo - > Add ( new InfoItem ( si - > T ( " API Version " ) , apiVersion ) ) ;
if ( GetGPUBackend ( ) = = GPUBackend : : VULKAN ) {
std : : string deviceApiVersion = draw - > GetInfoString ( InfoField : : DEVICE_API_VERSION ) ;
versionInfo - > Add ( new InfoItem ( si - > T ( " Device API Version " ) , deviceApiVersion ) ) ;
}
2015-07-23 12:00:02 +00:00
}
2023-07-16 23:11:37 +00:00
versionInfo - > Add ( new InfoItem ( si - > T ( " Shading Language " ) , draw - > GetInfoString ( InfoField : : SHADELANGVERSION ) ) ) ;
2013-11-14 15:17:22 +00:00
2020-10-21 22:04:00 +00:00
# if PPSSPP_PLATFORM(ANDROID)
2015-01-01 12:35:31 +00:00
std : : string moga = System_GetProperty ( SYSPROP_MOGA_VERSION ) ;
if ( moga . empty ( ) ) {
2017-12-10 18:57:57 +00:00
moga = si - > T ( " (none detected) " ) ;
2015-01-01 12:35:31 +00:00
}
2023-07-16 23:11:37 +00:00
versionInfo - > Add ( new InfoItem ( " Moga " , moga ) ) ;
2015-01-01 12:35:31 +00:00
# endif
2022-12-13 15:53:53 +00:00
if ( gstate_c . GetUseFlags ( ) ) {
2022-11-10 20:05:08 +00:00
// We're in-game, and can determine these.
// TODO: Call a static version of GPUCommon::CheckGPUFeatures() and derive them here directly.
2023-07-16 23:11:37 +00:00
CollapsibleSection * gpuFlags = deviceSpecs - > Add ( new CollapsibleSection ( si - > T ( " GPU Flags " ) ) ) ;
2022-11-10 20:05:08 +00:00
for ( int i = 0 ; i < 32 ; i + + ) {
if ( gstate_c . Use ( ( 1 < < i ) ) ) {
2023-07-16 23:11:37 +00:00
gpuFlags - > Add ( new TextView ( GpuUseFlagToString ( i ) , new LayoutParams ( FILL_PARENT , WRAP_CONTENT ) ) ) - > SetFocusable ( true ) ;
2022-11-10 20:05:08 +00:00
}
}
}
2023-06-18 10:22:36 +00:00
LinearLayout * storage = AddTab ( " Storage " , si - > T ( " Storage " ) ) ;
2021-02-27 10:49:38 +00:00
storage - > Add ( new ItemHeader ( si - > T ( " Directories " ) ) ) ;
// Intentionally non-translated
2021-05-05 23:31:38 +00:00
storage - > Add ( new InfoItem ( " MemStickDirectory " , g_Config . memStickDirectory . ToVisualString ( ) ) ) ;
2021-05-15 16:32:41 +00:00
storage - > Add ( new InfoItem ( " InternalDataDirectory " , g_Config . internalDataDirectory . ToVisualString ( ) ) ) ;
storage - > Add ( new InfoItem ( " AppCacheDir " , g_Config . appCacheDirectory . ToVisualString ( ) ) ) ;
2021-05-29 22:20:41 +00:00
storage - > Add ( new InfoItem ( " DefaultCurrentDir " , g_Config . defaultCurrentDirectory . ToVisualString ( ) ) ) ;
2021-02-27 10:49:38 +00:00
# if PPSSPP_PLATFORM(ANDROID)
storage - > Add ( new InfoItem ( " ExtFilesDir " , g_extFilesDir ) ) ;
2021-08-05 19:53:08 +00:00
bool scoped = System_GetPropertyBool ( SYSPROP_ANDROID_SCOPED_STORAGE ) ;
2023-03-14 14:37:51 +00:00
storage - > Add ( new InfoItem ( " Scoped Storage " , scoped ? di - > T ( " Yes " ) : di - > T ( " No " ) ) ) ;
2021-08-05 19:53:08 +00:00
if ( System_GetPropertyInt ( SYSPROP_SYSTEMVERSION ) > = 30 ) {
// This flag is only relevant on Android API 30+.
storage - > Add ( new InfoItem ( " IsStoragePreservedLegacy " , Android_IsExternalStoragePreservedLegacy ( ) ? di - > T ( " Yes " ) : di - > T ( " No " ) ) ) ;
2021-02-27 12:48:07 +00:00
}
2021-02-27 10:49:38 +00:00
# endif
2023-06-18 10:22:36 +00:00
LinearLayout * buildConfig = AddTab ( " DevSystemInfoBuildConfig " , si - > T ( " Build Config " ) ) ;
2017-03-16 11:33:23 +00:00
2017-12-10 18:57:57 +00:00
buildConfig - > Add ( new ItemHeader ( si - > T ( " Build Configuration " ) ) ) ;
2017-03-17 10:55:14 +00:00
# ifdef JENKINS
2017-12-10 18:57:57 +00:00
buildConfig - > Add ( new InfoItem ( si - > T ( " Built by " ) , " Jenkins " ) ) ;
2017-03-17 10:55:14 +00:00
# endif
2024-08-14 23:54:53 +00:00
# ifdef ANDROID_LEGACY
buildConfig - > Add ( new InfoItem ( " ANDROID_LEGACY " , " " ) ) ;
# endif
2017-03-16 11:33:23 +00:00
# ifdef _DEBUG
buildConfig - > Add ( new InfoItem ( " _DEBUG " , " " ) ) ;
# else
buildConfig - > Add ( new InfoItem ( " NDEBUG " , " " ) ) ;
# endif
2021-01-29 23:08:20 +00:00
# ifdef USE_ASAN
buildConfig - > Add ( new InfoItem ( " USE_ASAN " , " " ) ) ;
2018-01-31 17:35:48 +00:00
# endif
2017-03-16 11:33:23 +00:00
# ifdef USING_GLES2
buildConfig - > Add ( new InfoItem ( " USING_GLES2 " , " " ) ) ;
# endif
# ifdef MOBILE_DEVICE
buildConfig - > Add ( new InfoItem ( " MOBILE_DEVICE " , " " ) ) ;
2017-12-10 08:03:21 +00:00
# endif
# if PPSSPP_ARCH(ARMV7S)
buildConfig - > Add ( new InfoItem ( " ARMV7S " , " " ) ) ;
# endif
# if PPSSPP_ARCH(ARM_NEON)
buildConfig - > Add ( new InfoItem ( " ARM_NEON " , " " ) ) ;
# endif
# ifdef _M_SSE
buildConfig - > Add ( new InfoItem ( " _M_SSE " , StringFromFormat ( " 0x%x " , _M_SSE ) ) ) ;
2017-03-16 11:33:23 +00:00
# endif
2017-04-30 00:35:12 +00:00
if ( System_GetPropertyBool ( SYSPROP_APP_GOLD ) ) {
2017-04-05 14:21:08 +00:00
buildConfig - > Add ( new InfoItem ( " GOLD " , " " ) ) ;
}
2017-03-16 11:33:23 +00:00
2023-06-18 10:22:36 +00:00
LinearLayout * cpuExtensions = AddTab ( " DevSystemInfoCPUExt " , si - > T ( " CPU Extensions " ) ) ;
2017-12-10 18:57:57 +00:00
cpuExtensions - > Add ( new ItemHeader ( si - > T ( " CPU Extensions " ) ) ) ;
2023-01-29 23:03:42 +00:00
std : : vector < std : : string > exts = cpu_info . Features ( ) ;
for ( std : : string & ext : exts ) {
cpuExtensions - > Add ( new TextView ( ext , new LayoutParams ( FILL_PARENT , WRAP_CONTENT ) ) ) - > SetFocusable ( true ) ;
2013-11-14 15:17:22 +00:00
}
2015-07-21 18:48:10 +00:00
2023-06-18 10:22:36 +00:00
LinearLayout * driverBugs = AddTab ( " DevSystemInfoDriverBugs " , si - > T ( " Driver bugs " ) ) ;
2022-05-08 23:15:40 +00:00
bool anyDriverBugs = false ;
for ( int i = 0 ; i < ( int ) draw - > GetBugs ( ) . MaxBugIndex ( ) ; i + + ) {
if ( draw - > GetBugs ( ) . Has ( i ) ) {
anyDriverBugs = true ;
driverBugs - > Add ( new TextView ( draw - > GetBugs ( ) . GetBugName ( i ) , new LayoutParams ( FILL_PARENT , WRAP_CONTENT ) ) ) - > SetFocusable ( true ) ;
}
}
if ( ! anyDriverBugs ) {
driverBugs - > Add ( new TextView ( si - > T ( " No GPU driver bugs detected " ) , new LayoutParams ( FILL_PARENT , WRAP_CONTENT ) ) ) - > SetFocusable ( true ) ;
}
2017-12-26 23:55:24 +00:00
if ( GetGPUBackend ( ) = = GPUBackend : : OPENGL ) {
2023-06-18 10:22:36 +00:00
LinearLayout * gpuExtensions = AddTab ( " DevSystemInfoOGLExt " , si - > T ( " OGL Extensions " ) ) ;
2013-10-11 23:20:10 +00:00
2016-01-03 13:00:05 +00:00
if ( ! gl_extensions . IsGLES ) {
2017-12-10 18:57:57 +00:00
gpuExtensions - > Add ( new ItemHeader ( si - > T ( " OpenGL Extensions " ) ) ) ;
2016-01-03 13:00:05 +00:00
} else if ( gl_extensions . GLES3 ) {
2017-12-10 18:57:57 +00:00
gpuExtensions - > Add ( new ItemHeader ( si - > T ( " OpenGL ES 3.0 Extensions " ) ) ) ;
2016-01-03 13:00:05 +00:00
} else {
2017-12-10 18:57:57 +00:00
gpuExtensions - > Add ( new ItemHeader ( si - > T ( " OpenGL ES 2.0 Extensions " ) ) ) ;
2016-01-03 13:00:05 +00:00
}
exts . clear ( ) ;
SplitString ( g_all_gl_extensions , ' ' , exts ) ;
std : : sort ( exts . begin ( ) , exts . end ( ) ) ;
2017-12-10 08:02:41 +00:00
for ( auto & extension : exts ) {
gpuExtensions - > Add ( new TextView ( extension , new LayoutParams ( FILL_PARENT , WRAP_CONTENT ) ) ) - > SetFocusable ( true ) ;
2016-01-03 13:00:05 +00:00
}
2013-09-07 11:38:37 +00:00
2016-01-03 13:00:05 +00:00
exts . clear ( ) ;
SplitString ( g_all_egl_extensions , ' ' , exts ) ;
std : : sort ( exts . begin ( ) , exts . end ( ) ) ;
2014-05-06 04:25:50 +00:00
2016-01-03 13:00:05 +00:00
// If there aren't any EGL extensions, no need to show the tab.
if ( exts . size ( ) > 0 ) {
2024-04-02 10:58:40 +00:00
LinearLayout * eglExtensions = AddTab ( " EglExt " , si - > T ( " EGL Extensions " ) ) ;
2016-01-03 13:00:05 +00:00
eglExtensions - > SetSpacing ( 0 ) ;
2017-12-10 18:57:57 +00:00
eglExtensions - > Add ( new ItemHeader ( si - > T ( " EGL Extensions " ) ) ) ;
2017-12-10 08:02:41 +00:00
for ( auto & extension : exts ) {
eglExtensions - > Add ( new TextView ( extension , new LayoutParams ( FILL_PARENT , WRAP_CONTENT ) ) ) - > SetFocusable ( true ) ;
2016-01-03 13:00:05 +00:00
}
2014-05-06 04:25:50 +00:00
}
2017-12-26 23:55:24 +00:00
} else if ( GetGPUBackend ( ) = = GPUBackend : : VULKAN ) {
2023-06-18 10:22:36 +00:00
LinearLayout * gpuExtensions = AddTab ( " DevSystemInfoOGLExt " , si - > T ( " Vulkan Features " ) ) ;
2016-01-03 13:00:05 +00:00
2023-08-03 09:11:35 +00:00
CollapsibleSection * vulkanFeatures = gpuExtensions - > Add ( new CollapsibleSection ( si - > T ( " Vulkan Features " ) ) ) ;
2017-01-30 13:33:38 +00:00
std : : vector < std : : string > features = draw - > GetFeatureList ( ) ;
2016-01-03 13:00:05 +00:00
for ( auto & feature : features ) {
2023-08-03 09:11:35 +00:00
vulkanFeatures - > Add ( new TextView ( feature , new LayoutParams ( FILL_PARENT , WRAP_CONTENT ) ) ) - > SetFocusable ( true ) ;
2017-08-28 11:45:04 +00:00
}
2022-01-26 13:33:09 +00:00
2024-01-25 15:11:54 +00:00
CollapsibleSection * presentModes = gpuExtensions - > Add ( new CollapsibleSection ( si - > T ( " Present modes " ) ) ) ;
2023-12-14 10:01:45 +00:00
for ( auto mode : draw - > GetPresentModeList ( di - > T ( " Current " ) ) ) {
presentModes - > Add ( new TextView ( mode , new LayoutParams ( FILL_PARENT , WRAP_CONTENT ) ) ) - > SetFocusable ( true ) ;
2023-04-19 22:21:06 +00:00
}
2023-08-03 09:11:35 +00:00
CollapsibleSection * colorFormats = gpuExtensions - > Add ( new CollapsibleSection ( si - > T ( " Display Color Formats " ) ) ) ;
2023-12-14 10:01:45 +00:00
for ( auto & format : draw - > GetSurfaceFormatList ( ) ) {
colorFormats - > Add ( new TextView ( format , new LayoutParams ( FILL_PARENT , WRAP_CONTENT ) ) ) - > SetFocusable ( true ) ;
2022-01-25 18:22:49 +00:00
}
2024-01-19 12:44:49 +00:00
CollapsibleSection * enabledExtensions = gpuExtensions - > Add ( new CollapsibleSection ( std : : string ( si - > T ( " Vulkan Extensions " ) ) + " ( " + std : : string ( di - > T ( " Enabled " ) ) + " ) " ) ) ;
2023-08-03 16:56:47 +00:00
std : : vector < std : : string > extensions = draw - > GetExtensionList ( true , true ) ;
std : : sort ( extensions . begin ( ) , extensions . end ( ) ) ;
for ( auto & extension : extensions ) {
enabledExtensions - > Add ( new TextView ( extension , new LayoutParams ( FILL_PARENT , WRAP_CONTENT ) ) ) - > SetFocusable ( true ) ;
}
// Also get instance extensions
2024-01-28 16:05:36 +00:00
enabledExtensions - > Add ( new ItemHeader ( si - > T ( " Instance " ) ) ) ;
2023-08-03 16:56:47 +00:00
extensions = draw - > GetExtensionList ( false , true ) ;
2023-01-31 20:32:22 +00:00
std : : sort ( extensions . begin ( ) , extensions . end ( ) ) ;
2017-08-28 11:45:04 +00:00
for ( auto & extension : extensions ) {
2023-08-03 09:11:35 +00:00
enabledExtensions - > Add ( new TextView ( extension , new LayoutParams ( FILL_PARENT , WRAP_CONTENT ) ) ) - > SetFocusable ( true ) ;
}
CollapsibleSection * vulkanExtensions = gpuExtensions - > Add ( new CollapsibleSection ( si - > T ( " Vulkan Extensions " ) ) ) ;
2023-08-03 16:56:47 +00:00
extensions = draw - > GetExtensionList ( true , false ) ;
std : : sort ( extensions . begin ( ) , extensions . end ( ) ) ;
for ( auto & extension : extensions ) {
vulkanExtensions - > Add ( new TextView ( extension , new LayoutParams ( FILL_PARENT , WRAP_CONTENT ) ) ) - > SetFocusable ( true ) ;
}
2024-01-29 10:21:01 +00:00
vulkanExtensions - > Add ( new ItemHeader ( si - > T ( " Instance " ) ) ) ;
2023-08-03 16:56:47 +00:00
// Also get instance extensions
extensions = draw - > GetExtensionList ( false , false ) ;
2023-08-03 09:11:35 +00:00
std : : sort ( extensions . begin ( ) , extensions . end ( ) ) ;
for ( auto & extension : extensions ) {
vulkanExtensions - > Add ( new TextView ( extension , new LayoutParams ( FILL_PARENT , WRAP_CONTENT ) ) ) - > SetFocusable ( true ) ;
2016-01-03 13:00:05 +00:00
}
2013-09-07 11:38:37 +00:00
}
2023-06-18 12:18:45 +00:00
2023-09-02 13:42:47 +00:00
# ifdef _DEBUG
2023-06-18 12:18:45 +00:00
LinearLayout * internals = AddTab ( " DevSystemInfoInternals " , si - > T ( " Internals " ) ) ;
2023-09-02 13:42:47 +00:00
CreateInternalsTab ( internals ) ;
# endif
}
void SystemInfoScreen : : CreateInternalsTab ( UI : : ViewGroup * internals ) {
using namespace UI ;
auto di = GetI18NCategory ( I18NCat : : DIALOG ) ;
auto si = GetI18NCategory ( I18NCat : : SYSINFO ) ;
auto sy = GetI18NCategory ( I18NCat : : SYSTEM ) ;
auto ac = GetI18NCategory ( I18NCat : : ACHIEVEMENTS ) ;
2023-06-18 12:18:45 +00:00
internals - > Add ( new ItemHeader ( si - > T ( " Icon cache " ) ) ) ;
IconCacheStats iconStats = g_iconCache . GetStats ( ) ;
internals - > Add ( new InfoItem ( si - > T ( " Image data count " ) , StringFromFormat ( " %d " , iconStats . cachedCount ) ) ) ;
internals - > Add ( new InfoItem ( si - > T ( " Texture count " ) , StringFromFormat ( " %d " , iconStats . textureCount ) ) ) ;
internals - > Add ( new InfoItem ( si - > T ( " Data size " ) , NiceSizeFormat ( iconStats . dataSize ) ) ) ;
internals - > Add ( new Choice ( di - > T ( " Clear " ) ) ) - > OnClick . Add ( [ & ] ( UI : : EventParams & ) {
g_iconCache . ClearData ( ) ;
RecreateViews ( ) ;
return UI : : EVENT_DONE ;
} ) ;
2023-06-20 15:27:34 +00:00
internals - > Add ( new ItemHeader ( si - > T ( " Notification tests " ) ) ) ;
internals - > Add ( new Choice ( si - > T ( " Error " ) ) ) - > OnClick . Add ( [ & ] ( UI : : EventParams & ) {
2023-08-06 08:48:46 +00:00
std : : string str = " Error " + CodepointToUTF8 ( 0x1F41B ) + CodepointToUTF8 ( 0x1F41C ) + CodepointToUTF8 ( 0x1F914 ) ;
2023-08-06 09:35:13 +00:00
g_OSD . Show ( OSDType : : MESSAGE_ERROR , str ) ;
2023-06-20 15:27:34 +00:00
return UI : : EVENT_DONE ;
} ) ;
internals - > Add ( new Choice ( si - > T ( " Warning " ) ) ) - > OnClick . Add ( [ & ] ( UI : : EventParams & ) {
2023-07-06 17:21:19 +00:00
g_OSD . Show ( OSDType : : MESSAGE_WARNING , " Warning " , " Some \n Additional \n Detail " ) ;
2023-06-20 15:27:34 +00:00
return UI : : EVENT_DONE ;
} ) ;
internals - > Add ( new Choice ( si - > T ( " Info " ) ) ) - > OnClick . Add ( [ & ] ( UI : : EventParams & ) {
2023-07-06 17:21:19 +00:00
g_OSD . Show ( OSDType : : MESSAGE_INFO , " Info " ) ;
2023-06-20 15:27:34 +00:00
return UI : : EVENT_DONE ;
} ) ;
2024-04-09 12:10:02 +00:00
// This one is clickable
2023-06-20 15:27:34 +00:00
internals - > Add ( new Choice ( si - > T ( " Success " ) ) ) - > OnClick . Add ( [ & ] ( UI : : EventParams & ) {
2024-04-09 12:10:02 +00:00
g_OSD . Show ( OSDType : : MESSAGE_SUCCESS , " Success " , 0.0f , " clickable " ) ;
2024-04-09 12:23:26 +00:00
g_OSD . SetClickCallback ( " clickable " , [ ] ( bool clicked , void * ) {
2024-04-09 12:10:02 +00:00
if ( clicked ) {
System_LaunchUrl ( LaunchUrlType : : BROWSER_URL , " https://www.google.com/ " ) ;
}
2024-04-09 12:23:26 +00:00
} , nullptr ) ;
2023-06-20 15:27:34 +00:00
return UI : : EVENT_DONE ;
} ) ;
2023-08-25 14:32:39 +00:00
internals - > Add ( new Choice ( sy - > T ( " RetroAchievements " ) ) ) - > OnClick . Add ( [ & ] ( UI : : EventParams & ) {
g_OSD . Show ( OSDType : : MESSAGE_WARNING , " RetroAchievements warning " , " " , " I_RETROACHIEVEMENTS_LOGO " ) ;
return UI : : EVENT_DONE ;
} ) ;
2023-06-20 19:26:42 +00:00
internals - > Add ( new ItemHeader ( si - > T ( " Progress tests " ) ) ) ;
internals - > Add ( new Choice ( si - > T ( " 30% " ) ) ) - > OnClick . Add ( [ & ] ( UI : : EventParams & ) {
2023-07-18 13:13:44 +00:00
g_OSD . SetProgressBar ( " testprogress " , " Test Progress " , 1 , 100 , 30 , 0.0f ) ;
2023-06-20 19:26:42 +00:00
return UI : : EVENT_DONE ;
} ) ;
internals - > Add ( new Choice ( si - > T ( " 100% " ) ) ) - > OnClick . Add ( [ & ] ( UI : : EventParams & ) {
2023-07-18 13:13:44 +00:00
g_OSD . SetProgressBar ( " testprogress " , " Test Progress " , 1 , 100 , 100 , 1.0f ) ;
2023-06-20 19:26:42 +00:00
return UI : : EVENT_DONE ;
} ) ;
2023-06-20 22:15:23 +00:00
internals - > Add ( new Choice ( si - > T ( " N/A% " ) ) ) - > OnClick . Add ( [ & ] ( UI : : EventParams & ) {
2023-07-18 13:13:44 +00:00
g_OSD . SetProgressBar ( " testprogress " , " Test Progress " , 0 , 0 , 0 , 0.0f ) ;
2023-06-20 22:15:23 +00:00
return UI : : EVENT_DONE ;
} ) ;
2023-07-18 13:13:44 +00:00
internals - > Add ( new Choice ( si - > T ( " Success " ) ) ) - > OnClick . Add ( [ & ] ( UI : : EventParams & ) {
g_OSD . RemoveProgressBar ( " testprogress " , true , 0.5f ) ;
return UI : : EVENT_DONE ;
} ) ;
internals - > Add ( new Choice ( si - > T ( " Failure " ) ) ) - > OnClick . Add ( [ & ] ( UI : : EventParams & ) {
g_OSD . RemoveProgressBar ( " testprogress " , false , 0.5f ) ;
2023-07-03 12:39:49 +00:00
return UI : : EVENT_DONE ;
} ) ;
internals - > Add ( new ItemHeader ( si - > T ( " Achievement tests " ) ) ) ;
internals - > Add ( new Choice ( si - > T ( " Leaderboard tracker: Show " ) ) ) - > OnClick . Add ( [ = ] ( UI : : EventParams & ) {
g_OSD . ShowLeaderboardTracker ( 1 , " My leaderboard tracker " , true ) ;
return UI : : EVENT_DONE ;
} ) ;
internals - > Add ( new Choice ( si - > T ( " Leaderboard tracker: Update " ) ) ) - > OnClick . Add ( [ = ] ( UI : : EventParams & ) {
g_OSD . ShowLeaderboardTracker ( 1 , " Updated tracker " , true ) ;
return UI : : EVENT_DONE ;
} ) ;
internals - > Add ( new Choice ( si - > T ( " Leaderboard tracker: Hide " ) ) ) - > OnClick . Add ( [ = ] ( UI : : EventParams & ) {
g_OSD . ShowLeaderboardTracker ( 1 , nullptr , false ) ;
2023-06-20 19:26:42 +00:00
return UI : : EVENT_DONE ;
} ) ;
2023-07-31 22:13:33 +00:00
static const char * positions [ ] = { " Bottom Left " , " Bottom Center " , " Bottom Right " , " Top Left " , " Top Center " , " Top Right " , " Center Left " , " Center Right " , " None " } ;
internals - > Add ( new ItemHeader ( ac - > T ( " Notifications " ) ) ) ;
internals - > Add ( new PopupMultiChoice ( & g_Config . iAchievementsLeaderboardTrackerPos , ac - > T ( " Leaderboard tracker " ) , positions , 0 , ARRAY_SIZE ( positions ) , I18NCat : : DIALOG , screenManager ( ) ) ) - > SetEnabledPtr ( & g_Config . bAchievementsEnable ) ;
2023-07-06 17:06:27 +00:00
# if PPSSPP_PLATFORM(ANDROID)
internals - > Add ( new Choice ( si - > T ( " Exception " ) ) ) - > OnClick . Add ( [ & ] ( UI : : EventParams & ) {
System_Notify ( SystemNotification : : TEST_JAVA_EXCEPTION ) ;
return UI : : EVENT_DONE ;
} ) ;
# endif
2013-09-07 11:38:37 +00:00
}
2013-09-29 11:39:25 +00:00
2017-11-13 10:13:38 +00:00
int ShaderListScreen : : ListShaders ( DebugShaderType shaderType , UI : : LinearLayout * view ) {
2015-10-14 15:45:21 +00:00
using namespace UI ;
std : : vector < std : : string > shaderIds_ = gpu - > DebugGetShaderIDs ( shaderType ) ;
2017-11-13 10:13:38 +00:00
int count = 0 ;
2022-10-01 18:37:10 +00:00
for ( const auto & id : shaderIds_ ) {
2015-10-14 15:45:21 +00:00
Choice * choice = view - > Add ( new Choice ( gpu - > DebugGetShaderString ( id , shaderType , SHADER_STRING_SHORT_DESC ) ) ) ;
choice - > SetTag ( id ) ;
2023-01-08 22:37:38 +00:00
choice - > SetDrawTextFlags ( FLAG_DYNAMIC_ASCII ) ;
2015-10-14 15:45:21 +00:00
choice - > OnClick . Handle ( this , & ShaderListScreen : : OnShaderClick ) ;
2017-11-13 10:13:38 +00:00
count + + ;
2015-05-16 20:43:32 +00:00
}
2017-11-13 10:13:38 +00:00
return count ;
2015-10-14 15:45:21 +00:00
}
2015-05-16 20:43:32 +00:00
2015-10-21 21:06:32 +00:00
struct { DebugShaderType type ; const char * name ; } shaderTypes [ ] = {
{ SHADER_TYPE_VERTEX , " Vertex " } ,
{ SHADER_TYPE_FRAGMENT , " Fragment " } ,
2022-10-02 03:01:23 +00:00
{ SHADER_TYPE_GEOMETRY , " Geometry " } ,
2015-10-21 21:06:32 +00:00
{ SHADER_TYPE_VERTEXLOADER , " VertexLoader " } ,
2017-04-04 09:09:29 +00:00
{ SHADER_TYPE_PIPELINE , " Pipeline " } ,
2022-08-22 10:28:46 +00:00
{ SHADER_TYPE_TEXTURE , " Texture " } ,
2017-12-06 15:01:56 +00:00
{ SHADER_TYPE_SAMPLER , " Sampler " } ,
2015-10-21 21:06:32 +00:00
} ;
2015-10-14 15:45:21 +00:00
void ShaderListScreen : : CreateViews ( ) {
using namespace UI ;
2015-05-13 20:28:02 +00:00
2023-04-05 22:34:50 +00:00
auto di = GetI18NCategory ( I18NCat : : DIALOG ) ;
2015-10-14 20:05:05 +00:00
2015-10-14 15:45:21 +00:00
LinearLayout * layout = new LinearLayout ( ORIENT_VERTICAL ) ;
root_ = layout ;
2015-05-13 20:28:02 +00:00
2015-10-14 15:45:21 +00:00
tabs_ = new TabHolder ( ORIENT_HORIZONTAL , 40 , new LinearLayoutParams ( 1.0 ) ) ;
2016-01-23 06:38:21 +00:00
tabs_ - > SetTag ( " DevShaderList " ) ;
2015-10-14 15:45:21 +00:00
layout - > Add ( tabs_ ) ;
2015-10-14 20:05:05 +00:00
layout - > Add ( new Button ( di - > T ( " Back " ) ) ) - > OnClick . Handle < UIScreen > ( this , & UIScreen : : OnBack ) ;
2015-11-18 13:18:35 +00:00
for ( size_t i = 0 ; i < ARRAY_SIZE ( shaderTypes ) ; i + + ) {
2015-10-21 21:06:32 +00:00
ScrollView * scroll = new ScrollView ( ORIENT_VERTICAL , new LinearLayoutParams ( 1.0 ) ) ;
2021-02-22 02:41:08 +00:00
LinearLayout * shaderList = new LinearLayoutList ( ORIENT_VERTICAL , new LayoutParams ( FILL_PARENT , WRAP_CONTENT ) ) ;
2017-11-13 10:13:38 +00:00
int count = ListShaders ( shaderTypes [ i ] . type , shaderList ) ;
2015-10-21 21:06:32 +00:00
scroll - > Add ( shaderList ) ;
2017-11-13 10:13:38 +00:00
tabs_ - > AddTab ( StringFromFormat ( " %s (%d) " , shaderTypes [ i ] . name , count ) , scroll ) ;
2015-10-21 21:06:32 +00:00
}
2015-10-14 15:45:21 +00:00
}
2015-05-13 20:28:02 +00:00
2015-10-14 15:45:21 +00:00
UI : : EventReturn ShaderListScreen : : OnShaderClick ( UI : : EventParams & e ) {
using namespace UI ;
std : : string id = e . v - > Tag ( ) ;
2015-10-21 21:06:32 +00:00
DebugShaderType type = shaderTypes [ tabs_ - > GetCurrentTab ( ) ] . type ;
2015-10-14 15:45:21 +00:00
screenManager ( ) - > push ( new ShaderViewScreen ( id , type ) ) ;
return EVENT_DONE ;
}
2015-05-13 21:07:19 +00:00
2015-10-14 15:45:21 +00:00
void ShaderViewScreen : : CreateViews ( ) {
using namespace UI ;
2015-05-13 21:07:19 +00:00
2023-04-05 22:34:50 +00:00
auto di = GetI18NCategory ( I18NCat : : DIALOG ) ;
2015-10-14 20:05:05 +00:00
2015-10-14 15:45:21 +00:00
LinearLayout * layout = new LinearLayout ( ORIENT_VERTICAL ) ;
root_ = layout ;
2015-05-13 20:28:02 +00:00
2022-12-13 15:26:38 +00:00
layout - > Add ( new TextView ( gpu - > DebugGetShaderString ( id_ , type_ , SHADER_STRING_SHORT_DESC ) , FLAG_DYNAMIC_ASCII | FLAG_WRAP_TEXT , false ) ) ;
2015-05-13 21:07:19 +00:00
2015-10-14 15:45:21 +00:00
ScrollView * scroll = new ScrollView ( ORIENT_VERTICAL , new LinearLayoutParams ( 1.0 ) ) ;
2016-01-23 06:52:13 +00:00
scroll - > SetTag ( " DevShaderView " ) ;
2015-10-14 15:45:21 +00:00
layout - > Add ( scroll ) ;
2015-07-03 19:43:02 +00:00
2021-02-22 02:41:08 +00:00
LinearLayout * lineLayout = new LinearLayoutList ( ORIENT_VERTICAL , new LinearLayoutParams ( FILL_PARENT , WRAP_CONTENT ) ) ;
2015-10-14 15:45:21 +00:00
lineLayout - > SetSpacing ( 0.0 ) ;
scroll - > Add ( lineLayout ) ;
2015-05-13 21:07:19 +00:00
2015-10-14 15:45:21 +00:00
std : : vector < std : : string > lines ;
SplitString ( gpu - > DebugGetShaderString ( id_ , type_ , SHADER_STRING_SOURCE_CODE ) , ' \n ' , lines ) ;
2015-05-25 22:55:25 +00:00
2023-12-12 14:38:50 +00:00
for ( const auto & line : lines ) {
2022-12-13 15:26:38 +00:00
lineLayout - > Add ( new TextView ( line , FLAG_DYNAMIC_ASCII | FLAG_WRAP_TEXT , true ) ) ;
2015-05-25 22:55:25 +00:00
}
2015-10-14 20:05:05 +00:00
layout - > Add ( new Button ( di - > T ( " Back " ) ) ) - > OnClick . Handle < UIScreen > ( this , & UIScreen : : OnBack ) ;
2015-05-13 20:28:02 +00:00
}
2021-01-31 12:13:42 +00:00
2024-06-01 23:04:34 +00:00
bool ShaderViewScreen : : key ( const KeyInput & ki ) {
if ( ki . flags & KEY_CHAR ) {
if ( ki . unicodeChar = = ' C ' | | ki . unicodeChar = = ' c ' ) {
System_CopyStringToClipboard ( gpu - > DebugGetShaderString ( id_ , type_ , SHADER_STRING_SHORT_DESC ) ) ;
}
}
return UIDialogScreenWithBackground : : key ( ki ) ;
}
2021-01-31 13:42:40 +00:00
const std : : string framedumpsBaseUrl = " http://framedump.ppsspp.org/repro/ " ;
2021-01-31 12:13:42 +00:00
FrameDumpTestScreen : : FrameDumpTestScreen ( ) {
}
FrameDumpTestScreen : : ~ FrameDumpTestScreen ( ) {
g_DownloadManager . CancelAll ( ) ;
}
void FrameDumpTestScreen : : CreateViews ( ) {
2021-01-31 13:42:40 +00:00
using namespace UI ;
root_ = new AnchorLayout ( new LayoutParams ( FILL_PARENT , FILL_PARENT ) ) ;
2023-04-05 22:34:50 +00:00
auto di = GetI18NCategory ( I18NCat : : DIALOG ) ;
2021-01-31 13:42:40 +00:00
TabHolder * tabHolder ;
tabHolder = new TabHolder ( ORIENT_VERTICAL , 200 , new AnchorLayoutParams ( 10 , 0 , 10 , 0 , false ) ) ;
root_ - > Add ( tabHolder ) ;
AddStandardBack ( root_ ) ;
tabHolder - > SetTag ( " DumpTypes " ) ;
root_ - > SetDefaultFocusView ( tabHolder ) ;
ViewGroup * dumpsScroll = new ScrollView ( ORIENT_VERTICAL , new LinearLayoutParams ( FILL_PARENT , FILL_PARENT ) ) ;
dumpsScroll - > SetTag ( " GameSettingsGraphics " ) ;
2021-02-22 02:41:08 +00:00
LinearLayout * dumps = new LinearLayoutList ( ORIENT_VERTICAL ) ;
2021-01-31 13:42:40 +00:00
dumps - > SetSpacing ( 0 ) ;
dumpsScroll - > Add ( dumps ) ;
2024-04-02 10:48:16 +00:00
tabHolder - > AddTab ( " Dumps " , dumpsScroll ) ;
2021-01-31 13:42:40 +00:00
dumps - > Add ( new ItemHeader ( " GE Frame Dumps " ) ) ;
2021-01-31 12:13:42 +00:00
for ( auto & file : files_ ) {
std : : string url = framedumpsBaseUrl + file ;
2021-01-31 13:42:40 +00:00
Choice * c = dumps - > Add ( new Choice ( file ) ) ;
c - > SetTag ( url ) ;
c - > OnClick . Handle < FrameDumpTestScreen > ( this , & FrameDumpTestScreen : : OnLoadDump ) ;
2021-01-31 12:13:42 +00:00
}
}
2021-01-31 13:42:40 +00:00
UI : : EventReturn FrameDumpTestScreen : : OnLoadDump ( UI : : EventParams & params ) {
std : : string url = params . v - > Tag ( ) ;
2024-07-14 12:42:59 +00:00
INFO_LOG ( Log : : Common , " Trying to launch '%s' " , url . c_str ( ) ) ;
2021-01-31 13:42:40 +00:00
// Our disc streaming functionality detects the URL and takes over and handles loading framedumps well,
// except for some reason the game ID.
// TODO: Fix that since it can be important for compat settings.
2021-05-05 23:31:38 +00:00
LaunchFile ( screenManager ( ) , Path ( url ) ) ;
2021-01-31 13:42:40 +00:00
return UI : : EVENT_DONE ;
}
2021-01-31 12:13:42 +00:00
void FrameDumpTestScreen : : update ( ) {
2021-01-31 13:42:40 +00:00
UIScreen : : update ( ) ;
2021-01-31 12:13:42 +00:00
if ( ! listing_ ) {
2021-08-22 15:29:48 +00:00
const char * acceptMime = " text/html, */*; q=0.8 " ;
2023-07-18 13:13:44 +00:00
listing_ = g_DownloadManager . StartDownload ( framedumpsBaseUrl , Path ( ) , http : : ProgressBarMode : : DELAYED , acceptMime ) ;
2021-01-31 12:13:42 +00:00
}
if ( listing_ & & listing_ - > Done ( ) & & files_ . empty ( ) ) {
if ( listing_ - > ResultCode ( ) = = 200 ) {
std : : string listingHtml ;
listing_ - > buffer ( ) . TakeAll ( & listingHtml ) ;
2021-01-31 13:42:40 +00:00
std : : vector < std : : string > lines ;
// We rely slightly on nginx listing format here. Not great.
SplitString ( listingHtml , ' \n ' , lines ) ;
for ( auto & line : lines ) {
std : : string trimmed = StripSpaces ( line ) ;
if ( startsWith ( trimmed , " <a href= \" " ) ) {
trimmed = trimmed . substr ( strlen ( " <a href= \" " ) ) ;
size_t offset = trimmed . find ( ' \" ' ) ;
if ( offset ! = std : : string : : npos ) {
trimmed = trimmed . substr ( 0 , offset ) ;
if ( endsWith ( trimmed , " .ppdmp " ) ) {
2024-07-14 12:42:59 +00:00
INFO_LOG ( Log : : Common , " Found ppdmp: '%s' " , trimmed . c_str ( ) ) ;
2021-01-31 13:42:40 +00:00
files_ . push_back ( trimmed ) ;
}
}
}
}
2021-01-31 12:13:42 +00:00
} else {
// something went bad. Too lazy to make UI, so let's just finish this screen.
TriggerFinish ( DialogResult : : DR_CANCEL ) ;
}
RecreateViews ( ) ;
}
2023-08-24 10:52:00 +00:00
}
2023-12-14 10:10:36 +00:00
void TouchTestScreen : : touch ( const TouchInput & touch ) {
UIDialogScreenWithGameBackground : : touch ( touch ) ;
if ( touch . flags & TOUCH_DOWN ) {
bool found = false ;
for ( int i = 0 ; i < MAX_TOUCH_POINTS ; i + + ) {
if ( touches_ [ i ] . id = = touch . id ) {
2024-07-14 12:42:59 +00:00
WARN_LOG ( Log : : System , " Double touch " ) ;
2023-12-14 10:10:36 +00:00
touches_ [ i ] . x = touch . x ;
touches_ [ i ] . y = touch . y ;
found = true ;
}
}
if ( ! found ) {
for ( int i = 0 ; i < MAX_TOUCH_POINTS ; i + + ) {
if ( touches_ [ i ] . id = = - 1 ) {
touches_ [ i ] . id = touch . id ;
touches_ [ i ] . x = touch . x ;
touches_ [ i ] . y = touch . y ;
break ;
}
}
}
}
if ( touch . flags & TOUCH_MOVE ) {
bool found = false ;
for ( int i = 0 ; i < MAX_TOUCH_POINTS ; i + + ) {
if ( touches_ [ i ] . id = = touch . id ) {
touches_ [ i ] . x = touch . x ;
touches_ [ i ] . y = touch . y ;
found = true ;
}
}
2024-11-06 21:09:53 +00:00
if ( ! found & & touch . buttons ) {
WARN_LOG ( Log : : System , " Move with buttons %d without touch down: %d " , touch . buttons , touch . id ) ;
2023-12-14 10:10:36 +00:00
}
}
if ( touch . flags & TOUCH_UP ) {
bool found = false ;
for ( int i = 0 ; i < MAX_TOUCH_POINTS ; i + + ) {
if ( touches_ [ i ] . id = = touch . id ) {
found = true ;
touches_ [ i ] . id = - 1 ;
break ;
}
}
if ( ! found ) {
2024-07-14 12:42:59 +00:00
WARN_LOG ( Log : : System , " Touch release without touch down " ) ;
2023-12-14 10:10:36 +00:00
}
}
}
// TODO: Move this screen out into its own file.
void TouchTestScreen : : CreateViews ( ) {
using namespace UI ;
auto di = GetI18NCategory ( I18NCat : : DIALOG ) ;
auto gr = GetI18NCategory ( I18NCat : : GRAPHICS ) ;
root_ = new LinearLayout ( ORIENT_VERTICAL ) ;
LinearLayout * theTwo = new LinearLayout ( ORIENT_VERTICAL , new LinearLayoutParams ( 1.0f ) ) ;
2024-05-31 19:11:48 +00:00
// TODO: This one should use DYNAMIC_ASCII. Though doesn't matter much.
2023-12-14 10:10:36 +00:00
lastKeyEvents_ = theTwo - > Add ( new TextView ( " - " , new LayoutParams ( FILL_PARENT , WRAP_CONTENT ) ) ) ;
root_ - > Add ( theTwo ) ;
# if !PPSSPP_PLATFORM(UWP)
static const char * renderingBackend [ ] = { " OpenGL " , " Direct3D 9 " , " Direct3D 11 " , " Vulkan " } ;
PopupMultiChoice * renderingBackendChoice = root_ - > Add ( new PopupMultiChoice ( & g_Config . iGPUBackend , gr - > T ( " Backend " ) , renderingBackend , ( int ) GPUBackend : : OPENGL , ARRAY_SIZE ( renderingBackend ) , I18NCat : : GRAPHICS , screenManager ( ) ) ) ;
renderingBackendChoice - > OnChoice . Handle ( this , & TouchTestScreen : : OnRenderingBackend ) ;
if ( ! g_Config . IsBackendEnabled ( GPUBackend : : OPENGL ) )
renderingBackendChoice - > HideChoice ( ( int ) GPUBackend : : OPENGL ) ;
if ( ! g_Config . IsBackendEnabled ( GPUBackend : : DIRECT3D9 ) )
renderingBackendChoice - > HideChoice ( ( int ) GPUBackend : : DIRECT3D9 ) ;
if ( ! g_Config . IsBackendEnabled ( GPUBackend : : DIRECT3D11 ) )
renderingBackendChoice - > HideChoice ( ( int ) GPUBackend : : DIRECT3D11 ) ;
if ( ! g_Config . IsBackendEnabled ( GPUBackend : : VULKAN ) )
renderingBackendChoice - > HideChoice ( ( int ) GPUBackend : : VULKAN ) ;
# endif
# if PPSSPP_PLATFORM(ANDROID)
root_ - > Add ( new Choice ( gr - > T ( " Recreate Activity " ) ) ) - > OnClick . Handle ( this , & TouchTestScreen : : OnRecreateActivity ) ;
# endif
root_ - > Add ( new CheckBox ( & g_Config . bImmersiveMode , gr - > T ( " FullScreen " , " Full Screen " ) ) ) - > OnClick . Handle ( this , & TouchTestScreen : : OnImmersiveModeChange ) ;
root_ - > Add ( new Button ( di - > T ( " Back " ) ) ) - > OnClick . Handle < UIScreen > ( this , & UIScreen : : OnBack ) ;
}
void TouchTestScreen : : UpdateLogView ( ) {
while ( keyEventLog_ . size ( ) > 8 ) {
keyEventLog_ . erase ( keyEventLog_ . begin ( ) ) ;
}
std : : string text ;
for ( auto & iter : keyEventLog_ ) {
text + = iter + " \n " ;
}
if ( lastKeyEvents_ ) {
lastKeyEvents_ - > SetText ( text ) ;
}
}
bool TouchTestScreen : : key ( const KeyInput & key ) {
UIScreen : : key ( key ) ;
char buf [ 512 ] ;
snprintf ( buf , sizeof ( buf ) , " %s (%d) Device ID: %d [%s%s%s%s] " , KeyMap : : GetKeyName ( key . keyCode ) . c_str ( ) , key . keyCode , key . deviceId ,
( key . flags & KEY_IS_REPEAT ) ? " REP " : " " ,
( key . flags & KEY_UP ) ? " UP " : " " ,
( key . flags & KEY_DOWN ) ? " DOWN " : " " ,
( key . flags & KEY_CHAR ) ? " CHAR " : " " ) ;
keyEventLog_ . push_back ( buf ) ;
UpdateLogView ( ) ;
return true ;
}
void TouchTestScreen : : axis ( const AxisInput & axis ) {
char buf [ 512 ] ;
snprintf ( buf , sizeof ( buf ) , " Axis: %s (%d) (value %1.3f) Device ID: %d " ,
KeyMap : : GetAxisName ( axis . axisId ) . c_str ( ) , axis . axisId , axis . value , axis . deviceId ) ;
keyEventLog_ . push_back ( buf ) ;
if ( keyEventLog_ . size ( ) > 8 ) {
keyEventLog_ . erase ( keyEventLog_ . begin ( ) ) ;
}
UpdateLogView ( ) ;
}
void TouchTestScreen : : DrawForeground ( UIContext & dc ) {
Bounds bounds = dc . GetLayoutBounds ( ) ;
double now = dc . FrameStartTime ( ) ;
double delta = now - lastFrameTime_ ;
lastFrameTime_ = now ;
dc . BeginNoTex ( ) ;
for ( int i = 0 ; i < MAX_TOUCH_POINTS ; i + + ) {
if ( touches_ [ i ] . id ! = - 1 ) {
dc . Draw ( ) - > Circle ( touches_ [ i ] . x , touches_ [ i ] . y , 100.0 , 3.0 , 80 , 0.0f , 0xFFFFFFFF , 1.0 ) ;
}
}
dc . Flush ( ) ;
dc . Begin ( ) ;
char buffer [ 4096 ] ;
for ( int i = 0 ; i < MAX_TOUCH_POINTS ; i + + ) {
if ( touches_ [ i ] . id ! = - 1 ) {
dc . Draw ( ) - > Circle ( touches_ [ i ] . x , touches_ [ i ] . y , 100.0 , 3.0 , 80 , 0.0f , 0xFFFFFFFF , 1.0 ) ;
snprintf ( buffer , sizeof ( buffer ) , " %0.1fx%0.1f " , touches_ [ i ] . x , touches_ [ i ] . y ) ;
dc . DrawText ( buffer , touches_ [ i ] . x , touches_ [ i ] . y + ( touches_ [ i ] . y > g_display . dp_yres - 100.0f ? - 135.0f : 95.0f ) , 0xFFFFFFFF , ALIGN_HCENTER | FLAG_DYNAMIC_ASCII ) ;
}
}
char extra_debug [ 2048 ] { } ;
# if PPSSPP_PLATFORM(ANDROID)
truncate_cpy ( extra_debug , Android_GetInputDeviceDebugString ( ) . c_str ( ) ) ;
# endif
snprintf ( buffer , sizeof ( buffer ) ,
# if PPSSPP_PLATFORM(ANDROID)
" display_res: %dx%d \n "
# endif
" dp_res: %dx%d pixel_res: %dx%d \n "
" g_dpi: %0.3f g_dpi_scale: %0.3fx%0.3f \n "
" g_dpi_scale_real: %0.3fx%0.3f \n "
" delta: %0.2f ms fps: %0.3f \n %s " ,
# if PPSSPP_PLATFORM(ANDROID)
2024-05-11 11:27:22 +00:00
( int ) System_GetPropertyInt ( SYSPROP_DISPLAY_XRES ) , ( int ) System_GetPropertyInt ( SYSPROP_DISPLAY_YRES ) ,
2023-12-14 10:10:36 +00:00
# endif
g_display . dp_xres , g_display . dp_yres , g_display . pixel_xres , g_display . pixel_yres ,
g_display . dpi , g_display . dpi_scale_x , g_display . dpi_scale_y ,
g_display . dpi_scale_real_x , g_display . dpi_scale_real_y ,
delta * 1000.0 , 1.0 / delta ,
extra_debug ) ;
// On Android, also add joystick debug data.
dc . DrawTextShadow ( buffer , bounds . centerX ( ) , bounds . y + 20.0f , 0xFFFFFFFF , FLAG_DYNAMIC_ASCII ) ;
dc . Flush ( ) ;
}
void RecreateActivity ( ) {
const int SYSTEM_JELLYBEAN = 16 ;
if ( System_GetPropertyInt ( SYSPROP_SYSTEMVERSION ) > = SYSTEM_JELLYBEAN ) {
2024-07-14 12:42:59 +00:00
INFO_LOG ( Log : : System , " Sending recreate " ) ;
2023-12-14 10:10:36 +00:00
System_Notify ( SystemNotification : : FORCE_RECREATE_ACTIVITY ) ;
2024-07-14 12:42:59 +00:00
INFO_LOG ( Log : : System , " Got back from recreate " ) ;
2023-12-14 10:10:36 +00:00
} else {
auto gr = GetI18NCategory ( I18NCat : : GRAPHICS ) ;
2024-01-19 12:44:49 +00:00
System_Toast ( gr - > T_cstr ( " Must Restart " , " You must restart PPSSPP for this change to take effect " ) ) ;
2023-12-14 10:10:36 +00:00
}
}
UI : : EventReturn TouchTestScreen : : OnImmersiveModeChange ( UI : : EventParams & e ) {
System_Notify ( SystemNotification : : IMMERSIVE_MODE_CHANGE ) ;
if ( g_Config . iAndroidHwScale ! = 0 ) {
RecreateActivity ( ) ;
}
return UI : : EVENT_DONE ;
}
UI : : EventReturn TouchTestScreen : : OnRenderingBackend ( UI : : EventParams & e ) {
g_Config . Save ( " GameSettingsScreen::RenderingBackend " ) ;
System_RestartApp ( " --touchscreentest " ) ;
return UI : : EVENT_DONE ;
}
UI : : EventReturn TouchTestScreen : : OnRecreateActivity ( UI : : EventParams & e ) {
RecreateActivity ( ) ;
return UI : : EVENT_DONE ;
}