namespace-ified ActionReplay, and made ISOProperties use the existing AR code. bonus: encrypted arcodes are saved as unencrypted codes just by closing the isoproperties dialog. also added ARCodeAddEdit, but once again, it only views entries atm. some misc wxw cleanup

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1560 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2008-12-17 04:14:24 +00:00
parent 1e774a5db2
commit 4a5d9ded94
26 changed files with 308 additions and 171 deletions

View File

@ -602,10 +602,6 @@
RelativePath=".\Src\Plugin.h"
>
</File>
<File
RelativePath=".\Src\PortableSockets.h"
>
</File>
<File
RelativePath=".\Src\SConscript"
>

View File

@ -22,6 +22,9 @@
#include "ARDecrypt.h"
#include <algorithm>
namespace ActionReplay
{
int total;
// Alphanumeric filter for text<->bin conversion
@ -509,3 +512,4 @@ void DecryptARCode(std::vector<std::string> vCodes, std::vector<AREntry> &ops)
}
}
}
} //namespace ActionReplay

View File

@ -28,9 +28,13 @@
#include "Common.h"
#include "ActionReplay.h"
namespace ActionReplay
{
extern int total;
extern const char *filter;
void DecryptARCode(std::vector<std::string> vCodes, std::vector<AREntry> &ops);
} //namespace
#endif //_ARDECRYPT_H_

View File

