GUI updates: filesystemviewer is now ISOproperties, beginning of gameconfig (gameini) editing. Some misc cleanup here and there.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1126 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2008-11-11 18:39:09 +00:00
parent e2f687470b
commit e3f9886c72
17 changed files with 733 additions and 529 deletions

View File

@ -34,40 +34,28 @@
#include "Core.h"
#include "ARDecrypt.h"
namespace {
// These should be turned into locals in RunActionReplayCode, and passed as parameters to the others.
static u8 cmd;
static u32 addr;
static u32 data;
static u8 subtype;
static u8 w;
static u8 type;
static u8 zcode;
static bool doFillNSlide = false;
static bool doMemoryCopy = false;
static u32 addr_last;
static u32 val_last;
namespace
{
static std::vector<AREntry>::const_iterator iter;
static std::vector<ARCode> arCodes;
static ARCode code;
} // namespace
bool DoARSubtype_RamWriteAndFill();
bool DoARSubtype_WriteToPointer();
bool DoARSubtype_AddCode();
bool DoARSubtype_RamWriteAndFill(u8 w, u32 addr, u32 data);
bool DoARSubtype_WriteToPointer(u8 w, u32 addr, u32 data);
bool DoARSubtype_AddCode(u8 w, u32 addr, u32 data);
bool DoARSubtype_MasterCodeAndWriteToCCXXXXXX();
bool DoARSubtype_Other();
bool DoARZeroCode_FillAndSlide();
bool DoARZeroCode_MemoryCopy();
bool DoARSubtype_Other(u8 cmd, u32 addr, u32 data);
bool DoARZeroCode_FillAndSlide(u32 addr_last, u32 addr, u32 data, bool doFillNSlide);
bool DoARZeroCode_MemoryCopy(u32 val_last, u32 addr, u32 data);
// Parses the Action Replay section of a game ini file.
void LoadActionReplayCodes(IniFile &ini)
void LoadActionReplayCodes(IniFile &ini, bool bForGUI)
{
if (!Core::GetStartupParameter().bEnableCheats)
return; // If cheats are off, do not load them
if (!Core::GetStartupParameter().bEnableCheats && !bForGUI)
return; // If cheats are off, do not load them; but load anyway if it's for GameConfig GUI
std::vector<std::string> lines;
std::vector<std::string> encryptedLines;
@ -164,7 +152,20 @@ void ActionReplayRunAllActive()
// but the problem is not generally solvable.
// TODO: what is "nowIsBootup" for?
bool RunActionReplayCode(const ARCode &arcode) {
u8 cmd;
u32 addr;
u32 data;
u8 subtype;
u8 w;
u8 type;
u8 zcode;
bool doFillNSlide = false;
bool doMemoryCopy = false;
u32 addr_last;
u32 val_last;
code = arcode;
for (iter = code.ops.begin(); iter != code.ops.end(); ++iter)
{
cmd = iter->cmd_addr >> 24; // AR command
@ -177,14 +178,14 @@ bool RunActionReplayCode(const ARCode &arcode) {
// Do Fill & Slide
if (doFillNSlide) {
if (!DoARZeroCode_FillAndSlide())
if (!DoARZeroCode_FillAndSlide(addr_last, addr, data, doFillNSlide))
return false;
continue;
}
// Memory Copy
if (doMemoryCopy) {
if (!DoARZeroCode_MemoryCopy())
if (!DoARZeroCode_MemoryCopy(val_last, addr, data))
return false;
continue;
}
@ -233,15 +234,15 @@ bool RunActionReplayCode(const ARCode &arcode) {
switch (subtype)
{
case 0x0: // Ram write (and fill)
if (!DoARSubtype_RamWriteAndFill())
if (!DoARSubtype_RamWriteAndFill(w, addr, data))
return false;
continue;
case 0x1: // Write to pointer
if (!DoARSubtype_WriteToPointer())
if (!DoARSubtype_WriteToPointer(w, addr, data))
return false;
continue;
case 0x2: // Add code
if (!DoARSubtype_AddCode())
if (!DoARSubtype_AddCode(w, addr, data))
return false;
continue;
case 0x3: // Master Code & Write to CCXXXXXX
@ -249,7 +250,7 @@ bool RunActionReplayCode(const ARCode &arcode) {
return false;
continue;
default: // non-specific z codes (hacks)
if (!DoARSubtype_Other())
if (!DoARSubtype_Other(cmd, addr, data))
return false;
continue;
}
@ -257,7 +258,7 @@ bool RunActionReplayCode(const ARCode &arcode) {
return true;
}
bool DoARSubtype_RamWriteAndFill()
bool DoARSubtype_RamWriteAndFill(u8 w, u32 addr, u32 data)
{
if (w < 0x8) // Check the value W in 0xZWXXXXXXX
{
@ -277,9 +278,8 @@ bool DoARSubtype_RamWriteAndFill()
case 0x01: // Short write
{
u16 repeat = data >> 16;
for (int i = 0; i <= repeat; i++) {
for (int i = 0; i <= repeat; i++)
Memory::Write_U16(data & 0xFFFF, new_addr + i * 2);
}
break;
}
@ -295,8 +295,7 @@ bool DoARSubtype_RamWriteAndFill()
return false;
}
bool DoARSubtype_WriteToPointer()
bool DoARSubtype_WriteToPointer(u8 w, u32 addr, u32 data)
{
if (w < 0x8)
{
@ -335,7 +334,7 @@ bool DoARSubtype_WriteToPointer()
return false;
}
bool DoARSubtype_AddCode()
bool DoARSubtype_AddCode(u8 w, u32 addr, u32 data)
{
if (w < 0x8)
{
@ -378,7 +377,7 @@ bool DoARSubtype_MasterCodeAndWriteToCCXXXXXX()
}
// TODO(Omega): I think this needs cleanup, there might be a better way to code this part
bool DoARSubtype_Other()
bool DoARSubtype_Other(u8 cmd, u32 addr, u32 data)
{
switch (cmd & 0xFE)
{
@ -446,7 +445,8 @@ bool DoARSubtype_Other()
}
return true;
}
bool DoARZeroCode_FillAndSlide() // This needs more testing
bool DoARZeroCode_FillAndSlide(u32 addr_last, u32 addr, u32 data, bool doFillNSlide) // This needs more testing
{
u32 new_addr = (addr_last & 0x81FFFFFF);
u8 size = ((new_addr >> 25) & 0x03);
@ -512,25 +512,29 @@ bool DoARZeroCode_FillAndSlide() // This needs more testing
doFillNSlide = false;
return true;
}
bool DoARZeroCode_MemoryCopy() // Has not been tested
bool DoARZeroCode_MemoryCopy(u32 val_last, u32 addr, u32 data) // Has not been tested
{
u32 addr_dest = (val_last | 0x06000000);
u32 addr_src = ((addr & 0x7FFFFF) | 0x80000000);
u8 num_bytes = (data & 0x7FFF);
if ((data & ~0x7FFF) == 0x0000) {
if((data >> 24) != 0x0) { // Memory Copy With Pointers Support
for(int i = 0; i < 138; i++) {
if ((data & ~0x7FFF) == 0x0000)
{
if((data >> 24) != 0x0)
{ // Memory Copy With Pointers Support
for(int i = 0; i < 138; i++)
Memory::Write_U8(Memory::Read_U8(addr_src + i), addr_dest + i);
}
}
else { // Memory Copy Without Pointer Support
for(int i=0; i < num_bytes; i++) {
else
{ // Memory Copy Without Pointer Support
for (int i=0; i < num_bytes; i++)
Memory::Write_U32(Memory::Read_U32(addr_src + i), addr_dest + i);
} return true;
return true;
}
}
else {
else
{
PanicAlert("Action Replay Error: Invalid value (&08x) in Memory Copy (%s)", (data & ~0x7FFF), code.name.c_str());
return false;
}

View File

@ -32,6 +32,6 @@ struct ARCode {
void ActionReplayRunAllActive();
bool RunActionReplayCode(const ARCode &arcode);
void LoadActionReplayCodes(IniFile &ini);
void LoadActionReplayCodes(IniFile &ini, bool bForGUI);
#endif //_ACTIONREPLAY_H_

View File

@ -78,7 +78,7 @@ void PatchEngine_LoadPatches(const char *gameID)
if (ini.Load(filename.c_str())) {
LoadPatchSection("OnLoad", onLoad, ini);
LoadPatchSection("OnFrame", onFrame, ini);
LoadActionReplayCodes(ini);
LoadActionReplayCodes(ini, false);
}
}

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Version="9.00"
Name="DolphinWX"
ProjectGUID="{A72606EF-C5C1-4954-90AD-F0F93A8D97D9}"
RootNamespace="DolphinWX"
@ -758,14 +758,6 @@
RelativePath=".\src\ConfigMain.h"
>
</File>
<File
RelativePath=".\Src\FilesystemViewer.cpp"
>
</File>
<File
RelativePath=".\Src\FilesystemViewer.h"
>
</File>
<File
RelativePath=".\src\Frame.cpp"
>
@ -822,6 +814,14 @@
RelativePath=".\src\Globals.h"
>
</File>
<File
RelativePath=".\Src\ISOProperties.cpp"
>
</File>
<File
RelativePath=".\Src\ISOProperties.h"
>
</File>
<File
RelativePath=".\src\MemcardManager.cpp"
>

View File

@ -238,12 +238,12 @@ void CConfigMain::CreateGUIControls()
sPaths = new wxBoxSizer(wxVERTICAL);
sbISOPaths->Add(ISOPaths, 1, wxEXPAND|wxALL, 5);
sbISOPaths->Add(ISOPaths, 1, wxEXPAND|wxALL, 0);
sISOButtons = new wxBoxSizer(wxHORIZONTAL);
sISOButtons->AddStretchSpacer(1);
sISOButtons->Add(AddISOPath, 0, wxALL, 5);
sISOButtons->Add(RemoveISOPath, 0, wxALL, 5);
sISOButtons->Add(AddISOPath, 0, wxALL, 0);
sISOButtons->Add(RemoveISOPath, 0, wxALL, 0);
sbISOPaths->Add(sISOButtons, 0, wxEXPAND|wxALL, 5);
sPaths->Add(sbISOPaths, 1, wxEXPAND|wxALL, 5);

View File

@ -1,327 +0,0 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// 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/
#include "Globals.h"
#include "ISOFile.h"
#include "VolumeCreator.h"
#include "Filesystem.h"
#include "FilesystemViewer.h"
BEGIN_EVENT_TABLE(CFilesystemViewer, wxDialog)
EVT_CLOSE(CFilesystemViewer::OnClose)
EVT_TREE_ITEM_RIGHT_CLICK(ID_TREECTRL,CFilesystemViewer::OnRightClickOnTree)
EVT_BUTTON(ID_CLOSE,CFilesystemViewer::OnCloseClick)
EVT_MENU(IDM_BNRSAVEAS, CFilesystemViewer::OnBannerImageSave)
EVT_MENU(IDM_EXTRACTFILE, CFilesystemViewer::OnExtractFile)
END_EVENT_TABLE()
DiscIO::IVolume *OpenISO = NULL;
DiscIO::IFileSystem *pFileSystem = NULL;
CFilesystemViewer::CFilesystemViewer(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)
{
std::vector<const DiscIO::SFileInfo *> Our_Files;
OpenISO = DiscIO::CreateVolumeFromFilename(fileName);
pFileSystem = DiscIO::CreateFileSystem(OpenISO);
pFileSystem->GetFileList(Our_Files);
GameListItem OpenISO_(fileName);
CreateGUIControls();
fileIter beginning = Our_Files.begin(), end = Our_Files.end(),
pos = Our_Files.begin();
CreateDirectoryTree(RootId, beginning, end, pos, (char *)"\\");
m_Treectrl->Expand(RootId);
// Disk header and apploader
m_Name->SetValue(wxString(OpenISO->GetName().c_str(), wxConvUTF8));
m_GameID->SetValue(wxString(OpenISO->GetUniqueID().c_str(), wxConvUTF8));
switch (OpenISO->GetCountry())
{
case DiscIO::IVolume::COUNTRY_EUROPE:
case DiscIO::IVolume::COUNTRY_FRANCE:
m_Country->SetValue(wxString::FromAscii("EUR"));
break;
case DiscIO::IVolume::COUNTRY_USA:
m_Country->SetValue(wxString::FromAscii("USA"));
break;
case DiscIO::IVolume::COUNTRY_JAP:
m_Country->SetValue(wxString::FromAscii("JAP"));
break;
default:
m_Country->SetValue(wxString::FromAscii("UNKNOWN"));
break;
}
wxString temp;
temp = _T("0x") + wxString::FromAscii(OpenISO->GetMakerID().c_str());
m_MakerID->SetValue(temp);
m_Date->SetValue(wxString(OpenISO->GetApploaderDate().c_str(), wxConvUTF8));
m_FST->SetValue(wxString::Format(_T("%u"), OpenISO->GetFSTSize()));
// Banner
// ...all the BannerLoader functions are bool...gross
//m_Version;
//if (OpenISO_.GetBNRVersion() == "BNR1")
m_Lang->Enable(false);
m_ShortName->SetValue(wxString(OpenISO_.GetName().c_str(), wxConvUTF8));
//m_LongName->SetValue(wxString(OpenISO_.GetLongName().c_str(), wxConvUTF8));
m_Maker->SetValue(wxString(OpenISO_.GetCompany().c_str(), wxConvUTF8));//dev too
m_Comment->SetValue(wxString(OpenISO_.GetDescription().c_str(), wxConvUTF8));
m_Banner->SetBitmap(OpenISO_.GetImage());
m_Banner->Connect(wxID_ANY, wxEVT_RIGHT_DOWN,
wxMouseEventHandler(CFilesystemViewer::RightClickOnBanner), (wxObject*)NULL, this);
Fit();
}
CFilesystemViewer::~CFilesystemViewer()
{
delete pFileSystem;
delete OpenISO;
}
void CFilesystemViewer::CreateDirectoryTree(wxTreeItemId& parent,
fileIter& begin,
fileIter& end,
fileIter& iterPos,
char *directory)
{
bool bRoot = true;
if(iterPos == begin)
++iterPos;
else
bRoot = false;
char *name = (char *)((*iterPos)->m_FullPath);
if(iterPos == end)
return;
do
{
if((*iterPos)->IsDirectory()) {
char *dirName;
name[strlen(name) - 1] = '\0';
dirName = strrchr(name, '\\');
if(!dirName)
dirName = name;
else
dirName++;
wxTreeItemId item = m_Treectrl->AppendItem(parent, wxString::FromAscii(dirName));
CreateDirectoryTree(item, begin, end, ++iterPos, name);
} else {
char *fileName = strrchr(name, '\\');
if(!fileName)
fileName = name;
else
fileName++;
m_Treectrl->AppendItem(parent, wxString::FromAscii(fileName));
++iterPos;
}
if(iterPos == end)
break;
name = (char *)((*iterPos)->m_FullPath);
} while(bRoot || strstr(name, directory));
}
void CFilesystemViewer::CreateGUIControls()
{
m_Close = new wxButton(this, ID_CLOSE, wxT("Close"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
// ISO Details
sbISODetails = new wxStaticBoxSizer(wxVERTICAL, this, wxT("ISO Details"));
sISODetails = new wxGridBagSizer(0, 0);
sISODetails->AddGrowableCol(1);
m_NameText = new wxStaticText(this, ID_NAME_TEXT, wxT("Name:"), wxDefaultPosition, wxDefaultSize);
m_Name = new wxTextCtrl(this, ID_NAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
m_GameIDText = new wxStaticText(this, ID_GAMEID_TEXT, wxT("Game ID:"), wxDefaultPosition, wxDefaultSize);
m_GameID = new wxTextCtrl(this, ID_GAMEID, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
m_CountryText = new wxStaticText(this, ID_COUNTRY_TEXT, wxT("Country:"), wxDefaultPosition, wxDefaultSize);
m_Country = new wxTextCtrl(this, ID_COUNTRY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
m_MakerIDText = new wxStaticText(this, ID_MAKERID_TEXT, wxT("Maker ID:"), wxDefaultPosition, wxDefaultSize);
m_MakerID = new wxTextCtrl(this, ID_MAKERID, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
m_DateText = new wxStaticText(this, ID_DATE_TEXT, wxT("Date:"), wxDefaultPosition, wxDefaultSize);
m_Date = new wxTextCtrl(this, ID_DATE, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
m_FSTText = new wxStaticText(this, ID_FST_TEXT, wxT("FST Size:"), wxDefaultPosition, wxDefaultSize);
m_FST = new wxTextCtrl(this, ID_FST, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
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);
sbISODetails->Add(sISODetails, 0, wxEXPAND, 5);
// Banner Details
sbBannerDetails = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Banner Details"));
sBannerDetails = new wxGridBagSizer(0, 0);
m_VersionText = new wxStaticText(this, ID_VERSION_TEXT, wxT("Version:"), wxDefaultPosition, wxDefaultSize);
m_Version = new wxTextCtrl(this, ID_VERSION, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
m_LangText = new wxStaticText(this, ID_LANG_TEXT, wxT("Show Language:"), wxDefaultPosition, wxDefaultSize);
arrayStringFor_Lang.Add(wxT("English"));
arrayStringFor_Lang.Add(wxT("German"));
arrayStringFor_Lang.Add(wxT("French"));
arrayStringFor_Lang.Add(wxT("Spanish"));
arrayStringFor_Lang.Add(wxT("Italian"));
arrayStringFor_Lang.Add(wxT("Dutch"));
m_Lang = new wxChoice(this, ID_LANG, wxDefaultPosition, wxDefaultSize, arrayStringFor_Lang, 0, wxDefaultValidator);
m_Lang->SetSelection(0);
m_ShortText = new wxStaticText(this, ID_SHORTNAME_TEXT, wxT("Short Name:"), wxDefaultPosition, wxDefaultSize);
m_ShortName = new wxTextCtrl(this, ID_SHORTNAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
m_LongText = new wxStaticText(this, ID_LONGNAME_TEXT, wxT("Long Name:"), wxDefaultPosition, wxDefaultSize);
m_LongName = new wxTextCtrl(this, ID_LONGNAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
m_MakerText = new wxStaticText(this, ID_MAKER_TEXT, wxT("Maker:"), wxDefaultPosition, wxDefaultSize);
m_Maker = new wxTextCtrl(this, ID_MAKER, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
m_CommentText = new wxStaticText(this, ID_COMMENT_TEXT, wxT("Comment:"), wxDefaultPosition, wxDefaultSize);
m_Comment = new wxTextCtrl(this, ID_COMMENT, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY);
m_BannerText = new wxStaticText(this, ID_BANNER_TEXT, wxT("Banner:"), wxDefaultPosition, wxDefaultSize);
m_Banner = new wxStaticBitmap(this, ID_BANNER, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0);
sBannerDetails->Add(m_VersionText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
sBannerDetails->Add(m_Version, wxGBPosition(0, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
sBannerDetails->Add(m_LangText, wxGBPosition(0, 2), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
sBannerDetails->Add(m_Lang, wxGBPosition(0, 3), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
sBannerDetails->Add(m_ShortText, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
sBannerDetails->Add(m_ShortName, wxGBPosition(1, 1), wxGBSpan(1, 3), wxEXPAND|wxALL, 5);
sBannerDetails->Add(m_LongText, wxGBPosition(2, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
sBannerDetails->Add(m_LongName, wxGBPosition(2, 1), wxGBSpan(1, 3), wxEXPAND|wxALL, 5);
sBannerDetails->Add(m_MakerText, wxGBPosition(3, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
sBannerDetails->Add(m_Maker, wxGBPosition(3, 1), wxGBSpan(1, 3), wxEXPAND|wxALL, 5);
sBannerDetails->Add(m_CommentText, wxGBPosition(4, 0), wxGBSpan(1, 1), wxALL, 5);
sBannerDetails->Add(m_Comment, wxGBPosition(4, 1), wxGBSpan(1, 3), wxEXPAND|wxALL, 5);
sBannerDetails->Add(m_BannerText, wxGBPosition(5, 0), wxGBSpan(1, 1), wxALL, 5);
sBannerDetails->Add(m_Banner, wxGBPosition(5, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
sbBannerDetails->Add(sBannerDetails, 0, wxEXPAND, 0);
// Filesystem tree
sbTreectrl = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Filesytem"));
m_Treectrl = new wxTreeCtrl(this, ID_TREECTRL, wxDefaultPosition, wxSize(350, -1), wxTR_DEFAULT_STYLE, wxDefaultValidator);
sbTreectrl->Add(m_Treectrl, 1, wxEXPAND);
RootId = m_Treectrl->AddRoot(wxT("Root"), -1, -1, 0);
wxGridBagSizer* sMain;
sMain = new wxGridBagSizer(0, 0);
sMain->Add(sbISODetails, wxGBPosition(0, 0), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
sMain->Add(sbBannerDetails, wxGBPosition(1, 0), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
sMain->Add(sbTreectrl, wxGBPosition(0, 1), wxGBSpan(2, 1), wxEXPAND|wxALL, 5);
sMain->Add(m_Close, wxGBPosition(2, 1), wxGBSpan(1, 1), wxALL|wxALIGN_RIGHT, 5);
this->SetSizer(sMain);
this->Layout();
}
void CFilesystemViewer::OnClose(wxCloseEvent& WXUNUSED (event))
{
Destroy();
}
void CFilesystemViewer::OnCloseClick(wxCommandEvent& WXUNUSED (event))
{
Close();
}
void CFilesystemViewer::RightClickOnBanner(wxMouseEvent& event)
{
wxMenu popupMenu;
popupMenu.Append(IDM_BNRSAVEAS, _("Save as..."));
PopupMenu(&popupMenu);
event.Skip();
}
void CFilesystemViewer::OnBannerImageSave(wxCommandEvent& event)
{
wxString dirHome;
wxFileDialog dialog(this, _("Save as..."), wxGetHomeDir(&dirHome), wxString::Format(_("%s.png"), m_GameID->GetLabel()),
_("*.*"), wxFD_SAVE|wxFD_OVERWRITE_PROMPT, wxDefaultPosition, wxDefaultSize);
if (dialog.ShowModal() == wxID_OK)
{
m_Banner->GetBitmap().ConvertToImage().SaveFile(dialog.GetPath());
}
}
void CFilesystemViewer::OnRightClickOnTree(wxTreeEvent& event)
{
m_Treectrl->SelectItem(event.GetItem());
wxMenu popupMenu;
if (m_Treectrl->ItemHasChildren(m_Treectrl->GetSelection()))
;//popupMenu.Append(IDM_EXTRACTFILE, wxString::FromAscii("Extract Directory..."));
else
popupMenu.Append(IDM_EXTRACTFILE, wxString::FromAscii("Extract File..."));
PopupMenu(&popupMenu);
event.Skip();
}
void CFilesystemViewer::OnExtractFile(wxCommandEvent& WXUNUSED (event))
{
wxString Path;
wxString File;
File = m_Treectrl->GetItemText(m_Treectrl->GetSelection());
Path = wxFileSelector(
_T("Export File"),
wxEmptyString, File, wxEmptyString,
wxString::Format
(
_T("All files (%s)|%s"),
wxFileSelectorDefaultWildcardStr,
wxFileSelectorDefaultWildcardStr
),
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()));
File = temp + _T("\\") + File;
m_Treectrl->SelectItem(m_Treectrl->GetItemParent(m_Treectrl->GetSelection()));
}
pFileSystem->ExportFile(File.mb_str(), Path.mb_str());
}

View File

@ -28,7 +28,7 @@
#include "Config.h"
#include "GameListCtrl.h"
#include "Blob.h"
#include "FilesystemViewer.h"
#include "ISOProperties.h"
#include "IniFile.h"
#if USE_XPM_BITMAPS
@ -64,10 +64,9 @@ EVT_RIGHT_DOWN(CGameListCtrl::OnRightClick)
EVT_LIST_COL_BEGIN_DRAG(LIST_CTRL, CGameListCtrl::OnColBeginDrag)
EVT_LIST_ITEM_ACTIVATED(LIST_CTRL, CGameListCtrl::OnActivated)
EVT_LIST_COL_CLICK(LIST_CTRL, CGameListCtrl::OnColumnClick)
EVT_MENU(IDM_EDITPATCHFILE, CGameListCtrl::OnEditPatchFile)
EVT_MENU(IDM_PROPERTIES, CGameListCtrl::OnProperties)
EVT_MENU(IDM_OPENCONTAININGFOLDER, CGameListCtrl::OnOpenContainingFolder)
EVT_MENU(IDM_SETDEFAULTGCM, CGameListCtrl::OnSetDefaultGCM)
EVT_MENU(IDM_FILESYSTEMVIEWER, CGameListCtrl::OnFilesystemViewer)
EVT_MENU(IDM_COMPRESSGCM, CGameListCtrl::OnCompressGCM)
EVT_MENU(IDM_MULTICOMPRESSGCM, CGameListCtrl::OnMultiCompressGCM)
EVT_MENU(IDM_MULTIDECOMPRESSGCM, CGameListCtrl::OnMultiDecompressGCM)
@ -483,23 +482,21 @@ void CGameListCtrl::OnRightClick(wxMouseEvent& event)
const GameListItem *selected_iso = GetSelectedISO();
if (selected_iso)
{
std::string unique_id = selected_iso->GetUniqueID();
wxMenu popupMenu;
std::string menu_text = StringFromFormat("Edit &patch file: %s.ini", unique_id.c_str());
popupMenu.Append(IDM_EDITPATCHFILE, wxString::FromAscii(menu_text.c_str())); //Pretty much everything in wxwidgets is a wxString, try to convert to those first!
popupMenu.Append(IDM_OPENCONTAININGFOLDER, wxString::FromAscii("Open &containing folder"));
popupMenu.Append(IDM_FILESYSTEMVIEWER, wxString::FromAscii("Open in ISO viewer/dumper"));
popupMenu.AppendCheckItem(IDM_SETDEFAULTGCM, wxString::FromAscii("Set as &default ISO"));
popupMenu.Append(IDM_PROPERTIES, _("&Properties"));
popupMenu.AppendSeparator();
popupMenu.Append(IDM_OPENCONTAININGFOLDER, _("Open &containing folder"));
popupMenu.AppendCheckItem(IDM_SETDEFAULTGCM, _("Set as &default ISO"));
if(selected_iso->GetFileName() == SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM)
popupMenu.FindItemByPosition(3)->Check();
popupMenu.AppendSeparator();
popupMenu.Append(IDM_DELETEGCM, wxString::FromAscii("&Delete ISO..."));
popupMenu.Append(IDM_DELETEGCM, _("&Delete ISO..."));
if (selected_iso->IsCompressed())
popupMenu.Append(IDM_COMPRESSGCM, wxString::FromAscii("Decompress ISO... (UNTESTED)"));
popupMenu.Append(IDM_COMPRESSGCM, _("Decompress ISO... (UNTESTED)"));
else
popupMenu.Append(IDM_COMPRESSGCM, wxString::FromAscii("Compress ISO... (UNTESTED)"));
popupMenu.Append(IDM_COMPRESSGCM, _("Compress ISO... (UNTESTED)"));
PopupMenu(&popupMenu);
}
@ -507,10 +504,10 @@ void CGameListCtrl::OnRightClick(wxMouseEvent& event)
else if (GetSelectedItemCount() > 1)
{
wxMenu popupMenu;
popupMenu.Append(IDM_DELETEGCM, wxString::FromAscii("&Delete selected ISOs..."));
popupMenu.Append(IDM_DELETEGCM, _("&Delete selected ISOs..."));
popupMenu.AppendSeparator();
popupMenu.Append(IDM_MULTICOMPRESSGCM, wxString::FromAscii("Compress selected ISOs..."));
popupMenu.Append(IDM_MULTIDECOMPRESSGCM, wxString::FromAscii("Decompress selected ISOs..."));
popupMenu.Append(IDM_MULTICOMPRESSGCM, _("Compress selected ISOs..."));
popupMenu.Append(IDM_MULTIDECOMPRESSGCM, _("Decompress selected ISOs..."));
PopupMenu(&popupMenu);
}
}
@ -572,7 +569,7 @@ void CGameListCtrl::OnDeleteGCM(wxCommandEvent& WXUNUSED (event))
const GameListItem *iso = GetSelectedISO();
if (!iso)
return;
if (wxMessageBox(_T("Are you sure you want to delete this file?\nIt will be gone forever!"),
if (wxMessageBox(_("Are you sure you want to delete this file?\nIt will be gone forever!"),
wxMessageBoxCaptionStr, wxYES_NO|wxICON_EXCLAMATION) == wxYES)
{
File::Delete(iso->GetFileName().c_str());
@ -581,7 +578,7 @@ void CGameListCtrl::OnDeleteGCM(wxCommandEvent& WXUNUSED (event))
}
else
{
if (wxMessageBox(_T("Are you sure you want to delete these files?\nThey will be gone forever!"),
if (wxMessageBox(_("Are you sure you want to delete these files?\nThey will be gone forever!"),
wxMessageBoxCaptionStr, wxYES_NO|wxICON_EXCLAMATION) == wxYES)
{
int selected = GetSelectedItemCount();
@ -596,13 +593,15 @@ void CGameListCtrl::OnDeleteGCM(wxCommandEvent& WXUNUSED (event))
}
}
void CGameListCtrl::OnFilesystemViewer(wxCommandEvent& WXUNUSED (event))
void CGameListCtrl::OnProperties(wxCommandEvent& WXUNUSED (event))
{
const GameListItem *iso = GetSelectedISO();
if (!iso)
return;
CFilesystemViewer FSViewer(iso->GetFileName(), this);
FSViewer.ShowModal();
CISOProperties ISOProperties(iso->GetFileName(), this);
ISOProperties.ShowModal();
if (ISOProperties.bRefreshList)
Update();
}
void CGameListCtrl::MultiCompressCB(const char* text, float percent, void* arg)
@ -762,33 +761,6 @@ void CGameListCtrl::OnCompressGCM(wxCommandEvent& WXUNUSED (event))
Update();
}
void CGameListCtrl::OnEditPatchFile(wxCommandEvent& WXUNUSED (event))
{
const GameListItem *iso = GetSelectedISO();
if (!iso)
return;
std::string filename = "GameIni/" + iso->GetUniqueID() + ".ini";
if (!File::Exists(filename.c_str()))
{
if (AskYesNo("%s.ini does not exist. Do you want to create it?", iso->GetUniqueID().c_str()))
{
FILE *f = fopen(filename.c_str(), "w");
fprintf(f, "# %s - %s\r\n\r\n", iso->GetUniqueID().c_str(), iso->GetName().c_str());
fprintf(f, "[EmuState]\n#The Emulation State.\n");
fprintf(f, "EmulationStateId = 0\n");
fprintf(f, "[OnFrame]\r\n#Add memory patches here.\r\n\r\n");
fprintf(f, "[ActionReplay]\r\n#Add decrypted action replay cheats here.\r\n");
fclose(f);
}
else
{
return;
}
}
File::Launch(filename.c_str());
}
void CGameListCtrl::OnSize(wxSizeEvent& event)
{
AutomaticColumnWidth();

View File

@ -69,14 +69,13 @@ private:
void OnColBeginDrag(wxListEvent& event);
void OnActivated(wxListEvent& event);
void OnSize(wxSizeEvent& event);
void OnEditPatchFile(wxCommandEvent& event);
void OnProperties(wxCommandEvent& event);
void OnOpenContainingFolder(wxCommandEvent& event);
void OnSetDefaultGCM(wxCommandEvent& event);
void OnDeleteGCM(wxCommandEvent& event);
void OnCompressGCM(wxCommandEvent& event);
void OnMultiCompressGCM(wxCommandEvent& event);
void OnMultiDecompressGCM(wxCommandEvent& event);
void OnFilesystemViewer(wxCommandEvent& event);
#ifdef _WIN32
virtual bool MSWDrawSubItem(wxPaintDC& rPaintDC, int item, int subitem);

View File

@ -46,11 +46,10 @@ enum
IDM_STOP,
IDM_BROWSE,
IDM_MEMCARD,
IDM_EDITPATCHFILE,
IDM_PROPERTIES,
IDM_OPENCONTAININGFOLDER,
IDM_SETDEFAULTGCM,
IDM_DELETEGCM,
IDM_FILESYSTEMVIEWER,
IDM_COMPRESSGCM,
IDM_MULTICOMPRESSGCM,
IDM_MULTIDECOMPRESSGCM,

View File

@ -0,0 +1,506 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// 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/
#include "Globals.h"
#include "FileUtil.h"
#include "ISOFile.h"
#include "VolumeCreator.h"
#include "Filesystem.h"
#include "ISOProperties.h"
BEGIN_EVENT_TABLE(CISOProperties, wxDialog)
EVT_CLOSE(CISOProperties::OnClose)
EVT_BUTTON(ID_CLOSE, CISOProperties::OnCloseClick)
EVT_CHOICE(ID_EMUSTATE, CISOProperties::SetRefresh)
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)
END_EVENT_TABLE()
DiscIO::IVolume *OpenISO = NULL;
DiscIO::IFileSystem *pFileSystem = NULL;
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)
{
OpenISO = DiscIO::CreateVolumeFromFilename(fileName);
pFileSystem = DiscIO::CreateFileSystem(OpenISO);
pFileSystem->GetFileList(Our_Files);
GameListItem OpenISO_(fileName);
bRefreshList = false;
CreateGUIControls();
GameIniFile = "GameIni/" + (OpenISO->GetUniqueID()) + ".ini";
if (GameIni.Load(GameIniFile.c_str()))
LoadGameConfig();
else
{
FILE *f = fopen(GameIniFile.c_str(), "w");
fprintf(f, "# %s - %s\n", OpenISO->GetUniqueID().c_str(), OpenISO->GetName().c_str());
fprintf(f, "[Core]\n#Values set here will override the main dolphin settings.\n");
fprintf(f, "[EmuState]\n#The Emulation State. 1 is worst, 5 is best, 0 is not set.\n");
fprintf(f, "EmulationStateId = 0\n");
fprintf(f, "[OnLoad]\n#Add memory patches to be loaded once on boot here.\n");
fprintf(f, "[OnFrame]\n#Add memory patches to be applied every frame here.\n");
fprintf(f, "[ActionReplay]\n#Add action replay cheats here.\n");
fclose(f);
if (GameIni.Load(GameIniFile.c_str()))
LoadGameConfig();
else
wxMessageBox(wxString::Format("Could not create %s", GameIniFile.c_str()), _("Error"), wxOK|wxICON_ERROR, this);
}
// Disk header and apploader
m_Name->SetValue(wxString(OpenISO->GetName().c_str(), wxConvUTF8));
m_GameID->SetValue(wxString(OpenISO->GetUniqueID().c_str(), wxConvUTF8));
switch (OpenISO->GetCountry())
{
case DiscIO::IVolume::COUNTRY_EUROPE:
case DiscIO::IVolume::COUNTRY_FRANCE:
m_Country->SetValue(wxString::FromAscii("EUR"));
break;
case DiscIO::IVolume::COUNTRY_USA:
m_Country->SetValue(wxString::FromAscii("USA"));
break;
case DiscIO::IVolume::COUNTRY_JAP:
m_Country->SetValue(wxString::FromAscii("JAP"));
break;
default:
m_Country->SetValue(wxString::FromAscii("UNKNOWN"));
break;
}
wxString temp;
temp = _T("0x") + wxString::FromAscii(OpenISO->GetMakerID().c_str());
m_MakerID->SetValue(temp);
m_Date->SetValue(wxString(OpenISO->GetApploaderDate().c_str(), wxConvUTF8));
m_FST->SetValue(wxString::Format(_T("%u"), OpenISO->GetFSTSize()));
// Banner
// ...all the BannerLoader functions are bool...gross
//m_Version;
//if (OpenISO_.GetBNRVersion() == "BNR1")
m_Lang->Enable(false);
m_ShortName->SetValue(wxString(OpenISO_.GetName().c_str(), wxConvUTF8));
//m_LongName->SetValue(wxString(OpenISO_.GetLongName().c_str(), wxConvUTF8));
m_Maker->SetValue(wxString(OpenISO_.GetCompany().c_str(), wxConvUTF8));//dev too
m_Comment->SetValue(wxString(OpenISO_.GetDescription().c_str(), wxConvUTF8));
m_Banner->SetBitmap(OpenISO_.GetImage());
m_Banner->Connect(wxID_ANY, wxEVT_RIGHT_DOWN,
wxMouseEventHandler(CISOProperties::RightClickOnBanner), (wxObject*)NULL, this);
// Filesystem browser/dumper
fileIter beginning = Our_Files.begin(), end = Our_Files.end(), pos = Our_Files.begin();
CreateDirectoryTree(RootId, beginning, end, pos, (char *)"\\");
m_Treectrl->Expand(RootId);
SetTitle(wxString::Format("Properties: %s - %s", OpenISO_.GetUniqueID().c_str(), OpenISO_.GetName().c_str()));
Fit();
}
CISOProperties::~CISOProperties()
{
delete pFileSystem;
delete OpenISO;
}
void CISOProperties::CreateDirectoryTree(wxTreeItemId& parent,
fileIter& begin,
fileIter& end,
fileIter& iterPos,
char *directory)
{
bool bRoot = true;
if(iterPos == begin)
++iterPos;
else
bRoot = false;
char *name = (char *)((*iterPos)->m_FullPath);
if(iterPos == end)
return;
do
{
if((*iterPos)->IsDirectory()) {
char *dirName;
name[strlen(name) - 1] = '\0';
dirName = strrchr(name, '\\');
if(!dirName)
dirName = name;
else
dirName++;
wxTreeItemId item = m_Treectrl->AppendItem(parent, wxString::FromAscii(dirName));
CreateDirectoryTree(item, begin, end, ++iterPos, name);
} else {
char *fileName = strrchr(name, '\\');
if(!fileName)
fileName = name;
else
fileName++;
m_Treectrl->AppendItem(parent, wxString::FromAscii(fileName));
++iterPos;
}
if(iterPos == end)
break;
name = (char *)((*iterPos)->m_FullPath);
} while(bRoot || strstr(name, directory));
}
void CISOProperties::CreateGUIControls()
{
m_Close = new wxButton(this, ID_CLOSE, _("Close"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
// Notebook
m_Notebook = new wxNotebook(this, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize);
m_GameConfig = new wxPanel(m_Notebook, ID_GAMECONFIG, wxDefaultPosition, wxDefaultSize);
m_Notebook->AddPage(m_GameConfig, _("GameConfig"));
m_Information = new wxPanel(m_Notebook, ID_INFORMATION, wxDefaultPosition, wxDefaultSize);
m_Notebook->AddPage(m_Information, _("Info"));
m_Filesystem = new wxPanel(m_Notebook, ID_FILESYSTEM, wxDefaultPosition, wxDefaultSize);
m_Notebook->AddPage(m_Filesystem, _("Filesystem"));
wxBoxSizer* sButtons;
sButtons = new wxBoxSizer(wxHORIZONTAL);
sButtons->Add(0, 0, 1, wxEXPAND, 5);
sButtons->Add(m_Close, 0, wxALL, 5);
wxBoxSizer* sMain;
sMain = new wxBoxSizer(wxVERTICAL);
sMain->Add(m_Notebook, 1, wxEXPAND|wxALL, 5);
sMain->Add(sButtons, 0, wxEXPAND, 5);
this->SetSizer(sMain);
this->Layout();
// GameConfig editing - Core overrides and emulation state
sbCoreOverrides = new wxStaticBoxSizer(wxVERTICAL, m_GameConfig, _("Game-Specific Settings"));
sCoreOverrides = new wxBoxSizer(wxVERTICAL);
OverrideText = new wxStaticText(m_GameConfig, ID_OVERRIDE_TEXT, _("These settings override core Dolphin settings.\nThe 3rd state means the game uses Dolphin's setting."), wxDefaultPosition, wxDefaultSize);
UseDualCore = new wxCheckBox(m_GameConfig, ID_USEDUALCORE, _("Enable Dual Core"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator);
SkipIdle = new wxCheckBox(m_GameConfig, ID_IDLESKIP, _("Enable Idle Skipping"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator);
OptimizeQuantizers = new wxCheckBox(m_GameConfig, ID_OPTIMIZEQUANTIZERS, _("Optimize Quantizers"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator);
sEmuState = new wxBoxSizer(wxHORIZONTAL);
arrayStringFor_EmuState.Add(_("Not Set"));
arrayStringFor_EmuState.Add(_("Broken"));
arrayStringFor_EmuState.Add(_("Problems: Other"));
arrayStringFor_EmuState.Add(_("Intro"));
arrayStringFor_EmuState.Add(_("In Game"));
arrayStringFor_EmuState.Add(_("Perfect"));
EmuStateText = new wxStaticText(m_GameConfig, ID_EMUSTATE_TEXT, _("Emulation State: "), wxDefaultPosition, wxDefaultSize);
EmuState = new wxChoice(m_GameConfig, ID_EMUSTATE, wxDefaultPosition, wxDefaultSize, arrayStringFor_EmuState, 0, wxDefaultValidator);
// Patches
sbPatches = new wxStaticBoxSizer(wxVERTICAL, m_GameConfig, _("Patches"));
sPatches = new wxBoxSizer(wxVERTICAL);
Patches = new wxCheckListBox(m_GameConfig, ID_PATCHES_LIST, wxDefaultPosition, wxDefaultSize, arrayStringFor_Patches, 0, wxDefaultValidator);
sPatchButtons = new wxBoxSizer(wxHORIZONTAL);
EditPatch = new wxButton(m_GameConfig, ID_EDITPATCH, _("Edit..."), wxDefaultPosition, wxDefaultSize, 0);
AddPatch = new wxButton(m_GameConfig, ID_ADDPATCH, _("Add..."), wxDefaultPosition, wxDefaultSize, 0);
RemovePatch = new wxButton(m_GameConfig, ID_REMOVEPATCH, _("Remove"), wxDefaultPosition, wxDefaultSize, 0);
EditPatch->Enable(false);
RemovePatch->Enable(false);
// Action Replay Cheats
sbCheats = new wxStaticBoxSizer(wxVERTICAL, m_GameConfig, _("Action Replay Codes"));
sCheats = new wxBoxSizer(wxVERTICAL);
Cheats = new wxCheckListBox(m_GameConfig, ID_CHEATS_LIST, wxDefaultPosition, wxDefaultSize, arrayStringFor_Cheats, 0, wxDefaultValidator);
sCheatButtons = new wxBoxSizer(wxHORIZONTAL);
EditCheat = new wxButton(m_GameConfig, ID_EDITCHEAT, _("Edit..."), wxDefaultPosition, wxDefaultSize, 0);
AddCheat = new wxButton(m_GameConfig, ID_ADDCHEAT, _("Add..."), wxDefaultPosition, wxDefaultSize, 0);
RemoveCheat = new wxButton(m_GameConfig, ID_REMOVECHEAT, _("Remove"), wxDefaultPosition, wxDefaultSize, 0);
EditCheat->Enable(false);
RemoveCheat->Enable(false);
wxBoxSizer* sConfigPage;
sConfigPage = new wxBoxSizer(wxVERTICAL);
sCoreOverrides->Add(OverrideText, 0, wxEXPAND|wxALL, 5);
sCoreOverrides->Add(UseDualCore, 0, wxEXPAND|wxLEFT, 5);
sCoreOverrides->Add(SkipIdle, 0, wxEXPAND|wxLEFT, 5);
sCoreOverrides->Add(OptimizeQuantizers, 0, wxEXPAND|wxLEFT, 5);
sEmuState->AddStretchSpacer();
sEmuState->Add(EmuStateText, 0, wxALIGN_CENTER_VERTICAL|wxALL, 0);
sEmuState->Add(EmuState, 0, wxEXPAND|wxALL, 0);
sCoreOverrides->Add(sEmuState, 0, wxEXPAND|wxALL, 5);
sbCoreOverrides->Add(sCoreOverrides, 0, wxEXPAND|wxALL, 0);
sConfigPage->Add(sbCoreOverrides, 0, wxEXPAND|wxALL, 5);
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);
sbPatches->Add(sPatches, 1, wxEXPAND|wxALL, 0);
sConfigPage->Add(sbPatches, 1, wxEXPAND|wxALL, 5);
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);
sbCheats->Add(sCheats, 1, wxEXPAND|wxALL, 0);
sConfigPage->Add(sbCheats, 1, wxEXPAND|wxALL, 5);
m_GameConfig->SetSizer(sConfigPage);
sConfigPage->Layout();
// ISO Details
sbISODetails = new wxStaticBoxSizer(wxVERTICAL, m_Information, _("ISO Details"));
sISODetails = new wxGridBagSizer(0, 0);
sISODetails->AddGrowableCol(1);
m_NameText = new wxStaticText(m_Information, ID_NAME_TEXT, _("Name:"), wxDefaultPosition, wxDefaultSize);
m_Name = new wxTextCtrl(m_Information, ID_NAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
m_GameIDText = new wxStaticText(m_Information, ID_GAMEID_TEXT, _("Game ID:"), wxDefaultPosition, wxDefaultSize);
m_GameID = new wxTextCtrl(m_Information, ID_GAMEID, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
m_CountryText = new wxStaticText(m_Information, ID_COUNTRY_TEXT, _("Country:"), wxDefaultPosition, wxDefaultSize);
m_Country = new wxTextCtrl(m_Information, ID_COUNTRY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
m_MakerIDText = new wxStaticText(m_Information, ID_MAKERID_TEXT, _("Maker ID:"), wxDefaultPosition, wxDefaultSize);
m_MakerID = new wxTextCtrl(m_Information, ID_MAKERID, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
m_DateText = new wxStaticText(m_Information, ID_DATE_TEXT, _("Date:"), wxDefaultPosition, wxDefaultSize);
m_Date = new wxTextCtrl(m_Information, ID_DATE, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
m_FSTText = new wxStaticText(m_Information, ID_FST_TEXT, _("FST Size:"), wxDefaultPosition, wxDefaultSize);
m_FST = new wxTextCtrl(m_Information, ID_FST, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
// Banner Details
sbBannerDetails = new wxStaticBoxSizer(wxVERTICAL, m_Information, _("Banner Details"));
sBannerDetails = new wxGridBagSizer(0, 0);
sBannerDetails->AddGrowableCol(1); sBannerDetails->AddGrowableCol(2); sBannerDetails->AddGrowableCol(3);
m_VersionText = new wxStaticText(m_Information, ID_VERSION_TEXT, _("Version:"), wxDefaultPosition, wxDefaultSize);
m_Version = new wxTextCtrl(m_Information, ID_VERSION, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
m_LangText = new wxStaticText(m_Information, ID_LANG_TEXT, _("Show Language:"), wxDefaultPosition, wxDefaultSize);
arrayStringFor_Lang.Add(_("English"));
arrayStringFor_Lang.Add(_("German"));
arrayStringFor_Lang.Add(_("French"));
arrayStringFor_Lang.Add(_("Spanish"));
arrayStringFor_Lang.Add(_("Italian"));
arrayStringFor_Lang.Add(_("Dutch"));
m_Lang = new wxChoice(m_Information, ID_LANG, wxDefaultPosition, wxDefaultSize, arrayStringFor_Lang, 0, wxDefaultValidator);
m_Lang->SetSelection(0);
m_ShortText = new wxStaticText(m_Information, ID_SHORTNAME_TEXT, _("Short Name:"), wxDefaultPosition, wxDefaultSize);
m_ShortName = new wxTextCtrl(m_Information, ID_SHORTNAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
m_LongText = new wxStaticText(m_Information, ID_LONGNAME_TEXT, _("Long Name:"), wxDefaultPosition, wxDefaultSize);
m_LongName = new wxTextCtrl(m_Information, ID_LONGNAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
m_MakerText = new wxStaticText(m_Information, ID_MAKER_TEXT, _("Maker:"), wxDefaultPosition, wxDefaultSize);
m_Maker = new wxTextCtrl(m_Information, ID_MAKER, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
m_CommentText = new wxStaticText(m_Information, ID_COMMENT_TEXT, _("Comment:"), wxDefaultPosition, wxDefaultSize);
m_Comment = new wxTextCtrl(m_Information, ID_COMMENT, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY);
m_BannerText = new wxStaticText(m_Information, ID_BANNER_TEXT, _("Banner:"), wxDefaultPosition, wxDefaultSize);
m_Banner = new wxStaticBitmap(m_Information, ID_BANNER, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0);
wxBoxSizer* sInfoPage;
sInfoPage = new wxBoxSizer(wxVERTICAL);
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);
sbISODetails->Add(sISODetails, 0, wxEXPAND, 5);
sBannerDetails->Add(m_VersionText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
sBannerDetails->Add(m_Version, wxGBPosition(0, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
sBannerDetails->Add(m_LangText, wxGBPosition(0, 2), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
sBannerDetails->Add(m_Lang, wxGBPosition(0, 3), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
sBannerDetails->Add(m_ShortText, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
sBannerDetails->Add(m_ShortName, wxGBPosition(1, 1), wxGBSpan(1, 3), wxEXPAND|wxALL, 5);
sBannerDetails->Add(m_LongText, wxGBPosition(2, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
sBannerDetails->Add(m_LongName, wxGBPosition(2, 1), wxGBSpan(1, 3), wxEXPAND|wxALL, 5);
sBannerDetails->Add(m_MakerText, wxGBPosition(3, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
sBannerDetails->Add(m_Maker, wxGBPosition(3, 1), wxGBSpan(1, 3), wxEXPAND|wxALL, 5);
sBannerDetails->Add(m_CommentText, wxGBPosition(4, 0), wxGBSpan(1, 1), wxALL, 5);
sBannerDetails->Add(m_Comment, wxGBPosition(4, 1), wxGBSpan(1, 3), wxEXPAND|wxALL, 5);
sBannerDetails->Add(m_BannerText, wxGBPosition(5, 0), wxGBSpan(1, 1), wxALL, 5);
sBannerDetails->Add(m_Banner, wxGBPosition(5, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
sbBannerDetails->Add(sBannerDetails, 0, wxEXPAND, 0);
sInfoPage->Add(sbISODetails, 0, wxEXPAND|wxALL, 5);
sInfoPage->Add(sbBannerDetails, 0, wxEXPAND|wxALL, 5);
m_Information->SetSizer(sInfoPage);
sInfoPage->Layout();
// Filesystem tree
sbTreectrl = new wxStaticBoxSizer(wxVERTICAL, m_Filesystem, _("Filesystem"));
m_Treectrl = new wxTreeCtrl(m_Filesystem, ID_TREECTRL, wxDefaultPosition, wxDefaultSize, wxTR_DEFAULT_STYLE, wxDefaultValidator);
RootId = m_Treectrl->AddRoot(_("Root"), -1, -1, 0);
wxBoxSizer* sTreePage;
sTreePage = new wxBoxSizer(wxVERTICAL);
sbTreectrl->Add(m_Treectrl, 1, wxEXPAND);
sTreePage->Add(sbTreectrl, 1, wxEXPAND|wxALL, 5);
m_Filesystem->SetSizer(sTreePage);
sTreePage->Layout();
}
void CISOProperties::OnClose(wxCloseEvent& WXUNUSED (event))
{
if (!SaveGameConfig(GameIniFile))
wxMessageBox(wxString::Format("Could not save %s", GameIniFile.c_str()), _("Error"), wxOK|wxICON_ERROR, this);
Destroy();
}
void CISOProperties::OnCloseClick(wxCommandEvent& WXUNUSED (event))
{
Close();
}
void CISOProperties::RightClickOnBanner(wxMouseEvent& event)
{
wxMenu popupMenu;
popupMenu.Append(IDM_BNRSAVEAS, _("Save as..."));
PopupMenu(&popupMenu);
event.Skip();
}
void CISOProperties::OnBannerImageSave(wxCommandEvent& WXUNUSED (event))
{
wxString dirHome;
wxFileDialog dialog(this, _("Save as..."), wxGetHomeDir(&dirHome), wxString::Format(_("%s.png"), m_GameID->GetLabel()),
_("*.*"), wxFD_SAVE|wxFD_OVERWRITE_PROMPT, wxDefaultPosition, wxDefaultSize);
if (dialog.ShowModal() == wxID_OK)
{
m_Banner->GetBitmap().ConvertToImage().SaveFile(dialog.GetPath());
}
}
void CISOProperties::OnRightClickOnTree(wxTreeEvent& event)
{
m_Treectrl->SelectItem(event.GetItem());
wxMenu popupMenu;
if (m_Treectrl->ItemHasChildren(m_Treectrl->GetSelection()))
;//popupMenu.Append(IDM_EXTRACTDIR, _("Extract Directory..."));
else
popupMenu.Append(IDM_EXTRACTFILE, _("Extract File..."));
PopupMenu(&popupMenu);
event.Skip();
}
void CISOProperties::OnExtractFile(wxCommandEvent& WXUNUSED (event))
{
wxString Path;
wxString File;
File = m_Treectrl->GetItemText(m_Treectrl->GetSelection());
Path = wxFileSelector(
_T("Export File"),
wxEmptyString, File, wxEmptyString,
wxString::Format
(
_T("All files (%s)|%s"),
wxFileSelectorDefaultWildcardStr,
wxFileSelectorDefaultWildcardStr
),
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()));
File = temp + _T("\\") + File;
m_Treectrl->SelectItem(m_Treectrl->GetItemParent(m_Treectrl->GetSelection()));
}
pFileSystem->ExportFile(File.mb_str(), Path.mb_str());
}
void CISOProperties::OnExtractDir(wxCommandEvent& WXUNUSED (event))
{
}
void CISOProperties::SetRefresh(wxCommandEvent& WXUNUSED (event))
{
bRefreshList = true;
}
void CISOProperties::LoadGameConfig()
{
bool bTemp;
int iTemp;
if (GameIni.Get("Core", "UseDualCore", &bTemp))
UseDualCore->Set3StateValue((wxCheckBoxState)bTemp);
else
UseDualCore->Set3StateValue(wxCHK_UNDETERMINED);
if (GameIni.Get("Core", "SkipIdle", &bTemp))
SkipIdle->Set3StateValue((wxCheckBoxState)bTemp);
else
SkipIdle->Set3StateValue(wxCHK_UNDETERMINED);
if (GameIni.Get("Core", "OptimizeQuantizers", &bTemp))
OptimizeQuantizers->Set3StateValue((wxCheckBoxState)bTemp);
else
OptimizeQuantizers->Set3StateValue(wxCHK_UNDETERMINED);
GameIni.Get("EmuState", "EmulationStateId", &iTemp, 0);
EmuState->SetSelection(iTemp);
// TODO handle patches+cheats
//LoadActionReplayCodes(GameIni, true);
//for (int i = 0; i < arCodes.size(); i++)
// Cheats->Append(wxString(arCodes[i].name.c_str(), wxConvUTF8));
}
bool CISOProperties::SaveGameConfig(std::string GameIniFile)
{
if (UseDualCore->Get3StateValue() == wxCHK_UNDETERMINED)
GameIni.DeleteKey("Core", "UseDualCore");
else
GameIni.Set("Core", "UseDualCore", UseDualCore->Get3StateValue());
if (SkipIdle->Get3StateValue() == wxCHK_UNDETERMINED)
GameIni.DeleteKey("Core", "SkipIdle");
else
GameIni.Set("Core", "SkipIdle", SkipIdle->Get3StateValue());
if (OptimizeQuantizers->Get3StateValue() == wxCHK_UNDETERMINED)
GameIni.DeleteKey("Core", "OptimizeQuantizers");
else
GameIni.Set("Core", "OptimizeQuantizers", OptimizeQuantizers->Get3StateValue());
GameIni.Set("EmuState", "EmulationStateId", EmuState->GetSelection());
return GameIni.Save(GameIniFile.c_str());
// TODO save patches+cheats
}

View File

@ -15,8 +15,8 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef __FILESYSTEM_VIEWER_h__
#define __FILESYSTEM_VIEWER_h__
#ifndef __ISOPROPERTIES_h__
#define __ISOPROPERTIES_h__
#include <wx/wx.h>
#include <wx/sizer.h>
@ -25,33 +25,68 @@
#include <wx/imaglist.h>
#include <wx/treectrl.h>
#include <wx/gbsizer.h>
#include <wx/notebook.h>
#include <string>
#include "Filesystem.h"
#include "IniFile.h"
#undef FILESYSTEM_VIEWER_STYLE
#define FILESYSTEM_VIEWER_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX
#undef ISOPROPERTIES_STYLE
#define ISOPROPERTIES_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX
class CFilesystemViewer : public wxDialog
class CISOProperties : public wxDialog
{
public:
CFilesystemViewer(const std::string fileName, wxWindow* parent, wxWindowID id = 1, const wxString& title = wxT("Filesystem Viewer"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = FILESYSTEM_VIEWER_STYLE);
virtual ~CFilesystemViewer();
CISOProperties(const std::string fileName, wxWindow* parent, wxWindowID id = 1, const wxString& title = wxT("Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = ISOPROPERTIES_STYLE);
virtual ~CISOProperties();
bool bRefreshList;
private:
DECLARE_EVENT_TABLE();
wxStaticBoxSizer *sbCoreOverrides;
wxBoxSizer *sCoreOverrides;
wxBoxSizer *sEmuState;
wxStaticBoxSizer *sbPatches;
wxBoxSizer *sPatches;
wxBoxSizer *sPatchButtons;
wxStaticBoxSizer *sbCheats;
wxBoxSizer *sCheats;
wxBoxSizer *sCheatButtons;
wxStaticBoxSizer *sbISODetails;
wxGridBagSizer *sISODetails;
wxStaticBoxSizer *sbBannerDetails;
wxGridBagSizer *sBannerDetails;
wxStaticBoxSizer *sbTreectrl;
wxTreeCtrl *m_Treectrl;
wxButton *m_Close;
wxNotebook *m_Notebook;
wxPanel *m_GameConfig;
wxPanel *m_Information;
wxPanel *m_Filesystem;
wxStaticText *OverrideText;
wxCheckBox *UseDualCore;
wxCheckBox *SkipIdle;
wxCheckBox *OptimizeQuantizers;
wxStaticText *EmuStateText;
wxArrayString arrayStringFor_EmuState;
wxChoice *EmuState;
wxArrayString arrayStringFor_Patches;
wxCheckListBox *Patches;
wxButton *EditPatch;
wxButton *AddPatch;
wxButton *RemovePatch;
wxArrayString arrayStringFor_Cheats;
wxCheckListBox *Cheats;
wxButton *EditCheat;
wxButton *AddCheat;
wxButton *RemoveCheat;
wxStaticText *m_NameText;
wxStaticText *m_GameIDText;
wxStaticText *m_CountryText;
@ -65,7 +100,6 @@ class CFilesystemViewer : public wxDialog
wxStaticText *m_MakerText;
wxStaticText *m_CommentText;
wxStaticText *m_BannerText;
wxTextCtrl *m_Name;
wxTextCtrl *m_GameID;
wxTextCtrl *m_Country;
@ -80,6 +114,8 @@ class CFilesystemViewer : public wxDialog
wxTextCtrl *m_Maker;
wxTextCtrl *m_Comment;
wxStaticBitmap *m_Banner;
wxTreeCtrl *m_Treectrl;
wxTreeItemId RootId;
enum
@ -87,6 +123,26 @@ class CFilesystemViewer : public wxDialog
ID_CLOSE = 1000,
ID_TREECTRL,
ID_NOTEBOOK,
ID_GAMECONFIG,
ID_INFORMATION,
ID_FILESYSTEM,
ID_OVERRIDE_TEXT,
ID_USEDUALCORE,
ID_IDLESKIP,
ID_OPTIMIZEQUANTIZERS,
ID_EMUSTATE_TEXT,
ID_EMUSTATE,
ID_PATCHES_LIST,
ID_EDITPATCH,
ID_ADDPATCH,
ID_REMOVEPATCH,
ID_CHEATS_LIST,
ID_EDITCHEAT,
ID_ADDCHEAT,
ID_REMOVECHEAT,
ID_NAME_TEXT,
ID_GAMEID_TEXT,
ID_COUNTRY_TEXT,
@ -114,14 +170,9 @@ class CFilesystemViewer : public wxDialog
ID_MAKER,
ID_COMMENT,
ID_BANNER,
ID_SAVEBNR,
IDM_EXTRACTDIR,
IDM_EXTRACTFILE,
IDM_REPLACEFILE,
IDM_RENAMEFILE,
IDM_BNRSAVEAS,
ID_DUMMY_VALUE_ //don't remove this value unless you have other enum values
IDM_BNRSAVEAS
};
void CreateGUIControls();
@ -131,12 +182,20 @@ class CFilesystemViewer : public wxDialog
void OnBannerImageSave(wxCommandEvent& event);
void OnRightClickOnTree(wxTreeEvent& event);
void OnExtractFile(wxCommandEvent& event);
void OnExtractDir(wxCommandEvent& event);
void SetRefresh(wxCommandEvent& event);
std::vector<const DiscIO::SFileInfo *> Our_Files;
typedef std::vector<const DiscIO::SFileInfo *>::iterator fileIter;
void CreateDirectoryTree(wxTreeItemId& parent,fileIter& begin,
fileIter& end,
fileIter& iterPos, char *directory);
IniFile GameIni;
std::string GameIniFile;
void LoadGameConfig();
bool SaveGameConfig(std::string GameIniFile);
};
#endif

View File

@ -149,14 +149,17 @@ void ConfigDialog::CreateGUIControls()
sbDevice[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Controller Settings"));
sDevice[i] = new wxBoxSizer(wxHORIZONTAL);
m_Attached[i] = new wxCheckBox(m_Controller[i], ID_ATTACHED, wxT("Controller attached"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_X360Pad[i] = new wxCheckBox(m_Controller[i], ID_X360PAD, wxT("Use X360Pad"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
#ifdef _WIN32
m_X360Pad[i] = new wxCheckBox(m_Controller[i], ID_X360PAD, wxT("Enable X360Pad"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_X360PadC[i] = new wxChoice(m_Controller[i], ID_X360PAD_CHOICE, wxDefaultPosition, wxDefaultSize, arrayStringFor_X360Pad, 0, wxDefaultValidator);
m_Rumble[i] = new wxCheckBox(m_Controller[i], ID_RUMBLE, wxT("Enable rumble"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
#endif
m_Disable[i] = new wxCheckBox(m_Controller[i], ID_DISABLE, wxT("Disable when Dolphin is not in focus"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Attached[i]->SetValue(pad[i].bAttached);
#ifdef _WIN32
if (arrayStringFor_X360Pad.IsEmpty())
{
m_X360Pad[i]->SetLabel(wxT("Use X360Pad - No pad connected"));
m_X360Pad[i]->SetLabel(wxT("Enable X360Pad - No pad connected"));
m_X360Pad[i]->SetValue(false);
m_X360Pad[i]->Enable(false);
pad[i].bEnableXPad = false;
@ -171,14 +174,17 @@ void ConfigDialog::CreateGUIControls()
m_Rumble[i]->SetValue(pad[i].bRumble);
m_Rumble[i]->Enable(m_X360Pad[i]->IsChecked());
}
#endif
m_Disable[i]->SetValue(pad[i].bDisable);
sDevice[i]->Add(m_Attached[i], 0, wxEXPAND|wxALL, 1);
sDevice[i]->AddStretchSpacer();
#ifdef _WIN32
sDevice[i]->Add(m_X360Pad[i], 0, wxEXPAND|wxALL, 1);
sDevice[i]->Add(m_X360PadC[i], 0, wxEXPAND|wxALL, 1);
sDevice[i]->Add(m_Rumble[i], 0, wxEXPAND|wxALL, 1);
sDevice[i]->AddStretchSpacer();
#endif
sDevice[i]->Add(m_Disable[i], 0, wxEXPAND|wxALL, 1);
sbDevice[i]->Add(sDevice[i], 0, wxEXPAND|wxALL, 1);
@ -321,9 +327,9 @@ void ConfigDialog::OnButtonClick(wxCommandEvent& event)
}
void ConfigDialog::DllAbout(wxCommandEvent& event)
{
wxAboutDialogInfo info;
info.AddDeveloper(_T("ector"));
info.AddDeveloper(_T("F|RES"));
info.SetDescription(_T("Simple keyboard and XInput plugin for dolphin"));
wxAboutBox(info);
wxString message;
_WIN32 ? message = "A simple keyboard and XInput plugin for dolphin." : message = "A simple keyboard plugin for dolphin.";
wxMessageBox(_T("Dolphin PadSimple Plugin\nBy ector and F|RES\n\n" + message),
_T("Dolphin PadSimple"), wxOK, this);
}

View File

@ -19,7 +19,6 @@
#define __CONFIGDLG_H__
#include <wx/wx.h>
#include <wx/aboutdlg.h>
#include <wx/dialog.h>
#include <wx/textctrl.h>
#include <wx/button.h>

View File

@ -635,7 +635,7 @@ void LoadConfig()
char SectionName[32];
sprintf(SectionName, "PAD%i", i+1);
file.Get(SectionName, "UseXPad", &pad[i].bEnableXPad, true);
file.Get(SectionName, "UseXPad", &pad[i].bEnableXPad, i==0);
file.Get(SectionName, "Attached", &pad[i].bAttached, i==0);
file.Get(SectionName, "DisableOnBackground", &pad[i].bDisable, false);
file.Get(SectionName, "Rumble", &pad[i].bRumble, true);

View File

@ -24,8 +24,7 @@
BEGIN_EVENT_TABLE(ConfigDialog,wxDialog)
EVT_CLOSE(ConfigDialog::OnClose)
EVT_BUTTON(ID_CANCEL,ConfigDialog::OKClick)
EVT_BUTTON(ID_OK,ConfigDialog::OKClick)
EVT_BUTTON(ID_CLOSE, ConfigDialog::CloseClick)
EVT_BUTTON(ID_ABOUTOGL, ConfigDialog::AboutClick)
EVT_CHECKBOX(ID_FULLSCREEN, ConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(ID_RENDERTOMAINWINDOW, ConfigDialog::GeneralSettingsChanged)
@ -72,16 +71,14 @@ void ConfigDialog::CreateGUIControls()
// Buttons
m_About = new wxButton(this, ID_ABOUTOGL, wxT("About"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_OK = new wxButton(this, ID_OK, wxT("OK"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Cancel = new wxButton(this, ID_CANCEL, wxT("Cancel"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Close = new wxButton(this, ID_CLOSE, wxT("Close"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
// Put notebook and buttons in sizers
wxBoxSizer* sButtons;
sButtons = new wxBoxSizer(wxHORIZONTAL);
sButtons->Add(m_About, 0, wxALL, 5);
sButtons->Add(0, 0, 1, wxEXPAND, 5);
sButtons->Add(m_OK, 0, wxALL, 5);
sButtons->Add(m_Cancel, 0, wxALL, 5);
sButtons->AddStretchSpacer();
sButtons->Add(m_Close, 0, wxALL, 5);
wxBoxSizer* sMain;
sMain = new wxBoxSizer(wxVERTICAL);
@ -223,23 +220,15 @@ void ConfigDialog::CreateGUIControls()
Center();
}
void ConfigDialog::OnClose(wxCloseEvent& event)
void ConfigDialog::OnClose(wxCloseEvent& WXUNUSED (event))
{
g_Config.Save();
EndModal(0);
}
void ConfigDialog::OKClick(wxCommandEvent& event)
void ConfigDialog::CloseClick(wxCommandEvent& WXUNUSED (event))
{
switch(event.GetId())
{
case ID_CANCEL:
Close();
break;
case ID_OK:
g_Config.Save();
Close();
break;
}
}
void ConfigDialog::AddFSReso(char *reso)
@ -259,7 +248,7 @@ void ConfigDialog::AddAAMode(int mode)
m_AliasModeCB->Append(tmp);
}
void ConfigDialog::AboutClick(wxCommandEvent& event)
void ConfigDialog::AboutClick(wxCommandEvent& WXUNUSED (event))
{
wxMessageBox(_T("Dolphin OpenGL Plugin\nBy zerofrog(@gmail.com)\n\n"
"A card supporting Vertex/Pixel Shader 2.0 or higher, framebuffer objects, "

View File

@ -40,7 +40,7 @@ class ConfigDialog : public wxDialog
public:
ConfigDialog(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("OpenGL Plugin Configuration"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = ConfigDialog_STYLE);
virtual ~ConfigDialog();
void OKClick(wxCommandEvent& event);
void CloseClick(wxCommandEvent& event);
void AddFSReso(char *reso);
void AddWindowReso(char *reso);
@ -65,8 +65,7 @@ class ConfigDialog : public wxDialog
wxGridBagSizer* sHacks;
wxButton *m_About;
wxButton *m_Cancel;
wxButton *m_OK;
wxButton *m_Close;
wxNotebook *m_Notebook;
wxPanel *m_PageGeneral;
wxPanel *m_PageAdvanced;
@ -96,8 +95,7 @@ class ConfigDialog : public wxDialog
enum
{
ID_OK = 1000,
ID_CANCEL,
ID_CLOSE = 1000,
ID_ABOUTOGL,
ID_NOTEBOOK,