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}/InputRecordingFile.h
${rec_src}/NewRecordingFrame.h ${rec_src}/NewRecordingFrame.h
${rec_src}/PadData.h ${rec_src}/PadData.h
${rec_src}/Utilities/InputRecordingLogger.h ${rec_src}/Utilities/InputRecordingLogger.h
${rec_vp_src}/VirtualPad.h ${rec_vp_src}/VirtualPad.h
${rec_vp_src}/VirtualPadData.h ${rec_vp_src}/VirtualPadData.h
${rec_vp_src}/VirtualPadResources.h ${rec_vp_src}/VirtualPadResources.h

View File

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

View File

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

View File

@ -21,8 +21,7 @@
#include "MainFrame.h" #include "MainFrame.h"
#include "MemoryTypes.h" #include "MemoryTypes.h"
#include "InputRecordingFile.h" #include "Recording/InputRecordingFile.h"
#include "Utilities/InputRecordingLogger.h"
void InputRecordingFileHeader::Init() void InputRecordingFileHeader::Init()
{ {
@ -121,10 +120,10 @@ bool InputRecordingFile::open(const wxString path, bool newRecording)
return true; return true;
} }
Close(); Close();
inputRec::consoleLog("Input recording file header is invalid"); recordingConLog(wxString::Format("[REC]: Input recording file header is invalid\n"));
return false; 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; return false;
} }
@ -141,7 +140,7 @@ bool InputRecordingFile::OpenNew(const wxString path, bool fromSavestate)
} }
} }
else 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; return false;
} }
else if (open(path, true)) else if (open(path, true))
@ -243,7 +242,7 @@ bool InputRecordingFile::verifyRecordingFileHeader()
// Check for current verison // Check for current verison
if (header.version != 1) 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 false;
} }
return true; return true;

View File

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