@ -24,6 +24,8 @@
// It probably is Turing complete - but what does that matter when AR codes can write
// actual PowerPC code...
// THIS FILE IS GROSS!!!
#include <string>
#include <vector>
@ -35,16 +37,17 @@
#include "ARDecrypt.h"
#include "LogManager.h"
namespace
namespace ActionReplay
{
static std::vector<AREntry>::const_iterator iter;
static ARCode code;
static bool b_RanOnce = false;
static std::vector<ARCode> arCodes;
static std::vector<ARCode> activeCodes;
static bool logSelf = false;
static std::vector<std::string> arLog;
} // namespace
static std::vector<AREntry>::const_iterator iter;
static ARCode code;
static bool b_RanOnce = false;
static std::vector<ARCode> arCodes;
static std::vector<ARCode> activeCodes;
static bool logSelf = false;
static std::vector<std::string> arLog;
void LogInfo(const char *format, ...);
// --- Codes ---
@ -66,11 +69,11 @@ bool NormalCode_Type_5(u8 subtype, u32 addr, u32 data, int *count, bool *skip);
bool NormalCode_Type_6(u8 subtype, u32 addr, u32 data, int *count, bool *skip);
bool NormalCode_Type_7(u8 subtype, u32 addr, u32 data, int *count, bool *skip);
void LoadActionReplayCodes(IniFile &ini)
void LoadCodes(IniFile &ini, bool forceLoad)
{
// Parses the Action Replay section of a game ini file.
if (!Core::GetStartupParameter().bEnableCheats)
return; // If cheats are off, do not load them
if (!Core::GetStartupParameter().bEnableCheats && !forceLoad)
return;
std::vector<std::string> lines;
std::vector<std::string> encryptedLines;
@ -158,7 +161,13 @@ void LoadActionReplayCodes(IniFile &ini)
arCodes.push_back(currentCode);
}
ActionReplay_UpdateActiveList();
UpdateActiveList();
}
void LoadCodes(std::vector<ARCode> &_arCodes, IniFile &ini)
{
LoadCodes(ini, true);
_arCodes = arCodes;
}
void LogInfo(const char *format, ...)
@ -184,14 +193,14 @@ void LogInfo(const char *format, ...)
}
}
void ActionReplayRunAllActive()
void RunAllActive()
{
if (Core::GetStartupParameter().bEnableCheats) {
for (std::vector<ARCode>::iterator iter = activeCodes.begin(); iter != activeCodes.end(); ++iter)
{
if (iter->active)
{
if (!RunActionReplayCode(*iter))
if (!RunCode(*iter))
iter->active = false;
LogInfo("\n");
}
@ -201,7 +210,7 @@ void ActionReplayRunAllActive()
}
}
bool RunActionReplayCode(const ARCode &arcode) {
bool RunCode(const ARCode &arcode) {
// The mechanism is different than what the real AR uses, so there may be compatibility problems.
u8 cmd;
u32 addr;
@ -999,33 +1008,33 @@ bool NormalCode_Type_7(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
return true;
}
size_t ActionReplay_GetCodeListSize()
size_t GetCodeListSize()
{
return arCodes.size();
}
ARCode ActionReplay_GetARCode(size_t index)
ARCode GetARCode(size_t index)
{
if (index > arCodes.size())
{
PanicAlert("ActionReplay_GetARCode: Index is greater than ar code list size %i", index);
PanicAlert("GetARCode: Index is greater than ar code list size %i", index);
return ARCode();
}
return arCodes[index];
}
void ActionReplay_SetARCode_IsActive(bool active, size_t index)
void SetARCode_IsActive(bool active, size_t index)
{
if (index > arCodes.size())
{
PanicAlert("ActionReplay_SetARCode_IsActive: Index is greater than ar code list size %i", index);
PanicAlert("SetARCode_IsActive: Index is greater than ar code list size %i", index);
return;
}
arCodes[index].active = active;
ActionReplay_UpdateActiveList();
UpdateActiveList();
}
void ActionReplay_UpdateActiveList()
void UpdateActiveList()
{
b_RanOnce = false;
activeCodes.clear();
@ -1036,17 +1045,19 @@ void ActionReplay_UpdateActiveList()
}
}
void ActionReplay_EnableSelfLogging(bool enable)
void EnableSelfLogging(bool enable)
{
logSelf = enable;
}
const std::vector<std::string> &ActionReplay_GetSelfLog()
const std::vector<std::string> &GetSelfLog()
{
return arLog;
}
bool ActionReplay_IsSelfLogging()
bool IsSelfLogging()
{
return logSelf;
}
} // namespace ActionReplay

View File

@ -20,6 +20,9 @@
#include "IniFile.h"
namespace ActionReplay
{
struct AREntry {
u32 cmd_addr;
u32 value;
@ -31,15 +34,17 @@ struct ARCode {
bool active;
};
void ActionReplayRunAllActive();
bool RunActionReplayCode(const ARCode &arcode);
void LoadActionReplayCodes(IniFile &ini);
size_t ActionReplay_GetCodeListSize();
ARCode ActionReplay_GetARCode(size_t index);
void ActionReplay_SetARCode_IsActive(bool active, size_t index);
void ActionReplay_UpdateActiveList();
void ActionReplay_EnableSelfLogging(bool enable);
const std::vector<std::string> &ActionReplay_GetSelfLog();
bool ActionReplay_IsSelfLogging();
void RunAllActive();
bool RunCode(const ARCode &arcode);
void LoadCodes(IniFile &ini, bool forceLoad);
void LoadCodes(std::vector<ARCode> &_arCodes, IniFile &ini);
size_t GetCodeListSize();
ARCode GetARCode(size_t index);
void SetARCode_IsActive(bool active, size_t index);
void UpdateActiveList();
void EnableSelfLogging(bool enable);
const std::vector<std::string> &GetSelfLog();
bool IsSelfLogging();
} // namespace
#endif //_ACTIONREPLAY_H_

View File

@ -136,7 +136,7 @@ void LoadPatches(const char *gameID)
std::string filename = std::string(FULL_GAMECONFIG_DIR) + gameID + ".ini";
if (ini.Load(filename.c_str())) {
LoadPatchSection("OnFrame", onFrame, ini);
LoadActionReplayCodes(ini);
ActionReplay::LoadCodes(ini, false);
LoadSpeedhacks("Speedhacks", speedHacks, ini);
}
}
@ -178,6 +178,6 @@ void ApplyFramePatches()
void ApplyARPatches()
{
ActionReplayRunAllActive();
ActionReplay::RunAllActive();
}
} // namespace

View File

@ -768,6 +768,14 @@
RelativePath=".\Src\AboutDolphin.h"
>
</File>
<File
RelativePath=".\Src\ARCodeAddEdit.cpp"
>
</File>
<File
RelativePath=".\Src\ARCodeAddEdit.h"
>
</File>
<File
RelativePath=".\Src\CheatsWindow.cpp"
>

