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
# if !PPSSPP_PLATFORM(UWP)
2022-01-25 18:22:49 +00:00
# include "Common/GPU/Vulkan/VulkanContext.h"
2022-01-26 13:33:09 +00:00
# endif
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
2013-09-07 11:38:37 +00:00
# include "Common/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"
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"
2013-09-07 18:54:11 +00:00
2022-01-25 18:22:49 +00:00
2015-02-02 08:27:27 +00:00
# ifdef _WIN32
2018-02-25 09:27:59 +00:00
# include "Common/CommonWindows.h"
2015-02-02 08:27:27 +00:00
// 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 " ,
} ;
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 ) ;
items - > Add ( new Choice ( sy - > T ( " Developer Tools " ) ) ) - > OnClick . Handle ( this , & DevMenuScreen : : OnDeveloperTools ) ;
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
AddOverlayList ( items , screenManager ( ) ) ;
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 ) ;
items - > Add ( new Choice ( dev - > T ( " Create frame dump " ) ) ) - > OnClick . Add ( [ ] ( UI : : EventParams & e ) {
GPURecord : : RecordNextFrame ( [ ] ( const Path & dumpPath ) {
NOTICE_LOG ( SYSTEM , " Frame dump created at '%s' " , dumpPath . c_str ( ) ) ;
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
}
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.
2017-03-06 12:10:23 +00:00
NOTICE_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 + + ) {
2023-08-25 09:33:48 +00:00
LogType type = ( LogType ) 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 + + ) {
2023-08-25 09:33:48 +00:00
LogChannel * chan = logMan - > GetLogChannel ( ( LogType ) 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 + + ) {
2023-08-25 09:33:48 +00:00
LogChannel * chan = logMan - > GetLogChannel ( ( LogType ) 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 + + ) {
2023-08-25 09:33:48 +00:00
LogChannel * chan = logMan - > GetLogChannel ( ( LogType ) 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 ;
}
LogLevelScreen : : LogLevelScreen ( const std : : string & title ) : ListPopupScreen ( title ) {
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 ) ;
}
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 ) {
2023-08-25 09:33:48 +00:00
LogType type = ( LogType ) 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 ;
}
2014-07-20 14:32:56 +00:00
const char * GetCompilerABI ( ) {
2016-10-12 15:32:52 +00:00
# if PPSSPP_ARCH(ARMV7)
2014-07-20 14:32:56 +00:00
return " armeabi-v7a " ;
2016-10-12 15:32:52 +00:00
# elif PPSSPP_ARCH(ARM)
2014-07-20 15:34:39 +00:00
return " armeabi " ;
2016-10-12 15:32:52 +00:00
# elif PPSSPP_ARCH(ARM64)
2015-03-05 22:31:03 +00:00
return " arm64 " ;
2016-10-12 15:32:52 +00:00
# elif PPSSPP_ARCH(X86)
2014-07-20 14:32:56 +00:00
return " x86 " ;
2016-10-12 15:32:52 +00:00
# elif PPSSPP_ARCH(AMD64)
2014-07-20 14:32:56 +00:00
return " x86-64 " ;
2021-07-28 11:58:56 +00:00
# elif PPSSPP_ARCH(RISCV64)
2021-07-30 15:50:48 +00:00
//https://github.com/riscv/riscv-toolchain-conventions#cc-preprocessor-definitions
//https://github.com/riscv/riscv-c-api-doc/blob/master/riscv-c-api.md#abi-related-preprocessor-definitions
# if defined(__riscv_float_abi_single)
return " lp64f " ;
# elif defined(__riscv_float_abi_double)
return " lp64d " ;
# elif defined(__riscv_float_abi_quad)
return " lp64q " ;
# elif defined(__riscv_float_abi_soft)
return " lp64 " ;
# endif
2014-07-20 14:32:56 +00:00
# else
return " other " ;
# endif
}
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
TabHolder * tabHolder = new TabHolder ( ORIENT_VERTICAL , 225 , new AnchorLayoutParams ( 10 , 0 , 10 , 0 , false ) ) ;
2016-01-23 06:38:21 +00:00
tabHolder - > SetTag ( " DevSystemInfo " ) ;
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 ) ) ) ) ;
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 ( ) ) ) ;
2017-05-21 15:24:40 +00:00
# ifdef _WIN32
if ( IsDebuggerPresent ( ) ) {
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
}
# endif
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 ;
2017-12-10 18:57:57 +00:00
std : : string cores = StringFromFormat ( si - > T ( " %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 ) ;
const char * 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
2017-12-26 23:55:24 +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 ) ) ) ;
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 ) {
2020-11-11 22:09:48 +00:00
char temp [ 512 ] ;
snprintf ( temp , sizeof ( temp ) , " Highp int range: %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 ) {
char temp [ 512 ] ;
snprintf ( temp , sizeof ( temp ) , " Highp float range: %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 " ) ) ) ;
osInformation - > Add ( new InfoItem ( si - > T ( " Memory Page Size " ) , StringFromFormat ( si - > T ( " %d bytes " ) , GetMemoryProtectPageSize ( ) ) ) ) ;
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
2017-12-10 18:57:57 +00:00
const char * 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 " ) ) ) ;
audioInformation - > Add ( new InfoItem ( si - > T ( " Sample rate " ) , StringFromFormat ( si - > T ( " %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)
2023-07-16 23:11:37 +00:00
audioInformation - > Add ( new InfoItem ( si - > T ( " Optimal sample rate " ) , StringFromFormat ( si - > T ( " %d Hz " ) , System_GetPropertyInt ( SYSPROP_AUDIO_OPTIMAL_SAMPLE_RATE ) ) ) ) ;
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 ,
2022-12-17 21:14:21 +00:00
si - > T ( " 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.
2023-07-16 23:11:37 +00:00
displayInfo - > Add ( new InfoItem ( si - > T ( " Refresh rate " ) , StringFromFormat ( si - > T ( " %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 ] ) ;
}
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 ) ;
}
2023-07-16 23:11:37 +00:00
versionInfo - > Add ( new InfoItem ( si - > T ( " API Version " ) , apiVersion ) ) ;
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
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 ) {
ViewGroup * eglExtensionsScroll = new ScrollView ( ORIENT_VERTICAL , new LinearLayoutParams ( FILL_PARENT , FILL_PARENT ) ) ;
eglExtensionsScroll - > SetTag ( " DevSystemInfoEGLExt " ) ;
2021-02-22 02:41:08 +00:00
LinearLayout * eglExtensions = new LinearLayoutList ( ORIENT_VERTICAL ) ;
2016-01-03 13:00:05 +00:00
eglExtensions - > SetSpacing ( 0 ) ;
eglExtensionsScroll - > Add ( eglExtensions ) ;
2014-05-06 04:25:50 +00:00
2017-12-10 18:57:57 +00:00
tabHolder - > AddTab ( si - > T ( " EGL Extensions " ) , eglExtensionsScroll ) ;
2014-05-06 04:25:50 +00:00
2017-12-10 18:57:57 +00:00
eglExtensions - > Add ( new ItemHeader ( si - > T ( " EGL Extensions " ) ) ) ;
2014-05-06 04:25:50 +00:00
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 " ) ) ;
2023-04-19 22:21:06 +00:00
# if !PPSSPP_PLATFORM(UWP)
// Vulkan specific code here, can't be bothered to abstract.
// OK because of above check.
VulkanContext * vk = ( VulkanContext * ) draw - > GetNativeObject ( Draw : : NativeObject : : CONTEXT ) ;
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
2023-08-03 09:11:35 +00:00
CollapsibleSection * presentModes = gpuExtensions - > Add ( new CollapsibleSection ( si - > T ( " Present Modes " ) ) ) ;
2023-04-19 22:21:06 +00:00
for ( auto mode : vk - > GetAvailablePresentModes ( ) ) {
std : : string str = VulkanPresentModeToString ( mode ) ;
if ( mode = = vk - > GetPresentMode ( ) ) {
str + = std : : string ( " ( " ) + di - > T ( " Current " ) + " ) " ;
}
2023-08-03 14:19:18 +00:00
presentModes - > Add ( new TextView ( str , 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 " ) ) ) ;
2022-01-25 18:22:49 +00:00
if ( vk ) {
for ( auto & format : vk - > SurfaceFormats ( ) ) {
std : : string line = StringFromFormat ( " %s : %s " , VulkanFormatToString ( format . format ) , VulkanColorSpaceToString ( format . colorSpace ) ) ;
2023-08-03 09:11:35 +00:00
colorFormats - > Add ( new TextView ( line ,
2022-01-25 18:22:49 +00:00
new LayoutParams ( FILL_PARENT , WRAP_CONTENT ) ) ) - > SetFocusable ( true ) ;
}
}
2022-01-26 13:33:09 +00:00
# endif
2022-01-25 18:22:49 +00:00
2023-08-03 09:11:35 +00:00
CollapsibleSection * enabledExtensions = gpuExtensions - > Add ( new CollapsibleSection ( std : : string ( si - > T ( " Vulkan Extensions " ) ) + " ( " + 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
enabledExtensions - > Add ( new ItemHeader ( " Instance " ) ) ;
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 ) ;
}
vulkanExtensions - > Add ( new ItemHeader ( " Instance " ) ) ;
// 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 ;
} ) ;
internals - > Add ( new Choice ( si - > T ( " Success " ) ) ) - > OnClick . Add ( [ & ] ( UI : : EventParams & ) {
2023-07-06 17:21:19 +00:00
g_OSD . Show ( OSDType : : MESSAGE_SUCCESS , " Success " ) ;
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
2013-11-29 06:35:03 +00:00
void AddressPromptScreen : : CreatePopupContents ( UI : : ViewGroup * parent ) {
2013-11-29 07:02:04 +00:00
using namespace UI ;
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
addrView_ = new TextView ( dev - > T ( " Enter address " ) , ALIGN_HCENTER , false ) ;
2013-11-29 06:35:03 +00:00
parent - > Add ( addrView_ ) ;
2013-11-29 07:02:04 +00:00
ViewGroup * grid = new GridLayout ( GridLayoutSettings ( 60 , 40 ) ) ;
parent - > Add ( grid ) ;
for ( int i = 0 ; i < 16 ; + + i ) {
char temp [ 16 ] ;
snprintf ( temp , 16 , " %X " , i ) ;
buttons_ [ i ] = new Button ( temp ) ;
grid - > Add ( buttons_ [ i ] ) - > OnClick . Handle ( this , & AddressPromptScreen : : OnDigitButton ) ;
}
2015-06-30 03:28:31 +00:00
parent - > Add ( new Button ( dev - > T ( " Backspace " ) ) ) - > OnClick . Handle ( this , & AddressPromptScreen : : OnBackspace ) ;
2013-11-29 06:35:03 +00:00
}
void AddressPromptScreen : : OnCompleted ( DialogResult result ) {
if ( result = = DR_OK ) {
2017-03-22 01:34:52 +00:00
UI : : EventParams e { } ;
2013-11-29 06:35:03 +00:00
e . v = root_ ;
e . a = addr_ ;
OnChoice . Trigger ( e ) ;
}
}
2013-11-29 07:02:04 +00:00
UI : : EventReturn AddressPromptScreen : : OnDigitButton ( UI : : EventParams & e ) {
for ( int i = 0 ; i < 16 ; + + i ) {
if ( buttons_ [ i ] = = e . v ) {
AddDigit ( i ) ;
}
}
return UI : : EVENT_DONE ;
}
UI : : EventReturn AddressPromptScreen : : OnBackspace ( UI : : EventParams & e ) {
BackspaceDigit ( ) ;
return UI : : EVENT_DONE ;
}
void AddressPromptScreen : : AddDigit ( int n ) {
if ( ( addr_ & 0xF0000000 ) = = 0 ) {
addr_ = addr_ * 16 + n ;
}
UpdatePreviewDigits ( ) ;
}
void AddressPromptScreen : : BackspaceDigit ( ) {
addr_ / = 16 ;
UpdatePreviewDigits ( ) ;
}
void AddressPromptScreen : : UpdatePreviewDigits ( ) {
2023-04-05 22:34:50 +00:00
auto dev = GetI18NCategory ( I18NCat : : DEVELOPER ) ;
2014-12-10 22:01:09 +00:00
2013-11-29 07:02:04 +00:00
if ( addr_ ! = 0 ) {
char temp [ 32 ] ;
snprintf ( temp , 32 , " %8X " , addr_ ) ;
addrView_ - > SetText ( temp ) ;
} else {
2015-06-30 03:28:31 +00:00
addrView_ - > SetText ( dev - > T ( " Enter address " ) ) ;
2013-11-29 07:02:04 +00:00
}
}
2014-06-15 11:04:59 +00:00
bool AddressPromptScreen : : key ( const KeyInput & key ) {
2013-11-29 06:35:03 +00:00
if ( key . flags & KEY_DOWN ) {
if ( key . keyCode > = NKCODE_0 & & key . keyCode < = NKCODE_9 ) {
2013-11-29 07:02:04 +00:00
AddDigit ( key . keyCode - NKCODE_0 ) ;
2013-11-29 06:35:03 +00:00
} else if ( key . keyCode > = NKCODE_A & & key . keyCode < = NKCODE_F ) {
2013-11-29 07:02:04 +00:00
AddDigit ( 10 + key . keyCode - NKCODE_A ) ;
2013-11-29 06:35:03 +00:00
// NKCODE_DEL is backspace.
} else if ( key . keyCode = = NKCODE_DEL ) {
2013-11-29 07:02:04 +00:00
BackspaceDigit ( ) ;
2013-11-29 06:35:03 +00:00
} else if ( key . keyCode = = NKCODE_ENTER ) {
2017-03-20 00:43:03 +00:00
TriggerFinish ( DR_OK ) ;
2013-11-29 06:35:03 +00:00
} else {
2014-06-15 11:04:59 +00:00
return UIDialogScreen : : key ( key ) ;
2013-11-29 06:35:03 +00:00
}
} else {
2014-06-15 11:04:59 +00:00
return UIDialogScreen : : key ( key ) ;
2013-11-29 06:35:03 +00:00
}
2014-06-15 11:04:59 +00:00
return true ;
2013-11-29 06:35:03 +00:00
}
2013-09-29 11:39:25 +00:00
// Three panes: Block chooser, MIPS view, ARM/x86 view
void JitCompareScreen : : CreateViews ( ) {
2023-04-05 22:34:50 +00:00
auto di = GetI18NCategory ( I18NCat : : DIALOG ) ;
auto dev = GetI18NCategory ( I18NCat : : DEVELOPER ) ;
2013-09-29 11:39:25 +00:00
using namespace UI ;
root_ = new LinearLayout ( ORIENT_HORIZONTAL ) ;
ScrollView * leftColumnScroll = root_ - > Add ( new ScrollView ( ORIENT_VERTICAL , new LinearLayoutParams ( 1.0f ) ) ) ;
LinearLayout * leftColumn = leftColumnScroll - > Add ( new LinearLayout ( ORIENT_VERTICAL ) ) ;
ScrollView * midColumnScroll = root_ - > Add ( new ScrollView ( ORIENT_VERTICAL , new LinearLayoutParams ( 2.0f ) ) ) ;
LinearLayout * midColumn = midColumnScroll - > Add ( new LinearLayout ( ORIENT_VERTICAL ) ) ;
2016-01-23 06:52:13 +00:00
midColumn - > SetTag ( " JitCompareLeftDisasm " ) ;
2013-09-29 11:39:25 +00:00
leftDisasm_ = midColumn - > Add ( new LinearLayout ( ORIENT_VERTICAL ) ) ;
leftDisasm_ - > SetSpacing ( 0.0f ) ;
ScrollView * rightColumnScroll = root_ - > Add ( new ScrollView ( ORIENT_VERTICAL , new LinearLayoutParams ( 2.0f ) ) ) ;
2016-01-23 06:52:13 +00:00
rightColumnScroll - > SetTag ( " JitCompareRightDisasm " ) ;
2013-09-29 11:39:25 +00:00
LinearLayout * rightColumn = rightColumnScroll - > Add ( new LinearLayout ( ORIENT_VERTICAL ) ) ;
rightDisasm_ = rightColumn - > Add ( new LinearLayout ( ORIENT_VERTICAL ) ) ;
rightDisasm_ - > SetSpacing ( 0.0f ) ;
2015-06-30 03:28:31 +00:00
leftColumn - > Add ( new Choice ( dev - > T ( " Current " ) ) ) - > OnClick . Handle ( this , & JitCompareScreen : : OnCurrentBlock ) ;
leftColumn - > Add ( new Choice ( dev - > T ( " By Address " ) ) ) - > OnClick . Handle ( this , & JitCompareScreen : : OnSelectBlock ) ;
leftColumn - > Add ( new Choice ( dev - > T ( " Prev " ) ) ) - > OnClick . Handle ( this , & JitCompareScreen : : OnPrevBlock ) ;
leftColumn - > Add ( new Choice ( dev - > T ( " Next " ) ) ) - > OnClick . Handle ( this , & JitCompareScreen : : OnNextBlock ) ;
leftColumn - > Add ( new Choice ( dev - > T ( " Random " ) ) ) - > OnClick . Handle ( this , & JitCompareScreen : : OnRandomBlock ) ;
leftColumn - > Add ( new Choice ( dev - > T ( " FPU " ) ) ) - > OnClick . Handle ( this , & JitCompareScreen : : OnRandomFPUBlock ) ;
leftColumn - > Add ( new Choice ( dev - > T ( " VFPU " ) ) ) - > OnClick . Handle ( this , & JitCompareScreen : : OnRandomVFPUBlock ) ;
leftColumn - > Add ( new Choice ( dev - > T ( " Stats " ) ) ) - > OnClick . Handle ( this , & JitCompareScreen : : OnShowStats ) ;
2015-07-01 21:26:55 +00:00
leftColumn - > Add ( new Choice ( di - > T ( " Back " ) ) ) - > OnClick . Handle < UIScreen > ( this , & UIScreen : : OnBack ) ;
2015-06-30 03:28:31 +00:00
blockName_ = leftColumn - > Add ( new TextView ( dev - > T ( " No block " ) ) ) ;
2021-02-22 00:38:02 +00:00
blockAddr_ = leftColumn - > Add ( new TextEdit ( " " , dev - > T ( " Block address " ) , " " , new LayoutParams ( FILL_PARENT , WRAP_CONTENT ) ) ) ;
2014-11-16 15:45:24 +00:00
blockAddr_ - > OnTextChange . Handle ( this , & JitCompareScreen : : OnAddressChange ) ;
blockStats_ = leftColumn - > Add ( new TextView ( " " ) ) ;
2014-10-12 16:44:16 +00:00
2017-03-22 01:34:52 +00:00
EventParams ignore { } ;
2014-10-12 16:44:16 +00:00
OnCurrentBlock ( ignore ) ;
2013-09-29 11:39:25 +00:00
}
void JitCompareScreen : : UpdateDisasm ( ) {
leftDisasm_ - > Clear ( ) ;
rightDisasm_ - > Clear ( ) ;
using namespace UI ;
2023-04-05 22:34:50 +00:00
auto dev = GetI18NCategory ( I18NCat : : DEVELOPER ) ;
2014-12-10 22:01:09 +00:00
2018-01-04 11:22:49 +00:00
JitBlockCacheDebugInterface * blockCacheDebug = MIPSComp : : jit - > GetBlockCacheDebugInterface ( ) ;
2014-11-16 15:45:24 +00:00
char temp [ 256 ] ;
2018-01-04 11:22:49 +00:00
snprintf ( temp , sizeof ( temp ) , " %i/%i " , currentBlock_ , blockCacheDebug - > GetNumBlocks ( ) ) ;
2014-11-16 15:45:24 +00:00
blockName_ - > SetText ( temp ) ;
2023-07-17 01:51:20 +00:00
if ( currentBlock_ < 0 | | ! blockCacheDebug | | currentBlock_ > = blockCacheDebug - > GetNumBlocks ( ) ) {
2015-06-30 03:28:31 +00:00
leftDisasm_ - > Add ( new TextView ( dev - > T ( " No block " ) ) ) ;
rightDisasm_ - > Add ( new TextView ( dev - > T ( " No block " ) ) ) ;
2014-11-16 15:45:24 +00:00
blockStats_ - > SetText ( " " ) ;
2013-09-29 11:39:25 +00:00
return ;
}
2018-01-04 11:22:49 +00:00
JitBlockDebugInfo debugInfo = blockCacheDebug - > GetBlockDebugInfo ( currentBlock_ ) ;
2013-09-29 11:39:25 +00:00
2018-01-04 11:22:49 +00:00
snprintf ( temp , sizeof ( temp ) , " %08x " , debugInfo . originalAddress ) ;
2014-11-16 15:45:24 +00:00
blockAddr_ - > SetText ( temp ) ;
2013-09-30 08:10:34 +00:00
2013-09-29 11:39:25 +00:00
// Alright. First generate the MIPS disassembly.
2013-11-11 03:38:42 +00:00
// TODO: Need a way to communicate branch continuing.
2018-01-04 11:22:49 +00:00
for ( auto line : debugInfo . origDisasm ) {
leftDisasm_ - > Add ( new TextView ( line ) ) - > SetFocusable ( true ) ;
}
// TODO : When we have both target and IR, need a third column.
if ( debugInfo . targetDisasm . size ( ) ) {
for ( auto line : debugInfo . targetDisasm ) {
rightDisasm_ - > Add ( new TextView ( line ) ) - > SetFocusable ( true ) ;
}
} else {
for ( auto line : debugInfo . irDisasm ) {
rightDisasm_ - > Add ( new TextView ( line ) ) - > SetFocusable ( true ) ;
}
2014-10-11 16:06:52 +00:00
}
2014-11-16 15:45:24 +00:00
int numMips = leftDisasm_ - > GetNumSubviews ( ) ;
int numHost = rightDisasm_ - > GetNumSubviews ( ) ;
snprintf ( temp , sizeof ( temp ) , " %d to %d : %d%% " , numMips , numHost , 100 * numHost / numMips ) ;
blockStats_ - > SetText ( temp ) ;
}
UI : : EventReturn JitCompareScreen : : OnAddressChange ( UI : : EventParams & e ) {
2021-11-28 00:11:51 +00:00
std : : lock_guard < std : : recursive_mutex > guard ( MIPSComp : : jitLock ) ;
2015-03-07 16:58:15 +00:00
if ( ! MIPSComp : : jit ) {
return UI : : EVENT_DONE ;
}
2018-01-05 07:10:49 +00:00
JitBlockCacheDebugInterface * blockCache = MIPSComp : : jit - > GetBlockCacheDebugInterface ( ) ;
2016-05-08 19:56:52 +00:00
if ( ! blockCache )
return UI : : EVENT_DONE ;
2014-11-16 15:45:24 +00:00
u32 addr ;
if ( blockAddr_ - > GetText ( ) . size ( ) > 8 )
return UI : : EVENT_DONE ;
if ( 1 = = sscanf ( blockAddr_ - > GetText ( ) . c_str ( ) , " %08x " , & addr ) ) {
if ( Memory : : IsValidAddress ( addr ) ) {
currentBlock_ = blockCache - > GetBlockNumberFromStartAddress ( addr ) ;
UpdateDisasm ( ) ;
}
}
return UI : : EVENT_DONE ;
2013-09-29 11:39:25 +00:00
}
2014-11-24 20:57:27 +00:00
UI : : EventReturn JitCompareScreen : : OnShowStats ( UI : : EventParams & e ) {
2021-11-28 00:11:51 +00:00
std : : lock_guard < std : : recursive_mutex > guard ( MIPSComp : : jitLock ) ;
2017-01-25 18:11:33 +00:00
if ( ! MIPSComp : : jit ) {
return UI : : EVENT_DONE ;
}
2018-01-04 11:22:49 +00:00
JitBlockCacheDebugInterface * blockCache = MIPSComp : : jit - > GetBlockCacheDebugInterface ( ) ;
2023-07-17 01:51:20 +00:00
if ( ! blockCache )
return UI : : EVENT_DONE ;
2014-11-24 20:57:27 +00:00
BlockCacheStats bcStats ;
blockCache - > ComputeStats ( bcStats ) ;
NOTICE_LOG ( JIT , " Num blocks: %i " , bcStats . numBlocks ) ;
NOTICE_LOG ( JIT , " Average Bloat: %0.2f%% " , 100 * bcStats . avgBloat ) ;
NOTICE_LOG ( JIT , " Min Bloat: %0.2f%% (%08x) " , 100 * bcStats . minBloat , bcStats . minBloatBlock ) ;
NOTICE_LOG ( JIT , " Max Bloat: %0.2f%% (%08x) " , 100 * bcStats . maxBloat , bcStats . maxBloatBlock ) ;
int ctr = 0 , sz = ( int ) bcStats . bloatMap . size ( ) ;
for ( auto iter : bcStats . bloatMap ) {
if ( ctr < 10 | | ctr > sz - 10 ) {
NOTICE_LOG ( JIT , " %08x: %f " , iter . second , iter . first ) ;
} else if ( ctr = = 10 ) {
NOTICE_LOG ( JIT , " ... " ) ;
}
ctr + + ;
}
return UI : : EVENT_DONE ;
}
2013-11-29 06:35:03 +00:00
UI : : EventReturn JitCompareScreen : : OnSelectBlock ( 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 addressPrompt = new AddressPromptScreen ( dev - > T ( " Block address " ) ) ;
2013-11-29 06:35:03 +00:00
addressPrompt - > OnChoice . Handle ( this , & JitCompareScreen : : OnBlockAddress ) ;
screenManager ( ) - > push ( addressPrompt ) ;
return UI : : EVENT_DONE ;
}
2014-11-16 15:45:24 +00:00
UI : : EventReturn JitCompareScreen : : OnPrevBlock ( UI : : EventParams & e ) {
currentBlock_ - - ;
UpdateDisasm ( ) ;
return UI : : EVENT_DONE ;
}
UI : : EventReturn JitCompareScreen : : OnNextBlock ( UI : : EventParams & e ) {
currentBlock_ + + ;
UpdateDisasm ( ) ;
return UI : : EVENT_DONE ;
}
2013-11-29 06:35:03 +00:00
UI : : EventReturn JitCompareScreen : : OnBlockAddress ( UI : : EventParams & e ) {
2021-11-28 00:11:51 +00:00
std : : lock_guard < std : : recursive_mutex > guard ( MIPSComp : : jitLock ) ;
2015-03-07 16:58:15 +00:00
if ( ! MIPSComp : : jit ) {
return UI : : EVENT_DONE ;
}
2018-01-05 07:10:49 +00:00
JitBlockCacheDebugInterface * blockCache = MIPSComp : : jit - > GetBlockCacheDebugInterface ( ) ;
2016-05-08 19:56:52 +00:00
if ( ! blockCache )
return UI : : EVENT_DONE ;
2013-11-29 06:35:03 +00:00
if ( Memory : : IsValidAddress ( e . a ) ) {
currentBlock_ = blockCache - > GetBlockNumberFromStartAddress ( e . a ) ;
} else {
currentBlock_ = - 1 ;
}
UpdateDisasm ( ) ;
return UI : : EVENT_DONE ;
}
2013-09-29 11:39:25 +00:00
UI : : EventReturn JitCompareScreen : : OnRandomBlock ( UI : : EventParams & e ) {
2021-11-28 00:11:51 +00:00
std : : lock_guard < std : : recursive_mutex > guard ( MIPSComp : : jitLock ) ;
2015-03-07 16:58:15 +00:00
if ( ! MIPSComp : : jit ) {
return UI : : EVENT_DONE ;
}
2018-01-04 11:22:49 +00:00
JitBlockCacheDebugInterface * blockCache = MIPSComp : : jit - > GetBlockCacheDebugInterface ( ) ;
2016-05-08 19:56:52 +00:00
if ( ! blockCache )
return UI : : EVENT_DONE ;
2013-09-29 11:39:25 +00:00
int numBlocks = blockCache - > GetNumBlocks ( ) ;
if ( numBlocks > 0 ) {
currentBlock_ = rand ( ) % numBlocks ;
}
UpdateDisasm ( ) ;
return UI : : EVENT_DONE ;
}
2013-11-07 12:37:19 +00:00
UI : : EventReturn JitCompareScreen : : OnRandomVFPUBlock ( UI : : EventParams & e ) {
2015-03-16 23:54:56 +00:00
OnRandomBlock ( IS_VFPU ) ;
return UI : : EVENT_DONE ;
}
UI : : EventReturn JitCompareScreen : : OnRandomFPUBlock ( UI : : EventParams & e ) {
OnRandomBlock ( IS_FPU ) ;
return UI : : EVENT_DONE ;
}
void JitCompareScreen : : OnRandomBlock ( int flag ) {
2021-11-28 00:11:51 +00:00
std : : lock_guard < std : : recursive_mutex > guard ( MIPSComp : : jitLock ) ;
2015-03-07 16:58:15 +00:00
if ( ! MIPSComp : : jit ) {
2015-03-16 23:54:56 +00:00
return ;
2015-03-07 16:58:15 +00:00
}
2018-01-05 07:10:49 +00:00
JitBlockCacheDebugInterface * blockCache = MIPSComp : : jit - > GetBlockCacheDebugInterface ( ) ;
2016-05-08 19:56:52 +00:00
if ( ! blockCache )
return ;
2013-11-07 12:37:19 +00:00
int numBlocks = blockCache - > GetNumBlocks ( ) ;
if ( numBlocks > 0 ) {
2015-03-16 23:54:56 +00:00
bool anyWanted = false ;
2013-11-07 12:37:19 +00:00
int tries = 0 ;
2018-01-05 07:10:49 +00:00
while ( ! anyWanted & & tries < numBlocks ) {
2013-11-07 12:37:19 +00:00
currentBlock_ = rand ( ) % numBlocks ;
2018-01-05 07:10:49 +00:00
JitBlockDebugInfo b = blockCache - > GetBlockDebugInfo ( currentBlock_ ) ;
u32 mipsBytes = ( u32 ) b . origDisasm . size ( ) * 4 ;
2023-08-12 16:50:46 +00:00
for ( u32 addr = b . originalAddress ; addr < b . originalAddress + mipsBytes ; addr + = 4 ) {
2013-11-07 12:37:19 +00:00
MIPSOpcode opcode = Memory : : Read_Instruction ( addr ) ;
2015-03-16 23:54:56 +00:00
if ( MIPSGetInfo ( opcode ) & flag ) {
2013-11-07 12:37:19 +00:00
char temp [ 256 ] ;
2023-04-29 16:07:25 +00:00
MIPSDisAsm ( opcode , addr , temp , sizeof ( temp ) ) ;
2018-01-05 07:10:49 +00:00
// INFO_LOG(HLE, "Stopping at random instruction: %08x %s", addr, temp);
2015-03-16 23:54:56 +00:00
anyWanted = true ;
2013-11-07 12:37:19 +00:00
break ;
}
}
tries + + ;
}
2018-01-05 07:10:49 +00:00
if ( ! anyWanted )
currentBlock_ = - 1 ;
2013-11-07 12:37:19 +00:00
}
UpdateDisasm ( ) ;
}
2013-09-29 11:39:25 +00:00
UI : : EventReturn JitCompareScreen : : OnCurrentBlock ( UI : : EventParams & e ) {
2021-11-28 00:11:51 +00:00
std : : lock_guard < std : : recursive_mutex > guard ( MIPSComp : : jitLock ) ;
2015-03-07 16:58:15 +00:00
if ( ! MIPSComp : : jit ) {
return UI : : EVENT_DONE ;
}
2013-09-29 11:39:25 +00:00
JitBlockCache * blockCache = MIPSComp : : jit - > GetBlockCache ( ) ;
2016-05-08 19:56:52 +00:00
if ( ! blockCache )
return UI : : EVENT_DONE ;
2022-12-21 04:26:41 +00:00
currentBlock_ = blockCache - > GetBlockNumberFromAddress ( currentMIPS - > pc ) ;
2013-09-29 11:39:25 +00:00
UpdateDisasm ( ) ;
return UI : : EVENT_DONE ;
2013-09-29 17:59:55 +00:00
}
2015-05-13 20:28:02 +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
2015-10-14 15:45:21 +00:00
for ( 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
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 ) ;
tabHolder - > AddTab ( " Dumps " , dumps ) ;
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 ( ) ;
INFO_LOG ( COMMON , " Trying to launch '%s' " , url . c_str ( ) ) ;
// 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 " ) ) {
INFO_LOG ( COMMON , " Found ppdmp: '%s' " , trimmed . c_str ( ) ) ;
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
}