mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
properly open/close the file to avoid rapid open/close cycles
ES_OPENCONTENT and ES_CLOSECONTENT now call Open and Close respectively, as the old code did.
This commit is contained in:
@ -20,8 +20,10 @@ bool AddTicket(u64 title_id, const std::vector<u8>& ticket);
|
||||
class CNANDContentData
|
||||
{
|
||||
public:
|
||||
virtual void Open() { };
|
||||
virtual const std::vector<u8> Get() = 0;
|
||||
virtual bool GetRange(u32 start, u32 size, u8* buffer) = 0;
|
||||
virtual void Close() { };
|
||||
};
|
||||
|
||||
class CNANDContentDataFile final : public CNANDContentData
|
||||
@ -29,10 +31,15 @@ class CNANDContentDataFile final : public CNANDContentData
|
||||
public:
|
||||
CNANDContentDataFile(const std::string& filename) : m_filename(filename) { };
|
||||
|
||||
void Open() override;
|
||||
const std::vector<u8> Get() override;
|
||||
bool GetRange(u32 start, u32 size, u8* buffer) override;
|
||||
void Close() override;
|
||||
private:
|
||||
void EnsureOpen();
|
||||
|
||||
const std::string m_filename;
|
||||
std::unique_ptr<File::IOFile> m_file;
|
||||
};
|
||||
class CNANDContentDataBuffer final : public CNANDContentData
|
||||
{
|
||||
|
Reference in New Issue
Block a user