Add pcsxr and libretro cheat list parsing

This commit is contained in:
Connor McLaughlin
2020-09-09 22:11:28 +10:00
parent c2e7e8254f
commit ddb38ac31d
7 changed files with 620 additions and 1 deletions

View File

@ -2,6 +2,7 @@
#include "bios.h"
#include "bus.h"
#include "cdrom.h"
#include "cheats.h"
#include "common/audio_stream.h"
#include "common/file_system.h"
#include "common/iso_reader.h"
@ -26,8 +27,8 @@
#include "sio.h"
#include "spu.h"
#include "timers.h"
#include <cstdio>
#include <cctype>
#include <cstdio>
#include <fstream>
#include <limits>
Log_SetChannel(System);
@ -103,6 +104,8 @@ static Common::Timer s_frame_timer;
static std::vector<std::string> s_media_playlist;
static std::string s_media_playlist_filename;
static std::unique_ptr<CheatList> s_cheat_list;
State GetState()
{
return s_state;
@ -1107,6 +1110,9 @@ void RunFrame()
// Generate any pending samples from the SPU before sleeping, this way we reduce the chances of underruns.
g_spu.GeneratePendingSamples();
if (s_cheat_list)
s_cheat_list->Apply();
g_gpu->ResetGraphicsAPIState();
}
@ -1643,4 +1649,26 @@ bool SwitchMediaFromPlaylist(u32 index)
return InsertMedia(path.c_str());
}
bool HasCheatList()
{
return static_cast<bool>(s_cheat_list);
}
CheatList* GetCheatList()
{
return s_cheat_list.get();
}
void ApplyCheatCode(const CheatCode& code)
{
Assert(!IsShutdown());
code.Apply();
}
void SetCheatList(std::unique_ptr<CheatList> cheats)
{
Assert(!IsShutdown());
s_cheat_list = std::move(cheats);
}
} // namespace System