2014-06-14 11:27:55 -04:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
2015-08-28 21:01:18 -04:00
|
|
|
#include <algorithm>
|
2014-07-10 19:25:35 -04:00
|
|
|
#include "../Utilities/FolderUtilities.h"
|
2015-12-26 17:11:00 -05:00
|
|
|
#include "../Utilities/ZipReader.h"
|
2014-07-10 20:24:28 -04:00
|
|
|
#include "../Utilities/CRC32.h"
|
2015-12-27 18:41:38 -05:00
|
|
|
#include "../Utilities/IpsPatcher.h"
|
2016-01-28 20:47:16 -05:00
|
|
|
#include "RomData.h"
|
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;
|
2015-12-27 18:41:38 -05:00
|
|
|
string _ipsFilename;
|
2014-06-14 11:27:55 -04:00
|
|
|
|
2016-01-28 23:01:01 -05:00
|
|
|
bool LoadFromZip(istream &zipFile);
|
|
|
|
bool LoadFromStream(istream &romFile);
|
|
|
|
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-01-28 20:47:16 -05:00
|
|
|
bool LoadFromMemory(uint8_t* buffer, size_t length);
|
2014-07-10 19:25:35 -04:00
|
|
|
|
|
|
|
public:
|
2016-01-28 23:01:01 -05:00
|
|
|
bool LoadFile(string filename, istream *filestream = nullptr, string ipsFilename = "");
|
2016-01-28 20:47:16 -05:00
|
|
|
RomData GetRomData();
|
|
|
|
static uint32_t GetCRC32(string filename);
|
|
|
|
static string FindMatchingRomInFolder(string folder, string romFilename, uint32_t crc32Hash);
|
2014-06-14 11:27:55 -04:00
|
|
|
};
|