Added a window for the Action Replay.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1333 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
6ccf90bbba
commit
ca3e5befd9
|
@ -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);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
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]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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_
|
||||
|
|
|
@ -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>
|
||||
|
@ -762,6 +762,14 @@
|
|||
RelativePath=".\Src\AboutDolphin.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\CheatsWindow.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\CheatsWindow.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ConfigMain.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)
|
||||
|
@ -124,6 +126,12 @@ EVT_MENU(IDM_SAVESLOT10, CFrame::OnSaveState)
|
|||
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())
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ enum
|
|||
IDM_STOP,
|
||||
IDM_BROWSE,
|
||||
IDM_MEMCARD,
|
||||
IDM_CHEATS,
|
||||
IDM_PROPERTIES,
|
||||
IDM_OPENCONTAININGFOLDER,
|
||||
IDM_SETDEFAULTGCM,
|
||||
|
|
|
@ -21,6 +21,7 @@ if not env['osx64']:
|
|||
'MemcardManager.cpp',
|
||||
'MemoryCards/GCMemcard.cpp',
|
||||
'PluginManager.cpp',
|
||||
'CheatsWindow.cpp',
|
||||
'stdafx.cpp',
|
||||
]
|
||||
|
||||
|
|
Loading…
Reference in New Issue