Allow AREngine to be used independently of ARCodeFile (#2108)

* Make `EmuInstance::cheatFile` use a `unique_ptr`

- Fixes a memory leak, as the cheat file wasn't cleaned up in the destructor

* Split `AREngine` and `ARCodeFile` apart

- Suitable for frontends that have their own way of storing cheats
- Store the cheats in `AREngine` in a `std::vector`
- Apparently cheats are _supposed_ to be executed each frame; I didn't understand this until recently
This commit is contained in:
Jesse Talavera
2024-08-01 16:01:00 -04:00
committed by GitHub
parent f3f6a6a194
commit c6bf5d5181
6 changed files with 45 additions and 37 deletions

View File

@ -48,14 +48,16 @@ class ARCodeFile
{
public:
ARCodeFile(const std::string& filename);
~ARCodeFile();
~ARCodeFile() noexcept = default;
bool Error;
[[nodiscard]] std::vector<ARCode> GetCodes() const noexcept;
bool Error = false;
bool Load();
bool Save();
ARCodeCatList Categories;
ARCodeCatList Categories {};
private:
std::string Filename;