Path: blob/a-new-beginning/Cherry/Core/include/Cartridge.h
2 views
/*1* Gearcoleco - ColecoVision Emulator2* Copyright (C) 2021 Ignacio Sanchez34* This program is free software: you can redistribute it and/or modify5* it under the terms of the GNU General Public License as published by6* the Free Software Foundation, either version 3 of the License, or7* any later version.89* This program is distributed in the hope that it will be useful,10* but WITHOUT ANY WARRANTY; without even the implied warranty of11* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12* GNU General Public License for more details.1314* You should have received a copy of the GNU General Public License15* along with this program. If not, see http://www.gnu.org/licenses/16*17*/1819#ifndef CARTRIDGE_H20#define CARTRIDGE_H2122#include <list>23#include "definitions.h"24#include "log.h"2526class Cartridge27{28public:29enum CartridgeTypes30{31CartridgeColecoVision,32CartridgeMegaCart,33CartridgeActivisionCart,34CartridgeOCM,35CartridgeNotSupported36};3738enum CartridgeRegions39{40CartridgeNTSC,41CartridgePAL,42CartridgeUnknownRegion43};4445struct ForceConfiguration46{47CartridgeTypes type;48CartridgeRegions region;49};5051u8* GetEEPROM() const;5253public:54Cartridge();55~Cartridge();56void Init();57void Reset();58u32 GetCRC() const;59bool IsPAL() const;60bool HasSRAM() const;61bool IsValidROM() const;62bool IsReady() const;63CartridgeTypes GetType() const;64void ForceConfig(ForceConfiguration config);65int GetROMSize() const;66int GetROMBankCount() const;67const char* GetFilePath() const;68const char* GetFileName() const;69u8* GetROM() const;70bool LoadFromFile(const char* path);71bool LoadFromBuffer(const u8* buffer, int size);7273private:74bool GatherMetadata(u32 crc);75void GetInfoFromDB(u32 crc);76bool LoadFromZipFile(const u8* buffer, int size);7778private:79u8* m_pROM;80int m_iROMSize;81CartridgeTypes m_Type;82bool m_bValidROM;83bool m_bReady;84char m_szFilePath[512];85char m_szFileName[512];86int m_iROMBankCount;87bool m_bPAL;88u32 m_iCRC;89bool m_bSRAM;90u8* m_pEEPROM;91};9293#endif /* CARTRIDGE_H */949596