View File

@ -0,0 +1,90 @@
// 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 "ARCodeAddEdit.h"
extern std::vector<ActionReplay::ARCode> arCodes;
BEGIN_EVENT_TABLE(CARCodeAddEdit, wxDialog)
EVT_CLOSE(CARCodeAddEdit::OnClose)
EVT_SPIN(ID_ENTRY_SELECT, CARCodeAddEdit::ChangeEntry)
END_EVENT_TABLE()
CARCodeAddEdit::CARCodeAddEdit(int _selection, wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& position, const wxSize& size, long style)
: wxDialog(parent, id, title, position, size, style)
{
selection = _selection;
CreateGUIControls(selection);
}
CARCodeAddEdit::~CARCodeAddEdit()
{
}
void CARCodeAddEdit::CreateGUIControls(int _selection)
{
ActionReplay::ARCode currentCode = arCodes.at(_selection);
wxBoxSizer* sEditCheat = new wxBoxSizer(wxVERTICAL);
wxStaticBoxSizer* sbEntry = new wxStaticBoxSizer(wxVERTICAL, this, _("Code"));
wxStaticText* EditCheatNameText = new wxStaticText(this, ID_EDITCHEAT_NAME_TEXT, _("Name:"), wxDefaultPosition, wxDefaultSize);
EditCheatName = new wxTextCtrl(this, ID_EDITCHEAT_NAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
EditCheatName->SetValue(wxString::FromAscii(currentCode.name.c_str()));
EntrySelection = new wxSpinButton(this, ID_ENTRY_SELECT, wxDefaultPosition, wxDefaultSize, wxVERTICAL);
EntrySelection->SetRange(0, (int)arCodes.size()-1);
EntrySelection->SetValue(_selection);
EditCheatCode = new wxTextCtrl(this, ID_EDITCHEAT_CODE, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE);
UpdateTextCtrl(currentCode);
wxGridBagSizer* sgEntry = new wxGridBagSizer(0, 0);
sgEntry->AddGrowableCol(1);
sgEntry->AddGrowableRow(1);
sgEntry->Add(EditCheatNameText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, 5);
sgEntry->Add(EditCheatName, wxGBPosition(0, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
sgEntry->Add(EntrySelection, wxGBPosition(0, 2), wxGBSpan(2, 1), wxEXPAND|wxALL, 5);
sgEntry->Add(EditCheatCode, wxGBPosition(1, 0), wxGBSpan(1, 2), wxEXPAND|wxALL, 5);
sbEntry->Add(sgEntry, 1, wxEXPAND);
sEditCheat->Add(sbEntry, 1, wxEXPAND|wxALL, 5);
wxBoxSizer* sEditCheatButtons = new wxBoxSizer(wxHORIZONTAL);
wxButton* bOK = new wxButton(this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
wxButton* bCancel = new wxButton(this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
sEditCheatButtons->Add(0, 0, 1, wxEXPAND, 5);
sEditCheatButtons->Add(bOK, 0, wxALL, 5);
sEditCheatButtons->Add(bCancel, 0, wxALL, 5);
sEditCheat->Add(sEditCheatButtons, 0, wxEXPAND, 5);
this->SetSizer(sEditCheat);
sEditCheat->Layout();
}
void CARCodeAddEdit::OnClose(wxCloseEvent& WXUNUSED (event))
{
Destroy();
}
void CARCodeAddEdit::ChangeEntry(wxSpinEvent& event)
{
ActionReplay::ARCode currentCode = arCodes.at(event.GetPosition());
EditCheatName->SetValue(wxString::FromAscii(currentCode.name.c_str()));
UpdateTextCtrl(currentCode);
}
void CARCodeAddEdit::UpdateTextCtrl(ActionReplay::ARCode arCode)
{
EditCheatCode->Clear();
for (int i = 0; i < arCode.ops.size(); i++)
EditCheatCode->AppendText(wxString::Format("%08X %08X\n", arCode.ops.at(i).cmd_addr, arCode.ops.at(i).value));
}

View File

@ -0,0 +1,58 @@
// 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/
#ifndef __ARCODE_ADDEDIT_h__
#define __ARCODE_ADDEDIT_h__
#include <wx/wx.h>
#include <wx/spinctrl.h>
#include "ISOProperties.h"
class CARCodeAddEdit : public wxDialog
{
public:
CARCodeAddEdit(int _selection, wxWindow* parent,
wxWindowID id = 1,
const wxString& title = wxT("Edit ActionReplay Code"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE);
virtual ~CARCodeAddEdit();
private:
DECLARE_EVENT_TABLE();
wxTextCtrl *EditCheatName;
wxSpinButton *EntrySelection;
wxTextCtrl *EditCheatCode;
enum {
ID_EDITCHEAT_NAME_TEXT = 4550,
ID_EDITCHEAT_NAME,
ID_ENTRY_SELECT,
ID_EDITCHEAT_CODE
};
void CreateGUIControls(int selection);
void OnClose(wxCloseEvent& event);
void ChangeEntry(wxSpinEvent& event);
void UpdateTextCtrl(ActionReplay::ARCode arCode);
int selection;
};
#endif // __PATCH_ADDEDIT_h__

View File

@ -25,13 +25,15 @@
#include <wx/mstream.h>
#include <wx/statbmp.h>
#undef ABOUTDOLPHIN_STYLE
#define ABOUTDOLPHIN_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX
class AboutDolphin : public wxDialog
{
public:
AboutDolphin(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("About Dolphin"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = ABOUTDOLPHIN_STYLE);
AboutDolphin(wxWindow *parent,
wxWindowID id = 1,
const wxString &title = wxT("About Dolphin"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE);
virtual ~AboutDolphin();
void CloseClick(wxCommandEvent& event);

View File

@ -20,6 +20,8 @@
#include "ActionReplay.h"
#include "Core.h"
using namespace ActionReplay;
BEGIN_EVENT_TABLE(wxCheatsWindow, wxWindow)
EVT_SIZE( wxCheatsWindow::OnEvent_Window_Resize)
EVT_CLOSE( wxCheatsWindow::OnEvent_Window_Close)
@ -31,7 +33,8 @@ BEGIN_EVENT_TABLE(wxCheatsWindow, wxWindow)
EVT_CHECKBOX(ID_CHECKBOX_LOGAR, wxCheatsWindow::OnEvent_CheckBoxEnableLogging_StateChange)
END_EVENT_TABLE()
wxCheatsWindow::wxCheatsWindow(wxFrame* parent, const wxPoint& pos, const wxSize& size) : wxFrame(parent, wxID_ANY, _T("Action Replay"), pos, size, wxCHEATSWINDOW_STYLE)
wxCheatsWindow::wxCheatsWindow(wxFrame* parent, const wxPoint& pos, const wxSize& size) :
wxFrame(parent, wxID_ANY, _T("Action Replay"), pos, size, wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE)
{
// Create the GUI controls
Init_ChildControls();
@ -93,7 +96,7 @@ void wxCheatsWindow::Init_ChildControls()
m_Button_UpdateLog = new wxButton(m_Tab_Log, ID_BUTTON_UPDATELOG, wxT("Update"));
m_CheckBox_LogAR = new wxCheckBox(m_Tab_Log, ID_CHECKBOX_LOGAR, wxT("Enable AR Logging"));
m_CheckBox_LogAR->SetValue(ActionReplay_IsSelfLogging());
m_CheckBox_LogAR->SetValue(IsSelfLogging());
m_TextCtrl_Log = new wxTextCtrl(m_Tab_Log, ID_TEXTCTRL_LOG, wxT(""), wxDefaultPosition, wxSize(100, 600), wxTE_MULTILINE | wxTE_READONLY | wxTE_DONTWRAP);
wxBoxSizer *HStrip1 = new wxBoxSizer(wxHORIZONTAL);
@ -139,10 +142,10 @@ void wxCheatsWindow::OnEvent_Window_Close(wxCloseEvent& WXUNUSED (event))
void wxCheatsWindow::Load_ARCodes()
{
indexList.clear();
size_t size = ActionReplay_GetCodeListSize();
size_t size = GetCodeListSize();
for (size_t i = 0; i < size; i++)
{
ARCode code = ActionReplay_GetARCode(i);
ARCode code = GetARCode(i);
ARCodeIndex ind;
u32 index = m_CheckListBox_CheatsList->Append(wxString::FromAscii(code.name.c_str()));
m_CheckListBox_CheatsList->Check(index, code.active);
@ -158,7 +161,7 @@ void wxCheatsWindow::OnEvent_CheatsList_ItemSelected(wxCommandEvent& WXUNUSED (e
{
if ((int)indexList[i].uiIndex == index)
{
ARCode code = ActionReplay_GetARCode(i);
ARCode code = GetARCode(i);
m_Label_Codename->SetLabel(wxT("Name: ") + wxString::FromAscii(code.name.c_str()));
char text[CHAR_MAX];
char* numcodes = text;
@ -183,7 +186,7 @@ void wxCheatsWindow::OnEvent_CheatsList_ItemToggled(wxCommandEvent& WXUNUSED (ev
{
if ((int)indexList[i].uiIndex == index)
{
ActionReplay_SetARCode_IsActive(m_CheckListBox_CheatsList->IsChecked(index), indexList[i].index);
SetARCode_IsActive(m_CheckListBox_CheatsList->IsChecked(index), indexList[i].index);
}
}
}
@ -191,14 +194,14 @@ void wxCheatsWindow::OnEvent_ButtonUpdateCodes_Press(wxCommandEvent& WXUNUSED (e
{
for (size_t i = 0; i < indexList.size(); i++)
{
ActionReplay_SetARCode_IsActive(m_CheckListBox_CheatsList->IsChecked(indexList[i].uiIndex), indexList[i].index);
SetARCode_IsActive(m_CheckListBox_CheatsList->IsChecked(indexList[i].uiIndex), indexList[i].index);
}
}
void wxCheatsWindow::OnEvent_ButtonUpdateLog_Press(wxCommandEvent& WXUNUSED (event))
{
m_TextCtrl_Log->Clear();
const std::vector<std::string> &arLog = ActionReplay_GetSelfLog();
const std::vector<std::string> &arLog = GetSelfLog();
for (u32 i = 0; i < arLog.size(); i++)
{
m_TextCtrl_Log->AppendText(wxString::FromAscii(arLog[i].c_str()));
@ -207,5 +210,5 @@ void wxCheatsWindow::OnEvent_ButtonUpdateLog_Press(wxCommandEvent& WXUNUSED (eve
void wxCheatsWindow::OnEvent_CheckBoxEnableLogging_StateChange(wxCommandEvent& WXUNUSED (event))
{
ActionReplay_EnableSelfLogging(m_CheckBox_LogAR->IsChecked());
EnableSelfLogging(m_CheckBox_LogAR->IsChecked());
}

View File

@ -36,9 +36,6 @@
#include "Filesystem.h"
#include "IniFile.h"
#undef wxCHEATSWINDOW_STYLE
#define wxCHEATSWINDOW_STYLE wxCAPTION | wxSYSTEM_MENU | wxCLOSE_BOX | wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE
class wxCheatsWindow : public wxFrame
{
public:

View File

@ -22,18 +22,19 @@
#include <wx/gbsizer.h>
#include <wx/notebook.h>
#include <wx/filepicker.h>
//#include <wx/listbox.h>
#include "Config.h"
#undef CONFIG_MAIN_STYLE
#define CONFIG_MAIN_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX
class CConfigMain
: public wxDialog
{
public:
CConfigMain(wxWindow* parent, wxWindowID id = 1, const wxString& title = wxT("Dolphin Configuration"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = CONFIG_MAIN_STYLE);
CConfigMain(wxWindow* parent,
wxWindowID id = 1,
const wxString& title = wxT("Dolphin Configuration"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE);
virtual ~CConfigMain();
void CloseClick(wxCommandEvent& event);
void OnSelectionChanged(wxCommandEvent& event);

View File

@ -22,20 +22,14 @@
#include "Filesystem.h"
#include "ISOProperties.h"
#include "PatchAddEdit.h"
#include "ARCodeAddEdit.h"
DiscIO::IVolume *OpenISO = NULL;
DiscIO::IFileSystem *pFileSystem = NULL;
std::vector<PatchEngine::Patch> onFrame;
struct ARListCode {
std::string name;
bool enabled;
std::vector<std::string> ops;
u32 uiIndex;
};
std::vector<ARListCode> ARCodes;
std::vector<ActionReplay::ARCode> arCodes;
BEGIN_EVENT_TABLE(CISOProperties, wxDialog)
@ -698,86 +692,58 @@ void CISOProperties::PatchButtonClicked(wxCommandEvent& event)
void CISOProperties::ActionReplayList_Load()
{
ARCodes.clear();
arCodes.clear();
Cheats->Clear();
std::vector<std::string> lines;
ActionReplay::LoadCodes(arCodes, GameIni);
if (!GameIni.GetLines("ActionReplay", lines))
return;
ARListCode code;
for (std::vector<std::string>::const_iterator it = lines.begin(); it != lines.end(); ++it)
u32 index = 0;
for (std::vector<ActionReplay::ARCode>::const_iterator it = arCodes.begin(); it != arCodes.end(); ++it)
{
std::string line = *it;
if (line[0] == '+' || line[0] == '$')
{
// Take care of the previous code
if (code.ops.size())
{
code.uiIndex = Cheats->Append(wxString::FromAscii(code.name.c_str()));
ARCodes.push_back(code);
Cheats->Check(code.uiIndex, code.enabled);
code.ops.clear();
}
// Give name and enabled to current code
if(line.size() > 1)
{
if (line[0] == '+')
{
code.enabled = true;
code.name = line.substr(2, line.size() - 2);
}
else
{
code.enabled = false;
code.name = line.substr(1, line.size() - 1);
}
}
continue;
}
code.ops.push_back(line);
}
if (code.ops.size())
{
code.uiIndex = Cheats->Append(wxString::FromAscii(code.name.c_str()));
ARCodes.push_back(code);
Cheats->Check(code.uiIndex, code.enabled);
ActionReplay::ARCode arCode = *it;
Cheats->Append(wxString::FromAscii(arCode.name.c_str()));
Cheats->Check(index, arCode.active);
++index;
}
}
void CISOProperties::ActionReplayList_Save()
{
std::vector<std::string> lines;
for (std::vector<ARListCode>::const_iterator iter = ARCodes.begin(); iter != ARCodes.end(); ++iter)
u32 index = 0;
for (std::vector<ActionReplay::ARCode>::const_iterator iter = arCodes.begin(); iter != arCodes.end(); ++iter)
{
ARListCode code = *iter;
ActionReplay::ARCode code = *iter;
lines.push_back(Cheats->IsChecked(code.uiIndex) ? "+$" + code.name : "$" + code.name);
lines.push_back(Cheats->IsChecked(index) ? "+$" + code.name : "$" + code.name);
for (std::vector<std::string>::const_iterator iter2 = code.ops.begin(); iter2 != code.ops.end(); ++iter2)
for (std::vector<ActionReplay::AREntry>::const_iterator iter2 = code.ops.begin(); iter2 != code.ops.end(); ++iter2)
{
lines.push_back(*iter2);
lines.push_back(wxString::Format("%08X %08X", iter2->cmd_addr, iter2->value).mb_str());
}
++index;
}
GameIni.SetLines("ActionReplay", lines);
}
void CISOProperties::ActionReplayButtonClicked(wxCommandEvent& event)
{
int selection = Cheats->GetSelection();
switch (event.GetId())
{
case ID_EDITCHEAT:
// dialog
{
CARCodeAddEdit dlg(selection, this);
dlg.ShowModal();
}
break;
case ID_ADDCHEAT:
{
// dialog
}
break;
case ID_REMOVECHEAT:
ARCodes.erase(ARCodes.begin() + Cheats->GetSelection());
arCodes.erase(arCodes.begin() + Cheats->GetSelection());
break;
}

View File

@ -32,15 +32,19 @@
#include "Filesystem.h"
#include "IniFile.h"
#include "PatchEngine.h"
#undef ISOPROPERTIES_STYLE
#define ISOPROPERTIES_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX
#include "ActionReplay.h"
class CISOProperties : public wxDialog
{
public:
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);
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 = wxDEFAULT_DIALOG_STYLE);
virtual ~CISOProperties();
bool bRefreshList;

View File

@ -25,7 +25,12 @@
class CPatchAddEdit : public wxDialog
{
public:
CPatchAddEdit(int _selection, wxWindow* parent, wxWindowID id = 1, const wxString& title = wxT("Edit Patch"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(300, -1), long style = wxDEFAULT_DIALOG_STYLE);
CPatchAddEdit(int _selection, wxWindow* parent,
wxWindowID id = 1,
const wxString& title = wxT("Edit Patch"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxSize(300, -1),
long style = wxDEFAULT_DIALOG_STYLE);
virtual ~CPatchAddEdit();
private:

View File

@ -18,6 +18,7 @@ libs = [
if wxenv['HAVE_WX']:
files += [
'AboutDolphin.cpp',
'ARCodeAddEdit.cpp',
'ConfigMain.cpp',
'Frame.cpp',
'GameListCtrl.cpp',
@ -27,10 +28,10 @@ if wxenv['HAVE_WX']:
'MemcardManager.cpp',
'MemoryCards/GCMemcard.cpp',
'PluginManager.cpp',
'PatchAddEdit.cpp',
'PatchAddEdit.cpp',
'CheatsWindow.cpp',
'stdafx.cpp',
'FrameWiimote.cpp',
'FrameWiimote.cpp',
]
CPPDEFINES = [

View File

@ -15,6 +15,7 @@
#define PAD_ERR_TRANSFER -3
#define PAD_USE_ORIGIN 0x0080
#define PAD_BUTTON_LEFT 0x0001
#define PAD_BUTTON_RIGHT 0x0002
#define PAD_BUTTON_DOWN 0x0004
@ -32,13 +33,13 @@ typedef void (*TLog)(const char* _pMessage);
typedef struct
{
HWND hWnd;
TLog pLog;
HWND hWnd;
TLog pLog;
} SPADInitialize;
typedef struct
{
unsigned short button; // Or-ed PAD_BUTTON_* bits
unsigned short button; // Or-ed PAD_BUTTON_* and PAD_TRIGGER_* bits
unsigned char stickX; // 0 <= stickX <= 255
unsigned char stickY; // 0 <= stickY <= 255
unsigned char substickX; // 0 <= substickX <= 255
@ -47,7 +48,7 @@ typedef struct
unsigned char triggerRight; // 0 <= triggerRight <= 255
unsigned char analogA; // 0 <= analogA <= 255
unsigned char analogB; // 0 <= analogB <= 255
bool MicButton;
bool MicButton; // HAX
signed char err; // one of PAD_ERR_* number
} SPADStatus;
@ -59,7 +60,7 @@ typedef struct
// Function: GetDllInfo
// Purpose: This function allows the emulator to gather information
// about the DLL by filling in the PluginInfo structure.
// input: a pointer to a PLUGIN_INFO structure that needs to be
// input: A pointer to a PLUGIN_INFO structure that needs to be
// filled by the function. (see def above)
// output: none
//
@ -69,7 +70,7 @@ EXPORT void CALL GetDllInfo(PLUGIN_INFO* _pPluginInfo);
// Function: DllConfig
// Purpose: This function is optional function that is provided
// to allow the user to configure the DLL
// input: a handle to the window that calls this function
// input: A handle to the window that calls this function
// output: none
//
EXPORT void CALL DllConfig(HWND _hParent);

View File

@ -32,9 +32,6 @@
#ifndef _WIN32
#include "../XInputBase.h"
#endif
#undef CONFIGDIALOG_STYLE
#define CONFIGDIALOG_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX
class ConfigDialog : public wxDialog
{
@ -42,7 +39,7 @@ class ConfigDialog : public wxDialog
public:
ConfigDialog(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("Pad Configuration"),
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = CONFIGDIALOG_STYLE);
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE);
virtual ~ConfigDialog();

View File

@ -43,11 +43,6 @@
class CPBView;
class IniFile;
// Window settings - I'm not sure what these do. I just copied them gtom elsewhere basically.
#undef CDebugger_STYLE
#define CDebugger_STYLE wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE
class CDebugger : public wxDialog
{
private:
@ -56,7 +51,7 @@ class CDebugger : public wxDialog
public:
CDebugger(wxWindow *parent, wxWindowID id = 1, const wxString &title = _("Sound Debugger"),
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = CDebugger_STYLE);
long style = wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE);
virtual ~CDebugger();

View File

@ -15,8 +15,8 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef __CONFIGDIALOG_h__
#define __CONFIGDIALOG_h__
#ifndef __OGL_CONFIGDIALOG_h__
#define __OGL_CONFIGDIALOG_h__
#include <wx/wx.h>
#include <wx/dialog.h>
@ -32,14 +32,11 @@
#include <wx/gbsizer.h>
#undef ConfigDialog_STYLE
#define ConfigDialog_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX
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);
ConfigDialog(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("OpenGL Plugin Configuration"),
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE);
virtual ~ConfigDialog();
void CloseClick(wxCommandEvent& event);

View File

@ -31,17 +31,13 @@
#include <wx/gbsizer.h>
#undef ConfigDialog_STYLE
#define ConfigDialog_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX
class ConfigDialog : public wxDialog
{
public:
ConfigDialog(wxWindow *parent, wxWindowID id = 1,
const wxString &title = wxT("Wii Remote Plugin Configuration"),
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = ConfigDialog_STYLE);
long style = wxDEFAULT_DIALOG_STYLE);
virtual ~ConfigDialog();
void CloseClick(wxCommandEvent& event);

View File

@ -44,8 +44,6 @@
#include <wx/statbox.h>
#include <wx/statbmp.h>
#undef AboutBox_STYLE
#define AboutBox_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX
class AboutBox : public wxDialog
{
@ -53,7 +51,8 @@ class AboutBox : public wxDialog
DECLARE_EVENT_TABLE();
public:
AboutBox(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("About: nJoy Input Plugin"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = AboutBox_STYLE);
AboutBox(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("About: nJoy Input Plugin"),
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE);
virtual ~AboutBox();
void OKClick(wxCommandEvent& event);

View File

@ -46,8 +46,6 @@
#include <wx/panel.h>
#include <wx/statbmp.h>
#undef ConfigBox_STYLE
#define ConfigBox_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX
class ConfigBox : public wxDialog
{
@ -55,7 +53,8 @@ class ConfigBox : public wxDialog
DECLARE_EVENT_TABLE();
public:
ConfigBox(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("Configure: nJoy Input Plugin"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = ConfigBox_STYLE);
ConfigBox(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("Configure: nJoy Input Plugin"),
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE);
virtual ~ConfigBox();
private:

View File

@ -44,8 +44,6 @@
#include <wx/statbox.h>
#include <wx/statbmp.h>
#undef AboutBox_STYLE
#define AboutBox_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX
class AboutBox : public wxDialog
{
@ -53,7 +51,8 @@ class AboutBox : public wxDialog
DECLARE_EVENT_TABLE();
public:
AboutBox(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("About: nJoy Input Plugin"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = AboutBox_STYLE);
AboutBox(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("About: nJoy Input Plugin"),
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE);
virtual ~AboutBox();
void OKClick(wxCommandEvent& event);

View File

@ -46,8 +46,6 @@
#include <wx/panel.h>
#include <wx/statbmp.h>
#undef ConfigBox_STYLE
#define ConfigBox_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX
class ConfigBox : public wxDialog
{
@ -55,7 +53,8 @@ class ConfigBox : public wxDialog
DECLARE_EVENT_TABLE();
public:
ConfigBox(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("Configure: nJoy Input Plugin"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = ConfigBox_STYLE);
ConfigBox(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("Configure: nJoy Input Plugin"),
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE);
virtual ~ConfigBox();
private: