Revert "recording: Updated all current logging instances to use new logger"

This reverts commit 8decc44476.
This commit is contained in:
Tyler Wilding 2020-10-16 20:23:49 -04:00 committed by refractionpcsx2
parent 2c6805259e
commit aad5efa637
5 changed files with 42 additions and 50 deletions

View File

@ -555,7 +555,7 @@ set(pcsx2RecordingHeaders
${rec_src}/InputRecordingFile.h
${rec_src}/NewRecordingFrame.h
${rec_src}/PadData.h
${rec_src}/Utilities/InputRecordingLogger.h
${rec_src}/Utilities/InputRecordingLogger.h
${rec_vp_src}/VirtualPad.h
${rec_vp_src}/VirtualPadData.h
${rec_vp_src}/VirtualPadResources.h

View File

@ -27,7 +27,6 @@
#include "InputRecording.h"
#include "InputRecordingControls.h"
#include "Utilities/InputRecordingLogger.h"
#endif
@ -222,7 +221,7 @@ void InputRecording::SetToRecordMode()
state = InputRecordingMode::Recording;
virtualPads[CONTROLLER_PORT_ONE]->SetReadOnlyMode(false);
virtualPads[CONTROLLER_PORT_TWO]->SetReadOnlyMode(false);
inputRec::log("Record mode ON");
recordingConLog("[REC]: Record mode ON.\n");
}
void InputRecording::SetToReplayMode()
@ -230,15 +229,15 @@ void InputRecording::SetToReplayMode()
state = InputRecordingMode::Replaying;
virtualPads[CONTROLLER_PORT_ONE]->SetReadOnlyMode(true);
virtualPads[CONTROLLER_PORT_TWO]->SetReadOnlyMode(true);
inputRec::log("Replay mode ON");
recordingConLog("[REC]: Replay mode ON.\n");
}
void InputRecording::SetFrameCounter(u32 newGFrameCount)
{
if (newGFrameCount > startingFrame + (u32)g_InputRecording.GetInputRecordingData().GetTotalFrames())
{
inputRec::consoleLog("Warning, you've loaded PCSX2 emulation to a point after the end of the original recording. This should be avoided.");
inputRec::consoleLog("Savestate's framecount has been ignored.");
recordingConLog(L"[REC]: Warning, you've loaded PCSX2 emulation to a point after the end of the original recording. This should be avoided.\n");
recordingConLog(L"[REC]: Savestate's framecount has been ignored.\n");
frameCounter = g_InputRecording.GetInputRecordingData().GetTotalFrames();
if (state == InputRecordingMode::Replaying)
SetToRecordMode();
@ -248,7 +247,7 @@ void InputRecording::SetFrameCounter(u32 newGFrameCount)
{
if (newGFrameCount < startingFrame)
{
inputRec::consoleLog("Warning, you've loaded PCSX2 emulation to a point before the start of the original recording. This should be avoided.");
recordingConLog(L"[REC]: Warning, you've loaded PCSX2 emulation to a point before the start of the original recording. This should be avoided.\n");
if (state == InputRecordingMode::Recording)
SetToReplayMode();
}
@ -262,8 +261,9 @@ void InputRecording::SetFrameCounter(u32 newGFrameCount)
void InputRecording::SetStartingFrame(u32 newStartingFrame)
{
startingFrame = newStartingFrame;
// TODO - make a function of my own to simplify working with the logging macros
if (inputRecordingData.FromSaveState())
inputRec::consoleLog("Internal Starting Frame: %d", startingFrame);
recordingConLog(wxString::Format(L"[REC]: Internal Starting Frame: %d\n", startingFrame));
frameCounter = 0;
initialLoad = false;
g_InputRecordingControls.Lock(startingFrame);
@ -276,7 +276,7 @@ void InputRecording::Stop()
virtualPads[CONTROLLER_PORT_TWO]->SetReadOnlyMode(false);
incrementUndo = false;
if (inputRecordingData.Close())
inputRec::log("Input recording stopped");
recordingConLog(L"[REC]: InputRecording Recording Stopped.\n");
}
bool InputRecording::Create(wxString FileName, bool fromSaveState, wxString authorName)
@ -307,8 +307,7 @@ bool InputRecording::Create(wxString FileName, bool fromSaveState, wxString auth
inputRecordingData.WriteHeader();
SetToRecordMode();
g_InputRecordingControls.DisableFrameAdvance();
inputRec::log("Started new input recording");
inputRec::consoleLog("Filename %s", std::string(FileName));
recordingConLog(wxString::Format(L"[REC]: Started new recording - [%s]\n", FileName));
return true;
}
@ -325,14 +324,14 @@ bool InputRecording::Play(wxString fileName)
{
if (!CoreThread.IsOpen())
{
inputRec::consoleLog("Game is not open, aborting playing input recording which starts on a save-state.");
recordingConLog(L"[REC]: Game is not open, aborting playing input recording which starts on a save-state.\n");
inputRecordingData.Close();
return false;
}
if (!wxFileExists(inputRecordingData.GetFilename() + "_SaveState.p2s"))
{
inputRec::consoleLog("Could not locate savestate file at location - %s_SaveState.p2s",
inputRecordingData.GetFilename());
recordingConLog(wxString::Format("[REC]: Could not locate savestate file at location - %s_SaveState.p2s\n",
inputRecordingData.GetFilename()));
inputRecordingData.Close();
return false;
}
@ -348,19 +347,18 @@ bool InputRecording::Play(wxString fileName)
// Check if the current game matches with the one used to make the original recording
if (!g_Conf->CurrentIso.IsEmpty())
if (resolveGameName() != inputRecordingData.GetHeader().gameName)
inputRec::consoleLog("Input recording was possibly constructed for a different game.");
recordingConLog(L"[REC]: Recording was possibly constructed for a different game.\n");
incrementUndo = true;
SetToReplayMode();
inputRec::log("Playing input recording");
g_InputRecordingControls.DisableFrameAdvance();
inputRec::consoleMultiLog({wxString::Format("Replaying input recording - [%s]", std::string(inputRecordingData.GetFilename())),
wxString::Format("PCSX2 Version Used: %s", std::string(inputRecordingData.GetHeader().emu)),
wxString::Format("Recording File Version: %d", inputRecordingData.GetHeader().version),
wxString::Format("Associated Game Name or ISO Filename: %s", std::string(inputRecordingData.GetHeader().gameName)),
wxString::Format("Author: %s", inputRecordingData.GetHeader().author),
wxString::Format("Total Frames: %d", inputRecordingData.GetTotalFrames()),
wxString::Format("Undo Count: %d", inputRecordingData.GetUndoCount())});
recordingConLog(wxString::Format(L"[REC]: Replaying input recording - [%s]\n", inputRecordingData.GetFilename()));
recordingConLog(wxString::Format(L"[REC]: PCSX2 Version Used: %s\n", inputRecordingData.GetHeader().emu));
recordingConLog(wxString::Format(L"[REC]: Recording File Version: %d\n", inputRecordingData.GetHeader().version));
recordingConLog(wxString::Format(L"[REC]: Associated Game Name or ISO Filename: %s\n", inputRecordingData.GetHeader().gameName));
recordingConLog(wxString::Format(L"[REC]: Author: %s\n", inputRecordingData.GetHeader().author));
recordingConLog(wxString::Format(L"[REC]: Total Frames: %d\n", inputRecordingData.GetTotalFrames()));
recordingConLog(wxString::Format(L"[REC]: Undo Count: %d\n", inputRecordingData.GetUndoCount()));
return true;
}

View File

@ -25,7 +25,7 @@
#include "InputRecording.h"
#include "InputRecordingControls.h"
#include "Utilities/InputRecordingLogger.h"
InputRecordingControls g_InputRecordingControls;
@ -43,7 +43,7 @@ void InputRecordingControls::HandleFrameAdvanceAndPausing()
if (g_FrameCount == frameCountTracker)
{
frameLock = false;
Resume();
g_InputRecordingControls.Resume();
}
else if (!emulationCurrentlyPaused && CoreThread.IsOpen() && CoreThread.IsRunning())
{
@ -62,7 +62,7 @@ void InputRecordingControls::HandleFrameAdvanceAndPausing()
frameCountTracker = g_FrameCount;
if (g_InputRecording.GetFrameCounter() < INT_MAX)
g_InputRecording.IncrementFrameCounter();
}
}
else
{
if (pauseEmulation)
@ -79,18 +79,17 @@ void InputRecordingControls::HandleFrameAdvanceAndPausing()
switchToReplay = false;
}
if ((g_InputRecording.IsReplaying() &&
g_InputRecording.GetFrameCounter() >= g_InputRecording.GetInputRecordingData().GetTotalFrames()) ||
g_InputRecording.GetFrameCounter() == INT_MAX)
if ((g_InputRecording.IsReplaying() && g_InputRecording.GetFrameCounter() >= g_InputRecording.GetInputRecordingData().GetTotalFrames())
|| g_InputRecording.GetFrameCounter() == INT_MAX)
pauseEmulation = true;
// If we haven't yet advanced atleast a single frame from when we paused, setup things to be paused
if (frameAdvancing && frameAdvanceMarker < g_InputRecording.GetFrameCounter())
if (frameAdvancing && frameAdvanceMarker < g_InputRecording.GetFrameCounter())
{
frameAdvancing = false;
pauseEmulation = true;
}
// Pause emulation if we need to (either due to frame advancing, or pause has been explicitly toggled on)
if (pauseEmulation && CoreThread.IsOpen() && CoreThread.IsRunning())
{
@ -111,8 +110,8 @@ void InputRecordingControls::ResumeCoreThreadIfStarted()
void InputRecordingControls::FrameAdvance()
{
if (g_InputRecording.IsReplaying() &&
g_InputRecording.GetFrameCounter() >= g_InputRecording.GetInputRecordingData().GetTotalFrames())
if (g_InputRecording.IsReplaying()
&& g_InputRecording.GetFrameCounter() >= g_InputRecording.GetInputRecordingData().GetTotalFrames())
{
g_InputRecording.SetToRecordMode();
return;
@ -152,8 +151,8 @@ void InputRecordingControls::PauseImmediately()
void InputRecordingControls::Resume()
{
if (g_InputRecording.IsReplaying() &&
g_InputRecording.GetFrameCounter() >= g_InputRecording.GetInputRecordingData().GetTotalFrames())
if (g_InputRecording.IsReplaying()
&& g_InputRecording.GetFrameCounter() >= g_InputRecording.GetInputRecordingData().GetTotalFrames())
{
g_InputRecording.SetToRecordMode();
return;
@ -174,23 +173,20 @@ void InputRecordingControls::DisableFrameAdvance()
void InputRecordingControls::TogglePause()
{
if (pauseEmulation &&
g_InputRecording.IsReplaying() &&
g_InputRecording.GetFrameCounter() >= g_InputRecording.GetInputRecordingData().GetTotalFrames())
if (pauseEmulation && g_InputRecording.IsReplaying()
&& g_InputRecording.GetFrameCounter() >= g_InputRecording.GetInputRecordingData().GetTotalFrames())
{
g_InputRecording.SetToRecordMode();
return;
}
pauseEmulation = !pauseEmulation;
resumeEmulation = !pauseEmulation;
inputRec::log(pauseEmulation ? "Paused Emulation" : "Resumed Emulation");
}
void InputRecordingControls::RecordModeToggle()
{
if (IsPaused() ||
g_InputRecording.IsReplaying() ||
g_InputRecording.GetFrameCounter() < g_InputRecording.GetInputRecordingData().GetTotalFrames())
if (IsPaused() || g_InputRecording.IsReplaying()
|| g_InputRecording.GetFrameCounter() < g_InputRecording.GetInputRecordingData().GetTotalFrames())
{
if (g_InputRecording.IsReplaying())
g_InputRecording.SetToRecordMode();

View File

@ -21,8 +21,7 @@
#include "MainFrame.h"
#include "MemoryTypes.h"
#include "InputRecordingFile.h"
#include "Utilities/InputRecordingLogger.h"
#include "Recording/InputRecordingFile.h"
void InputRecordingFileHeader::Init()
{
@ -121,10 +120,10 @@ bool InputRecordingFile::open(const wxString path, bool newRecording)
return true;
}
Close();
inputRec::consoleLog("Input recording file header is invalid");
recordingConLog(wxString::Format("[REC]: Input recording file header is invalid\n"));
return false;
}
inputRec::consoleLog("Input recording file opening failed. Error - %s", strerror(errno));
recordingConLog(wxString::Format("[REC]: Input recording file opening failed. Error - %s\n", strerror(errno)));
return false;
}
@ -141,7 +140,7 @@ bool InputRecordingFile::OpenNew(const wxString path, bool fromSavestate)
}
}
else
inputRec::consoleLog("Game is not open, aborting playing input recording which starts on a save-state.");
recordingConLog(L"[REC]: Game is not open, aborting playing input recording which starts on a save-state.\n");
return false;
}
else if (open(path, true))
@ -243,7 +242,7 @@ bool InputRecordingFile::verifyRecordingFileHeader()
// Check for current verison
if (header.version != 1)
{
inputRec::consoleLog("Input recording file is not a supported version - %d", header.version);
recordingConLog(wxString::Format("[REC]: Input recording file is not a supported version - %d\n", header.version));
return false;
}
return true;

View File

@ -27,7 +27,6 @@
#ifndef DISABLE_RECORDING
# include "Recording/InputRecording.h"
# include "Recording/Utilities/InputRecordingLogger.h"
#endif
#include <wx/utils.h>
@ -143,7 +142,7 @@ void GSPanel::InitRecordingAccelerators()
m_Accels->findKeycodeWithCommandId("InputRecordingModeToggle").toTitleizedString(),
g_InputRecording.IsActive());
inputRec::consoleLog("Initialized Input Recording Key Bindings");
recordingConLog(L"Initialized Input Recording Key Bindings\n");
}
void GSPanel::RemoveRecordingAccelerators()