mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-26 15:49:50 -06:00
Rerecording: Added frame step function and status bar for the input recording. Turn on frame stepping with Ctrl, step with Space. Build the Rerecording version with the setting in Setup.h.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2273 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -47,6 +47,8 @@ be accessed from Core::GetWindowHandle().
|
||||
#include "Common.h" // Common
|
||||
#include "FileUtil.h"
|
||||
#include "Timer.h"
|
||||
#include "Setup.h"
|
||||
#include "ConsoleWindow.h"
|
||||
|
||||
#include "ConfigManager.h" // Core
|
||||
#include "Core.h"
|
||||
@ -352,6 +354,13 @@ CFrame::CFrame(wxFrame* parent,
|
||||
// ----------
|
||||
|
||||
UpdateGUI();
|
||||
|
||||
// If we are rerecording create the status bar now instead of later when a game starts
|
||||
#ifdef RERECORDING
|
||||
ModifyStatusBar();
|
||||
// It's to early for the OnHostMessage(), we will update the status when Ctrl or Space is pressed
|
||||
//Core::WriteStatus();
|
||||
#endif
|
||||
}
|
||||
|
||||
// Destructor
|
||||
@ -439,18 +448,27 @@ void CFrame::OnKeyDown(wxKeyEvent& event)
|
||||
UpdateGUI();
|
||||
}
|
||||
#ifdef _WIN32
|
||||
else if(event.GetKeyCode() == 'E') // Send this to the video plugin WndProc
|
||||
if(event.GetKeyCode() == 'E') // Send this to the video plugin WndProc
|
||||
{
|
||||
PostMessage((HWND)Core::GetWindowHandle(), WM_KEYDOWN, event.GetKeyCode(), 0);
|
||||
event.Skip(); // Don't block the E key
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
if(Core::GetState() != Core::CORE_UNINITIALIZED)
|
||||
CPluginManager::GetInstance().GetPad(0)->PAD_Input(event.GetKeyCode(), 1); // 1 = Down
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
#ifdef RERECORDING
|
||||
// Turn on or off frame advance
|
||||
if (event.GetKeyCode() == WXK_CONTROL) Core::FrameStepOnOff();
|
||||
|
||||
// Step forward
|
||||
if (event.GetKeyCode() == WXK_SPACE) Core::FrameAdvance();
|
||||
#endif
|
||||
|
||||
// Send the keyboard status to the Input plugin
|
||||
if(Core::GetState() != Core::CORE_UNINITIALIZED)
|
||||
CPluginManager::GetInstance().GetPad(0)->PAD_Input(event.GetKeyCode(), 1); // 1 = Down
|
||||
|
||||
// Don't block other events
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void CFrame::OnKeyUp(wxKeyEvent& event)
|
||||
|
@ -219,7 +219,6 @@ class CFrame : public wxFrame
|
||||
wxToolBarToolBase* m_pToolPlay;
|
||||
|
||||
void UpdateGUI();
|
||||
|
||||
void BootGame();
|
||||
|
||||
// Double click and mouse move options
|
||||
|
@ -49,6 +49,7 @@ be accessed from Core::GetWindowHandle().
|
||||
#include "FileUtil.h"
|
||||
#include "Timer.h"
|
||||
#include "ConsoleWindow.h"
|
||||
#include "Setup.h"
|
||||
|
||||
#include "ConfigManager.h" // Core
|
||||
#include "Core.h"
|
||||
@ -316,7 +317,7 @@ void CFrame::InitBitmaps()
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// Music modification
|
||||
// Music modification
|
||||
// -------------
|
||||
#ifdef MUSICMOD
|
||||
MM_InitBitmaps(Theme);
|
||||
@ -327,12 +328,21 @@ void CFrame::InitBitmaps()
|
||||
if (GetToolBar() != NULL) RecreateToolbar();
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
// Start the game or change the disc
|
||||
// -------------
|
||||
void CFrame::BootGame()
|
||||
{
|
||||
#ifdef MUSICMOD // Music modification
|
||||
// Music modification
|
||||
#ifdef MUSICMOD
|
||||
MM_OnPlay();
|
||||
#endif
|
||||
|
||||
// Rerecording
|
||||
#ifdef RERECORDING
|
||||
Core::RerecordingStart();
|
||||
#endif
|
||||
|
||||
// shuffle2: wxBusyInfo is meant to be created on the stack
|
||||
// and only stay around for the life of the scope it's in.
|
||||
@ -447,8 +457,16 @@ void CFrame::OnChangeDisc(wxCommandEvent& WXUNUSED (event))
|
||||
DVDInterface::SetLidOpen(false);
|
||||
}
|
||||
|
||||
void CFrame::OnPlay(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
BootGame();
|
||||
}
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
// Refresh the file list and browse for a favorites directory
|
||||
// -------------
|
||||
void CFrame::OnRefresh(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
if (m_GameListCtrl)
|
||||
@ -462,17 +480,23 @@ void CFrame::OnBrowse(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
m_GameListCtrl->BrowseForDirectory();
|
||||
}
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
void CFrame::OnPlay(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
BootGame();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
// Stop the emulation
|
||||
// -------------
|
||||
void CFrame::DoStop()
|
||||
{
|
||||
#ifdef MUSICMOD // Music modification
|
||||
// Music modification
|
||||
#ifdef MUSICMOD
|
||||
MM_OnStop();
|
||||
#endif
|
||||
|
||||
// Rerecording
|
||||
#ifdef RERECORDING
|
||||
Core::RerecordingStop();
|
||||
#endif
|
||||
|
||||
if (Core::GetState() != Core::CORE_UNINITIALIZED)
|
||||
{
|
||||
@ -506,6 +530,7 @@ void CFrame::OnStop(wxCommandEvent& WXUNUSED (event))
|
||||
|
||||
if (answer) DoStop();
|
||||
}
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
|
||||
void CFrame::OnConfigMain(wxCommandEvent& WXUNUSED (event))
|
||||
|
@ -16,15 +16,20 @@
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Include
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#include "Globals.h"
|
||||
#include "Frame.h"
|
||||
#include "FileUtil.h"
|
||||
#include "StringUtil.h"
|
||||
#include "ConsoleWindow.h"
|
||||
|
||||
#include "GameListCtrl.h"
|
||||
#include "BootManager.h"
|
||||
|
||||
#include "Common.h"
|
||||
#include "Setup.h"
|
||||
#include "ConfigManager.h"
|
||||
#include "Core.h"
|
||||
#include "State.h"
|
||||
@ -35,6 +40,7 @@
|
||||
#include "AboutDolphin.h"
|
||||
|
||||
#include <wx/statusbr.h>
|
||||
/////////////////////////////////////////
|
||||
|
||||
|
||||
namespace WiimoteLeds
|
||||
@ -50,10 +56,18 @@ namespace WiimoteLeds
|
||||
int SpIconMargin = 11;
|
||||
int LedIconMargin = 11;
|
||||
|
||||
// The necessary recording status width, allow Frame to be at last of the form 100,000
|
||||
#ifdef RERECORDING
|
||||
static const int RerecordingStatusWidth = 340;
|
||||
#endif
|
||||
|
||||
// Leds only
|
||||
static const int LdWidthsOn[] =
|
||||
{
|
||||
-1,
|
||||
#ifdef RERECORDING
|
||||
RerecordingStatusWidth,
|
||||
#endif
|
||||
ConnectionStatusWidth,
|
||||
(LedIconMargin + LED_SIZE_X) * 4 + RightmostMargin
|
||||
};
|
||||
@ -63,32 +77,61 @@ namespace WiimoteLeds
|
||||
static const int SpWidthsOn[] =
|
||||
{
|
||||
-1,
|
||||
#ifdef RERECORDING
|
||||
RerecordingStatusWidth,
|
||||
#endif
|
||||
ConnectionStatusWidth,
|
||||
( SpIconMargin + SPEAKER_SIZE_X ) * 3 + RightmostMargin
|
||||
};
|
||||
static const int SpStylesFieldOn[] = { wxSB_NORMAL, wxSB_NORMAL, wxSB_NORMAL };
|
||||
static const int SpStylesFieldOn[] = { wxSB_NORMAL,
|
||||
#ifdef RERECORDING
|
||||
wxSB_NORMAL,
|
||||
#endif
|
||||
wxSB_NORMAL, wxSB_NORMAL };
|
||||
|
||||
// Both
|
||||
static const int LdSpWidthsOn[] =
|
||||
{
|
||||
-1,
|
||||
#ifdef RERECORDING
|
||||
RerecordingStatusWidth,
|
||||
#endif
|
||||
ConnectionStatusWidth,
|
||||
(SpIconMargin + SPEAKER_SIZE_X) * 3,
|
||||
(LedIconMargin + LED_SIZE_X) * 4 + RightmostMargin
|
||||
};
|
||||
static const int LdSpStylesFieldOn[] = { wxSB_NORMAL, wxSB_NORMAL, wxSB_NORMAL };
|
||||
static const int LdSpStylesFieldOn[] = { wxSB_NORMAL,
|
||||
#ifdef RERECORDING
|
||||
wxSB_NORMAL,
|
||||
#endif
|
||||
wxSB_NORMAL, wxSB_NORMAL };
|
||||
|
||||
// Only the Wiimote connection Status
|
||||
static const int WidthsOff[] =
|
||||
{
|
||||
-1,
|
||||
#ifdef RERECORDING
|
||||
RerecordingStatusWidth,
|
||||
#endif
|
||||
ConnectionStatusWidth + ConnectionStatusOnlyAdj + RightmostMargin
|
||||
};
|
||||
static const int StylesFieldOff[] = { wxSB_NORMAL, wxSB_NORMAL };
|
||||
static const int StylesFieldOff[] = { wxSB_NORMAL,
|
||||
#ifdef RERECORDING
|
||||
wxSB_NORMAL,
|
||||
#endif
|
||||
wxSB_NORMAL };
|
||||
|
||||
// GC mode
|
||||
static const int WidthsOffGC[] = { -1 };
|
||||
static const int StylesFieldOffGC[] = { wxSB_NORMAL };
|
||||
static const int WidthsOffGC[] = { -1
|
||||
#ifdef RERECORDING
|
||||
, RerecordingStatusWidth
|
||||
#endif
|
||||
};
|
||||
static const int StylesFieldOffGC[] = { wxSB_NORMAL
|
||||
#ifdef RERECORDING
|
||||
, wxSB_NORMAL
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
// =======================================================
|
||||
@ -154,6 +197,11 @@ void CFrame::ModifyStatusBar()
|
||||
}
|
||||
}
|
||||
|
||||
// Add a filed for the rerecording status
|
||||
#ifdef RERECORDING
|
||||
Fields++;
|
||||
#endif
|
||||
|
||||
// Update the settings
|
||||
m_pStatusBar->SetFieldsCount(Fields);
|
||||
m_pStatusBar->SetStatusWidths(Fields, Widths);
|
||||
@ -352,13 +400,49 @@ void CFrame::DoMoveIcons()
|
||||
{
|
||||
if(HaveLeds) MoveLeds();
|
||||
if(HaveSpeakers) MoveSpeakers();
|
||||
|
||||
// If there is not room for the led icons hide them
|
||||
if(m_pStatusBar->GetFieldsCount() >= 2 && HaveLeds)
|
||||
{
|
||||
wxRect Rect;
|
||||
#ifdef RERECORDING
|
||||
m_pStatusBar->GetFieldRect((HaveLeds && HaveSpeakers) ? 4 : 3, Rect);
|
||||
#else
|
||||
m_pStatusBar->GetFieldRect((HaveLeds && HaveSpeakers) ? 3 : 2, Rect);
|
||||
#endif
|
||||
if(Rect.GetWidth() < 20)
|
||||
for (int i = 0; i < 4; i++) m_StatBmp[i]->Hide();
|
||||
else // if(!m_StatBmp[0]->IsShown())
|
||||
for (int i = 0; i < 4; i++) m_StatBmp[i]->Show();
|
||||
//Console::Print("LED: %i ", Rect.GetWidth());
|
||||
}
|
||||
|
||||
// If there is not room for the speaker icons hide them
|
||||
if(m_pStatusBar->GetFieldsCount() >= 2 && HaveSpeakers)
|
||||
{
|
||||
wxRect Rect;
|
||||
#ifdef RERECORDING
|
||||
m_pStatusBar->GetFieldRect(3, Rect);
|
||||
#else
|
||||
m_pStatusBar->GetFieldRect(2, Rect);
|
||||
#endif
|
||||
if(Rect.GetWidth() < 20)
|
||||
for(int i = 0; i < 3; i++) m_StatBmp[i + 4]->Hide();
|
||||
else // if(!m_StatBmp[4]->IsShown())
|
||||
for (int i = 0; i < 3; i++) m_StatBmp[i + 4]->Show();
|
||||
//Console::Print("Speaker: %i\n", Rect.GetWidth());
|
||||
}
|
||||
}
|
||||
|
||||
void CFrame::MoveLeds()
|
||||
{
|
||||
wxRect Rect;
|
||||
// Get the bitmap field coordinates
|
||||
m_pStatusBar->GetFieldRect((HaveLeds && HaveSpeakers) ? 3 : 2, Rect);
|
||||
#ifdef RERECORDING
|
||||
m_pStatusBar->GetFieldRect((HaveLeds && HaveSpeakers) ? 4 : 3, Rect);
|
||||
#else
|
||||
m_pStatusBar->GetFieldRect((HaveLeds && HaveSpeakers) ? 3 : 2, Rect);
|
||||
#endif
|
||||
wxSize Size = m_StatBmp[0]->GetSize(); // Get the bitmap size
|
||||
|
||||
//wxMessageBox(wxString::Format("%i", Rect.x));
|
||||
@ -376,7 +460,12 @@ void CFrame::MoveLeds()
|
||||
void CFrame::MoveSpeakers()
|
||||
{
|
||||
wxRect Rect;
|
||||
m_pStatusBar->GetFieldRect(2, Rect); // Get the bitmap field coordinates
|
||||
// Get the bitmap field coordinates
|
||||
#ifdef RERECORDING
|
||||
m_pStatusBar->GetFieldRect(3, Rect);
|
||||
#else
|
||||
m_pStatusBar->GetFieldRect(2, Rect);
|
||||
#endif
|
||||
|
||||
// Get the actual bitmap size, currently it's the same as SPEAKER_SIZE_Y
|
||||
wxSize Size = m_StatBmp[4]->GetSize();
|
||||
@ -389,7 +478,7 @@ void CFrame::MoveSpeakers()
|
||||
for(int i = 0; i < 3; i++)
|
||||
{
|
||||
if(i > 0) x = m_StatBmp[i-1+4]->GetPosition().x + Dist;
|
||||
m_StatBmp[i+4]->Move(x, y);
|
||||
m_StatBmp[i + 4]->Move(x, y);
|
||||
}
|
||||
}
|
||||
// ==============
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "CPUDetect.h"
|
||||
#include "IniFile.h"
|
||||
#include "FileUtil.h"
|
||||
#include "ConsoleWindow.h"
|
||||
|
||||
#include "Main.h" // Local
|
||||
#include "Frame.h"
|
||||
@ -92,10 +93,12 @@ LONG WINAPI MyUnhandledExceptionFilter(LPEXCEPTION_POINTERS e) {
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
/* The `main program' equivalent that creates the mai nwindow and return the main frame */
|
||||
/* The `main program' equivalent that creates the main window and return the main frame */
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
bool DolphinApp::OnInit()
|
||||
{
|
||||
//Console::Open();
|
||||
|
||||
// Declarations and definitions
|
||||
bool UseDebugger = false;
|
||||
bool UseLogger = false;
|
||||
@ -442,15 +445,16 @@ void Host_SetWaitCursor(bool enable)
|
||||
SetCursor(LoadCursor(NULL, IDC_ARROW));
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void Host_UpdateStatusBar(const char* _pText)
|
||||
void Host_UpdateStatusBar(const char* _pText, int Field)
|
||||
{
|
||||
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATESTATUSBAR);
|
||||
// Set the event string
|
||||
event.SetString(wxString::FromAscii(_pText));
|
||||
event.SetInt(0);
|
||||
|
||||
// Update statusbar field
|
||||
event.SetInt(Field);
|
||||
// Post message
|
||||
wxPostEvent(main_frame, event);
|
||||
}
|
||||
|
||||
@ -482,8 +486,12 @@ void Host_SetWiiMoteConnectionState(int _State)
|
||||
case 1: event.SetString(wxString::FromAscii("Connecting...")); break;
|
||||
case 2: event.SetString(wxString::FromAscii("Wiimote Connected")); break;
|
||||
}
|
||||
|
||||
event.SetInt(1);
|
||||
// Update field 1 or 2
|
||||
#ifdef RERECORDING
|
||||
event.SetInt(2);
|
||||
#else
|
||||
event.SetInt(1);
|
||||
#endif
|
||||
|
||||
wxPostEvent(main_frame, event);
|
||||
}
|
||||
|
Reference in New Issue
Block a user