diff options
| author | omegadox <omegadox@gmail.com> | 2008-11-30 11:13:14 +0000 |
|---|---|---|
| committer | omegadox <omegadox@gmail.com> | 2008-11-30 11:13:14 +0000 |
| commit | ca3e5befd90746ac09ea917c78a177e8f163f2ad (patch) | |
| tree | b15b2347c692dd57ee198ef0fc6a3ec532d6ef97 /Source | |
| parent | 6ccf90bbbae87449504205a7d5bc5e497eccbc05 (diff) | |
Added a window for the Action Replay.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1333 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source')
| -rw-r--r-- | Source/Core/Core/Src/ActionReplay.cpp | 80 | ||||
| -rw-r--r-- | Source/Core/Core/Src/ActionReplay.h | 5 | ||||
| -rw-r--r-- | Source/Core/DolphinWX/DolphinWX.vcproj | 20 | ||||
| -rw-r--r-- | Source/Core/DolphinWX/Src/Frame.cpp | 14 | ||||
| -rw-r--r-- | Source/Core/DolphinWX/Src/Frame.h | 4 | ||||
| -rw-r--r-- | Source/Core/DolphinWX/Src/Globals.h | 1 | ||||
| -rw-r--r-- | Source/Core/DolphinWX/Src/SConscript | 1 |
7 files changed, 102 insertions, 23 deletions
diff --git a/Source/Core/Core/Src/ActionReplay.cpp b/Source/Core/Core/Src/ActionReplay.cpp index 0f0fa61ffd..d77241026c 100644 --- a/Source/Core/Core/Src/ActionReplay.cpp +++ b/Source/Core/Core/Src/ActionReplay.cpp @@ -39,13 +39,14 @@ namespace
{
static std::vector<AREntry>::const_iterator iter;
- static std::vector<ARCode> arCodes;
static ARCode code;
static bool b_RanOnce = false;
+ static std::vector<ARCode> arCodes;
+ static std::vector<ARCode> activeCodes;
} // namespace
void LogInfo(const char *format, ...);
-// --Codes--
+// --- Codes ---
// SubTypes (Normal 0 Codes)
bool Subtype_RamWriteAndFill(u32 addr, u32 data);
bool Subtype_WriteToPointer(u32 addr, u32 data);
@@ -64,9 +65,9 @@ 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);
-// Parses the Action Replay section of a game ini file.
void LoadActionReplayCodes(IniFile &ini)
{
+ // Parses the Action Replay section of a game ini file.
if (!Core::GetStartupParameter().bEnableCheats)
return; // If cheats are off, do not load them
@@ -88,7 +89,7 @@ void LoadActionReplayCodes(IniFile &ini) {
if (currentCode.ops.size())
{
- if (currentCode.active) arCodes.push_back(currentCode); //temp hack to not store inactive codes
+ arCodes.push_back(currentCode);
currentCode.ops.clear();
}
if (encryptedLines.size())
@@ -98,13 +99,21 @@ void LoadActionReplayCodes(IniFile &ini) currentCode.ops.clear();
encryptedLines.clear();
}
- currentCode.name = line;
- if (line[0] == '+'){
- Core::DisplayMessage("AR code active: " + line, 5000);
- currentCode.active = true;
+
+ if(line.size() > 1)
+ {
+ if (line[0] == '+')
+ {
+ currentCode.active = true;
+ currentCode.name = line.substr(2, line.size() - 2);;
+ Core::DisplayMessage("AR code active: " + currentCode.name, 5000);
+ }
+ else
+ {
+ currentCode.active = false;
+ currentCode.name = line.substr(1, line.size() - 1);
+ }
}
- else
- currentCode.active = false;
continue;
}
@@ -147,6 +156,8 @@ void LoadActionReplayCodes(IniFile &ini) DecryptARCode(encryptedLines, currentCode.ops);
arCodes.push_back(currentCode);
}
+
+ ActionReplay_UpdateActiveList();
}
void LogInfo(const char *format, ...)
@@ -164,7 +175,7 @@ void LogInfo(const char *format, ...) void ActionReplayRunAllActive()
{
if (Core::GetStartupParameter().bEnableCheats) {
- for (std::vector<ARCode>::iterator iter = arCodes.begin(); iter != arCodes.end(); ++iter)
+ for (std::vector<ARCode>::iterator iter = activeCodes.begin(); iter != activeCodes.end(); ++iter)
if (iter->active) {
if(!RunActionReplayCode(*iter))
iter->active = false;
@@ -176,11 +187,9 @@ void ActionReplayRunAllActive() }
-// The mechanism is slightly different than what the real AR uses, so there may be compatibility problems.
-// For example, some authors have created codes that add features to AR. Hacks for popular ones can be added here,
-// but the problem is not generally solvable.
-// TODO: what is "nowIsBootup" for?
+
bool RunActionReplayCode(const ARCode &arcode) {
+ // The mechanism is slightly different than what the real AR uses, so there may be compatibility problems.
u8 cmd;
u32 addr;
u32 data;
@@ -216,6 +225,9 @@ bool RunActionReplayCode(const ARCode &arcode) { if (!skip && count == 0) { LogInfo("Line skipped"); continue; }// Skip rest of lines
if (!skip && count > 0) count--; // execute n lines
// if -2 : execute all lines
+
+ if(b_RanOnce)
+ b_RanOnce = false;
}
cmd = iter->cmd_addr >> 24; // AR command
@@ -348,6 +360,10 @@ bool RunActionReplayCode(const ARCode &arcode) { PanicAlert("Action Replay: Invalid Normal Code Type %08x (%s)", type, code.name.c_str());
}
}
+
+ if(b_RanOnce && cond)
+ b_RanOnce = true;
+
return true;
}
@@ -926,3 +942,37 @@ bool NormalCode_Type_7(u8 subtype, u32 addr, u32 data, int *count, bool *skip) }
return true;
}
+
+size_t ActionReplay_GetCodeListSize()
+{
+ return arCodes.size();
+}
+ARCode ActionReplay_GetARCode(size_t index)
+{
+ if (index > arCodes.size())
+ {
+ PanicAlert("ActionReplay_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)
+{
+ if (index > arCodes.size())
+ {
+ PanicAlert("ActionReplay_SetARCode_IsActive: Index is greater than ar code list size %i", index);
+ return;
+ }
+ arCodes[index].active = active;
+ ActionReplay_UpdateActiveList();
+}
+void ActionReplay_UpdateActiveList()
+{
+ b_RanOnce = false;
+ activeCodes.clear();
+ for (size_t i = 0; i < arCodes.size(); i++)
+ {
+ if (arCodes[i].active)
+ activeCodes.push_back(arCodes[i]);
+ }
+}
diff --git a/Source/Core/Core/Src/ActionReplay.h b/Source/Core/Core/Src/ActionReplay.h index ff98898c8f..5c92d3c070 100644 --- a/Source/Core/Core/Src/ActionReplay.h +++ b/Source/Core/Core/Src/ActionReplay.h @@ -14,6 +14,7 @@ // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
+
#ifndef _ACTIONREPLAY_H_
#define _ACTIONREPLAY_H_
@@ -33,5 +34,9 @@ struct ARCode { 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();
#endif //_ACTIONREPLAY_H_
diff --git a/Source/Core/DolphinWX/DolphinWX.vcproj b/Source/Core/DolphinWX/DolphinWX.vcproj index e4a84ba5a2..d005b9448c 100644 --- a/Source/Core/DolphinWX/DolphinWX.vcproj +++ b/Source/Core/DolphinWX/DolphinWX.vcproj @@ -127,7 +127,7 @@ <Tool
Name="VCPostBuildEventTool"
Description="Copying Data\* to $(TargetDir)"
- CommandLine="xcopy "$(SolutionDir)..\Data" "$(TargetDir)" /s /e /q /d
echo Copying External .dlls
xcopy "$(SolutionDir)..\Externals\Cg\*.dll" "$(TargetDir)" /s /e /q /d
xcopy "$(SolutionDir)..\Externals\SDL\win32\*.dll" "$(TargetDir)" /s /e /q /d
xcopy "$(SolutionDir)..\Externals\WiiUse\Win32\*.dll" "$(TargetDir)" /s /e /q /d"
+ CommandLine="xcopy "$(SolutionDir)..\Data" "$(TargetDir)" /s /e /q /d
echo Copying External .dlls
xcopy "$(SolutionDir)..\Externals\Cg\*.dll" "$(TargetDir)" /s /e /q /d
xcopy "$(SolutionDir)..\Externals\SDL\win32\*.dll" "$(TargetDir)" /s /e /q /d
xcopy "$(SolutionDir)..\Externals\WiiUse\Win32\*.dll" "$(TargetDir)" /s /e /q /d
"
/>
</Configuration>
<Configuration
@@ -238,7 +238,7 @@ <Tool
Name="VCPostBuildEventTool"
Description="Copying Data\* to $(TargetDir)"
- CommandLine="xcopy "$(SolutionDir)..\Data" "$(TargetDir)" /s /e /q /d
echo Copying External .dlls
xcopy "$(SolutionDir)..\Externals\Cg64\*.dll" "$(TargetDir)" /s /e /q /d
xcopy "$(SolutionDir)..\Externals\SDL\x64\*.dll" "$(TargetDir)" /s /e /q /d
xcopy "$(SolutionDir)..\Externals\WiiUse\X64\*.dll" "$(TargetDir)" /s /e /q /d"
+ CommandLine="xcopy "$(SolutionDir)..\Data" "$(TargetDir)" /s /e /q /d
echo Copying External .dlls
xcopy "$(SolutionDir)..\Externals\Cg64\*.dll" "$(TargetDir)" /s /e /q /d
xcopy "$(SolutionDir)..\Externals\SDL\x64\*.dll" "$(TargetDir)" /s /e /q /d
xcopy "$(SolutionDir)..\Externals\WiiUse\X64\*.dll" "$(TargetDir)" /s /e /q /d
"
/>
</Configuration>
<Configuration
@@ -347,7 +347,7 @@ <Tool
Name="VCPostBuildEventTool"
Description="Copying Data\* to $(TargetDir)"
- CommandLine="xcopy "$(SolutionDir)..\Data" "$(TargetDir)" /s /e /q /d
echo Copying External .dlls
xcopy "$(SolutionDir)..\Externals\Cg\*.dll" "$(TargetDir)" /s /e /q /d
xcopy "$(SolutionDir)..\Externals\SDL\win32\*.dll" "$(TargetDir)" /s /e /q /d
xcopy "$(SolutionDir)..\Externals\WiiUse\Win32\*.dll" "$(TargetDir)" /s /e /q /d"
+ CommandLine="xcopy "$(SolutionDir)..\Data" "$(TargetDir)" /s /e /q /d
echo Copying External .dlls
xcopy "$(SolutionDir)..\Externals\Cg\*.dll" "$(TargetDir)" /s /e /q /d
xcopy "$(SolutionDir)..\Externals\SDL\win32\*.dll" "$(TargetDir)" /s /e /q /d
xcopy "$(SolutionDir)..\Externals\WiiUse\Win32\*.dll" "$(TargetDir)" /s /e /q /d
"
/>
</Configuration>
<Configuration
@@ -456,7 +456,7 @@ <Tool
Name="VCPostBuildEventTool"
Description="Copying Data\* to $(TargetDir)"
- CommandLine="xcopy "$(SolutionDir)..\Data" "$(TargetDir)" /s /e /q /d
echo Copying External .dlls
xcopy "$(SolutionDir)..\Externals\Cg64\*.dll" "$(TargetDir)" /s /e /q /d
xcopy "$(SolutionDir)..\Externals\SDL\x64\*.dll" "$(TargetDir)" /s /e /q /d
xcopy "$(SolutionDir)..\Externals\WiiUse\X64\*.dll" "$(TargetDir)" /s /e /q /d"
+ CommandLine="xcopy "$(SolutionDir)..\Data" "$(TargetDir)" /s /e /q /d
echo Copying External .dlls
xcopy "$(SolutionDir)..\Externals\Cg64\*.dll" "$(TargetDir)" /s /e /q /d
xcopy "$(SolutionDir)..\Externals\SDL\x64\*.dll" "$(TargetDir)" /s /e /q /d
xcopy "$(SolutionDir)..\Externals\WiiUse\X64\*.dll" "$(TargetDir)" /s /e /q /d
"
/>
</Configuration>
<Configuration
@@ -567,7 +567,7 @@ <Tool
Name="VCPostBuildEventTool"
Description="Copying Data\* to $(TargetDir)"
- CommandLine="xcopy "$(SolutionDir)..\Data" "$(TargetDir)" /s /e /q /d
echo Copying External .dlls
xcopy "$(SolutionDir)..\Externals\Cg\*.dll" "$(TargetDir)" /s /e /q /d
xcopy "$(SolutionDir)..\Externals\SDL\win32\*.dll" "$(TargetDir)" /s /e /q /d
xcopy "$(SolutionDir)..\Externals\WiiUse\Win32\*.dll" "$(TargetDir)" /s /e /q /d"
+ CommandLine="xcopy "$(SolutionDir)..\Data" "$(TargetDir)" /s /e /q /d
echo Copying External .dlls
xcopy "$(SolutionDir)..\Externals\Cg\*.dll" "$(TargetDir)" /s /e /q /d
xcopy "$(SolutionDir)..\Externals\SDL\win32\*.dll" "$(TargetDir)" /s /e /q /d
xcopy "$(SolutionDir)..\Externals\WiiUse\Win32\*.dll" "$(TargetDir)" /s /e /q /d
"
/>
</Configuration>
<Configuration
@@ -676,7 +676,7 @@ <Tool
Name="VCPostBuildEventTool"
Description="Copying Data\* to $(TargetDir)"
- CommandLine="xcopy "$(SolutionDir)..\Data" "$(TargetDir)" /s /e /q /d
echo Copying External .dlls
xcopy "$(SolutionDir)..\Externals\Cg64\*.dll" "$(TargetDir)" /s /e /q /d
xcopy "$(SolutionDir)..\Externals\SDL\x64\*.dll" "$(TargetDir)" /s /e /q /d
xcopy "$(SolutionDir)..\Externals\WiiUse\X64\*.dll" "$(TargetDir)" /s /e /q /d"
+ CommandLine="xcopy "$(SolutionDir)..\Data" "$(TargetDir)" /s /e /q /d
echo Copying External .dlls
xcopy "$(SolutionDir)..\Externals\Cg64\*.dll" "$(TargetDir)" /s /e /q /d
xcopy "$(SolutionDir)..\Externals\SDL\x64\*.dll" "$(TargetDir)" /s /e /q /d
xcopy "$(SolutionDir)..\Externals\WiiUse\X64\*.dll" "$(TargetDir)" /s /e /q /d
"
/>
</Configuration>
</Configurations>
@@ -763,6 +763,14 @@ >
</File>
<File
+ RelativePath=".\Src\CheatsWindow.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Src\CheatsWindow.h"
+ >
+ </File>
+ <File
RelativePath=".\src\ConfigMain.cpp"
>
</File>
diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index aead7a10e8..8b2bb43dfc 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -29,6 +29,7 @@ #include "ConfigMain.h"
#include "PluginManager.h"
#include "MemcardManager.h"
+#include "CheatsWindow.h"
#include "AboutDolphin.h"
#include <wx/mstream.h>
@@ -96,6 +97,7 @@ EVT_MENU(IDM_CONFIG_PAD_PLUGIN, CFrame::OnPluginPAD) EVT_MENU(IDM_CONFIG_WIIMOTE_PLUGIN, CFrame::OnPluginWiimote)
EVT_MENU(IDM_BROWSE, CFrame::OnBrowse)
EVT_MENU(IDM_MEMCARD, CFrame::OnMemcard)
+EVT_MENU(IDM_CHEATS, OnShow_CheatsWindow)
EVT_MENU(IDM_TOGGLE_FULLSCREEN, CFrame::OnToggleFullscreen)
EVT_MENU(IDM_TOGGLE_DUALCORE, CFrame::OnToggleDualCore)
EVT_MENU(IDM_TOGGLE_SKIPIDLE, CFrame::OnToggleSkipIdle)
@@ -125,6 +127,12 @@ EVT_HOST_COMMAND(wxID_ANY, CFrame::OnHostMessage) END_EVENT_TABLE()
// ----------------------------------------------------------------------------
+// Other Windows
+// ----------------------------------------------------------------------------
+
+wxCheatsWindow* CheatsWindow;
+
+// ----------------------------------------------------------------------------
// implementation
// ----------------------------------------------------------------------------
@@ -252,6 +260,7 @@ void CFrame::CreateMenu() miscMenu->Check(IDM_TOGGLE_STATUSBAR, true);
miscMenu->AppendSeparator();
miscMenu->Append(IDM_MEMCARD, _T("&Memcard manager"));
+ miscMenu->Append(IDM_CHEATS, _T("Action &Replay Manager"));
m_pMenuBar->Append(miscMenu, _T("&Misc"));
// help menu
@@ -508,6 +517,11 @@ void CFrame::OnMemcard(wxCommandEvent& WXUNUSED (event)) MemcardManager.ShowModal();
}
+void CFrame::OnShow_CheatsWindow(wxCommandEvent& WXUNUSED (event))
+{
+ CheatsWindow = new wxCheatsWindow(this, wxDefaultPosition, wxSize(600, 390));
+}
+
void CFrame::OnHostMessage(wxCommandEvent& event)
{
switch (event.GetId())
diff --git a/Source/Core/DolphinWX/Src/Frame.h b/Source/Core/DolphinWX/Src/Frame.h index 6d419de80b..64324fd969 100644 --- a/Source/Core/DolphinWX/Src/Frame.h +++ b/Source/Core/DolphinWX/Src/Frame.h @@ -13,7 +13,7 @@ class CFrame : public wxFrame const wxString& title = _T("Dolphin"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
- long style = wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE);
+ long style = wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE);
void* GetRenderHandle() {return(m_Panel->GetHandle());}
@@ -70,6 +70,7 @@ class CFrame : public wxFrame void OnStop(wxCommandEvent& event);
void OnBrowse(wxCommandEvent& event);
void OnMemcard(wxCommandEvent& event);
+ void OnShow_CheatsWindow(wxCommandEvent& event);
void OnToggleFullscreen(wxCommandEvent& event);
void OnToggleDualCore(wxCommandEvent& event);
void OnToggleSkipIdle(wxCommandEvent& event);
@@ -82,7 +83,6 @@ class CFrame : public wxFrame void OnSaveState(wxCommandEvent& event);
void OnClose(wxCloseEvent &event);
-
wxStatusBar* m_pStatusBar;
wxMenuBar* m_pMenuBar;
diff --git a/Source/Core/DolphinWX/Src/Globals.h b/Source/Core/DolphinWX/Src/Globals.h index 591697c708..edaa2af118 100644 --- a/Source/Core/DolphinWX/Src/Globals.h +++ b/Source/Core/DolphinWX/Src/Globals.h @@ -46,6 +46,7 @@ enum IDM_STOP,
IDM_BROWSE,
IDM_MEMCARD,
+ IDM_CHEATS,
IDM_PROPERTIES,
IDM_OPENCONTAININGFOLDER,
IDM_SETDEFAULTGCM,
diff --git a/Source/Core/DolphinWX/Src/SConscript b/Source/Core/DolphinWX/Src/SConscript index 36f28c72cd..7bb1b2c78b 100644 --- a/Source/Core/DolphinWX/Src/SConscript +++ b/Source/Core/DolphinWX/Src/SConscript @@ -21,6 +21,7 @@ if not env['osx64']: 'MemcardManager.cpp', 'MemoryCards/GCMemcard.cpp', 'PluginManager.cpp', + 'CheatsWindow.cpp', 'stdafx.cpp', ] |
