Start framework for emulator

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 2 years ago
parent b8aa791c12
commit b2f05fb407
  1. BIN
      C++ProjectTemplate
  2. 47
      main.cpp

Binary file not shown.

@ -1,31 +1,41 @@
#include "pixelGameEngine.h" #include "pixelGameEngine.h"
#include "Polygon.h"
using namespace olc; using namespace olc;
#define WIDTH 640 bool USE_DEBUG_DISPLAY=false;
#define HEIGHT 480 int EMULATOR_SCREEN_WIDTH = 64;
int EMULATOR_SCREEN_HEIGHT = 32;
int EMULATOR_PIXEL_SIZE=5;
class Example : public olc::PixelGameEngine class SNESEmulator : public olc::PixelGameEngine
{ {
public: public:
Example() //SplashScreen s;
SNESEmulator()
{ {
sAppName = "Example"; sAppName = "SNES Emulator";
} }
public: 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 bool OnUserCreate() override
{ {
Polygon poly{{30,30},{20,20},{-7,6}}; 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; return true;
} }
bool OnUserUpdate(float fElapsedTime) override bool OnUserUpdate(float fElapsedTime) override
{ {
Clear(BLACK);
return true; return true;
} }
@ -34,23 +44,12 @@ public:
} }
}; };
enum Direction{
RIGHT,
DOWN,
LEFT,
UP
};
struct Data{
int x,y;
};
int main() int main()
{ {
Example demo; SNESEmulator demo;
if (demo.Construct(640, 480, 4, 4)) if (demo.Construct(64, 32, 10, 10))
demo.Start(); demo.Start();
return 0; return 0;
} }

Loading…
Cancel
Save