mirror of https://github.com/PCSX2/pcsx2.git
recording: Updated all current logging instances to use new logger
This commit is contained in:
parent
0fede4cb66
commit
39ac5bff71
|
@ -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
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
#include "InputRecording.h"
|
#include "InputRecording.h"
|
||||||
#include "InputRecordingControls.h"
|
#include "InputRecordingControls.h"
|
||||||
|
#include "Utilities/InputRecordingLogger.h"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -221,7 +222,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);
|
||||||
recordingConLog("[REC]: Record mode ON.\n");
|
inputRec::log("Record mode ON");
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputRecording::SetToReplayMode()
|
void InputRecording::SetToReplayMode()
|
||||||
|
@ -229,15 +230,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);
|
||||||
recordingConLog("[REC]: Replay mode ON.\n");
|
inputRec::log("Replay mode ON");
|
||||||
}
|
}
|
||||||
|
|
||||||
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())
|
||||||
{
|
{
|
||||||
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("Warning, you've loaded PCSX2 emulation to a point after the end of the original recording. This should be avoided.");
|
||||||
recordingConLog(L"[REC]: Savestate's framecount has been ignored.\n");
|
inputRec::consoleLog("Savestate's framecount has been ignored.");
|
||||||
frameCounter = g_InputRecording.GetInputRecordingData().GetTotalFrames();
|
frameCounter = g_InputRecording.GetInputRecordingData().GetTotalFrames();
|
||||||
if (state == InputRecordingMode::Replaying)
|
if (state == InputRecordingMode::Replaying)
|
||||||
SetToRecordMode();
|
SetToRecordMode();
|
||||||
|
@ -247,7 +248,7 @@ void InputRecording::SetFrameCounter(u32 newGFrameCount)
|
||||||
{
|
{
|
||||||
if (newGFrameCount < startingFrame)
|
if (newGFrameCount < startingFrame)
|
||||||
{
|
{
|
||||||
recordingConLog(L"[REC]: Warning, you've loaded PCSX2 emulation to a point before the start of the original recording. This should be avoided.\n");
|
inputRec::consoleLog("Warning, you've loaded PCSX2 emulation to a point before the start of the original recording. This should be avoided.");
|
||||||
if (state == InputRecordingMode::Recording)
|
if (state == InputRecordingMode::Recording)
|
||||||
SetToReplayMode();
|
SetToReplayMode();
|
||||||
}
|
}
|
||||||
|
@ -261,9 +262,8 @@ 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())
|
||||||
recordingConLog(wxString::Format(L"[REC]: Internal Starting Frame: %d\n", startingFrame));
|
inputRec::consoleLog(fmt::format("Internal Starting Frame: {}", 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())
|
||||||
recordingConLog(L"[REC]: InputRecording Recording Stopped.\n");
|
inputRec::log("Input recording stopped");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InputRecording::Create(wxString FileName, bool fromSaveState, wxString authorName)
|
bool InputRecording::Create(wxString FileName, bool fromSaveState, wxString authorName)
|
||||||
|
@ -307,7 +307,8 @@ bool InputRecording::Create(wxString FileName, bool fromSaveState, wxString auth
|
||||||
inputRecordingData.WriteHeader();
|
inputRecordingData.WriteHeader();
|
||||||
SetToRecordMode();
|
SetToRecordMode();
|
||||||
g_InputRecordingControls.DisableFrameAdvance();
|
g_InputRecordingControls.DisableFrameAdvance();
|
||||||
recordingConLog(wxString::Format(L"[REC]: Started new recording - [%s]\n", FileName));
|
inputRec::log("Started new input recording");
|
||||||
|
inputRec::consoleLog(fmt::format("Filename {}", std::string(FileName)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,13 +325,13 @@ bool InputRecording::Play(wxString fileName)
|
||||||
{
|
{
|
||||||
if (!CoreThread.IsOpen())
|
if (!CoreThread.IsOpen())
|
||||||
{
|
{
|
||||||
recordingConLog(L"[REC]: Game is not open, aborting playing input recording which starts on a save-state.\n");
|
inputRec::consoleLog("Game is not open, aborting playing input recording which starts on a save-state.");
|
||||||
inputRecordingData.Close();
|
inputRecordingData.Close();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!wxFileExists(inputRecordingData.GetFilename() + "_SaveState.p2s"))
|
if (!wxFileExists(inputRecordingData.GetFilename() + "_SaveState.p2s"))
|
||||||
{
|
{
|
||||||
recordingConLog(wxString::Format("[REC]: Could not locate savestate file at location - %s_SaveState.p2s\n",
|
inputRec::consoleLog(fmt::format("Could not locate savestate file at location - {}_SaveState.p2s",
|
||||||
inputRecordingData.GetFilename()));
|
inputRecordingData.GetFilename()));
|
||||||
inputRecordingData.Close();
|
inputRecordingData.Close();
|
||||||
return false;
|
return false;
|
||||||
|
@ -347,18 +348,19 @@ 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)
|
||||||
recordingConLog(L"[REC]: Recording was possibly constructed for a different game.\n");
|
inputRec::consoleLog("Input recording was possibly constructed for a different game.");
|
||||||
|
|
||||||
incrementUndo = true;
|
incrementUndo = true;
|
||||||
SetToReplayMode();
|
SetToReplayMode();
|
||||||
|
inputRec::log("Playing input recording");
|
||||||
g_InputRecordingControls.DisableFrameAdvance();
|
g_InputRecordingControls.DisableFrameAdvance();
|
||||||
recordingConLog(wxString::Format(L"[REC]: Replaying input recording - [%s]\n", inputRecordingData.GetFilename()));
|
inputRec::consoleMultiLog({fmt::format("Replaying input recording - [{}]", std::string(inputRecordingData.GetFilename())),
|
||||||
recordingConLog(wxString::Format(L"[REC]: PCSX2 Version Used: %s\n", inputRecordingData.GetHeader().emu));
|
fmt::format("PCSX2 Version Used: {}", std::string(inputRecordingData.GetHeader().emu)),
|
||||||
recordingConLog(wxString::Format(L"[REC]: Recording File Version: %d\n", inputRecordingData.GetHeader().version));
|
fmt::format("Recording File Version: {}", inputRecordingData.GetHeader().version),
|
||||||
recordingConLog(wxString::Format(L"[REC]: Associated Game Name or ISO Filename: %s\n", inputRecordingData.GetHeader().gameName));
|
fmt::format("Associated Game Name or ISO Filename: {}", std::string(inputRecordingData.GetHeader().gameName)),
|
||||||
recordingConLog(wxString::Format(L"[REC]: Author: %s\n", inputRecordingData.GetHeader().author));
|
fmt::format("Author: {}", inputRecordingData.GetHeader().author),
|
||||||
recordingConLog(wxString::Format(L"[REC]: Total Frames: %d\n", inputRecordingData.GetTotalFrames()));
|
fmt::format("Total Frames: {}", inputRecordingData.GetTotalFrames()),
|
||||||
recordingConLog(wxString::Format(L"[REC]: Undo Count: %d\n", inputRecordingData.GetUndoCount()));
|
fmt::format("Undo Count: {}", inputRecordingData.GetUndoCount())});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
g_InputRecordingControls.Resume();
|
Resume();
|
||||||
}
|
}
|
||||||
else if (!emulationCurrentlyPaused && CoreThread.IsOpen() && CoreThread.IsRunning())
|
else if (!emulationCurrentlyPaused && CoreThread.IsOpen() && CoreThread.IsRunning())
|
||||||
{
|
{
|
||||||
|
@ -79,8 +79,9 @@ void InputRecordingControls::HandleFrameAdvanceAndPausing()
|
||||||
switchToReplay = false;
|
switchToReplay = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((g_InputRecording.IsReplaying() && g_InputRecording.GetFrameCounter() >= g_InputRecording.GetInputRecordingData().GetTotalFrames())
|
if ((g_InputRecording.IsReplaying() &&
|
||||||
|| g_InputRecording.GetFrameCounter() == INT_MAX)
|
g_InputRecording.GetFrameCounter() >= g_InputRecording.GetInputRecordingData().GetTotalFrames()) ||
|
||||||
|
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
|
||||||
|
@ -110,8 +111,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;
|
||||||
|
@ -151,8 +152,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;
|
||||||
|
@ -173,20 +174,23 @@ void InputRecordingControls::DisableFrameAdvance()
|
||||||
|
|
||||||
void InputRecordingControls::TogglePause()
|
void InputRecordingControls::TogglePause()
|
||||||
{
|
{
|
||||||
if (pauseEmulation && g_InputRecording.IsReplaying()
|
if (pauseEmulation &&
|
||||||
&& g_InputRecording.GetFrameCounter() >= g_InputRecording.GetInputRecordingData().GetTotalFrames())
|
g_InputRecording.IsReplaying() &&
|
||||||
|
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() || g_InputRecording.IsReplaying()
|
if (IsPaused() ||
|
||||||
|| g_InputRecording.GetFrameCounter() < g_InputRecording.GetInputRecordingData().GetTotalFrames())
|
g_InputRecording.IsReplaying() ||
|
||||||
|
g_InputRecording.GetFrameCounter() < g_InputRecording.GetInputRecordingData().GetTotalFrames())
|
||||||
{
|
{
|
||||||
if (g_InputRecording.IsReplaying())
|
if (g_InputRecording.IsReplaying())
|
||||||
g_InputRecording.SetToRecordMode();
|
g_InputRecording.SetToRecordMode();
|
||||||
|
|
|
@ -21,7 +21,8 @@
|
||||||
#include "MainFrame.h"
|
#include "MainFrame.h"
|
||||||
#include "MemoryTypes.h"
|
#include "MemoryTypes.h"
|
||||||
|
|
||||||
#include "Recording/InputRecordingFile.h"
|
#include "InputRecordingFile.h"
|
||||||
|
#include "Utilities/InputRecordingLogger.h"
|
||||||
|
|
||||||
void InputRecordingFileHeader::Init()
|
void InputRecordingFileHeader::Init()
|
||||||
{
|
{
|
||||||
|
@ -120,10 +121,10 @@ bool InputRecordingFile::open(const wxString path, bool newRecording)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Close();
|
Close();
|
||||||
recordingConLog(wxString::Format("[REC]: Input recording file header is invalid\n"));
|
inputRec::consoleLog("Input recording file header is invalid");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
recordingConLog(wxString::Format("[REC]: Input recording file opening failed. Error - %s\n", strerror(errno)));
|
inputRec::consoleLog(fmt::format("Input recording file opening failed. Error - {}", strerror(errno)));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,7 +141,7 @@ bool InputRecordingFile::OpenNew(const wxString path, bool fromSavestate)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
recordingConLog(L"[REC]: Game is not open, aborting playing input recording which starts on a save-state.\n");
|
inputRec::consoleLog("Game is not open, aborting playing input recording which starts on a save-state.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (open(path, true))
|
else if (open(path, true))
|
||||||
|
@ -242,7 +243,7 @@ bool InputRecordingFile::verifyRecordingFileHeader()
|
||||||
// Check for current verison
|
// Check for current verison
|
||||||
if (header.version != 1)
|
if (header.version != 1)
|
||||||
{
|
{
|
||||||
recordingConLog(wxString::Format("[REC]: Input recording file is not a supported version - %d\n", header.version));
|
inputRec::consoleLog(fmt::format("Input recording file is not a supported version - {}", header.version));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -28,42 +28,32 @@
|
||||||
|
|
||||||
namespace inputRec
|
namespace inputRec
|
||||||
{
|
{
|
||||||
static void log(const std::string& log)
|
static void log(const std::string log)
|
||||||
{
|
{
|
||||||
if (log.empty())
|
if (log.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
recordingConLog(fmt::format("[REC]: %s\n", log));
|
recordingConLog(fmt::format("[REC]: {}\n", log));
|
||||||
|
|
||||||
// NOTE - Color is not currently used for OSD logs
|
// NOTE - Color is not currently used for OSD logs
|
||||||
if (GSosdLog)
|
if (GSosdLog)
|
||||||
GSosdLog(log.c_str(), wxGetApp().GetProgramLog()->GetRGBA(ConsoleColors::Color_StrongMagenta));
|
GSosdLog(log.c_str(), wxGetApp().GetProgramLog()->GetRGBA(ConsoleColors::Color_StrongMagenta));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void consoleLog(const std::string& log)
|
static void consoleLog(const std::string log)
|
||||||
{
|
{
|
||||||
if (log.empty())
|
if (log.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
recordingConLog(fmt::format("[REC]: %s\n", log));
|
recordingConLog(fmt::format("[REC]: {}\n", log));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void consoleMultiLog(std::vector<std::string> logs)
|
static void consoleMultiLog(std::vector<std::string> logs)
|
||||||
{
|
{
|
||||||
std::string log;
|
std::string log;
|
||||||
for (std::string l : logs)
|
for (std::string l : logs)
|
||||||
log.append(fmt::format("[REC]: %s\n", l));
|
log.append(fmt::format("[REC]: {}\n", l));
|
||||||
|
|
||||||
recordingConLog(log);
|
recordingConLog(log);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void consoleMultiLog(std::vector<wxString> logs)
|
|
||||||
{
|
|
||||||
std::vector<std::string> stdLogs;
|
|
||||||
for (wxString l : logs)
|
|
||||||
stdLogs.push_back(std::string(l));
|
|
||||||
|
|
||||||
consoleMultiLog(stdLogs);
|
|
||||||
}
|
|
||||||
} // namespace inputRec
|
} // namespace inputRec
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
#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>
|
||||||
|
@ -142,7 +143,7 @@ void GSPanel::InitRecordingAccelerators()
|
||||||
m_Accels->findKeycodeWithCommandId("InputRecordingModeToggle").toTitleizedString(),
|
m_Accels->findKeycodeWithCommandId("InputRecordingModeToggle").toTitleizedString(),
|
||||||
g_InputRecording.IsActive());
|
g_InputRecording.IsActive());
|
||||||
|
|
||||||
recordingConLog(L"Initialized Input Recording Key Bindings\n");
|
inputRec::consoleLog("Initialized Input Recording Key Bindings");
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSPanel::RemoveRecordingAccelerators()
|
void GSPanel::RemoveRecordingAccelerators()
|
||||||
|
|
Loading…
Reference in New Issue