2013-05-03 18:22:48 +02:00
// Copyright (c) 2012- PPSSPP Project.
2012-11-01 16:19:01 +01: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
2012-11-04 23:58:25 +01:00
// the Free Software Foundation, version 2.0 or later versions.
2012-11-01 16:19:01 +01:00
// 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/.
# include <cmath>
# include <string>
2013-03-21 19:28:20 +01:00
# include <cstdio>
# ifdef _MSC_VER
# define snprintf _snprintf
2013-06-03 21:13:17 +08:00
# pragma execution_character_set("utf-8")
2013-03-21 19:28:20 +01:00
# endif
2012-11-01 16:19:01 +01:00
# include "base/display.h"
# include "base/logging.h"
# include "base/colorutil.h"
# include "base/timeutil.h"
# include "base/NativeApp.h"
2013-04-18 11:58:54 +02:00
# include "i18n/i18n.h"
2013-04-18 23:42:44 +02:00
# include "file/vfs.h"
2012-11-01 16:19:01 +01:00
# include "gfx_es2/glsl_program.h"
2013-02-22 22:14:17 +01:00
# include "gfx_es2/gl_state.h"
2012-11-01 16:19:01 +01:00
# include "input/input_state.h"
# include "math/curves.h"
# include "ui/ui.h"
2013-03-30 20:10:32 +01:00
# include "ui/ui_context.h"
2012-11-01 16:19:01 +01:00
# include "ui_atlas.h"
2013-01-02 21:00:10 +01:00
# include "util/text/utf8.h"
2012-11-01 16:19:01 +01:00
# include "UIShader.h"
2013-05-03 16:22:15 +10:00
# include "Common/StringUtils.h"
2013-03-29 19:32:20 +01:00
# include "Core/System.h"
2013-03-31 01:04:46 +01:00
# include "Core/CoreParameter.h"
2013-06-01 19:01:43 +02:00
# include "Core/HW/atrac3plus.h"
2013-03-29 19:32:20 +01:00
# include "GPU/ge_constants.h"
# include "GPU/GPUState.h"
# include "GPU/GPUInterface.h"
# include "Core/Config.h"
# include "Core/CoreParameter.h"
2013-05-14 01:27:37 -07:00
# include "Core/Reporting.h"
2013-03-29 19:32:20 +01:00
# include "Core/SaveState.h"
2013-04-21 20:56:21 +02:00
# include "Core/HLE/sceUtility.h"
2012-11-01 16:19:01 +01:00
2013-06-03 00:42:19 +02:00
# include "UI/MenuScreens.h"
2013-06-08 22:42:31 +02:00
# include "UI/GameScreen.h"
2013-06-03 00:42:19 +02:00
# include "UI/EmuScreen.h"
# include "UI/PluginScreen.h"
2013-06-10 22:06:51 +02:00
# include "UI/MainScreen.h"
2013-06-03 00:42:19 +02:00
2013-03-30 19:23:20 +01:00
# include "GameInfoCache.h"
2013-03-30 15:44:10 +01:00
# include "android/jni/TestRunner.h"
2012-11-01 16:19:01 +01:00
2013-01-11 19:43:42 +10:00
# ifdef USING_QT_UI
# include <QFileDialog>
# include <QFile>
# include <QDir>
# endif
2013-06-03 21:13:17 +08:00
# ifdef _WIN32
namespace MainWindow {
extern HWND hwndMain ;
void BrowseAndBoot ( std : : string defaultPath ) ;
}
# endif
2013-04-11 15:16:45 +10:00
# if !defined(nullptr)
# define nullptr NULL
# endif
2013-01-02 21:00:10 +01:00
// Ugly communication with NativeApp
extern std : : string game_title ;
2013-04-23 14:36:53 +09:00
// Detect jailbreak for iOS(Non-jailbreak iDevice doesn't support JIT)
# ifdef IOS
extern bool isJailed ;
# endif
2012-11-01 16:19:01 +01:00
static const int symbols [ 4 ] = {
I_CROSS ,
I_CIRCLE ,
I_SQUARE ,
I_TRIANGLE
} ;
static const uint32_t colors [ 4 ] = {
0xC0FFFFFF ,
0xC0FFFFFF ,
0xC0FFFFFF ,
0xC0FFFFFF ,
} ;
2013-06-03 00:42:19 +02:00
void DrawBackground ( float alpha ) {
2012-11-01 16:19:01 +01:00
static float xbase [ 100 ] = { 0 } ;
static float ybase [ 100 ] = { 0 } ;
2013-03-30 15:44:10 +01:00
static int last_dp_xres = 0 ;
static int last_dp_yres = 0 ;
if ( xbase [ 0 ] = = 0.0f | | last_dp_xres ! = dp_xres | | last_dp_yres ! = dp_yres ) {
2012-11-01 16:19:01 +01:00
GMRng rng ;
for ( int i = 0 ; i < 100 ; i + + ) {
xbase [ i ] = rng . F ( ) * dp_xres ;
ybase [ i ] = rng . F ( ) * dp_yres ;
}
2013-03-30 15:44:10 +01:00
last_dp_xres = dp_xres ;
last_dp_yres = dp_yres ;
2012-11-01 16:19:01 +01:00
}
2013-02-22 22:14:17 +01:00
glstate . depthWrite . set ( GL_TRUE ) ;
glstate . colorMask . set ( GL_TRUE , GL_TRUE , GL_TRUE , GL_TRUE ) ;
2012-11-01 16:19:01 +01:00
glClearColor ( 0.1f , 0.2f , 0.43f , 1.0f ) ;
glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT ) ;
ui_draw2d . DrawImageStretch ( I_BG , 0 , 0 , dp_xres , dp_yres ) ;
float t = time_now ( ) ;
for ( int i = 0 ; i < 100 ; i + + ) {
float x = xbase [ i ] ;
float y = ybase [ i ] + 40 * cos ( i * 7.2 + t * 1.3 ) ;
float angle = sin ( i + t ) ;
int n = i & 3 ;
ui_draw2d . DrawImageRotated ( symbols [ n ] , x , y , 1.0f , angle , colorAlpha ( colors [ n ] , alpha * 0.1f ) ) ;
}
}
// For private alphas, etc.
void DrawWatermark ( ) {
// ui_draw2d.DrawTextShadow(UBUNTU24, "PRIVATE BUILD", dp_xres / 2, 10, 0xFF0000FF, ALIGN_HCENTER);
}
void LogoScreen : : update ( InputState & input_state ) {
frames_ + + ;
if ( frames_ > 180 | | input_state . pointer_down [ 0 ] ) {
if ( bootFilename_ . size ( ) ) {
screenManager ( ) - > switchScreen ( new EmuScreen ( bootFilename_ ) ) ;
} else {
2013-06-10 22:06:51 +02:00
if ( g_Config . bNewUI )
screenManager ( ) - > switchScreen ( new MainScreen ( ) ) ;
else
screenManager ( ) - > switchScreen ( new MenuScreen ( ) ) ;
2012-11-01 16:19:01 +01:00
}
}
}
2013-03-31 18:06:25 -07:00
void LogoScreen : : sendMessage ( const char * message , const char * value ) {
if ( ! strcmp ( message , " boot " ) ) {
screenManager ( ) - > switchScreen ( new EmuScreen ( value ) ) ;
}
}
2012-11-01 16:19:01 +01:00
void LogoScreen : : render ( ) {
float t = ( float ) frames_ / 60.0f ;
float alpha = t ;
if ( t > 1.0f ) alpha = 1.0f ;
float alphaText = alpha ;
if ( t > 2.0f ) alphaText = 3.0f - t ;
UIShader_Prepare ( ) ;
2013-03-30 19:23:20 +01:00
UIBegin ( UIShader_Get ( ) ) ;
2012-11-01 16:19:01 +01:00
DrawBackground ( alpha ) ;
2013-06-30 20:00:35 -03:00
I18NCategory * c = GetI18NCategory ( " PSPCredits " ) ;
char temp [ 256 ] ;
sprintf ( temp , " %s Henrik Rydgård " , c - > T ( " created " , " Created by " ) ) ;
2012-11-01 16:19:01 +01:00
2012-12-27 00:18:45 +01:00
ui_draw2d . SetFontScale ( 1.5f , 1.5f ) ;
2012-11-01 16:19:01 +01:00
ui_draw2d . DrawText ( UBUNTU48 , " PPSSPP " , dp_xres / 2 , dp_yres / 2 - 30 , colorAlpha ( 0xFFFFFFFF , alphaText ) , ALIGN_CENTER ) ;
2012-12-27 00:18:45 +01:00
ui_draw2d . SetFontScale ( 1.0f , 1.0f ) ;
2013-06-30 20:00:35 -03:00
ui_draw2d . DrawText ( UBUNTU24 , temp , dp_xres / 2 , dp_yres / 2 + 40 , colorAlpha ( 0xFFFFFFFF , alphaText ) , ALIGN_CENTER ) ;
ui_draw2d . DrawText ( UBUNTU24 , c - > T ( " license " , " Free Software under GPL 2.0 " ) , dp_xres / 2 , dp_yres / 2 + 70 , colorAlpha ( 0xFFFFFFFF , alphaText ) , ALIGN_CENTER ) ;
2012-11-01 16:19:01 +01:00
ui_draw2d . DrawText ( UBUNTU24 , " www.ppsspp.org " , dp_xres / 2 , dp_yres / 2 + 130 , colorAlpha ( 0xFFFFFFFF , alphaText ) , ALIGN_CENTER ) ;
if ( bootFilename_ . size ( ) ) {
ui_draw2d . DrawText ( UBUNTU24 , bootFilename_ . c_str ( ) , dp_xres / 2 , dp_yres / 2 + 180 , colorAlpha ( 0xFFFFFFFF , alphaText ) , ALIGN_CENTER ) ;
}
DrawWatermark ( ) ;
UIEnd ( ) ;
}
// ==================
// Menu Screen
// ==================
2013-05-31 23:10:14 +02:00
MenuScreen : : MenuScreen ( ) : frames_ ( 0 ) {
2013-06-25 23:29:49 +02:00
// If first run, let's show the user an easy way to access the atrac3plus download screen.
showAtracShortcut_ = g_Config . bFirstRun & & ! Atrac3plus_Decoder : : IsInstalled ( ) ;
2013-05-31 23:10:14 +02:00
}
2013-06-26 21:26:44 +02:00
void MenuScreen : : dialogFinished ( const Screen * dialog , DialogResult result ) {
showAtracShortcut_ = showAtracShortcut_ & & ! Atrac3plus_Decoder : : IsInstalled ( ) ;
}
2012-11-01 16:19:01 +01:00
void MenuScreen : : update ( InputState & input_state ) {
2013-03-29 19:32:20 +01:00
globalUIState = UISTATE_MENU ;
2012-11-01 16:19:01 +01:00
frames_ + + ;
}
2013-03-29 19:32:20 +01:00
void MenuScreen : : sendMessage ( const char * message , const char * value ) {
if ( ! strcmp ( message , " boot " ) ) {
screenManager ( ) - > switchScreen ( new EmuScreen ( value ) ) ;
}
}
2012-11-01 16:19:01 +01:00
void MenuScreen : : render ( ) {
UIShader_Prepare ( ) ;
2013-03-30 19:23:20 +01:00
UIBegin ( UIShader_Get ( ) ) ;
2012-11-01 16:19:01 +01:00
DrawBackground ( 1.0f ) ;
double xoff = 150 - frames_ * frames_ * 0.4f ;
if ( xoff < - 20 )
xoff = - 20 ;
2013-01-26 23:46:02 +01:00
if ( frames_ > 200 ) // seems the above goes nuts after a while...
xoff = - 20 ;
2012-11-01 16:19:01 +01:00
2013-06-16 22:49:26 +02:00
int w = LARGE_BUTTON_WIDTH + 70 ;
2012-11-01 16:19:01 +01:00
2013-03-11 19:27:58 +01:00
ui_draw2d . DrawTextShadow ( UBUNTU48 , " PPSSPP " , dp_xres + xoff - w / 2 , 75 , 0xFFFFFFFF , ALIGN_HCENTER | ALIGN_BOTTOM ) ;
2012-11-01 16:19:01 +01:00
ui_draw2d . SetFontScale ( 0.7f , 0.7f ) ;
2013-05-25 12:34:43 +08:00
ui_draw2d . DrawTextShadow ( UBUNTU24 , PPSSPP_GIT_VERSION , dp_xres + xoff , 95 , 0xFFFFFFFF , ALIGN_RIGHT | ALIGN_BOTTOM ) ;
2012-11-01 16:19:01 +01:00
ui_draw2d . SetFontScale ( 1.0f , 1.0f ) ;
2013-03-11 19:27:58 +01:00
VLinear vlinear ( dp_xres + xoff , 100 , 20 ) ;
2012-11-01 16:19:01 +01:00
2013-04-18 11:58:54 +02:00
I18NCategory * m = GetI18NCategory ( " MainMenu " ) ;
if ( UIButton ( GEN_ID , vlinear , w , 0 , m - > T ( " Load " , " Load... " ) , ALIGN_RIGHT ) ) {
2013-04-12 02:58:58 +10:00
# if defined(USING_QT_UI) && !defined(MEEGO_EDITION_HARMATTAN)
2013-01-11 19:43:42 +10:00
QString fileName = QFileDialog : : getOpenFileName ( NULL , " Load ROM " , g_Config . currentDirectory . c_str ( ) , " PSP ROMs (*.iso *.cso *.pbp *.elf) " ) ;
if ( QFile : : exists ( fileName ) ) {
QDir newPath ;
g_Config . currentDirectory = newPath . filePath ( fileName ) . toStdString ( ) ;
g_Config . Save ( ) ;
screenManager ( ) - > switchScreen ( new EmuScreen ( fileName . toStdString ( ) ) ) ;
}
2013-04-13 21:26:18 +02:00
# elif _WIN32
MainWindow : : BrowseAndBoot ( " " ) ;
2013-01-11 19:43:42 +10:00
# else
2012-11-01 16:19:01 +01:00
FileSelectScreenOptions options ;
options . allowChooseDirectory = true ;
2012-11-10 10:15:11 +01:00
options . filter = " iso:cso:pbp:elf:prx: " ;
2012-11-01 16:19:01 +01:00
options . folderIcon = I_ICON_FOLDER ;
options . iconMapping [ " iso " ] = I_ICON_UMD ;
options . iconMapping [ " cso " ] = I_ICON_UMD ;
options . iconMapping [ " pbp " ] = I_ICON_EXE ;
options . iconMapping [ " elf " ] = I_ICON_EXE ;
screenManager ( ) - > switchScreen ( new FileSelectScreen ( options ) ) ;
2013-01-11 19:43:42 +10:00
# endif
2012-11-01 16:19:01 +01:00
UIReset ( ) ;
}
2013-04-18 11:58:54 +02:00
if ( UIButton ( GEN_ID , vlinear , w , 0 , m - > T ( " Settings " ) , ALIGN_RIGHT ) ) {
2013-03-02 17:47:37 +01:00
screenManager ( ) - > push ( new SettingsScreen ( ) , 0 ) ;
2012-11-01 16:19:01 +01:00
UIReset ( ) ;
}
2013-04-18 11:58:54 +02:00
if ( UIButton ( GEN_ID , vlinear , w , 0 , m - > T ( " Credits " ) , ALIGN_RIGHT ) ) {
2013-06-10 22:06:51 +02:00
screenManager ( ) - > push ( new CreditsScreen ( ) ) ;
2012-11-01 16:19:01 +01:00
UIReset ( ) ;
}
2013-04-18 11:58:54 +02:00
if ( UIButton ( GEN_ID , vlinear , w , 0 , m - > T ( " Exit " ) , ALIGN_RIGHT ) ) {
2012-11-01 16:19:01 +01:00
// TODO: Need a more elegant way to quit
2013-04-14 11:58:28 +02:00
# ifdef _WIN32
2013-06-03 21:13:17 +08:00
PostMessage ( MainWindow : : hwndMain , WM_CLOSE , 0 , 0 ) ;
2013-04-14 11:58:28 +02:00
# else
2013-06-03 21:13:17 +08:00
// TODO: Save when setting changes, rather than when we quit
NativeShutdown ( ) ;
2012-11-01 16:19:01 +01:00
exit ( 0 ) ;
2013-04-14 11:58:28 +02:00
# endif
2012-11-01 16:19:01 +01:00
}
2013-04-13 15:06:18 +02:00
if ( UIButton ( GEN_ID , vlinear , w , 0 , " www.ppsspp.org " , ALIGN_RIGHT ) ) {
2012-11-01 16:19:01 +01:00
LaunchBrowser ( " http://www.ppsspp.org/ " ) ;
}
2013-06-15 11:40:31 +02:00
// Skip the forum button if screen too small. Will be redesigned in new UI later.
if ( dp_yres > 510 ) {
if ( UIButton ( GEN_ID , vlinear , w , 0 , " forums.ppsspp.org " , ALIGN_RIGHT ) ) {
LaunchBrowser ( " http://forums.ppsspp.org/ " ) ;
}
}
2013-06-25 23:29:49 +02:00
if ( showAtracShortcut_ ) {
if ( UIButton ( GEN_ID , Pos ( 10 , dp_yres - 10 ) , 500 , 50 , " Download audio plugin " , ALIGN_BOTTOMLEFT ) ) {
screenManager ( ) - > push ( new PluginScreen ( ) ) ;
}
}
2013-03-24 20:03:42 +01:00
int recentW = 350 ;
if ( g_Config . recentIsos . size ( ) ) {
2013-04-18 11:58:54 +02:00
ui_draw2d . DrawText ( UBUNTU24 , m - > T ( " Recent " ) , - xoff , 80 , 0xFFFFFFFF , ALIGN_BOTTOMLEFT ) ;
2013-03-24 20:03:42 +01:00
}
2013-04-14 11:48:54 +02:00
int spacing = 15 ;
float textureButtonWidth = 144 ;
float textureButtonHeight = 80 ;
if ( dp_yres < 480 )
spacing = 8 ;
2013-06-25 23:29:49 +02:00
int extraSpace = 0 ;
if ( showAtracShortcut_ )
extraSpace = 60 ;
if ( showAtracShortcut_ )
2013-04-14 11:48:54 +02:00
// On small screens, we can't fit four vertically.
if ( 100 + spacing * 6 + textureButtonHeight * 4 > dp_yres ) {
textureButtonHeight = ( dp_yres - 100 - spacing * 6 ) / 4 ;
textureButtonWidth = ( textureButtonHeight / 80 ) * 144 ;
}
2013-06-25 23:29:49 +02:00
VGrid vgrid_recent ( - xoff , 100 , std : : min ( dp_yres - spacing * 2 - extraSpace , 480 ) , spacing , spacing ) ;
2013-04-14 11:48:54 +02:00
2013-03-24 20:03:42 +01:00
for ( size_t i = 0 ; i < g_Config . recentIsos . size ( ) ; i + + ) {
std : : string filename ;
2013-03-29 21:21:27 +01:00
std : : string rec = g_Config . recentIsos [ i ] ;
for ( size_t j = 0 ; j < rec . size ( ) ; j + + )
if ( rec [ j ] = = ' \\ ' ) rec [ j ] = ' / ' ;
SplitPath ( rec , nullptr , & filename , nullptr ) ;
2013-03-30 19:23:20 +01:00
UIContext * ctx = screenManager ( ) - > getUIContext ( ) ;
// This might create a texture so we must flush first.
UIFlush ( ) ;
GameInfo * ginfo = g_gameInfoCache . GetInfo ( g_Config . recentIsos [ i ] , false ) ;
2013-06-23 16:24:45 +02:00
if ( ginfo ) {
2013-04-13 21:24:07 +02:00
u32 color ;
if ( ginfo - > iconTexture = = 0 ) {
color = 0 ;
} else {
color = whiteAlpha ( ease ( ( time_now_d ( ) - ginfo - > timeIconWasLoaded ) * 2 ) ) ;
}
2013-04-17 17:09:13 +02:00
if ( UITextureButton ( ctx , ( int ) GEN_ID_LOOP ( i ) , vgrid_recent , textureButtonWidth , textureButtonHeight , ginfo - > iconTexture , ALIGN_LEFT , color , I_DROP_SHADOW ) ) {
2013-04-21 19:32:29 +02:00
UIEnd ( ) ;
2013-06-08 22:42:31 +02:00
// To try some new UI, enable this.
2013-06-09 13:41:15 +02:00
// screenManager()->switchScreen(new GameScreen(g_Config.recentIsos[i]));
screenManager ( ) - > switchScreen ( new EmuScreen ( g_Config . recentIsos [ i ] ) ) ;
2013-04-21 19:32:29 +02:00
return ;
2013-03-30 19:23:20 +01:00
}
} else {
2013-04-14 11:48:54 +02:00
if ( UIButton ( ( int ) GEN_ID_LOOP ( i ) , vgrid_recent , textureButtonWidth , textureButtonHeight , filename . c_str ( ) , ALIGN_LEFT ) ) {
2013-04-21 19:32:29 +02:00
UIEnd ( ) ;
2013-06-09 13:41:15 +02:00
// screenManager()->switchScreen(new GameScreen(g_Config.recentIsos[i]));
screenManager ( ) - > switchScreen ( new EmuScreen ( g_Config . recentIsos [ i ] ) ) ;
2013-04-21 19:32:29 +02:00
return ;
2013-03-30 19:23:20 +01:00
}
2013-03-24 20:03:42 +01:00
}
}
2013-04-14 11:48:54 +02:00
# if defined(_DEBUG) & defined(_WIN32)
// Print the current dp_xres/yres in the corner. For UI scaling testing - just
// resize to 800x480 to get an idea of what it will look like on a Nexus S.
2013-05-25 12:34:43 +08:00
ui_draw2d . SetFontScale ( 0.6 , 0.6 ) ;
2013-04-14 11:48:54 +02:00
char temptext [ 64 ] ;
sprintf ( temptext , " %ix%i " , dp_xres , dp_yres ) ;
ui_draw2d . DrawTextShadow ( UBUNTU24 , temptext , 5 , dp_yres - 5 , 0xFFFFFFFF , ALIGN_BOTTOMLEFT ) ;
ui_draw2d . SetFontScale ( 1.0 , 1.0 ) ;
# endif
2012-11-01 16:19:01 +01:00
DrawWatermark ( ) ;
UIEnd ( ) ;
}
2013-03-29 18:50:08 +01:00
void PauseScreen : : update ( InputState & input ) {
2013-03-29 19:32:20 +01:00
globalUIState = UISTATE_PAUSEMENU ;
2012-11-01 16:19:01 +01:00
if ( input . pad_buttons_down & PAD_BUTTON_BACK ) {
screenManager ( ) - > finishDialog ( this , DR_CANCEL ) ;
}
}
2013-03-29 18:50:08 +01:00
void PauseScreen : : sendMessage ( const char * msg , const char * value ) {
if ( ! strcmp ( msg , " run " ) ) {
screenManager ( ) - > finishDialog ( this , DR_CANCEL ) ;
2013-05-28 15:51:26 +08:00
} else if ( ! strcmp ( msg , " stop " ) ) {
screenManager ( ) - > finishDialog ( this , DR_OK ) ;
2013-03-29 18:50:08 +01:00
}
}
void PauseScreen : : render ( ) {
2012-11-01 16:19:01 +01:00
UIShader_Prepare ( ) ;
2013-03-30 19:23:20 +01:00
UIBegin ( UIShader_Get ( ) ) ;
2012-11-01 16:19:01 +01:00
DrawBackground ( 1.0f ) ;
2013-04-17 16:37:15 +02:00
std : : string title = game_title . c_str ( ) ;
2013-03-11 21:32:14 +01:00
// Try to ignore (tm) etc.
2013-04-17 16:37:15 +02:00
//if (UTF8StringNonASCIICount(game_title.c_str()) > 2) {
// title = "(can't display japanese title)";
//} else {
//}
2013-01-02 21:00:10 +01:00
2013-03-31 01:04:46 +01:00
UIContext * ctx = screenManager ( ) - > getUIContext ( ) ;
// This might create a texture so we must flush first.
UIFlush ( ) ;
GameInfo * ginfo = g_gameInfoCache . GetInfo ( PSP_CoreParameter ( ) . fileToStart , true ) ;
2013-04-17 16:37:15 +02:00
if ( ginfo ) {
title = ginfo - > title ;
}
2013-04-01 12:35:02 +02:00
if ( ginfo & & ginfo - > pic1Texture ) {
ginfo - > pic1Texture - > Bind ( 0 ) ;
2013-04-18 15:08:01 +02:00
uint32_t color = whiteAlpha ( ease ( ( time_now_d ( ) - ginfo - > timePic1WasLoaded ) * 3 ) ) & 0xFFc0c0c0 ;
ui_draw2d . DrawTexRect ( 0 , 0 , dp_xres , dp_yres , 0 , 0 , 1 , 1 , color ) ;
2013-03-31 01:04:46 +01:00
ui_draw2d . Flush ( ) ;
ctx - > RebindTexture ( ) ;
}
2013-04-01 12:35:02 +02:00
if ( ginfo & & ginfo - > pic0Texture ) {
ginfo - > pic0Texture - > Bind ( 0 ) ;
// Pic0 is drawn in the bottom right corner, overlaying pic1.
float sizeX = dp_xres / 480 * ginfo - > pic0Texture - > Width ( ) ;
float sizeY = dp_yres / 272 * ginfo - > pic0Texture - > Height ( ) ;
2013-04-18 15:08:01 +02:00
uint32_t color = whiteAlpha ( ease ( ( time_now_d ( ) - ginfo - > timePic1WasLoaded ) * 2 ) ) & 0xFFc0c0c0 ;
ui_draw2d . DrawTexRect ( dp_xres - sizeX , dp_yres - sizeY , dp_xres , dp_yres , 0 , 0 , 1 , 1 , color ) ;
2013-04-01 12:35:02 +02:00
ui_draw2d . Flush ( ) ;
ctx - > RebindTexture ( ) ;
}
2013-03-31 01:04:46 +01:00
if ( ginfo & & ginfo - > iconTexture ) {
2013-04-18 15:08:01 +02:00
uint32_t color = whiteAlpha ( ease ( ( time_now_d ( ) - ginfo - > timeIconWasLoaded ) * 1.5 ) ) ;
2013-03-31 01:04:46 +01:00
ginfo - > iconTexture - > Bind ( 0 ) ;
2013-04-28 16:57:52 -07:00
// Maintain the icon's aspect ratio. Minis are square, for example.
float iconAspect = ( float ) ginfo - > iconTexture - > Width ( ) / ( float ) ginfo - > iconTexture - > Height ( ) ;
float h = 80.0f ;
float w = 144.0f ;
float x = 10.0f + ( w - h * iconAspect ) / 2.0f ;
w = h * iconAspect ;
ui_draw2d . DrawTexRect ( x , 10 , x + w , 10 + h , 0 , 0 , 1 , 1 , 0xFFFFFFFF ) ;
2013-03-31 01:04:46 +01:00
ui_draw2d . Flush ( ) ;
ctx - > RebindTexture ( ) ;
}
2013-04-18 09:01:23 +08:00
ui_draw2d . DrawText ( UBUNTU24 , title . c_str ( ) , 10 + 144 + 10 , 30 , 0xFFFFFFFF , ALIGN_LEFT ) ;
2012-11-01 16:19:01 +01:00
2013-06-03 16:25:48 +08:00
I18NCategory * i = GetI18NCategory ( " Pause " ) ;
VLinear vlinear ( dp_xres - 10 , 100 , 20 ) ;
if ( UIButton ( GEN_ID , vlinear , LARGE_BUTTON_WIDTH + 40 , 0 , i - > T ( " Continue " ) , ALIGN_RIGHT ) ) {
screenManager ( ) - > finishDialog ( this , DR_CANCEL ) ;
}
if ( UIButton ( GEN_ID , vlinear , LARGE_BUTTON_WIDTH + 40 , 0 , i - > T ( " Settings " ) , ALIGN_RIGHT ) ) {
screenManager ( ) - > push ( new SettingsScreen ( ) , 0 ) ;
}
if ( UIButton ( GEN_ID , vlinear , LARGE_BUTTON_WIDTH + 40 , 0 , i - > T ( " Back to Menu " ) , ALIGN_RIGHT ) ) {
screenManager ( ) - > finishDialog ( this , DR_OK ) ;
}
/*
if ( UIButton ( GEN_ID , Pos ( dp_xres - 10 , dp_yres - 10 ) , LARGE_BUTTON_WIDTH * 2 , 0 , " Debug: Dump Next Frame " , ALIGN_BOTTOMRIGHT ) ) {
gpu - > DumpNextFrame ( ) ;
}
*/
2012-12-26 21:08:41 +01:00
int x = 30 ;
2013-06-03 16:25:48 +08:00
int y = 60 ;
2013-03-11 22:22:07 +01:00
int stride = 40 ;
2013-03-25 15:57:06 +08:00
int columnw = 400 ;
2013-04-18 11:58:54 +02:00
// Shared with settings
I18NCategory * ss = GetI18NCategory ( " System " ) ;
I18NCategory * gs = GetI18NCategory ( " Graphics " ) ;
2013-05-03 09:10:02 +08:00
I18NCategory * a = GetI18NCategory ( " Audio " ) ;
2013-05-03 20:23:43 +08:00
UICheckBox ( GEN_ID , x , y + = stride , a - > T ( " Enable Sound " ) , ALIGN_TOPLEFT , & g_Config . bEnableSound ) ;
2013-02-13 18:21:21 +01:00
// TODO: Maybe shouldn't show this if the screen ratios are very close...
2013-06-21 15:40:52 +10:00
# ifdef BLACKBERRY
2013-05-08 23:22:45 +10:00
if ( pixel_xres = = pixel_yres )
UICheckBox ( GEN_ID , x , y + = stride , gs - > T ( " Partial Vertical Stretch " ) , ALIGN_TOPLEFT , & g_Config . bPartialStretch ) ;
# endif
2013-04-18 11:58:54 +02:00
UICheckBox ( GEN_ID , x , y + = stride , gs - > T ( " Stretch to Display " ) , ALIGN_TOPLEFT , & g_Config . bStretchToDisplay ) ;
2013-02-13 18:21:21 +01:00
2013-04-18 11:58:54 +02:00
UICheckBox ( GEN_ID , x , y + = stride , gs - > T ( " Hardware Transform " ) , ALIGN_TOPLEFT , & g_Config . bHardwareTransform ) ;
if ( UICheckBox ( GEN_ID , x , y + = stride , gs - > T ( " Buffered Rendering " ) , ALIGN_TOPLEFT , & g_Config . bBufferedRendering ) ) {
2013-03-11 22:22:07 +01:00
if ( gpu )
gpu - > Resized ( ) ;
}
2013-05-02 07:48:28 -07:00
bool enableFrameSkip = g_Config . iFrameSkip ! = 0 ;
2013-06-15 14:36:07 +08:00
UICheckBox ( GEN_ID , x , y + = stride , gs - > T ( " Frame Skipping " ) , ALIGN_TOPLEFT , & enableFrameSkip ) ;
2013-05-02 07:48:28 -07:00
if ( enableFrameSkip ) {
if ( g_Config . iFrameSkip = = 0 )
g_Config . iFrameSkip = 3 ;
2013-06-03 16:25:48 +08:00
char showFrameSkip [ 256 ] ;
sprintf ( showFrameSkip , " %s %d " , gs - > T ( " Frames : " ) , g_Config . iFrameSkip ) ;
2013-06-15 14:36:07 +08:00
ui_draw2d . DrawText ( UBUNTU24 , showFrameSkip , x + 60 , y + = stride , 0xFFFFFFFF , ALIGN_LEFT ) ;
HLinear hlinear2 ( x + 220 , y , 20 ) ;
if ( UIButton ( GEN_ID , hlinear2 , 80 , 0 , gs - > T ( " Auto " ) , ALIGN_LEFT ) )
g_Config . iFrameSkip = 3 ;
if ( UIButton ( GEN_ID , hlinear2 , 40 , 0 , gs - > T ( " -1 " ) , ALIGN_LEFT ) )
if ( g_Config . iFrameSkip > 1 )
g_Config . iFrameSkip - = 1 ;
if ( UIButton ( GEN_ID , hlinear2 , 40 , 0 , gs - > T ( " +1 " ) , ALIGN_LEFT ) )
if ( g_Config . iFrameSkip < 9 )
g_Config . iFrameSkip + = 1 ;
2013-06-21 11:13:08 +08:00
y + = 20 ;
2013-06-15 14:36:07 +08:00
} else
2013-05-02 07:48:28 -07:00
g_Config . iFrameSkip = 0 ;
2013-01-02 21:00:10 +01:00
2013-06-19 21:49:51 +08:00
ui_draw2d . DrawText ( UBUNTU24 , gs - > T ( " Save State : " ) , 30 , y + = 40 , 0xFFFFFFFF , ALIGN_LEFT ) ;
HLinear hlinear4 ( x + 180 , y , 10 ) ;
2013-06-18 21:17:53 +08:00
if ( UIButton ( GEN_ID , hlinear4 , 60 , 0 , " 1 " , ALIGN_LEFT ) ) {
2013-01-02 21:00:10 +01:00
SaveState : : SaveSlot ( 0 , 0 , 0 ) ;
screenManager ( ) - > finishDialog ( this , DR_CANCEL ) ;
}
2013-06-18 21:17:53 +08:00
if ( UIButton ( GEN_ID , hlinear4 , 60 , 0 , " 2 " , ALIGN_LEFT ) ) {
2013-06-18 18:11:47 +08:00
SaveState : : SaveSlot ( 1 , 0 , 0 ) ;
screenManager ( ) - > finishDialog ( this , DR_CANCEL ) ;
}
2013-06-18 21:17:53 +08:00
if ( UIButton ( GEN_ID , hlinear4 , 60 , 0 , " 3 " , ALIGN_LEFT ) ) {
2013-06-18 18:11:47 +08:00
SaveState : : SaveSlot ( 2 , 0 , 0 ) ;
screenManager ( ) - > finishDialog ( this , DR_CANCEL ) ;
}
2013-06-18 21:17:53 +08:00
if ( UIButton ( GEN_ID , hlinear4 , 60 , 0 , " 4 " , ALIGN_LEFT ) ) {
2013-06-18 18:11:47 +08:00
SaveState : : SaveSlot ( 3 , 0 , 0 ) ;
screenManager ( ) - > finishDialog ( this , DR_CANCEL ) ;
}
2013-06-18 21:17:53 +08:00
if ( UIButton ( GEN_ID , hlinear4 , 60 , 0 , " 5 " , ALIGN_LEFT ) ) {
2013-06-18 18:11:47 +08:00
SaveState : : SaveSlot ( 4 , 0 , 0 ) ;
screenManager ( ) - > finishDialog ( this , DR_CANCEL ) ;
}
2013-06-19 21:49:51 +08:00
ui_draw2d . DrawText ( UBUNTU24 , gs - > T ( " Load State : " ) , 30 , y + = 60 , 0xFFFFFFFF , ALIGN_LEFT ) ;
HLinear hlinear3 ( x + 180 , y + 10 , 10 ) ;
2013-06-18 21:17:53 +08:00
if ( UIButton ( GEN_ID , hlinear3 , 60 , 0 , " 1 " , ALIGN_LEFT ) ) {
2013-01-02 21:00:10 +01:00
SaveState : : LoadSlot ( 0 , 0 , 0 ) ;
screenManager ( ) - > finishDialog ( this , DR_CANCEL ) ;
}
2013-06-18 21:17:53 +08:00
if ( UIButton ( GEN_ID , hlinear3 , 60 , 0 , " 2 " , ALIGN_LEFT ) ) {
2013-06-18 18:11:47 +08:00
SaveState : : LoadSlot ( 1 , 0 , 0 ) ;
screenManager ( ) - > finishDialog ( this , DR_CANCEL ) ;
}
2013-06-18 21:17:53 +08:00
if ( UIButton ( GEN_ID , hlinear3 , 60 , 0 , " 3 " , ALIGN_LEFT ) ) {
2013-06-18 18:11:47 +08:00
SaveState : : LoadSlot ( 2 , 0 , 0 ) ;
screenManager ( ) - > finishDialog ( this , DR_CANCEL ) ;
}
2013-06-18 21:17:53 +08:00
if ( UIButton ( GEN_ID , hlinear3 , 60 , 0 , " 4 " , ALIGN_LEFT ) ) {
2013-06-18 18:11:47 +08:00
SaveState : : LoadSlot ( 3 , 0 , 0 ) ;
screenManager ( ) - > finishDialog ( this , DR_CANCEL ) ;
}
2013-06-18 21:17:53 +08:00
if ( UIButton ( GEN_ID , hlinear3 , 60 , 0 , " 5 " , ALIGN_LEFT ) ) {
2013-06-18 18:11:47 +08:00
SaveState : : LoadSlot ( 4 , 0 , 0 ) ;
screenManager ( ) - > finishDialog ( this , DR_CANCEL ) ;
}
2012-11-01 16:19:01 +01:00
DrawWatermark ( ) ;
UIEnd ( ) ;
}
void SettingsScreen : : update ( InputState & input ) {
2013-03-29 19:32:20 +01:00
globalUIState = UISTATE_MENU ;
2012-11-01 16:19:01 +01:00
if ( input . pad_buttons_down & PAD_BUTTON_BACK ) {
g_Config . Save ( ) ;
2013-03-02 17:47:37 +01:00
screenManager ( ) - > finishDialog ( this , DR_OK ) ;
2012-11-01 16:19:01 +01:00
}
}
void SettingsScreen : : render ( ) {
UIShader_Prepare ( ) ;
2013-03-30 19:23:20 +01:00
UIBegin ( UIShader_Get ( ) ) ;
2012-11-01 16:19:01 +01:00
DrawBackground ( 1.0f ) ;
2013-04-18 11:58:54 +02:00
I18NCategory * g = GetI18NCategory ( " General " ) ;
I18NCategory * ms = GetI18NCategory ( " MainSettings " ) ;
2013-04-20 00:01:29 +02:00
ui_draw2d . SetFontScale ( 1.5f , 1.5f ) ;
2013-05-15 18:09:30 +08:00
ui_draw2d . DrawText ( UBUNTU24 , ms - > T ( " Settings " ) , dp_xres / 2 , 10 , 0xFFFFFFFF , ALIGN_HCENTER ) ;
2013-04-20 00:01:29 +02:00
ui_draw2d . SetFontScale ( 1.0f , 1.0f ) ;
2012-11-01 16:19:01 +01:00
2013-06-03 16:25:48 +08:00
VLinear vlinear ( 30 , 135 , 20 ) ;
2012-11-01 16:19:01 +01:00
2013-04-18 11:58:54 +02:00
if ( UIButton ( GEN_ID , Pos ( dp_xres - 10 , dp_yres - 10 ) , LARGE_BUTTON_WIDTH , 0 , g - > T ( " Back " ) , ALIGN_RIGHT | ALIGN_BOTTOM ) ) {
2013-03-02 17:47:37 +01:00
screenManager ( ) - > finishDialog ( this , DR_OK ) ;
2012-11-01 16:19:01 +01:00
}
2013-04-17 04:57:13 +08:00
2013-06-03 16:25:48 +08:00
const int stride = 70 ;
2013-04-19 17:09:35 +08:00
int w = LARGE_BUTTON_WIDTH + 25 ;
2013-06-03 16:25:48 +08:00
int s = 270 ;
int y = 90 ;
2013-04-18 09:01:23 +08:00
2013-04-18 11:58:54 +02:00
if ( UIButton ( GEN_ID , vlinear , w , 0 , ms - > T ( " Audio " ) , ALIGN_BOTTOMLEFT ) ) {
2013-04-17 04:57:13 +08:00
screenManager ( ) - > push ( new AudioScreen ( ) ) ;
}
2013-06-03 16:25:48 +08:00
ui_draw2d . DrawText ( UBUNTU24 , ms - > T ( " AudioDesc " , " Adjust Audio Settings " ) , s , y , 0xFFFFFFFF , ALIGN_LEFT ) ;
2013-04-17 04:57:13 +08:00
2013-04-18 11:58:54 +02:00
if ( UIButton ( GEN_ID , vlinear , w , 0 , ms - > T ( " Graphics " ) , ALIGN_BOTTOMLEFT ) ) {
2013-04-28 08:55:03 +08:00
screenManager ( ) - > push ( new GraphicsScreenP1 ( ) ) ;
2013-04-17 04:57:13 +08:00
}
2013-06-03 16:25:48 +08:00
ui_draw2d . DrawText ( UBUNTU24 , ms - > T ( " GraphicsDesc " , " Change graphics options " ) , s , y + = stride , 0xFFFFFFFF , ALIGN_LEFT ) ;
2013-04-17 04:57:13 +08:00
2013-04-18 11:58:54 +02:00
if ( UIButton ( GEN_ID , vlinear , w , 0 , ms - > T ( " System " ) , ALIGN_BOTTOMLEFT ) ) {
2013-04-17 04:57:13 +08:00
screenManager ( ) - > push ( new SystemScreen ( ) ) ;
}
2013-06-03 16:25:48 +08:00
ui_draw2d . DrawText ( UBUNTU24 , ms - > T ( " SystemDesc " , " Turn on Dynarec (JIT), Fast Memory " ) , s , y + = stride , 0xFFFFFFFF , ALIGN_LEFT ) ;
2013-04-17 04:57:13 +08:00
2013-04-18 11:58:54 +02:00
if ( UIButton ( GEN_ID , vlinear , w , 0 , ms - > T ( " Controls " ) , ALIGN_BOTTOMLEFT ) ) {
2013-04-17 04:57:13 +08:00
screenManager ( ) - > push ( new ControlsScreen ( ) ) ;
}
2013-06-03 16:25:48 +08:00
ui_draw2d . DrawText ( UBUNTU24 , ms - > T ( " ControlsDesc " , " On Screen Controls, Large Buttons " ) , s , y + = stride , 0xFFFFFFFF , ALIGN_LEFT ) ;
2013-04-17 04:57:13 +08:00
2013-04-18 11:58:54 +02:00
if ( UIButton ( GEN_ID , vlinear , w , 0 , ms - > T ( " Developer " ) , ALIGN_BOTTOMLEFT ) ) {
2013-03-07 00:10:53 +01:00
screenManager ( ) - > push ( new DeveloperScreen ( ) ) ;
}
2013-06-03 16:25:48 +08:00
ui_draw2d . DrawText ( UBUNTU24 , ms - > T ( " DeveloperDesc " , " Run CPU test, Dump Next Frame Log " ) , s , y + = stride , 0xFFFFFFFF , ALIGN_LEFT ) ;
2013-03-07 00:10:53 +01:00
UIEnd ( ) ;
}
void DeveloperScreen : : update ( InputState & input ) {
if ( input . pad_buttons_down & PAD_BUTTON_BACK ) {
g_Config . Save ( ) ;
screenManager ( ) - > finishDialog ( this , DR_OK ) ;
}
}
2013-04-17 04:57:13 +08:00
void AudioScreen : : update ( InputState & input ) {
if ( input . pad_buttons_down & PAD_BUTTON_BACK ) {
g_Config . Save ( ) ;
screenManager ( ) - > finishDialog ( this , DR_OK ) ;
}
}
2013-04-28 08:55:03 +08:00
void GraphicsScreenP1 : : update ( InputState & input ) {
2013-04-17 04:57:13 +08:00
if ( input . pad_buttons_down & PAD_BUTTON_BACK ) {
g_Config . Save ( ) ;
screenManager ( ) - > finishDialog ( this , DR_OK ) ;
}
}
2013-04-28 08:55:03 +08:00
void GraphicsScreenP2 : : update ( InputState & input ) {
2013-04-27 23:57:15 +08:00
if ( input . pad_buttons_down & PAD_BUTTON_BACK ) {
g_Config . Save ( ) ;
screenManager ( ) - > finishDialog ( this , DR_OK ) ;
}
}
2013-06-03 16:25:48 +08:00
void GraphicsScreenP3 : : update ( InputState & input ) {
if ( input . pad_buttons_down & PAD_BUTTON_BACK ) {
g_Config . Save ( ) ;
screenManager ( ) - > finishDialog ( this , DR_OK ) ;
}
}
2013-04-17 04:57:13 +08:00
void SystemScreen : : update ( InputState & input ) {
if ( input . pad_buttons_down & PAD_BUTTON_BACK ) {
g_Config . Save ( ) ;
screenManager ( ) - > finishDialog ( this , DR_OK ) ;
}
}
void ControlsScreen : : update ( InputState & input ) {
if ( input . pad_buttons_down & PAD_BUTTON_BACK ) {
g_Config . Save ( ) ;
screenManager ( ) - > finishDialog ( this , DR_OK ) ;
}
}
2013-04-21 00:07:54 +08:00
void LanguageScreen : : update ( InputState & input ) {
if ( input . pad_buttons_down & PAD_BUTTON_BACK ) {
g_Config . Save ( ) ;
screenManager ( ) - > finishDialog ( this , DR_OK ) ;
}
}
2013-03-07 00:10:53 +01:00
void DeveloperScreen : : render ( ) {
UIShader_Prepare ( ) ;
2013-03-30 19:23:20 +01:00
UIBegin ( UIShader_Get ( ) ) ;
2013-03-07 00:10:53 +01:00
DrawBackground ( 1.0f ) ;
2013-04-18 11:58:54 +02:00
I18NCategory * g = GetI18NCategory ( " General " ) ;
I18NCategory * d = GetI18NCategory ( " Developer " ) ;
2013-06-03 16:25:48 +08:00
I18NCategory * s = GetI18NCategory ( " System " ) ;
2013-04-18 11:58:54 +02:00
2013-04-20 00:01:29 +02:00
ui_draw2d . SetFontScale ( 1.5f , 1.5f ) ;
2013-05-15 18:09:30 +08:00
ui_draw2d . DrawText ( UBUNTU24 , d - > T ( " Developer Tools " ) , dp_xres / 2 , 10 , 0xFFFFFFFF , ALIGN_HCENTER ) ;
2013-04-20 00:01:29 +02:00
ui_draw2d . SetFontScale ( 1.0f , 1.0f ) ;
2013-06-03 16:25:48 +08:00
int x = 50 ;
int y = 40 ;
const int stride = 40 ;
const int w = 400 ;
2013-04-19 17:09:35 +08:00
2013-06-03 16:25:48 +08:00
UICheckBox ( GEN_ID , x , y + = stride , s - > T ( " Show Debug Statistics " ) , ALIGN_TOPLEFT , & g_Config . bShowDebugStats ) ;
bool reportingEnabled = Reporting : : IsEnabled ( ) ;
const static std : : string reportHostOfficial = " report.ppsspp.org " ;
2013-06-15 14:54:50 +08:00
if ( UICheckBox ( GEN_ID , x , y + = stride , d - > T ( " Report " , " Enable Compatibility Server Reports " ) , ALIGN_TOPLEFT , & reportingEnabled ) ) {
2013-06-03 16:25:48 +08:00
g_Config . sReportHost = reportingEnabled ? reportHostOfficial : " " ;
}
VLinear vlinear ( x , y + stride + 12 , 16 ) ;
if ( UIButton ( GEN_ID , Pos ( dp_xres - 10 , dp_yres - 10 ) , LARGE_BUTTON_WIDTH , 0 , g - > T ( " Back " ) , ALIGN_RIGHT | ALIGN_BOTTOM ) ) {
2013-03-07 00:10:53 +01:00
screenManager ( ) - > finishDialog ( this , DR_OK ) ;
}
2013-06-19 13:08:29 +08:00
if ( UIButton ( GEN_ID , vlinear , LARGE_BUTTON_WIDTH + 80 , 0 , d - > T ( " Load language ini " ) , ALIGN_LEFT ) ) {
2013-04-18 11:58:54 +02:00
i18nrepo . LoadIni ( g_Config . languageIni ) ;
// After this, g and s are no longer valid. Need to reload them.
g = GetI18NCategory ( " General " ) ;
d = GetI18NCategory ( " Developer " ) ;
}
2013-06-19 13:08:29 +08:00
if ( UIButton ( GEN_ID , vlinear , LARGE_BUTTON_WIDTH + 80 , 0 , d - > T ( " Save language ini " ) , ALIGN_LEFT ) ) {
2013-06-17 20:28:22 +02:00
i18nrepo . SaveIni ( g_Config . languageIni ) ;
2013-04-18 11:58:54 +02:00
}
2013-06-19 13:08:29 +08:00
if ( UIButton ( GEN_ID , vlinear , LARGE_BUTTON_WIDTH + 80 , 0 , d - > T ( " Run CPU Tests " ) , ALIGN_LEFT ) ) {
2013-03-07 00:10:53 +01:00
// TODO: Run tests
RunTests ( ) ;
// screenManager()->push(new EmuScreen())
}
2013-06-19 13:08:29 +08:00
if ( UIButton ( GEN_ID , vlinear , LARGE_BUTTON_WIDTH + 80 , 0 , d - > T ( " Dump next frame " ) , ALIGN_LEFT ) ) {
2013-03-07 00:10:53 +01:00
gpu - > DumpNextFrame ( ) ;
}
2012-12-01 23:20:08 +01:00
2013-06-21 01:37:52 +08:00
if ( UIButton ( GEN_ID , vlinear , LARGE_BUTTON_WIDTH + 80 , 0 , d - > T ( " Cleanup Recents " ) , ALIGN_LEFT ) ) {
g_Config . recentIsos . clear ( ) ;
}
2012-11-01 16:19:01 +01:00
UIEnd ( ) ;
}
2013-04-17 04:57:13 +08:00
void AudioScreen : : render ( ) {
UIShader_Prepare ( ) ;
UIBegin ( UIShader_Get ( ) ) ;
DrawBackground ( 1.0f ) ;
2013-04-18 11:58:54 +02:00
I18NCategory * g = GetI18NCategory ( " General " ) ;
I18NCategory * a = GetI18NCategory ( " Audio " ) ;
2013-04-17 04:57:13 +08:00
2013-04-20 00:01:29 +02:00
ui_draw2d . SetFontScale ( 1.5f , 1.5f ) ;
2013-05-15 18:09:30 +08:00
ui_draw2d . DrawText ( UBUNTU24 , a - > T ( " Audio Settings " ) , dp_xres / 2 , 10 , 0xFFFFFFFF , ALIGN_HCENTER ) ;
2013-04-20 00:01:29 +02:00
ui_draw2d . SetFontScale ( 1.0f , 1.0f ) ;
2013-04-18 11:58:54 +02:00
if ( UIButton ( GEN_ID , Pos ( dp_xres - 10 , dp_yres - 10 ) , LARGE_BUTTON_WIDTH , 0 , g - > T ( " Back " ) , ALIGN_RIGHT | ALIGN_BOTTOM ) ) {
2013-04-17 04:57:13 +08:00
screenManager ( ) - > finishDialog ( this , DR_OK ) ;
}
int x = 30 ;
2013-06-03 16:25:48 +08:00
int y = 35 ;
2013-04-17 04:57:13 +08:00
int stride = 40 ;
int columnw = 400 ;
2013-04-18 11:58:54 +02:00
UICheckBox ( GEN_ID , x , y + = stride , a - > T ( " Enable Sound " ) , ALIGN_TOPLEFT , & g_Config . bEnableSound ) ;
2013-06-16 12:41:41 +02:00
if ( Atrac3plus_Decoder : : IsSupported ( ) ) {
2013-06-16 22:49:26 +02:00
if ( Atrac3plus_Decoder : : IsInstalled ( ) & & g_Config . bEnableSound ) {
UICheckBox ( GEN_ID , x + 60 , y + = stride , a - > T ( " Enable Atrac3+ " ) , ALIGN_TOPLEFT , & g_Config . bEnableAtrac3plus ) ;
2013-06-27 18:54:50 +08:00
} else
g_Config . bEnableAtrac3plus = false ;
2013-06-16 22:49:26 +02:00
VLinear vlinear ( 30 , 200 , 20 ) ;
if ( UIButton ( GEN_ID , vlinear , 400 , 0 , a - > T ( " Download Atrac3+ plugin " ) , ALIGN_LEFT ) ) {
2013-06-16 12:41:41 +02:00
screenManager ( ) - > push ( new PluginScreen ( ) ) ;
}
2013-06-03 00:42:19 +02:00
}
2013-04-17 04:57:13 +08:00
UIEnd ( ) ;
}
2013-04-28 08:55:03 +08:00
void GraphicsScreenP1 : : render ( ) {
2013-04-17 04:57:13 +08:00
UIShader_Prepare ( ) ;
UIBegin ( UIShader_Get ( ) ) ;
DrawBackground ( 1.0f ) ;
2013-04-18 11:58:54 +02:00
I18NCategory * g = GetI18NCategory ( " General " ) ;
I18NCategory * gs = GetI18NCategory ( " Graphics " ) ;
2013-06-30 20:00:35 -03:00
char temp [ 256 ] ;
sprintf ( temp , " %s 1/3 " , gs - > T ( " Graphics Settings " ) ) ;
2013-04-19 21:23:18 -07:00
ui_draw2d . SetFontScale ( 1.5f , 1.5f ) ;
2013-06-30 20:00:35 -03:00
ui_draw2d . DrawText ( UBUNTU24 , temp , dp_xres / 2 , 10 , 0xFFFFFFFF , ALIGN_HCENTER ) ;
2013-04-19 21:23:18 -07:00
ui_draw2d . SetFontScale ( 1.0f , 1.0f ) ;
2013-04-17 04:57:13 +08:00
2013-06-03 16:25:48 +08:00
if ( UIButton ( GEN_ID , Pos ( dp_xres - 10 , dp_yres - 10 ) , LARGE_BUTTON_WIDTH , 0 , g - > T ( " Back " ) , ALIGN_BOTTOMRIGHT ) ) {
2013-04-17 04:57:13 +08:00
screenManager ( ) - > finishDialog ( this , DR_OK ) ;
}
2013-06-03 16:25:48 +08:00
HLinear hlinear ( 10 , dp_yres - 10 , 20.0f ) ;
2013-06-15 12:38:22 +08:00
if ( UIButton ( GEN_ID , hlinear , LARGE_BUTTON_WIDTH + 10 , 0 , g - > T ( " Prev Page " ) , ALIGN_BOTTOMLEFT ) ) {
screenManager ( ) - > switchScreen ( new GraphicsScreenP3 ( ) ) ;
}
2013-06-15 11:57:39 -07:00
if ( UIButton ( GEN_ID , hlinear , LARGE_BUTTON_WIDTH + 10 , 0 , g - > T ( " Next Page " ) , ALIGN_BOTTOMLEFT ) ) {
screenManager ( ) - > switchScreen ( new GraphicsScreenP2 ( ) ) ;
}
2013-04-27 23:57:15 +08:00
2013-04-17 04:57:13 +08:00
int x = 30 ;
2013-06-03 16:25:48 +08:00
int y = 35 ;
2013-04-17 04:57:13 +08:00
int stride = 40 ;
int columnw = 400 ;
# ifndef __SYMBIAN32__
2013-04-18 11:58:54 +02:00
UICheckBox ( GEN_ID , x , y + = stride , gs - > T ( " Hardware Transform " ) , ALIGN_TOPLEFT , & g_Config . bHardwareTransform ) ;
2013-06-03 16:25:48 +08:00
# endif
UICheckBox ( GEN_ID , x , y + = stride , gs - > T ( " Vertex Cache " ) , ALIGN_TOPLEFT , & g_Config . bVertexCache ) ;
# ifndef __SYMBIAN32__
2013-04-18 11:58:54 +02:00
UICheckBox ( GEN_ID , x , y + = stride , gs - > T ( " Stream VBO " ) , ALIGN_TOPLEFT , & g_Config . bUseVBO ) ;
2013-04-17 04:57:13 +08:00
# endif
2013-04-18 11:58:54 +02:00
UICheckBox ( GEN_ID , x , y + = stride , gs - > T ( " Mipmapping " ) , ALIGN_TOPLEFT , & g_Config . bMipMap ) ;
2013-06-17 20:06:17 +08:00
# ifdef _WIN32
bool Vsync = g_Config . iVSyncInterval ! = 0 ;
UICheckBox ( GEN_ID , x , y + = stride , gs - > T ( " VSync " ) , ALIGN_TOPLEFT , & Vsync ) ;
g_Config . iVSyncInterval = Vsync ? 1 : 0 ;
# endif
2013-06-03 16:25:48 +08:00
UICheckBox ( GEN_ID , x , y + = stride , gs - > T ( " Display Raw Framebuffer " ) , ALIGN_TOPLEFT , & g_Config . bDisplayFramebuffer ) ;
2013-04-18 11:58:54 +02:00
if ( UICheckBox ( GEN_ID , x , y + = stride , gs - > T ( " Buffered Rendering " ) , ALIGN_TOPLEFT , & g_Config . bBufferedRendering ) ) {
2013-04-17 04:57:13 +08:00
if ( gpu )
gpu - > Resized ( ) ;
}
2013-05-15 18:09:30 +08:00
if ( g_Config . bBufferedRendering ) {
2013-06-03 16:25:48 +08:00
if ( UICheckBox ( GEN_ID , x + 60 , y + = stride , gs - > T ( " AA " , " Anti Aliasing " ) , ALIGN_TOPLEFT , & g_Config . SSAntiAliasing ) ) {
2013-05-15 18:09:30 +08:00
if ( gpu )
gpu - > Resized ( ) ;
}
}
2013-06-03 16:25:48 +08:00
2013-04-27 23:57:15 +08:00
UIEnd ( ) ;
}
2013-04-28 08:55:03 +08:00
void GraphicsScreenP2 : : render ( ) {
2013-04-27 23:57:15 +08:00
UIShader_Prepare ( ) ;
UIBegin ( UIShader_Get ( ) ) ;
DrawBackground ( 1.0f ) ;
I18NCategory * g = GetI18NCategory ( " General " ) ;
I18NCategory * gs = GetI18NCategory ( " Graphics " ) ;
2013-06-30 20:00:35 -03:00
char temp [ 256 ] ;
sprintf ( temp , " %s 2/3 " , gs - > T ( " Graphics Settings " ) ) ;
2013-04-27 23:57:15 +08:00
ui_draw2d . SetFontScale ( 1.5f , 1.5f ) ;
2013-06-30 20:00:35 -03:00
ui_draw2d . DrawText ( UBUNTU24 , temp , dp_xres / 2 , 10 , 0xFFFFFFFF , ALIGN_HCENTER ) ;
2013-04-27 23:57:15 +08:00
ui_draw2d . SetFontScale ( 1.0f , 1.0f ) ;
if ( UIButton ( GEN_ID , Pos ( dp_xres - 10 , dp_yres - 10 ) , LARGE_BUTTON_WIDTH , 0 , g - > T ( " Back " ) , ALIGN_RIGHT | ALIGN_BOTTOM ) ) {
screenManager ( ) - > finishDialog ( this , DR_OK ) ;
}
2013-06-03 16:25:48 +08:00
HLinear hlinear ( 10 , dp_yres - 10 , 20.0f ) ;
2013-06-15 12:38:22 +08:00
if ( UIButton ( GEN_ID , hlinear , LARGE_BUTTON_WIDTH + 10 , 0 , g - > T ( " Prev Page " ) , ALIGN_BOTTOMLEFT ) ) {
screenManager ( ) - > switchScreen ( new GraphicsScreenP1 ( ) ) ;
}
2013-06-15 11:57:39 -07:00
if ( UIButton ( GEN_ID , hlinear , LARGE_BUTTON_WIDTH + 10 , 0 , g - > T ( " Next Page " ) , ALIGN_BOTTOMLEFT ) ) {
screenManager ( ) - > switchScreen ( new GraphicsScreenP3 ( ) ) ;
}
2013-06-03 16:25:48 +08:00
2013-04-27 23:57:15 +08:00
int x = 30 ;
2013-06-03 16:25:48 +08:00
int y = 35 ;
2013-04-27 23:57:15 +08:00
int stride = 40 ;
int columnw = 400 ;
2013-05-02 07:48:28 -07:00
bool AnisotropicFiltering = g_Config . iAnisotropyLevel ! = 0 ;
2013-06-03 16:25:48 +08:00
UICheckBox ( GEN_ID , x , y + = stride , gs - > T ( " Anisotropic Filtering " ) , ALIGN_TOPLEFT , & AnisotropicFiltering ) ;
2013-05-02 07:48:28 -07:00
if ( AnisotropicFiltering ) {
if ( g_Config . iAnisotropyLevel = = 0 )
g_Config . iAnisotropyLevel = 2 ;
2013-06-15 13:08:00 +08:00
char showAF [ 256 ] ;
sprintf ( showAF , " %s %dx " , gs - > T ( " Level : " ) , g_Config . iAnisotropyLevel ) ;
2013-06-15 13:50:18 +08:00
ui_draw2d . DrawText ( UBUNTU24 , showAF , x + 60 , ( y + = stride ) , 0xFFFFFFFF , ALIGN_LEFT ) ;
2013-06-15 15:23:14 +09:00
HLinear hlinear1 ( x + 250 , y , 20 ) ;
2013-06-30 20:00:35 -03:00
if ( UIButton ( GEN_ID , hlinear1 , 60 , 0 , gs - > T ( " 2x " ) , ALIGN_LEFT ) )
2013-04-28 08:55:03 +08:00
g_Config . iAnisotropyLevel = 2 ;
2013-06-30 20:00:35 -03:00
if ( UIButton ( GEN_ID , hlinear1 , 60 , 0 , gs - > T ( " 4x " ) , ALIGN_LEFT ) )
2013-04-28 08:55:03 +08:00
g_Config . iAnisotropyLevel = 4 ;
2013-06-30 20:00:35 -03:00
if ( UIButton ( GEN_ID , hlinear1 , 60 , 0 , gs - > T ( " 8x " ) , ALIGN_LEFT ) )
2013-04-28 08:55:03 +08:00
g_Config . iAnisotropyLevel = 8 ;
2013-05-25 11:23:14 +08:00
if ( UIButton ( GEN_ID , hlinear1 , 60 , 0 , gs - > T ( " 16x " ) , ALIGN_LEFT ) )
2013-04-28 08:55:03 +08:00
g_Config . iAnisotropyLevel = 16 ;
2013-06-03 16:25:48 +08:00
y + = 20 ;
2013-06-15 13:50:18 +08:00
} else
2013-04-28 08:55:03 +08:00
g_Config . iAnisotropyLevel = 0 ;
2013-06-15 13:50:18 +08:00
2013-06-30 14:48:50 +08:00
bool TexFiltering = g_Config . iTexFiltering > 1 ;
UICheckBox ( GEN_ID , x , y + = stride , gs - > T ( " Texture Filtering " ) , ALIGN_TOPLEFT , & TexFiltering ) ;
if ( TexFiltering ) {
if ( g_Config . iTexFiltering < = 1 )
g_Config . iTexFiltering = 2 ;
char showType [ 256 ] ;
std : : string type ;
switch ( g_Config . iTexFiltering ) {
case 2 : type = " Nearest " ; break ;
case 3 : type = " Linear " ; break ;
case 4 : type = " Linear(CG) " ; break ;
}
sprintf ( showType , " %s %s " , gs - > T ( " Type : " ) , type . c_str ( ) ) ;
ui_draw2d . DrawText ( UBUNTU24 , showType , x + 60 , ( y + = stride ) , 0xFFFFFFFF , ALIGN_LEFT ) ;
HLinear hlinear1 ( x + 300 , y , 20 ) ;
2013-06-30 20:00:35 -03:00
if ( UIButton ( GEN_ID , hlinear1 , 170 , 0 , gs - > T ( " Nearest " ) , ALIGN_LEFT ) )
2013-06-30 14:48:50 +08:00
g_Config . iTexFiltering = 2 ;
2013-06-30 20:00:35 -03:00
if ( UIButton ( GEN_ID , hlinear1 , 170 , 0 , gs - > T ( " Linear " ) , ALIGN_LEFT ) )
2013-06-30 14:48:50 +08:00
g_Config . iTexFiltering = 3 ;
2013-06-30 20:00:35 -03:00
if ( UIButton ( GEN_ID , hlinear1 , 170 , 0 , gs - > T ( " Linear(CG) " ) , ALIGN_LEFT ) )
2013-06-30 14:48:50 +08:00
g_Config . iTexFiltering = 4 ;
y + = 20 ;
} else
g_Config . iTexFiltering = 0 ;
2013-06-15 13:50:18 +08:00
2013-05-03 02:46:34 +02:00
bool TexScaling = g_Config . iTexScalingLevel > 1 ;
2013-06-30 14:48:50 +08:00
UICheckBox ( GEN_ID , x , y + = stride , gs - > T ( " Texture Scaling " ) , ALIGN_TOPLEFT , & TexScaling ) ;
2013-05-03 02:46:34 +02:00
if ( TexScaling ) {
if ( g_Config . iTexScalingLevel < = 1 )
g_Config . iTexScalingLevel = 2 ;
2013-06-15 13:50:18 +08:00
char showType [ 256 ] ;
2013-06-15 15:23:14 +09:00
std : : string type ;
switch ( g_Config . iTexScalingType ) {
case 0 : type = " xBRZ " ; break ;
case 1 : type = " Hybrid " ; break ;
case 2 : type = " Bicubic " ; break ;
case 3 : type = " H+B " ; break ;
}
sprintf ( showType , " %s %s " , gs - > T ( " Type : " ) , type . c_str ( ) ) ;
2013-06-15 13:50:18 +08:00
ui_draw2d . DrawText ( UBUNTU24 , showType , x + 60 , ( y + = stride ) , 0xFFFFFFFF , ALIGN_LEFT ) ;
2013-06-15 15:23:14 +09:00
HLinear hlinear1 ( x + 250 , y , 20 ) ;
2013-05-25 12:34:43 +08:00
if ( UIButton ( GEN_ID , hlinear1 , 80 , 0 , gs - > T ( " xBRZ " ) , ALIGN_LEFT ) )
2013-05-05 15:59:36 +08:00
g_Config . iTexScalingType = 0 ;
2013-06-15 15:23:14 +09:00
if ( UIButton ( GEN_ID , hlinear1 , 120 , 0 , gs - > T ( " Hybrid " , " (H)ybrid " ) , ALIGN_LEFT ) )
2013-05-05 15:59:36 +08:00
g_Config . iTexScalingType = 1 ;
2013-06-15 15:23:14 +09:00
if ( UIButton ( GEN_ID , hlinear1 , 130 , 0 , gs - > T ( " Bicubic " , " (B)icubic " ) , ALIGN_LEFT ) )
2013-05-05 15:59:36 +08:00
g_Config . iTexScalingType = 2 ;
2013-05-29 00:36:24 +08:00
if ( UIButton ( GEN_ID , hlinear1 , 80 , 0 , gs - > T ( " H+B " , " H+B " ) , ALIGN_LEFT ) )
2013-05-05 15:59:36 +08:00
g_Config . iTexScalingType = 3 ;
2013-06-15 13:50:18 +08:00
y + = 20 ;
char showLevel [ 256 ] ;
sprintf ( showLevel , " %s %dx " , gs - > T ( " Level : " ) , g_Config . iTexScalingLevel ) ;
ui_draw2d . DrawText ( UBUNTU24 , showLevel , x + 60 , ( y + = stride ) , 0xFFFFFFFF , ALIGN_LEFT ) ;
2013-06-15 15:23:14 +09:00
HLinear hlinear2 ( x + 250 , y , 20 ) ;
2013-05-25 12:34:43 +08:00
if ( UIButton ( GEN_ID , hlinear2 , 45 , 0 , gs - > T ( " 2x " ) , ALIGN_LEFT ) )
g_Config . iTexScalingLevel = 2 ;
if ( UIButton ( GEN_ID , hlinear2 , 45 , 0 , gs - > T ( " 3x " ) , ALIGN_LEFT ) )
g_Config . iTexScalingLevel = 3 ;
2013-06-23 21:33:50 +08:00
# ifdef _WIN32
if ( UIButton ( GEN_ID , hlinear2 , 45 , 0 , gs - > T ( " 4x " ) , ALIGN_LEFT ) )
g_Config . iTexScalingLevel = 4 ;
if ( UIButton ( GEN_ID , hlinear2 , 45 , 0 , gs - > T ( " 5x " ) , ALIGN_LEFT ) )
g_Config . iTexScalingLevel = 5 ;
# endif
2013-06-15 13:50:18 +08:00
UICheckBox ( GEN_ID , x + 60 , y + = stride + 20 , gs - > T ( " Deposterize " ) , ALIGN_LEFT , & g_Config . bTexDeposterize ) ;
} else
g_Config . iTexScalingLevel = 1 ;
2013-04-17 04:57:13 +08:00
UIEnd ( ) ;
}
2013-06-03 16:25:48 +08:00
void GraphicsScreenP3 : : render ( ) {
UIShader_Prepare ( ) ;
UIBegin ( UIShader_Get ( ) ) ;
DrawBackground ( 1.0f ) ;
I18NCategory * g = GetI18NCategory ( " General " ) ;
I18NCategory * gs = GetI18NCategory ( " Graphics " ) ;
2013-06-30 20:00:35 -03:00
char temp [ 256 ] ;
sprintf ( temp , " %s 3/3 " , gs - > T ( " Graphics Settings " ) ) ;
2013-06-03 16:25:48 +08:00
ui_draw2d . SetFontScale ( 1.5f , 1.5f ) ;
2013-06-30 20:00:35 -03:00
ui_draw2d . DrawText ( UBUNTU24 , temp , dp_xres / 2 , 10 , 0xFFFFFFFF , ALIGN_HCENTER ) ;
2013-06-03 16:25:48 +08:00
ui_draw2d . SetFontScale ( 1.0f , 1.0f ) ;
if ( UIButton ( GEN_ID , Pos ( dp_xres - 10 , dp_yres - 10 ) , LARGE_BUTTON_WIDTH , 0 , g - > T ( " Back " ) , ALIGN_RIGHT | ALIGN_BOTTOM ) ) {
screenManager ( ) - > finishDialog ( this , DR_OK ) ;
}
HLinear hlinear ( 10 , dp_yres - 10 , 20.0f ) ;
if ( UIButton ( GEN_ID , hlinear , LARGE_BUTTON_WIDTH + 10 , 0 , g - > T ( " Prev Page " ) , ALIGN_BOTTOMLEFT ) ) {
screenManager ( ) - > switchScreen ( new GraphicsScreenP2 ( ) ) ;
}
if ( UIButton ( GEN_ID , hlinear , LARGE_BUTTON_WIDTH + 10 , 0 , g - > T ( " Next Page " ) , ALIGN_BOTTOMLEFT ) ) {
screenManager ( ) - > switchScreen ( new GraphicsScreenP1 ( ) ) ;
}
int x = 30 ;
int y = 35 ;
int stride = 40 ;
int columnw = 400 ;
2013-06-19 13:08:29 +08:00
2013-06-30 00:02:33 -07:00
bool ForceMaxEmulatedFPS60 = g_Config . iForceMaxEmulatedFPS = = 60 ;
if ( UICheckBox ( GEN_ID , x , y + = stride , gs - > T ( " Force 60 FPS or less " ) , ALIGN_TOPLEFT , & ForceMaxEmulatedFPS60 ) )
g_Config . iForceMaxEmulatedFPS = ForceMaxEmulatedFPS60 ? 60 : 0 ;
2013-06-29 20:41:53 -07:00
2013-06-19 13:08:29 +08:00
bool ShowCounter = g_Config . iShowFPSCounter > 0 ;
2013-06-30 00:03:32 -07:00
UICheckBox ( GEN_ID , x , y + = stride , gs - > T ( " Show speed / internal FPS " ) , ALIGN_TOPLEFT , & ShowCounter ) ;
2013-06-19 13:08:29 +08:00
if ( ShowCounter ) {
2013-06-29 19:57:25 -07:00
# ifdef _WIN32
const int checkboxH = 32 ;
# else
const int checkboxH = 48 ;
# endif
2013-06-30 00:03:32 -07:00
ui_draw2d . DrawTextShadow ( UBUNTU24 , gs - > T ( " (60.0 is full speed, internal FPS depends on game) " ) , x + UI_SPACE + 29 , ( y + = stride ) + checkboxH / 2 , 0xFFFFFFFF , ALIGN_LEFT | ALIGN_VCENTER ) ;
2013-06-29 19:57:25 -07:00
2013-06-19 13:08:29 +08:00
if ( g_Config . iShowFPSCounter < = 0 )
g_Config . iShowFPSCounter = 1 ;
2013-06-03 16:25:48 +08:00
2013-06-29 19:57:25 -07:00
const char * type ;
2013-06-19 13:08:29 +08:00
switch ( g_Config . iShowFPSCounter ) {
2013-06-29 19:57:25 -07:00
case 1 : type = gs - > T ( " Display: Speed " ) ; break ;
2013-06-30 00:03:32 -07:00
case 2 : type = gs - > T ( " Display: FPS " ) ; break ;
2013-06-29 19:57:25 -07:00
case 3 : type = gs - > T ( " Display: Both " ) ; break ;
2013-06-19 13:08:29 +08:00
}
2013-06-29 19:57:25 -07:00
ui_draw2d . DrawText ( UBUNTU24 , type , x + 60 , y + = stride , 0xFFFFFFFF , ALIGN_LEFT ) ;
HLinear hlinear1 ( x + 260 , y , 20 ) ;
if ( UIButton ( GEN_ID , hlinear1 , 100 , 0 , gs - > T ( " Speed " ) , ALIGN_LEFT ) )
2013-06-19 13:08:29 +08:00
g_Config . iShowFPSCounter = 1 ;
2013-06-30 00:03:32 -07:00
if ( UIButton ( GEN_ID , hlinear1 , 100 , 0 , gs - > T ( " FPS " ) , ALIGN_LEFT ) )
2013-06-19 13:08:29 +08:00
g_Config . iShowFPSCounter = 2 ;
2013-06-29 19:57:25 -07:00
if ( UIButton ( GEN_ID , hlinear1 , 100 , 0 , gs - > T ( " Both " ) , ALIGN_LEFT ) )
2013-06-19 13:08:29 +08:00
g_Config . iShowFPSCounter = 3 ;
y + = 20 ;
} else
g_Config . iShowFPSCounter = 0 ;
2013-06-29 20:41:53 -07:00
2013-06-03 16:25:48 +08:00
bool FpsLimit = g_Config . iFpsLimit ! = 0 ;
2013-06-29 19:57:25 -07:00
UICheckBox ( GEN_ID , x , y + = stride , gs - > T ( " Toggled Speed Limit " ) , ALIGN_TOPLEFT , & FpsLimit ) ;
2013-06-03 16:25:48 +08:00
if ( FpsLimit ) {
if ( g_Config . iFpsLimit = = 0 )
g_Config . iFpsLimit = 60 ;
char showFps [ 256 ] ;
2013-06-29 19:57:25 -07:00
sprintf ( showFps , " %s %d " , gs - > T ( " Speed : " ) , g_Config . iFpsLimit ) ;
2013-06-15 14:43:49 +09:00
ui_draw2d . DrawText ( UBUNTU24 , showFps , x + 60 , y + = stride , 0xFFFFFFFF , ALIGN_LEFT ) ;
2013-06-29 19:57:25 -07:00
HLinear hlinear1 ( x + 260 , y , 20 ) ;
if ( UIButton ( GEN_ID , hlinear1 , 100 , 0 , gs - > T ( " Auto " ) , ALIGN_LEFT ) )
2013-06-15 13:26:38 +08:00
g_Config . iFpsLimit = 60 ;
2013-06-29 19:57:25 -07:00
if ( UIButton ( GEN_ID , hlinear1 , 50 , 0 , gs - > T ( " -1 " ) , ALIGN_LEFT ) )
if ( g_Config . iFpsLimit > 10 )
2013-06-15 13:26:38 +08:00
g_Config . iFpsLimit - = 1 ;
2013-06-29 19:57:25 -07:00
if ( UIButton ( GEN_ID , hlinear1 , 50 , 0 , gs - > T ( " +1 " ) , ALIGN_LEFT ) )
if ( g_Config . iFrameSkip < 240 )
2013-06-15 13:26:38 +08:00
g_Config . iFpsLimit + = 1 ;
y + = 20 ;
} else
g_Config . iFpsLimit = 0 ;
2013-06-03 16:25:48 +08:00
bool enableFrameSkip = g_Config . iFrameSkip ! = 0 ;
2013-06-15 13:26:38 +08:00
UICheckBox ( GEN_ID , x , y + = stride , gs - > T ( " Frame Skipping " ) , ALIGN_TOPLEFT , & enableFrameSkip ) ;
2013-06-03 16:25:48 +08:00
if ( enableFrameSkip ) {
if ( g_Config . iFrameSkip = = 0 )
g_Config . iFrameSkip = 3 ;
char showFrameSkip [ 256 ] ;
sprintf ( showFrameSkip , " %s %d " , gs - > T ( " Frames : " ) , g_Config . iFrameSkip ) ;
2013-06-15 14:43:49 +09:00
ui_draw2d . DrawText ( UBUNTU24 , showFrameSkip , x + 60 , y + = stride , 0xFFFFFFFF , ALIGN_LEFT ) ;
2013-06-15 15:23:14 +09:00
HLinear hlinear2 ( x + 250 , y , 20 ) ;
2013-06-15 13:26:38 +08:00
if ( UIButton ( GEN_ID , hlinear2 , 80 , 0 , gs - > T ( " Auto " ) , ALIGN_LEFT ) )
g_Config . iFrameSkip = 3 ;
if ( UIButton ( GEN_ID , hlinear2 , 40 , 0 , gs - > T ( " -1 " ) , ALIGN_LEFT ) )
if ( g_Config . iFrameSkip > 1 )
g_Config . iFrameSkip - = 1 ;
if ( UIButton ( GEN_ID , hlinear2 , 40 , 0 , gs - > T ( " +1 " ) , ALIGN_LEFT ) )
if ( g_Config . iFrameSkip < 9 )
g_Config . iFrameSkip + = 1 ;
y + = 20 ;
} else
2013-06-03 16:25:48 +08:00
g_Config . iFrameSkip = 0 ;
2013-06-15 14:43:49 +09:00
2013-06-03 16:25:48 +08:00
UIEnd ( ) ;
}
2013-04-21 00:07:54 +08:00
LanguageScreen : : LanguageScreen ( )
2013-04-18 23:42:44 +02:00
{
# ifdef ANDROID
VFSGetFileListing ( " assets/lang " , & langs_ , " ini " ) ;
# else
VFSGetFileListing ( " lang " , & langs_ , " ini " ) ;
# endif
}
2013-04-21 00:07:54 +08:00
void LanguageScreen : : render ( ) {
2013-04-17 04:57:13 +08:00
UIShader_Prepare ( ) ;
UIBegin ( UIShader_Get ( ) ) ;
DrawBackground ( 1.0f ) ;
2013-04-18 11:58:54 +02:00
I18NCategory * s = GetI18NCategory ( " System " ) ;
I18NCategory * g = GetI18NCategory ( " General " ) ;
2013-04-21 00:07:54 +08:00
I18NCategory * l = GetI18NCategory ( " Language " ) ;
2013-04-17 04:57:13 +08:00
2013-06-19 13:13:23 +02:00
bool small = dp_xres < 790 ;
2013-06-18 01:21:20 +02:00
if ( ! small ) {
ui_draw2d . SetFontScale ( 1.5f , 1.5f ) ;
ui_draw2d . DrawText ( UBUNTU24 , s - > T ( " Language " ) , dp_xres / 2 , 10 , 0xFFFFFFFF , ALIGN_HCENTER ) ;
ui_draw2d . SetFontScale ( 1.0f , 1.0f ) ;
}
2013-04-18 11:58:54 +02:00
if ( UIButton ( GEN_ID , Pos ( dp_xres - 10 , dp_yres - 10 ) , LARGE_BUTTON_WIDTH , 0 , g - > T ( " Back " ) , ALIGN_RIGHT | ALIGN_BOTTOM ) ) {
2013-04-17 04:57:13 +08:00
screenManager ( ) - > finishDialog ( this , DR_OK ) ;
}
2013-06-23 05:30:54 +08:00
int buttonW = LARGE_BUTTON_WIDTH - 30 ;
2013-06-18 01:21:20 +02:00
if ( small ) {
2013-06-23 05:30:54 +08:00
buttonW = LARGE_BUTTON_WIDTH - 50 ;
2013-06-18 01:21:20 +02:00
}
VGrid vlang ( 20 , small ? 20 : 100 , dp_yres - 50 , 10 , 10 ) ;
2013-04-24 02:47:36 +08:00
std : : string text ;
2013-06-18 01:21:20 +02:00
2013-04-19 08:36:32 -07:00
for ( size_t i = 0 ; i < langs_ . size ( ) ; i + + ) {
2013-06-19 13:13:23 +02:00
// Skip README
if ( langs_ [ i ] . name . find ( " README " ) ! = std : : string : : npos ) {
continue ;
}
2013-04-18 23:42:44 +02:00
std : : string code ;
size_t dot = langs_ [ i ] . name . find ( ' . ' ) ;
if ( dot ! = std : : string : : npos )
code = langs_ [ i ] . name . substr ( 0 , dot ) ;
2013-04-18 14:59:00 +02:00
2013-04-18 23:42:44 +02:00
std : : string buttonTitle = langs_ [ i ] . name ;
2013-04-23 22:39:17 +02:00
langValuesMapping [ " ja_JP " ] = std : : make_pair ( " 日本語 " , PSP_SYSTEMPARAM_LANGUAGE_JAPANESE ) ;
langValuesMapping [ " en_US " ] = std : : make_pair ( " English " , PSP_SYSTEMPARAM_LANGUAGE_ENGLISH ) ;
langValuesMapping [ " fr_FR " ] = std : : make_pair ( " Français " , PSP_SYSTEMPARAM_LANGUAGE_FRENCH ) ;
2013-06-06 15:26:57 +02:00
langValuesMapping [ " es_ES " ] = std : : make_pair ( " Castellano " , PSP_SYSTEMPARAM_LANGUAGE_SPANISH ) ;
langValuesMapping [ " es_LA " ] = std : : make_pair ( " Latino " , PSP_SYSTEMPARAM_LANGUAGE_SPANISH ) ;
2013-04-23 22:39:17 +02:00
langValuesMapping [ " de_DE " ] = std : : make_pair ( " Deutsch " , PSP_SYSTEMPARAM_LANGUAGE_GERMAN ) ;
langValuesMapping [ " it_IT " ] = std : : make_pair ( " Italiano " , PSP_SYSTEMPARAM_LANGUAGE_ITALIAN ) ;
langValuesMapping [ " nl_NL " ] = std : : make_pair ( " Nederlands " , PSP_SYSTEMPARAM_LANGUAGE_DUTCH ) ;
langValuesMapping [ " pt_PT " ] = std : : make_pair ( " Português " , PSP_SYSTEMPARAM_LANGUAGE_PORTUGUESE ) ;
2013-06-06 15:26:57 +02:00
langValuesMapping [ " pt_BR " ] = std : : make_pair ( " Brasileiro " , PSP_SYSTEMPARAM_LANGUAGE_PORTUGUESE ) ;
2013-04-24 13:03:22 +07:00
langValuesMapping [ " ru_RU " ] = std : : make_pair ( " Русский " , PSP_SYSTEMPARAM_LANGUAGE_RUSSIAN ) ;
2013-04-24 10:24:14 +02:00
langValuesMapping [ " ko_KR " ] = std : : make_pair ( " 한국어 " , PSP_SYSTEMPARAM_LANGUAGE_KOREAN ) ;
2013-04-23 22:39:17 +02:00
langValuesMapping [ " zh_TW " ] = std : : make_pair ( " 繁體中文 " , PSP_SYSTEMPARAM_LANGUAGE_CHINESE_TRADITIONAL ) ;
langValuesMapping [ " zh_CN " ] = std : : make_pair ( " 简体中文 " , PSP_SYSTEMPARAM_LANGUAGE_CHINESE_SIMPLIFIED ) ;
2013-06-03 16:25:48 +08:00
//langValuesMapping["ar_AE"] = std::make_pair("العربية", PSP_SYSTEMPARAM_LANGUAGE_ENGLISH);
2013-06-19 13:13:23 +02:00
langValuesMapping [ " az_AZ " ] = std : : make_pair ( " Azeri " , PSP_SYSTEMPARAM_LANGUAGE_ENGLISH ) ;
2013-06-03 16:25:48 +08:00
langValuesMapping [ " ca_ES " ] = std : : make_pair ( " Català " , PSP_SYSTEMPARAM_LANGUAGE_ENGLISH ) ;
2013-04-23 22:39:17 +02:00
langValuesMapping [ " gr_EL " ] = std : : make_pair ( " ελληνικά " , PSP_SYSTEMPARAM_LANGUAGE_ENGLISH ) ;
langValuesMapping [ " he_IL " ] = std : : make_pair ( " עברית " , PSP_SYSTEMPARAM_LANGUAGE_ENGLISH ) ;
2013-04-27 14:28:06 +03:00
langValuesMapping [ " hu_HU " ] = std : : make_pair ( " Magyar " , PSP_SYSTEMPARAM_LANGUAGE_ENGLISH ) ;
2013-06-03 16:25:48 +08:00
langValuesMapping [ " id_ID " ] = std : : make_pair ( " Indonesia " , PSP_SYSTEMPARAM_LANGUAGE_ENGLISH ) ;
2013-04-27 14:28:06 +03:00
langValuesMapping [ " pl_PL " ] = std : : make_pair ( " Polski " , PSP_SYSTEMPARAM_LANGUAGE_ENGLISH ) ;
2013-06-03 16:25:48 +08:00
langValuesMapping [ " ro_RO " ] = std : : make_pair ( " Român " , PSP_SYSTEMPARAM_LANGUAGE_ENGLISH ) ;
2013-04-23 22:39:17 +02:00
langValuesMapping [ " sv_SE " ] = std : : make_pair ( " Svenska " , PSP_SYSTEMPARAM_LANGUAGE_ENGLISH ) ;
langValuesMapping [ " tr_TR " ] = std : : make_pair ( " Türk " , PSP_SYSTEMPARAM_LANGUAGE_ENGLISH ) ;
2013-04-25 13:05:13 +03:00
langValuesMapping [ " uk_UA " ] = std : : make_pair ( " Українська " , PSP_SYSTEMPARAM_LANGUAGE_ENGLISH ) ;
2013-06-03 16:25:48 +08:00
2013-04-23 22:39:17 +02:00
if ( ! code . empty ( ) ) {
if ( langValuesMapping . find ( code ) = = langValuesMapping . end ( ) ) {
2013-06-19 13:13:23 +02:00
// No title found, show locale code
2013-04-23 22:10:44 +02:00
buttonTitle = code ;
} else {
2013-04-23 22:39:17 +02:00
buttonTitle = langValuesMapping [ code ] . first ;
2013-04-23 22:10:44 +02:00
}
}
2013-06-18 01:21:20 +02:00
if ( UIButton ( GEN_ID_LOOP ( i ) , vlang , buttonW , 0 , buttonTitle . c_str ( ) , ALIGN_TOPLEFT ) ) {
2013-04-18 23:42:44 +02:00
std : : string oldLang = g_Config . languageIni ;
g_Config . languageIni = code ;
2013-04-21 19:35:05 +02:00
2013-04-18 23:42:44 +02:00
if ( i18nrepo . LoadIni ( g_Config . languageIni ) ) {
// Dunno what else to do here.
2013-04-21 19:35:05 +02:00
2013-04-21 20:40:14 +02:00
if ( langValuesMapping . find ( code ) = = langValuesMapping . end ( ) ) {
2013-04-21 19:35:05 +02:00
//Fallback to English
2013-04-21 20:56:21 +02:00
g_Config . ilanguage = PSP_SYSTEMPARAM_LANGUAGE_ENGLISH ;
2013-04-21 19:35:05 +02:00
} else {
2013-04-23 22:39:17 +02:00
g_Config . ilanguage = langValuesMapping [ code ] . second ;
2013-04-21 19:35:05 +02:00
}
2013-04-18 23:42:44 +02:00
// After this, g and s are no longer valid. Let's return, some flicker is okay.
g = GetI18NCategory ( " General " ) ;
s = GetI18NCategory ( " System " ) ;
2013-04-21 00:07:54 +08:00
l = GetI18NCategory ( " Language " ) ;
2013-04-18 23:42:44 +02:00
} else {
g_Config . languageIni = oldLang ;
}
2013-04-18 14:59:00 +02:00
}
2013-04-18 11:58:54 +02:00
}
2013-04-17 04:57:13 +08:00
UIEnd ( ) ;
}
2013-04-21 00:07:54 +08:00
void SystemScreen : : render ( ) {
UIShader_Prepare ( ) ;
UIBegin ( UIShader_Get ( ) ) ;
DrawBackground ( 1.0f ) ;
I18NCategory * s = GetI18NCategory ( " System " ) ;
I18NCategory * g = GetI18NCategory ( " General " ) ;
ui_draw2d . SetFontScale ( 1.5f , 1.5f ) ;
2013-05-15 18:09:30 +08:00
ui_draw2d . DrawText ( UBUNTU24 , s - > T ( " System Settings " ) , dp_xres / 2 , 10 , 0xFFFFFFFF , ALIGN_HCENTER ) ;
2013-04-21 00:07:54 +08:00
ui_draw2d . SetFontScale ( 1.0f , 1.0f ) ;
if ( UIButton ( GEN_ID , Pos ( dp_xres - 10 , dp_yres - 10 ) , LARGE_BUTTON_WIDTH , 0 , g - > T ( " Back " ) , ALIGN_RIGHT | ALIGN_BOTTOM ) ) {
screenManager ( ) - > finishDialog ( this , DR_OK ) ;
}
int x = 30 ;
2013-06-03 16:25:48 +08:00
int y = 35 ;
2013-04-21 00:07:54 +08:00
int stride = 40 ;
int columnw = 400 ;
2013-04-23 14:36:53 +09:00
# ifdef IOS
if ( ! isJailed )
2013-04-23 16:35:57 +09:00
UICheckBox ( GEN_ID , x , y + = stride , s - > T ( " Dynarec " , " Dynarec (JIT) " ) , ALIGN_TOPLEFT , & g_Config . bJit ) ;
else
2013-04-23 17:35:16 +09:00
{
UICheckBox ( GEN_ID , x , y + = stride , s - > T ( " DynarecisJailed " , " Dynarec (JIT) - (Not jailbroken - JIT not available) " ) , ALIGN_TOPLEFT , & g_Config . bJit ) ;
g_Config . bJit = false ;
}
2013-04-23 14:36:53 +09:00
# else
2013-04-21 00:07:54 +08:00
UICheckBox ( GEN_ID , x , y + = stride , s - > T ( " Dynarec " , " Dynarec (JIT) " ) , ALIGN_TOPLEFT , & g_Config . bJit ) ;
2013-04-23 17:33:22 +09:00
# endif
2013-04-21 00:07:54 +08:00
if ( g_Config . bJit )
UICheckBox ( GEN_ID , x , y + = stride , s - > T ( " Fast Memory " , " Fast Memory (unstable) " ) , ALIGN_TOPLEFT , & g_Config . bFastMemory ) ;
2013-06-19 13:08:29 +08:00
2013-06-12 17:15:45 -04:00
bool LockCPUSpeed = g_Config . iLockedCPUSpeed ! = 0 ;
UICheckBox ( GEN_ID , x , y + = stride , s - > T ( " Lock PSP CPU Speed " ) , ALIGN_TOPLEFT , & LockCPUSpeed ) ;
if ( LockCPUSpeed ) {
if ( g_Config . iLockedCPUSpeed < = 0 )
g_Config . iLockedCPUSpeed = 222 ;
char showCPUSpeed [ 256 ] ;
2013-06-30 20:00:35 -03:00
sprintf ( showCPUSpeed , " %s %d " , s - > T ( " Locked CPU Speed: " ) , g_Config . iLockedCPUSpeed ) ;
2013-06-12 17:15:45 -04:00
ui_draw2d . DrawText ( UBUNTU24 , showCPUSpeed , x + 60 , ( y + = stride ) - 5 , 0xFFFFFFFF , ALIGN_LEFT ) ;
}
else {
g_Config . iLockedCPUSpeed = 0 ;
}
2013-06-23 05:30:54 +08:00
//UICheckBox(GEN_ID, x, y += stride, s->T("Daylight Savings"), ALIGN_TOPLEFT, &g_Config.bDayLightSavings);
2013-06-21 17:40:41 -07:00
const char * buttonPreferenceTitle ;
switch ( g_Config . iButtonPreference ) {
case PSP_SYSTEMPARAM_BUTTON_CIRCLE :
buttonPreferenceTitle = s - > T ( " Button Preference - O to Confirm " ) ;
break ;
case PSP_SYSTEMPARAM_BUTTON_CROSS :
default :
buttonPreferenceTitle = s - > T ( " Button Preference - X to Confirm " ) ;
break ;
2013-05-14 01:27:37 -07:00
}
2013-06-19 13:08:29 +08:00
2013-06-21 17:40:41 -07:00
# ifdef _WIN32
const int checkboxH = 32 ;
# else
const int checkboxH = 48 ;
# endif
ui_draw2d . DrawTextShadow ( UBUNTU24 , buttonPreferenceTitle , x + UI_SPACE + 29 , ( y + = stride ) + checkboxH / 2 , 0xFFFFFFFF , ALIGN_LEFT | ALIGN_VCENTER ) ;
y + = stride ;
// 29 is the width of the checkbox, new UI will replace.
HLinear hlinearButtonPref ( x + UI_SPACE + 29 , y , 20 ) ;
if ( UIButton ( GEN_ID , hlinearButtonPref , 90 , 0 , s - > T ( " Use O " ) , ALIGN_LEFT ) )
g_Config . iButtonPreference = PSP_SYSTEMPARAM_BUTTON_CIRCLE ;
if ( UIButton ( GEN_ID , hlinearButtonPref , 90 , 0 , s - > T ( " Use X " ) , ALIGN_LEFT ) )
g_Config . iButtonPreference = PSP_SYSTEMPARAM_BUTTON_CROSS ;
y + = 20 + 6 ;
2013-06-21 02:54:10 +08:00
/*
2013-06-19 13:08:29 +08:00
bool time = g_Config . iTimeFormat > 0 ;
UICheckBox ( GEN_ID , x , y + = stride , s - > T ( " Time Format " ) , ALIGN_TOPLEFT , & time ) ;
if ( time ) {
if ( g_Config . iTimeFormat < = 0 )
g_Config . iTimeFormat = 1 ;
char button [ 256 ] ;
std : : string type ;
switch ( g_Config . iTimeFormat ) {
case 1 : type = " 12HR " ; break ;
case 2 : type = " 24HR " ; break ;
}
sprintf ( button , " %s %s " , s - > T ( " Format : " ) , type . c_str ( ) ) ;
ui_draw2d . DrawText ( UBUNTU24 , button , x + 60 , y + = stride , 0xFFFFFFFF , ALIGN_LEFT ) ;
HLinear hlinear1 ( x + 280 , y , 20 ) ;
if ( UIButton ( GEN_ID , hlinear1 , 80 , 0 , s - > T ( " 12HR " ) , ALIGN_LEFT ) )
g_Config . iTimeFormat = 1 ;
if ( UIButton ( GEN_ID , hlinear1 , 80 , 0 , s - > T ( " 24HR " ) , ALIGN_LEFT ) )
g_Config . iTimeFormat = 2 ;
y + = 10 ;
} else
g_Config . iTimeFormat = 0 ;
bool date = g_Config . iDateFormat > 0 ;
UICheckBox ( GEN_ID , x , y + = stride , s - > T ( " Date Format " ) , ALIGN_TOPLEFT , & date ) ;
if ( date ) {
if ( g_Config . iDateFormat < = 0 )
g_Config . iDateFormat = 1 ;
char button [ 256 ] ;
std : : string type ;
switch ( g_Config . iDateFormat ) {
case 1 : type = " YYYYMMDD " ; break ;
case 2 : type = " MMDDYYYY " ; break ;
case 3 : type = " DDMMYYYY " ; break ;
}
sprintf ( button , " %s %s " , s - > T ( " Format : " ) , type . c_str ( ) ) ;
ui_draw2d . DrawText ( UBUNTU24 , button , x + 60 , y + = stride , 0xFFFFFFFF , ALIGN_LEFT ) ;
HLinear hlinear1 ( x + 350 , y , 10 ) ;
if ( UIButton ( GEN_ID , hlinear1 , 70 , 0 , s - > T ( " YMD " ) , ALIGN_LEFT ) )
g_Config . iDateFormat = 1 ;
if ( UIButton ( GEN_ID , hlinear1 , 70 , 0 , s - > T ( " MDY " ) , ALIGN_LEFT ) )
g_Config . iDateFormat = 2 ;
if ( UIButton ( GEN_ID , hlinear1 , 70 , 0 , s - > T ( " DMY " ) , ALIGN_LEFT ) )
g_Config . iDateFormat = 3 ;
y + = 10 ;
} else
g_Config . iDateFormat = 0 ;
2013-06-21 02:54:10 +08:00
*/
2013-06-10 22:06:51 +02:00
# ifndef ANDROID
2013-05-23 13:10:39 +02:00
UICheckBox ( GEN_ID , x , y + = stride , s - > T ( " Enable Cheats " ) , ALIGN_TOPLEFT , & g_Config . bEnableCheats ) ;
2013-06-18 14:03:49 +08:00
if ( g_Config . bEnableCheats ) {
HLinear hlinear1 ( x + 60 , y + = stride + 10 , 20 ) ;
if ( UIButton ( GEN_ID , hlinear1 , LARGE_BUTTON_WIDTH + 50 , 0 , s - > T ( " Reload Cheats " ) , ALIGN_TOPLEFT ) )
g_Config . bReloadCheats = true ;
y + = 10 ;
2013-05-30 02:08:20 -05:00
}
2013-06-10 22:06:51 +02:00
# endif
2013-06-18 14:03:49 +08:00
HLinear hlinear2 ( x , y + = stride + 10 , 20 ) ;
2013-06-10 22:06:51 +02:00
2013-06-03 16:25:48 +08:00
if ( UIButton ( GEN_ID , hlinear2 , LARGE_BUTTON_WIDTH , 0 , s - > T ( " Language " ) , ALIGN_TOPLEFT ) ) {
screenManager ( ) - > push ( new LanguageScreen ( ) ) ;
2013-06-19 13:08:29 +08:00
}
2013-05-30 02:08:20 -05:00
2013-04-21 00:07:54 +08:00
UIEnd ( ) ;
}
2013-04-17 04:57:13 +08:00
void ControlsScreen : : render ( ) {
UIShader_Prepare ( ) ;
UIBegin ( UIShader_Get ( ) ) ;
DrawBackground ( 1.0f ) ;
2013-04-18 11:58:54 +02:00
I18NCategory * c = GetI18NCategory ( " Controls " ) ;
I18NCategory * g = GetI18NCategory ( " General " ) ;
2013-04-17 04:57:13 +08:00
2013-04-20 00:01:29 +02:00
ui_draw2d . SetFontScale ( 1.5f , 1.5f ) ;
2013-05-15 18:09:30 +08:00
ui_draw2d . DrawText ( UBUNTU24 , c - > T ( " Controls Settings " ) , dp_xres / 2 , 10 , 0xFFFFFFFF , ALIGN_HCENTER ) ;
2013-04-20 00:01:29 +02:00
ui_draw2d . SetFontScale ( 1.0f , 1.0f ) ;
2013-04-18 11:58:54 +02:00
2013-04-21 00:07:54 +08:00
if ( UIButton ( GEN_ID , Pos ( dp_xres - 10 , dp_yres - 10 ) , LARGE_BUTTON_WIDTH , 0 , g - > T ( " Back " ) , ALIGN_RIGHT | ALIGN_BOTTOM ) ) {
2013-04-17 04:57:13 +08:00
screenManager ( ) - > finishDialog ( this , DR_OK ) ;
}
int x = 30 ;
2013-06-03 16:25:48 +08:00
int y = 35 ;
2013-04-17 04:57:13 +08:00
int stride = 40 ;
2013-04-18 09:01:23 +08:00
int columnw = 440 ;
2013-04-17 04:57:13 +08:00
2013-04-18 11:58:54 +02:00
UICheckBox ( GEN_ID , x , y + = stride , c - > T ( " OnScreen " , " On-Screen Touch Controls " ) , ALIGN_TOPLEFT , & g_Config . bShowTouchControls ) ;
2013-06-23 05:46:54 +08:00
UICheckBox ( GEN_ID , x , y + = stride , c - > T ( " Tilt " , " Tilt to Analog (horizontal) " ) , ALIGN_TOPLEFT , & g_Config . bAccelerometerToAnalogHoriz ) ;
2013-04-17 04:57:13 +08:00
if ( g_Config . bShowTouchControls ) {
2013-06-23 05:30:54 +08:00
UICheckBox ( GEN_ID , x , y + = stride , c - > T ( " Show Analog Stick " ) , ALIGN_TOPLEFT , & g_Config . bShowAnalogStick ) ;
2013-06-18 18:37:34 +09:00
UICheckBox ( GEN_ID , x , y + = stride , c - > T ( " Buttons Scaling " ) , ALIGN_TOPLEFT , & g_Config . bLargeControls ) ;
if ( g_Config . bLargeControls ) {
char scale [ 256 ] ;
sprintf ( scale , " %s %0.2f " , c - > T ( " Scale : " ) , g_Config . fButtonScale ) ;
ui_draw2d . DrawText ( UBUNTU24 , scale , x + 60 , y + = stride , 0xFFFFFFFF , ALIGN_LEFT ) ;
HLinear hlinear1 ( x + 250 , y , 20 ) ;
if ( UIButton ( GEN_ID , hlinear1 , 80 , 0 , c - > T ( " Auto " ) , ALIGN_LEFT ) )
g_Config . fButtonScale = 1.15 ;
if ( UIButton ( GEN_ID , hlinear1 , 60 , 0 , c - > T ( " -0.1 " ) , ALIGN_LEFT ) )
if ( g_Config . fButtonScale > 1.15 )
g_Config . fButtonScale - = 0.1 ;
if ( UIButton ( GEN_ID , hlinear1 , 60 , 0 , c - > T ( " +0.1 " ) , ALIGN_LEFT ) )
if ( g_Config . fButtonScale < 2.05 )
g_Config . fButtonScale + = 0.1 ;
y + = 20 ;
}
2013-06-17 20:28:22 +02:00
// This will be a slider in the new UI later
2013-06-18 14:03:49 +08:00
bool bTransparent = g_Config . iTouchButtonOpacity < 65 ;
2013-06-17 20:28:22 +02:00
bool prev = bTransparent ;
2013-06-19 13:08:29 +08:00
UICheckBox ( GEN_ID , x , y + = stride , c - > T ( " Buttons Opacity " ) , ALIGN_TOPLEFT , & bTransparent ) ;
2013-06-18 09:45:13 +08:00
if ( bTransparent ) {
char opacity [ 256 ] ;
sprintf ( opacity , " %s %d " , c - > T ( " Opacity : " ) , g_Config . iTouchButtonOpacity ) ;
ui_draw2d . DrawText ( UBUNTU24 , opacity , x + 60 , y + = stride , 0xFFFFFFFF , ALIGN_LEFT ) ;
HLinear hlinear1 ( x + 250 , y , 20 ) ;
if ( UIButton ( GEN_ID , hlinear1 , 80 , 0 , c - > T ( " Auto " ) , ALIGN_LEFT ) )
g_Config . iTouchButtonOpacity = 15 ;
2013-06-18 14:03:49 +08:00
if ( UIButton ( GEN_ID , hlinear1 , 40 , 0 , c - > T ( " -5 " ) , ALIGN_LEFT ) )
2013-06-18 09:45:13 +08:00
if ( g_Config . iTouchButtonOpacity > 15 )
2013-06-18 14:03:49 +08:00
g_Config . iTouchButtonOpacity - = 5 ;
if ( UIButton ( GEN_ID , hlinear1 , 40 , 0 , c - > T ( " +5 " ) , ALIGN_LEFT ) )
if ( g_Config . iTouchButtonOpacity < 65 )
g_Config . iTouchButtonOpacity + = 5 ;
2013-06-18 09:45:13 +08:00
y + = 20 ;
}
2013-06-17 20:28:22 +02:00
if ( bTransparent ! = prev )
g_Config . iTouchButtonOpacity = bTransparent ? 15 : 65 ;
}
2013-04-17 04:57:13 +08:00
UIEnd ( ) ;
}
2012-11-01 16:19:01 +01:00
class FileListAdapter : public UIListAdapter {
public :
2013-03-30 20:10:32 +01:00
FileListAdapter ( const FileSelectScreenOptions & options , const std : : vector < FileInfo > * items , UIContext * ctx )
: options_ ( options ) , items_ ( items ) , ctx_ ( ctx ) { }
2012-11-01 16:19:01 +01:00
virtual size_t getCount ( ) const { return items_ - > size ( ) ; }
virtual void drawItem ( int item , int x , int y , int w , int h , bool active ) const ;
private :
const FileSelectScreenOptions & options_ ;
const std : : vector < FileInfo > * items_ ;
2013-03-30 20:10:32 +01:00
const UIContext * ctx_ ;
2012-11-01 16:19:01 +01:00
} ;
void FileListAdapter : : drawItem ( int item , int x , int y , int w , int h , bool selected ) const
{
int icon = - 1 ;
if ( ( * items_ ) [ item ] . isDirectory ) {
icon = options_ . folderIcon ;
} else {
std : : string extension = getFileExtension ( ( * items_ ) [ item ] . name ) ;
auto iter = options_ . iconMapping . find ( extension ) ;
if ( iter ! = options_ . iconMapping . end ( ) )
icon = iter - > second ;
}
2013-03-30 20:10:32 +01:00
2013-04-14 12:24:51 +02:00
float scaled_h = ui_atlas . images [ I_BUTTON ] . h ;
float scaled_w = scaled_h * ( 144.f / 80.f ) ;
int iconSpace = scaled_w + 10 ;
2012-11-01 16:19:01 +01:00
ui_draw2d . DrawImage2GridH ( selected ? I_BUTTON_SELECTED : I_BUTTON , x , y , x + w ) ;
ui_draw2d . DrawTextShadow ( UBUNTU24 , ( * items_ ) [ item ] . name . c_str ( ) , x + UI_SPACE + iconSpace , y + 25 , 0xFFFFFFFF , ALIGN_LEFT | ALIGN_VCENTER ) ;
2013-03-30 20:10:32 +01:00
// This might create a texture so we must flush first.
UIFlush ( ) ;
GameInfo * ginfo = 0 ;
2013-04-13 21:24:07 +02:00
if ( ! ( * items_ ) [ item ] . isDirectory ) {
2013-03-30 20:10:32 +01:00
ginfo = g_gameInfoCache . GetInfo ( ( * items_ ) [ item ] . fullName , false ) ;
2013-04-13 21:24:07 +02:00
if ( ! ginfo ) {
ELOG ( " No ginfo :( %s " , ( * items_ ) [ item ] . fullName . c_str ( ) ) ;
}
}
if ( ginfo ) {
if ( ginfo - > iconTexture ) {
uint32_t color = whiteAlpha ( ease ( ( time_now_d ( ) - ginfo - > timeIconWasLoaded ) * 2 ) ) ;
UIFlush ( ) ;
ginfo - > iconTexture - > Bind ( 0 ) ;
ui_draw2d . DrawTexRect ( x + 10 , y , x + 10 + scaled_w , y + scaled_h , 0 , 0 , 1 , 1 , color ) ;
ui_draw2d . Flush ( ) ;
ctx_ - > RebindTexture ( ) ;
}
2013-03-30 20:10:32 +01:00
} else {
if ( icon ! = - 1 )
ui_draw2d . DrawImage ( icon , x + UI_SPACE , y + 25 , 1.0f , 0xFFFFFFFF , ALIGN_VCENTER | ALIGN_LEFT ) ;
}
2012-11-01 16:19:01 +01:00
}
FileSelectScreen : : FileSelectScreen ( const FileSelectScreenOptions & options ) : options_ ( options ) {
currentDirectory_ = g_Config . currentDirectory ;
2013-03-30 20:10:32 +01:00
# ifdef _WIN32
// HACK
// currentDirectory_ = "E:/PSP ISO/";
# endif
2012-11-01 16:19:01 +01:00
updateListing ( ) ;
}
void FileSelectScreen : : updateListing ( ) {
listing_ . clear ( ) ;
2012-11-14 02:20:01 +10:00
getFilesInDir ( currentDirectory_ . c_str ( ) , & listing_ , options_ . filter ) ;
2012-11-01 16:19:01 +01:00
g_Config . currentDirectory = currentDirectory_ ;
list_ . contentChanged ( ) ;
}
void FileSelectScreen : : update ( InputState & input_state ) {
if ( input_state . pad_buttons_down & PAD_BUTTON_BACK ) {
g_Config . Save ( ) ;
screenManager ( ) - > switchScreen ( new MenuScreen ( ) ) ;
}
}
void FileSelectScreen : : render ( ) {
2013-03-30 20:10:32 +01:00
FileListAdapter adapter ( options_ , & listing_ , screenManager ( ) - > getUIContext ( ) ) ;
2012-11-01 16:19:01 +01:00
2013-04-18 11:58:54 +02:00
I18NCategory * g = GetI18NCategory ( " General " ) ;
2012-11-01 16:19:01 +01:00
UIShader_Prepare ( ) ;
2013-03-30 19:23:20 +01:00
UIBegin ( UIShader_Get ( ) ) ;
2012-11-01 16:19:01 +01:00
DrawBackground ( 1.0f ) ;
if ( list_ . Do ( GEN_ID , 10 , BUTTON_HEIGHT + 20 , dp_xres - 20 , dp_yres - BUTTON_HEIGHT - 30 , & adapter ) ) {
if ( listing_ [ list_ . selected ] . isDirectory ) {
currentDirectory_ = listing_ [ list_ . selected ] . fullName ;
ILOG ( " %s " , currentDirectory_ . c_str ( ) ) ;
updateListing ( ) ;
list_ . selected = - 1 ;
} else {
std : : string boot_filename = listing_ [ list_ . selected ] . fullName ;
ILOG ( " Selected: %i : %s " , list_ . selected , boot_filename . c_str ( ) ) ;
list_ . selected = - 1 ;
g_Config . Save ( ) ;
2013-04-21 19:32:29 +02:00
UIEnd ( ) ;
2012-11-01 16:19:01 +01:00
screenManager ( ) - > switchScreen ( new EmuScreen ( boot_filename ) ) ;
2013-04-21 19:32:29 +02:00
return ;
2012-11-01 16:19:01 +01:00
}
}
ui_draw2d . DrawImageStretch ( I_BUTTON , 0 , 0 , dp_xres , 70 ) ;
2013-04-18 11:58:54 +02:00
if ( UIButton ( GEN_ID , Pos ( 10 , 10 ) , SMALL_BUTTON_WIDTH , 0 , g - > T ( " Up " ) , ALIGN_TOPLEFT ) ) {
2012-11-01 16:19:01 +01:00
currentDirectory_ = getDir ( currentDirectory_ ) ;
updateListing ( ) ;
}
2013-06-18 01:21:20 +02:00
if ( UIButton ( GEN_ID , Pos ( SMALL_BUTTON_WIDTH + 20 , 10 ) , SMALL_BUTTON_WIDTH , 0 , g - > T ( " Home " ) , ALIGN_TOPLEFT ) ) {
currentDirectory_ = g_Config . externalDirectory ;
updateListing ( ) ;
}
ui_draw2d . DrawTextShadow ( UBUNTU24 , currentDirectory_ . c_str ( ) , 30 + SMALL_BUTTON_WIDTH * 2 , 10 + 25 , 0xFFFFFFFF , ALIGN_LEFT | ALIGN_VCENTER ) ;
2013-04-18 11:58:54 +02:00
if ( UIButton ( GEN_ID , Pos ( dp_xres - 10 , 10 ) , SMALL_BUTTON_WIDTH , 0 , g - > T ( " Back " ) , ALIGN_RIGHT ) ) {
2012-11-01 16:19:01 +01:00
g_Config . Save ( ) ;
screenManager ( ) - > switchScreen ( new MenuScreen ( ) ) ;
2013-03-29 08:48:55 +01:00
}
2013-04-18 09:01:23 +08:00
2012-11-01 16:19:01 +01:00
UIEnd ( ) ;
}
void CreditsScreen : : update ( InputState & input_state ) {
2013-03-29 19:32:20 +01:00
globalUIState = UISTATE_MENU ;
2012-11-01 16:19:01 +01:00
if ( input_state . pad_buttons_down & PAD_BUTTON_BACK ) {
screenManager ( ) - > switchScreen ( new MenuScreen ( ) ) ;
}
frames_ + + ;
}
void CreditsScreen : : render ( ) {
2013-06-29 18:21:23 -03:00
I18NCategory * c = GetI18NCategory ( " PSPCredits " ) ;
const char * credits [ ] = {
" PPSSPP " ,
" " ,
" " ,
c - > T ( " title " , " A fast and portable PSP emulator " ) ,
" " ,
c - > T ( " created " , " Created by " ) ,
" Henrik Rydgård " ,
" (aka hrydgard, ector) " ,
" " ,
" " ,
c - > T ( " contributors " , " Contributors: " ) ,
" unknownbrackets " ,
" oioitff " ,
" xsacha " ,
" raven02 " ,
" tpunix " ,
" orphis " ,
" sum2012 " ,
" mikusp " ,
" aquanull " ,
" The Dax " ,
" tmaul " ,
" artart78 " ,
" ced2911 " ,
" soywiz " ,
" kovensky " ,
" xele " ,
" chaserhjk " ,
" evilcorn " ,
" daniel dressler " ,
" makotech222 " ,
" CPkmn " ,
" mgaver " ,
" jeid3 " ,
" cinaera/BeaR " ,
" jtraynham " ,
" Kingcom " ,
" aquanull " ,
" arnastia " ,
2013-06-30 20:00:35 -03:00
" lioncash " ,
" JulianoAmaralChaves " ,
2013-06-29 18:21:23 -03:00
" " ,
c - > T ( " written " , " Written in C++ for speed and portability " ) ,
" " ,
" " ,
c - > T ( " tools " , " Free tools used: " ) ,
# ifdef ANDROID
" Android SDK + NDK " ,
# elif defined(BLACKBERRY)
" Blackberry NDK " ,
# endif
# if defined(USING_QT_UI)
" Qt " ,
# else
" SDL " ,
# endif
" CMake " ,
" freetype2 " ,
" zlib " ,
" PSP SDK " ,
" " ,
" " ,
c - > T ( " website " , " Check out the website: " ) ,
" www.ppsspp.org " ,
c - > T ( " list " , " compatibility lists, forums, and development info " ) ,
" " ,
" " ,
c - > T ( " check " , " Also check out Dolphin, the best Wii/GC emu around: " ) ,
" http://www.dolphin-emu.org " ,
" " ,
" " ,
c - > T ( " info1 " , " PPSSPP is intended for educational purposes only. " ) ,
" " ,
c - > T ( " info2 " , " Please make sure that you own the rights to any games " ) ,
c - > T ( " info3 " , " you play by owning the UMD or by buying the digital " ) ,
c - > T ( " info4 " , " download from the PSN store on your real PSP. " ) ,
" " ,
" " ,
c - > T ( " info5 " , " PSP is a trademark by Sony, Inc. " ) ,
} ;
2013-03-02 12:31:11 -08:00
// TODO: This is kinda ugly, done on every frame...
char temp [ 256 ] ;
2013-03-21 19:28:20 +01:00
sprintf ( temp , " PPSSPP %s " , PPSSPP_GIT_VERSION ) ;
2013-03-02 13:50:38 -08:00
credits [ 0 ] = ( const char * ) temp ;
2013-03-02 12:31:11 -08:00
2012-11-01 16:19:01 +01:00
UIShader_Prepare ( ) ;
2013-03-30 19:23:20 +01:00
UIBegin ( UIShader_Get ( ) ) ;
2012-11-01 16:19:01 +01:00
DrawBackground ( 1.0f ) ;
const int numItems = ARRAY_SIZE ( credits ) ;
int itemHeight = 36 ;
int totalHeight = numItems * itemHeight + dp_yres + 200 ;
int y = dp_yres - ( frames_ % totalHeight ) ;
for ( int i = 0 ; i < numItems ; i + + ) {
float alpha = linearInOut ( y + 32 , 64 , dp_yres - 192 , 64 ) ;
if ( alpha > 0.0f ) {
UIText ( dp_xres / 2 , y , credits [ i ] , whiteAlpha ( alpha ) , ease ( alpha ) , ALIGN_HCENTER ) ;
}
y + = itemHeight ;
}
2013-04-18 11:58:54 +02:00
I18NCategory * g = GetI18NCategory ( " General " ) ;
2012-11-01 16:19:01 +01:00
2013-04-18 11:58:54 +02:00
if ( UIButton ( GEN_ID , Pos ( dp_xres - 10 , dp_yres - 10 ) , 200 , 0 , g - > T ( " Back " ) , ALIGN_BOTTOMRIGHT ) ) {
2013-06-10 22:06:51 +02:00
screenManager ( ) - > finishDialog ( this , DR_OK ) ;
2012-11-01 16:19:01 +01:00
}
UIEnd ( ) ;
}
void ErrorScreen : : update ( InputState & input_state ) {
if ( input_state . pad_buttons_down & PAD_BUTTON_BACK ) {
screenManager ( ) - > finishDialog ( this , DR_OK ) ;
}
}
void ErrorScreen : : render ( )
{
UIShader_Prepare ( ) ;
2013-03-30 19:23:20 +01:00
UIBegin ( UIShader_Get ( ) ) ;
2012-11-01 16:19:01 +01:00
DrawBackground ( 1.0f ) ;
2013-05-25 13:37:43 +08:00
I18NCategory * ge = GetI18NCategory ( " Error " ) ;
2013-04-20 00:01:29 +02:00
ui_draw2d . SetFontScale ( 1.5f , 1.5f ) ;
2013-05-25 13:37:43 +08:00
ui_draw2d . DrawText ( UBUNTU24 , ge - > T ( errorTitle_ . c_str ( ) ) , dp_xres / 2 , 30 , 0xFFFFFFFF , ALIGN_HCENTER ) ;
2013-04-20 00:01:29 +02:00
ui_draw2d . SetFontScale ( 1.0f , 1.0f ) ;
2013-05-25 13:37:43 +08:00
ui_draw2d . DrawText ( UBUNTU24 , ge - > T ( errorMessage_ . c_str ( ) ) , 40 , 120 , 0xFFFFFFFF , ALIGN_LEFT ) ;
2012-11-01 16:19:01 +01:00
2013-04-18 11:58:54 +02:00
I18NCategory * g = GetI18NCategory ( " General " ) ;
if ( UIButton ( GEN_ID , Pos ( dp_xres - 10 , dp_yres - 10 ) , 200 , 0 , g - > T ( " Back " ) , ALIGN_BOTTOMRIGHT ) ) {
2012-11-01 16:19:01 +01:00
screenManager ( ) - > finishDialog ( this , DR_OK ) ;
}
UIEnd ( ) ;
}