2013-04-18 03:43:35 +00:00
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
2008-12-08 05:30:24 +00:00
2011-01-30 14:20:20 +00:00
# ifdef __APPLE__
# import <Cocoa / Cocoa.h>
# endif
2013-09-07 21:02:49 +00:00
# include <type_traits>
2013-10-26 09:55:41 +00:00
# include <cinttypes>
2013-09-07 21:02:49 +00:00
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"
2013-02-28 04:37:38 +00:00
# include "WxUtils.h"
2008-12-08 05:30:24 +00:00
# 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
2013-12-07 20:14:29 +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 )
2013-09-07 21:02:49 +00:00
EVT_BUTTON ( ID_SHOWDEFAULTCONFIG , CISOProperties : : OnShowDefaultConfig )
2008-12-08 05:30:24 +00:00
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 )
{
2013-09-07 21:02:49 +00:00
// Load ISO data
2009-03-10 17:19:30 +00:00
OpenISO = DiscIO : : CreateVolumeFromFilename ( fileName ) ;
2013-09-14 22:07:53 +00:00
bool IsWad = DiscIO : : IsVolumeWadFile ( OpenISO ) ;
bool IsWiiDisc = DiscIO : : IsVolumeWiiDisc ( OpenISO ) ;
if ( IsWiiDisc )
2009-03-10 17:19:30 +00:00
{
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
2013-04-08 05:16:50 +00:00
{
2009-03-10 17:19:30 +00:00
break ;
2013-04-08 05:16:50 +00:00
}
2009-03-10 17:19:30 +00:00
}
}
else
{
2009-06-07 02:54:07 +00:00
// TODO : Should we add a way to browse the wad file ?
2013-09-14 22:07:53 +00:00
if ( ! IsWad )
2009-06-07 02:54:07 +00:00
{
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
2013-09-07 21:02:49 +00:00
// Load game ini
2011-02-03 17:51:12 +00:00
std : : string _iniFilename = OpenISO - > GetUniqueID ( ) ;
2013-09-23 06:39:14 +00:00
std : : string _iniFilenameRevisionSpecific = OpenISO - > GetRevisionSpecificUniqueID ( ) ;
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 ) )
{
2013-10-26 09:55:41 +00:00
snprintf ( tmp , 17 , " %016 " PRIx64 , Common : : swap64 ( _tTitleID ) ) ;
2010-12-15 23:18:08 +00:00
_iniFilename = tmp ;
}
}
2013-04-08 05:16:50 +00:00
2013-09-07 21:02:49 +00:00
GameIniFileDefault = File : : GetSysDirectory ( ) + GAMESETTINGS_DIR DIR_SEP + _iniFilename + " .ini " ;
2013-09-23 06:39:14 +00:00
std : : string GameIniFileDefaultRevisionSpecific = File : : GetSysDirectory ( ) + GAMESETTINGS_DIR DIR_SEP + _iniFilenameRevisionSpecific + " .ini " ;
2013-09-07 21:02:49 +00:00
GameIniFileLocal = File : : GetUserPath ( D_GAMESETTINGS_IDX ) + _iniFilename + " .ini " ;
2013-04-08 05:16:50 +00:00
2013-09-07 21:02:49 +00:00
GameIniDefault . Load ( GameIniFileDefault ) ;
2013-09-23 06:39:14 +00:00
if ( _iniFilenameRevisionSpecific ! = " " )
GameIniDefault . Load ( GameIniFileDefaultRevisionSpecific ) ;
2013-09-07 21:02:49 +00:00
GameIniLocal . Load ( GameIniFileLocal ) ;
2013-04-08 05:16:50 +00:00
2013-09-07 21:02:49 +00:00
// Setup GUI
OpenGameListItem = new GameListItem ( fileName ) ;
bRefreshList = false ;
2013-09-14 22:07:53 +00:00
CreateGUIControls ( IsWad ) ;
2013-09-07 21:02:49 +00:00
LoadGameConfig ( ) ;
2008-12-08 05:30:24 +00:00
// Disk header and apploader
2011-12-19 06:01:46 +00:00
2013-03-03 01:46:55 +00:00
m_Name - > SetValue ( StrToWxStr ( OpenISO - > GetName ( ) ) ) ;
m_GameID - > SetValue ( StrToWxStr ( OpenISO - > GetUniqueID ( ) ) ) ;
2008-12-08 05:30:24 +00:00
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 " ) ) ;
2013-09-14 22:07:53 +00:00
if ( ! IsWad ) // For (non wad) NTSC Games, there's no multi lang
{
m_Lang - > SetSelection ( 0 ) ;
m_Lang - > Disable ( ) ;
}
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 " ) ) ;
2013-09-14 22:07:53 +00:00
if ( ! IsWad ) // For (non wad) NTSC Games, there's no multi lang
{
m_Lang - > Insert ( _ ( " Japanese " ) , 0 ) ;
m_Lang - > SetSelection ( 0 ) ;
m_Lang - > Disable ( ) ;
}
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 " ) ) ;
2013-09-14 22:07:53 +00:00
if ( ! IsWad ) // For (non wad) NTSC Games, there's no multi lang
{
m_Lang - > Insert ( _ ( " TAIWAN " ) , 0 ) ;
m_Lang - > SetSelection ( 0 ) ;
m_Lang - > Disable ( ) ;
}
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 ;
}
2013-10-29 05:23:17 +00:00
2013-09-14 22:07:53 +00:00
if ( IsWiiDisc ) // Only one language with wii banners
{
m_Lang - > SetSelection ( 0 ) ;
m_Lang - > Disable ( ) ;
}
2013-03-03 02:34:53 +00:00
wxString temp = _T ( " 0x " ) + StrToWxStr ( OpenISO - > GetMakerID ( ) ) ;
2008-12-08 05:30:24 +00:00
m_MakerID - > SetValue ( temp ) ;
2013-04-17 03:29:01 +00:00
m_Revision - > SetValue ( wxString : : Format ( wxT ( " %u " ) , OpenISO - > GetRevision ( ) ) ) ;
2013-03-03 02:34:53 +00:00
m_Date - > SetValue ( StrToWxStr ( OpenISO - > GetApploaderDate ( ) ) ) ;
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
2013-09-14 22:07:53 +00:00
if ( ! IsWad )
{
ChangeBannerDetails ( ( int ) SConfig : : GetInstance ( ) . m_LocalCoreStartupParameter . SelectedLanguage ) ;
}
else
{
ChangeBannerDetails ( SConfig : : GetInstance ( ) . m_SYSCONF - > GetData < u8 > ( " IPL.LNG " ) ) ;
}
2013-10-29 05:23:17 +00:00
2013-09-25 07:05:36 +00:00
m_Banner - > SetBitmap ( OpenGameListItem - > GetBitmap ( ) ) ;
2013-01-13 18:07:45 +00:00
m_Banner - > Bind ( wxEVT_RIGHT_DOWN , & CISOProperties : : RightClickOnBanner , this ) ;
2008-12-08 05:30:24 +00:00
// 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 ) ;
2013-10-29 05:23:17 +00:00
CreateDirectoryTree ( PartitionRoot , partition . Files , 1 , partition . Files . at ( 0 ) - > m_FileSize ) ;
2011-03-16 22:22:21 +00:00
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 ( ) )
2013-04-08 05:16:50 +00:00
{
2011-03-16 22:22:21 +00:00
CreateDirectoryTree ( RootId , GCFiles , 1 , GCFiles . at ( 0 ) - > m_FileSize ) ;
2013-04-08 05:16:50 +00:00
}
2011-03-16 22:22:21 +00:00
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 ,
2013-10-29 05:23:17 +00:00
const size_t _FirstIndex ,
2011-03-16 22:22:21 +00:00
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
2013-04-08 05:16:50 +00:00
if ( rFileInfo - > IsDirectory ( ) )
{
name [ strlen ( name ) - 1 ] = ' \0 ' ;
}
2009-09-13 22:03:18 +00:00
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 ( ) )
{
2013-03-03 02:34:53 +00:00
wxTreeItemId item = m_Treectrl - > AppendItem ( parent , StrToWxStr ( 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
{
2013-03-03 02:34:53 +00:00
m_Treectrl - > AppendItem ( parent , StrToWxStr ( 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
}
2013-09-07 21:02:49 +00:00
long CISOProperties : : GetElementStyle ( const char * section , const char * key )
{
// Disable 3rd state if default gameini overrides the setting
if ( GameIniDefault . Exists ( section , key ) )
return 0 ;
return wxCHK_3STATE | wxCHK_ALLOW_3RD_STATE_FOR_USER ;
}
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
2013-09-08 19:03:24 +00:00
wxButton * const EditConfigDefault =
2013-09-07 21:02:49 +00:00
new wxButton ( this , ID_SHOWDEFAULTCONFIG , _ ( " Show Defaults " ) , wxDefaultPosition , wxDefaultSize ) ;
2013-09-08 19:03:24 +00:00
EditConfigDefault - > SetToolTip ( _ ( " Opens the default (read-only) configuration for this game in an external text editor. " ) ) ;
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. " ) ) ;
2013-09-07 21:02:49 +00:00
2009-03-24 23:10:43 +00:00
// Core
2013-09-07 21:02:49 +00:00
CPUThread = new wxCheckBox ( m_GameConfig , ID_USEDUALCORE , _ ( " Enable Dual Core " ) , wxDefaultPosition , wxDefaultSize , GetElementStyle ( " Core " , " CPUThread " ) , wxDefaultValidator ) ;
SkipIdle = new wxCheckBox ( m_GameConfig , ID_IDLESKIP , _ ( " Enable Idle Skipping " ) , wxDefaultPosition , wxDefaultSize , GetElementStyle ( " Core " , " SkipIdle " ) , wxDefaultValidator ) ;
MMU = new wxCheckBox ( m_GameConfig , ID_MMU , _ ( " Enable MMU " ) , wxDefaultPosition , wxDefaultSize , GetElementStyle ( " Core " , " MMU " ) , wxDefaultValidator ) ;
2011-01-05 04:35:46 +00:00
MMU - > SetToolTip ( _ ( " Enables the Memory Management Unit, needed for some games. (ON = Compatible, OFF = Fast) " ) ) ;
2013-09-07 21:02:49 +00:00
TLBHack = new wxCheckBox ( m_GameConfig , ID_TLBHACK , _ ( " MMU Speed Hack " ) , wxDefaultPosition , wxDefaultSize , GetElementStyle ( " Core " , " TLBHack " ) , wxDefaultValidator ) ;
2011-01-05 04:35:46 +00:00
TLBHack - > SetToolTip ( _ ( " Fast version of the MMU. Does not work for every game. " ) ) ;
2013-09-07 21:02:49 +00:00
DCBZOFF = new wxCheckBox ( m_GameConfig , ID_DCBZOFF , _ ( " Skip DCBZ clearing " ) , wxDefaultPosition , wxDefaultSize , GetElementStyle ( " Core " , " DCBZ " ) , wxDefaultValidator ) ;
2013-01-20 02:09:38 +00:00
DCBZOFF - > SetToolTip ( _ ( " Bypass the clearing of the data cache by the DCBZ instruction. Usually leave this option disabled. " ) ) ;
2013-09-07 21:02:49 +00:00
VBeam = new wxCheckBox ( m_GameConfig , ID_VBEAM , _ ( " VBeam Speed Hack " ) , wxDefaultPosition , wxDefaultSize , GetElementStyle ( " Core " , " VBeam " ) , wxDefaultValidator ) ;
2013-04-15 10:23:25 +00:00
VBeam - > SetToolTip ( _ ( " Doubles the emulated GPU clock rate. May speed up some games (ON = Fast, OFF = Compatible) " ) ) ;
2013-09-07 21:02:49 +00:00
SyncGPU = new wxCheckBox ( m_GameConfig , ID_SYNCGPU , _ ( " Synchronize GPU thread " ) , wxDefaultPosition , wxDefaultSize , GetElementStyle ( " Core " , " SyncGPU " ) , wxDefaultValidator ) ;
2013-03-29 16:05:22 +00:00
SyncGPU - > SetToolTip ( _ ( " Synchronizes the GPU and CPU threads to help prevent random freezes in Dual Core mode. (ON = Compatible, OFF = Fast) " ) ) ;
2013-09-07 21:02:49 +00:00
FastDiscSpeed = new wxCheckBox ( m_GameConfig , ID_DISCSPEED , _ ( " Speed up Disc Transfer Rate " ) , wxDefaultPosition , wxDefaultSize , GetElementStyle ( " Core " , " FastDiscSpeed " ) , wxDefaultValidator ) ;
2011-01-05 04:35:46 +00:00
FastDiscSpeed - > SetToolTip ( _ ( " Enable fast disc access. Needed for a few games. (ON = Fast, OFF = Compatible) " ) ) ;
2013-09-07 21:02:49 +00:00
BlockMerging = new wxCheckBox ( m_GameConfig , ID_MERGEBLOCKS , _ ( " Enable Block Merging " ) , wxDefaultPosition , wxDefaultSize , GetElementStyle ( " Core " , " BlockMerging " ) , wxDefaultValidator ) ;
DSPHLE = new wxCheckBox ( m_GameConfig , ID_AUDIO_DSP_HLE , _ ( " DSP HLE emulation (fast) " ) , wxDefaultPosition , wxDefaultSize , GetElementStyle ( " Core " , " DSPHLE " ) , wxDefaultValidator ) ;
2010-09-14 13:50:25 +00:00
2009-03-24 23:10:43 +00:00
// Wii Console
2013-09-07 21:02:49 +00:00
EnableWideScreen = new wxCheckBox ( m_GameConfig , ID_ENABLEWIDESCREEN , _ ( " Enable WideScreen " ) , wxDefaultPosition , wxDefaultSize , GetElementStyle ( " Wii " , " Widescreen " ) , wxDefaultValidator ) ;
2011-05-25 15:01:49 +00:00
2009-03-24 23:10:43 +00:00
// Video
2013-09-07 21:02:49 +00:00
UseBBox = new wxCheckBox ( m_GameConfig , ID_USE_BBOX , _ ( " Enable Bounding Box Calculation " ) , wxDefaultPosition , wxDefaultSize , GetElementStyle ( " Video " , " UseBBox " ) ) ;
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. " ) ) ;
2013-09-07 21:02:49 +00:00
UseZTPSpeedupHack = new wxCheckBox ( m_GameConfig , ID_ZTP_SPEEDUP , _ ( " ZTP hack " ) , wxDefaultPosition , wxDefaultSize , GetElementStyle ( " Video " , " ZTPSpeedupHack " ) ) ;
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. " ) ) ;
2013-10-29 05:23:17 +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 ( TLBHack , 0 , wxLEFT , 5 ) ;
2013-02-16 01:51:09 +00:00
sbCoreOverrides - > Add ( DCBZOFF , 0 , wxLEFT , 5 ) ;
2011-02-04 23:44:11 +00:00
sbCoreOverrides - > Add ( VBeam , 0 , wxLEFT , 5 ) ;
2013-02-16 01:51:09 +00:00
sbCoreOverrides - > Add ( SyncGPU , 0 , wxLEFT , 5 ) ;
2013-10-29 05:23:17 +00:00
sbCoreOverrides - > Add ( FastDiscSpeed , 0 , wxLEFT , 5 ) ;
2011-02-04 23:44:11 +00:00
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 ) ;
EnableWideScreen - > Hide ( ) ;
}
2011-02-04 23:44:11 +00:00
sbWiiOverrides - > Add ( EnableWideScreen , 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 ) ;
2013-10-29 05:23:17 +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 ) ;
2013-10-29 05:23:17 +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 ) ;
2013-10-29 05:23:17 +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 ) ;
2013-04-17 03:29:01 +00:00
wxStaticText * const m_RevisionText =
new wxStaticText ( m_Information , wxID_ANY , _ ( " Revision: " ) ) ;
m_Revision = new wxTextCtrl ( m_Information , ID_REVISION , wxEmptyString ,
wxDefaultPosition , wxDefaultSize , wxTE_READONLY ) ;
2011-03-16 22:22:21 +00:00
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 =
2013-10-29 05:23:17 +00:00
new wxStaticText ( m_Information , wxID_ANY , _ ( " FST Size: " ) ) ;
2011-03-16 22:22:21 +00:00
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 " ) ) ;
2013-09-14 22:07:53 +00:00
int language = ( int ) SConfig : : GetInstance ( ) . m_LocalCoreStartupParameter . SelectedLanguage ;
if ( IsWad )
{
arrayStringFor_Lang . Insert ( _ ( " Japanese " ) , 0 ) ;
arrayStringFor_Lang . Add ( _ ( " Simplified Chinese " ) ) ;
arrayStringFor_Lang . Add ( _ ( " Traditional Chinese " ) ) ;
arrayStringFor_Lang . Add ( _ ( " Korean " ) ) ;
2013-10-29 05:23:17 +00:00
2013-09-14 22:07:53 +00:00
language = SConfig : : GetInstance ( ) . m_SYSCONF - > GetData < u8 > ( " IPL.LNG " ) ;
}
2011-03-16 22:22:21 +00:00
m_Lang = new wxChoice ( m_Information , ID_LANG , wxDefaultPosition , wxDefaultSize , arrayStringFor_Lang ) ;
2013-09-14 22:07:53 +00:00
m_Lang - > SetSelection ( language ) ;
2013-10-29 05:23:17 +00:00
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 ) ;
2013-04-17 03:29:01 +00:00
sISODetails - > Add ( m_RevisionText , wxGBPosition ( 4 , 0 ) , wxGBSpan ( 1 , 1 ) , wxALIGN_CENTER_VERTICAL | wxALL , 5 ) ;
sISODetails - > Add ( m_Revision , wxGBPosition ( 4 , 1 ) , wxGBSpan ( 1 , 1 ) , wxEXPAND | wxALL , 5 ) ;
sISODetails - > Add ( m_DateText , wxGBPosition ( 5 , 0 ) , wxGBSpan ( 1 , 1 ) , wxALIGN_CENTER_VERTICAL | wxALL , 5 ) ;
sISODetails - > Add ( m_Date , wxGBPosition ( 5 , 1 ) , wxGBSpan ( 1 , 1 ) , wxEXPAND | wxALL , 5 ) ;
sISODetails - > Add ( m_FSTText , wxGBPosition ( 6 , 0 ) , wxGBSpan ( 1 , 1 ) , wxALIGN_CENTER_VERTICAL | wxALL , 5 ) ;
sISODetails - > Add ( m_FST , wxGBPosition ( 6 , 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 ) ;
2013-09-08 19:03:24 +00:00
sButtons - > Prepend ( EditConfigDefault ) ;
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
2013-09-07 21:02:49 +00:00
// If there is no default gameini, disable the button.
if ( ! File : : Exists ( GameIniFileDefault ) )
EditConfigDefault - > Disable ( ) ;
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 ( ) )
2013-09-07 21:02:49 +00:00
PanicAlertT ( " Could not save %s " , GameIniFileLocal . 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 ( ) )
2013-06-17 10:51:15 +00:00
{
2009-11-23 08:05:54 +00:00
popupMenu - > Append ( IDM_EXTRACTDIR , _ ( " Extract Partition... " ) ) ;
2013-06-17 10:51:15 +00:00
}
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... " ) ) ;
2013-10-29 05:23:17 +00:00
2009-11-23 08:05:54 +00:00
popupMenu - > Append ( IDM_EXTRACTALL , _ ( " Extract All Files... " ) ) ;
2013-10-29 05:23:17 +00:00
2012-05-04 10:49:10 +00:00
if ( m_Treectrl - > GetItemImage ( m_Treectrl - > GetSelection ( ) ) = = 0
& & m_Treectrl - > GetFirstVisibleItem ( ) ! = m_Treectrl - > GetSelection ( ) )
{
2013-06-17 10:51:15 +00:00
popupMenu - > AppendSeparator ( ) ;
popupMenu - > Append ( IDM_EXTRACTAPPLOADER , _ ( " Extract Apploader... " ) ) ;
popupMenu - > Append ( IDM_EXTRACTDOL , _ ( " Extract DOL... " ) ) ;
2012-05-04 10:49:10 +00:00
popupMenu - > AppendSeparator ( ) ;
popupMenu - > Append ( IDM_CHECKINTEGRITY , _ ( " Check Partition Integrity " ) ) ;
}
2013-10-29 05:23:17 +00:00
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 ( ) ) ;
2013-10-29 05:23:17 +00:00
2008-12-08 05:30:24 +00:00
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 ) )
{
2013-03-13 11:04:53 +00:00
int partitionNum = wxAtoi ( File . Mid ( File . find_first_of ( " / " ) , 1 ) ) ;
File . Remove ( 0 , File . find_first_of ( " / " ) + 1 ) ; // Remove "Partition x/"
2013-02-28 04:37:38 +00:00
WiiDisc . at ( partitionNum ) . FileSystem - > ExportFile ( WxStrToStr ( File ) . c_str ( ) , WxStrToStr ( Path ) . c_str ( ) ) ;
2009-03-10 17:19:30 +00:00
}
else
2013-04-08 05:16:50 +00:00
{
2013-02-28 04:37:38 +00:00
pFileSystem - > ExportFile ( WxStrToStr ( File ) . c_str ( ) , WxStrToStr ( Path ) . c_str ( ) ) ;
2013-04-08 05:16:50 +00:00
}
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 ] ;
2012-12-10 06:40:28 +00:00
u32 index [ 2 ] = { 0 , 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 ;
}
else
2013-04-08 05:16:50 +00:00
{
2009-09-13 22:03:18 +00:00
FS = pFileSystem ;
2013-04-08 05:16:50 +00:00
}
2009-09-13 22:03:18 +00:00
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 ) )
{
2013-03-31 23:10:21 +00:00
DEBUG_LOG ( DISCIO , " Found the directory at %u " , index [ 0 ] ) ;
2009-09-13 22:03:18 +00:00
index [ 1 ] = ( u32 ) fst . at ( index [ 0 ] ) - > m_FileSize ;
break ;
}
}
2013-03-31 23:10:21 +00:00
DEBUG_LOG ( DISCIO , " Directory found from %u to %u \n extracting to: \n %s " , index [ 0 ] , index [ 1 ] , _rExportFolder ) ;
2009-09-13 22:03:18 +00:00
}
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 ) ) ) ;
2013-10-29 05:23:17 +00:00
2012-03-25 03:59:20 +00:00
dialog . Update ( i , wxString : : Format ( _ ( " Extracting %s " ) ,
2013-02-28 08:39:06 +00:00
StrToWxStr ( fst [ i ] - > m_FullPath ) ) ) ;
2012-03-25 03:59:20 +00:00
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 ) ;
2013-10-29 05:23:17 +00:00
DEBUG_LOG ( DISCIO , " %s " , exportName ) ;
2009-09-13 22:03:18 +00:00
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 ) ;
2013-03-31 23:10:21 +00:00
DEBUG_LOG ( DISCIO , " Folder %s already exists " , exportName ) ;
2009-09-13 22:03:18 +00:00
}
}
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 + + )
2013-02-28 04:37:38 +00:00
ExportDir ( NULL , WxStrToStr ( Path ) . c_str ( ) , i ) ;
2009-09-13 22:03:18 +00:00
else
2013-02-28 04:37:38 +00:00
ExportDir ( NULL , WxStrToStr ( Path ) . c_str ( ) ) ;
2009-09-13 22:03:18 +00:00
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 ) )
{
2013-03-13 11:04:53 +00:00
int partitionNum = wxAtoi ( Directory . Mid ( Directory . find_first_of ( " / " ) , 1 ) ) ;
Directory . Remove ( 0 , Directory . find_first_of ( " / " ) + 1 ) ; // Remove "Partition x/"
2013-02-28 04:37:38 +00:00
ExportDir ( WxStrToStr ( Directory ) . c_str ( ) , WxStrToStr ( Path ) . c_str ( ) , partitionNum ) ;
2009-09-13 09:03:38 +00:00
}
else
2013-04-08 05:16:50 +00:00
{
2013-02-28 04:37:38 +00:00
ExportDir ( WxStrToStr ( Directory ) . c_str ( ) , WxStrToStr ( Path ) . c_str ( ) ) ;
2013-04-08 05:16:50 +00:00
}
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 ;
2013-06-17 07:25:55 +00:00
DiscIO : : IFileSystem * FS = NULL ;
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 ) )
2013-06-17 10:51:15 +00:00
{
wxString Directory = m_Treectrl - > GetItemText ( m_Treectrl - > GetSelection ( ) ) ;
std : : size_t partitionNum = ( std : : size_t ) wxAtoi ( Directory . Mid ( Directory . find_first_of ( " / " ) , 1 ) ) ;
Directory . Remove ( 0 , Directory . find_first_of ( " / " ) + 1 ) ; // Remove "Partition x/"
2013-10-29 05:23:17 +00:00
2013-06-17 10:51:15 +00:00
if ( WiiDisc . size ( ) > partitionNum )
2013-06-17 07:25:55 +00:00
{
// Get the filesystem of the LAST partition
2013-06-17 10:51:15 +00:00
FS = WiiDisc . at ( partitionNum ) . FileSystem ;
2013-06-17 07:25:55 +00:00
}
else
{
2013-10-03 00:46:46 +00:00
PanicAlertT ( " Partition doesn't exist: %u " , ( unsigned ) partitionNum ) ;
2013-06-17 07:25:55 +00:00
return ;
}
2013-06-17 10:51:15 +00:00
}
2009-12-29 13:59:38 +00:00
else
2013-06-17 10:51:15 +00:00
{
2009-12-29 13:59:38 +00:00
FS = pFileSystem ;
2013-06-17 10:51:15 +00:00
}
2013-10-29 05:23:17 +00:00
2009-12-29 13:59:38 +00:00
bool ret = false ;
if ( event . GetId ( ) = = IDM_EXTRACTAPPLOADER )
{
2013-02-28 04:37:38 +00:00
ret = FS - > ExportApploader ( WxStrToStr ( Path ) . c_str ( ) ) ;
2009-12-29 13:59:38 +00:00
}
else if ( event . GetId ( ) = = IDM_EXTRACTDOL )
{
2013-02-28 04:37:38 +00:00
ret = FS - > ExportDOL ( WxStrToStr ( Path ) . c_str ( ) ) ;
2009-12-29 13:59:38 +00:00
}
if ( ! ret )
2013-02-28 04:37:38 +00:00
PanicAlertT ( " Failed to extract to %s! " , WxStrToStr ( Path ) . c_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 ( ) ;
}
2013-10-29 05:34:26 +00:00
virtual ExitCode Entry ( ) override
2012-05-04 10:49:10 +00:00
{
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")
2013-03-13 11:04:53 +00:00
int PartitionNum = wxAtoi ( PartitionName . Mid ( PartitionName . find_first_of ( " 0123456789 " ) , 1 ) ) ;
2012-05-04 10:49:10 +00:00
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
}
2013-09-07 21:02:49 +00:00
void CISOProperties : : SetCheckboxValueFromGameini ( const char * section , const char * key , wxCheckBox * checkbox )
2008-12-08 05:30:24 +00:00
{
2013-09-07 21:02:49 +00:00
// Prefer local gameini value over default gameini value.
bool value ;
if ( GameIniLocal . Get ( section , key , & value ) )
checkbox - > Set3StateValue ( ( wxCheckBoxState ) value ) ;
else if ( GameIniDefault . Get ( section , key , & value ) )
checkbox - > Set3StateValue ( ( wxCheckBoxState ) value ) ;
2010-06-03 18:05:08 +00:00
else
2013-09-07 21:02:49 +00:00
checkbox - > Set3StateValue ( wxCHK_UNDETERMINED ) ;
}
2011-01-29 21:13:56 +00:00
2013-09-07 21:02:49 +00:00
void CISOProperties : : LoadGameConfig ( )
{
SetCheckboxValueFromGameini ( " Core " , " CPUThread " , CPUThread ) ;
SetCheckboxValueFromGameini ( " Core " , " SkipIdle " , SkipIdle ) ;
SetCheckboxValueFromGameini ( " Core " , " MMU " , MMU ) ;
SetCheckboxValueFromGameini ( " Core " , " TLBHack " , TLBHack ) ;
SetCheckboxValueFromGameini ( " Core " , " DCBZ " , DCBZOFF ) ;
SetCheckboxValueFromGameini ( " Core " , " VBeam " , VBeam ) ;
SetCheckboxValueFromGameini ( " Core " , " SyncGPU " , SyncGPU ) ;
SetCheckboxValueFromGameini ( " Core " , " FastDiscSpeed " , FastDiscSpeed ) ;
SetCheckboxValueFromGameini ( " Core " , " BlockMerging " , BlockMerging ) ;
SetCheckboxValueFromGameini ( " Core " , " DSPHLE " , DSPHLE ) ;
SetCheckboxValueFromGameini ( " Wii " , " Widescreen " , EnableWideScreen ) ;
SetCheckboxValueFromGameini ( " Video " , " UseBBox " , UseBBox ) ;
SetCheckboxValueFromGameini ( " Video " , " ZTPSpeedupHack " , UseZTPSpeedupHack ) ;
// First set values from default gameini, then apply values from local gameini
2013-09-18 10:27:50 +00:00
int iTemp ;
GameIniDefault . Get ( " Video " , " ProjectionHack " , & iTemp ) ;
PHackEnable - > SetValue ( iTemp ) ;
if ( GameIniLocal . Get ( " Video " , " ProjectionHack " , & iTemp ) )
PHackEnable - > SetValue ( iTemp ) ;
2013-09-07 21:02:49 +00:00
GameIniDefault . Get ( " Video " , " PH_SZNear " , & PHack_Data . PHackSZNear ) ;
2013-09-18 10:27:50 +00:00
if ( GameIniLocal . GetIfExists ( " Video " , " PH_SZNear " , & iTemp ) )
PHack_Data . PHackSZNear = iTemp ;
2013-09-07 21:02:49 +00:00
GameIniDefault . Get ( " Video " , " PH_SZFar " , & PHack_Data . PHackSZFar ) ;
2013-09-18 10:27:50 +00:00
if ( GameIniLocal . GetIfExists ( " Video " , " PH_SZFar " , & iTemp ) )
PHack_Data . PHackSZFar = iTemp ;
2013-09-07 21:02:49 +00:00
GameIniDefault . Get ( " Video " , " PH_ExtraParam " , & PHack_Data . PHackExP ) ;
2013-09-18 10:27:50 +00:00
if ( GameIniLocal . GetIfExists ( " Video " , " PH_ExtraParam " , & iTemp ) )
PHack_Data . PHackExP = iTemp ;
2013-09-07 21:02:49 +00:00
2013-09-17 14:44:47 +00:00
std : : string sTemp ;
2013-09-07 21:02:49 +00:00
GameIniDefault . Get ( " Video " , " PH_ZNear " , & PHack_Data . PHZNear ) ;
2013-09-18 10:27:50 +00:00
if ( GameIniLocal . GetIfExists ( " Video " , " PH_ZNear " , & sTemp ) )
2013-09-17 14:44:47 +00:00
PHack_Data . PHZNear = sTemp ;
2013-09-07 21:02:49 +00:00
GameIniDefault . Get ( " Video " , " PH_ZFar " , & PHack_Data . PHZFar ) ;
2013-09-18 10:27:50 +00:00
if ( GameIniLocal . GetIfExists ( " Video " , " PH_ZFar " , & sTemp ) )
2013-09-17 14:44:47 +00:00
PHack_Data . PHZFar = sTemp ;
2009-05-10 12:33:47 +00:00
2013-09-07 21:02:49 +00:00
GameIniDefault . Get ( " EmuState " , " EmulationStateId " , & iTemp , 0 /*Not Set*/ ) ;
2008-12-08 05:30:24 +00:00
EmuState - > SetSelection ( iTemp ) ;
2013-09-18 10:27:50 +00:00
if ( GameIniLocal . GetIfExists ( " EmuState " , " EmulationStateId " , & iTemp ) )
2013-09-07 21:02:49 +00:00
EmuState - > SetSelection ( iTemp ) ;
2008-12-08 05:30:24 +00:00
2013-09-07 21:02:49 +00:00
GameIniDefault . Get ( " EmuState " , " EmulationIssues " , & sTemp ) ;
2009-02-21 14:40:34 +00:00
if ( ! sTemp . empty ( ) )
2013-02-28 08:39:06 +00:00
EmuIssues - > SetValue ( StrToWxStr ( sTemp ) ) ;
2013-09-18 10:27:50 +00:00
if ( GameIniLocal . GetIfExists ( " EmuState " , " EmulationIssues " , & sTemp ) )
2013-09-07 21:02:49 +00:00
EmuIssues - > SetValue ( StrToWxStr ( sTemp ) ) ;
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 ( ) ;
2013-09-23 06:39:14 +00:00
m_geckocode_panel - > LoadCodes ( GameIniDefault , GameIniLocal , OpenISO - > GetUniqueID ( ) ) ;
2008-12-08 05:30:24 +00:00
}
2013-09-07 21:02:49 +00:00
void CISOProperties : : SaveGameIniValueFrom3StateCheckbox ( const char * section , const char * key , wxCheckBox * checkbox )
2008-12-08 05:30:24 +00:00
{
2013-09-07 21:02:49 +00:00
// Delete any existing entries from the local gameini if checkbox is undetermined.
// Otherwise, write the current value to the local gameini if the value differs from the default gameini values.
// Delete any existing entry from the local gameini if the value does not differ from the default gameini value.
bool checkbox_val = ( checkbox - > Get3StateValue ( ) = = wxCHK_CHECKED ) ;
if ( checkbox - > Get3StateValue ( ) = = wxCHK_UNDETERMINED )
GameIniLocal . DeleteKey ( section , key ) ;
else if ( ! GameIniDefault . Exists ( section , key ) )
GameIniLocal . Set ( section , key , checkbox_val ) ;
2010-09-14 13:50:25 +00:00
else
2013-09-07 21:02:49 +00:00
{
bool default_value ;
GameIniDefault . Get ( section , key , & default_value ) ;
if ( default_value ! = checkbox_val )
GameIniLocal . Set ( section , key , checkbox_val ) ;
else
GameIniLocal . DeleteKey ( section , key ) ;
}
}
2013-01-25 18:00:53 +00:00
2013-09-07 21:02:49 +00:00
bool CISOProperties : : SaveGameConfig ( )
{
SaveGameIniValueFrom3StateCheckbox ( " Core " , " CPUThread " , CPUThread ) ;
SaveGameIniValueFrom3StateCheckbox ( " Core " , " SkipIdle " , SkipIdle ) ;
SaveGameIniValueFrom3StateCheckbox ( " Core " , " MMU " , MMU ) ;
SaveGameIniValueFrom3StateCheckbox ( " Core " , " TLBHack " , TLBHack ) ;
SaveGameIniValueFrom3StateCheckbox ( " Core " , " DCBZ " , DCBZOFF ) ;
SaveGameIniValueFrom3StateCheckbox ( " Core " , " VBeam " , VBeam ) ;
SaveGameIniValueFrom3StateCheckbox ( " Core " , " SyncGPU " , SyncGPU ) ;
SaveGameIniValueFrom3StateCheckbox ( " Core " , " FastDiscSpeed " , FastDiscSpeed ) ;
SaveGameIniValueFrom3StateCheckbox ( " Core " , " BlockMerging " , BlockMerging ) ;
SaveGameIniValueFrom3StateCheckbox ( " Core " , " DSPHLE " , DSPHLE ) ;
SaveGameIniValueFrom3StateCheckbox ( " Wii " , " Widescreen " , EnableWideScreen ) ;
SaveGameIniValueFrom3StateCheckbox ( " Video " , " UseBBox " , UseBBox ) ;
SaveGameIniValueFrom3StateCheckbox ( " Video " , " ZTPSpeedupHack " , UseZTPSpeedupHack ) ;
# define SAVE_IF_NOT_DEFAULT(section, key, val, def) do { \
if ( GameIniDefault . Exists ( ( section ) , ( key ) ) ) { \
std : : remove_reference < decltype ( ( val ) ) > : : type tmp__ ; \
GameIniDefault . Get ( ( section ) , ( key ) , & tmp__ ) ; \
if ( ( val ) ! = tmp__ ) \
GameIniLocal . Set ( ( section ) , ( key ) , ( val ) ) ; \
else \
GameIniLocal . DeleteKey ( ( section ) , ( key ) ) ; \
} else if ( ( val ) ! = ( def ) ) \
GameIniLocal . Set ( ( section ) , ( key ) , ( val ) ) ; \
else \
GameIniLocal . DeleteKey ( ( section ) , ( key ) ) ; \
} while ( 0 )
2013-09-18 10:27:50 +00:00
SAVE_IF_NOT_DEFAULT ( " Video " , " ProjectionHack " , ( int ) PHackEnable - > GetValue ( ) , 0 ) ;
2013-09-07 21:02:49 +00:00
SAVE_IF_NOT_DEFAULT ( " Video " , " PH_SZNear " , ( PHack_Data . PHackSZNear ? 1 : 0 ) , 0 ) ;
SAVE_IF_NOT_DEFAULT ( " Video " , " PH_SZFar " , ( PHack_Data . PHackSZFar ? 1 : 0 ) , 0 ) ;
SAVE_IF_NOT_DEFAULT ( " Video " , " PH_ExtraParam " , ( PHack_Data . PHackExP ? 1 : 0 ) , 0 ) ;
SAVE_IF_NOT_DEFAULT ( " Video " , " PH_ZNear " , PHack_Data . PHZNear , " " ) ;
SAVE_IF_NOT_DEFAULT ( " Video " , " PH_ZFar " , PHack_Data . PHZFar , " " ) ;
SAVE_IF_NOT_DEFAULT ( " EmuState " , " EmulationStateId " , EmuState - > GetSelection ( ) , 0 ) ;
std : : string emu_issues = EmuIssues - > GetValue ( ) . ToStdString ( ) ;
SAVE_IF_NOT_DEFAULT ( " EmuState " , " EmulationIssues " , emu_issues , " " ) ;
2008-12-08 05:30:24 +00:00
PatchList_Save ( ) ;
ActionReplayList_Save ( ) ;
2013-09-07 21:02:49 +00:00
Gecko : : SaveCodes ( GameIniLocal , m_geckocode_panel - > GetCodes ( ) ) ;
bool success = GameIniLocal . Save ( GameIniFileLocal . c_str ( ) ) ;
2008-12-08 05:30:24 +00:00
2013-09-07 21:02:49 +00:00
// If the resulting file is empty, delete it. Kind of a hack, but meh.
2013-09-15 02:58:32 +00:00
if ( success & & File : : GetSize ( GameIniFileLocal ) = = 0 )
File : : Delete ( GameIniFileLocal ) ;
2013-09-07 21:02:49 +00:00
return success ;
2008-12-08 05:30:24 +00:00
}
2013-09-07 21:02:49 +00:00
void CISOProperties : : LaunchExternalEditor ( const std : : string & filename )
2008-12-08 05:30:24 +00:00
{
2011-01-30 14:20:20 +00:00
# ifdef __APPLE__
2013-09-07 21:02:49 +00:00
// wxTheMimeTypesManager is not yet implemented for wxCocoa
[ [ NSWorkspace sharedWorkspace ] openFile :
[ NSString stringWithUTF8String : filename . c_str ( ) ]
withApplication : @ " TextEdit " ] ;
2011-01-30 14:20:20 +00:00
# else
2013-09-07 21:02:49 +00:00
wxFileType * filetype = wxTheMimeTypesManager - > GetFileTypeFromExtension ( _T ( " ini " ) ) ;
if ( filetype = = NULL ) // From extension failed, trying with MIME type now
{
filetype = wxTheMimeTypesManager - > GetFileTypeFromMimeType ( _T ( " text/plain " ) ) ;
if ( filetype = = NULL ) // MIME type failed, aborting mission
2008-12-09 23:19:44 +00:00
{
2013-09-07 21:02:49 +00:00
PanicAlertT ( " Filetype 'ini' is unknown! Will not open! " ) ;
return ;
2008-12-09 23:19:44 +00:00
}
2013-09-07 21:02:49 +00:00
}
wxString OpenCommand ;
OpenCommand = filetype - > GetOpenCommand ( StrToWxStr ( filename ) ) ;
if ( OpenCommand . IsEmpty ( ) )
PanicAlertT ( " Couldn't find open command for extension 'ini'! " ) ;
else
if ( wxExecute ( OpenCommand , wxEXEC_SYNC ) = = - 1 )
PanicAlertT ( " wxExecute returned -1 on application run! " ) ;
2011-01-30 14:20:20 +00:00
# endif
2008-12-08 05:30:24 +00:00
2013-09-07 21:02:49 +00:00
bRefreshList = true ; // Just in case
2009-06-07 02:54:07 +00:00
2013-10-29 05:23:17 +00:00
// Once we're done with the ini edit, give the focus back to Dolphin
2009-06-07 02:54:07 +00:00
SetFocus ( ) ;
2008-12-08 05:30:24 +00:00
}
2013-09-07 21:02:49 +00:00
void CISOProperties : : OnEditConfig ( wxCommandEvent & WXUNUSED ( event ) )
{
SaveGameConfig ( ) ;
2013-09-15 00:27:54 +00:00
// Create blank file to prevent editor from prompting to create it.
if ( ! File : : Exists ( GameIniFileLocal ) )
{
2013-09-15 02:58:32 +00:00
std : : fstream blankFile ( GameIniFileLocal , std : : ios : : out ) ;
2013-09-15 00:27:54 +00:00
blankFile . close ( ) ;
}
2013-09-07 21:02:49 +00:00
LaunchExternalEditor ( GameIniFileLocal ) ;
GameIniLocal . Load ( GameIniFileLocal ) ;
LoadGameConfig ( ) ;
}
void CISOProperties : : OnShowDefaultConfig ( wxCommandEvent & WXUNUSED ( event ) )
{
LaunchExternalEditor ( GameIniFileDefault ) ;
}
2008-12-08 05:30:24 +00:00
void CISOProperties : : ListSelectionChanged ( wxCommandEvent & event )
{
switch ( event . GetId ( ) )
{
case ID_PATCHES_LIST :
2013-09-07 21:02:49 +00:00
if ( Patches - > GetSelection ( ) = = wxNOT_FOUND
| | DefaultPatches . find ( Patches - > GetString ( Patches - > GetSelection ( ) ) . ToStdString ( ) ) ! = DefaultPatches . end ( ) )
{
EditPatch - > Disable ( ) ;
RemovePatch - > Disable ( ) ;
}
else
2008-12-08 05:30:24 +00:00
{
EditPatch - > Enable ( ) ;
RemovePatch - > Enable ( ) ;
}
break ;
case ID_CHEATS_LIST :
2013-09-07 21:02:49 +00:00
if ( Cheats - > GetSelection ( ) = = wxNOT_FOUND
| | DefaultCheats . find ( Cheats - > GetString ( Cheats - > GetSelection ( ) ) . ToStdString ( ) ) ! = DefaultCheats . end ( ) )
{
EditCheat - > Disable ( ) ;
RemoveCheat - > Disable ( ) ;
}
else
2008-12-08 05:30:24 +00:00
{
EditCheat - > Enable ( ) ;
RemoveCheat - > Enable ( ) ;
}
break ;
}
}
void CISOProperties : : PatchList_Load ( )
{
onFrame . clear ( ) ;
Patches - > Clear ( ) ;
2013-09-07 21:02:49 +00:00
PatchEngine : : LoadPatchSection ( " OnFrame " , onFrame , GameIniDefault , GameIniLocal ) ;
2008-12-08 05:30:24 +00:00
u32 index = 0 ;
2013-10-29 05:09:01 +00:00
for ( PatchEngine : : Patch & p : onFrame )
2008-12-08 05:30:24 +00:00
{
2013-02-28 08:39:06 +00:00
Patches - > Append ( StrToWxStr ( p . name ) ) ;
2008-12-08 05:30:24 +00:00
Patches - > Check ( index , p . active ) ;
2013-09-07 21:02:49 +00:00
if ( ! p . user_defined )
DefaultPatches . insert ( p . name ) ;
2008-12-08 05:30:24 +00:00
+ + index ;
}
}
void CISOProperties : : PatchList_Save ( )
{
std : : vector < std : : string > lines ;
2013-09-07 21:02:49 +00:00
std : : vector < std : : string > enabledLines ;
2009-01-03 23:02:13 +00:00
u32 index = 0 ;
2013-10-29 05:09:01 +00:00
for ( PatchEngine : : Patch & p : onFrame )
2008-12-08 05:30:24 +00:00
{
2013-09-07 21:02:49 +00:00
if ( Patches - > IsChecked ( index ) )
2013-10-29 05:09:01 +00:00
enabledLines . push_back ( " $ " + p . name ) ;
2008-12-08 05:30:24 +00:00
2013-09-07 21:02:49 +00:00
// Do not save default patches.
2013-10-29 05:09:01 +00:00
if ( DefaultPatches . find ( p . name ) = = DefaultPatches . end ( ) )
2008-12-08 05:30:24 +00:00
{
2013-10-29 05:09:01 +00:00
lines . push_back ( " $ " + p . name ) ;
for ( auto iter2 = p . entries . begin ( ) ; iter2 ! = p . entries . end ( ) ; + + iter2 )
2013-09-07 21:02:49 +00:00
{
std : : string temp = StringFromFormat ( " 0x%08X:%s:0x%08X " , iter2 - > address , PatchEngine : : PatchTypeStrings [ iter2 - > type ] , iter2 - > value ) ;
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
}
2013-09-07 21:02:49 +00:00
GameIniLocal . SetLines ( " OnFrame_Enabled " , enabledLines ) ;
GameIniLocal . SetLines ( " OnFrame " , lines ) ;
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 ( ) ;
2013-10-29 05:23:17 +00:00
2008-12-08 05:30:24 +00:00
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 )
{
2013-02-28 04:37:38 +00:00
Patches - > Append ( StrToWxStr ( onFrame . back ( ) . name ) ) ;
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 ( ) ;
2013-09-07 21:02:49 +00:00
ActionReplay : : LoadCodes ( arCodes , GameIniDefault , GameIniLocal ) ;
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 ;
2013-02-28 04:37:38 +00:00
Cheats - > Append ( StrToWxStr ( arCode . name ) ) ;
2008-12-17 04:14:24 +00:00
Cheats - > Check ( index , arCode . active ) ;
2013-09-07 21:02:49 +00:00
if ( ! arCode . user_defined )
DefaultCheats . insert ( arCode . name ) ;
2008-12-17 04:14:24 +00:00
+ + index ;
2008-12-08 05:30:24 +00:00
}
}
void CISOProperties : : ActionReplayList_Save ( )
{
std : : vector < std : : string > lines ;
2013-09-07 21:02:49 +00:00
std : : vector < std : : string > enabledLines ;
2008-12-17 04:14:24 +00:00
u32 index = 0 ;
2013-10-29 05:09:01 +00:00
for ( auto code : arCodes )
2008-12-08 05:30:24 +00:00
{
2013-09-07 21:02:49 +00:00
if ( Cheats - > IsChecked ( index ) )
enabledLines . push_back ( " $ " + code . name ) ;
2008-12-08 05:30:24 +00:00
2013-09-07 21:02:49 +00:00
// Do not save default cheats.
if ( DefaultCheats . find ( code . name ) = = DefaultCheats . end ( ) )
2008-12-08 05:30:24 +00:00
{
2013-09-07 21:02:49 +00:00
lines . push_back ( " $ " + code . name ) ;
2013-10-29 05:09:01 +00:00
for ( auto & op : code . ops )
2013-09-07 21:02:49 +00:00
{
2013-10-29 05:09:01 +00:00
lines . push_back ( WxStrToStr ( wxString : : Format ( wxT ( " %08X %08X " ) , op . cmd_addr , op . value ) ) ) ;
2013-09-07 21:02:49 +00:00
}
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
}
2013-09-07 21:02:49 +00:00
GameIniLocal . SetLines ( " ActionReplay_Enabled " , enabledLines ) ;
GameIniLocal . 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 ( ) ;
2013-10-29 05:23:17 +00:00
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 )
{
2013-03-03 02:34:53 +00:00
Cheats - > Append ( StrToWxStr ( arCodes . back ( ) . name ) ) ;
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 )
{
2013-09-14 22:07:53 +00:00
wxString const shortName = StrToWxStr ( OpenGameListItem - > GetName ( lang ) ) ;
2013-03-04 00:29:56 +00:00
wxString const comment = StrToWxStr ( OpenGameListItem - > GetDescription ( lang ) ) ;
wxString const maker = StrToWxStr ( OpenGameListItem - > GetCompany ( ) ) ;
2013-03-03 01:46:55 +00:00
2013-04-19 13:21:45 +00:00
// Updates the information shown in the window
2011-12-19 06:01:46 +00:00
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
2013-02-28 04:37:38 +00:00
SetTitle ( StrToWxStr ( StringFromFormat ( " %s%s: %s - " , filename . c_str ( ) ,
2013-02-28 08:39:06 +00:00
extension . c_str ( ) , OpenGameListItem - > GetUniqueID ( ) . c_str ( ) ) ) + shortName ) ;
2009-02-14 17:32:03 +00:00
}