input-rec: fix captialization of IRFile function names

This commit is contained in:
sonicfind 2022-09-24 22:25:58 -05:00 committed by refractionpcsx2
parent af1e41681c
commit bed53be218
5 changed files with 47 additions and 46 deletions

View File

@ -96,7 +96,7 @@ void InputRecordingViewer::openFile() {
if (!fileNames.isEmpty())
{
const std::string fileName = fileNames.first().toStdString();
m_file.OpenExisting(fileName);
m_file.openExisting(fileName);
loadTable();
}
}

View File

@ -417,7 +417,9 @@ ImFont* ImGuiManager::AddFixedFont(float size)
bool ImGuiManager::AddIconFonts(float size)
{
static constexpr ImWchar range_fa[] = { 0xf001,0xf002,0xf005,0xf005,0xf007,0xf007,0xf00c,0xf00e,0xf011,0xf011,0xf013,0xf013,0xf017,0xf017,0xf019,0xf019,0xf021,0xf021,0xf023,0xf023,0xf025,0xf025,0xf028,0xf028,0xf02d,0xf02e,0xf030,0xf030,0xf03a,0xf03a,0xf03d,0xf03d,0xf04a,0xf04c,0xf04e,0xf04e,0xf050,0xf050,0xf052,0xf052,0xf059,0xf059,0xf05e,0xf05e,0xf065,0xf065,0xf067,0xf067,0xf06a,0xf06a,0xf071,0xf071,0xf077,0xf078,0xf07b,0xf07c,0xf084,0xf085,0xf091,0xf091,0xf0a0,0xf0a0,0xf0ac,0xf0ad,0xf0b0,0xf0b0,0xf0c5,0xf0c5,0xf0c7,0xf0c9,0xf0cb,0xf0cb,0xf0d0,0xf0d0,0xf0dc,0xf0dc,0xf0e2,0xf0e2,0xf0eb,0xf0eb,0xf0f1,0xf0f1,0xf0f3,0xf0f3,0xf0fe,0xf0fe,0xf110,0xf110,0xf119,0xf119,0xf11b,0xf11c,0xf121,0xf121,0xf133,0xf133,0xf140,0xf140,0xf144,0xf144,0xf14a,0xf14a,0xf15b,0xf15b,0xf15d,0xf15d,0xf188,0xf188,0xf191,0xf192,0xf1c9,0xf1c9,0xf1dd,0xf1de,0xf1e6,0xf1e6,0xf1ea,0xf1eb,0xf1f8,0xf1f8,0xf1fc,0xf1fc,0xf242,0xf242,0xf245,0xf245,0xf26c,0xf26c,0xf279,0xf279,0xf2d0,0xf2d0,0xf2db,0xf2db,0xf2f2,0xf2f2,0xf2f5,0xf2f5,0xf302,0xf302,0xf3c1,0xf3c1,0xf3fd,0xf3fd,0xf410,0xf410,0xf466,0xf466,0xf479,0xf479,0xf500,0xf500,0xf517,0xf517,0xf51f,0xf51f,0xf543,0xf543,0xf545,0xf545,0xf547,0xf548,0xf552,0xf552,0xf5a2,0xf5a2,0xf65d,0xf65e,0xf6a9,0xf6a9,0xf756,0xf756,0xf7c2,0xf7c2,0xf807,0xf807,0xf815,0xf815,0xf818,0xf818,0xf84c,0xf84c,0xf8cc,0xf8cc,0x0,0x0 };
// clang-format off
static constexpr ImWchar range_fa[] = { 0xf001,0xf002,0xf005,0xf005,0xf007,0xf007,0xf00c,0xf00e,0xf011,0xf011,0xf013,0xf013,0xf017,0xf017,0xf019,0xf019,0xf021,0xf021,0xf023,0xf023,0xf025,0xf025,0xf028,0xf028,0xf02d,0xf02e,0xf030,0xf030,0xf03a,0xf03a,0xf03d,0xf03d,0xf04a,0xf04c,0xf04e,0xf04e,0xf050,0xf050,0xf052,0xf052,0xf059,0xf059,0xf05e,0xf05e,0xf065,0xf065,0xf067,0xf067,0xf06a,0xf06a,0xf071,0xf071,0xf077,0xf078,0xf07b,0xf07c,0xf084,0xf085,0xf091,0xf091,0xf0a0,0xf0a0,0xf0ac,0xf0ad,0xf0b0,0xf0b0,0xf0c5,0xf0c5,0xf0c7,0xf0c9,0xf0cb,0xf0cb,0xf0d0,0xf0d0,0xf0dc,0xf0dc,0xf0e2,0xf0e2,0xf0eb,0xf0eb,0xf0f1,0xf0f1,0xf0f3,0xf0f3,0xf0fe,0xf0fe,0xf110,0xf110,0xf119,0xf119,0xf11b,0xf11c,0xf121,0xf121,0xf133,0xf133,0xf140,0xf140,0xf144,0xf144,0xf14a,0xf14a,0xf15b,0xf15b,0xf15d,0xf15d,0xf188,0xf188,0xf191,0xf192,0xf1c9,0xf1c9,0xf1dd,0xf1de,0xf1e6,0xf1e6,0xf1ea,0xf1eb,0xf1f8,0xf1f8,0xf1fc,0xf1fc,0xf242,0xf242,0xf245,0xf245,0xf26c,0xf26c,0xf279,0xf279,0xf2d0,0xf2d0,0xf2db,0xf2db,0xf2f2,0xf2f2,0xf2f5,0xf2f5,0xf302,0xf302,0xf3c1,0xf3c1,0xf3fd,0xf3fd,0xf410,0xf410,0xf466,0xf466,0xf479,0xf479,0xf500,0xf500,0xf517,0xf517,0xf51f,0xf51f,0xf543,0xf543,0xf545,0xf545,0xf547,0xf548,0xf552,0xf552,0xf5a2,0xf5a2,0xf65d,0xf65e,0xf6a9,0xf6a9,0xf756,0xf756,0xf7c2,0xf7c2,0xf807,0xf807,0xf815,0xf815,0xf818,0xf818,0xf84c,0xf84c,0xf8cc,0xf8cc,0xf8d9,0xf8d9,0x0,0x0 };
// clang-format on
ImFontConfig cfg;
cfg.MergeMode = true;
@ -528,7 +530,7 @@ void Host::AddIconOSDMessage(std::string key, const char* icon, const std::strin
{
OSDMessage msg;
msg.key = std::move(key);
msg.text = fmt::format("{} {}", icon, message);
msg.text = fmt::format("{} {}", icon, message);
msg.duration = duration;
msg.time = std::chrono::steady_clock::now();
@ -819,4 +821,3 @@ bool ImGuiManager::ProcessGenericInputEvent(GenericInputBinding key, float value
}
#endif // PCSX2_CORE

View File

@ -504,7 +504,7 @@ InputRecording g_InputRecording;
bool InputRecording::create(const std::string& fileName, const bool fromSaveState, const std::string& authorName)
{
if (!m_file.OpenNew(fileName, fromSaveState))
if (!m_file.openNew(fileName, fromSaveState))
{
return false;
}
@ -533,10 +533,10 @@ bool InputRecording::create(const std::string& fileName, const bool fromSaveStat
VMManager::Reset();
}
m_file.SetEmulatorVersion();
m_file.SetAuthor(authorName);
m_file.SetGameName(resolveGameName());
m_file.WriteHeader();
m_file.setEmulatorVersion();
m_file.setAuthor(authorName);
m_file.setGameName(resolveGameName());
m_file.writeHeader();
initializeState();
InputRec::log("Started new input recording");
InputRec::consoleLog(fmt::format("Filename {}", m_file.getFilename()));
@ -545,20 +545,20 @@ bool InputRecording::create(const std::string& fileName, const bool fromSaveStat
bool InputRecording::play(const std::string& filename)
{
if (!m_file.OpenExisting(filename))
if (!m_file.openExisting(filename))
{
return false;
}
// Either load the savestate, or restart the game
if (m_file.FromSaveState())
if (m_file.fromSaveState())
{
std::string savestatePath = fmt::format("{}_SaveState.p2s", m_file.getFilename());
if (!FileSystem::FileExists(savestatePath.c_str()))
{
InputRec::consoleLog(fmt::format("Could not locate savestate file at location - {}", savestatePath));
InputRec::log("Savestate load failed");
m_file.Close();
m_file.close();
return false;
}
m_type = Type::FROM_SAVESTATE;
@ -568,7 +568,7 @@ bool InputRecording::play(const std::string& filename)
if (!loaded)
{
InputRec::log("Savestate load failed, unsupported version?");
m_file.Close();
m_file.close();
m_is_active = false;
return false;
}
@ -597,7 +597,7 @@ bool InputRecording::play(const std::string& filename)
void InputRecording::stop()
{
m_is_active = false;
if (m_file.Close())
if (m_file.close())
{
InputRec::log("Input recording stopped");
}
@ -622,7 +622,7 @@ void InputRecording::ControllerInterrupt(u8 port, size_t fifoSize, u8 dataIn, u8
const u16 bufIndex = fifoSize - 3;
if (state == InputRecordingMode::Replaying)
{
if (!m_file.WriteKeyBuffer(m_frame_counter, port, bufIndex, bufVal))
if (!m_file.writeKeyBuffer(m_frame_counter, port, bufIndex, bufVal))
{
InputRec::consoleLog(fmt::format("Failed to write input data at frame {}", m_frame_counter));
}
@ -667,12 +667,12 @@ void InputRecording::incFrameCounter()
}
if (m_controls.isRecording())
{
m_file.SetTotalFrames(m_frame_counter);
m_file.setTotalFrames(m_frame_counter);
// If we've been in record mode and moved to the next frame, we've overrote something
// if this was following a save-state loading, this is considered a re-record, a.k.a an undo
if (m_watching_for_rerecords)
{
m_file.IncrementUndoCount();
m_file.incrementUndoCount();
m_watching_for_rerecords = false;
}
}

View File

@ -245,23 +245,23 @@ bool InputRecordingFile::verifyRecordingFileHeader()
#include <vector>
#include <array>
void InputRecordingFile::InputRecordingFileHeader::Init() noexcept
void InputRecordingFile::InputRecordingFileHeader::init() noexcept
{
m_fileVersion = 1;
}
void InputRecordingFile::SetEmulatorVersion()
void InputRecordingFile::setEmulatorVersion()
{
static const std::string emuVersion = fmt::format("PCSX2-{}.{}.{}", PCSX2_VersionHi, PCSX2_VersionMid, PCSX2_VersionLo);
strncpy(m_header.m_emulatorVersion, emuVersion.c_str(), sizeof(m_header.m_emulatorVersion) - 1);
}
void InputRecordingFile::SetAuthor(const std::string& _author)
void InputRecordingFile::setAuthor(const std::string& _author)
{
strncpy(m_header.m_author, _author.data(), sizeof(m_header.m_author) - 1);
}
void InputRecordingFile::SetGameName(const std::string& _gameName)
void InputRecordingFile::setGameName(const std::string& _gameName)
{
strncpy(m_header.m_gameName, _gameName.data(), sizeof(m_header.m_gameName) - 1);
}
@ -281,7 +281,7 @@ const char* InputRecordingFile::getGameName() const noexcept
return m_header.m_gameName;
}
bool InputRecordingFile::Close() noexcept
bool InputRecordingFile::close() noexcept
{
if (m_recordingFile == nullptr)
{
@ -308,12 +308,12 @@ unsigned long InputRecordingFile::getUndoCount() const noexcept
return m_undoCount;
}
bool InputRecordingFile::FromSaveState() const noexcept
bool InputRecordingFile::fromSaveState() const noexcept
{
return m_savestate;
}
void InputRecordingFile::IncrementUndoCount()
void InputRecordingFile::incrementUndoCount()
{
m_undoCount++;
if (m_recordingFile == nullptr)
@ -324,7 +324,7 @@ void InputRecordingFile::IncrementUndoCount()
fwrite(&m_undoCount, 4, 1, m_recordingFile);
}
bool InputRecordingFile::OpenNew(const std::string& path, bool fromSavestate)
bool InputRecordingFile::openNew(const std::string& path, bool fromSavestate)
{
if ((m_recordingFile = FileSystem::OpenCFile(path.data(), "wb+")) == nullptr)
{
@ -335,12 +335,12 @@ bool InputRecordingFile::OpenNew(const std::string& path, bool fromSavestate)
m_filename = path;
m_totalFrames = 0;
m_undoCount = 0;
m_header.Init();
m_header.init();
m_savestate = fromSavestate;
return true;
}
bool InputRecordingFile::OpenExisting(const std::string& path)
bool InputRecordingFile::openExisting(const std::string& path)
{
if ((m_recordingFile = FileSystem::OpenCFile(path.data(), "rb+")) == nullptr)
{
@ -350,7 +350,7 @@ bool InputRecordingFile::OpenExisting(const std::string& path)
if (!verifyRecordingFileHeader())
{
Close();
close();
InputRec::consoleLog("Input recording file header is invalid");
return false;
}
@ -359,7 +359,7 @@ bool InputRecordingFile::OpenExisting(const std::string& path)
return true;
}
bool InputRecordingFile::ReadKeyBuffer(u8& result, const uint frame, const uint port, const uint bufIndex)
bool InputRecordingFile::readKeyBuffer(u8& result, const uint frame, const uint port, const uint bufIndex)
{
if (m_recordingFile == nullptr)
{
@ -375,7 +375,7 @@ bool InputRecordingFile::ReadKeyBuffer(u8& result, const uint frame, const uint
return true;
}
void InputRecordingFile::SetTotalFrames(u32 frame)
void InputRecordingFile::setTotalFrames(u32 frame)
{
if (m_recordingFile == nullptr || m_totalFrames >= frame)
{
@ -386,7 +386,7 @@ void InputRecordingFile::SetTotalFrames(u32 frame)
fwrite(&m_totalFrames, 4, 1, m_recordingFile);
}
bool InputRecordingFile::WriteHeader() const
bool InputRecordingFile::writeHeader() const
{
if (m_recordingFile == nullptr)
{
@ -403,7 +403,7 @@ bool InputRecordingFile::WriteHeader() const
return true;
}
bool InputRecordingFile::WriteKeyBuffer(const uint frame, const uint port, const uint bufIndex, const u8 buf) const
bool InputRecordingFile::writeKeyBuffer(const uint frame, const uint port, const uint bufIndex, const u8 buf) const
{
if (m_recordingFile == nullptr)
{

View File

@ -132,45 +132,45 @@ class InputRecordingFile
char m_gameName[255]{};
public:
void Init() noexcept;
void init() noexcept;
} m_header;
public:
void SetEmulatorVersion();
void SetAuthor(const std::string& author);
void SetGameName(const std::string& cdrom);
void setEmulatorVersion();
void setAuthor(const std::string& author);
void setGameName(const std::string& cdrom);
const char* getEmulatorVersion() const noexcept;
const char* getAuthor() const noexcept;
const char* getGameName() const noexcept;
~InputRecordingFile() { Close(); }
~InputRecordingFile() { close(); }
// Closes the underlying input recording file, writing the header and
// prepares for a possible new recording to be started
bool Close() noexcept;
bool close() noexcept;
// The number of times a save-state has been loaded while recording this movie
// this is also often referred to as a "re-record"
// Whether or not this input recording starts by loading a save-state or by booting the game fresh
bool FromSaveState() const noexcept;
bool fromSaveState() const noexcept;
// Increment the number of undo actions and commit it to the recording file
void IncrementUndoCount();
void incrementUndoCount();
// Open an existing recording file
bool OpenExisting(const std::string& path);
bool openExisting(const std::string& path);
// Create and open a brand new input recording, either starting from a save-state or from
// booting the game
bool OpenNew(const std::string& path, bool fromSaveState);
bool openNew(const std::string& 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);
bool readKeyBuffer(u8& result, const uint frame, const uint port, const uint bufIndex);
// Updates the total frame counter and commit it to the recording file
void SetTotalFrames(u32 frames);
void setTotalFrames(u32 frames);
// Persist the input recording file header's current state to the file
bool WriteHeader() const;
bool writeHeader() const;
// Writes the current frame's input data to the file so it can be replayed
bool WriteKeyBuffer(const uint frame, const uint port, const uint bufIndex, const u8 buf) const;
bool writeKeyBuffer(const uint frame, const uint port, const uint bufIndex, const u8 buf) const;
// Retrieve the input recording's filename (not the path)