Add an IsMovieActive function.
Makes things a bit simpler, since this is a common check.
This commit is contained in:
parent
46c18aa909
commit
5a163ec5e6
|
@ -338,7 +338,7 @@ u32 CEXIIPL::GetGCTime()
|
|||
u64 ltime = 0;
|
||||
static const u32 cJanuary2000 = 0x386D4380; // Seconds between 1.1.1970 and 1.1.2000
|
||||
|
||||
if (Movie::IsRecordingInput() || Movie::IsPlayingInput())
|
||||
if (Movie::IsMovieActive())
|
||||
{
|
||||
ltime = Movie::GetRecordingStartTime();
|
||||
|
||||
|
|
|
@ -500,7 +500,7 @@ void CEXIMemoryCard::DoState(PointerWrap &p)
|
|||
// for movie sync, we need to save/load memory card contents (and other data) in savestates.
|
||||
// otherwise, we'll assume the user wants to keep their memcards and saves separate,
|
||||
// unless we're loading (in which case we let the savestate contents decide, in order to stay aligned with them).
|
||||
bool storeContents = (Movie::IsRecordingInput() || Movie::IsPlayingInput());
|
||||
bool storeContents = (Movie::IsMovieActive());
|
||||
p.Do(storeContents);
|
||||
|
||||
if (storeContents)
|
||||
|
|
|
@ -230,8 +230,7 @@ void DoState(PointerWrap &p)
|
|||
// if we had to create a temporary device, discard it if we're not loading.
|
||||
// also, if no movie is active, we'll assume the user wants to keep their current devices
|
||||
// instead of the ones they had when the savestate was created.
|
||||
if (p.GetMode() != PointerWrap::MODE_READ ||
|
||||
(!Movie::IsRecordingInput() && !Movie::IsPlayingInput()))
|
||||
if (p.GetMode() != PointerWrap::MODE_READ || !Movie::IsMovieActive())
|
||||
{
|
||||
delete pSaveDevice;
|
||||
}
|
||||
|
@ -257,7 +256,7 @@ void Init()
|
|||
g_Channel[i].m_InHi.Hex = 0;
|
||||
g_Channel[i].m_InLo.Hex = 0;
|
||||
|
||||
if (Movie::IsRecordingInput() || Movie::IsPlayingInput())
|
||||
if (Movie::IsMovieActive())
|
||||
AddDevice(Movie::IsUsingPad(i) ? (Movie::IsUsingBongo(i) ? SIDEVICE_GC_TARUKONGA : SIDEVICE_GC_CONTROLLER) : SIDEVICE_NONE, i);
|
||||
else if (!NetPlay::IsNetPlayRunning())
|
||||
AddDevice(SConfig::GetInstance().m_SIDevice[i], i);
|
||||
|
@ -531,7 +530,7 @@ void RunSIBuffer()
|
|||
int GetTicksToNextSIPoll()
|
||||
{
|
||||
// Poll for input at regular intervals (once per frame) when playing or recording a movie
|
||||
if (Movie::IsPlayingInput() || Movie::IsRecordingInput())
|
||||
if (Movie::IsMovieActive())
|
||||
{
|
||||
if (Movie::IsNetPlayRecording())
|
||||
return SystemTimers::GetTicksPerSecond() / VideoInterface::TargetRefreshRate / 2;
|
||||
|
|
|
@ -53,7 +53,7 @@ void Initialize(void* const hwnd, bool wait)
|
|||
WiimoteReal::Initialize(wait);
|
||||
|
||||
// reload Wiimotes with our settings
|
||||
if (Movie::IsPlayingInput() || Movie::IsRecordingInput())
|
||||
if (Movie::IsMovieActive())
|
||||
Movie::ChangeWiiPads();
|
||||
}
|
||||
|
||||
|
|
|
@ -329,7 +329,7 @@ bool Wiimote::Step()
|
|||
m_rumble->controls[0]->control_ref->State(m_rumble_on);
|
||||
|
||||
// when a movie is active, this button status update is disabled (moved), because movies only record data reports.
|
||||
if (!(Movie::IsPlayingInput() || Movie::IsRecordingInput()) || NetPlay::IsNetPlayRunning())
|
||||
if (!(Movie::IsMovieActive()) || NetPlay::IsNetPlayRunning())
|
||||
{
|
||||
UpdateButtonsStatus();
|
||||
}
|
||||
|
@ -383,7 +383,7 @@ void Wiimote::UpdateButtonsStatus()
|
|||
void Wiimote::GetCoreData(u8* const data)
|
||||
{
|
||||
// when a movie is active, the button update happens here instead of Wiimote::Step, to avoid potential desync issues.
|
||||
if (Movie::IsPlayingInput() || Movie::IsRecordingInput() || NetPlay::IsNetPlayRunning())
|
||||
if (Movie::IsMovieActive() || NetPlay::IsNetPlayRunning())
|
||||
{
|
||||
UpdateButtonsStatus();
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ static bool IsMovieHeader(u8 magic[4])
|
|||
|
||||
std::string GetInputDisplay()
|
||||
{
|
||||
if (!IsPlayingInput() && !IsRecordingInput())
|
||||
if (!IsMovieActive())
|
||||
{
|
||||
g_numPads = 0;
|
||||
for (int i = 0; i < 4; i++)
|
||||
|
@ -198,7 +198,7 @@ void Init()
|
|||
for (auto& disp : g_InputDisplay)
|
||||
disp.clear();
|
||||
|
||||
if (!IsPlayingInput() && !IsRecordingInput())
|
||||
if (!IsMovieActive())
|
||||
{
|
||||
g_bRecordingFromSaveState = false;
|
||||
g_rerecords = 0;
|
||||
|
@ -273,7 +273,7 @@ void SetReadOnly(bool bEnabled)
|
|||
void FrameSkipping()
|
||||
{
|
||||
// Frameskipping will desync movie playback
|
||||
if (!IsPlayingInput() && !IsRecordingInput())
|
||||
if (!IsMovieActive())
|
||||
{
|
||||
std::lock_guard<std::mutex> lk(cs_frameSkip);
|
||||
|
||||
|
@ -310,6 +310,11 @@ bool IsPlayingInput()
|
|||
return (g_playMode == MODE_PLAYING);
|
||||
}
|
||||
|
||||
bool IsMovieActive()
|
||||
{
|
||||
return g_playMode != MODE_NONE;
|
||||
}
|
||||
|
||||
bool IsReadOnly()
|
||||
{
|
||||
return g_bReadOnly;
|
||||
|
|
|
@ -123,6 +123,7 @@ bool IsRecordingInputFromSaveState();
|
|||
bool IsJustStartingRecordingInputFromSaveState();
|
||||
bool IsJustStartingPlayingInputFromSaveState();
|
||||
bool IsPlayingInput();
|
||||
bool IsMovieActive();
|
||||
bool IsReadOnly();
|
||||
u64 GetRecordingStartTime();
|
||||
|
||||
|
|
|
@ -236,9 +236,9 @@ static void CompressAndDumpState(CompressAndDumpState_args save_args)
|
|||
File::Rename(filename + ".dtm", File::GetUserPath(D_STATESAVES_IDX) + "lastState.sav.dtm");
|
||||
}
|
||||
|
||||
if ((Movie::IsRecordingInput() || Movie::IsPlayingInput()) && !Movie::IsJustStartingRecordingInputFromSaveState())
|
||||
if ((Movie::IsMovieActive()) && !Movie::IsJustStartingRecordingInputFromSaveState())
|
||||
Movie::SaveRecording(filename + ".dtm");
|
||||
else if (!Movie::IsRecordingInput() && !Movie::IsPlayingInput())
|
||||
else if (!Movie::IsMovieActive())
|
||||
File::Delete(filename + ".dtm");
|
||||
|
||||
File::IOFile f(filename, "wb");
|
||||
|
@ -437,7 +437,7 @@ void LoadAs(const std::string& filename)
|
|||
{
|
||||
std::lock_guard<std::mutex> lk(g_cs_undo_load_buffer);
|
||||
SaveToBuffer(g_undo_load_buffer);
|
||||
if (Movie::IsRecordingInput() || Movie::IsPlayingInput())
|
||||
if (Movie::IsMovieActive())
|
||||
Movie::SaveRecording(File::GetUserPath(D_STATESAVES_IDX) + "undo.dtm");
|
||||
else if (File::Exists(File::GetUserPath(D_STATESAVES_IDX) +"undo.dtm"))
|
||||
File::Delete(File::GetUserPath(D_STATESAVES_IDX) + "undo.dtm");
|
||||
|
@ -607,10 +607,10 @@ void UndoLoadState()
|
|||
std::lock_guard<std::mutex> lk(g_cs_undo_load_buffer);
|
||||
if (!g_undo_load_buffer.empty())
|
||||
{
|
||||
if (File::Exists(File::GetUserPath(D_STATESAVES_IDX) + "undo.dtm") || (!Movie::IsRecordingInput() && !Movie::IsPlayingInput()))
|
||||
if (File::Exists(File::GetUserPath(D_STATESAVES_IDX) + "undo.dtm") || (!Movie::IsMovieActive()))
|
||||
{
|
||||
LoadFromBuffer(g_undo_load_buffer);
|
||||
if (Movie::IsRecordingInput() || Movie::IsPlayingInput())
|
||||
if (Movie::IsMovieActive())
|
||||
Movie::LoadInput(File::GetUserPath(D_STATESAVES_IDX) + "undo.dtm");
|
||||
}
|
||||
else
|
||||
|
|
|
@ -757,7 +757,7 @@ void CConfigMain::CreateGUIControls()
|
|||
{
|
||||
sbGamecubeDevSettings->Add(GCSIDeviceText[i], 1, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxBOTTOM, 0);
|
||||
sbGamecubeDevSettings->Add(GCSIDevice[i], 1, wxEXPAND|wxLEFT|wxRIGHT|wxBOTTOM, 0);
|
||||
if (NetPlay::IsNetPlayRunning() || Movie::IsRecordingInput() || Movie::IsPlayingInput())
|
||||
if (NetPlay::IsNetPlayRunning() || Movie::IsMovieActive())
|
||||
{
|
||||
GCSIDevice[i]->Disable();
|
||||
}
|
||||
|
|
|
@ -1084,7 +1084,7 @@ void CFrame::DoStop()
|
|||
// TODO: Show the author/description dialog here
|
||||
if (Movie::IsRecordingInput())
|
||||
DoRecordingSave();
|
||||
if (Movie::IsPlayingInput() || Movie::IsRecordingInput())
|
||||
if (Movie::IsMovieActive())
|
||||
Movie::EndPlayInput(false);
|
||||
NetPlay::StopGame();
|
||||
|
||||
|
@ -1631,7 +1631,7 @@ void CFrame::UpdateGUI()
|
|||
GetMenuBar()->FindItem(IDM_RESET)->Enable(Running || Paused);
|
||||
GetMenuBar()->FindItem(IDM_RECORD)->Enable(!Movie::IsRecordingInput());
|
||||
GetMenuBar()->FindItem(IDM_PLAYRECORD)->Enable(!Initialized);
|
||||
GetMenuBar()->FindItem(IDM_RECORDEXPORT)->Enable(Movie::IsPlayingInput() || Movie::IsRecordingInput());
|
||||
GetMenuBar()->FindItem(IDM_RECORDEXPORT)->Enable(Movie::IsMovieActive());
|
||||
GetMenuBar()->FindItem(IDM_FRAMESTEP)->Enable(Running || Paused);
|
||||
GetMenuBar()->FindItem(IDM_SCREENSHOT)->Enable(Running || Paused);
|
||||
GetMenuBar()->FindItem(IDM_TOGGLE_FULLSCREEN)->Enable(Running || Paused);
|
||||
|
|
Loading…
Reference in New Issue