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/.
2013-10-03 20:13:16 +00:00
# include <algorithm>
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
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"
2020-10-04 21:24:14 +00:00
# include "Common/GPU/OpenGL/GLFeatures.h"
2020-10-01 11:05:04 +00:00
# include "Common/Data/Text/I18n.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"
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"
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
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
# if PPSSPP_PLATFORM(ANDROID)
# include "android/jni/app-android.h"
# endif
2013-10-17 16:23:57 +00:00
static const char * logLevelList [ ] = {
" Notice " ,
" Error " ,
" Warn " ,
" Info " ,
" Debug " ,
" Verb. "
} ;
2013-09-07 18:54:11 +00:00
void DevMenu : : CreatePopupContents ( UI : : ViewGroup * parent ) {
using namespace UI ;
2020-01-26 18:43:18 +00:00
auto dev = GetI18NCategory ( " Developer " ) ;
auto sy = GetI18NCategory ( " 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)
2015-12-23 04:46:31 +00:00
items - > Add ( new Choice ( dev - > T ( " Log View " ) ) ) - > OnClick . Handle ( this , & DevMenu : : OnLogView ) ;
2015-01-05 00:23:03 +00:00
# endif
2015-12-23 04:46:31 +00:00
items - > Add ( new Choice ( dev - > T ( " Logging Channels " ) ) ) - > OnClick . Handle ( this , & DevMenu : : OnLogConfig ) ;
items - > Add ( new Choice ( sy - > T ( " Developer Tools " ) ) ) - > OnClick . Handle ( this , & DevMenu : : OnDeveloperTools ) ;
items - > Add ( new Choice ( dev - > T ( " Jit Compare " ) ) ) - > OnClick . Handle ( this , & DevMenu : : OnJitCompare ) ;
items - > Add ( new Choice ( dev - > T ( " Shader Viewer " ) ) ) - > OnClick . Handle ( this , & DevMenu : : OnShaderView ) ;
2019-08-20 22:03:00 +00:00
if ( g_Config . iGPUBackend = = ( int ) GPUBackend : : VULKAN ) {
items - > Add ( new CheckBox ( & g_Config . bShowAllocatorDebug , dev - > T ( " Allocator Viewer " ) ) ) ;
items - > Add ( new CheckBox ( & g_Config . bShowGpuProfile , dev - > T ( " GPU Profile " ) ) ) ;
}
2015-12-23 04:46:31 +00:00
items - > Add ( new Choice ( dev - > T ( " Toggle Freeze " ) ) ) - > OnClick . Handle ( this , & DevMenu : : OnFreezeFrame ) ;
items - > Add ( new Choice ( dev - > T ( " Dump Frame GPU Commands " ) ) ) - > OnClick . Handle ( this , & DevMenu : : OnDumpFrame ) ;
items - > Add ( new Choice ( dev - > T ( " Toggle Audio Debug " ) ) ) - > OnClick . Handle ( this , & DevMenu : : OnToggleAudioDebug ) ;
2015-05-13 20:28:02 +00:00
# ifdef USE_PROFILER
2015-12-23 04:46:31 +00:00
items - > Add ( new CheckBox ( & g_Config . bShowFrameProfiler , dev - > T ( " Frame Profiler " ) , " " ) ) ;
2015-05-13 20:28:02 +00:00
# endif
2020-02-11 07:19:30 +00:00
items - > Add ( new CheckBox ( & g_Config . bDrawFrameGraph , dev - > T ( " Draw Frametimes Graph " ) ) ) ;
2020-10-10 13:09:32 +00:00
items - > Add ( new Choice ( dev - > T ( " Reset limited logging " ) ) ) - > OnClick . Handle ( this , & DevMenu : : OnResetLimitedLogging ) ;
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
}
}
2015-01-29 11:55:49 +00:00
UI : : EventReturn DevMenu : : OnToggleAudioDebug ( UI : : EventParams & e ) {
g_Config . bShowAudioDebug = ! g_Config . bShowAudioDebug ;
return UI : : EVENT_DONE ;
}
2020-10-10 13:09:32 +00:00
UI : : EventReturn DevMenu : : OnResetLimitedLogging ( UI : : EventParams & e ) {
Reporting : : ResetCounts ( ) ;
return UI : : EVENT_DONE ;
}
2015-01-29 11:55:49 +00:00
2015-01-05 00:23:03 +00:00
UI : : EventReturn DevMenu : : OnLogView ( UI : : EventParams & e ) {
UpdateUIState ( UISTATE_PAUSEMENU ) ;
screenManager ( ) - > push ( new LogScreen ( ) ) ;
return UI : : EVENT_DONE ;
2013-09-07 18:54:11 +00:00
}
UI : : EventReturn DevMenu : : 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 ;
}
UI : : EventReturn DevMenu : : OnDeveloperTools ( 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 DeveloperToolsScreen ( ) ) ;
return UI : : EVENT_DONE ;
}
2013-09-29 11:39:25 +00:00
UI : : EventReturn DevMenu : : 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 ;
}
2015-10-14 15:45:21 +00:00
UI : : EventReturn DevMenu : : OnShaderView ( UI : : EventParams & e ) {
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 ;
}
2013-11-15 12:11:44 +00:00
UI : : EventReturn DevMenu : : OnFreezeFrame ( UI : : EventParams & e ) {
if ( PSP_CoreParameter ( ) . frozen ) {
PSP_CoreParameter ( ) . frozen = false ;
} else {
PSP_CoreParameter ( ) . freezeNext = true ;
}
return UI : : EVENT_DONE ;
}
2013-11-15 15:49:13 +00:00
UI : : EventReturn DevMenu : : OnDumpFrame ( UI : : EventParams & e ) {
gpu - > DumpNextFrame ( ) ;
return UI : : EVENT_DONE ;
}
2013-09-07 20:02:55 +00:00
void DevMenu : : 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 ) ) {
case LogTypes : : LDEBUG : color = 0xE0E0E0 ; break ;
case LogTypes : : LWARNING : color = 0x50FFFF ; break ;
case LogTypes : : LERROR : color = 0x5050FF ; break ;
case LogTypes : : LNOTICE : color = 0x30FF30 ; break ;
case LogTypes : : LINFO : color = 0xFFFFFF ; break ;
2015-01-10 00:52:20 +00:00
case LogTypes : : 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 ;
2020-01-26 18:43:18 +00:00
auto di = GetI18NCategory ( " 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 ;
2020-01-26 18:43:18 +00:00
auto di = GetI18NCategory ( " Dialog " ) ;
auto dev = GetI18NCategory ( " 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 + + ) {
LogTypes : : LOG_TYPE type = ( LogTypes : : LOG_TYPE ) i ;
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 ) ) ) ;
row - > Add ( new PopupMultiChoice ( ( int * ) & chan - > level , chan - > m_shortName , logLevelList , 1 , 6 , 0 , 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 + + ) {
2017-03-06 12:50:22 +00:00
LogChannel * chan = logMan - > GetLogChannel ( ( LogTypes : : LOG_TYPE ) 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 + + ) {
LogChannel * chan = logMan - > GetLogChannel ( ( LogTypes : : LOG_TYPE ) 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 + + ) {
LogChannel * chan = logMan - > GetLogChannel ( ( LogTypes : : LOG_TYPE ) 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 ) {
2020-01-26 18:43:18 +00:00
auto dev = GetI18NCategory ( " 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 ) {
LogTypes : : LOG_TYPE type = ( LogTypes : : LOG_TYPE ) i ;
LogChannel * chan = logMan - > GetLogChannel ( type ) ;
2017-03-18 09:47:10 +00:00
if ( chan - > enabled )
chan - > level = ( LogTypes : : LOG_LEVELS ) ( 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 ;
2020-01-26 18:43:18 +00:00
auto di = GetI18NCategory ( " Dialog " ) ;
auto dev = GetI18NCategory ( " 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 " ;
# else
return " other " ;
# endif
}
2013-09-07 11:38:37 +00:00
void SystemInfoScreen : : CreateViews ( ) {
2016-12-25 17:18:19 +00:00
using namespace Draw ;
2016-12-26 16:03:01 +00:00
using namespace UI ;
2013-09-07 11:38:37 +00:00
// NOTE: Do not translate this section. It will change a lot and will be impossible to keep up.
2020-01-26 18:43:18 +00:00
auto di = GetI18NCategory ( " Dialog " ) ;
auto si = GetI18NCategory ( " SysInfo " ) ;
auto gr = GetI18NCategory ( " Graphics " ) ;
2013-10-11 23:20:10 +00:00
root_ = new AnchorLayout ( new LayoutParams ( FILL_PARENT , FILL_PARENT ) ) ;
ViewGroup * leftColumn = new AnchorLayout ( new LinearLayoutParams ( 1.0f ) ) ;
root_ - > Add ( leftColumn ) ;
2015-07-04 15:01:32 +00:00
AddStandardBack ( root_ ) ;
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
root_ - > Add ( tabHolder ) ;
ViewGroup * deviceSpecsScroll = new ScrollView ( ORIENT_VERTICAL , new LinearLayoutParams ( FILL_PARENT , FILL_PARENT ) ) ;
2016-01-23 06:52:13 +00:00
deviceSpecsScroll - > SetTag ( " DevSystemInfoDeviceSpecs " ) ;
2021-02-22 02:41:08 +00:00
LinearLayout * deviceSpecs = new LinearLayoutList ( ORIENT_VERTICAL ) ;
2013-10-11 23:20:10 +00:00
deviceSpecs - > SetSpacing ( 0 ) ;
deviceSpecsScroll - > Add ( deviceSpecs ) ;
2017-12-10 18:57:57 +00:00
tabHolder - > AddTab ( si - > T ( " Device Info " ) , deviceSpecsScroll ) ;
2013-10-11 23:20:10 +00:00
2017-12-10 18:57:57 +00:00
deviceSpecs - > Add ( new ItemHeader ( si - > T ( " System Information " ) ) ) ;
deviceSpecs - > Add ( new InfoItem ( si - > T ( " System Name " , " Name " ) , System_GetProperty ( SYSPROP_NAME ) ) ) ;
2019-09-02 22:05:18 +00:00
# if PPSSPP_PLATFORM(ANDROID)
deviceSpecs - > Add ( new InfoItem ( si - > T ( " System Version " ) , StringFromInt ( System_GetPropertyInt ( SYSPROP_SYSTEMVERSION ) ) ) ) ;
# endif
2017-12-10 18:57:57 +00:00
deviceSpecs - > 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 ( ) )
2017-12-10 18:57:57 +00:00
deviceSpecs - > Add ( new InfoItem ( si - > T ( " Board " ) , board ) ) ;
deviceSpecs - > Add ( new InfoItem ( si - > T ( " ABI " ) , GetCompilerABI ( ) ) ) ;
2017-05-21 15:24:40 +00:00
# ifdef _WIN32
if ( IsDebuggerPresent ( ) ) {
2018-01-09 23:38:16 +00:00
deviceSpecs - > Add ( new InfoItem ( si - > T ( " Debugger Present " ) , di - > T ( " Yes " ) ) ) ;
2017-05-21 15:24:40 +00:00
}
# endif
2017-12-10 18:57:57 +00:00
deviceSpecs - > Add ( new ItemHeader ( si - > T ( " CPU Information " ) ) ) ;
deviceSpecs - > Add ( new InfoItem ( si - > T ( " CPU Name " , " Name " ) , cpu_info . brand_string ) ) ;
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 ) ;
deviceSpecs - > Add ( new InfoItem ( si - > T ( " Threads " ) , cores ) ) ;
2021-02-22 08:31:18 +00:00
# if PPSSPP_PLATFORM(IOS)
2021-02-21 21:02:11 +00:00
deviceSpecs - > 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
2017-12-10 18:57:57 +00:00
deviceSpecs - > Add ( new ItemHeader ( 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 ) ;
2017-12-10 18:57:57 +00:00
deviceSpecs - > Add ( new InfoItem ( si - > T ( " 3D API " ) , apiName ) ) ;
deviceSpecs - > Add ( new InfoItem ( si - > T ( " Vendor " ) , draw - > GetInfoString ( InfoField : : VENDORSTRING ) ) ) ;
2017-03-16 08:48:10 +00:00
std : : string vendor = draw - > GetInfoString ( InfoField : : VENDOR ) ;
if ( vendor . size ( ) )
2017-12-10 18:57:57 +00:00
deviceSpecs - > Add ( new InfoItem ( si - > T ( " Vendor (detected) " ) , vendor ) ) ;
deviceSpecs - > 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 )
2017-12-10 18:57:57 +00:00
deviceSpecs - > 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 ) {
2019-05-12 03:15:45 +00:00
deviceSpecs - > 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 ) {
2018-01-10 07:57:41 +00:00
deviceSpecs - > 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 ) ;
deviceSpecs - > Add ( new InfoItem ( si - > T ( " High precision int range " ) , temp ) ) ;
}
if ( highp_float_max ! = 0 ) {
char temp [ 512 ] ;
snprintf ( temp , sizeof ( temp ) , " Highp float range: %d-%d " , highp_int_min , highp_int_max ) ;
deviceSpecs - > 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
}
2017-12-10 18:57:57 +00:00
deviceSpecs - > Add ( new ItemHeader ( si - > T ( " OS Information " ) ) ) ;
deviceSpecs - > Add ( new InfoItem ( si - > T ( " Memory Page Size " ) , StringFromFormat ( si - > T ( " %d bytes " ) , GetMemoryProtectPageSize ( ) ) ) ) ;
2018-01-10 07:57:41 +00:00
deviceSpecs - > 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)
2018-01-09 23:38:16 +00:00
deviceSpecs - > 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
2017-12-10 18:57:57 +00:00
deviceSpecs - > Add ( new InfoItem ( si - > T ( " PPSSPP build " ) , build ) ) ;
2017-02-28 00:47:13 +00:00
2017-12-10 18:57:57 +00:00
deviceSpecs - > Add ( new ItemHeader ( si - > T ( " Audio Information " ) ) ) ;
deviceSpecs - > Add ( new InfoItem ( si - > T ( " Sample rate " ) , StringFromFormat ( " %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 ) {
deviceSpecs - > Add ( new InfoItem ( si - > T ( " Frames per buffer " ) , StringFromFormat ( " %d " , framesPerBuffer ) ) ) ;
}
2020-05-16 15:46:21 +00:00
# if PPSSPP_PLATFORM(ANDROID)
2017-12-10 18:57:57 +00:00
deviceSpecs - > Add ( new InfoItem ( si - > T ( " Optimal sample rate " ) , StringFromFormat ( " %d Hz " , System_GetPropertyInt ( SYSPROP_AUDIO_OPTIMAL_SAMPLE_RATE ) ) ) ) ;
deviceSpecs - > 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
deviceSpecs - > Add ( new ItemHeader ( si - > T ( " Display Information " ) ) ) ;
2020-05-16 15:46:21 +00:00
# if PPSSPP_PLATFORM(ANDROID)
2017-12-10 18:57:57 +00:00
deviceSpecs - > 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 ) ) ) ) ;
2020-02-16 01:47:10 +00:00
# endif
# if !PPSSPP_PLATFORM(WINDOWS)
// Don't show on Windows, since it's always treated as 60 there.
2020-02-16 01:40:15 +00:00
deviceSpecs - > Add ( new InfoItem ( si - > T ( " Refresh rate " ) , StringFromFormat ( " %0.3f Hz " , ( float ) System_GetPropertyFloat ( SYSPROP_DISPLAY_REFRESH_RATE ) ) ) ) ;
2015-01-11 10:40:53 +00:00
# endif
2017-12-10 18:57:57 +00:00
deviceSpecs - > Add ( new ItemHeader ( 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 ) ;
}
2017-12-10 18:57:57 +00:00
deviceSpecs - > Add ( new InfoItem ( si - > T ( " API Version " ) , apiVersion ) ) ;
deviceSpecs - > 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
}
deviceSpecs - > Add ( new InfoItem ( " Moga " , moga ) ) ;
# endif
2021-02-27 10:49:38 +00:00
ViewGroup * storageScroll = new ScrollView ( ORIENT_VERTICAL , new LinearLayoutParams ( FILL_PARENT , FILL_PARENT ) ) ;
storageScroll - > SetTag ( " DevSystemInfoBuildConfig " ) ;
LinearLayout * storage = new LinearLayout ( ORIENT_VERTICAL ) ;
storage - > SetSpacing ( 0 ) ;
storageScroll - > Add ( storage ) ;
tabHolder - > AddTab ( si - > T ( " Storage " ) , storageScroll ) ;
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-02-27 12:48:07 +00:00
if ( System_GetPropertyBool ( SYSPROP_ANDROID_SCOPED_STORAGE ) ) {
storage - > Add ( new InfoItem ( " Scoped Storage " , di - > T ( " Yes " ) ) ) ;
}
2021-02-27 10:49:38 +00:00
# endif
2017-03-16 11:33:23 +00:00
ViewGroup * buildConfigScroll = new ScrollView ( ORIENT_VERTICAL , new LinearLayoutParams ( FILL_PARENT , FILL_PARENT ) ) ;
buildConfigScroll - > SetTag ( " DevSystemInfoBuildConfig " ) ;
2021-02-22 02:41:08 +00:00
LinearLayout * buildConfig = new LinearLayoutList ( ORIENT_VERTICAL ) ;
2017-03-16 11:33:23 +00:00
buildConfig - > SetSpacing ( 0 ) ;
buildConfigScroll - > Add ( buildConfig ) ;
2017-12-10 18:57:57 +00:00
tabHolder - > AddTab ( si - > T ( " Build Config " ) , buildConfigScroll ) ;
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
2013-11-14 15:17:22 +00:00
ViewGroup * cpuExtensionsScroll = new ScrollView ( ORIENT_VERTICAL , new LinearLayoutParams ( FILL_PARENT , FILL_PARENT ) ) ;
2016-01-23 06:52:13 +00:00
cpuExtensionsScroll - > SetTag ( " DevSystemInfoCPUExt " ) ;
2021-02-22 02:41:08 +00:00
LinearLayout * cpuExtensions = new LinearLayoutList ( ORIENT_VERTICAL ) ;
2013-11-14 15:17:22 +00:00
cpuExtensions - > SetSpacing ( 0 ) ;
cpuExtensionsScroll - > Add ( cpuExtensions ) ;
2017-12-10 18:57:57 +00:00
tabHolder - > AddTab ( si - > T ( " CPU Extensions " ) , cpuExtensionsScroll ) ;
2013-11-14 15:17:22 +00:00
2017-12-10 18:57:57 +00:00
cpuExtensions - > Add ( new ItemHeader ( si - > T ( " CPU Extensions " ) ) ) ;
2013-11-14 15:17:22 +00:00
std : : vector < std : : string > exts ;
SplitString ( cpu_info . Summarize ( ) , ' , ' , exts ) ;
for ( size_t i = 2 ; i < exts . size ( ) ; i + + ) {
2017-12-10 08:02:41 +00:00
cpuExtensions - > Add ( new TextView ( exts [ i ] , new LayoutParams ( FILL_PARENT , WRAP_CONTENT ) ) ) - > SetFocusable ( true ) ;
2013-11-14 15:17:22 +00:00
}
2015-07-21 18:48:10 +00:00
2017-08-28 11:45:04 +00:00
ViewGroup * gpuExtensionsScroll = new ScrollView ( ORIENT_VERTICAL , new LinearLayoutParams ( FILL_PARENT , FILL_PARENT ) ) ;
gpuExtensionsScroll - > SetTag ( " DevSystemInfoOGLExt " ) ;
2021-02-22 02:41:08 +00:00
LinearLayout * gpuExtensions = new LinearLayoutList ( ORIENT_VERTICAL ) ;
2017-08-28 11:45:04 +00:00
gpuExtensions - > SetSpacing ( 0 ) ;
gpuExtensionsScroll - > Add ( gpuExtensions ) ;
2013-10-11 23:20:10 +00:00
2017-12-26 23:55:24 +00:00
if ( GetGPUBackend ( ) = = GPUBackend : : OPENGL ) {
2017-12-10 18:57:57 +00:00
tabHolder - > AddTab ( si - > T ( " OGL Extensions " ) , gpuExtensionsScroll ) ;
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 ) {
2017-12-10 18:57:57 +00:00
tabHolder - > AddTab ( si - > T ( " Vulkan Features " ) , gpuExtensionsScroll ) ;
2016-01-03 13:00:05 +00:00
2017-12-10 18:57:57 +00:00
gpuExtensions - > Add ( new ItemHeader ( 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 ) {
2017-12-10 08:02:41 +00:00
gpuExtensions - > Add ( new TextView ( feature , new LayoutParams ( FILL_PARENT , WRAP_CONTENT ) ) ) - > SetFocusable ( true ) ;
2017-08-28 11:45:04 +00:00
}
2017-12-10 18:57:57 +00:00
gpuExtensions - > Add ( new ItemHeader ( si - > T ( " Vulkan Extensions " ) ) ) ;
2017-08-28 11:45:04 +00:00
std : : vector < std : : string > extensions = draw - > GetExtensionList ( ) ;
for ( auto & extension : extensions ) {
2017-12-10 08:02:41 +00:00
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
}
}
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 ;
2020-01-26 18:43:18 +00:00
auto dev = GetI18NCategory ( " 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 ( ) {
2020-01-26 18:43:18 +00:00
auto dev = GetI18NCategory ( " 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 ( ) {
2020-01-26 18:43:18 +00:00
auto di = GetI18NCategory ( " Dialog " ) ;
auto dev = GetI18NCategory ( " 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 ;
2020-01-26 18:43:18 +00:00
auto dev = GetI18NCategory ( " 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 ) ;
2018-01-04 11:22:49 +00:00
if ( currentBlock_ < 0 | | 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 ) {
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 ) {
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 ( ) ;
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 ) {
2020-01-26 18:43:18 +00:00
auto dev = GetI18NCategory ( " 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 ) {
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 ) {
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 ) {
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 ;
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 ] ;
MIPSDisAsm ( opcode , addr , 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 ) {
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 ;
2013-09-29 11:39:25 +00:00
std : : vector < int > blockNum ;
blockCache - > GetBlockNumbersFromAddress ( currentMIPS - > pc , & blockNum ) ;
if ( blockNum . size ( ) > 0 ) {
currentBlock_ = blockNum [ 0 ] ;
} else {
currentBlock_ = - 1 ;
}
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 ;
2015-10-14 15:45:21 +00:00
for ( auto id : shaderIds_ ) {
Choice * choice = view - > Add ( new Choice ( gpu - > DebugGetShaderString ( id , shaderType , SHADER_STRING_SHORT_DESC ) ) ) ;
choice - > SetTag ( id ) ;
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 " } ,
// { SHADER_TYPE_GEOMETRY, "Geometry" },
{ SHADER_TYPE_VERTEXLOADER , " VertexLoader " } ,
2017-04-04 09:09:29 +00:00
{ SHADER_TYPE_PIPELINE , " Pipeline " } ,
{ SHADER_TYPE_DEPAL , " Depal " } ,
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
2020-01-26 18:43:18 +00:00
auto di = GetI18NCategory ( " 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
2020-01-26 18:43:18 +00:00
auto di = GetI18NCategory ( " 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
layout - > Add ( new TextView ( gpu - > DebugGetShaderString ( id_ , type_ , SHADER_STRING_SHORT_DESC ) ) ) ;
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 ) {
lineLayout - > Add ( new TextView ( line , FLAG_DYNAMIC_ASCII , 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 ) ) ;
auto di = GetI18NCategory ( " Dialog " ) ;
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-05-15 05:46:03 +00:00
listing_ = g_DownloadManager . StartDownload ( framedumpsBaseUrl , Path ( ) ) ;
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 ( ) ;
}
}