|
|
|
#include "pixelGameEngine.h"
|
|
|
|
|
|
|
|
using namespace olc;
|
|
|
|
|
|
|
|
bool USE_DEBUG_DISPLAY=false;
|
|
|
|
int EMULATOR_SCREEN_WIDTH = 64;
|
|
|
|
int EMULATOR_SCREEN_HEIGHT = 32;
|
|
|
|
int EMULATOR_PIXEL_SIZE=5;
|
|
|
|
|
|
|
|
class SNESEmulator : public olc::PixelGameEngine
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
//SplashScreen s;
|
|
|
|
SNESEmulator()
|
|
|
|
{
|
|
|
|
sAppName = "SNES Emulator";
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
std::array<uint8_t,128000>memory={}; //128KB RAM
|
|
|
|
std::array<uint8_t,4000000>cartridge={}; //32 Mb cartidge (seems to be the max)
|
|
|
|
|
|
|
|
bool OnUserCreate() override
|
|
|
|
{
|
|
|
|
std::ifstream file("/home/niconiconii/Documents/Earthbound (USA).smc",std::ios_base::binary);
|
|
|
|
uint32_t counter=0x0;
|
|
|
|
while (file.good()){
|
|
|
|
uint8_t val = file.get();
|
|
|
|
if (val!=-1){
|
|
|
|
memory[counter++]=val;
|
|
|
|
std::cout<<val<<std::endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool OnUserUpdate(float fElapsedTime) override
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool OnUserDestroy()override{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
SNESEmulator demo;
|
|
|
|
if (demo.Construct(64, 32, 10, 10))
|
|
|
|
demo.Start();
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|