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