2014-06-14 11:27:55 -04:00
|
|
|
#pragma once
|
|
|
|
#include "stdafx.h"
|
2016-01-28 20:47:16 -05:00
|
|
|
#include "RomData.h"
|
2016-12-11 10:56:23 -05:00
|
|
|
class ArchiveReader;
|
2014-06-14 11:27:55 -04:00
|
|
|
|
2016-01-28 20:47:16 -05:00
|
|
|
class RomLoader
|
2014-06-14 11:27:55 -04:00
|
|
|
{
|
|
|
|
private:
|
2016-01-28 20:47:16 -05:00
|
|
|
RomData _romData;
|
2015-07-11 08:27:22 -04:00
|
|
|
string _filename;
|
2017-04-09 22:44:13 -04:00
|
|
|
string _patchFilename;
|
2014-06-14 11:27:55 -04:00
|
|
|
|
2016-06-17 20:53:05 -04:00
|
|
|
bool LoadFromArchive(istream &zipFile, ArchiveReader& reader, int32_t archiveFileIndex = -1);
|
|
|
|
bool LoadFromStream(istream &romFile, string romName);
|
2016-01-28 23:01:01 -05:00
|
|
|
uint32_t GetFileSize(istream &file);
|
2014-07-10 19:25:35 -04:00
|
|
|
|
2016-01-28 23:01:01 -05:00
|
|
|
uint8_t* ReadFile(istream &file, uint32_t &fileSize);
|
2016-06-17 20:53:05 -04:00
|
|
|
bool LoadFromMemory(uint8_t* buffer, size_t length, string romName);
|
|
|
|
static int32_t FindMatchingRomInFile(string filename, uint32_t crc32Hash);
|
2017-04-09 22:44:13 -04:00
|
|
|
void ApplyPatch(string patchPath, vector<uint8_t> &data);
|
2014-07-10 19:25:35 -04:00
|
|
|
|
|
|
|
public:
|
2017-04-09 22:44:13 -04:00
|
|
|
bool LoadFile(string filename, istream *filestream = nullptr, string patchFilename = "", int32_t archiveFileIndex = -1);
|
2016-01-28 20:47:16 -05:00
|
|
|
RomData GetRomData();
|
2016-06-17 20:53:05 -04:00
|
|
|
static string FindMatchingRomInFolder(string folder, string romFilename, uint32_t crc32Hash, bool useFastSearch, int32_t &archiveFileIndex);
|
|
|
|
static vector<string> GetArchiveRomList(string filename);
|
2014-06-14 11:27:55 -04:00
|
|
|
};
|