2009-07-30 07:22:00 +00:00
// Copyright (C) 2003 Dolphin Project.
2008-12-08 05:30:24 +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.
// 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 SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
2011-01-30 14:20:20 +00:00
# ifdef __APPLE__
# import <Cocoa / Cocoa.h>
# endif
2010-07-20 03:23:25 +00:00
# include "Common.h"
# include "CommonPaths.h"
2008-12-08 05:30:24 +00:00
# include "Globals.h"
# include "VolumeCreator.h"
# include "Filesystem.h"
# include "ISOProperties.h"
2011-02-03 17:51:12 +00:00
# include "PHackSettings.h"
2008-12-08 05:30:24 +00:00
# include "PatchAddEdit.h"
2008-12-17 04:14:24 +00:00
# include "ARCodeAddEdit.h"
2010-07-22 01:48:48 +00:00
# include "GeckoCodeDiag.h"
2009-02-14 17:32:03 +00:00
# include "ConfigManager.h"
2009-07-30 07:09:26 +00:00
# include "StringUtil.h"
2008-12-08 05:30:24 +00:00
2010-06-01 21:03:02 +00:00
# include "../resources/isoprop_file.xpm"
# include "../resources/isoprop_folder.xpm"
# include "../resources/isoprop_disc.xpm"
2009-09-13 22:03:18 +00:00
2009-03-10 17:19:30 +00:00
struct WiiPartition
{
DiscIO : : IVolume * Partition ;
DiscIO : : IFileSystem * FileSystem ;
std : : vector < const DiscIO : : SFileInfo * > Files ;
} ;
std : : vector < WiiPartition > WiiDisc ;
2008-12-08 05:30:24 +00:00
DiscIO : : IVolume * OpenISO = NULL ;
DiscIO : : IFileSystem * pFileSystem = NULL ;
std : : vector < PatchEngine : : Patch > onFrame ;
2008-12-17 04:14:24 +00:00
std : : vector < ActionReplay : : ARCode > arCodes ;
2011-02-03 17:51:12 +00:00
PHackData PHack_Data ;
2008-12-08 05:30:24 +00:00
BEGIN_EVENT_TABLE ( CISOProperties , wxDialog )
EVT_CLOSE ( CISOProperties : : OnClose )
2011-03-15 21:57:00 +00:00
EVT_BUTTON ( wxID_OK , CISOProperties : : OnCloseClick )
2008-12-08 05:30:24 +00:00
EVT_BUTTON ( ID_EDITCONFIG , CISOProperties : : OnEditConfig )
EVT_CHOICE ( ID_EMUSTATE , CISOProperties : : SetRefresh )
2009-02-21 14:40:34 +00:00
EVT_CHOICE ( ID_EMU_ISSUES , CISOProperties : : SetRefresh )
2011-02-03 17:51:12 +00:00
EVT_BUTTON ( ID_PHSETTINGS , CISOProperties : : PHackButtonClicked )
2008-12-08 05:30:24 +00:00
EVT_LISTBOX ( ID_PATCHES_LIST , CISOProperties : : ListSelectionChanged )
EVT_BUTTON ( ID_EDITPATCH , CISOProperties : : PatchButtonClicked )
EVT_BUTTON ( ID_ADDPATCH , CISOProperties : : PatchButtonClicked )
EVT_BUTTON ( ID_REMOVEPATCH , CISOProperties : : PatchButtonClicked )
EVT_LISTBOX ( ID_CHEATS_LIST , CISOProperties : : ListSelectionChanged )
EVT_BUTTON ( ID_EDITCHEAT , CISOProperties : : ActionReplayButtonClicked )
EVT_BUTTON ( ID_ADDCHEAT , CISOProperties : : ActionReplayButtonClicked )
EVT_BUTTON ( ID_REMOVECHEAT , CISOProperties : : ActionReplayButtonClicked )
EVT_MENU ( IDM_BNRSAVEAS , CISOProperties : : OnBannerImageSave )
EVT_TREE_ITEM_RIGHT_CLICK ( ID_TREECTRL , CISOProperties : : OnRightClickOnTree )
EVT_MENU ( IDM_EXTRACTFILE , CISOProperties : : OnExtractFile )
EVT_MENU ( IDM_EXTRACTDIR , CISOProperties : : OnExtractDir )
2009-09-13 22:03:18 +00:00
EVT_MENU ( IDM_EXTRACTALL , CISOProperties : : OnExtractDir )
2009-12-29 13:59:38 +00:00
EVT_MENU ( IDM_EXTRACTAPPLOADER , CISOProperties : : OnExtractDataFromHeader )
EVT_MENU ( IDM_EXTRACTDOL , CISOProperties : : OnExtractDataFromHeader )
2012-05-04 10:49:10 +00:00
EVT_MENU ( IDM_CHECKINTEGRITY , CISOProperties : : CheckPartitionIntegrity )
2009-02-14 17:32:03 +00:00
EVT_CHOICE ( ID_LANG , CISOProperties : : OnChangeBannerLang )
2008-12-08 05:30:24 +00:00
END_EVENT_TABLE ( )
CISOProperties : : CISOProperties ( const std : : string fileName , wxWindow * parent , wxWindowID id , const wxString & title , const wxPoint & position , const wxSize & size , long style )
: wxDialog ( parent , id , title , position , size , style )
{
2009-03-10 17:19:30 +00:00
OpenISO = DiscIO : : CreateVolumeFromFilename ( fileName ) ;
if ( DiscIO : : IsVolumeWiiDisc ( OpenISO ) )
{
2009-12-28 19:34:19 +00:00
for ( u32 i = 0 ; i < 0xFFFFFFFF ; i + + ) // yes, technically there can be OVER NINE THOUSAND partitions...
2009-03-10 17:19:30 +00:00
{
WiiPartition temp ;
2009-05-22 00:36:44 +00:00
if ( ( temp . Partition = DiscIO : : CreateVolumeFromFilename ( fileName , 0 , i ) ) ! = NULL )
2009-03-10 17:19:30 +00:00
{
2009-04-27 23:27:56 +00:00
if ( ( temp . FileSystem = DiscIO : : CreateFileSystem ( temp . Partition ) ) ! = NULL )
{
temp . FileSystem - > GetFileList ( temp . Files ) ;
WiiDisc . push_back ( temp ) ;
}
2009-03-10 17:19:30 +00:00
}
else
break ;
}
}
else
{
2009-06-07 02:54:07 +00:00
// TODO : Should we add a way to browse the wad file ?
if ( ! DiscIO : : IsVolumeWadFile ( OpenISO ) )
{
2009-09-04 06:52:34 +00:00
GCFiles . clear ( ) ;
2009-06-07 02:54:07 +00:00
pFileSystem = DiscIO : : CreateFileSystem ( OpenISO ) ;
2010-01-11 05:07:56 +00:00
if ( pFileSystem )
pFileSystem - > GetFileList ( GCFiles ) ;
2009-06-07 02:54:07 +00:00
}
2009-03-10 17:19:30 +00:00
}
2008-12-08 05:30:24 +00:00
2009-02-14 17:32:03 +00:00
OpenGameListItem = new GameListItem ( fileName ) ;
2008-12-08 05:30:24 +00:00
2009-02-14 17:32:03 +00:00
bRefreshList = false ;
2009-01-28 10:21:18 +00:00
2009-06-07 02:54:07 +00:00
CreateGUIControls ( DiscIO : : IsVolumeWadFile ( OpenISO ) ) ;
2008-12-08 05:30:24 +00:00
2011-02-03 17:51:12 +00:00
std : : string _iniFilename = OpenISO - > GetUniqueID ( ) ;
2011-01-31 20:30:25 +00:00
2010-12-15 23:18:08 +00:00
if ( ! _iniFilename . length ( ) )
{
char tmp [ 17 ] ;
u8 _tTitleID [ 8 ] ;
if ( OpenISO - > GetTitleID ( _tTitleID ) )
{
snprintf ( tmp , 17 , " %016llx " , Common : : swap64 ( _tTitleID ) ) ;
_iniFilename = tmp ;
}
}
2011-02-28 20:40:15 +00:00
GameIniFile = File : : GetUserPath ( D_GAMECONFIG_IDX ) + _iniFilename + " .ini " ;
2008-12-08 05:30:24 +00:00
if ( GameIni . Load ( GameIniFile . c_str ( ) ) )
LoadGameConfig ( ) ;
else
{
2010-02-14 14:06:33 +00:00
// Will fail out if GameConfig folder doesn't exist
2011-03-11 10:21:46 +00:00
std : : ofstream f ( GameIniFile . c_str ( ) ) ;
2010-02-14 14:06:33 +00:00
if ( f )
{
2011-03-11 10:21:46 +00:00
f < < " # " < < OpenISO - > GetUniqueID ( ) < < " - " < < OpenISO - > GetName ( ) < < ' \n '
< < " [Core] Values set here will override the main dolphin settings. \n "
< < " [EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. \n "
< < " [OnFrame] Add memory patches to be applied every frame here. \n "
< < " [ActionReplay] Add action replay cheats here. \n " ;
f . close ( ) ;
2010-02-14 14:06:33 +00:00
}
2008-12-08 05:30:24 +00:00
if ( GameIni . Load ( GameIniFile . c_str ( ) ) )
LoadGameConfig ( ) ;
else
2011-03-16 22:22:21 +00:00
wxMessageBox ( wxString : : Format ( _ ( " Could not create %s " ) ,
wxString : : From8BitData ( GameIniFile . c_str ( ) ) . c_str ( ) ) ,
_ ( " Error " ) , wxOK | wxICON_ERROR , this ) ;
2008-12-08 05:30:24 +00:00
}
// Disk header and apploader
2011-12-19 06:01:46 +00:00
std : : wstring wname ;
wxString name ;
if ( OpenGameListItem - > GetName ( wname ) )
2012-01-27 08:30:52 +00:00
name = wname . c_str ( ) ;
2011-12-19 06:01:46 +00:00
else
name = wxString ( OpenISO - > GetName ( ) . c_str ( ) , wxConvUTF8 ) ;
m_Name - > SetValue ( name ) ;
2008-12-08 05:30:24 +00:00
m_GameID - > SetValue ( wxString ( OpenISO - > GetUniqueID ( ) . c_str ( ) , wxConvUTF8 ) ) ;
switch ( OpenISO - > GetCountry ( ) )
{
case DiscIO : : IVolume : : COUNTRY_EUROPE :
2011-01-05 04:35:46 +00:00
m_Country - > SetValue ( _ ( " EUROPE " ) ) ;
2009-07-03 22:34:51 +00:00
break ;
2008-12-08 05:30:24 +00:00
case DiscIO : : IVolume : : COUNTRY_FRANCE :
2011-01-05 04:35:46 +00:00
m_Country - > SetValue ( _ ( " FRANCE " ) ) ;
2009-07-03 22:34:51 +00:00
break ;
2009-03-07 18:03:53 +00:00
case DiscIO : : IVolume : : COUNTRY_ITALY :
2011-01-05 04:35:46 +00:00
m_Country - > SetValue ( _ ( " ITALY " ) ) ;
2008-12-08 05:30:24 +00:00
break ;
2010-10-03 06:10:14 +00:00
case DiscIO : : IVolume : : COUNTRY_RUSSIA :
2011-01-05 04:35:46 +00:00
m_Country - > SetValue ( _ ( " RUSSIA " ) ) ;
2010-10-03 06:10:14 +00:00
break ;
2008-12-08 05:30:24 +00:00
case DiscIO : : IVolume : : COUNTRY_USA :
2011-01-05 04:35:46 +00:00
m_Country - > SetValue ( _ ( " USA " ) ) ;
2009-12-28 19:34:19 +00:00
m_Lang - > SetSelection ( 0 ) ;
m_Lang - > Disable ( ) ; // For NTSC Games, there's no multi lang
2008-12-08 05:30:24 +00:00
break ;
2009-07-03 22:34:51 +00:00
case DiscIO : : IVolume : : COUNTRY_JAPAN :
2011-01-05 04:35:46 +00:00
m_Country - > SetValue ( _ ( " JAPAN " ) ) ;
2009-12-28 19:34:19 +00:00
m_Lang - > SetSelection ( - 1 ) ;
m_Lang - > Disable ( ) ; // For NTSC Games, there's no multi lang
2009-07-03 22:34:51 +00:00
break ;
case DiscIO : : IVolume : : COUNTRY_KOREA :
2011-01-05 04:35:46 +00:00
m_Country - > SetValue ( _ ( " KOREA " ) ) ;
2009-07-03 22:34:51 +00:00
break ;
case DiscIO : : IVolume : : COUNTRY_TAIWAN :
2011-01-05 04:35:46 +00:00
m_Country - > SetValue ( _ ( " TAIWAN " ) ) ;
2009-12-28 19:34:19 +00:00
m_Lang - > SetSelection ( - 1 ) ;
m_Lang - > Disable ( ) ; // For NTSC Games, there's no multi lang
2009-07-03 22:34:51 +00:00
break ;
case DiscIO : : IVolume : : COUNTRY_SDK :
2011-01-05 04:35:46 +00:00
m_Country - > SetValue ( _ ( " No Country (SDK) " ) ) ;
2008-12-08 05:30:24 +00:00
break ;
default :
2011-01-05 04:35:46 +00:00
m_Country - > SetValue ( _ ( " UNKNOWN " ) ) ;
2008-12-08 05:30:24 +00:00
break ;
}
2010-06-11 08:39:03 +00:00
wxString temp = _T ( " 0x " ) + wxString : : From8BitData ( OpenISO - > GetMakerID ( ) . c_str ( ) ) ;
2008-12-08 05:30:24 +00:00
m_MakerID - > SetValue ( temp ) ;
2010-06-11 08:39:03 +00:00
m_Date - > SetValue ( wxString : : From8BitData ( OpenISO - > GetApploaderDate ( ) . c_str ( ) ) ) ;
2011-01-05 04:35:46 +00:00
m_FST - > SetValue ( wxString : : Format ( wxT ( " %u " ) , OpenISO - > GetFSTSize ( ) ) ) ;
2008-12-08 05:30:24 +00:00
2009-12-28 19:34:19 +00:00
// Here we set all the info to be shown (be it SJIS or Ascii) + we set the window title
2011-01-08 15:05:59 +00:00
ChangeBannerDetails ( ( int ) SConfig : : GetInstance ( ) . m_LocalCoreStartupParameter . SelectedLanguage ) ;
2009-02-14 17:32:03 +00:00
m_Banner - > SetBitmap ( OpenGameListItem - > GetImage ( ) ) ;
2008-12-08 05:30:24 +00:00
m_Banner - > Connect ( wxID_ANY , wxEVT_RIGHT_DOWN ,
wxMouseEventHandler ( CISOProperties : : RightClickOnBanner ) , ( wxObject * ) NULL , this ) ;
// Filesystem browser/dumper
2011-03-16 22:22:21 +00:00
// TODO : Should we add a way to browse the wad file ?
if ( ! DiscIO : : IsVolumeWadFile ( OpenISO ) )
2009-03-10 17:19:30 +00:00
{
2011-03-16 22:22:21 +00:00
if ( DiscIO : : IsVolumeWiiDisc ( OpenISO ) )
2009-06-07 02:54:07 +00:00
{
2011-03-16 22:22:21 +00:00
for ( u32 i = 0 ; i < WiiDisc . size ( ) ; i + + )
{
WiiPartition partition = WiiDisc . at ( i ) ;
wxTreeItemId PartitionRoot =
2011-04-17 21:39:58 +00:00
m_Treectrl - > AppendItem ( RootId , wxString : : Format ( _ ( " Partition %i " ) , i ) , 0 , 0 ) ;
2011-03-16 22:22:21 +00:00
CreateDirectoryTree ( PartitionRoot , partition . Files , 1 , partition . Files . at ( 0 ) - > m_FileSize ) ;
if ( i = = 1 )
m_Treectrl - > Expand ( PartitionRoot ) ;
}
2009-06-07 02:54:07 +00:00
}
2011-03-16 22:22:21 +00:00
else if ( ! GCFiles . empty ( ) )
CreateDirectoryTree ( RootId , GCFiles , 1 , GCFiles . at ( 0 ) - > m_FileSize ) ;
m_Treectrl - > Expand ( RootId ) ;
2009-03-10 17:19:30 +00:00
}
2008-12-08 05:30:24 +00:00
}
CISOProperties : : ~ CISOProperties ( )
{
2011-03-16 22:22:21 +00:00
if ( ! IsVolumeWiiDisc ( OpenISO ) & & ! IsVolumeWadFile ( OpenISO ) & & pFileSystem )
delete pFileSystem ;
2010-02-14 14:06:33 +00:00
// two vector's items are no longer valid after deleting filesystem
WiiDisc . clear ( ) ;
GCFiles . clear ( ) ;
2010-02-12 19:28:51 +00:00
delete OpenGameListItem ;
2009-03-24 23:58:32 +00:00
delete OpenISO ;
2008-12-08 05:30:24 +00:00
}
2009-09-13 22:03:18 +00:00
size_t CISOProperties : : CreateDirectoryTree ( wxTreeItemId & parent ,
2011-03-16 22:22:21 +00:00
std : : vector < const DiscIO : : SFileInfo * > fileInfos ,
const size_t _FirstIndex ,
const size_t _LastIndex )
2008-12-08 05:30:24 +00:00
{
2009-09-13 22:03:18 +00:00
size_t CurrentIndex = _FirstIndex ;
2008-12-08 05:30:24 +00:00
2009-09-13 22:03:18 +00:00
while ( CurrentIndex < _LastIndex )
{
const DiscIO : : SFileInfo * rFileInfo = fileInfos [ CurrentIndex ] ;
char * name = ( char * ) rFileInfo - > m_FullPath ;
2008-12-08 05:30:24 +00:00
2009-09-13 22:03:18 +00:00
if ( rFileInfo - > IsDirectory ( ) ) name [ strlen ( name ) - 1 ] = ' \0 ' ;
char * itemName = strrchr ( name , DIR_SEP_CHR ) ;
2008-12-08 05:30:24 +00:00
2009-09-13 22:03:18 +00:00
if ( ! itemName )
itemName = name ;
else
itemName + + ;
2008-12-08 05:30:24 +00:00
2009-09-13 22:03:18 +00:00
// check next index
if ( rFileInfo - > IsDirectory ( ) )
{
2010-06-11 08:39:03 +00:00
wxTreeItemId item = m_Treectrl - > AppendItem ( parent , wxString : : From8BitData ( itemName ) , 1 , 1 ) ;
2009-09-13 22:03:18 +00:00
CurrentIndex = CreateDirectoryTree ( item , fileInfos , CurrentIndex + 1 , ( size_t ) rFileInfo - > m_FileSize ) ;
2008-12-08 05:30:24 +00:00
}
2009-09-13 22:03:18 +00:00
else
{
2010-06-11 08:39:03 +00:00
m_Treectrl - > AppendItem ( parent , wxString : : From8BitData ( itemName ) , 2 , 2 ) ;
2009-09-13 22:03:18 +00:00
CurrentIndex + + ;
}
}
2008-12-08 05:30:24 +00:00
2009-09-13 22:03:18 +00:00
return CurrentIndex ;
2008-12-08 05:30:24 +00:00
}
2009-06-07 02:54:07 +00:00
void CISOProperties : : CreateGUIControls ( bool IsWad )
2008-12-08 05:30:24 +00:00
{
2011-03-16 22:22:21 +00:00
wxButton * const EditConfig =
new wxButton ( this , ID_EDITCONFIG , _ ( " Edit Config " ) , wxDefaultPosition , wxDefaultSize ) ;
2009-06-07 02:54:07 +00:00
EditConfig - > SetToolTip ( _ ( " This will let you Manually Edit the INI config file " ) ) ;
2008-12-08 05:30:24 +00:00
// Notebook
2011-03-16 22:22:21 +00:00
wxNotebook * const m_Notebook =
new wxNotebook ( this , ID_NOTEBOOK , wxDefaultPosition , wxDefaultSize ) ;
wxPanel * const m_GameConfig =
new wxPanel ( m_Notebook , ID_GAMECONFIG , wxDefaultPosition , wxDefaultSize ) ;
2008-12-08 05:30:24 +00:00
m_Notebook - > AddPage ( m_GameConfig , _ ( " GameConfig " ) ) ;
2011-03-16 22:22:21 +00:00
wxPanel * const m_PatchPage =
new wxPanel ( m_Notebook , ID_PATCH_PAGE , wxDefaultPosition , wxDefaultSize ) ;
2009-03-24 23:10:43 +00:00
m_Notebook - > AddPage ( m_PatchPage , _ ( " Patches " ) ) ;
2011-03-16 22:22:21 +00:00
wxPanel * const m_CheatPage =
new wxPanel ( m_Notebook , ID_ARCODE_PAGE , wxDefaultPosition , wxDefaultSize ) ;
2009-03-24 23:10:43 +00:00
m_Notebook - > AddPage ( m_CheatPage , _ ( " AR Codes " ) ) ;
2010-07-22 01:48:48 +00:00
m_geckocode_panel = new Gecko : : CodeConfigPanel ( m_Notebook ) ;
2011-01-05 04:35:46 +00:00
m_Notebook - > AddPage ( m_geckocode_panel , _ ( " Gecko Codes " ) ) ;
2011-03-16 22:22:21 +00:00
wxPanel * const m_Information =
new wxPanel ( m_Notebook , ID_INFORMATION , wxDefaultPosition , wxDefaultSize ) ;
2008-12-08 05:30:24 +00:00
m_Notebook - > AddPage ( m_Information , _ ( " Info " ) ) ;
2009-02-14 17:32:03 +00:00
2009-03-24 23:10:43 +00:00
// GameConfig editing - Overrides and emulation state
2011-03-16 22:22:21 +00:00
wxStaticText * const OverrideText = new wxStaticText ( m_GameConfig , wxID_ANY , _ ( " These settings override core Dolphin settings. \n Undetermined means the game uses Dolphin's setting. " ) ) ;
2009-03-24 23:10:43 +00:00
// Core
2009-10-23 15:26:35 +00:00
CPUThread = new wxCheckBox ( m_GameConfig , ID_USEDUALCORE , _ ( " Enable Dual Core " ) , wxDefaultPosition , wxDefaultSize , wxCHK_3STATE | wxCHK_ALLOW_3RD_STATE_FOR_USER , wxDefaultValidator ) ;
2008-12-08 05:30:24 +00:00
SkipIdle = new wxCheckBox ( m_GameConfig , ID_IDLESKIP , _ ( " Enable Idle Skipping " ) , wxDefaultPosition , wxDefaultSize , wxCHK_3STATE | wxCHK_ALLOW_3RD_STATE_FOR_USER , wxDefaultValidator ) ;
2010-07-29 12:17:47 +00:00
MMU = new wxCheckBox ( m_GameConfig , ID_MMU , _ ( " Enable MMU " ) , wxDefaultPosition , wxDefaultSize , wxCHK_3STATE | wxCHK_ALLOW_3RD_STATE_FOR_USER , wxDefaultValidator ) ;
2011-01-05 04:35:46 +00:00
MMU - > SetToolTip ( _ ( " Enables the Memory Management Unit, needed for some games. (ON = Compatible, OFF = Fast) " ) ) ;
2010-09-06 14:43:28 +00:00
MMUBAT = new wxCheckBox ( m_GameConfig , ID_MMUBAT , _ ( " Enable BAT " ) , wxDefaultPosition , wxDefaultSize , wxCHK_3STATE | wxCHK_ALLOW_3RD_STATE_FOR_USER , wxDefaultValidator ) ;
2011-01-05 04:35:46 +00:00
MMUBAT - > SetToolTip ( _ ( " Enables Block Address Translation (BAT); a function of the Memory Management Unit. Accurate to the hardware, but slow to emulate. (ON = Compatible, OFF = Fast) " ) ) ;
2010-07-29 12:17:47 +00:00
TLBHack = new wxCheckBox ( m_GameConfig , ID_TLBHACK , _ ( " MMU Speed Hack " ) , wxDefaultPosition , wxDefaultSize , wxCHK_3STATE | wxCHK_ALLOW_3RD_STATE_FOR_USER , wxDefaultValidator ) ;
2011-01-05 04:35:46 +00:00
TLBHack - > SetToolTip ( _ ( " Fast version of the MMU. Does not work for every game. " ) ) ;
2011-01-23 03:28:05 +00:00
VBeam = new wxCheckBox ( m_GameConfig , ID_VBEAM , _ ( " Accurate VBeam emulation " ) , wxDefaultPosition , wxDefaultSize , wxCHK_3STATE | wxCHK_ALLOW_3RD_STATE_FOR_USER , wxDefaultValidator ) ;
2011-01-20 08:34:49 +00:00
VBeam - > SetToolTip ( _ ( " If the FPS is erratic, this option may help. (ON = Compatible, OFF = Fast) " ) ) ;
2010-10-15 21:46:51 +00:00
FastDiscSpeed = new wxCheckBox ( m_GameConfig , ID_DISCSPEED , _ ( " Speed up Disc Transfer Rate " ) , wxDefaultPosition , wxDefaultSize , wxCHK_3STATE | wxCHK_ALLOW_3RD_STATE_FOR_USER , wxDefaultValidator ) ;
2011-01-05 04:35:46 +00:00
FastDiscSpeed - > SetToolTip ( _ ( " Enable fast disc access. Needed for a few games. (ON = Fast, OFF = Compatible) " ) ) ;
2010-09-14 13:50:25 +00:00
BlockMerging = new wxCheckBox ( m_GameConfig , ID_MERGEBLOCKS , _ ( " Enable Block Merging " ) , wxDefaultPosition , wxDefaultSize , wxCHK_3STATE | wxCHK_ALLOW_3RD_STATE_FOR_USER , wxDefaultValidator ) ;
2011-01-29 13:26:49 +00:00
DSPHLE = new wxCheckBox ( m_GameConfig , ID_AUDIO_DSP_HLE , _ ( " DSP HLE emulation (fast) " ) , wxDefaultPosition , wxDefaultSize , wxCHK_3STATE | wxCHK_ALLOW_3RD_STATE_FOR_USER , wxDefaultValidator ) ;
2010-09-14 13:50:25 +00:00
2009-03-24 23:10:43 +00:00
// Wii Console
EnableProgressiveScan = new wxCheckBox ( m_GameConfig , ID_ENABLEPROGRESSIVESCAN , _ ( " Enable Progressive Scan " ) , wxDefaultPosition , wxDefaultSize , wxCHK_3STATE | wxCHK_ALLOW_3RD_STATE_FOR_USER , wxDefaultValidator ) ;
EnableWideScreen = new wxCheckBox ( m_GameConfig , ID_ENABLEWIDESCREEN , _ ( " Enable WideScreen " ) , wxDefaultPosition , wxDefaultSize , wxCHK_3STATE | wxCHK_ALLOW_3RD_STATE_FOR_USER , wxDefaultValidator ) ;
2011-10-09 10:54:38 +00:00
DisableWiimoteSpeaker = new wxCheckBox ( m_GameConfig , ID_DISABLEWIIMOTESPEAKER , _ ( " Alternate Wiimote Timing " ) , wxDefaultPosition , wxDefaultSize , wxCHK_3STATE | wxCHK_ALLOW_3RD_STATE_FOR_USER , wxDefaultValidator ) ;
2011-05-25 15:01:49 +00:00
DisableWiimoteSpeaker - > SetToolTip ( _ ( " Mutes the Wiimote speaker. Fixes random disconnections on real wiimotes. No effect on emulated wiimotes. " ) ) ;
2009-03-24 23:10:43 +00:00
// Video
2011-10-28 20:12:12 +00:00
UseBBox = new wxCheckBox ( m_GameConfig , ID_USE_BBOX , _ ( " Enable Bounding Box Calculation " ) , wxDefaultPosition , wxDefaultSize , wxCHK_3STATE | wxCHK_ALLOW_3RD_STATE_FOR_USER ) ;
2011-10-26 00:19:10 +00:00
UseBBox - > SetToolTip ( _ ( " If checked, the bounding box registers will be updated. Used by the Paper Mario games. " ) ) ;
2011-03-16 22:22:21 +00:00
UseZTPSpeedupHack = new wxCheckBox ( m_GameConfig , ID_ZTP_SPEEDUP , _ ( " ZTP hack " ) , wxDefaultPosition , wxDefaultSize , wxCHK_3STATE | wxCHK_ALLOW_3RD_STATE_FOR_USER ) ;
2011-01-05 04:35:46 +00:00
UseZTPSpeedupHack - > SetToolTip ( _ ( " Enable this to speed up The Legend of Zelda: Twilight Princess. Disable for ANY other game. " ) ) ;
2011-02-03 17:51:12 +00:00
2009-05-11 21:20:27 +00:00
// Hack
2011-03-16 22:22:21 +00:00
wxFlexGridSizer * const szrPHackSettings = new wxFlexGridSizer ( 0 ) ;
PHackEnable = new wxCheckBox ( m_GameConfig , ID_PHACKENABLE , _ ( " Custom Projection Hack " ) , wxDefaultPosition , wxDefaultSize , wxCHK_2STATE ) ;
2011-02-03 17:51:12 +00:00
PHackEnable - > SetToolTip ( _ ( " Enables Custom Projection Hack " ) ) ;
2011-03-16 22:22:21 +00:00
PHSettings = new wxButton ( m_GameConfig , ID_PHSETTINGS , _ ( " Settings... " ) ) ;
2011-02-03 17:51:12 +00:00
PHSettings - > SetToolTip ( _ ( " Customize some Orthographic Projection parameters. " ) ) ;
2011-03-16 22:22:21 +00:00
wxBoxSizer * const sEmuState = new wxBoxSizer ( wxHORIZONTAL ) ;
wxStaticText * const EmuStateText =
new wxStaticText ( m_GameConfig , wxID_ANY , _ ( " Emulation State: " ) ) ;
2008-12-08 05:30:24 +00:00
arrayStringFor_EmuState . Add ( _ ( " Not Set " ) ) ;
arrayStringFor_EmuState . Add ( _ ( " Broken " ) ) ;
arrayStringFor_EmuState . Add ( _ ( " Intro " ) ) ;
arrayStringFor_EmuState . Add ( _ ( " In Game " ) ) ;
2009-09-25 16:29:00 +00:00
arrayStringFor_EmuState . Add ( _ ( " Playable " ) ) ;
2008-12-08 05:30:24 +00:00
arrayStringFor_EmuState . Add ( _ ( " Perfect " ) ) ;
2011-03-16 22:22:21 +00:00
EmuState = new wxChoice ( m_GameConfig , ID_EMUSTATE ,
wxDefaultPosition , wxDefaultSize , arrayStringFor_EmuState ) ;
EmuIssues = new wxTextCtrl ( m_GameConfig , ID_EMU_ISSUES , wxEmptyString ) ;
2008-12-08 05:30:24 +00:00
2011-03-16 22:22:21 +00:00
wxBoxSizer * const sConfigPage = new wxBoxSizer ( wxVERTICAL ) ;
wxStaticBoxSizer * const sbCoreOverrides =
new wxStaticBoxSizer ( wxVERTICAL , m_GameConfig , _ ( " Core " ) ) ;
2011-02-04 23:44:11 +00:00
sbCoreOverrides - > Add ( CPUThread , 0 , wxLEFT , 5 ) ;
sbCoreOverrides - > Add ( SkipIdle , 0 , wxLEFT , 5 ) ;
sbCoreOverrides - > Add ( MMU , 0 , wxLEFT , 5 ) ;
sbCoreOverrides - > Add ( MMUBAT , 0 , wxLEFT , 5 ) ;
sbCoreOverrides - > Add ( TLBHack , 0 , wxLEFT , 5 ) ;
sbCoreOverrides - > Add ( VBeam , 0 , wxLEFT , 5 ) ;
sbCoreOverrides - > Add ( FastDiscSpeed , 0 , wxLEFT , 5 ) ;
sbCoreOverrides - > Add ( BlockMerging , 0 , wxLEFT , 5 ) ;
sbCoreOverrides - > Add ( DSPHLE , 0 , wxLEFT , 5 ) ;
2011-01-31 22:19:30 +00:00
2011-03-16 22:22:21 +00:00
wxStaticBoxSizer * const sbWiiOverrides =
new wxStaticBoxSizer ( wxVERTICAL , m_GameConfig , _ ( " Wii Console " ) ) ;
2011-01-31 22:19:30 +00:00
if ( ! DiscIO : : IsVolumeWiiDisc ( OpenISO ) & & ! DiscIO : : IsVolumeWadFile ( OpenISO ) )
{
sbWiiOverrides - > ShowItems ( false ) ;
EnableProgressiveScan - > Hide ( ) ;
EnableWideScreen - > Hide ( ) ;
2011-05-25 15:01:49 +00:00
DisableWiimoteSpeaker - > Hide ( ) ;
2011-01-31 22:19:30 +00:00
}
else
{
// Progressive Scan is not used by Dolphin itself, and changing it on a per-game
// basis would have the side-effect of changing the SysConf, making this setting
// rather useless.
EnableProgressiveScan - > Disable ( ) ;
}
2011-02-04 23:44:11 +00:00
sbWiiOverrides - > Add ( EnableProgressiveScan , 0 , wxLEFT , 5 ) ;
sbWiiOverrides - > Add ( EnableWideScreen , 0 , wxLEFT , 5 ) ;
2011-05-25 15:01:49 +00:00
sbWiiOverrides - > Add ( DisableWiimoteSpeaker , 0 , wxLEFT , 5 ) ;
2011-01-31 22:19:30 +00:00
2011-03-16 22:22:21 +00:00
wxStaticBoxSizer * const sbVideoOverrides =
new wxStaticBoxSizer ( wxVERTICAL , m_GameConfig , _ ( " Video " ) ) ;
2011-10-26 00:19:10 +00:00
sbVideoOverrides - > Add ( UseBBox , 0 , wxLEFT , 5 ) ;
2011-02-04 23:44:11 +00:00
sbVideoOverrides - > Add ( UseZTPSpeedupHack , 0 , wxLEFT , 5 ) ;
szrPHackSettings - > Add ( PHackEnable , 0 , wxALIGN_CENTER_VERTICAL | wxLEFT , 5 ) ;
2011-02-03 17:51:12 +00:00
szrPHackSettings - > Add ( PHSettings , 0 , wxLEFT , 5 ) ;
2010-07-18 15:47:28 +00:00
2011-02-04 23:44:11 +00:00
sbVideoOverrides - > Add ( szrPHackSettings , 0 , wxEXPAND ) ;
2011-03-16 22:22:21 +00:00
wxStaticBoxSizer * const sbGameConfig =
new wxStaticBoxSizer ( wxVERTICAL , m_GameConfig , _ ( " Game-Specific Settings " ) ) ;
2011-01-31 22:19:30 +00:00
sbGameConfig - > Add ( OverrideText , 0 , wxEXPAND | wxALL , 5 ) ;
2009-03-24 23:10:43 +00:00
sbGameConfig - > Add ( sbCoreOverrides , 0 , wxEXPAND ) ;
sbGameConfig - > Add ( sbWiiOverrides , 0 , wxEXPAND ) ;
sbGameConfig - > Add ( sbVideoOverrides , 0 , wxEXPAND ) ;
sConfigPage - > Add ( sbGameConfig , 0 , wxEXPAND | wxALL , 5 ) ;
sEmuState - > Add ( EmuStateText , 0 , wxALIGN_CENTER_VERTICAL ) ;
sEmuState - > Add ( EmuState , 0 , wxEXPAND ) ;
2011-01-29 21:13:56 +00:00
sEmuState - > Add ( EmuIssues , 1 , wxEXPAND ) ;
2009-03-24 23:10:43 +00:00
sConfigPage - > Add ( sEmuState , 0 , wxEXPAND | wxALL , 5 ) ;
m_GameConfig - > SetSizer ( sConfigPage ) ;
2009-09-02 21:00:45 +00:00
2008-12-08 05:30:24 +00:00
// Patches
2011-03-16 22:22:21 +00:00
wxBoxSizer * const sPatches = new wxBoxSizer ( wxVERTICAL ) ;
Patches = new wxCheckListBox ( m_PatchPage , ID_PATCHES_LIST , wxDefaultPosition ,
wxDefaultSize , arrayStringFor_Patches , wxLB_HSCROLL ) ;
wxBoxSizer * const sPatchButtons = new wxBoxSizer ( wxHORIZONTAL ) ;
EditPatch = new wxButton ( m_PatchPage , ID_EDITPATCH , _ ( " Edit... " ) ) ;
wxButton * const AddPatch = new wxButton ( m_PatchPage , ID_ADDPATCH , _ ( " Add... " ) ) ;
RemovePatch = new wxButton ( m_PatchPage , ID_REMOVEPATCH , _ ( " Remove " ) ) ;
2008-12-08 05:30:24 +00:00
EditPatch - > Enable ( false ) ;
RemovePatch - > Enable ( false ) ;
2011-03-16 22:22:21 +00:00
wxBoxSizer * sPatchPage = new wxBoxSizer ( wxVERTICAL ) ;
2008-12-08 05:30:24 +00:00
sPatches - > Add ( Patches , 1 , wxEXPAND | wxALL , 0 ) ;
sPatchButtons - > Add ( EditPatch , 0 , wxEXPAND | wxALL , 0 ) ;
sPatchButtons - > AddStretchSpacer ( ) ;
sPatchButtons - > Add ( AddPatch , 0 , wxEXPAND | wxALL , 0 ) ;
sPatchButtons - > Add ( RemovePatch , 0 , wxEXPAND | wxALL , 0 ) ;
sPatches - > Add ( sPatchButtons , 0 , wxEXPAND | wxALL , 0 ) ;
2009-03-24 23:10:43 +00:00
sPatchPage - > Add ( sPatches , 1 , wxEXPAND | wxALL , 5 ) ;
2008-12-08 05:30:24 +00:00
m_PatchPage - > SetSizer ( sPatchPage ) ;
2009-09-02 21:00:45 +00:00
2009-03-24 23:10:43 +00:00
// Action Replay Cheats
2011-03-16 22:22:21 +00:00
wxBoxSizer * const sCheats = new wxBoxSizer ( wxVERTICAL ) ;
Cheats = new wxCheckListBox ( m_CheatPage , ID_CHEATS_LIST , wxDefaultPosition ,
wxDefaultSize , arrayStringFor_Cheats , wxLB_HSCROLL ) ;
wxBoxSizer * const sCheatButtons = new wxBoxSizer ( wxHORIZONTAL ) ;
EditCheat = new wxButton ( m_CheatPage , ID_EDITCHEAT , _ ( " Edit... " ) ) ;
wxButton * const AddCheat = new wxButton ( m_CheatPage , ID_ADDCHEAT , _ ( " Add... " ) ) ;
RemoveCheat = new wxButton ( m_CheatPage , ID_REMOVECHEAT , _ ( " Remove " ) ,
wxDefaultPosition , wxDefaultSize , 0 ) ;
2009-03-24 23:10:43 +00:00
EditCheat - > Enable ( false ) ;
RemoveCheat - > Enable ( false ) ;
2011-03-16 22:22:21 +00:00
wxBoxSizer * sCheatPage = new wxBoxSizer ( wxVERTICAL ) ;
2008-12-08 05:30:24 +00:00
sCheats - > Add ( Cheats , 1 , wxEXPAND | wxALL , 0 ) ;
sCheatButtons - > Add ( EditCheat , 0 , wxEXPAND | wxALL , 0 ) ;
sCheatButtons - > AddStretchSpacer ( ) ;
sCheatButtons - > Add ( AddCheat , 0 , wxEXPAND | wxALL , 0 ) ;
sCheatButtons - > Add ( RemoveCheat , 0 , wxEXPAND | wxALL , 0 ) ;
sCheats - > Add ( sCheatButtons , 0 , wxEXPAND | wxALL , 0 ) ;
2009-03-24 23:10:43 +00:00
sCheatPage - > Add ( sCheats , 1 , wxEXPAND | wxALL , 5 ) ;
2008-12-08 05:30:24 +00:00
m_CheatPage - > SetSizer ( sCheatPage ) ;
2009-09-02 21:00:45 +00:00
2011-03-16 22:22:21 +00:00
wxStaticText * const m_NameText =
new wxStaticText ( m_Information , wxID_ANY , _ ( " Name: " ) ) ;
m_Name = new wxTextCtrl ( m_Information , ID_NAME , wxEmptyString ,
wxDefaultPosition , wxDefaultSize , wxTE_READONLY ) ;
wxStaticText * const m_GameIDText =
new wxStaticText ( m_Information , wxID_ANY , _ ( " Game ID: " ) ) ;
m_GameID = new wxTextCtrl ( m_Information , ID_GAMEID , wxEmptyString ,
wxDefaultPosition , wxDefaultSize , wxTE_READONLY ) ;
wxStaticText * const m_CountryText =
new wxStaticText ( m_Information , wxID_ANY , _ ( " Country: " ) ) ;
m_Country = new wxTextCtrl ( m_Information , ID_COUNTRY , wxEmptyString ,
wxDefaultPosition , wxDefaultSize , wxTE_READONLY ) ;
wxStaticText * const m_MakerIDText =
new wxStaticText ( m_Information , wxID_ANY , _ ( " Maker ID: " ) ) ;
m_MakerID = new wxTextCtrl ( m_Information , ID_MAKERID , wxEmptyString ,
wxDefaultPosition , wxDefaultSize , wxTE_READONLY ) ;
wxStaticText * const m_DateText =
new wxStaticText ( m_Information , wxID_ANY , _ ( " Date: " ) ) ;
m_Date = new wxTextCtrl ( m_Information , ID_DATE , wxEmptyString ,
wxDefaultPosition , wxDefaultSize , wxTE_READONLY ) ;
wxStaticText * const m_FSTText =
new wxStaticText ( m_Information , wxID_ANY , _ ( " FST Size: " ) ) ;
m_FST = new wxTextCtrl ( m_Information , ID_FST , wxEmptyString ,
wxDefaultPosition , wxDefaultSize , wxTE_READONLY ) ;
wxStaticText * const m_LangText = new wxStaticText ( m_Information , wxID_ANY , _ ( " Show Language: " ) ) ;
2008-12-08 05:30:24 +00:00
arrayStringFor_Lang . Add ( _ ( " English " ) ) ;
arrayStringFor_Lang . Add ( _ ( " German " ) ) ;
arrayStringFor_Lang . Add ( _ ( " French " ) ) ;
arrayStringFor_Lang . Add ( _ ( " Spanish " ) ) ;
arrayStringFor_Lang . Add ( _ ( " Italian " ) ) ;
arrayStringFor_Lang . Add ( _ ( " Dutch " ) ) ;
2011-03-16 22:22:21 +00:00
m_Lang = new wxChoice ( m_Information , ID_LANG , wxDefaultPosition , wxDefaultSize , arrayStringFor_Lang ) ;
2011-01-08 15:05:59 +00:00
m_Lang - > SetSelection ( ( int ) SConfig : : GetInstance ( ) . m_LocalCoreStartupParameter . SelectedLanguage ) ;
2011-03-16 22:22:21 +00:00
wxStaticText * const m_ShortText = new wxStaticText ( m_Information , wxID_ANY , _ ( " Short Name: " ) ) ;
2008-12-08 05:30:24 +00:00
m_ShortName = new wxTextCtrl ( m_Information , ID_SHORTNAME , wxEmptyString , wxDefaultPosition , wxDefaultSize , wxTE_READONLY ) ;
2011-03-16 22:22:21 +00:00
wxStaticText * const m_MakerText = new wxStaticText ( m_Information , wxID_ANY , _ ( " Maker: " ) ) ;
2008-12-08 05:30:24 +00:00
m_Maker = new wxTextCtrl ( m_Information , ID_MAKER , wxEmptyString , wxDefaultPosition , wxDefaultSize , wxTE_READONLY ) ;
2011-03-16 22:22:21 +00:00
wxStaticText * const m_CommentText = new wxStaticText ( m_Information , wxID_ANY , _ ( " Comment: " ) ) ;
2008-12-08 05:30:24 +00:00
m_Comment = new wxTextCtrl ( m_Information , ID_COMMENT , wxEmptyString , wxDefaultPosition , wxDefaultSize , wxTE_MULTILINE | wxTE_READONLY ) ;
2011-03-16 22:22:21 +00:00
wxStaticText * const m_BannerText = new wxStaticText ( m_Information , wxID_ANY , _ ( " Banner: " ) ) ;
2008-12-08 05:30:24 +00:00
m_Banner = new wxStaticBitmap ( m_Information , ID_BANNER , wxNullBitmap , wxDefaultPosition , wxSize ( 96 , 32 ) , 0 ) ;
2010-06-11 08:39:03 +00:00
// ISO Details
2011-03-16 22:22:21 +00:00
wxGridBagSizer * const sISODetails = new wxGridBagSizer ( 0 , 0 ) ;
2008-12-08 05:30:24 +00:00
sISODetails - > Add ( m_NameText , wxGBPosition ( 0 , 0 ) , wxGBSpan ( 1 , 1 ) , wxALIGN_CENTER_VERTICAL | wxALL , 5 ) ;
sISODetails - > Add ( m_Name , wxGBPosition ( 0 , 1 ) , wxGBSpan ( 1 , 1 ) , wxEXPAND | wxALL , 5 ) ;
sISODetails - > Add ( m_GameIDText , wxGBPosition ( 1 , 0 ) , wxGBSpan ( 1 , 1 ) , wxALIGN_CENTER_VERTICAL | wxALL , 5 ) ;
sISODetails - > Add ( m_GameID , wxGBPosition ( 1 , 1 ) , wxGBSpan ( 1 , 1 ) , wxEXPAND | wxALL , 5 ) ;
sISODetails - > Add ( m_CountryText , wxGBPosition ( 2 , 0 ) , wxGBSpan ( 1 , 1 ) , wxALIGN_CENTER_VERTICAL | wxALL , 5 ) ;
sISODetails - > Add ( m_Country , wxGBPosition ( 2 , 1 ) , wxGBSpan ( 1 , 1 ) , wxEXPAND | wxALL , 5 ) ;
sISODetails - > Add ( m_MakerIDText , wxGBPosition ( 3 , 0 ) , wxGBSpan ( 1 , 1 ) , wxALIGN_CENTER_VERTICAL | wxALL , 5 ) ;
sISODetails - > Add ( m_MakerID , wxGBPosition ( 3 , 1 ) , wxGBSpan ( 1 , 1 ) , wxEXPAND | wxALL , 5 ) ;
sISODetails - > Add ( m_DateText , wxGBPosition ( 4 , 0 ) , wxGBSpan ( 1 , 1 ) , wxALIGN_CENTER_VERTICAL | wxALL , 5 ) ;
sISODetails - > Add ( m_Date , wxGBPosition ( 4 , 1 ) , wxGBSpan ( 1 , 1 ) , wxEXPAND | wxALL , 5 ) ;
sISODetails - > Add ( m_FSTText , wxGBPosition ( 5 , 0 ) , wxGBSpan ( 1 , 1 ) , wxALIGN_CENTER_VERTICAL | wxALL , 5 ) ;
sISODetails - > Add ( m_FST , wxGBPosition ( 5 , 1 ) , wxGBSpan ( 1 , 1 ) , wxEXPAND | wxALL , 5 ) ;
2010-06-14 22:01:10 +00:00
sISODetails - > AddGrowableCol ( 1 ) ;
2011-03-16 22:22:21 +00:00
wxStaticBoxSizer * const sbISODetails =
new wxStaticBoxSizer ( wxVERTICAL , m_Information , _ ( " ISO Details " ) ) ;
2008-12-08 05:30:24 +00:00
sbISODetails - > Add ( sISODetails , 0 , wxEXPAND , 5 ) ;
2009-02-14 17:32:03 +00:00
2010-06-11 08:39:03 +00:00
// Banner Details
2011-03-16 22:22:21 +00:00
wxGridBagSizer * const sBannerDetails = new wxGridBagSizer ( 0 , 0 ) ;
2009-02-14 17:32:03 +00:00
sBannerDetails - > Add ( m_LangText , wxGBPosition ( 0 , 0 ) , wxGBSpan ( 1 , 1 ) , wxALIGN_CENTER_VERTICAL | wxALL , 5 ) ;
sBannerDetails - > Add ( m_Lang , wxGBPosition ( 0 , 1 ) , wxGBSpan ( 1 , 1 ) , wxEXPAND | wxALL , 5 ) ;
2008-12-08 05:30:24 +00:00
sBannerDetails - > Add ( m_ShortText , wxGBPosition ( 1 , 0 ) , wxGBSpan ( 1 , 1 ) , wxALIGN_CENTER_VERTICAL | wxALL , 5 ) ;
2009-02-14 17:32:03 +00:00
sBannerDetails - > Add ( m_ShortName , wxGBPosition ( 1 , 1 ) , wxGBSpan ( 1 , 1 ) , wxEXPAND | wxALL , 5 ) ;
sBannerDetails - > Add ( m_MakerText , wxGBPosition ( 2 , 0 ) , wxGBSpan ( 1 , 1 ) , wxALIGN_CENTER_VERTICAL | wxALL , 5 ) ;
sBannerDetails - > Add ( m_Maker , wxGBPosition ( 2 , 1 ) , wxGBSpan ( 1 , 1 ) , wxEXPAND | wxALL , 5 ) ;
sBannerDetails - > Add ( m_CommentText , wxGBPosition ( 3 , 0 ) , wxGBSpan ( 1 , 1 ) , wxALL , 5 ) ;
sBannerDetails - > Add ( m_Comment , wxGBPosition ( 3 , 1 ) , wxGBSpan ( 1 , 1 ) , wxEXPAND | wxALL , 5 ) ;
sBannerDetails - > Add ( m_BannerText , wxGBPosition ( 4 , 0 ) , wxGBSpan ( 1 , 1 ) , wxALL , 5 ) ;
sBannerDetails - > Add ( m_Banner , wxGBPosition ( 4 , 1 ) , wxGBSpan ( 1 , 1 ) , wxEXPAND | wxALL , 5 ) ;
2010-06-11 08:39:03 +00:00
sBannerDetails - > AddGrowableCol ( 1 ) ;
2011-03-16 22:22:21 +00:00
wxStaticBoxSizer * const sbBannerDetails =
new wxStaticBoxSizer ( wxVERTICAL , m_Information , _ ( " Banner Details " ) ) ;
2010-06-11 08:39:03 +00:00
sbBannerDetails - > Add ( sBannerDetails , 0 , wxEXPAND , 5 ) ;
2011-03-16 22:22:21 +00:00
wxBoxSizer * const sInfoPage = new wxBoxSizer ( wxVERTICAL ) ;
2008-12-08 05:30:24 +00:00
sInfoPage - > Add ( sbISODetails , 0 , wxEXPAND | wxALL , 5 ) ;
sInfoPage - > Add ( sbBannerDetails , 0 , wxEXPAND | wxALL , 5 ) ;
m_Information - > SetSizer ( sInfoPage ) ;
2009-03-24 23:10:43 +00:00
2011-03-16 22:22:21 +00:00
if ( ! IsWad )
{
wxPanel * const m_Filesystem =
new wxPanel ( m_Notebook , ID_FILESYSTEM , wxDefaultPosition , wxDefaultSize ) ;
m_Notebook - > AddPage ( m_Filesystem , _ ( " Filesystem " ) ) ;
// Filesystem icons
wxImageList * const m_iconList = new wxImageList ( 16 , 16 ) ;
m_iconList - > Add ( wxBitmap ( disc_xpm ) , wxNullBitmap ) ; // 0
m_iconList - > Add ( wxBitmap ( folder_xpm ) , wxNullBitmap ) ; // 1
m_iconList - > Add ( wxBitmap ( file_xpm ) , wxNullBitmap ) ; // 2
// Filesystem tree
m_Treectrl = new wxTreeCtrl ( m_Filesystem , ID_TREECTRL ,
wxDefaultPosition , wxDefaultSize , wxTR_DEFAULT_STYLE ) ;
m_Treectrl - > AssignImageList ( m_iconList ) ;
RootId = m_Treectrl - > AddRoot ( _ ( " Disc " ) , 0 , 0 , 0 ) ;
wxBoxSizer * sTreePage = new wxBoxSizer ( wxVERTICAL ) ;
sTreePage - > Add ( m_Treectrl , 1 , wxEXPAND | wxALL , 5 ) ;
m_Filesystem - > SetSizer ( sTreePage ) ;
}
2008-12-08 05:30:24 +00:00
2011-03-16 22:22:21 +00:00
wxSizer * sButtons = CreateButtonSizer ( wxNO_DEFAULT ) ;
2011-06-03 12:26:32 +00:00
sButtons - > Prepend ( EditConfig ) ;
sButtons - > Add ( new wxButton ( this , wxID_OK , _ ( " Close " ) ) ) ;
2009-06-07 02:54:07 +00:00
2009-03-24 23:10:43 +00:00
// Add notebook and buttons to the dialog
2009-02-14 17:32:03 +00:00
wxBoxSizer * sMain ;
sMain = new wxBoxSizer ( wxVERTICAL ) ;
sMain - > Add ( m_Notebook , 1 , wxEXPAND | wxALL , 5 ) ;
2011-06-03 12:26:32 +00:00
sMain - > Add ( sButtons , 0 , wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM , 5 ) ;
2011-03-16 22:22:21 +00:00
sMain - > SetMinSize ( wxSize ( 500 , - 1 ) ) ;
2010-06-14 22:01:10 +00:00
2009-02-14 17:32:03 +00:00
SetSizerAndFit ( sMain ) ;
2011-03-15 21:57:00 +00:00
Center ( ) ;
2011-03-16 22:22:21 +00:00
SetFocus ( ) ;
2008-12-08 05:30:24 +00:00
}
void CISOProperties : : OnClose ( wxCloseEvent & WXUNUSED ( event ) )
{
if ( ! SaveGameConfig ( ) )
2011-01-13 02:05:58 +00:00
PanicAlertT ( " Could not save %s " , GameIniFile . c_str ( ) ) ;
2008-12-08 05:30:24 +00:00
2009-01-28 10:21:18 +00:00
EndModal ( bRefreshList ? wxID_OK : wxID_CANCEL ) ;
2008-12-08 05:30:24 +00:00
}
void CISOProperties : : OnCloseClick ( wxCommandEvent & WXUNUSED ( event ) )
{
Close ( ) ;
}
void CISOProperties : : RightClickOnBanner ( wxMouseEvent & event )
{
2009-11-23 08:05:54 +00:00
wxMenu * popupMenu = new wxMenu ;
popupMenu - > Append ( IDM_BNRSAVEAS , _ ( " Save as... " ) ) ;
PopupMenu ( popupMenu ) ;
2008-12-08 05:30:24 +00:00
event . Skip ( ) ;
}
void CISOProperties : : OnBannerImageSave ( wxCommandEvent & WXUNUSED ( event ) )
{
wxString dirHome ;
2011-01-05 04:35:46 +00:00
wxFileDialog dialog ( this , _ ( " Save as... " ) , wxGetHomeDir ( & dirHome ) , wxString : : Format ( wxT ( " %s.png " ) , m_GameID - > GetLabel ( ) . c_str ( ) ) ,
2011-01-06 13:57:46 +00:00
wxALL_FILES_PATTERN , wxFD_SAVE | wxFD_OVERWRITE_PROMPT , wxDefaultPosition , wxDefaultSize ) ;
2008-12-08 05:30:24 +00:00
if ( dialog . ShowModal ( ) = = wxID_OK )
{
m_Banner - > GetBitmap ( ) . ConvertToImage ( ) . SaveFile ( dialog . GetPath ( ) ) ;
}
}
void CISOProperties : : OnRightClickOnTree ( wxTreeEvent & event )
{
m_Treectrl - > SelectItem ( event . GetItem ( ) ) ;
2009-11-23 08:05:54 +00:00
wxMenu * popupMenu = new wxMenu ;
2009-09-13 22:03:18 +00:00
if ( m_Treectrl - > GetItemImage ( m_Treectrl - > GetSelection ( ) ) = = 0
& & m_Treectrl - > GetFirstVisibleItem ( ) ! = m_Treectrl - > GetSelection ( ) )
2009-11-23 08:05:54 +00:00
popupMenu - > Append ( IDM_EXTRACTDIR , _ ( " Extract Partition... " ) ) ;
2009-09-13 22:03:18 +00:00
else if ( m_Treectrl - > GetItemImage ( m_Treectrl - > GetSelection ( ) ) = = 1 )
2009-11-23 08:05:54 +00:00
popupMenu - > Append ( IDM_EXTRACTDIR , _ ( " Extract Directory... " ) ) ;
2009-09-13 22:03:18 +00:00
else if ( m_Treectrl - > GetItemImage ( m_Treectrl - > GetSelection ( ) ) = = 2 )
2009-11-23 08:05:54 +00:00
popupMenu - > Append ( IDM_EXTRACTFILE , _ ( " Extract File... " ) ) ;
2009-09-12 09:09:47 +00:00
2009-11-23 08:05:54 +00:00
popupMenu - > Append ( IDM_EXTRACTALL , _ ( " Extract All Files... " ) ) ;
2009-12-29 13:59:38 +00:00
popupMenu - > AppendSeparator ( ) ;
popupMenu - > Append ( IDM_EXTRACTAPPLOADER , _ ( " Extract Apploader... " ) ) ;
popupMenu - > Append ( IDM_EXTRACTDOL , _ ( " Extract DOL... " ) ) ;
2009-09-13 22:03:18 +00:00
2012-05-04 10:49:10 +00:00
if ( m_Treectrl - > GetItemImage ( m_Treectrl - > GetSelection ( ) ) = = 0
& & m_Treectrl - > GetFirstVisibleItem ( ) ! = m_Treectrl - > GetSelection ( ) )
{
popupMenu - > AppendSeparator ( ) ;
popupMenu - > Append ( IDM_CHECKINTEGRITY , _ ( " Check Partition Integrity " ) ) ;
}
2009-11-23 08:05:54 +00:00
PopupMenu ( popupMenu ) ;
2008-12-08 05:30:24 +00:00
event . Skip ( ) ;
}
void CISOProperties : : OnExtractFile ( wxCommandEvent & WXUNUSED ( event ) )
{
wxString Path ;
wxString File ;
File = m_Treectrl - > GetItemText ( m_Treectrl - > GetSelection ( ) ) ;
Path = wxFileSelector (
2011-01-05 04:35:46 +00:00
_ ( " Export File " ) ,
2008-12-08 05:30:24 +00:00
wxEmptyString , File , wxEmptyString ,
2011-01-06 13:57:46 +00:00
wxGetTranslation ( wxALL_FILES ) ,
2008-12-08 05:30:24 +00:00
wxFD_SAVE ,
this ) ;
if ( ! Path | | ! File )
return ;
while ( m_Treectrl - > GetItemParent ( m_Treectrl - > GetSelection ( ) ) ! = m_Treectrl - > GetRootItem ( ) )
{
wxString temp ;
temp = m_Treectrl - > GetItemText ( m_Treectrl - > GetItemParent ( m_Treectrl - > GetSelection ( ) ) ) ;
2009-03-10 17:19:30 +00:00
File = temp + wxT ( DIR_SEP_CHR ) + File ;
2008-12-08 05:30:24 +00:00
m_Treectrl - > SelectItem ( m_Treectrl - > GetItemParent ( m_Treectrl - > GetSelection ( ) ) ) ;
}
2009-03-10 17:19:30 +00:00
if ( DiscIO : : IsVolumeWiiDisc ( OpenISO ) )
{
int partitionNum = wxAtoi ( File . SubString ( 10 , 11 ) ) ;
File . Remove ( 0 , 12 ) ; // Remove "Partition x/"
WiiDisc . at ( partitionNum ) . FileSystem - > ExportFile ( File . mb_str ( ) , Path . mb_str ( ) ) ;
}
else
pFileSystem - > ExportFile ( File . mb_str ( ) , Path . mb_str ( ) ) ;
2008-12-08 05:30:24 +00:00
}
2009-09-13 22:03:18 +00:00
void CISOProperties : : ExportDir ( const char * _rFullPath , const char * _rExportFolder , const int partitionNum )
2008-12-08 05:30:24 +00:00
{
2009-09-13 22:03:18 +00:00
char exportName [ 512 ] ;
2010-05-26 21:16:03 +00:00
u32 index [ 2 ] = { 0 , 0 } , offsetShift = 0 ;
2009-09-13 22:03:18 +00:00
std : : vector < const DiscIO : : SFileInfo * > fst ;
DiscIO : : IFileSystem * FS = 0 ;
2009-09-13 09:03:38 +00:00
2009-09-13 22:03:18 +00:00
if ( DiscIO : : IsVolumeWiiDisc ( OpenISO ) )
{
FS = WiiDisc . at ( partitionNum ) . FileSystem ;
offsetShift = 2 ;
}
else
FS = pFileSystem ;
FS - > GetFileList ( fst ) ;
if ( ! _rFullPath ) // Extract all
{
index [ 0 ] = 0 ;
2009-09-29 22:32:53 +00:00
index [ 1 ] = ( u32 ) fst . size ( ) ;
2009-09-13 22:03:18 +00:00
FS - > ExportApploader ( _rExportFolder ) ;
2009-10-11 16:06:02 +00:00
if ( ! DiscIO : : IsVolumeWiiDisc ( OpenISO ) )
FS - > ExportDOL ( _rExportFolder ) ;
2009-09-13 22:03:18 +00:00
}
else // Look for the dir we are going to extract
{
for ( index [ 0 ] = 0 ; index [ 0 ] < fst . size ( ) ; index [ 0 ] + + )
{
if ( ! strcmp ( fst . at ( index [ 0 ] ) - > m_FullPath , _rFullPath ) )
{
DEBUG_LOG ( DISCIO , " Found the Dir at %u " , index [ 0 ] ) ;
index [ 1 ] = ( u32 ) fst . at ( index [ 0 ] ) - > m_FileSize ;
break ;
}
}
DEBUG_LOG ( DISCIO , " Dir found from %u to %u \n extracting to: \n %s " , index [ 0 ] , index [ 1 ] , _rExportFolder ) ;
}
2011-01-05 04:35:46 +00:00
wxString dialogTitle = index [ 0 ] ? _ ( " Extracting Directory " ) : _ ( " Extracting All Files " ) ;
2012-03-25 03:59:20 +00:00
wxProgressDialog dialog (
dialogTitle ,
_ ( " Extracting... " ) ,
index [ 1 ] - 1 ,
this ,
wxPD_APP_MODAL | wxPD_AUTO_HIDE | wxPD_CAN_ABORT |
wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME | wxPD_REMAINING_TIME |
wxPD_SMOOTH
) ;
2009-09-13 22:03:18 +00:00
// Extraction
for ( u32 i = index [ 0 ] ; i < index [ 1 ] ; i + + )
{
2011-01-05 04:35:46 +00:00
dialog . SetTitle ( wxString : : Format ( wxT ( " %s : %d%% " ) , dialogTitle . c_str ( ) ,
2009-09-15 21:35:32 +00:00
( u32 ) ( ( ( float ) ( i - index [ 0 ] ) / ( float ) ( index [ 1 ] - index [ 0 ] ) ) * 100 ) ) ) ;
2012-03-25 03:59:20 +00:00
dialog . Update ( i , wxString : : Format ( _ ( " Extracting %s " ) ,
wxString ( fst [ i ] - > m_FullPath , * wxConvCurrent ) . c_str ( ) ) ) ;
if ( dialog . WasCancelled ( ) )
2009-09-13 22:03:18 +00:00
break ;
if ( fst [ i ] - > IsDirectory ( ) )
{
2010-05-29 19:37:29 +00:00
snprintf ( exportName , sizeof ( exportName ) , " %s/%s/ " , _rExportFolder , fst [ i ] - > m_FullPath ) ;
2009-09-13 22:03:18 +00:00
DEBUG_LOG ( DISCIO , " %s " , exportName ) ;
if ( ! File : : Exists ( exportName ) & & ! File : : CreateFullPath ( exportName ) )
{
ERROR_LOG ( DISCIO , " Could not create the path %s " , exportName ) ;
}
else
{
if ( ! File : : IsDirectory ( exportName ) )
ERROR_LOG ( DISCIO , " %s already exists and is not a directory " , exportName ) ;
DEBUG_LOG ( DISCIO , " folder %s already exists " , exportName ) ;
}
}
else
{
2010-05-29 19:37:29 +00:00
snprintf ( exportName , sizeof ( exportName ) , " %s/%s " , _rExportFolder , fst [ i ] - > m_FullPath ) ;
2009-09-13 22:03:18 +00:00
DEBUG_LOG ( DISCIO , " %s " , exportName ) ;
if ( ! File : : Exists ( exportName ) & & ! FS - > ExportFile ( fst [ i ] - > m_FullPath , exportName ) )
{
ERROR_LOG ( DISCIO , " Could not export %s " , exportName ) ;
}
else
{
DEBUG_LOG ( DISCIO , " %s already exists " , exportName ) ;
}
}
}
}
void CISOProperties : : OnExtractDir ( wxCommandEvent & event )
{
wxString Directory = m_Treectrl - > GetItemText ( m_Treectrl - > GetSelection ( ) ) ;
2011-01-06 13:57:46 +00:00
wxString Path = wxDirSelector ( _ ( " Choose the folder to extract to " ) ) ;
2009-09-13 09:03:38 +00:00
if ( ! Path | | ! Directory )
return ;
2009-09-13 22:03:18 +00:00
if ( event . GetId ( ) = = IDM_EXTRACTALL )
{
if ( DiscIO : : IsVolumeWiiDisc ( OpenISO ) )
for ( u32 i = 0 ; i < WiiDisc . size ( ) ; i + + )
ExportDir ( NULL , Path . mb_str ( ) , i ) ;
else
ExportDir ( NULL , Path . mb_str ( ) ) ;
return ;
}
2009-09-13 09:03:38 +00:00
while ( m_Treectrl - > GetItemParent ( m_Treectrl - > GetSelection ( ) ) ! = m_Treectrl - > GetRootItem ( ) )
{
wxString temp ;
temp = m_Treectrl - > GetItemText ( m_Treectrl - > GetItemParent ( m_Treectrl - > GetSelection ( ) ) ) ;
Directory = temp + wxT ( DIR_SEP_CHR ) + Directory ;
m_Treectrl - > SelectItem ( m_Treectrl - > GetItemParent ( m_Treectrl - > GetSelection ( ) ) ) ;
}
if ( DiscIO : : IsVolumeWiiDisc ( OpenISO ) )
{
int partitionNum = wxAtoi ( Directory . SubString ( 10 , 11 ) ) ;
Directory . Remove ( 0 , 12 ) ; // Remove "Partition x/"
2009-09-13 22:03:18 +00:00
ExportDir ( Directory . mb_str ( ) , Path . mb_str ( ) , partitionNum ) ;
2009-09-13 09:03:38 +00:00
}
else
2009-09-13 22:03:18 +00:00
ExportDir ( Directory . mb_str ( ) , Path . mb_str ( ) ) ;
2009-09-12 09:09:47 +00:00
}
2009-12-29 13:59:38 +00:00
void CISOProperties : : OnExtractDataFromHeader ( wxCommandEvent & event )
{
std : : vector < const DiscIO : : SFileInfo * > fst ;
DiscIO : : IFileSystem * FS = 0 ;
2011-01-05 04:35:46 +00:00
wxString Path = wxDirSelector ( _ ( " Choose the folder to extract to " ) ) ;
2009-12-29 13:59:38 +00:00
if ( Path . empty ( ) )
return ;
if ( DiscIO : : IsVolumeWiiDisc ( OpenISO ) )
FS = WiiDisc . at ( 1 ) . FileSystem ;
else
FS = pFileSystem ;
bool ret = false ;
if ( event . GetId ( ) = = IDM_EXTRACTAPPLOADER )
{
ret = FS - > ExportApploader ( Path . mb_str ( ) ) ;
}
else if ( event . GetId ( ) = = IDM_EXTRACTDOL )
{
ret = FS - > ExportDOL ( Path . mb_str ( ) ) ;
}
if ( ! ret )
2011-01-13 02:05:58 +00:00
PanicAlertT ( " Failed to extract to %s! " , ( const char * ) Path . mb_str ( ) ) ;
2009-12-29 13:59:38 +00:00
}
2012-05-04 10:49:10 +00:00
class IntegrityCheckThread : public wxThread
{
public :
IntegrityCheckThread ( const WiiPartition & Partition )
: wxThread ( wxTHREAD_JOINABLE ) , m_Partition ( Partition )
{
Create ( ) ;
}
virtual ExitCode Entry ( )
{
return ( ExitCode ) m_Partition . Partition - > CheckIntegrity ( ) ;
}
private :
const WiiPartition & m_Partition ;
} ;
void CISOProperties : : CheckPartitionIntegrity ( wxCommandEvent & event )
{
// Normally we can't enter this function if we aren't analyzing a Wii disc
// anyway, but let's still check to be sure.
if ( ! DiscIO : : IsVolumeWiiDisc ( OpenISO ) )
return ;
wxString PartitionName = m_Treectrl - > GetItemText ( m_Treectrl - > GetSelection ( ) ) ;
if ( ! PartitionName )
return ;
// Get the partition number from the item text ("Partition N")
int PartitionNum = wxAtoi ( PartitionName . SubString ( 10 , 11 ) ) ;
const WiiPartition & Partition = WiiDisc [ PartitionNum ] ;
wxProgressDialog * dialog = new wxProgressDialog (
_ ( " Checking integrity... " ) , _ ( " Working... " ) , 1000 , this ,
wxPD_APP_MODAL | wxPD_ELAPSED_TIME | wxPD_SMOOTH
) ;
IntegrityCheckThread thread ( Partition ) ;
thread . Run ( ) ;
while ( thread . IsAlive ( ) )
{
dialog - > Pulse ( ) ;
wxThread : : Sleep ( 50 ) ;
}
delete dialog ;
if ( ! thread . Wait ( ) )
{
wxMessageBox (
wxString : : Format ( _ ( " Integrity check for partition %d failed. "
" Your dump is most likely corrupted or has been "
" patched incorrectly. " ) , PartitionNum ) ,
_ ( " Integrity Check Error " ) , wxOK | wxICON_ERROR , this
) ;
}
else
{
wxMessageBox ( _ ( " Integrity check completed. No errors have been found. " ) ,
_ ( " Integrity check completed " ) , wxOK | wxICON_INFORMATION , this ) ;
}
}
2009-03-24 23:10:43 +00:00
void CISOProperties : : SetRefresh ( wxCommandEvent & event )
2008-12-08 05:30:24 +00:00
{
2009-03-24 23:10:43 +00:00
bRefreshList = true ;
if ( event . GetId ( ) = = ID_EMUSTATE )
2009-09-25 16:29:00 +00:00
EmuIssues - > Enable ( event . GetSelection ( ) ! = 0 ) ;
2008-12-08 05:30:24 +00:00
}
void CISOProperties : : LoadGameConfig ( )
{
2010-06-03 18:05:08 +00:00
bool bTemp ;
2008-12-08 05:30:24 +00:00
int iTemp ;
2009-02-21 14:40:34 +00:00
std : : string sTemp ;
2008-12-08 05:30:24 +00:00
2010-06-03 18:05:08 +00:00
if ( GameIni . Get ( " Core " , " CPUThread " , & bTemp ) )
CPUThread - > Set3StateValue ( ( wxCheckBoxState ) bTemp ) ;
else
CPUThread - > Set3StateValue ( wxCHK_UNDETERMINED ) ;
2008-12-08 05:30:24 +00:00
2010-06-03 18:05:08 +00:00
if ( GameIni . Get ( " Core " , " SkipIdle " , & bTemp ) )
SkipIdle - > Set3StateValue ( ( wxCheckBoxState ) bTemp ) ;
else
SkipIdle - > Set3StateValue ( wxCHK_UNDETERMINED ) ;
2008-12-08 05:30:24 +00:00
2010-07-29 12:17:47 +00:00
if ( GameIni . Get ( " Core " , " MMU " , & bTemp ) )
MMU - > Set3StateValue ( ( wxCheckBoxState ) bTemp ) ;
else
MMU - > Set3StateValue ( wxCHK_UNDETERMINED ) ;
2010-09-06 14:43:28 +00:00
if ( GameIni . Get ( " Core " , " BAT " , & bTemp ) )
MMUBAT - > Set3StateValue ( ( wxCheckBoxState ) bTemp ) ;
else
MMUBAT - > Set3StateValue ( wxCHK_UNDETERMINED ) ;
2010-06-03 18:05:08 +00:00
if ( GameIni . Get ( " Core " , " TLBHack " , & bTemp ) )
TLBHack - > Set3StateValue ( ( wxCheckBoxState ) bTemp ) ;
else
TLBHack - > Set3StateValue ( wxCHK_UNDETERMINED ) ;
2009-03-24 23:10:43 +00:00
2011-01-20 08:34:49 +00:00
if ( GameIni . Get ( " Core " , " VBeam " , & bTemp ) )
VBeam - > Set3StateValue ( ( wxCheckBoxState ) bTemp ) ;
2010-07-30 17:12:59 +00:00
else
2011-01-20 08:34:49 +00:00
VBeam - > Set3StateValue ( wxCHK_UNDETERMINED ) ;
2010-07-30 17:12:59 +00:00
2010-10-15 21:46:51 +00:00
if ( GameIni . Get ( " Core " , " FastDiscSpeed " , & bTemp ) )
FastDiscSpeed - > Set3StateValue ( ( wxCheckBoxState ) bTemp ) ;
2010-10-11 12:38:17 +00:00
else
2010-10-15 21:46:51 +00:00
FastDiscSpeed - > Set3StateValue ( wxCHK_UNDETERMINED ) ;
2010-10-11 12:38:17 +00:00
2010-09-14 13:50:25 +00:00
if ( GameIni . Get ( " Core " , " BlockMerging " , & bTemp ) )
BlockMerging - > Set3StateValue ( ( wxCheckBoxState ) bTemp ) ;
else
BlockMerging - > Set3StateValue ( wxCHK_UNDETERMINED ) ;
2011-01-29 13:26:49 +00:00
if ( GameIni . Get ( " Core " , " DSPHLE " , & bTemp ) )
DSPHLE - > Set3StateValue ( ( wxCheckBoxState ) bTemp ) ;
else
DSPHLE - > Set3StateValue ( wxCHK_UNDETERMINED ) ;
2010-10-21 14:50:42 +00:00
if ( GameIni . Get ( " Display " , " ProgressiveScan " , & bTemp ) )
2010-06-03 18:05:08 +00:00
EnableProgressiveScan - > Set3StateValue ( ( wxCheckBoxState ) bTemp ) ;
else
EnableProgressiveScan - > Set3StateValue ( wxCHK_UNDETERMINED ) ;
2009-03-24 23:10:43 +00:00
2011-02-27 14:43:52 +00:00
// ??
2010-06-03 18:05:08 +00:00
if ( GameIni . Get ( " Wii " , " Widescreen " , & bTemp ) )
EnableWideScreen - > Set3StateValue ( ( wxCheckBoxState ) bTemp ) ;
else
EnableWideScreen - > Set3StateValue ( wxCHK_UNDETERMINED ) ;
2009-03-22 21:24:38 +00:00
2011-05-25 15:01:49 +00:00
if ( GameIni . Get ( " Wii " , " DisableWiimoteSpeaker " , & bTemp ) )
DisableWiimoteSpeaker - > Set3StateValue ( ( wxCheckBoxState ) bTemp ) ;
else
DisableWiimoteSpeaker - > Set3StateValue ( wxCHK_UNDETERMINED ) ;
2011-10-26 00:19:10 +00:00
if ( GameIni . Get ( " Video " , " UseBBox " , & bTemp ) )
UseBBox - > Set3StateValue ( ( wxCheckBoxState ) bTemp ) ;
else
UseBBox - > Set3StateValue ( wxCHK_UNDETERMINED ) ;
2010-08-05 18:41:02 +00:00
if ( GameIni . Get ( " Video " , " ZTPSpeedupHack " , & bTemp ) )
UseZTPSpeedupHack - > Set3StateValue ( ( wxCheckBoxState ) bTemp ) ;
else
UseZTPSpeedupHack - > Set3StateValue ( wxCHK_UNDETERMINED ) ;
2011-01-29 21:13:56 +00:00
GameIni . Get ( " Video " , " ProjectionHack " , & bTemp ) ;
PHackEnable - > Set3StateValue ( ( wxCheckBoxState ) bTemp ) ;
2011-02-03 17:51:12 +00:00
GameIni . Get ( " Video " , " PH_SZNear " , & PHack_Data . PHackSZNear ) ;
GameIni . Get ( " Video " , " PH_SZFar " , & PHack_Data . PHackSZFar ) ;
GameIni . Get ( " Video " , " PH_ExtraParam " , & PHack_Data . PHackExP ) ;
2011-01-29 21:13:56 +00:00
2011-02-03 17:51:12 +00:00
GameIni . Get ( " Video " , " PH_ZNear " , & PHack_Data . PHZNear ) ;
GameIni . Get ( " Video " , " PH_ZFar " , & PHack_Data . PHZFar ) ;
2009-05-10 12:33:47 +00:00
2010-11-11 01:00:01 +00:00
GameIni . Get ( " EmuState " , " EmulationStateId " , & iTemp , 0 /*Not Set*/ ) ;
2008-12-08 05:30:24 +00:00
EmuState - > SetSelection ( iTemp ) ;
2010-06-03 18:05:08 +00:00
GameIni . Get ( " EmuState " , " EmulationIssues " , & sTemp ) ;
2009-02-21 14:40:34 +00:00
if ( ! sTemp . empty ( ) )
{
2009-12-29 18:25:45 +00:00
EmuIssues - > SetValue ( wxString ( sTemp . c_str ( ) , * wxConvCurrent ) ) ;
2009-02-21 14:40:34 +00:00
bRefreshList = true ;
}
2009-09-25 16:29:00 +00:00
EmuIssues - > Enable ( EmuState - > GetSelection ( ) ! = 0 ) ;
2009-02-21 14:40:34 +00:00
2008-12-08 05:30:24 +00:00
PatchList_Load ( ) ;
ActionReplayList_Load ( ) ;
2010-07-23 05:22:12 +00:00
m_geckocode_panel - > LoadCodes ( GameIni , OpenISO - > GetUniqueID ( ) ) ;
2008-12-08 05:30:24 +00:00
}
bool CISOProperties : : SaveGameConfig ( )
{
2010-06-03 18:05:08 +00:00
if ( CPUThread - > Get3StateValue ( ) = = wxCHK_UNDETERMINED )
GameIni . DeleteKey ( " Core " , " CPUThread " ) ;
else
GameIni . Set ( " Core " , " CPUThread " , CPUThread - > Get3StateValue ( ) ) ;
if ( SkipIdle - > Get3StateValue ( ) = = wxCHK_UNDETERMINED )
GameIni . DeleteKey ( " Core " , " SkipIdle " ) ;
else
GameIni . Set ( " Core " , " SkipIdle " , SkipIdle - > Get3StateValue ( ) ) ;
2010-07-29 12:17:47 +00:00
if ( MMU - > Get3StateValue ( ) = = wxCHK_UNDETERMINED )
GameIni . DeleteKey ( " Core " , " MMU " ) ;
else
GameIni . Set ( " Core " , " MMU " , MMU - > Get3StateValue ( ) ) ;
2010-09-06 14:43:28 +00:00
if ( MMUBAT - > Get3StateValue ( ) = = wxCHK_UNDETERMINED )
GameIni . DeleteKey ( " Core " , " BAT " ) ;
else
GameIni . Set ( " Core " , " BAT " , MMUBAT - > Get3StateValue ( ) ) ;
2010-06-03 18:05:08 +00:00
if ( TLBHack - > Get3StateValue ( ) = = wxCHK_UNDETERMINED )
GameIni . DeleteKey ( " Core " , " TLBHack " ) ;
else
GameIni . Set ( " Core " , " TLBHack " , TLBHack - > Get3StateValue ( ) ) ;
2011-01-20 08:34:49 +00:00
if ( VBeam - > Get3StateValue ( ) = = wxCHK_UNDETERMINED )
GameIni . DeleteKey ( " Core " , " VBeam " ) ;
2010-07-30 17:12:59 +00:00
else
2011-01-20 08:34:49 +00:00
GameIni . Set ( " Core " , " VBeam " , VBeam - > Get3StateValue ( ) ) ;
2010-07-30 17:12:59 +00:00
2010-10-15 21:46:51 +00:00
if ( FastDiscSpeed - > Get3StateValue ( ) = = wxCHK_UNDETERMINED )
GameIni . DeleteKey ( " Core " , " FastDiscSpeed " ) ;
2010-10-11 12:38:17 +00:00
else
2010-10-15 21:46:51 +00:00
GameIni . Set ( " Core " , " FastDiscSpeed " , FastDiscSpeed - > Get3StateValue ( ) ) ;
2010-10-11 12:38:17 +00:00
2010-09-14 13:50:25 +00:00
if ( BlockMerging - > Get3StateValue ( ) = = wxCHK_UNDETERMINED )
GameIni . DeleteKey ( " Core " , " BlockMerging " ) ;
else
GameIni . Set ( " Core " , " BlockMerging " , BlockMerging - > Get3StateValue ( ) ) ;
2011-01-29 13:26:49 +00:00
if ( DSPHLE - > Get3StateValue ( ) = = wxCHK_UNDETERMINED )
GameIni . DeleteKey ( " Core " , " DSPHLE " ) ;
else
GameIni . Set ( " Core " , " DSPHLE " , DSPHLE - > Get3StateValue ( ) ) ;
2010-06-03 18:05:08 +00:00
if ( EnableProgressiveScan - > Get3StateValue ( ) = = wxCHK_UNDETERMINED )
2010-10-21 14:50:42 +00:00
GameIni . DeleteKey ( " Display " , " ProgressiveScan " ) ;
2010-06-03 18:05:08 +00:00
else
2010-10-21 14:50:42 +00:00
GameIni . Set ( " Display " , " ProgressiveScan " , EnableProgressiveScan - > Get3StateValue ( ) ) ;
2010-06-03 18:05:08 +00:00
if ( EnableWideScreen - > Get3StateValue ( ) = = wxCHK_UNDETERMINED )
GameIni . DeleteKey ( " Wii " , " Widescreen " ) ;
else
GameIni . Set ( " Wii " , " Widescreen " , EnableWideScreen - > Get3StateValue ( ) ) ;
2011-05-25 15:01:49 +00:00
if ( DisableWiimoteSpeaker - > Get3StateValue ( ) = = wxCHK_UNDETERMINED )
GameIni . DeleteKey ( " Wii " , " DisableWiimoteSpeaker " ) ;
else
GameIni . Set ( " Wii " , " DisableWiimoteSpeaker " , DisableWiimoteSpeaker - > Get3StateValue ( ) ) ;
2011-10-26 00:19:10 +00:00
if ( UseBBox - > Get3StateValue ( ) = = wxCHK_UNDETERMINED )
GameIni . DeleteKey ( " Video " , " UseBBox " ) ;
else
GameIni . Set ( " Video " , " UseBBox " , UseBBox - > Get3StateValue ( ) ) ;
2010-08-05 18:41:02 +00:00
if ( UseZTPSpeedupHack - > Get3StateValue ( ) = = wxCHK_UNDETERMINED )
GameIni . DeleteKey ( " Video " , " ZTPSpeedupHack " ) ;
else
GameIni . Set ( " Video " , " ZTPSpeedupHack " , UseZTPSpeedupHack - > Get3StateValue ( ) ) ;
2011-01-29 21:13:56 +00:00
GameIni . Set ( " Video " , " ProjectionHack " , PHackEnable - > Get3StateValue ( ) ) ;
2011-02-03 17:51:12 +00:00
GameIni . Set ( " Video " , " PH_SZNear " , PHack_Data . PHackSZNear ? 1 : 0 ) ;
GameIni . Set ( " Video " , " PH_SZFar " , PHack_Data . PHackSZFar ? 1 : 0 ) ;
GameIni . Set ( " Video " , " PH_ExtraParam " , PHack_Data . PHackExP ? 1 : 0 ) ;
GameIni . Set ( " Video " , " PH_ZNear " , PHack_Data . PHZNear ) ;
GameIni . Set ( " Video " , " PH_ZFar " , PHack_Data . PHZFar ) ;
2011-01-29 21:13:56 +00:00
2010-11-11 01:00:01 +00:00
GameIni . Set ( " EmuState " , " EmulationStateId " , EmuState - > GetSelection ( ) ) ;
2010-06-03 18:05:08 +00:00
GameIni . Set ( " EmuState " , " EmulationIssues " , ( const char * ) EmuIssues - > GetValue ( ) . mb_str ( * wxConvCurrent ) ) ;
2008-12-08 05:30:24 +00:00
PatchList_Save ( ) ;
ActionReplayList_Save ( ) ;
2010-07-22 01:48:48 +00:00
Gecko : : SaveCodes ( GameIni , m_geckocode_panel - > GetCodes ( ) ) ;
2008-12-08 05:30:24 +00:00
return GameIni . Save ( GameIniFile . c_str ( ) ) ;
}
void CISOProperties : : OnEditConfig ( wxCommandEvent & WXUNUSED ( event ) )
{
2010-06-11 08:39:03 +00:00
if ( wxFileExists ( wxString : : From8BitData ( GameIniFile . c_str ( ) ) ) )
2008-12-08 05:30:24 +00:00
{
SaveGameConfig ( ) ;
2011-01-30 14:20:20 +00:00
# ifdef __APPLE__
// wxTheMimeTypesManager is not yet implemented for wxCocoa
[ [ NSWorkspace sharedWorkspace ] openFile :
[ NSString stringWithUTF8String : GameIniFile . c_str ( ) ]
withApplication : @ " TextEdit " ] ;
# else
2011-01-06 13:57:46 +00:00
wxFileType * filetype = wxTheMimeTypesManager - > GetFileTypeFromExtension ( _T ( " ini " ) ) ;
2008-12-09 23:27:08 +00:00
if ( filetype = = NULL ) // From extension failed, trying with MIME type now
2008-12-09 23:19:44 +00:00
{
2011-01-06 13:57:46 +00:00
filetype = wxTheMimeTypesManager - > GetFileTypeFromMimeType ( _T ( " text/plain " ) ) ;
2008-12-09 23:27:08 +00:00
if ( filetype = = NULL ) // MIME type failed, aborting mission
{
2011-01-13 02:05:58 +00:00
PanicAlertT ( " Filetype 'ini' is unknown! Will not open! " ) ;
2008-12-09 23:27:08 +00:00
return ;
}
2008-12-09 23:19:44 +00:00
}
wxString OpenCommand ;
2010-06-11 08:39:03 +00:00
OpenCommand = filetype - > GetOpenCommand ( wxString : : From8BitData ( GameIniFile . c_str ( ) ) ) ;
2008-12-09 23:19:44 +00:00
if ( OpenCommand . IsEmpty ( ) )
2011-01-13 02:05:58 +00:00
PanicAlertT ( " Couldn't find open command for extension 'ini'! " ) ;
2008-12-09 23:19:44 +00:00
else
if ( wxExecute ( OpenCommand , wxEXEC_SYNC ) = = - 1 )
2011-01-13 02:05:58 +00:00
PanicAlertT ( " wxExecute returned -1 on application run! " ) ;
2011-01-30 14:20:20 +00:00
# endif
2008-12-08 05:30:24 +00:00
GameIni . Load ( GameIniFile . c_str ( ) ) ;
LoadGameConfig ( ) ;
bRefreshList = true ; // Just in case
}
2009-06-07 02:54:07 +00:00
// Once we're done with the ini edit, give the focus back to Dolphin
SetFocus ( ) ;
2008-12-08 05:30:24 +00:00
}
void CISOProperties : : ListSelectionChanged ( wxCommandEvent & event )
{
switch ( event . GetId ( ) )
{
case ID_PATCHES_LIST :
if ( Patches - > GetSelection ( ) ! = wxNOT_FOUND )
{
EditPatch - > Enable ( ) ;
RemovePatch - > Enable ( ) ;
}
break ;
case ID_CHEATS_LIST :
if ( Cheats - > GetSelection ( ) ! = wxNOT_FOUND )
{
EditCheat - > Enable ( ) ;
RemoveCheat - > Enable ( ) ;
}
break ;
}
}
void CISOProperties : : PatchList_Load ( )
{
onFrame . clear ( ) ;
Patches - > Clear ( ) ;
PatchEngine : : LoadPatchSection ( " OnFrame " , onFrame , GameIni ) ;
u32 index = 0 ;
for ( std : : vector < PatchEngine : : Patch > : : const_iterator it = onFrame . begin ( ) ; it ! = onFrame . end ( ) ; + + it )
{
PatchEngine : : Patch p = * it ;
2009-12-29 18:25:45 +00:00
Patches - > Append ( wxString ( p . name . c_str ( ) , * wxConvCurrent ) ) ;
2008-12-08 05:30:24 +00:00
Patches - > Check ( index , p . active ) ;
+ + index ;
}
}
void CISOProperties : : PatchList_Save ( )
{
std : : vector < std : : string > lines ;
2009-01-03 23:02:13 +00:00
u32 index = 0 ;
2008-12-08 05:30:24 +00:00
for ( std : : vector < PatchEngine : : Patch > : : const_iterator onFrame_it = onFrame . begin ( ) ; onFrame_it ! = onFrame . end ( ) ; + + onFrame_it )
{
2009-01-03 23:02:13 +00:00
lines . push_back ( Patches - > IsChecked ( index ) ? " +$ " + onFrame_it - > name : " $ " + onFrame_it - > name ) ;
2008-12-08 05:30:24 +00:00
for ( std : : vector < PatchEngine : : PatchEntry > : : const_iterator iter2 = onFrame_it - > entries . begin ( ) ; iter2 ! = onFrame_it - > entries . end ( ) ; + + iter2 )
{
2010-11-10 04:12:31 +00:00
std : : string temp = StringFromFormat ( " 0x%08X:%s:0x%08X " , iter2 - > address , PatchEngine : : PatchTypeStrings [ iter2 - > type ] , iter2 - > value ) ;
2009-01-03 23:02:13 +00:00
lines . push_back ( temp ) ;
2008-12-08 05:30:24 +00:00
}
2009-01-03 23:02:13 +00:00
+ + index ;
2008-12-08 05:30:24 +00:00
}
2010-06-03 18:05:08 +00:00
GameIni . SetLines ( " OnFrame " , lines ) ;
lines . clear ( ) ;
2008-12-08 05:30:24 +00:00
}
2011-02-03 17:51:12 +00:00
void CISOProperties : : PHackButtonClicked ( wxCommandEvent & event )
{
if ( event . GetId ( ) = = ID_PHSETTINGS )
{
: : PHack_Data = PHack_Data ;
CPHackSettings dlg ( this , 1 ) ;
if ( dlg . ShowModal ( ) = = wxID_OK )
PHack_Data = : : PHack_Data ;
}
}
2008-12-08 05:30:24 +00:00
void CISOProperties : : PatchButtonClicked ( wxCommandEvent & event )
{
int selection = Patches - > GetSelection ( ) ;
switch ( event . GetId ( ) )
{
case ID_EDITPATCH :
{
CPatchAddEdit dlg ( selection , this ) ;
dlg . ShowModal ( ) ;
}
break ;
case ID_ADDPATCH :
{
2009-01-03 21:55:49 +00:00
CPatchAddEdit dlg ( - 1 , this , 1 , _ ( " Add Patch " ) ) ;
2009-01-03 23:02:13 +00:00
if ( dlg . ShowModal ( ) = = wxID_OK )
{
2009-12-29 18:25:45 +00:00
Patches - > Append ( wxString ( onFrame . back ( ) . name . c_str ( ) , * wxConvCurrent ) ) ;
2009-01-24 00:45:46 +00:00
Patches - > Check ( ( unsigned int ) ( onFrame . size ( ) - 1 ) , onFrame . back ( ) . active ) ;
2009-01-03 23:02:13 +00:00
}
2008-12-08 05:30:24 +00:00
}
break ;
case ID_REMOVEPATCH :
onFrame . erase ( onFrame . begin ( ) + Patches - > GetSelection ( ) ) ;
2009-12-11 00:03:56 +00:00
Patches - > Delete ( Cheats - > GetSelection ( ) ) ;
2008-12-08 05:30:24 +00:00
break ;
}
PatchList_Save ( ) ;
Patches - > Clear ( ) ;
PatchList_Load ( ) ;
EditPatch - > Enable ( false ) ;
RemovePatch - > Enable ( false ) ;
}
void CISOProperties : : ActionReplayList_Load ( )
{
2008-12-17 04:14:24 +00:00
arCodes . clear ( ) ;
2008-12-08 05:30:24 +00:00
Cheats - > Clear ( ) ;
2008-12-17 04:14:24 +00:00
ActionReplay : : LoadCodes ( arCodes , GameIni ) ;
2008-12-08 05:30:24 +00:00
2008-12-17 04:14:24 +00:00
u32 index = 0 ;
for ( std : : vector < ActionReplay : : ARCode > : : const_iterator it = arCodes . begin ( ) ; it ! = arCodes . end ( ) ; + + it )
2008-12-08 05:30:24 +00:00
{
2008-12-17 04:14:24 +00:00
ActionReplay : : ARCode arCode = * it ;
2009-12-29 18:25:45 +00:00
Cheats - > Append ( wxString ( arCode . name . c_str ( ) , * wxConvCurrent ) ) ;
2008-12-17 04:14:24 +00:00
Cheats - > Check ( index , arCode . active ) ;
+ + index ;
2008-12-08 05:30:24 +00:00
}
}
void CISOProperties : : ActionReplayList_Save ( )
{
std : : vector < std : : string > lines ;
2008-12-17 04:14:24 +00:00
u32 index = 0 ;
for ( std : : vector < ActionReplay : : ARCode > : : const_iterator iter = arCodes . begin ( ) ; iter ! = arCodes . end ( ) ; + + iter )
2008-12-08 05:30:24 +00:00
{
2008-12-17 04:14:24 +00:00
ActionReplay : : ARCode code = * iter ;
2008-12-08 05:30:24 +00:00
2008-12-17 04:14:24 +00:00
lines . push_back ( Cheats - > IsChecked ( index ) ? " +$ " + code . name : " $ " + code . name ) ;
2008-12-08 05:30:24 +00:00
2008-12-17 04:14:24 +00:00
for ( std : : vector < ActionReplay : : AREntry > : : const_iterator iter2 = code . ops . begin ( ) ; iter2 ! = code . ops . end ( ) ; + + iter2 )
2008-12-08 05:30:24 +00:00
{
2008-12-17 09:46:32 +00:00
lines . push_back ( std : : string ( wxString : : Format ( wxT ( " %08X %08X " ) , iter2 - > cmd_addr , iter2 - > value ) . mb_str ( ) ) ) ;
2008-12-08 05:30:24 +00:00
}
2008-12-17 04:14:24 +00:00
+ + index ;
2008-12-08 05:30:24 +00:00
}
2010-06-03 18:05:08 +00:00
GameIni . SetLines ( " ActionReplay " , lines ) ;
2008-12-08 05:30:24 +00:00
}
void CISOProperties : : ActionReplayButtonClicked ( wxCommandEvent & event )
{
2008-12-17 04:14:24 +00:00
int selection = Cheats - > GetSelection ( ) ;
2008-12-08 05:30:24 +00:00
switch ( event . GetId ( ) )
{
case ID_EDITCHEAT :
2008-12-17 04:14:24 +00:00
{
CARCodeAddEdit dlg ( selection , this ) ;
dlg . ShowModal ( ) ;
}
2008-12-08 05:30:24 +00:00
break ;
case ID_ADDCHEAT :
2008-12-17 04:14:24 +00:00
{
2009-04-08 16:38:41 +00:00
CARCodeAddEdit dlg ( - 1 , this , 1 , _ ( " Add ActionReplay Code " ) ) ;
2009-02-20 00:07:35 +00:00
if ( dlg . ShowModal ( ) = = wxID_OK )
{
2010-06-11 08:39:03 +00:00
Cheats - > Append ( wxString : : From8BitData ( arCodes . back ( ) . name . c_str ( ) ) ) ;
2009-02-20 00:07:35 +00:00
Cheats - > Check ( ( unsigned int ) ( arCodes . size ( ) - 1 ) , arCodes . back ( ) . active ) ;
}
2008-12-17 04:14:24 +00:00
}
2008-12-08 05:30:24 +00:00
break ;
case ID_REMOVECHEAT :
2008-12-17 04:14:24 +00:00
arCodes . erase ( arCodes . begin ( ) + Cheats - > GetSelection ( ) ) ;
2009-11-08 23:12:35 +00:00
Cheats - > Delete ( Cheats - > GetSelection ( ) ) ;
2008-12-08 05:30:24 +00:00
break ;
}
ActionReplayList_Save ( ) ;
Cheats - > Clear ( ) ;
ActionReplayList_Load ( ) ;
EditCheat - > Enable ( false ) ;
RemoveCheat - > Enable ( false ) ;
}
2009-02-14 17:32:03 +00:00
void CISOProperties : : OnChangeBannerLang ( wxCommandEvent & event )
{
ChangeBannerDetails ( event . GetSelection ( ) ) ;
}
void CISOProperties : : ChangeBannerDetails ( int lang )
{
2011-12-19 06:01:46 +00:00
std : : wstring wname ;
wxString shortName ,
comment ,
maker ;
2011-12-20 10:10:40 +00:00
2011-01-27 23:59:12 +00:00
# ifdef _WIN32
2011-12-19 06:01:46 +00:00
wxCSConv SJISConv ( * ( wxCSConv * ) wxConvCurrent ) ;
static bool validCP932 = : : IsValidCodePage ( 932 ) ! = 0 ;
if ( validCP932 )
{
SJISConv = wxCSConv ( wxFontMapper : : GetEncodingName ( wxFONTENCODING_SHIFT_JIS ) ) ;
2009-12-28 19:34:19 +00:00
}
2011-12-19 06:01:46 +00:00
else
2009-12-28 19:34:19 +00:00
{
2011-12-19 06:01:46 +00:00
WARN_LOG ( COMMON , " Cannot Convert from Charset Windows Japanese cp 932 " ) ;
}
# else
2011-12-20 09:35:12 +00:00
// on linux the wrong string is returned from wxFontMapper::GetEncodingName(wxFONTENCODING_SHIFT_JIS)
// it returns CP-932, in order to use iconv we need to use CP932
2012-01-27 08:30:52 +00:00
wxCSConv SJISConv ( wxT ( " CP932 " ) ) ;
2011-12-20 09:35:12 +00:00
# endif
2011-12-19 06:01:46 +00:00
switch ( OpenGameListItem - > GetCountry ( ) )
{
case DiscIO : : IVolume : : COUNTRY_TAIWAN :
case DiscIO : : IVolume : : COUNTRY_JAPAN :
2009-12-28 19:34:19 +00:00
2011-12-19 06:01:46 +00:00
if ( OpenGameListItem - > GetName ( wname , - 1 ) )
2012-01-27 08:30:52 +00:00
shortName = wname . c_str ( ) ;
2011-12-19 06:01:46 +00:00
else
shortName = wxString ( OpenGameListItem - > GetName ( 0 ) . c_str ( ) , SJISConv ) ;
2009-12-28 19:34:19 +00:00
2012-01-27 08:30:52 +00:00
if ( ( comment = OpenGameListItem - > GetDescription ( ) . c_str ( ) ) . size ( ) = = 0 )
2011-12-19 06:01:46 +00:00
comment = wxString ( OpenGameListItem - > GetDescription ( 0 ) . c_str ( ) , SJISConv ) ;
maker = wxString ( OpenGameListItem - > GetCompany ( ) . c_str ( ) , SJISConv ) ;
break ;
case DiscIO : : IVolume : : COUNTRY_USA :
2011-12-20 10:19:46 +00:00
lang = 0 ;
2011-12-19 06:01:46 +00:00
default :
2011-12-20 10:19:46 +00:00
{
wxCSConv WindowsCP1252 ( wxFontMapper : : GetEncodingName ( wxFONTENCODING_CP1252 ) ) ;
2011-12-19 06:01:46 +00:00
if ( OpenGameListItem - > GetName ( wname , lang ) )
2012-01-27 08:30:52 +00:00
shortName = wname . c_str ( ) ;
2011-12-19 06:01:46 +00:00
else
2011-12-20 10:10:40 +00:00
shortName = wxString ( OpenGameListItem - > GetName ( lang ) . c_str ( ) , WindowsCP1252 ) ;
2012-01-27 08:30:52 +00:00
if ( ( comment = OpenGameListItem - > GetDescription ( ) . c_str ( ) ) . size ( ) = = 0 )
2011-12-20 10:10:40 +00:00
comment = wxString ( OpenGameListItem - > GetDescription ( lang ) . c_str ( ) , WindowsCP1252 ) ;
maker = wxString ( OpenGameListItem - > GetCompany ( ) . c_str ( ) , WindowsCP1252 ) ;
2011-12-20 10:19:46 +00:00
}
2011-12-19 06:01:46 +00:00
break ;
2009-12-28 19:34:19 +00:00
}
2011-12-19 06:01:46 +00:00
// Updates the informations shown in the window
m_ShortName - > SetValue ( shortName ) ;
m_Comment - > SetValue ( comment ) ;
m_Maker - > SetValue ( maker ) ; //dev too
std : : string filename , extension ;
SplitPath ( OpenGameListItem - > GetFileName ( ) , 0 , & filename , & extension ) ;
// Also sets the window's title
SetTitle ( wxString ( StringFromFormat ( " %s%s: %s - " , filename . c_str ( ) , extension . c_str ( ) , OpenGameListItem - > GetUniqueID ( ) . c_str ( ) ) . c_str ( ) , * wxConvCurrent ) + shortName ) ;
2009-02-14 17:32:03 +00:00
}