Mesen-X/Core/ROMLoader.h

31 lines
814 B
C
Raw Normal View History

2014-06-14 11:27:55 -04:00
#pragma once
#include "stdafx.h"
#include <algorithm>
#include "../Utilities/FolderUtilities.h"
2015-12-26 17:11:00 -05:00
#include "../Utilities/ZipReader.h"
#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;
string _filename;
2015-12-27 18:41:38 -05:00
string _ipsFilename;
2014-06-14 11:27:55 -04:00
bool LoadFromZip(istream &zipFile);
bool LoadFromStream(istream &romFile);
uint32_t GetFileSize(istream &file);
uint8_t* ReadFile(istream &file, uint32_t &fileSize);
2016-01-28 20:47:16 -05:00
bool LoadFromMemory(uint8_t* buffer, size_t length);
public:
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
};