2018-11-17 01:01:10 +00:00
|
|
|
// Copyright 2018 Citra Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <memory>
|
2019-01-30 15:03:44 +00:00
|
|
|
#include <shared_mutex>
|
2018-11-17 01:01:10 +00:00
|
|
|
#include <vector>
|
|
|
|
#include "common/common_types.h"
|
|
|
|
|
|
|
|
namespace Core {
|
|
|
|
class System;
|
|
|
|
struct TimingEventType;
|
|
|
|
} // namespace Core
|
|
|
|
|
|
|
|
namespace CoreTiming {
|
|
|
|
struct EventType;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace Cheats {
|
|
|
|
|
|
|
|
class CheatBase;
|
|
|
|
|
|
|
|
class CheatEngine {
|
|
|
|
public:
|
|
|
|
explicit CheatEngine(Core::System& system);
|
|
|
|
~CheatEngine();
|
2019-01-30 15:03:44 +00:00
|
|
|
std::vector<std::shared_ptr<CheatBase>> GetCheats() const;
|
|
|
|
void AddCheat(const std::shared_ptr<CheatBase>& cheat);
|
|
|
|
void RemoveCheat(int index);
|
|
|
|
void UpdateCheat(int index, const std::shared_ptr<CheatBase>& new_cheat);
|
|
|
|
void SaveCheatFile() const;
|
2018-11-17 01:01:10 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
void LoadCheatFile();
|
|
|
|
void RunCallback(u64 userdata, int cycles_late);
|
2019-01-30 15:03:44 +00:00
|
|
|
std::vector<std::shared_ptr<CheatBase>> cheats_list;
|
|
|
|
mutable std::shared_mutex cheats_list_mutex;
|
2018-11-17 01:01:10 +00:00
|
|
|
Core::TimingEventType* event;
|
|
|
|
Core::System& system;
|
|
|
|
};
|
|
|
|
} // namespace Cheats
|