cscg22-gearboy

CSCG 2022 Challenge 'Gearboy'
git clone https://git.sinitax.com/sinitax/cscg22-gearboy
Log | Files | Refs | sfeed.txt

MemoryRule.h (2106B)


      1/*
      2 * Gearboy - Nintendo Game Boy Emulator
      3 * Copyright (C) 2012  Ignacio Sanchez
      4
      5 * This program is free software: you can redistribute it and/or modify
      6 * it under the terms of the GNU General Public License as published by
      7 * the Free Software Foundation, either version 3 of the License, or
      8 * any later version.
      9
     10 * This program is distributed in the hope that it will be useful,
     11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
     13 * GNU General Public License for more details.
     14
     15 * You should have received a copy of the GNU General Public License
     16 * along with this program.  If not, see http://www.gnu.org/licenses/
     17 *
     18 */
     19
     20#ifndef MEMORYRULE_H
     21#define	MEMORYRULE_H
     22
     23#include "definitions.h"
     24#include <vector>
     25
     26class Memory;
     27class Video;
     28class Processor;
     29class Input;
     30class Cartridge;
     31class Audio;
     32
     33class MemoryRule
     34{
     35public:
     36    MemoryRule(Processor* pProcessor, Memory* pMemory, Video* pVideo,
     37            Input* pInput, Cartridge* pCartridge, Audio* pAudio);
     38    virtual ~MemoryRule();
     39    virtual u8 PerformRead(u16 address) = 0;
     40    virtual void PerformWrite(u16 address, u8 value) = 0;
     41    virtual void Reset(bool bCGB) = 0;
     42    virtual void SaveRam(std::ostream &file);
     43    virtual bool LoadRam(std::istream &file, s32 fileSize);
     44    virtual void SetRamChangedCallback(RamChangedCallback callback);
     45    virtual size_t GetRamSize();
     46    virtual size_t GetRTCSize();
     47    virtual u8* GetRamBanks();
     48    virtual u8* GetCurrentRamBank();
     49    virtual int GetCurrentRamBankIndex();
     50    virtual u8* GetRomBank0();
     51    virtual int GetCurrentRomBank0Index();
     52    virtual u8* GetCurrentRomBank1();
     53    virtual int GetCurrentRomBank1Index();
     54    virtual u8* GetRTCMemory();
     55    virtual void SaveState(std::ostream& stream);
     56    virtual void LoadState(std::istream& stream);
     57
     58protected:
     59    Processor* m_pProcessor;
     60    Memory* m_pMemory;
     61    Video* m_pVideo;
     62    Input* m_pInput;
     63    Cartridge* m_pCartridge;
     64    Audio* m_pAudio;
     65    bool m_bCGB;
     66    RamChangedCallback m_pRamChangedCallback;
     67};
     68
     69#endif	/* MEMORYRULE_H */