diff --git a/pcsx2-qt/CMakeLists.txt b/pcsx2-qt/CMakeLists.txt index d491d06f19..b562c7b0a8 100644 --- a/pcsx2-qt/CMakeLists.txt +++ b/pcsx2-qt/CMakeLists.txt @@ -101,9 +101,9 @@ target_sources(pcsx2-qt PRIVATE Settings/SystemSettingsWidget.cpp Settings/SystemSettingsWidget.h Settings/SystemSettingsWidget.ui - input-rec/NewInputRecordingDlg.cpp - input-rec/NewInputRecordingDlg.h - input-rec/NewInputRecordingDlg.ui + Tools/InputRecording/NewInputRecordingDlg.cpp + Tools/InputRecording/NewInputRecordingDlg.h + Tools/InputRecording/NewInputRecordingDlg.ui resources/resources.qrc ) diff --git a/pcsx2-qt/EmuThread.cpp b/pcsx2-qt/EmuThread.cpp index 27753c17ea..1bcf3e0537 100644 --- a/pcsx2-qt/EmuThread.cpp +++ b/pcsx2-qt/EmuThread.cpp @@ -976,13 +976,4 @@ DEFINE_HOTKEY("InputRecToggleMode", "Input Recording", "Toggle Recording Mode", g_InputRecordingControls.RecordModeToggle(); } }) -// TODO - Vaser - the way the pause/resuming used to work is broken on Qt, needs a rewrite. -// - Currently if you frame advance you can't get out of frame advancing! -DEFINE_HOTKEY("InputRecFrameAdvance", "Input Recording", "Frame Advance", [](bool pressed) { - if (!pressed) // ?? - not pressed so it is on key up? - { - g_InputRecordingControls.FrameAdvance(); - g_InputRecordingControls.ResumeCoreThreadIfStarted(); - } -}) END_HOTKEY_LIST() diff --git a/pcsx2-qt/MainWindow.cpp b/pcsx2-qt/MainWindow.cpp index d57e68309f..05ce609503 100644 --- a/pcsx2-qt/MainWindow.cpp +++ b/pcsx2-qt/MainWindow.cpp @@ -39,7 +39,6 @@ #include "EmuThread.h" #include "GameList/GameListRefreshThread.h" #include "GameList/GameListWidget.h" -#include "input-rec/NewInputRecordingDlg.h" #include "MainWindow.h" #include "QtHost.h" #include "QtUtils.h" @@ -48,6 +47,7 @@ #include "Settings/InterfaceSettingsWidget.h" #include "SettingWidgetBinder.h" #include "svnrev.h" +#include "Tools/InputRecording/NewInputRecordingDlg.h" static constexpr char DISC_IMAGE_FILTER[] = @@ -1194,8 +1194,8 @@ void MainWindow::onLoggingOptionChanged() void MainWindow::onInputRecNewActionTriggered() { - const bool wasPaused = VMManager::GetState() == VMState::Paused; - const bool wasRunning = VMManager::GetState() == VMState::Running; + const bool wasPaused = m_vm_paused; + const bool wasRunning = m_vm_valid; if (wasRunning && !wasPaused) { VMManager::SetPaused(true); @@ -1225,7 +1225,7 @@ void MainWindow::onInputRecNewActionTriggered() void MainWindow::onInputRecPlayActionTriggered() { - const bool wasPaused = VMManager::GetState() == VMState::Paused; + const bool wasPaused = m_vm_paused; if (!wasPaused) g_InputRecordingControls.PauseImmediately(); @@ -1246,7 +1246,7 @@ void MainWindow::onInputRecPlayActionTriggered() { g_InputRecording.Stop(); } - if (g_InputRecording.Play(fs::path(fileNames.first().toStdString()))) + if (g_InputRecording.Play(fileNames.first().toStdString())) { return; } diff --git a/pcsx2-qt/pcsx2-qt.vcxproj b/pcsx2-qt/pcsx2-qt.vcxproj index d0443bcb7a..5f7e505aa4 100644 --- a/pcsx2-qt/pcsx2-qt.vcxproj +++ b/pcsx2-qt/pcsx2-qt.vcxproj @@ -45,7 +45,7 @@ $(SolutionDir)3rdparty\lzma\include;%(AdditionalIncludeDirectories) $(ProjectDir);$(SolutionDir)pcsx2;%(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories);$(ProjectDir)\Settings;$(ProjectDir)\GameList;$(ProjectDir)\input-rec + %(AdditionalIncludeDirectories);$(ProjectDir)\Settings;$(ProjectDir)\GameList;$(ProjectDir)\Tools\InputRecording Async Use PrecompiledHeader.h @@ -134,7 +134,7 @@ - + @@ -195,7 +195,7 @@ - + @@ -242,7 +242,7 @@ - + NotUsing @@ -314,7 +314,7 @@ Document - + Document diff --git a/pcsx2-qt/pcsx2-qt.vcxproj.filters b/pcsx2-qt/pcsx2-qt.vcxproj.filters index 3701c00153..015a7cd874 100644 --- a/pcsx2-qt/pcsx2-qt.vcxproj.filters +++ b/pcsx2-qt/pcsx2-qt.vcxproj.filters @@ -198,10 +198,10 @@ moc - + moc - + Tools\Input Recording @@ -294,7 +294,7 @@ Settings - + Tools\Input Recording @@ -366,8 +366,8 @@ GameList - - Tools\Input Recording + + Tools\Input Recording diff --git a/pcsx2-qt/input-rec/NewInputRecordingDlg.cpp b/pcsx2-qt/tools/inputrecording/NewInputRecordingDlg.cpp similarity index 100% rename from pcsx2-qt/input-rec/NewInputRecordingDlg.cpp rename to pcsx2-qt/tools/inputrecording/NewInputRecordingDlg.cpp diff --git a/pcsx2-qt/input-rec/NewInputRecordingDlg.h b/pcsx2-qt/tools/inputrecording/NewInputRecordingDlg.h similarity index 100% rename from pcsx2-qt/input-rec/NewInputRecordingDlg.h rename to pcsx2-qt/tools/inputrecording/NewInputRecordingDlg.h diff --git a/pcsx2-qt/input-rec/NewInputRecordingDlg.ui b/pcsx2-qt/tools/inputrecording/NewInputRecordingDlg.ui similarity index 100% rename from pcsx2-qt/input-rec/NewInputRecordingDlg.ui rename to pcsx2-qt/tools/inputrecording/NewInputRecordingDlg.ui diff --git a/pcsx2/Recording/InputRecording.cpp b/pcsx2/Recording/InputRecording.cpp index 5d39ee1cbe..5283a1e2ca 100644 --- a/pcsx2/Recording/InputRecording.cpp +++ b/pcsx2/Recording/InputRecording.cpp @@ -465,6 +465,7 @@ wxString InputRecording::resolveGameName() #else +#include "common/FileSystem.h" #include "common/StringUtil.h" #include "SaveState.h" #include "Counters.h" @@ -742,9 +743,9 @@ bool InputRecording::Create(const std::string_view& fileName, const bool fromSav if (fromSaveState) { savestate = fmt::format("{}_SaveState.p2s", fileName); - if (fs::exists(savestate)) + if (FileSystem::FileExists(savestate.c_str())) { - fs::copy_file(savestate, fmt::format("{}.bak", savestate)); + FileSystem::CopyFilePath(savestate.c_str(), fmt::format("{}.bak", savestate).c_str(), true); } VMManager::SaveState(savestate.c_str()); } @@ -768,7 +769,7 @@ bool InputRecording::Create(const std::string_view& fileName, const bool fromSav return true; } -bool InputRecording::Play(const fs::path& filename) +bool InputRecording::Play(const std::string_view& filename) { if (!inputRecordingData.OpenExisting(filename)) return false; @@ -785,7 +786,7 @@ bool InputRecording::Play(const fs::path& filename) } savestate = fmt::format("{}_SaveState.p2s", inputRecordingData.GetFilename()); - if (!fs::exists(savestate)) + if (!FileSystem::FileExists(savestate.c_str())) { inputRec::consoleLog(fmt::format("Could not locate savestate file at location - {}", savestate)); inputRec::log("Savestate load failed"); @@ -809,8 +810,7 @@ bool InputRecording::Play(const fs::path& filename) std::string InputRecording::resolveGameName() { std::string gameName; - // TODO - Vaser - there is probably a way to get rid of the wx usage here i imagine - const std::string gameKey(StringUtil::wxStringToUTF8String(SysGetDiscID())); + const std::string gameKey = SysGetDiscID(); if (!gameKey.empty()) { auto game = GameDatabase::findGame(gameKey); @@ -820,7 +820,6 @@ std::string InputRecording::resolveGameName() gameName += " (" + game->region + ")"; } } - // TODO - Vaser - there is probably a way to get rid of the wx usage here i imagine return !gameName.empty() ? gameName : VMManager::GetGameName(); } diff --git a/pcsx2/Recording/InputRecording.h b/pcsx2/Recording/InputRecording.h index 9e059385fe..80fc6d9879 100644 --- a/pcsx2/Recording/InputRecording.h +++ b/pcsx2/Recording/InputRecording.h @@ -216,7 +216,7 @@ public: bool Create(const std::string_view& filename, const bool fromSaveState, const std::string_view& authorName); // Play an existing input recording from a file // TODO - Vaser - Calls a file dialog if it fails to locate the default base savestate - bool Play(const fs::path& path); + bool Play(const std::string_view& path); // Stop the active input recording void Stop(); // Logs the padData and redraws the virtualPad windows of active pads diff --git a/pcsx2/Recording/InputRecordingFile.cpp b/pcsx2/Recording/InputRecordingFile.cpp index d0b5544618..8cad05ff90 100644 --- a/pcsx2/Recording/InputRecordingFile.cpp +++ b/pcsx2/Recording/InputRecordingFile.cpp @@ -318,24 +318,24 @@ void InputRecordingFile::IncrementUndoCount() fwrite(&undoCount, 4, 1, recordingFile); } -bool InputRecordingFile::open(const fs::path& path, bool newRecording) +bool InputRecordingFile::open(const std::string_view& path, bool newRecording) { if (newRecording) { - if ((recordingFile = FileSystem::OpenCFile(path.string().c_str(), "wb+")) != nullptr) + if ((recordingFile = FileSystem::OpenCFile(path.data(), "wb+")) != nullptr) { - filename = path.string(); + filename = path; totalFrames = 0; undoCount = 0; header.Init(); return true; } } - else if ((recordingFile = FileSystem::OpenCFile(path.string().c_str(), "rb+")) != nullptr) + else if ((recordingFile = FileSystem::OpenCFile(path.data(), "rb+")) != nullptr) { if (verifyRecordingFileHeader()) { - filename = path.string(); + filename = path; return true; } Close(); @@ -346,7 +346,7 @@ bool InputRecordingFile::open(const fs::path& path, bool newRecording) return false; } -bool InputRecordingFile::OpenNew(const fs::path& path, bool fromSavestate) +bool InputRecordingFile::OpenNew(const std::string_view& path, bool fromSavestate) { if (!open(path, true)) return false; @@ -354,7 +354,7 @@ bool InputRecordingFile::OpenNew(const fs::path& path, bool fromSavestate) return true; } -bool InputRecordingFile::OpenExisting(const fs::path& path) +bool InputRecordingFile::OpenExisting(const std::string_view& path) { return open(path, false); } diff --git a/pcsx2/Recording/InputRecordingFile.h b/pcsx2/Recording/InputRecordingFile.h index 687e885619..bc96ef2851 100644 --- a/pcsx2/Recording/InputRecordingFile.h +++ b/pcsx2/Recording/InputRecordingFile.h @@ -164,10 +164,10 @@ public: // Increment the number of undo actions and commit it to the recording file void IncrementUndoCount(); // Open an existing recording file - bool OpenExisting(const fs::path& path); + bool OpenExisting(const std::string_view& path); // Create and open a brand new input recording, either starting from a save-state or from // booting the game - bool OpenNew(const fs::path& path, bool fromSaveState); + bool OpenNew(const std::string_view& path, bool fromSaveState); // Reads the current frame's input data from the file in order to intercept and overwrite // the current frame's value from the emulator bool ReadKeyBuffer(u8& result, const uint& frame, const uint port, const uint bufIndex); @@ -202,7 +202,7 @@ private: // Calculates the position of the current frame in the input recording long getRecordingBlockSeekPoint(const long& frame); - bool open(const fs::path& path, bool newRecording); + bool open(const std::string_view& path, bool newRecording); bool verifyRecordingFileHeader(); }; diff --git a/pcsx2/SourceLog.cpp b/pcsx2/SourceLog.cpp index d18e1f1e1f..9c25a79866 100644 --- a/pcsx2/SourceLog.cpp +++ b/pcsx2/SourceLog.cpp @@ -106,7 +106,7 @@ static const TraceLogDescriptor TLD_sysoutConsole = {"SYSout", "System Out", "Shows strings printed to the system output stream."}, - TLD_Pgif = {"PGIFout", "&PGIF Console", "Shows output from pgif the emulated ps1 gpu"} + TLD_Pgif = {"PGIFout", "&PGIF Console", "Shows output from pgif the emulated ps1 gpu"}, TLD_recordingConsole = {"Input Recording", "Input Recording Console", "Shows recording related logs and information."},