mirror of
https://github.com/LNH-team/pico-launcher.git
synced 2026-06-02 09:06:54 +02:00
Change cheat implementation to show cheats in database order, fix some bugs
- AdvancedPaletteManager incorrectly handled negative y positions - FocusManager still had a pointer to a view that was destroyed in the cheats panel. After changing focus, memory got corrupted.
This commit is contained in:
@@ -1,48 +1,15 @@
|
||||
#pragma once
|
||||
#include "Cheat.h"
|
||||
#include "CheatCategory.h"
|
||||
#include "ICheatCategory.h"
|
||||
#include "CheatEntry.h"
|
||||
|
||||
/// @brief Class holding the cheats for a game.
|
||||
class GameCheats : public ICheatCategory
|
||||
class GameCheats : public CheatEntry
|
||||
{
|
||||
public:
|
||||
GameCheats(std::unique_ptr<u8[]> cheatData, u32 cheatDataLength, u32 fileOffset, const char* gameName,
|
||||
CheatCategory* categories, u32 numberOfCategories, Cheat* cheats, u32 numberOfCheats)
|
||||
: _cheatData(std::move(cheatData)), _cheatDataLength(cheatDataLength), _fileOffset(fileOffset), _gameName(gameName)
|
||||
, _categories(categories), _numberOfCategories(numberOfCategories)
|
||||
, _cheats(cheats), _numberOfCheats(numberOfCheats) { }
|
||||
|
||||
~GameCheats()
|
||||
{
|
||||
if (_categories != nullptr)
|
||||
{
|
||||
free(_categories);
|
||||
}
|
||||
if (_cheats != nullptr)
|
||||
{
|
||||
free(_cheats);
|
||||
}
|
||||
}
|
||||
|
||||
/// @brief Gets the name of the game.
|
||||
/// @return A pointer to the name of the game.
|
||||
const char* GetGameName() const
|
||||
{
|
||||
return _gameName;
|
||||
}
|
||||
|
||||
const CheatCategory* GetCategories(u32& numberOfCategories) const override
|
||||
{
|
||||
numberOfCategories = _numberOfCategories;
|
||||
return _categories;
|
||||
}
|
||||
|
||||
const Cheat* GetCheats(u32& numberOfCheats) const override
|
||||
{
|
||||
numberOfCheats = _numberOfCheats;
|
||||
return _cheats;
|
||||
}
|
||||
CheatEntry* subEntries, u32 numberOfSubEntries)
|
||||
: CheatEntry(gameName, "", false, subEntries, numberOfSubEntries)
|
||||
, _cheatData(std::move(cheatData)), _cheatDataLength(cheatDataLength)
|
||||
, _fileOffset(fileOffset) { }
|
||||
|
||||
/// @brief Gets a pointer to the cheat data.
|
||||
/// @param cheatDataLength The length of the cheat data is returned in this reference.
|
||||
@@ -62,20 +29,4 @@ private:
|
||||
std::unique_ptr<u8[]> _cheatData;
|
||||
u32 _cheatDataLength;
|
||||
u32 _fileOffset;
|
||||
const char* _gameName;
|
||||
CheatCategory* _categories;
|
||||
u32 _numberOfCategories;
|
||||
Cheat* _cheats;
|
||||
u32 _numberOfCheats;
|
||||
|
||||
// From ICheatCategory
|
||||
const char* GetName() const override
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
bool GetIsMaxOneCheatActive() const override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user