2013-09-05 16:45:41 +00:00
// Copyright (c) 2013- PPSSPP Project.
2013-06-08 20:42:31 +00:00
// 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/.
2014-02-10 11:38:23 +00:00
# include "base/display.h" // Only to check screen aspect ratio with pixel_yres/pixel_xres
2013-10-17 14:15:04 +00:00
# include "base/colorutil.h"
# include "base/timeutil.h"
# include "math/curves.h"
2014-01-20 05:14:21 +00:00
# include "gfx_es2/gpu_features.h"
2013-06-08 20:42:31 +00:00
# include "gfx_es2/draw_buffer.h"
# include "i18n/i18n.h"
# include "ui/view.h"
# include "ui/viewgroup.h"
2013-07-17 20:27:05 +00:00
# include "ui/ui_context.h"
2013-06-08 20:42:31 +00:00
# include "UI/EmuScreen.h"
# include "UI/GameSettingsScreen.h"
# include "UI/GameInfoCache.h"
2013-11-29 15:46:47 +00:00
# include "UI/GamepadEmu.h"
2013-07-17 20:27:05 +00:00
# include "UI/MiscScreens.h"
2013-08-16 14:48:43 +00:00
# include "UI/ControlMappingScreen.h"
2013-09-07 11:38:37 +00:00
# include "UI/DevScreens.h"
2015-06-12 18:37:42 +00:00
# include "UI/SavedataScreen.h"
2013-10-09 20:15:56 +00:00
# include "UI/TouchControlLayoutScreen.h"
2013-10-20 02:40:52 +00:00
# include "UI/TouchControlVisibilityScreen.h"
2013-10-27 17:58:47 +00:00
# include "UI/TiltAnalogSettingsScreen.h"
2013-12-14 12:55:57 +00:00
# include "UI/TiltEventProcessor.h"
2013-09-07 11:38:37 +00:00
2013-12-29 22:28:31 +00:00
# include "Common/KeyMap.h"
# include "Common/FileUtil.h"
2013-06-08 20:42:31 +00:00
# include "Core/Config.h"
2013-09-04 19:00:00 +00:00
# include "Core/Host.h"
2013-08-14 12:44:36 +00:00
# include "Core/System.h"
2013-09-01 19:57:39 +00:00
# include "Core/Reporting.h"
2013-10-17 14:15:04 +00:00
# include "android/jni/TestRunner.h"
# include "GPU/GPUInterface.h"
2013-12-21 08:20:46 +00:00
# include "GPU/GLES/Framebuffer.h"
2013-07-30 14:28:34 +00:00
2014-09-14 10:59:27 +00:00
# if defined(_WIN32)
# include "Windows/WndMainWindow.h"
2014-10-23 14:22:11 +00:00
# include <shlobj.h>
# include "util/text/utf8.h"
2014-10-27 18:57:40 +00:00
# include "Windows/W32Util/ShellUtil.h"
2015-02-01 10:56:44 +00:00
# include "Windows/W32Util/Misc.h"
2014-10-23 14:22:11 +00:00
using namespace std ;
2014-09-14 10:59:27 +00:00
# endif
2013-08-17 21:49:06 +00:00
# ifdef IOS
2013-12-01 19:28:20 +00:00
extern bool iosCanUseJit ;
2013-08-17 21:49:06 +00:00
# endif
2013-08-04 07:39:49 +00:00
2014-12-14 19:33:20 +00:00
GameSettingsScreen : : GameSettingsScreen ( std : : string gamePath , std : : string gameID , bool editThenRestore )
: UIDialogScreenWithGameBackground ( gamePath ) , gameID_ ( gameID ) , enableReports_ ( false ) , bEditThenRestore ( editThenRestore ) {
2014-07-22 08:37:20 +00:00
lastVertical_ = UseVerticalLayout ( ) ;
}
bool GameSettingsScreen : : UseVerticalLayout ( ) const {
return dp_yres > dp_xres * 1.1f ;
}
2013-06-08 20:42:31 +00:00
void GameSettingsScreen : : CreateViews ( ) {
2014-08-17 19:29:36 +00:00
GameInfo * info = g_gameInfoCache . GetInfo ( NULL , gamePath_ , GAMEINFO_WANTBG | GAMEINFO_WANTSIZE ) ;
2013-06-08 20:42:31 +00:00
2014-12-14 19:33:20 +00:00
if ( bEditThenRestore )
{
g_Config . loadGameConfig ( gameID_ ) ;
}
2013-07-17 23:04:11 +00:00
cap60FPS_ = g_Config . iForceMaxEmulatedFPS = = 60 ;
2013-10-28 15:04:53 +00:00
2014-05-06 03:49:48 +00:00
iAlternateSpeedPercent_ = ( g_Config . iFpsLimit * 100 ) / 60 ;
2014-06-10 21:32:37 +00:00
2014-07-22 08:37:20 +00:00
bool vertical = UseVerticalLayout ( ) ;
2013-06-08 20:42:31 +00:00
// Information in the top left.
// Back button to the bottom left.
// Scrolling action menu to the right.
using namespace UI ;
2013-09-03 08:42:26 +00:00
I18NCategory * d = GetI18NCategory ( " Dialog " ) ;
2013-06-08 20:42:31 +00:00
I18NCategory * gs = GetI18NCategory ( " Graphics " ) ;
2013-06-10 20:06:51 +00:00
I18NCategory * c = GetI18NCategory ( " Controls " ) ;
I18NCategory * a = GetI18NCategory ( " Audio " ) ;
2015-06-21 14:49:21 +00:00
I18NCategory * sa = GetI18NCategory ( " Savedata " ) ;
2013-06-10 20:06:51 +00:00
I18NCategory * s = GetI18NCategory ( " System " ) ;
2015-01-04 13:52:01 +00:00
I18NCategory * n = GetI18NCategory ( " Networking " ) ;
2013-08-11 15:25:50 +00:00
I18NCategory * ms = GetI18NCategory ( " MainSettings " ) ;
2013-09-04 11:59:19 +00:00
I18NCategory * dev = GetI18NCategory ( " Developer " ) ;
2013-06-08 20:42:31 +00:00
2014-07-22 08:37:20 +00:00
if ( vertical ) {
root_ = new LinearLayout ( ORIENT_VERTICAL , new LayoutParams ( FILL_PARENT , FILL_PARENT ) ) ;
} else {
root_ = new AnchorLayout ( new LayoutParams ( FILL_PARENT , FILL_PARENT ) ) ;
}
2013-07-21 16:03:54 +00:00
2014-07-22 08:37:20 +00:00
TabHolder * tabHolder ;
if ( vertical ) {
tabHolder = new TabHolder ( ORIENT_HORIZONTAL , 200 , new LinearLayoutParams ( 1.0f ) ) ;
root_ - > Add ( tabHolder ) ;
root_ - > Add ( new Choice ( d - > T ( " Back " ) , " " , false , new LinearLayoutParams ( 0.0f ) ) ) - > OnClick . Handle < UIScreen > ( this , & UIScreen : : OnBack ) ;
} else {
tabHolder = new TabHolder ( ORIENT_VERTICAL , 200 , new AnchorLayoutParams ( 10 , 0 , 10 , 0 , false ) ) ;
root_ - > Add ( tabHolder ) ;
root_ - > Add ( new Choice ( d - > T ( " Back " ) , " " , false , new AnchorLayoutParams ( 150 , 64 , 10 , NONE , NONE , 10 ) ) ) - > OnClick . Handle < UIScreen > ( this , & UIScreen : : OnBack ) ;
}
2014-03-03 11:56:01 +00:00
root_ - > SetDefaultFocusView ( tabHolder ) ;
2013-06-08 20:42:31 +00:00
// TODO: These currently point to global settings, not game specific ones.
2013-07-20 14:03:52 +00:00
// Graphics
2013-06-08 20:42:31 +00:00
ViewGroup * graphicsSettingsScroll = new ScrollView ( ORIENT_VERTICAL , new LinearLayoutParams ( FILL_PARENT , FILL_PARENT ) ) ;
2013-08-19 22:49:25 +00:00
LinearLayout * graphicsSettings = new LinearLayout ( ORIENT_VERTICAL ) ;
graphicsSettings - > SetSpacing ( 0 ) ;
2013-06-08 20:42:31 +00:00
graphicsSettingsScroll - > Add ( graphicsSettings ) ;
2013-08-11 15:25:50 +00:00
tabHolder - > AddTab ( ms - > T ( " Graphics " ) , graphicsSettingsScroll ) ;
2013-07-21 20:15:18 +00:00
graphicsSettings - > Add ( new ItemHeader ( gs - > T ( " Rendering Mode " ) ) ) ;
2014-09-14 10:59:27 +00:00
# if defined(_WIN32)
2014-09-14 11:30:49 +00:00
static const char * renderingBackend [ ] = { " OpenGL " , " Direct3D9 " } ;
2014-09-14 10:59:27 +00:00
PopupMultiChoice * renderingBackendChoice = graphicsSettings - > Add ( new PopupMultiChoice ( & g_Config . iTempGPUBackend , gs - > T ( " Backend " ) , renderingBackend , GPU_BACKEND_OPENGL , ARRAY_SIZE ( renderingBackend ) , gs , screenManager ( ) ) ) ;
renderingBackendChoice - > OnChoice . Handle ( this , & GameSettingsScreen : : OnRenderingBackend ) ;
# endif
2013-08-30 09:22:29 +00:00
static const char * renderingMode [ ] = { " Non-Buffered Rendering " , " Buffered Rendering " , " Read Framebuffers To Memory (CPU) " , " Read Framebuffers To Memory (GPU) " } ;
2014-06-10 21:28:13 +00:00
PopupMultiChoice * renderingModeChoice = graphicsSettings - > Add ( new PopupMultiChoice ( & g_Config . iRenderingMode , gs - > T ( " Mode " ) , renderingMode , 0 , ARRAY_SIZE ( renderingMode ) , gs , screenManager ( ) ) ) ;
renderingModeChoice - > OnChoice . Handle ( this , & GameSettingsScreen : : OnRenderingMode ) ;
2014-07-09 06:47:27 +00:00
renderingModeChoice - > SetDisabledPtr ( & g_Config . bSoftwareRendering ) ;
2014-06-10 21:28:13 +00:00
CheckBox * blockTransfer = graphicsSettings - > Add ( new CheckBox ( & g_Config . bBlockTransferGPU , gs - > T ( " Simulate Block Transfer " , " Simulate Block Transfer (unfinished) " ) ) ) ;
2014-07-09 06:47:27 +00:00
blockTransfer - > SetDisabledPtr ( & g_Config . bSoftwareRendering ) ;
2013-08-18 21:11:47 +00:00
2013-08-18 17:51:40 +00:00
graphicsSettings - > Add ( new ItemHeader ( gs - > T ( " Frame Rate Control " ) ) ) ;
2014-01-25 16:41:39 +00:00
static const char * frameSkip [ ] = { " Off " , " 1 " , " 2 " , " 3 " , " 4 " , " 5 " , " 6 " , " 7 " , " 8 " } ;
2014-07-22 07:55:12 +00:00
graphicsSettings - > Add ( new PopupMultiChoice ( & g_Config . iFrameSkip , gs - > T ( " Frame Skipping " ) , frameSkip , 0 , ARRAY_SIZE ( frameSkip ) , gs , screenManager ( ) ) ) ;
2014-02-11 17:32:26 +00:00
frameSkipAuto_ = graphicsSettings - > Add ( new CheckBox ( & g_Config . bAutoFrameSkip , gs - > T ( " Auto FrameSkip " ) ) ) ;
2014-07-22 07:55:12 +00:00
frameSkipAuto_ - > OnClick . Handle ( this , & GameSettingsScreen : : OnAutoFrameskip ) ;
2013-08-20 18:12:58 +00:00
graphicsSettings - > Add ( new CheckBox ( & cap60FPS_ , gs - > T ( " Force max 60 FPS (helps GoW) " ) ) ) ;
2014-05-03 20:24:46 +00:00
2014-05-06 03:49:48 +00:00
graphicsSettings - > Add ( new PopupSliderChoice ( & iAlternateSpeedPercent_ , 0 , 600 , gs - > T ( " Alternative Speed " , " Alternative Speed (in %, 0 = unlimited) " ) , 5 , screenManager ( ) ) ) ;
2013-09-30 09:57:30 +00:00
2013-07-17 20:27:05 +00:00
graphicsSettings - > Add ( new ItemHeader ( gs - > T ( " Features " ) ) ) ;
2014-07-21 16:42:52 +00:00
I18NCategory * ps = GetI18NCategory ( " PostShaders " ) ;
postProcChoice_ = graphicsSettings - > Add ( new ChoiceWithValueDisplay ( & g_Config . sPostShaderName , gs - > T ( " Postprocessing Shader " ) , ps ) ) ;
2013-10-30 10:28:14 +00:00
postProcChoice_ - > OnClick . Handle ( this , & GameSettingsScreen : : OnPostProcShader ) ;
2014-07-09 06:47:27 +00:00
postProcEnable_ = ! g_Config . bSoftwareRendering & & ( g_Config . iRenderingMode ! = FB_NON_BUFFERED_MODE ) ;
postProcChoice_ - > SetEnabledPtr ( & postProcEnable_ ) ;
2013-10-30 10:28:14 +00:00
2014-04-27 18:24:10 +00:00
# if !defined(MOBILE_DEVICE)
2013-10-20 15:33:18 +00:00
graphicsSettings - > Add ( new CheckBox ( & g_Config . bFullScreen , gs - > T ( " FullScreen " ) ) ) - > OnClick . Handle ( this , & GameSettingsScreen : : OnFullscreenChange ) ;
2013-10-04 19:31:40 +00:00
# endif
2013-06-08 20:42:31 +00:00
graphicsSettings - > Add ( new CheckBox ( & g_Config . bStretchToDisplay , gs - > T ( " Stretch to Display " ) ) ) ;
2014-01-15 23:17:41 +00:00
// Small Display: To avoid overlapping touch controls on large tablets. Better control over this will be coming later.
graphicsSettings - > Add ( new CheckBox ( & g_Config . bSmallDisplay , gs - > T ( " Small Display " ) ) ) ;
2013-11-28 04:59:17 +00:00
if ( pixel_xres < pixel_yres * 1.3 ) // Smaller than 4:3
2013-08-20 11:37:22 +00:00
graphicsSettings - > Add ( new CheckBox ( & g_Config . bPartialStretch , gs - > T ( " Partial Vertical Stretch " ) ) ) ;
2014-07-20 10:11:50 +00:00
2014-02-09 22:16:08 +00:00
# ifdef ANDROID
2014-07-20 10:11:50 +00:00
// Hide Immersive Mode on pre-kitkat Android
if ( System_GetPropertyInt ( SYSPROP_SYSTEMVERSION ) > = 19 ) {
graphicsSettings - > Add ( new CheckBox ( & g_Config . bImmersiveMode , gs - > T ( " Immersive Mode " ) ) ) - > OnClick . Handle ( this , & GameSettingsScreen : : OnImmersiveModeChange ) ;
}
2014-02-09 22:16:08 +00:00
# endif
2013-10-20 15:33:18 +00:00
graphicsSettings - > Add ( new ItemHeader ( gs - > T ( " Performance " ) ) ) ;
2014-02-08 18:29:22 +00:00
# ifndef MOBILE_DEVICE
2013-10-20 15:33:18 +00:00
static const char * internalResolutions [ ] = { " Auto (1:1) " , " 1x PSP " , " 2x PSP " , " 3x PSP " , " 4x PSP " , " 5x PSP " , " 6x PSP " , " 7x PSP " , " 8x PSP " , " 9x PSP " , " 10x PSP " } ;
# else
static const char * internalResolutions [ ] = { " Auto (1:1) " , " 1x PSP " , " 2x PSP " , " 3x PSP " , " 4x PSP " , " 5x PSP " } ;
# endif
2013-10-30 11:12:14 +00:00
resolutionChoice_ = graphicsSettings - > Add ( new PopupMultiChoice ( & g_Config . iInternalResolution , gs - > T ( " Rendering Resolution " ) , internalResolutions , 0 , ARRAY_SIZE ( internalResolutions ) , gs , screenManager ( ) ) ) ;
2014-07-18 19:49:54 +00:00
resolutionChoice_ - > OnChoice . Handle ( this , & GameSettingsScreen : : OnResolutionChange ) ;
2014-07-09 06:47:27 +00:00
resolutionEnable_ = ! g_Config . bSoftwareRendering & & ( g_Config . iRenderingMode ! = FB_NON_BUFFERED_MODE ) ;
resolutionChoice_ - > SetEnabledPtr ( & resolutionEnable_ ) ;
2014-06-10 21:32:37 +00:00
2015-05-16 18:09:01 +00:00
static const char * displayRotation [ ] = { " Landscape " , " Portrait " , " Landscape Reversed " , " Portrait Reversed " } ;
PopupMultiChoice * dispRotChoice = graphicsSettings - > Add ( new PopupMultiChoice ( & g_Config . iInternalScreenRotation , gs - > T ( " Display Rotation " ) , displayRotation , 1 , ARRAY_SIZE ( displayRotation ) , c , screenManager ( ) ) ) ;
dispRotChoice - > SetEnabledPtr ( & displayRotEnable_ ) ;
displayRotEnable_ = ( g_Config . iRenderingMode ! = FB_NON_BUFFERED_MODE ) ;
2015-05-12 19:01:15 +00:00
2014-07-18 19:49:54 +00:00
# ifdef ANDROID
2014-07-18 22:42:22 +00:00
static const char * deviceResolutions [ ] = { " Native device resolution " , " Auto (same as Rendering) " , " 1x PSP " , " 2x PSP " , " 3x PSP " , " 4x PSP " , " 5x PSP " } ;
2015-01-29 23:28:53 +00:00
int max_res_temp = std : : max ( System_GetPropertyInt ( SYSPROP_DISPLAY_XRES ) , System_GetPropertyInt ( SYSPROP_DISPLAY_YRES ) ) / 480 + 2 ;
int max_res = std : : min ( max_res_temp , ( int ) ARRAY_SIZE ( deviceResolutions ) ) ;
UI : : PopupMultiChoice * hwscale = graphicsSettings - > Add ( new PopupMultiChoice ( & g_Config . iAndroidHwScale , gs - > T ( " Display Resolution (HW scaler) " ) , deviceResolutions , 0 , max_res , gs , screenManager ( ) ) ) ;
2014-07-18 19:49:54 +00:00
hwscale - > OnChoice . Handle ( this , & GameSettingsScreen : : OnHwScaleChange ) ; // To refresh the display mode
# endif
2013-10-27 13:09:46 +00:00
# ifdef _WIN32
2013-10-20 15:33:18 +00:00
graphicsSettings - > Add ( new CheckBox ( & g_Config . bVSync , gs - > T ( " VSync " ) ) ) ;
2013-10-27 13:09:46 +00:00
# endif
2014-06-10 21:28:13 +00:00
CheckBox * mipmapping = graphicsSettings - > Add ( new CheckBox ( & g_Config . bMipMap , gs - > T ( " Mipmapping " ) ) ) ;
2014-07-09 06:47:27 +00:00
mipmapping - > SetDisabledPtr ( & g_Config . bSoftwareRendering ) ;
2014-06-10 18:00:11 +00:00
2014-06-10 21:28:13 +00:00
CheckBox * hwTransform = graphicsSettings - > Add ( new CheckBox ( & g_Config . bHardwareTransform , gs - > T ( " Hardware Transform " ) ) ) ;
hwTransform - > OnClick . Handle ( this , & GameSettingsScreen : : OnHardwareTransform ) ;
2014-07-09 06:47:27 +00:00
hwTransform - > SetDisabledPtr ( & g_Config . bSoftwareRendering ) ;
2014-06-10 18:00:11 +00:00
2014-06-10 21:28:13 +00:00
CheckBox * swSkin = graphicsSettings - > Add ( new CheckBox ( & g_Config . bSoftwareSkinning , gs - > T ( " Software Skinning " ) ) ) ;
2014-07-09 06:47:27 +00:00
swSkin - > SetDisabledPtr ( & g_Config . bSoftwareRendering ) ;
2014-06-10 18:00:11 +00:00
2014-06-10 21:28:13 +00:00
CheckBox * vtxCache = graphicsSettings - > Add ( new CheckBox ( & g_Config . bVertexCache , gs - > T ( " Vertex Cache " ) ) ) ;
2014-07-09 06:47:27 +00:00
vtxCacheEnable_ = ! g_Config . bSoftwareRendering & & g_Config . bHardwareTransform ;
vtxCache - > SetEnabledPtr ( & vtxCacheEnable_ ) ;
2014-06-10 18:00:11 +00:00
2014-06-10 21:28:13 +00:00
CheckBox * texBackoff = graphicsSettings - > Add ( new CheckBox ( & g_Config . bTextureBackoffCache , gs - > T ( " Lazy texture caching " , " Lazy texture caching (speedup) " ) ) ) ;
2014-07-09 06:47:27 +00:00
texBackoff - > SetDisabledPtr ( & g_Config . bSoftwareRendering ) ;
2014-06-10 18:00:11 +00:00
2014-06-10 21:28:13 +00:00
CheckBox * texSecondary_ = graphicsSettings - > Add ( new CheckBox ( & g_Config . bTextureSecondaryCache , gs - > T ( " Retain changed textures " , " Retain changed textures (speedup, mem hog) " ) ) ) ;
2014-07-09 06:47:27 +00:00
texSecondary_ - > SetDisabledPtr ( & g_Config . bSoftwareRendering ) ;
2013-11-29 13:20:37 +00:00
2014-07-09 06:57:43 +00:00
CheckBox * framebufferSlowEffects = graphicsSettings - > Add ( new CheckBox ( & g_Config . bDisableSlowFramebufEffects , gs - > T ( " Disable slower effects (speedup) " ) ) ) ;
framebufferSlowEffects - > SetDisabledPtr ( & g_Config . bSoftwareRendering ) ;
2013-11-29 13:20:37 +00:00
// Seems solid, so we hide the setting.
2013-12-04 09:46:05 +00:00
// CheckBox *vtxJit = graphicsSettings->Add(new CheckBox(&g_Config.bVertexDecoderJit, gs->T("Vertex Decoder JIT")));
2013-11-29 13:20:37 +00:00
2014-06-10 18:00:11 +00:00
// if (PSP_IsInited()) {
2013-12-04 09:46:05 +00:00
// vtxJit->SetEnabled(false);
2014-06-10 18:00:11 +00:00
// }
2013-11-09 17:16:26 +00:00
2014-04-25 12:44:02 +00:00
static const char * quality [ ] = { " Low " , " Medium " , " High " } ;
2014-06-10 21:28:13 +00:00
PopupMultiChoice * beziersChoice = graphicsSettings - > Add ( new PopupMultiChoice ( & g_Config . iSplineBezierQuality , gs - > T ( " LowCurves " , " Spline/Bezier curves quality " ) , quality , 0 , ARRAY_SIZE ( quality ) , gs , screenManager ( ) ) ) ;
2014-07-09 06:47:27 +00:00
beziersChoice - > SetDisabledPtr ( & g_Config . bSoftwareRendering ) ;
2014-04-25 12:44:02 +00:00
2013-09-28 06:21:59 +00:00
// In case we're going to add few other antialiasing option like MSAA in the future.
2013-10-12 00:05:55 +00:00
// graphicsSettings->Add(new CheckBox(&g_Config.bFXAA, gs->T("FXAA")));
2013-07-20 14:03:52 +00:00
graphicsSettings - > Add ( new ItemHeader ( gs - > T ( " Texture Scaling " ) ) ) ;
2014-02-08 18:29:22 +00:00
# ifndef MOBILE_DEVICE
2014-01-20 05:14:21 +00:00
static const char * texScaleLevelsNPOT [ ] = { " Auto " , " Off " , " 2x " , " 3x " , " 4x " , " 5x " } ;
static const char * texScaleLevelsPOT [ ] = { " Auto " , " Off " , " 2x " , " 4x " } ;
2013-07-26 12:25:11 +00:00
# else
2014-01-20 05:14:21 +00:00
static const char * texScaleLevelsNPOT [ ] = { " Auto " , " Off " , " 2x " , " 3x " } ;
static const char * texScaleLevelsPOT [ ] = { " Auto " , " Off " , " 2x " } ;
2013-07-26 12:25:11 +00:00
# endif
2014-01-20 05:14:21 +00:00
static const char * * texScaleLevels ;
static int numTexScaleLevels ;
if ( gl_extensions . OES_texture_npot ) {
texScaleLevels = texScaleLevelsNPOT ;
numTexScaleLevels = ARRAY_SIZE ( texScaleLevelsNPOT ) ;
} else {
texScaleLevels = texScaleLevelsPOT ;
numTexScaleLevels = ARRAY_SIZE ( texScaleLevelsPOT ) ;
}
2014-06-10 21:28:13 +00:00
PopupMultiChoice * texScalingChoice = graphicsSettings - > Add ( new PopupMultiChoice ( & g_Config . iTexScalingLevel , gs - > T ( " Upscale Level " ) , texScaleLevels , 0 , numTexScaleLevels , gs , screenManager ( ) ) ) ;
2014-07-09 06:47:27 +00:00
texScalingChoice - > SetDisabledPtr ( & g_Config . bSoftwareRendering ) ;
2014-06-10 18:00:11 +00:00
2013-07-17 23:04:11 +00:00
static const char * texScaleAlgos [ ] = { " xBRZ " , " Hybrid " , " Bicubic " , " Hybrid + Bicubic " , } ;
2014-06-10 21:28:13 +00:00
PopupMultiChoice * texScalingType = graphicsSettings - > Add ( new PopupMultiChoice ( & g_Config . iTexScalingType , gs - > T ( " Upscale Type " ) , texScaleAlgos , 0 , ARRAY_SIZE ( texScaleAlgos ) , gs , screenManager ( ) ) ) ;
2014-07-09 06:47:27 +00:00
texScalingType - > SetDisabledPtr ( & g_Config . bSoftwareRendering ) ;
2014-06-10 21:28:13 +00:00
CheckBox * deposterize = graphicsSettings - > Add ( new CheckBox ( & g_Config . bTexDeposterize , gs - > T ( " Deposterize " ) ) ) ;
2014-07-09 06:47:27 +00:00
deposterize - > SetDisabledPtr ( & g_Config . bSoftwareRendering ) ;
2014-06-10 21:28:13 +00:00
2013-07-20 14:03:52 +00:00
graphicsSettings - > Add ( new ItemHeader ( gs - > T ( " Texture Filtering " ) ) ) ;
2013-08-16 10:52:16 +00:00
static const char * anisoLevels [ ] = { " Off " , " 2x " , " 4x " , " 8x " , " 16x " } ;
2014-06-10 21:28:13 +00:00
PopupMultiChoice * anisoFiltering = graphicsSettings - > Add ( new PopupMultiChoice ( & g_Config . iAnisotropyLevel , gs - > T ( " Anisotropic Filtering " ) , anisoLevels , 0 , ARRAY_SIZE ( anisoLevels ) , gs , screenManager ( ) ) ) ;
2014-07-09 06:47:27 +00:00
anisoFiltering - > SetDisabledPtr ( & g_Config . bSoftwareRendering ) ;
2014-06-10 21:28:13 +00:00
2013-07-26 12:25:11 +00:00
static const char * texFilters [ ] = { " Auto " , " Nearest " , " Linear " , " Linear on FMV " , } ;
2014-06-10 21:28:13 +00:00
PopupMultiChoice * texFilter = graphicsSettings - > Add ( new PopupMultiChoice ( & g_Config . iTexFiltering , gs - > T ( " Texture Filter " ) , texFilters , 1 , ARRAY_SIZE ( texFilters ) , gs , screenManager ( ) ) ) ;
2014-07-09 06:47:27 +00:00
texFilter - > SetDisabledPtr ( & g_Config . bSoftwareRendering ) ;
2013-07-17 20:27:05 +00:00
2014-08-08 18:51:15 +00:00
static const char * bufFilters [ ] = { " Linear " , " Nearest " , } ;
PopupMultiChoice * bufFilter = graphicsSettings - > Add ( new PopupMultiChoice ( & g_Config . iBufFilter , gs - > T ( " Screen Scaling Filter " ) , bufFilters , 1 , ARRAY_SIZE ( bufFilters ) , gs , screenManager ( ) ) ) ;
bufFilter - > SetDisabledPtr ( & g_Config . bSoftwareRendering ) ;
2015-01-24 19:01:09 +00:00
# ifdef ANDROID
graphicsSettings - > Add ( new ItemHeader ( gs - > T ( " Cardboard Settings " , " Cardboard Settings " ) ) ) ;
CheckBox * cardboardMode = graphicsSettings - > Add ( new CheckBox ( & g_Config . bEnableCardboard , gs - > T ( " Enable Cardboard " , " Enable Cardboard " ) ) ) ;
cardboardMode - > SetDisabledPtr ( & g_Config . bSoftwareRendering ) ;
PopupSliderChoice * cardboardScreenSize = graphicsSettings - > Add ( new PopupSliderChoice ( & g_Config . iCardboardScreenSize , 30 , 100 , gs - > T ( " Cardboard Screen Size " , " Screen Size (in % of the viewport) " ) , 1 , screenManager ( ) ) ) ;
cardboardScreenSize - > SetDisabledPtr ( & g_Config . bSoftwareRendering ) ;
PopupSliderChoice * cardboardXShift = graphicsSettings - > Add ( new PopupSliderChoice ( & g_Config . iCardboardXShift , - 100 , 100 , gs - > T ( " Cardboard Screen X Shift " , " X Shift (in % of the void) " ) , 1 , screenManager ( ) ) ) ;
cardboardXShift - > SetDisabledPtr ( & g_Config . bSoftwareRendering ) ;
PopupSliderChoice * cardboardYShift = graphicsSettings - > Add ( new PopupSliderChoice ( & g_Config . iCardboardYShift , - 100 , 100 , gs - > T ( " Cardboard Screen Y Shift " , " Y Shift (in % of the void) " ) , 1 , screenManager ( ) ) ) ;
cardboardYShift - > SetDisabledPtr ( & g_Config . bSoftwareRendering ) ;
# endif
2013-10-22 11:00:19 +00:00
graphicsSettings - > Add ( new ItemHeader ( gs - > T ( " Hack Settings " , " Hack Settings (these WILL cause glitches) " ) ) ) ;
2013-11-15 16:16:03 +00:00
graphicsSettings - > Add ( new CheckBox ( & g_Config . bTimerHack , gs - > T ( " Timer Hack " ) ) ) ;
2014-06-10 22:40:28 +00:00
CheckBox * alphaHack = graphicsSettings - > Add ( new CheckBox ( & g_Config . bDisableAlphaTest , gs - > T ( " Disable Alpha Test (PowerVR speedup) " ) ) ) ;
alphaHack - > OnClick . Handle ( this , & GameSettingsScreen : : OnShaderChange ) ;
2014-07-09 06:47:27 +00:00
alphaHack - > SetDisabledPtr ( & g_Config . bSoftwareRendering ) ;
2014-06-10 18:00:11 +00:00
2014-06-16 22:43:22 +00:00
CheckBox * stencilTest = graphicsSettings - > Add ( new CheckBox ( & g_Config . bDisableStencilTest , gs - > T ( " Disable Stencil Test " ) ) ) ;
2014-07-09 06:47:27 +00:00
stencilTest - > SetDisabledPtr ( & g_Config . bSoftwareRendering ) ;
2014-06-10 18:00:11 +00:00
2014-06-10 21:28:13 +00:00
CheckBox * depthWrite = graphicsSettings - > Add ( new CheckBox ( & g_Config . bAlwaysDepthWrite , gs - > T ( " Always Depth Write " ) ) ) ;
2014-07-09 06:47:27 +00:00
depthWrite - > SetDisabledPtr ( & g_Config . bSoftwareRendering ) ;
2014-06-10 18:00:11 +00:00
2014-06-10 21:28:13 +00:00
CheckBox * prescale = graphicsSettings - > Add ( new CheckBox ( & g_Config . bPrescaleUV , gs - > T ( " Texture Coord Speedhack " ) ) ) ;
2014-07-09 06:47:27 +00:00
prescale - > SetDisabledPtr ( & g_Config . bSoftwareRendering ) ;
2013-09-05 12:51:17 +00:00
2014-11-08 12:31:17 +00:00
CheckBox * depthRange = graphicsSettings - > Add ( new CheckBox ( & g_Config . bDepthRangeHack , gs - > T ( " Depth Range Hack (Phantasy Star Portable 2) " ) ) ) ;
depthRange - > SetDisabledPtr ( & g_Config . bSoftwareRendering ) ;
2015-01-23 01:08:20 +00:00
static const char * bloomHackOptions [ ] = { " Off " , " Safe " , " Balanced " , " Aggressive " } ;
2015-01-23 09:40:49 +00:00
PopupMultiChoice * bloomHack = graphicsSettings - > Add ( new PopupMultiChoice ( & g_Config . iBloomHack , gs - > T ( " Lower resolution for effects (reduces artifacts) " ) , bloomHackOptions , 0 , ARRAY_SIZE ( bloomHackOptions ) , gs , screenManager ( ) ) ) ;
2015-01-23 01:08:20 +00:00
bloomHackEnable_ = ! g_Config . bSoftwareRendering & & ( g_Config . iInternalResolution ! = 1 ) ;
bloomHack - > SetEnabledPtr ( & bloomHackEnable_ ) ;
2013-10-20 15:33:18 +00:00
graphicsSettings - > Add ( new ItemHeader ( gs - > T ( " Overlay Information " ) ) ) ;
2013-11-29 10:36:47 +00:00
static const char * fpsChoices [ ] = {
" None " , " Speed " , " FPS " , " Both "
2013-10-28 04:19:27 +00:00
# ifdef BLACKBERRY
2013-11-29 10:36:47 +00:00
, " Statistics "
2013-10-28 04:19:27 +00:00
# endif
2013-11-29 10:36:47 +00:00
} ;
2013-10-20 15:33:18 +00:00
graphicsSettings - > Add ( new PopupMultiChoice ( & g_Config . iShowFPSCounter , gs - > T ( " Show FPS Counter " ) , fpsChoices , 0 , ARRAY_SIZE ( fpsChoices ) , gs , screenManager ( ) ) ) ;
2014-05-27 06:39:53 +00:00
graphicsSettings - > Add ( new CheckBox ( & g_Config . bShowDebugStats , gs - > T ( " Show Debug Statistics " ) ) ) - > OnClick . Handle ( this , & GameSettingsScreen : : OnJitAffectingSetting ) ;
2013-10-20 15:33:18 +00:00
2013-09-30 17:13:47 +00:00
// Developer tools are not accessible ingame, so it goes here.
2013-08-18 17:51:40 +00:00
graphicsSettings - > Add ( new ItemHeader ( gs - > T ( " Debugging " ) ) ) ;
2013-08-18 21:11:47 +00:00
Choice * dump = graphicsSettings - > Add ( new Choice ( gs - > T ( " Dump next frame to log " ) ) ) ;
dump - > OnClick . Handle ( this , & GameSettingsScreen : : OnDumpNextFrameToLog ) ;
if ( ! PSP_IsInited ( ) )
dump - > SetEnabled ( false ) ;
2013-08-18 17:51:40 +00:00
2013-09-30 17:13:47 +00:00
// We normally use software rendering to debug so put it in debugging.
2014-03-03 11:56:01 +00:00
CheckBox * softwareGPU = graphicsSettings - > Add ( new CheckBox ( & g_Config . bSoftwareRendering , gs - > T ( " Software Rendering " , " Software Rendering (experimental) " ) ) ) ;
2014-06-10 18:00:11 +00:00
softwareGPU - > OnClick . Handle ( this , & GameSettingsScreen : : OnSoftwareRendering ) ;
2015-01-21 22:57:20 +00:00
2014-11-05 23:03:06 +00:00
if ( PSP_IsInited ( ) | | g_Config . iGPUBackend ! = GPU_BACKEND_OPENGL )
2013-09-30 17:13:47 +00:00
softwareGPU - > SetEnabled ( false ) ;
2013-07-20 14:03:52 +00:00
// Audio
2013-06-08 20:42:31 +00:00
ViewGroup * audioSettingsScroll = new ScrollView ( ORIENT_VERTICAL , new LinearLayoutParams ( FILL_PARENT , FILL_PARENT ) ) ;
2013-08-19 22:49:25 +00:00
LinearLayout * audioSettings = new LinearLayout ( ORIENT_VERTICAL ) ;
audioSettings - > SetSpacing ( 0 ) ;
2013-06-08 20:42:31 +00:00
audioSettingsScroll - > Add ( audioSettings ) ;
2013-08-11 15:25:50 +00:00
tabHolder - > AddTab ( ms - > T ( " Audio " ) , audioSettingsScroll ) ;
2013-08-09 10:57:03 +00:00
2013-08-20 10:28:17 +00:00
audioSettings - > Add ( new ItemHeader ( ms - > T ( " Audio " ) ) ) ;
2013-08-09 10:57:03 +00:00
2013-08-16 17:34:44 +00:00
audioSettings - > Add ( new CheckBox ( & g_Config . bEnableSound , a - > T ( " Enable Sound " ) ) ) ;
2015-01-24 12:50:27 +00:00
# ifdef _WIN32
2015-02-01 10:56:44 +00:00
if ( IsVistaOrHigher ( ) ) {
2015-02-01 17:04:06 +00:00
static const char * backend [ ] = { " Auto " , " DSound (compatible) " , " WASAPI (fast) " } ;
PopupMultiChoice * audioBackend = audioSettings - > Add ( new PopupMultiChoice ( & g_Config . iAudioBackend , a - > T ( " Audio backend " , " Audio backend (restart req.) " ) , backend , 0 , ARRAY_SIZE ( backend ) , a , screenManager ( ) ) ) ;
2015-02-01 10:56:44 +00:00
audioBackend - > SetEnabledPtr ( & g_Config . bEnableSound ) ;
}
2015-01-24 12:50:27 +00:00
# endif
2014-04-27 14:05:53 +00:00
static const char * latency [ ] = { " Low " , " Medium " , " High " } ;
2014-08-04 04:00:51 +00:00
PopupMultiChoice * lowAudio = audioSettings - > Add ( new PopupMultiChoice ( & g_Config . iAudioLatency , a - > T ( " Audio Latency " ) , latency , 0 , ARRAY_SIZE ( latency ) , gs , screenManager ( ) ) ) ;
2015-01-31 11:12:01 +00:00
2014-01-03 20:03:57 +00:00
lowAudio - > SetEnabledPtr ( & g_Config . bEnableSound ) ;
2015-01-31 11:12:01 +00:00
if ( System_GetPropertyInt ( SYSPROP_AUDIO_SAMPLE_RATE ) = = 44100 ) {
2015-02-01 17:04:06 +00:00
CheckBox * resampling = audioSettings - > Add ( new CheckBox ( & g_Config . bAudioResampler , a - > T ( " Audio sync " , " Audio sync (resampling) " ) ) ) ;
2015-01-31 11:12:01 +00:00
resampling - > SetEnabledPtr ( & g_Config . bEnableSound ) ;
}
2013-08-16 17:34:44 +00:00
2014-04-15 21:25:04 +00:00
audioSettings - > Add ( new ItemHeader ( a - > T ( " Audio hacks " ) ) ) ;
2014-04-12 21:16:38 +00:00
audioSettings - > Add ( new CheckBox ( & g_Config . bSoundSpeedHack , a - > T ( " Sound speed hack (DOA etc.) " ) ) ) ;
2014-04-12 15:16:31 +00:00
2013-07-20 14:03:52 +00:00
// Control
2013-06-09 10:41:12 +00:00
ViewGroup * controlsSettingsScroll = new ScrollView ( ORIENT_VERTICAL , new LinearLayoutParams ( FILL_PARENT , FILL_PARENT ) ) ;
2013-08-19 22:49:25 +00:00
LinearLayout * controlsSettings = new LinearLayout ( ORIENT_VERTICAL ) ;
controlsSettings - > SetSpacing ( 0 ) ;
2013-06-09 10:41:12 +00:00
controlsSettingsScroll - > Add ( controlsSettings ) ;
2013-08-11 15:25:50 +00:00
tabHolder - > AddTab ( ms - > T ( " Controls " ) , controlsSettingsScroll ) ;
2013-08-20 10:28:17 +00:00
controlsSettings - > Add ( new ItemHeader ( ms - > T ( " Controls " ) ) ) ;
2013-08-21 14:12:49 +00:00
controlsSettings - > Add ( new Choice ( c - > T ( " Control Mapping " ) ) ) - > OnClick . Handle ( this , & GameSettingsScreen : : OnControlMapping ) ;
2013-10-09 20:15:56 +00:00
2015-02-28 22:02:03 +00:00
# if defined(USING_WIN_UI)
controlsSettings - > Add ( new CheckBox ( & g_Config . bGamepadOnlyFocused , c - > T ( " Ignore gamepads when not focused " ) ) ) ;
# endif
2014-02-08 18:29:22 +00:00
# if defined(MOBILE_DEVICE)
2013-10-10 14:44:12 +00:00
controlsSettings - > Add ( new CheckBox ( & g_Config . bHapticFeedback , c - > T ( " HapticFeedback " , " Haptic Feedback (vibration) " ) ) ) ;
2013-11-11 11:52:04 +00:00
static const char * tiltTypes [ ] = { " None (Disabled) " , " Analog Stick " , " D-PAD " , " PSP Action Buttons " } ;
2013-12-14 12:55:57 +00:00
controlsSettings - > Add ( new PopupMultiChoice ( & g_Config . iTiltInputType , c - > T ( " Tilt Input Type " ) , tiltTypes , 0 , ARRAY_SIZE ( tiltTypes ) , c , screenManager ( ) ) ) - > OnClick . Handle ( this , & GameSettingsScreen : : OnTiltTypeChange ) ;
2013-11-11 11:52:04 +00:00
2013-12-14 12:55:57 +00:00
Choice * customizeTilt = controlsSettings - > Add ( new Choice ( c - > T ( " Customize tilt " ) ) ) ;
2015-04-03 09:50:03 +00:00
customizeTilt - > OnClick . Handle ( this , & GameSettingsScreen : : OnTiltCustomize ) ;
2013-12-14 12:55:57 +00:00
customizeTilt - > SetEnabledPtr ( ( bool * ) & g_Config . iTiltInputType ) ; //<- dirty int-to-bool cast
2013-09-29 19:47:15 +00:00
# endif
2015-04-03 09:50:03 +00:00
// TVs don't have touch control, at least not yet.
if ( System_GetPropertyInt ( SYSPROP_DEVICE_TYPE ) ! = DEVICE_TYPE_TV ) {
controlsSettings - > Add ( new ItemHeader ( c - > T ( " OnScreen " , " On-Screen Touch Controls " ) ) ) ;
controlsSettings - > Add ( new CheckBox ( & g_Config . bShowTouchControls , c - > T ( " OnScreen " , " On-Screen Touch Controls " ) ) ) ;
layoutEditorChoice_ = controlsSettings - > Add ( new Choice ( c - > T ( " Custom layout... " ) ) ) ;
layoutEditorChoice_ - > OnClick . Handle ( this , & GameSettingsScreen : : OnTouchControlLayout ) ;
layoutEditorChoice_ - > SetEnabledPtr ( & g_Config . bShowTouchControls ) ;
// Re-centers itself to the touch location on touch-down.
CheckBox * floatingAnalog = controlsSettings - > Add ( new CheckBox ( & g_Config . bAutoCenterTouchAnalog , c - > T ( " Auto-centering analog stick " ) ) ) ;
floatingAnalog - > SetEnabledPtr ( & g_Config . bShowTouchControls ) ;
// On systems that aren't Symbian, iOS, and Maemo, offer to let the user see this button.
// Some Windows touch devices don't have a back button or other button to call up the menu.
2014-06-17 17:42:31 +00:00
# if !defined(__SYMBIAN32__) && !defined(IOS) && !defined(MAEMO)
2015-04-03 09:50:03 +00:00
CheckBox * enablePauseBtn = controlsSettings - > Add ( new CheckBox ( & g_Config . bShowTouchPause , c - > T ( " Show Touch Pause Menu Button " ) ) ) ;
2014-02-25 06:39:10 +00:00
2015-04-03 09:50:03 +00:00
// Don't allow the user to disable it once in-game, so they can't lock themselves out of the menu.
if ( ! PSP_IsInited ( ) ) {
enablePauseBtn - > SetEnabledPtr ( & g_Config . bShowTouchControls ) ;
} else {
enablePauseBtn - > SetEnabled ( false ) ;
}
2014-02-25 06:39:10 +00:00
# endif
2015-04-03 09:50:03 +00:00
CheckBox * disableDiags = controlsSettings - > Add ( new CheckBox ( & g_Config . bDisableDpadDiagonals , c - > T ( " Disable D-Pad diagonals (4-way touch) " ) ) ) ;
disableDiags - > SetEnabledPtr ( & g_Config . bShowTouchControls ) ;
View * opacity = controlsSettings - > Add ( new PopupSliderChoice ( & g_Config . iTouchButtonOpacity , 0 , 100 , c - > T ( " Button Opacity " ) , screenManager ( ) ) ) ;
opacity - > SetEnabledPtr ( & g_Config . bShowTouchControls ) ;
static const char * touchControlStyles [ ] = { " Classic " , " Thin borders " } ;
View * style = controlsSettings - > Add ( new PopupMultiChoice ( & g_Config . iTouchButtonStyle , c - > T ( " Button style " ) , touchControlStyles , 0 , ARRAY_SIZE ( touchControlStyles ) , c , screenManager ( ) ) ) ;
style - > SetEnabledPtr ( & g_Config . bShowTouchControls ) ;
}
2013-10-10 14:44:12 +00:00
2015-03-01 15:38:22 +00:00
# ifdef _WIN32
2015-01-17 16:47:19 +00:00
static const char * inverseDeadzoneModes [ ] = { " Off " , " X " , " Y " , " X + Y " } ;
controlsSettings - > Add ( new ItemHeader ( c - > T ( " DInput Analog Settings " , " DInput Analog Settings " ) ) ) ;
2015-03-01 15:38:22 +00:00
controlsSettings - > Add ( new PopupSliderChoiceFloat ( & g_Config . fDInputAnalogDeadzone , 0.0f , 1.0f , c - > T ( " Deadzone Radius " ) , screenManager ( ) ) ) ;
2015-02-05 06:30:29 +00:00
controlsSettings - > Add ( new PopupMultiChoice ( & g_Config . iDInputAnalogInverseMode , c - > T ( " Analog Mapper Mode " ) , inverseDeadzoneModes , 0 , ARRAY_SIZE ( inverseDeadzoneModes ) , c , screenManager ( ) ) ) ;
2015-03-01 15:38:22 +00:00
controlsSettings - > Add ( new PopupSliderChoiceFloat ( & g_Config . fDInputAnalogInverseDeadzone , 0.0f , 1.0f , c - > T ( " Analog Mapper Low End " , " Analog Mapper Low End (Inverse Deadzone) " ) , screenManager ( ) ) ) ;
controlsSettings - > Add ( new PopupSliderChoiceFloat ( & g_Config . fDInputAnalogSensitivity , 0.0f , 10.0f , c - > T ( " Analog Mapper High End " , " Analog Mapper High End (Axis Sensitivity) " ) , screenManager ( ) ) ) ;
2015-01-17 16:47:19 +00:00
controlsSettings - > Add ( new ItemHeader ( c - > T ( " XInput Analog Settings " , " XInput Analog Settings " ) ) ) ;
2015-03-01 15:38:22 +00:00
controlsSettings - > Add ( new PopupSliderChoiceFloat ( & g_Config . fXInputAnalogDeadzone , 0.0f , 1.0f , c - > T ( " Deadzone Radius " ) , screenManager ( ) ) ) ;
2015-02-05 06:30:29 +00:00
controlsSettings - > Add ( new PopupMultiChoice ( & g_Config . iXInputAnalogInverseMode , c - > T ( " Analog Mapper Mode " ) , inverseDeadzoneModes , 0 , ARRAY_SIZE ( inverseDeadzoneModes ) , c , screenManager ( ) ) ) ;
2015-03-01 15:38:22 +00:00
controlsSettings - > Add ( new PopupSliderChoiceFloat ( & g_Config . fXInputAnalogInverseDeadzone , 0.0f , 1.0f , c - > T ( " Analog Mapper Low End " , " Analog Mapper Low End (Inverse Deadzone) " ) , screenManager ( ) ) ) ;
controlsSettings - > Add ( new PopupSliderChoiceFloat ( & g_Config . fXInputAnalogSensitivity , 0.0f , 10.0f , c - > T ( " Analog Mapper High End " , " Analog Mapper High End (Axis Sensitivity) " ) , screenManager ( ) ) ) ;
# endif
2015-01-17 16:47:19 +00:00
2014-01-07 21:08:11 +00:00
controlsSettings - > Add ( new ItemHeader ( c - > T ( " Keyboard " , " Keyboard Control Settings " ) ) ) ;
2014-08-16 19:05:37 +00:00
# if defined(USING_WIN_UI)
2014-01-07 20:32:58 +00:00
controlsSettings - > Add ( new CheckBox ( & g_Config . bIgnoreWindowsKey , c - > T ( " Ignore Windows Key " ) ) ) ;
2014-08-16 19:05:37 +00:00
# endif // #if defined(USING_WIN_UI)
2014-08-18 12:50:34 +00:00
controlsSettings - > Add ( new PopupSliderChoiceFloat ( & g_Config . fAnalogLimiterDeadzone , 0.0f , 1.0f , c - > T ( " Analog Limiter " ) , 0.10f , screenManager ( ) ) ) ;
2014-01-07 20:32:58 +00:00
2015-01-04 10:59:43 +00:00
ViewGroup * networkingSettingsScroll = new ScrollView ( ORIENT_VERTICAL , new LinearLayoutParams ( FILL_PARENT , FILL_PARENT ) ) ;
LinearLayout * networkingSettings = new LinearLayout ( ORIENT_VERTICAL ) ;
networkingSettings - > SetSpacing ( 0 ) ;
networkingSettingsScroll - > Add ( networkingSettings ) ;
2015-01-05 00:32:53 +00:00
tabHolder - > AddTab ( ms - > T ( " Networking " ) , networkingSettingsScroll ) ;
networkingSettings - > Add ( new ItemHeader ( ms - > T ( " Networking " ) ) ) ;
2015-01-04 10:59:43 +00:00
2015-01-29 21:47:46 +00:00
networkingSettings - > Add ( new Choice ( n - > T ( " Adhoc Multiplayer forum " ) ) ) - > OnClick . Handle ( this , & GameSettingsScreen : : OnAdhocGuides ) ;
2015-01-29 21:15:42 +00:00
2015-01-04 10:59:43 +00:00
networkingSettings - > Add ( new CheckBox ( & g_Config . bEnableWlan , n - > T ( " Enable networking " , " Enable networking/wlan (beta) " ) ) ) ;
# ifdef _WIN32
networkingSettings - > Add ( new PopupTextInputChoice ( & g_Config . proAdhocServer , n - > T ( " Change proAdhocServer Address " ) , " " , 255 , screenManager ( ) ) ) ;
# else
networkingSettings - > Add ( new ChoiceWithValueDisplay ( & g_Config . proAdhocServer , n - > T ( " Change proAdhocServer Address " ) , nullptr ) ) - > OnClick . Handle ( this , & GameSettingsScreen : : OnChangeproAdhocServerAddress ) ;
# endif
networkingSettings - > Add ( new CheckBox ( & g_Config . bEnableAdhocServer , n - > T ( " Enable built-in PRO Adhoc Server " , " Enable built-in PRO Adhoc Server " ) ) ) ;
2015-01-04 13:52:01 +00:00
networkingSettings - > Add ( new ChoiceWithValueDisplay ( & g_Config . sMACAddress , n - > T ( " Change Mac Address " ) , nullptr ) ) - > OnClick . Handle ( this , & GameSettingsScreen : : OnChangeMacAddress ) ;
2015-01-04 10:59:43 +00:00
2015-06-12 18:37:42 +00:00
ViewGroup * toolsScroll = new ScrollView ( ORIENT_VERTICAL , new LinearLayoutParams ( FILL_PARENT , FILL_PARENT ) ) ;
LinearLayout * tools = new LinearLayout ( ORIENT_VERTICAL ) ;
tools - > SetSpacing ( 0 ) ;
toolsScroll - > Add ( tools ) ;
tabHolder - > AddTab ( ms - > T ( " Tools " ) , toolsScroll ) ;
tools - > Add ( new ItemHeader ( ms - > T ( " Tools " ) ) ) ;
2015-06-21 14:49:21 +00:00
tools - > Add ( new Choice ( sa - > T ( " Savedata Manager " ) ) ) - > OnClick . Handle ( this , & GameSettingsScreen : : OnSavedataManager ) ;
2015-06-12 18:37:42 +00:00
2013-07-20 14:03:52 +00:00
// System
2013-06-09 10:41:12 +00:00
ViewGroup * systemSettingsScroll = new ScrollView ( ORIENT_VERTICAL , new LinearLayoutParams ( FILL_PARENT , FILL_PARENT ) ) ;
2013-08-19 22:49:25 +00:00
LinearLayout * systemSettings = new LinearLayout ( ORIENT_VERTICAL ) ;
systemSettings - > SetSpacing ( 0 ) ;
2013-06-09 10:41:12 +00:00
systemSettingsScroll - > Add ( systemSettings ) ;
2013-08-11 15:25:50 +00:00
tabHolder - > AddTab ( ms - > T ( " System " ) , systemSettingsScroll ) ;
2013-08-17 21:49:06 +00:00
2013-10-20 15:33:18 +00:00
systemSettings - > Add ( new ItemHeader ( s - > T ( " UI Language " ) ) ) ;
systemSettings - > Add ( new Choice ( dev - > T ( " Language " , " Language " ) ) ) - > OnClick . Handle ( this , & GameSettingsScreen : : OnLanguage ) ;
2015-03-05 22:31:03 +00:00
systemSettings - > Add ( new ItemHeader ( s - > T ( " Developer Tools " ) ) ) ;
systemSettings - > Add ( new Choice ( s - > T ( " Developer Tools " ) ) ) - > OnClick . Handle ( this , & GameSettingsScreen : : OnDeveloperTools ) ;
2015-01-10 23:09:17 +00:00
systemSettings - > Add ( new ItemHeader ( s - > T ( " Help the PPSSPP team " ) ) ) ;
enableReports_ = Reporting : : IsEnabled ( ) ;
enableReportsCheckbox_ = new CheckBox ( & enableReports_ , s - > T ( " Enable Compatibility Server Reports " ) ) ;
enableReportsCheckbox_ - > SetEnabled ( Reporting : : IsSupported ( ) ) ;
systemSettings - > Add ( enableReportsCheckbox_ ) ;
2013-08-18 17:51:40 +00:00
systemSettings - > Add ( new ItemHeader ( s - > T ( " Emulation " ) ) ) ;
2015-01-10 23:09:17 +00:00
2014-05-27 06:39:53 +00:00
systemSettings - > Add ( new CheckBox ( & g_Config . bFastMemory , s - > T ( " Fast Memory " , " Fast Memory (Unstable) " ) ) ) - > OnClick . Handle ( this , & GameSettingsScreen : : OnJitAffectingSetting ) ;
2013-08-18 17:51:40 +00:00
2014-12-21 00:11:19 +00:00
systemSettings - > Add ( new CheckBox ( & g_Config . bSeparateCPUThread , s - > T ( " Multithreaded (experimental) " ) ) ) ;
2013-08-21 07:20:43 +00:00
systemSettings - > Add ( new CheckBox ( & g_Config . bSeparateIOThread , s - > T ( " I/O on thread (experimental) " ) ) ) - > SetEnabled ( ! PSP_IsInited ( ) ) ;
2014-12-26 09:18:52 +00:00
static const char * ioTimingMethods [ ] = { " Fast (lag on slow storage) " , " Host (bugs, less lag) " , " Simulate UMD delays " } ;
2014-12-26 03:02:49 +00:00
View * ioTimingMethod = systemSettings - > Add ( new PopupMultiChoice ( & g_Config . iIOTimingMethod , s - > T ( " IO timing method " ) , ioTimingMethods , 0 , ARRAY_SIZE ( ioTimingMethods ) , s , screenManager ( ) ) ) ;
ioTimingMethod - > SetEnabledPtr ( & g_Config . bSeparateIOThread ) ;
2014-06-03 06:37:26 +00:00
systemSettings - > Add ( new CheckBox ( & g_Config . bForceLagSync , s - > T ( " Force real clock sync (slower, less lag) " ) ) ) ;
2013-12-10 22:19:37 +00:00
systemSettings - > Add ( new PopupSliderChoice ( & g_Config . iLockedCPUSpeed , 0 , 1000 , s - > T ( " Change CPU Clock " , " Change CPU Clock (0 = default) (unstable) " ) , screenManager ( ) ) ) ;
2014-02-08 18:29:22 +00:00
# ifndef MOBILE_DEVICE
2013-11-03 15:56:17 +00:00
systemSettings - > Add ( new PopupSliderChoice ( & g_Config . iRewindFlipFrequency , 0 , 1800 , s - > T ( " Rewind Snapshot Frequency " , " Rewind Snapshot Frequency (0 = off, mem hog) " ) , screenManager ( ) ) ) ;
2013-12-05 15:15:33 +00:00
# endif
2014-08-22 07:35:02 +00:00
systemSettings - > Add ( new CheckBox ( & g_Config . bSetRoundingMode , s - > T ( " Respect FPU rounding (disable for old GEB saves) " ) ) ) - > OnClick . Handle ( this , & GameSettingsScreen : : OnJitAffectingSetting ) ;
2013-08-18 17:51:40 +00:00
2015-01-10 23:09:17 +00:00
systemSettings - > Add ( new ItemHeader ( s - > T ( " General " ) ) ) ;
# ifdef ANDROID
2015-04-03 09:50:03 +00:00
if ( System_GetPropertyInt ( SYSPROP_DEVICE_TYPE ) = = DEVICE_TYPE_MOBILE ) {
static const char * screenRotation [ ] = { " Auto " , " Landscape " , " Portrait " , " Landscape Reversed " , " Portrait Reversed " } ;
PopupMultiChoice * rot = systemSettings - > Add ( new PopupMultiChoice ( & g_Config . iScreenRotation , c - > T ( " Screen Rotation " ) , screenRotation , 0 , ARRAY_SIZE ( screenRotation ) , c , screenManager ( ) ) ) ;
rot - > OnChoice . Handle ( this , & GameSettingsScreen : : OnScreenRotation ) ;
}
2015-01-10 23:09:17 +00:00
# endif
systemSettings - > Add ( new CheckBox ( & g_Config . bCheckForNewVersion , s - > T ( " VersionCheck " , " Check for new versions of PPSSPP " ) ) ) ;
if ( g_Config . iMaxRecent > 0 )
systemSettings - > Add ( new Choice ( s - > T ( " Clear Recent Games List " ) ) ) - > OnClick . Handle ( this , & GameSettingsScreen : : OnClearRecents ) ;
systemSettings - > Add ( new Choice ( s - > T ( " Restore Default Settings " ) ) ) - > OnClick . Handle ( this , & GameSettingsScreen : : OnRestoreDefaultSettings ) ;
systemSettings - > Add ( new CheckBox ( & g_Config . bEnableAutoLoad , s - > T ( " Auto Load Newest Savestate " ) ) ) ;
2014-05-25 01:26:30 +00:00
# if defined(USING_WIN_UI)
systemSettings - > Add ( new CheckBox ( & g_Config . bBypassOSKWithKeyboard , s - > T ( " Enable Windows native keyboard " , " Enable Windows native keyboard " ) ) ) ;
# endif
2014-10-23 14:22:11 +00:00
# if defined(_WIN32)
2014-11-03 00:53:15 +00:00
SavePathInMyDocumentChoice = systemSettings - > Add ( new CheckBox ( & installed_ , s - > T ( " Save path in My Documents " , " Save path in My Documents " ) ) ) ;
2014-10-26 00:35:11 +00:00
SavePathInMyDocumentChoice - > OnClick . Handle ( this , & GameSettingsScreen : : OnSavePathMydoc ) ;
2014-11-03 00:53:15 +00:00
SavePathInOtherChoice = systemSettings - > Add ( new CheckBox ( & otherinstalled_ , s - > T ( " Save path in installed.txt " , " Save path in installed.txt " ) ) ) ;
2014-10-23 14:22:11 +00:00
SavePathInOtherChoice - > SetEnabled ( false ) ;
SavePathInOtherChoice - > OnClick . Handle ( this , & GameSettingsScreen : : OnSavePathOther ) ;
wchar_t myDocumentsPath [ MAX_PATH ] ;
const HRESULT result = SHGetFolderPath ( NULL , CSIDL_PERSONAL , NULL , SHGFP_TYPE_CURRENT , myDocumentsPath ) ;
const std : : string PPSSPPpath = File : : GetExeDirectory ( ) ;
const std : : string installedFile = PPSSPPpath + " installed.txt " ;
2014-11-03 00:53:15 +00:00
installed_ = File : : Exists ( installedFile ) ;
otherinstalled_ = false ;
if ( ! installed_ & & result = = S_OK ) {
2014-10-26 01:03:57 +00:00
if ( File : : CreateEmptyFile ( PPSSPPpath + " installedTEMP.txt " ) ) {
2014-10-26 00:35:11 +00:00
// Disable the setting whether cannot create & delete file
if ( ! ( File : : Delete ( PPSSPPpath + " installedTEMP.txt " ) ) )
SavePathInMyDocumentChoice - > SetEnabled ( false ) ;
2014-10-27 10:48:48 +00:00
else
2015-01-10 23:09:17 +00:00
SavePathInOtherChoice - > SetEnabled ( true ) ;
} else
2014-10-23 14:22:11 +00:00
SavePathInMyDocumentChoice - > SetEnabled ( false ) ;
2015-01-10 23:09:17 +00:00
} else {
2014-11-03 00:53:15 +00:00
if ( installed_ & & ( result = = S_OK ) ) {
2014-10-23 14:22:11 +00:00
std : : ifstream inputFile ( ConvertUTF8ToWString ( installedFile ) ) ;
2014-10-24 14:21:49 +00:00
if ( ! inputFile . fail ( ) & & inputFile . is_open ( ) ) {
std : : string tempString ;
std : : getline ( inputFile , tempString ) ;
// Skip UTF-8 encoding bytes if there are any. There are 3 of them.
if ( tempString . substr ( 0 , 3 ) = = " \xEF \xBB \xBF " )
2014-10-26 00:39:44 +00:00
tempString = tempString . substr ( 3 ) ;
2014-10-27 10:48:48 +00:00
SavePathInOtherChoice - > SetEnabled ( true ) ;
2014-10-26 06:50:21 +00:00
if ( ! ( tempString = = " " ) ) {
2014-11-03 00:53:15 +00:00
installed_ = false ;
otherinstalled_ = true ;
2014-10-24 14:21:49 +00:00
}
2014-10-23 14:22:11 +00:00
}
2014-10-24 14:21:49 +00:00
inputFile . close ( ) ;
2015-01-10 23:09:17 +00:00
} else if ( result ! = S_OK )
2014-10-24 14:21:49 +00:00
SavePathInMyDocumentChoice - > SetEnabled ( false ) ;
2015-01-10 23:09:17 +00:00
}
2014-10-23 14:22:11 +00:00
# endif
2013-10-15 06:06:37 +00:00
2014-10-30 23:14:00 +00:00
# if defined(_M_X64)
systemSettings - > Add ( new CheckBox ( & g_Config . bCacheFullIsoInRam , s - > T ( " Cache ISO in RAM " , " Cache full ISO in RAM (slow startup) " ) ) ) ;
# endif
2013-12-10 22:19:37 +00:00
//#ifndef ANDROID
systemSettings - > Add ( new ItemHeader ( s - > T ( " Cheats " , " Cheats (experimental, see forums) " ) ) ) ;
systemSettings - > Add ( new CheckBox ( & g_Config . bEnableCheats , s - > T ( " Enable Cheats " ) ) ) ;
//#endif
systemSettings - > SetSpacing ( 0 ) ;
2013-08-20 16:03:52 +00:00
2013-08-18 17:51:40 +00:00
systemSettings - > Add ( new ItemHeader ( s - > T ( " PSP Settings " ) ) ) ;
2014-01-13 12:45:28 +00:00
static const char * models [ ] = { " PSP-1000 " , " PSP-2000/3000 " } ;
2014-01-13 12:04:15 +00:00
systemSettings - > Add ( new PopupMultiChoice ( & g_Config . iPSPModel , s - > T ( " PSP Model " ) , models , 0 , ARRAY_SIZE ( models ) , s , screenManager ( ) ) ) ;
2013-09-28 06:21:59 +00:00
// TODO: Come up with a way to display a keyboard for mobile users,
// so until then, this is Windows/Desktop only.
2014-07-18 09:04:12 +00:00
# if defined(_WIN32) // TODO: Add all platforms where KEY_CHAR support is added
2014-07-21 09:59:47 +00:00
systemSettings - > Add ( new PopupTextInputChoice ( & g_Config . sNickName , s - > T ( " Change Nickname " ) , " " , 32 , screenManager ( ) ) ) ;
2014-07-18 09:04:12 +00:00
# elif defined(USING_QT_UI)
2013-09-28 06:21:59 +00:00
systemSettings - > Add ( new Choice ( s - > T ( " Change Nickname " ) ) ) - > OnClick . Handle ( this , & GameSettingsScreen : : OnChangeNickname ) ;
2013-12-08 10:16:18 +00:00
# endif
2014-02-08 18:29:22 +00:00
# if defined(_WIN32) || (defined(USING_QT_UI) && !defined(MOBILE_DEVICE))
2013-12-08 10:16:18 +00:00
// Screenshot functionality is not yet available on non-Windows/non-Qt
2013-09-28 06:21:59 +00:00
systemSettings - > Add ( new CheckBox ( & g_Config . bScreenshotsAsPNG , s - > T ( " Screenshots as PNG " ) ) ) ;
2013-11-29 15:46:47 +00:00
# endif
2013-07-21 21:06:04 +00:00
systemSettings - > Add ( new CheckBox ( & g_Config . bDayLightSavings , s - > T ( " Day Light Saving " ) ) ) ;
2013-07-21 20:15:18 +00:00
static const char * dateFormat [ ] = { " YYYYMMDD " , " MMDDYYYY " , " DDMMYYYY " } ;
2013-08-21 14:12:49 +00:00
systemSettings - > Add ( new PopupMultiChoice ( & g_Config . iDateFormat , s - > T ( " Date Format " ) , dateFormat , 1 , 3 , s , screenManager ( ) ) ) ;
2013-07-21 20:15:18 +00:00
static const char * timeFormat [ ] = { " 12HR " , " 24HR " } ;
2013-08-21 14:12:49 +00:00
systemSettings - > Add ( new PopupMultiChoice ( & g_Config . iTimeFormat , s - > T ( " Time Format " ) , timeFormat , 1 , 2 , s , screenManager ( ) ) ) ;
2013-08-21 09:17:55 +00:00
static const char * buttonPref [ ] = { " Use O to confirm " , " Use X to confirm " } ;
2013-08-21 14:12:49 +00:00
systemSettings - > Add ( new PopupMultiChoice ( & g_Config . iButtonPreference , s - > T ( " Confirmation Button " ) , buttonPref , 0 , 2 , s , screenManager ( ) ) ) ;
2013-06-08 20:42:31 +00:00
}
2014-07-22 07:55:12 +00:00
UI : : EventReturn GameSettingsScreen : : OnAutoFrameskip ( UI : : EventParams & e ) {
if ( g_Config . bAutoFrameSkip & & g_Config . iFrameSkip = = 0 ) {
g_Config . iFrameSkip = 1 ;
}
2015-02-09 22:10:57 +00:00
if ( g_Config . bAutoFrameSkip & & g_Config . iRenderingMode = = FB_NON_BUFFERED_MODE ) {
g_Config . iRenderingMode = FB_BUFFERED_MODE ;
}
2014-07-22 07:55:12 +00:00
return UI : : EVENT_DONE ;
}
2014-06-10 18:00:11 +00:00
UI : : EventReturn GameSettingsScreen : : OnSoftwareRendering ( UI : : EventParams & e ) {
2014-07-09 06:47:27 +00:00
vtxCacheEnable_ = ! g_Config . bSoftwareRendering & & g_Config . bHardwareTransform ;
postProcEnable_ = ! g_Config . bSoftwareRendering & & ( g_Config . iRenderingMode ! = FB_NON_BUFFERED_MODE ) ;
resolutionEnable_ = ! g_Config . bSoftwareRendering & & ( g_Config . iRenderingMode ! = FB_NON_BUFFERED_MODE ) ;
2014-06-10 18:00:11 +00:00
return UI : : EVENT_DONE ;
}
UI : : EventReturn GameSettingsScreen : : OnHardwareTransform ( UI : : EventParams & e ) {
2014-07-09 06:47:27 +00:00
vtxCacheEnable_ = ! g_Config . bSoftwareRendering & & g_Config . bHardwareTransform ;
2014-06-10 18:00:11 +00:00
return UI : : EVENT_DONE ;
}
2014-02-04 11:58:37 +00:00
UI : : EventReturn GameSettingsScreen : : OnScreenRotation ( UI : : EventParams & e ) {
System_SendMessage ( " rotate " , " " ) ;
return UI : : EVENT_DONE ;
}
2014-07-20 22:35:36 +00:00
static void RecreateActivity ( ) {
const int SYSTEM_JELLYBEAN = 16 ;
if ( System_GetPropertyInt ( SYSPROP_SYSTEMVERSION ) > = SYSTEM_JELLYBEAN ) {
System_SendMessage ( " recreate " , " " ) ;
} else {
I18NCategory * gs = GetI18NCategory ( " Graphics " ) ;
System_SendMessage ( " toast " , gs - > T ( " Must Restart " , " You must restart PPSSPP for this change to take effect " ) ) ;
}
}
2015-01-29 21:15:42 +00:00
UI : : EventReturn GameSettingsScreen : : OnAdhocGuides ( UI : : EventParams & e ) {
LaunchBrowser ( " http://forums.ppsspp.org/forumdisplay.php?fid=34 " ) ;
return UI : : EVENT_DONE ;
}
2014-02-09 22:16:08 +00:00
UI : : EventReturn GameSettingsScreen : : OnImmersiveModeChange ( UI : : EventParams & e ) {
System_SendMessage ( " immersive " , " " ) ;
2014-07-20 22:35:36 +00:00
const int SYSTEM_JELLYBEAN = 16 ;
// recreate doesn't seem reliable on earlier versions.
if ( g_Config . iAndroidHwScale ! = 0 ) {
RecreateActivity ( ) ;
}
2014-02-09 22:16:08 +00:00
return UI : : EVENT_DONE ;
}
2013-10-29 15:22:36 +00:00
UI : : EventReturn GameSettingsScreen : : OnRenderingMode ( UI : : EventParams & e ) {
2013-10-30 10:28:14 +00:00
// We do not want to report when rendering mode is Framebuffer to memory - so many issues
// are caused by that (framebuffer copies overwriting display lists, etc).
2014-02-16 04:34:03 +00:00
Reporting : : UpdateConfig ( ) ;
2013-10-29 15:22:36 +00:00
enableReports_ = Reporting : : IsEnabled ( ) ;
enableReportsCheckbox_ - > SetEnabled ( Reporting : : IsSupported ( ) ) ;
2013-10-30 10:28:14 +00:00
2014-07-09 06:47:27 +00:00
postProcEnable_ = ! g_Config . bSoftwareRendering & & ( g_Config . iRenderingMode ! = FB_NON_BUFFERED_MODE ) ;
resolutionEnable_ = ! g_Config . bSoftwareRendering & & ( g_Config . iRenderingMode ! = FB_NON_BUFFERED_MODE ) ;
2015-05-16 18:09:01 +00:00
displayRotEnable_ = ( g_Config . iRenderingMode ! = FB_NON_BUFFERED_MODE ) ;
2015-02-09 22:10:57 +00:00
if ( g_Config . iRenderingMode = = FB_NON_BUFFERED_MODE ) {
g_Config . bAutoFrameSkip = false ;
}
2013-10-29 15:22:36 +00:00
return UI : : EVENT_DONE ;
}
2014-05-27 06:39:53 +00:00
UI : : EventReturn GameSettingsScreen : : OnJitAffectingSetting ( UI : : EventParams & e ) {
NativeMessageReceived ( " clear jit " , " " ) ;
return UI : : EVENT_DONE ;
}
2014-10-23 14:22:11 +00:00
# ifdef _WIN32
UI : : EventReturn GameSettingsScreen : : OnSavePathMydoc ( UI : : EventParams & e ) {
const std : : string PPSSPPpath = File : : GetExeDirectory ( ) ;
const std : : string installedFile = PPSSPPpath + " installed.txt " ;
2014-11-03 00:53:15 +00:00
installed_ = File : : Exists ( installedFile ) ;
if ( otherinstalled_ ) {
2014-10-26 06:50:21 +00:00
File : : Delete ( PPSSPPpath + " installed.txt " ) ;
File : : CreateEmptyFile ( PPSSPPpath + " installed.txt " ) ;
2014-11-03 00:53:15 +00:00
otherinstalled_ = false ;
2014-10-26 01:03:57 +00:00
wchar_t myDocumentsPath [ MAX_PATH ] ;
const HRESULT result = SHGetFolderPath ( NULL , CSIDL_PERSONAL , NULL , SHGFP_TYPE_CURRENT , myDocumentsPath ) ;
const std : : string myDocsPath = ConvertWStringToUTF8 ( myDocumentsPath ) + " /PPSSPP/ " ;
g_Config . memStickDirectory = myDocsPath ;
}
2014-11-03 00:53:15 +00:00
else if ( installed_ ) {
2014-10-23 14:22:11 +00:00
File : : Delete ( PPSSPPpath + " installed.txt " ) ;
2014-11-03 00:53:15 +00:00
installed_ = false ;
2014-10-23 14:44:41 +00:00
g_Config . memStickDirectory = PPSSPPpath + " memstick/ " ;
2014-10-23 14:22:11 +00:00
}
else {
ofstream myfile ;
myfile . open ( PPSSPPpath + " installed.txt " ) ;
if ( myfile . is_open ( ) ) {
myfile . close ( ) ;
}
wchar_t myDocumentsPath [ MAX_PATH ] ;
const HRESULT result = SHGetFolderPath ( NULL , CSIDL_PERSONAL , NULL , SHGFP_TYPE_CURRENT , myDocumentsPath ) ;
const std : : string myDocsPath = ConvertWStringToUTF8 ( myDocumentsPath ) + " /PPSSPP/ " ;
g_Config . memStickDirectory = myDocsPath ;
2014-11-03 00:53:15 +00:00
installed_ = true ;
2014-10-23 14:22:11 +00:00
}
2014-10-26 06:50:21 +00:00
return UI : : EVENT_DONE ;
2014-10-23 14:22:11 +00:00
}
UI : : EventReturn GameSettingsScreen : : OnSavePathOther ( UI : : EventParams & e ) {
2014-10-27 10:48:48 +00:00
const std : : string PPSSPPpath = File : : GetExeDirectory ( ) ;
2014-11-03 00:53:15 +00:00
if ( otherinstalled_ ) {
2014-10-27 19:10:21 +00:00
I18NCategory * di = GetI18NCategory ( " Dialog " ) ;
std : : string folder = W32Util : : BrowseForFolder ( MainWindow : : GetHWND ( ) , di - > T ( " Choose PPSSPP save folder " ) ) ;
2014-10-27 18:57:40 +00:00
if ( folder . size ( ) ) {
g_Config . memStickDirectory = folder ;
2015-01-27 22:56:41 +00:00
FILE * f = File : : OpenCFile ( PPSSPPpath + " installed.txt " , " wb " ) ;
if ( f ) {
std : : string utfstring ( " \xEF \xBB \xBF " ) ;
utfstring . append ( folder ) ;
2015-02-04 12:34:53 +00:00
fwrite ( utfstring . c_str ( ) , 1 , utfstring . length ( ) , f ) ;
2015-01-27 22:56:41 +00:00
fclose ( f ) ;
}
2014-11-03 00:53:15 +00:00
installed_ = false ;
2014-10-27 10:48:48 +00:00
}
2014-10-27 11:14:39 +00:00
else
2014-11-03 00:53:15 +00:00
otherinstalled_ = false ;
2014-10-27 10:48:48 +00:00
}
else {
File : : Delete ( PPSSPPpath + " installed.txt " ) ;
SavePathInMyDocumentChoice - > SetEnabled ( true ) ;
2014-11-03 00:53:15 +00:00
otherinstalled_ = false ;
installed_ = false ;
2014-10-27 10:48:48 +00:00
g_Config . memStickDirectory = PPSSPPpath + " memstick/ " ;
}
2014-10-23 14:22:11 +00:00
return UI : : EVENT_DONE ;
}
# endif
2013-08-25 19:36:34 +00:00
UI : : EventReturn GameSettingsScreen : : OnClearRecents ( UI : : EventParams & e ) {
g_Config . recentIsos . clear ( ) ;
2013-09-07 16:44:28 +00:00
OnRecentChanged . Trigger ( e ) ;
2013-08-25 19:36:34 +00:00
return UI : : EVENT_DONE ;
}
2013-08-18 17:57:50 +00:00
UI : : EventReturn GameSettingsScreen : : OnReloadCheats ( UI : : EventParams & e ) {
// Hmm, strange mechanism.
g_Config . bReloadCheats = true ;
return UI : : EVENT_DONE ;
}
2013-10-13 17:24:49 +00:00
UI : : EventReturn GameSettingsScreen : : OnFullscreenChange ( UI : : EventParams & e ) {
2014-04-27 18:24:10 +00:00
# if defined(USING_WIN_UI) || defined(USING_QT_UI)
2013-10-13 17:24:49 +00:00
host - > GoFullscreen ( g_Config . bFullScreen ) ;
2014-04-27 18:24:10 +00:00
# else
// SDL, basically.
System_SendMessage ( " toggle_fullscreen " , " " ) ;
# endif
2013-10-13 17:24:49 +00:00
return UI : : EVENT_DONE ;
}
2013-09-10 22:19:34 +00:00
UI : : EventReturn GameSettingsScreen : : OnResolutionChange ( UI : : EventParams & e ) {
2013-09-11 05:13:06 +00:00
if ( gpu ) {
gpu - > Resized ( ) ;
}
2014-07-18 22:42:22 +00:00
if ( g_Config . iAndroidHwScale = = 1 ) {
2014-07-20 22:35:36 +00:00
RecreateActivity ( ) ;
2014-07-18 22:42:22 +00:00
}
2014-02-09 22:04:16 +00:00
Reporting : : UpdateConfig ( ) ;
2013-09-10 22:19:34 +00:00
return UI : : EVENT_DONE ;
}
2014-07-18 19:49:54 +00:00
UI : : EventReturn GameSettingsScreen : : OnHwScaleChange ( UI : : EventParams & e ) {
2014-07-20 22:35:36 +00:00
RecreateActivity ( ) ;
2014-07-18 19:49:54 +00:00
return UI : : EVENT_DONE ;
}
2013-10-22 11:00:19 +00:00
UI : : EventReturn GameSettingsScreen : : OnShaderChange ( UI : : EventParams & e ) {
if ( gpu ) {
2013-10-22 12:34:16 +00:00
gpu - > ClearShaderCache ( ) ;
2013-10-22 11:00:19 +00:00
}
return UI : : EVENT_DONE ;
}
2013-08-18 17:51:40 +00:00
UI : : EventReturn GameSettingsScreen : : OnDumpNextFrameToLog ( UI : : EventParams & e ) {
2013-08-18 21:11:47 +00:00
if ( gpu ) {
gpu - > DumpNextFrame ( ) ;
}
2013-08-18 17:51:40 +00:00
return UI : : EVENT_DONE ;
}
2013-07-21 11:31:46 +00:00
void GameSettingsScreen : : update ( InputState & input ) {
UIScreen : : update ( input ) ;
2013-07-17 23:04:11 +00:00
g_Config . iForceMaxEmulatedFPS = cap60FPS_ ? 60 : 0 ;
2014-05-03 20:24:46 +00:00
2014-05-06 03:49:48 +00:00
g_Config . iFpsLimit = ( iAlternateSpeedPercent_ * 60 ) / 100 ;
2014-07-22 08:37:20 +00:00
bool vertical = UseVerticalLayout ( ) ;
if ( vertical ! = lastVertical_ ) {
RecreateViews ( ) ;
lastVertical_ = vertical ;
}
2013-07-17 20:27:05 +00:00
}
2013-09-04 02:06:05 +00:00
void GameSettingsScreen : : sendMessage ( const char * message , const char * value ) {
2013-10-21 20:52:44 +00:00
// Always call the base class method first to handle the most common messages.
UIDialogScreenWithBackground : : sendMessage ( message , value ) ;
2013-09-24 05:03:59 +00:00
if ( ! strcmp ( message , " control mapping " ) ) {
UpdateUIState ( UISTATE_MENU ) ;
screenManager ( ) - > push ( new ControlMappingScreen ( ) ) ;
}
2013-09-04 02:06:05 +00:00
}
2013-10-25 11:19:08 +00:00
void GameSettingsScreen : : onFinish ( DialogResult result ) {
2013-10-17 14:15:04 +00:00
if ( g_Config . bEnableSound ) {
if ( PSP_IsInited ( ) & & ! IsAudioInitialised ( ) )
2013-08-14 12:55:31 +00:00
Audio_Init ( ) ;
2013-08-14 12:44:36 +00:00
}
2013-10-17 14:15:04 +00:00
2013-09-01 19:57:39 +00:00
Reporting : : Enable ( enableReports_ , " report.ppsspp.org " ) ;
2014-02-16 04:34:03 +00:00
Reporting : : UpdateConfig ( ) ;
2013-08-20 16:03:52 +00:00
g_Config . Save ( ) ;
2014-12-14 19:33:20 +00:00
if ( bEditThenRestore )
{
g_Config . unloadGameConfig ( ) ;
}
2013-08-20 16:03:52 +00:00
2013-09-04 15:21:33 +00:00
host - > UpdateUI ( ) ;
2013-09-08 04:42:15 +00:00
2013-08-22 11:10:06 +00:00
KeyMap : : UpdateConfirmCancelKeys ( ) ;
2013-10-25 11:19:08 +00:00
}
2013-08-20 16:03:52 +00:00
/*
2013-07-17 20:27:05 +00:00
void GlobalSettingsScreen : : CreateViews ( ) {
using namespace UI ;
root_ = new ScrollView ( ORIENT_VERTICAL ) ;
2013-09-01 19:57:39 +00:00
enableReports_ = Reporting : : IsEnabled ( ) ;
2013-08-20 16:03:52 +00:00
} */
2013-07-18 09:39:54 +00:00
2014-09-14 10:59:27 +00:00
void GameSettingsScreen : : CallbackRenderingBackend ( bool yes ) {
# if defined(_WIN32)
// If the user ends up deciding not to restart, set the temporary variable back to the current backend
// so it doesn't get switched by accident.
if ( yes ) {
g_Config . bRestartRequired = true ;
PostMessage ( MainWindow : : GetHWND ( ) , WM_CLOSE , 0 , 0 ) ;
} else {
g_Config . iTempGPUBackend = g_Config . iGPUBackend ;
}
# endif
}
UI : : EventReturn GameSettingsScreen : : OnRenderingBackend ( UI : : EventParams & e ) {
# if defined(_WIN32)
I18NCategory * d = GetI18NCategory ( " Dialog " ) ;
// It only makes sense to show the restart prompt if the backend was actually changed.
if ( g_Config . iTempGPUBackend ! = g_Config . iGPUBackend ) {
screenManager ( ) - > push ( new PromptScreen ( d - > T ( " ChangingGPUBackends " , " Changing GPU backends requires PPSSPP to restart. Restart now? " ) , d - > T ( " Yes " ) , d - > T ( " No " ) ,
std : : bind ( & GameSettingsScreen : : CallbackRenderingBackend , this , placeholder : : _1 ) ) ) ;
}
# endif
return UI : : EVENT_DONE ;
}
2013-08-20 16:03:52 +00:00
UI : : EventReturn GameSettingsScreen : : OnChangeNickname ( UI : : EventParams & e ) {
2013-12-08 10:16:18 +00:00
# if defined(_WIN32) || defined(USING_QT_UI)
2013-08-18 00:03:59 +00:00
const size_t name_len = 256 ;
char name [ name_len ] ;
memset ( name , 0 , sizeof ( name ) ) ;
2013-12-08 10:16:18 +00:00
if ( System_InputBoxGetString ( " Enter a new PSP nickname " , g_Config . sNickName . c_str ( ) , name , name_len ) ) {
2013-08-18 00:03:59 +00:00
g_Config . sNickName = name ;
}
2013-12-07 18:57:06 +00:00
# endif
2014-05-25 05:19:56 +00:00
return UI : : EVENT_DONE ;
}
2014-06-02 06:15:07 +00:00
UI : : EventReturn GameSettingsScreen : : OnChangeproAdhocServerAddress ( UI : : EventParams & e ) {
# if defined(_WIN32) || defined(USING_QT_UI)
if ( ! g_Config . bFullScreen ) {
const size_t name_len = 256 ;
2014-05-25 05:19:56 +00:00
2014-06-02 06:15:07 +00:00
char name [ name_len ] ;
memset ( name , 0 , sizeof ( name ) ) ;
2014-05-25 05:19:56 +00:00
2014-06-02 06:15:07 +00:00
if ( System_InputBoxGetString ( " Enter an IP address " , g_Config . proAdhocServer . c_str ( ) , name , name_len ) ) {
g_Config . proAdhocServer = name ;
}
2014-05-25 05:19:56 +00:00
}
2014-06-02 06:15:07 +00:00
else
screenManager ( ) - > push ( new ProAdhocServerScreen ) ;
# else
screenManager ( ) - > push ( new ProAdhocServerScreen ) ;
2014-05-25 05:19:56 +00:00
# endif
2014-06-02 06:15:07 +00:00
2014-05-25 05:19:56 +00:00
return UI : : EVENT_DONE ;
}
2013-08-21 08:52:40 +00:00
2014-05-25 05:19:56 +00:00
UI : : EventReturn GameSettingsScreen : : OnChangeMacAddress ( UI : : EventParams & e ) {
2014-07-07 20:29:48 +00:00
g_Config . sMACAddress = std : : string ( CreateRandMAC ( ) ) ;
2014-06-02 06:15:07 +00:00
2013-08-18 00:03:59 +00:00
return UI : : EVENT_DONE ;
}
2013-08-20 16:03:52 +00:00
UI : : EventReturn GameSettingsScreen : : OnLanguage ( UI : : EventParams & e ) {
2013-09-03 08:42:26 +00:00
I18NCategory * de = GetI18NCategory ( " Developer " ) ;
auto langScreen = new NewLanguageScreen ( de - > T ( " Language " ) ) ;
2013-09-01 20:29:23 +00:00
langScreen - > OnChoice . Handle ( this , & GameSettingsScreen : : OnLanguageChange ) ;
screenManager ( ) - > push ( langScreen ) ;
return UI : : EVENT_DONE ;
}
UI : : EventReturn GameSettingsScreen : : OnLanguageChange ( UI : : EventParams & e ) {
2014-02-17 19:39:58 +00:00
screenManager ( ) - > RecreateAllViews ( ) ;
2013-11-03 00:24:19 +00:00
2013-09-07 16:48:12 +00:00
if ( host ) {
host - > UpdateUI ( ) ;
}
2013-07-17 20:27:05 +00:00
return UI : : EVENT_DONE ;
}
2013-10-12 00:05:55 +00:00
UI : : EventReturn GameSettingsScreen : : OnPostProcShader ( UI : : EventParams & e ) {
I18NCategory * g = GetI18NCategory ( " Graphics " ) ;
auto procScreen = new PostProcScreen ( g - > T ( " Postprocessing Shader " ) ) ;
procScreen - > OnChoice . Handle ( this , & GameSettingsScreen : : OnPostProcShaderChange ) ;
screenManager ( ) - > push ( procScreen ) ;
return UI : : EVENT_DONE ;
}
UI : : EventReturn GameSettingsScreen : : OnPostProcShaderChange ( UI : : EventParams & e ) {
if ( gpu ) {
gpu - > Resized ( ) ;
}
2014-02-09 22:04:16 +00:00
Reporting : : UpdateConfig ( ) ;
2013-10-12 00:05:55 +00:00
return UI : : EVENT_DONE ;
}
2013-08-20 16:03:52 +00:00
UI : : EventReturn GameSettingsScreen : : OnDeveloperTools ( UI : : EventParams & e ) {
2013-07-18 09:39:54 +00:00
screenManager ( ) - > push ( new DeveloperToolsScreen ( ) ) ;
return UI : : EVENT_DONE ;
}
2013-07-29 00:15:30 +00:00
UI : : EventReturn GameSettingsScreen : : OnControlMapping ( UI : : EventParams & e ) {
2013-08-17 08:34:38 +00:00
screenManager ( ) - > push ( new ControlMappingScreen ( ) ) ;
2013-07-22 22:06:07 +00:00
return UI : : EVENT_DONE ;
}
2013-10-20 02:45:58 +00:00
UI : : EventReturn GameSettingsScreen : : OnTouchControlLayout ( UI : : EventParams & e ) {
2013-10-09 20:15:56 +00:00
screenManager ( ) - > push ( new TouchControlLayoutScreen ( ) ) ;
return UI : : EVENT_DONE ;
} ;
2013-12-14 12:55:57 +00:00
//when the tilt event type is modified, we need to reset all tilt settings.
//refer to the ResetTiltEvents() function for a detailed explanation.
UI : : EventReturn GameSettingsScreen : : OnTiltTypeChange ( UI : : EventParams & e ) {
TiltEventProcessor : : ResetTiltEvents ( ) ;
return UI : : EVENT_DONE ;
} ;
2015-04-03 09:50:03 +00:00
UI : : EventReturn GameSettingsScreen : : OnTiltCustomize ( UI : : EventParams & e ) {
2013-10-27 17:58:47 +00:00
screenManager ( ) - > push ( new TiltAnalogSettingsScreen ( ) ) ;
return UI : : EVENT_DONE ;
} ;
2015-06-12 18:37:42 +00:00
UI : : EventReturn GameSettingsScreen : : OnSavedataManager ( UI : : EventParams & e ) {
auto saveData = new SavedataScreen ( " " ) ;
screenManager ( ) - > push ( saveData ) ;
return UI : : EVENT_DONE ;
}
2013-07-18 09:39:54 +00:00
void DeveloperToolsScreen : : CreateViews ( ) {
using namespace UI ;
root_ = new ScrollView ( ORIENT_VERTICAL ) ;
2013-09-03 08:42:26 +00:00
I18NCategory * d = GetI18NCategory ( " Dialog " ) ;
I18NCategory * de = GetI18NCategory ( " Developer " ) ;
2013-08-17 11:21:17 +00:00
I18NCategory * gs = GetI18NCategory ( " Graphics " ) ;
2013-07-20 10:06:06 +00:00
I18NCategory * a = GetI18NCategory ( " Audio " ) ;
2013-08-30 15:57:33 +00:00
I18NCategory * s = GetI18NCategory ( " System " ) ;
2013-07-18 09:39:54 +00:00
LinearLayout * list = root_ - > Add ( new LinearLayout ( ORIENT_VERTICAL , new LinearLayoutParams ( 1.0f ) ) ) ;
2013-08-19 22:49:25 +00:00
list - > SetSpacing ( 0 ) ;
2013-08-30 15:10:14 +00:00
list - > Add ( new ItemHeader ( s - > T ( " General " ) ) ) ;
2013-10-20 15:33:18 +00:00
2014-05-27 06:55:48 +00:00
bool canUseJit = true ;
2013-10-20 15:33:18 +00:00
# ifdef IOS
2013-12-01 19:28:20 +00:00
if ( ! iosCanUseJit ) {
2014-05-27 06:55:48 +00:00
canUseJit = false ;
2013-10-20 15:33:18 +00:00
list - > Add ( new TextView ( s - > T ( " DynarecisJailed " , " Dynarec (JIT) - (Not jailbroken - JIT not available) " ) ) ) ;
}
# endif
2014-05-27 07:39:07 +00:00
if ( canUseJit ) {
list - > Add ( new CheckBox ( & g_Config . bJit , s - > T ( " Dynarec " , " Dynarec (JIT) " ) ) ) - > OnClick . Handle ( this , & DeveloperToolsScreen : : OnJitAffectingSetting ) ;
}
2013-10-20 15:33:18 +00:00
2013-09-03 08:42:26 +00:00
list - > Add ( new Choice ( de - > T ( " System Information " ) ) ) - > OnClick . Handle ( this , & DeveloperToolsScreen : : OnSysInfo ) ;
2013-09-07 18:54:11 +00:00
list - > Add ( new CheckBox ( & g_Config . bShowDeveloperMenu , de - > T ( " Show Developer Menu " ) ) ) ;
2014-02-27 06:19:32 +00:00
list - > Add ( new CheckBox ( & g_Config . bDumpDecryptedEboot , de - > T ( " Dump Decrypted Eboot " , " Dump Decrypted EBOOT.BIN (If Encrypted) When Booting Game " ) ) ) ;
2013-10-12 19:34:13 +00:00
Choice * cpuTests = new Choice ( de - > T ( " Run CPU Tests " ) ) ;
list - > Add ( cpuTests ) - > OnClick . Handle ( this , & DeveloperToolsScreen : : OnRunCPUTests ) ;
2013-10-14 07:53:13 +00:00
# ifdef IOS
const std : : string testDirectory = g_Config . flash0Directory + " ../ " ;
# else
2014-10-19 21:20:51 +00:00
const std : : string testDirectory = g_Config . memStickDirectory ;
2013-10-14 07:53:13 +00:00
# endif
if ( ! File : : Exists ( testDirectory + " pspautotests/tests/ " ) ) {
2013-10-12 19:34:13 +00:00
cpuTests - > SetEnabled ( false ) ;
2013-10-14 07:53:13 +00:00
}
2013-10-12 19:34:13 +00:00
2013-10-13 18:14:28 +00:00
list - > Add ( new CheckBox ( & g_Config . bEnableLogging , de - > T ( " Enable Logging " ) ) ) - > OnClick . Handle ( this , & DeveloperToolsScreen : : OnLoggingChanged ) ;
2013-09-28 06:21:59 +00:00
list - > Add ( new Choice ( de - > T ( " Logging Channels " ) ) ) - > OnClick . Handle ( this , & DeveloperToolsScreen : : OnLogConfig ) ;
2013-09-03 08:42:26 +00:00
list - > Add ( new ItemHeader ( de - > T ( " Language " ) ) ) ;
list - > Add ( new Choice ( de - > T ( " Load language ini " ) ) ) - > OnClick . Handle ( this , & DeveloperToolsScreen : : OnLoadLanguageIni ) ;
list - > Add ( new Choice ( de - > T ( " Save language ini " ) ) ) - > OnClick . Handle ( this , & DeveloperToolsScreen : : OnSaveLanguageIni ) ;
2013-10-28 15:04:53 +00:00
list - > Add ( new ItemHeader ( " " ) ) ;
2013-10-25 11:19:08 +00:00
list - > Add ( new Choice ( d - > T ( " Back " ) ) ) - > OnClick . Handle < UIScreen > ( this , & UIScreen : : OnBack ) ;
2013-07-18 09:39:54 +00:00
}
2013-10-25 11:19:08 +00:00
void DeveloperToolsScreen : : onFinish ( DialogResult result ) {
2013-08-04 08:45:09 +00:00
g_Config . Save ( ) ;
2013-07-18 09:39:54 +00:00
}
2013-09-28 06:21:59 +00:00
void GameSettingsScreen : : CallbackRestoreDefaults ( bool yes ) {
2013-10-25 11:19:08 +00:00
if ( yes )
2013-08-28 20:23:16 +00:00
g_Config . RestoreDefaults ( ) ;
2013-09-29 02:41:47 +00:00
host - > UpdateUI ( ) ;
2013-08-28 20:23:16 +00:00
}
2013-09-28 06:21:59 +00:00
UI : : EventReturn GameSettingsScreen : : OnRestoreDefaultSettings ( UI : : EventParams & e ) {
2013-09-03 08:42:26 +00:00
I18NCategory * de = GetI18NCategory ( " Developer " ) ;
2013-08-28 20:23:16 +00:00
I18NCategory * d = GetI18NCategory ( " Dialog " ) ;
2014-12-19 16:03:42 +00:00
if ( g_Config . bGameSpecific )
{
screenManager ( ) - > push (
2014-12-19 18:30:35 +00:00
new PromptScreen ( de - > T ( " RestoreGameDefaultSettings " , " Are you sure you want to restore the game-specific settings back to the ppsspp defaults? \n " ) , d - > T ( " OK " ) , d - > T ( " Cancel " ) ,
2014-12-19 16:03:42 +00:00
std : : bind ( & GameSettingsScreen : : CallbackRestoreDefaults , this , placeholder : : _1 ) ) ) ;
}
else
{
screenManager ( ) - > push (
new PromptScreen ( de - > T ( " RestoreDefaultSettings " , " Are you sure you want to restore all settings(except control mapping) \n back to their defaults? \n You can't undo this. \n Please restart PPSSPP after restoring settings. " ) , d - > T ( " OK " ) , d - > T ( " Cancel " ) ,
std : : bind ( & GameSettingsScreen : : CallbackRestoreDefaults , this , placeholder : : _1 ) ) ) ;
}
2013-08-28 20:23:16 +00:00
return UI : : EVENT_DONE ;
}
2013-08-17 23:24:34 +00:00
UI : : EventReturn DeveloperToolsScreen : : OnLoggingChanged ( UI : : EventParams & e ) {
2013-10-13 18:25:59 +00:00
host - > ToggleDebugConsoleVisibility ( ) ;
2013-08-17 23:24:34 +00:00
return UI : : EVENT_DONE ;
}
2013-08-17 22:41:19 +00:00
UI : : EventReturn DeveloperToolsScreen : : OnSysInfo ( UI : : EventParams & e ) {
screenManager ( ) - > push ( new SystemInfoScreen ( ) ) ;
return UI : : EVENT_DONE ;
}
2013-07-18 09:39:54 +00:00
UI : : EventReturn DeveloperToolsScreen : : OnRunCPUTests ( UI : : EventParams & e ) {
RunTests ( ) ;
return UI : : EVENT_DONE ;
}
2013-07-20 10:06:06 +00:00
2013-08-18 17:51:40 +00:00
UI : : EventReturn DeveloperToolsScreen : : OnSaveLanguageIni ( UI : : EventParams & e ) {
2013-09-16 23:47:25 +00:00
i18nrepo . SaveIni ( g_Config . sLanguageIni ) ;
2013-08-18 17:51:40 +00:00
return UI : : EVENT_DONE ;
}
UI : : EventReturn DeveloperToolsScreen : : OnLoadLanguageIni ( UI : : EventParams & e ) {
2013-09-16 23:47:25 +00:00
i18nrepo . LoadIni ( g_Config . sLanguageIni ) ;
2013-07-20 10:06:06 +00:00
return UI : : EVENT_DONE ;
}
2013-09-07 11:38:37 +00:00
UI : : EventReturn DeveloperToolsScreen : : OnLogConfig ( UI : : EventParams & e ) {
screenManager ( ) - > push ( new LogConfigScreen ( ) ) ;
return UI : : EVENT_DONE ;
}
2014-05-27 06:55:48 +00:00
UI : : EventReturn DeveloperToolsScreen : : OnJitAffectingSetting ( UI : : EventParams & e ) {
NativeMessageReceived ( " clear jit " , " " ) ;
return UI : : EVENT_DONE ;
}
2014-06-02 06:15:07 +00:00
void ProAdhocServerScreen : : CreateViews ( ) {
using namespace UI ;
I18NCategory * s = GetI18NCategory ( " System " ) ;
I18NCategory * d = GetI18NCategory ( " Dialog " ) ;
2014-06-02 10:28:16 +00:00
tempProAdhocServer = g_Config . proAdhocServer ;
2014-06-02 06:15:07 +00:00
root_ = new AnchorLayout ( new LayoutParams ( FILL_PARENT , FILL_PARENT ) ) ;
LinearLayout * leftColumn = new LinearLayout ( ORIENT_VERTICAL , new LinearLayoutParams ( FILL_PARENT , FILL_PARENT ) ) ;
leftColumn - > Add ( new ItemHeader ( s - > T ( " proAdhocServer Address: " ) ) ) ;
2014-06-02 10:21:34 +00:00
addrView_ = new TextView ( tempProAdhocServer , ALIGN_LEFT , false ) ;
leftColumn - > Add ( addrView_ ) ;
2014-06-02 06:15:07 +00:00
LinearLayout * rightColumn = new LinearLayout ( ORIENT_HORIZONTAL , new AnchorLayoutParams ( 0 , 120 , 10 , NONE , NONE , 10 ) ) ;
rightColumn - > Add ( new Button ( " 0 " ) ) - > OnClick . Handle ( this , & ProAdhocServerScreen : : On0Click ) ;
rightColumn - > Add ( new Button ( " 1 " ) ) - > OnClick . Handle ( this , & ProAdhocServerScreen : : On1Click ) ;
rightColumn - > Add ( new Button ( " 2 " ) ) - > OnClick . Handle ( this , & ProAdhocServerScreen : : On2Click ) ;
rightColumn - > Add ( new Button ( " 3 " ) ) - > OnClick . Handle ( this , & ProAdhocServerScreen : : On3Click ) ;
rightColumn - > Add ( new Button ( " 4 " ) ) - > OnClick . Handle ( this , & ProAdhocServerScreen : : On4Click ) ;
rightColumn - > Add ( new Button ( " 5 " ) ) - > OnClick . Handle ( this , & ProAdhocServerScreen : : On5Click ) ;
rightColumn - > Add ( new Button ( " 6 " ) ) - > OnClick . Handle ( this , & ProAdhocServerScreen : : On6Click ) ;
rightColumn - > Add ( new Button ( " 7 " ) ) - > OnClick . Handle ( this , & ProAdhocServerScreen : : On7Click ) ;
rightColumn - > Add ( new Button ( " 8 " ) ) - > OnClick . Handle ( this , & ProAdhocServerScreen : : On8Click ) ;
rightColumn - > Add ( new Button ( " 9 " ) ) - > OnClick . Handle ( this , & ProAdhocServerScreen : : On9Click ) ;
rightColumn - > Add ( new Button ( " . " ) ) - > OnClick . Handle ( this , & ProAdhocServerScreen : : OnPointClick ) ;
rightColumn - > Add ( new Button ( d - > T ( " Delete " ) ) ) - > OnClick . Handle ( this , & ProAdhocServerScreen : : OnDeleteClick ) ;
rightColumn - > Add ( new Button ( d - > T ( " Delete all " ) ) ) - > OnClick . Handle ( this , & ProAdhocServerScreen : : OnDeleteAllClick ) ;
rightColumn - > Add ( new Button ( d - > T ( " OK " ) ) ) - > OnClick . Handle ( this , & ProAdhocServerScreen : : OnOKClick ) ;
rightColumn - > Add ( new Button ( d - > T ( " Cancel " ) ) ) - > OnClick . Handle ( this , & ProAdhocServerScreen : : OnCancelClick ) ;
root_ - > Add ( leftColumn ) ;
root_ - > Add ( rightColumn ) ;
}
UI : : EventReturn ProAdhocServerScreen : : On0Click ( UI : : EventParams & e ) {
if ( tempProAdhocServer . length ( ) > 0 )
tempProAdhocServer . append ( " 0 " ) ;
2014-06-02 10:21:34 +00:00
addrView_ - > SetText ( tempProAdhocServer ) ;
2014-06-02 06:15:07 +00:00
return UI : : EVENT_DONE ;
}
UI : : EventReturn ProAdhocServerScreen : : On1Click ( UI : : EventParams & e ) {
tempProAdhocServer . append ( " 1 " ) ;
2014-06-02 10:21:34 +00:00
addrView_ - > SetText ( tempProAdhocServer ) ;
2014-06-02 06:15:07 +00:00
return UI : : EVENT_DONE ;
}
UI : : EventReturn ProAdhocServerScreen : : On2Click ( UI : : EventParams & e ) {
tempProAdhocServer . append ( " 2 " ) ;
2014-06-02 10:21:34 +00:00
addrView_ - > SetText ( tempProAdhocServer ) ;
2014-06-02 06:15:07 +00:00
return UI : : EVENT_DONE ;
}
UI : : EventReturn ProAdhocServerScreen : : On3Click ( UI : : EventParams & e ) {
tempProAdhocServer . append ( " 3 " ) ;
2014-06-02 10:21:34 +00:00
addrView_ - > SetText ( tempProAdhocServer ) ;
2014-06-02 06:15:07 +00:00
return UI : : EVENT_DONE ;
}
UI : : EventReturn ProAdhocServerScreen : : On4Click ( UI : : EventParams & e ) {
tempProAdhocServer . append ( " 4 " ) ;
2014-06-02 10:21:34 +00:00
addrView_ - > SetText ( tempProAdhocServer ) ;
2014-06-02 06:15:07 +00:00
return UI : : EVENT_DONE ;
}
UI : : EventReturn ProAdhocServerScreen : : On5Click ( UI : : EventParams & e ) {
tempProAdhocServer . append ( " 5 " ) ;
2014-06-02 10:21:34 +00:00
addrView_ - > SetText ( tempProAdhocServer ) ;
2014-06-02 06:15:07 +00:00
return UI : : EVENT_DONE ;
}
UI : : EventReturn ProAdhocServerScreen : : On6Click ( UI : : EventParams & e ) {
tempProAdhocServer . append ( " 6 " ) ;
2014-06-02 10:21:34 +00:00
addrView_ - > SetText ( tempProAdhocServer ) ;
2014-06-02 06:15:07 +00:00
return UI : : EVENT_DONE ;
}
UI : : EventReturn ProAdhocServerScreen : : On7Click ( UI : : EventParams & e ) {
tempProAdhocServer . append ( " 7 " ) ;
2014-06-02 10:21:34 +00:00
addrView_ - > SetText ( tempProAdhocServer ) ;
2014-06-02 06:15:07 +00:00
return UI : : EVENT_DONE ;
}
UI : : EventReturn ProAdhocServerScreen : : On8Click ( UI : : EventParams & e ) {
tempProAdhocServer . append ( " 8 " ) ;
2014-06-02 10:21:34 +00:00
addrView_ - > SetText ( tempProAdhocServer ) ;
2014-06-02 06:15:07 +00:00
return UI : : EVENT_DONE ;
}
UI : : EventReturn ProAdhocServerScreen : : On9Click ( UI : : EventParams & e ) {
tempProAdhocServer . append ( " 9 " ) ;
2014-06-02 10:21:34 +00:00
addrView_ - > SetText ( tempProAdhocServer ) ;
2014-06-02 06:15:07 +00:00
return UI : : EVENT_DONE ;
}
UI : : EventReturn ProAdhocServerScreen : : OnPointClick ( UI : : EventParams & e ) {
if ( tempProAdhocServer . length ( ) > 0 & & tempProAdhocServer . at ( tempProAdhocServer . length ( ) - 1 ) ! = ' . ' )
tempProAdhocServer . append ( " . " ) ;
2014-06-02 10:21:34 +00:00
addrView_ - > SetText ( tempProAdhocServer ) ;
2014-06-02 06:15:07 +00:00
return UI : : EVENT_DONE ;
}
UI : : EventReturn ProAdhocServerScreen : : OnDeleteClick ( UI : : EventParams & e ) {
if ( tempProAdhocServer . length ( ) > 0 )
tempProAdhocServer . erase ( tempProAdhocServer . length ( ) - 1 , 1 ) ;
2014-06-02 10:21:34 +00:00
addrView_ - > SetText ( tempProAdhocServer ) ;
2014-06-02 06:15:07 +00:00
return UI : : EVENT_DONE ;
}
UI : : EventReturn ProAdhocServerScreen : : OnDeleteAllClick ( UI : : EventParams & e ) {
tempProAdhocServer = " " ;
2014-06-02 10:21:34 +00:00
addrView_ - > SetText ( tempProAdhocServer ) ;
2014-06-02 06:15:07 +00:00
return UI : : EVENT_DONE ;
}
UI : : EventReturn ProAdhocServerScreen : : OnOKClick ( UI : : EventParams & e ) {
g_Config . proAdhocServer = tempProAdhocServer ;
UIScreen : : OnBack ( e ) ;
return UI : : EVENT_DONE ;
}
UI : : EventReturn ProAdhocServerScreen : : OnCancelClick ( UI : : EventParams & e ) {
tempProAdhocServer = g_Config . proAdhocServer ;
UIScreen : : OnBack ( e ) ;
return UI : : EVENT_DONE ;
}