foxygit / fake-08-xbox360 Log in
commit dc2bac3e10edb09c6d0da4b43dcc63ff0c70055b
Author:     jtothebell <j.to.the.bell@gmail.com>
AuthorDate: Sat Jan 29 14:14:12 2022 -0700
Commit:     jtothebell <j.to.the.bell@gmail.com>
CommitDate: Sat Jan 29 14:14:12 2022 -0700

    Add (untested) Miyoo Mini build

    Successfully built using MiyooMini/union-toolchain, not manufacturer
    provided toolchain
---
 .gitignore                                  |   1 +
 Makefile                                    |   6 +
 platform/miyoomini/Makefile                 | 128 ++++++
 platform/miyoomini/source/MiyooMiniHost.cpp | 602 ++++++++++++++++++++++++++++
 4 files changed, 737 insertions(+)

diff --git a/.gitignore b/.gitignore
index 57a7b86..3a726e2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -37,3 +37,4 @@ platform/vita/*.vpk
 platform/vita/param.sfo
 platform/SDL1_2/FAKE08
 platform/bittboy/FAKE08
+platform/miyoomini/FAKE08
diff --git a/Makefile b/Makefile
index 2ec6f79..a30c2ed 100644
--- a/Makefile
+++ b/Makefile
@@ -42,6 +42,9 @@ clean-sdl:
 clean-bittboy:
 	@$(MAKE) -C platform/bittboy clean

+clean-miyoomini:
+	@$(MAKE) -C platform/miyoomini clean
+
 3ds:
 	@$(MAKE) -C platform/3ds

@@ -66,6 +69,9 @@ sdl:
 bittboy:
 	@$(MAKE) -C platform/bittboy

+miyoomini:
+	@$(MAKE) -C platform/miyoomini
+
 clean-tests:
 	@$(MAKE) -C test clean

diff --git a/platform/miyoomini/Makefile b/platform/miyoomini/Makefile
new file mode 100644
index 0000000..7c4deb6
--- /dev/null
+++ b/platform/miyoomini/Makefile
@@ -0,0 +1,128 @@
+
+#---------------------------------------------------------------------------------
+# TARGET is the name of the output
+# BUILD is the directory where object files & intermediate files will be placed
+# SOURCES is a list of directories containing source code
+# INCLUDES is a list of directories containing header files
+#
+#---------------------------------------------------------------------------------
+TARGET		:=	FAKE08
+BUILD		:=	build
+SOURCES		:=	${SOURCES} source
+INCLUDES	:=	${INCLUDES}
+
+#---------------------------------------------------------------------------------
+# options for code generation
+#---------------------------------------------------------------------------------
+
+CC = arm-linux-gnueabihf-gcc
+CXX = arm-linux-gnueabihf-g++
+STRIP = arm-linux-gnueabihf-strip
+
+CC = $(CXX)
+
+CFLAGS	:=	-g -Wall -Ofast -ffunction-sections -Iinc -D_BITTBOY -DVER_STR=\"$(APP_VERSION)\" -marm -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -O3 -march=armv7ve \
+			$(DEFINES)
+
+CFLAGS	+=	$(INCLUDE)
+
+CXXFLAGS	:= $(CFLAGS) -fno-rtti -std=gnu++17
+
+LIBS	:= -lSDL
+
+LDFLAGS	:= $(LIBS)
+
+
+#---------------------------------------------------------------------------------
+# no real need to edit anything past this point unless you need to add additional
+# rules for different file extensions
+#---------------------------------------------------------------------------------
+ifneq ($(BUILD),$(notdir $(CURDIR)))
+#---------------------------------------------------------------------------------
+
+export OUTPUT	:=	$(CURDIR)/$(TARGET)
+export TOPDIR	:=	$(CURDIR)
+
+export VPATH	:=	$(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
+			$(foreach dir,$(DATA),$(CURDIR)/$(dir))
+
+export DEPSDIR	:=	$(CURDIR)/$(BUILD)
+
+CFILES		:=	$(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
+CPPFILES	:=	$(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
+
+#---------------------------------------------------------------------------------
+# use CXX for linking C++ projects, CC for standard C
+#---------------------------------------------------------------------------------
+ifeq ($(strip $(CPPFILES)),)
+#---------------------------------------------------------------------------------
+	export LD	:=	$(CC)
+#---------------------------------------------------------------------------------
+else
+#---------------------------------------------------------------------------------
+	export LD	:=	$(CXX)
+#---------------------------------------------------------------------------------
+endif
+#---------------------------------------------------------------------------------
+
+export OFILES_BIN	:=	$(addsuffix .o,$(BINFILES))
+export OFILES_SRC	:=	$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
+export OFILES 		:=	$(OFILES_BIN) $(OFILES_SRC)
+export HFILES_BIN	:=	$(addsuffix .h,$(subst .,_,$(BINFILES)))
+
+export INCLUDE	:=	$(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
+			$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
+			-I$(CURDIR)/$(BUILD)
+
+export LIBPATHS	:=	$(foreach dir,$(LIBDIRS),-L$(dir)/lib)
+
+
+.PHONY: $(BUILD) clean all
+
+#---------------------------------------------------------------------------------
+all: $(BUILD)
+
+$(BUILD):
+	@[ -d $@ ] || mkdir -p $@
+	@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
+
+#---------------------------------------------------------------------------------
+clean:
+	@echo clean ...
+	@rm -fr $(BUILD) $(TARGET)
+
+
+#---------------------------------------------------------------------------------
+else
+.PHONY: clean all
+
+DEPENDS	:=	$(OFILES:.o=.d)
+
+#---------------------------------------------------------------------------------
+# main targets
+#---------------------------------------------------------------------------------
+all	:	$(OUTPUT)
+
+$(OUTPUT)		:	$(OFILES)
+	$(CC) $(CXXFLAGS) -o $@ $^ $(LDFLAGS)
+
+$(OFILES_SRC)	: $(HFILES_BIN)
+
+#---------------------------------------------------------------------------------
+clean:
+	@echo clean ...
+	@rm -fr $(BUILD) $(TARGET)
+
+#---------------------------------------------------------------------------------
+# you need a rule like this for each extension you use as binary data
+#---------------------------------------------------------------------------------
+%.bin.o	%_bin.h :	%.bin
+#---------------------------------------------------------------------------------
+	@echo $(notdir $<)
+	@$(bin2o)
+
+-include $(DEPENDS)
+
+#---------------------------------------------------------------------------------------
+endif
+#---------------------------------------------------------------------------------------
diff --git a/platform/miyoomini/source/MiyooMiniHost.cpp b/platform/miyoomini/source/MiyooMiniHost.cpp
new file mode 100644
index 0000000..96d20fb
--- /dev/null
+++ b/platform/miyoomini/source/MiyooMiniHost.cpp
@@ -0,0 +1,602 @@
+
+#include <stdio.h>
+#include <string.h>
+#include <dirent.h>
+#include <errno.h>
+
+#include <fstream>
+#include <iostream>
+using namespace std;
+
+#include "../../../source/host.h"
+#include "../../../source/hostVmShared.h"
+#include "../../../source/nibblehelpers.h"
+#include "../../../source/logger.h"
+#include "../../../source/filehelpers.h"
+
+// sdl
+#include <SDL/SDL.h>
+
+#define SCREEN_SIZE_X 640
+#define SCREEN_SIZE_Y 480
+
+#define SCREEN_BPP 32
+
+
+#define SAMPLERATE 22050
+#define SAMPLESPERBUF (SAMPLERATE / 30)
+#define NUM_BUFFERS 2
+
+const int __screenWidth = SCREEN_SIZE_X;
+const int __screenHeight = SCREEN_SIZE_Y;
+
+int _windowWidth = 128;
+int _windowHeight = 128;
+
+int _screenWidth = 128;
+int _screenHeight = 128;
+
+int _maxNoStretchWidth = 128;
+int _maxNoStretchHeight = 128;
+
+const int PicoScreenWidth = 128;
+const int PicoScreenHeight = 128;
+const int pixelBlocksPerLine = PicoScreenWidth / 8;
+
+
+StretchOption stretch;
+uint32_t last_time;
+uint32_t now_time;
+uint32_t frame_time;
+uint32_t targetFrameTimeMs;
+
+uint8_t currKDown;
+uint8_t currKHeld;
+
+Color* _paletteColors;
+Audio* _audio;
+
+SDL_Event event;
+SDL_Surface *window;
+SDL_Surface *texture;
+SDL_bool done = SDL_FALSE;
+SDL_AudioSpec want, have;
+void *pixels;
+uint16_t *base;
+int pitch;
+
+SDL_Rect SrcR;
+SDL_Rect DestR;
+
+int textureAngle;
+uint8_t flip; //0 none, 1 horizontal, 2 vertical - match SDL2's SDL_RendererFlip
+int drawModeScaleX = 1;
+int drawModeScaleY = 1;
+
+bool audioInitialized = false;
+
+uint16_t _mapped16BitColors[144];
+
+
+void postFlipFunction(){
+    // We're done rendering, so we end the frame here.
+
+    SDL_SoftStretch(texture, &SrcR, window, &DestR);
+
+    SDL_Flip(window);
+}
+
+void audioCleanup(){
+    SDL_PauseAudio(1);
+
+    audioInitialized = false;
+
+    SDL_CloseAudio();
+}
+
+
+void FillAudioDeviceBuffer(void* UserData, Uint8* DeviceBuffer, int Length)
+{
+    _audio->FillMonoAudioBuffer(DeviceBuffer, 0, Length / 2);
+}
+
+void audioSetup(){
+    //modifed from SDL docs: https://wiki.libsdl.org/SDL_OpenAudioDevice
+
+    SDL_memset(&want, 0, sizeof(want));
+    want.freq = SAMPLERATE;
+    want.format = AUDIO_S16LSB;
+    want.channels = 1;
+    want.samples = 512;
+    want.callback = FillAudioDeviceBuffer;
+
+
+    int audioOpenRes = SDL_OpenAudio(&want, &have);
+    if (audioOpenRes < 0) {
+        Logger_Write("Failed to open audio: %s", SDL_GetError());
+    } else {
+        if (have.format != want.format) {
+            Logger_Write("We didn't get requested audio format.");
+        }
+        SDL_PauseAudio(0);
+        audioInitialized = true;
+    }
+}
+
+void _setSourceRect(int xoffset, int yoffset) {
+    SrcR.x = xoffset;
+    SrcR.y = yoffset;
+    SrcR.w = PicoScreenWidth / drawModeScaleX - (xoffset * 2);
+    SrcR.h = PicoScreenHeight / drawModeScaleY - (yoffset * 2);
+}
+
+void _changeStretch(StretchOption newStretch){
+    int xoffset = 0;
+    int yoffset = 0;
+
+    if (newStretch == PixelPerfect) {
+        _screenWidth = PicoScreenWidth;
+        _screenHeight = PicoScreenHeight;
+    }
+    else if (newStretch == StretchAndOverflow) {
+        yoffset = 4 / drawModeScaleY;
+        _screenWidth = PicoScreenWidth * 2;
+        _screenHeight = _windowHeight;
+    }
+    //default to StretchToFill)
+    else {
+        _screenWidth = _windowWidth;
+        _screenHeight = _windowHeight;
+    }
+
+
+    DestR.x = _windowWidth / 2 - _screenWidth / 2;
+    DestR.y = _windowHeight / 2 - _screenHeight / 2;
+    DestR.w = _screenWidth;
+    DestR.h = _screenHeight;
+
+    _setSourceRect(xoffset, yoffset);
+
+    textureAngle = 0;
+    flip = 0;
+
+    //clear the screen so nothing is left over behind current stretch
+    SDL_FillRect(window, NULL, SDL_MapRGB(window->format, 0, 0, 0));
+}
+
+
+
+
+Host::Host() {
+    _cartDirectory = "/mnt/SDCARD/Roms/PICO";
+    _logFilePrefix = "/mnt/SDCARD/Roms/PICO/";
+
+ }
+
+void Host::oneTimeSetup(Color* paletteColors, Audio* audio){
+    if (SDL_Init(SDL_INIT_VIDEO) != 0)
+    {
+        fprintf(stderr, "SDL could not initialize\n");
+        return;
+    }
+
+    SDL_WM_SetCaption("FAKE-08", NULL);
+    SDL_ShowCursor(SDL_DISABLE);
+
+    int flags = SDL_HWSURFACE;
+
+    window = SDL_SetVideoMode(SCREEN_SIZE_X, SCREEN_SIZE_Y, SCREEN_BPP, flags);
+
+    texture = SDL_CreateRGBSurface(flags, PicoScreenWidth, PicoScreenHeight, SCREEN_BPP, 0, 0, 0, 0);
+
+    _audio = audio;
+    audioSetup();
+
+    last_time = 0;
+    now_time = 0;
+    frame_time = 0;
+    targetFrameTimeMs = 0;
+
+    _paletteColors = paletteColors;
+
+    SDL_PixelFormat *f = window->format;
+
+    for(int i = 0; i < 144; i++){
+        _mapped16BitColors[i] = SDL_MapRGB(f, _paletteColors[i].Red, _paletteColors[i].Green, _paletteColors[i].Blue);
+    }
+
+
+    _windowWidth = SCREEN_SIZE_X;
+    _windowHeight = SCREEN_SIZE_Y;
+
+    //TODO: store in settings INI
+    stretch = StretchToFill;
+    loadSettingsIni();
+
+    _changeStretch(stretch);
+}
+
+void Host::oneTimeCleanup(){
+    audioCleanup();
+
+    //saving seems to increase the number of hard locks
+    saveSettingsIni();
+
+    //SDL_DestroyRenderer(renderer);
+    //SDL_DestroyWindow(window);
+
+    SDL_FreeSurface(texture);
+    SDL_FreeSurface(window);
+
+    SDL_Quit();
+}
+
+void Host::setTargetFps(int targetFps){
+    targetFrameTimeMs = 1000 / targetFps;
+}
+
+void Host::changeStretch(){
+    if (stretchKeyPressed) {
+        StretchOption newStretch = stretch;
+
+        if (stretch == StretchAndOverflow) {
+            newStretch = PixelPerfect;
+        }
+        else if (stretch == PixelPerfect) {
+            newStretch = StretchToFill;
+        }
+        else{
+            newStretch = StretchAndOverflow;
+        }
+
+        _changeStretch(newStretch);
+
+        stretch = newStretch;
+        scaleX = _screenWidth / (float)PicoScreenWidth;
+        scaleY = _screenHeight / (float)PicoScreenHeight;
+        mouseOffsetX = DestR.x;
+        mouseOffsetY = DestR.y;
+    }
+}
+
+InputState_t Host::scanInput(){
+    currKDown = 0;
+    currKHeld = 0;
+    stretchKeyPressed = false;
+
+    while (SDL_PollEvent(&event)) {
+        switch (event.type) {
+            case SDL_KEYDOWN:
+                switch (event.key.keysym.sym)
+                {
+                    case SDLK_RETURN:currKDown |= P8_KEY_PAUSE; break;
+                    case SDLK_LEFT:  currKDown |= P8_KEY_LEFT; break;
+                    case SDLK_RIGHT: currKDown |= P8_KEY_RIGHT; break;
+                    case SDLK_UP:    currKDown |= P8_KEY_UP; break;
+                    case SDLK_DOWN:  currKDown |= P8_KEY_DOWN; break;
+                    case SDLK_SPACE: currKDown |= P8_KEY_X; break;
+                    case SDLK_LSHIFT:currKDown |= P8_KEY_O; break;
+                    case SDLK_LALT:  currKDown |= P8_KEY_X; break;
+                    case SDLK_LCTRL: currKDown |= P8_KEY_O; break;
+                    case SDLK_RCTRL: done = SDL_TRUE; break;
+                    case SDLK_ESCAPE: stretchKeyPressed = true; break;
+                    default: break;
+                }
+                break;
+            case SDL_QUIT:
+                done = SDL_TRUE;
+                break;
+        }
+    }
+
+    const Uint8* keystate = SDL_GetKeyState(NULL);
+
+    //continuous-response keys
+    if(keystate[SDLK_LEFT]){
+        currKHeld |= P8_KEY_LEFT;
+    }
+    if(keystate[SDLK_RIGHT]){
+        currKHeld |= P8_KEY_RIGHT;;
+    }
+    if(keystate[SDLK_UP]){
+        currKHeld |= P8_KEY_UP;
+    }
+    if(keystate[SDLK_DOWN]){
+        currKHeld |= P8_KEY_DOWN;
+    }
+    if(keystate[SDLK_SPACE]){
+        currKHeld |= P8_KEY_X;
+    }
+    if(keystate[SDLK_LSHIFT]){
+        currKHeld |= P8_KEY_O;
+    }
+    if(keystate[SDLK_LALT]){
+        currKHeld |= P8_KEY_X;
+    }
+    if(keystate[SDLK_LCTRL]){
+        currKHeld |= P8_KEY_O;
+    }
+    if(keystate[SDLK_RETURN]){
+        currKHeld |= P8_KEY_PAUSE;
+    }
+
+
+    return InputState_t {
+        currKDown,
+        currKHeld
+    };
+}
+
+bool Host::shouldQuit() {
+    return done == SDL_TRUE;
+}
+
+void Host::waitForTargetFps(){
+    now_time = SDL_GetTicks();
+    frame_time = now_time - last_time;
+	last_time = now_time;
+
+
+	//sleep for remainder of time
+	if (frame_time < targetFrameTimeMs) {
+		uint32_t msToSleep = targetFrameTimeMs - frame_time;
+
+        SDL_Delay(msToSleep);
+
+		last_time += msToSleep;
+	}
+}
+
+/*
+void set_pixel(SDL_Surface *surface, int x, int y, uint16_t pixel)
+{
+  uint16_t * const target_pixel = (uint16_t *) ((Uint8 *) surface->pixels
+                                             + y * surface->pitch
+                                             + x * surface->format->BytesPerPixel);
+  *target_pixel = pixel;
+}
+*/
+
+void Host::drawFrame(uint8_t* picoFb, uint8_t* screenPaletteMap, uint8_t drawMode){
+    drawModeScaleX = 1;
+    drawModeScaleY = 1;
+    switch(drawMode){
+        case 1:
+            drawModeScaleX = 2;
+            textureAngle = 0;
+            flip = 0;
+            break;
+        case 2:
+            drawModeScaleY = 2;
+            textureAngle = 0;
+            flip = 0;
+            break;
+        case 3:
+            drawModeScaleX = 2;
+            drawModeScaleY = 2;
+            textureAngle = 0;
+            flip = 0;
+            break;
+        //todo: mirroring
+        //case 4,6,7
+        case 129:
+            textureAngle = 0;
+            flip = 1;
+            break;
+        case 130:
+            textureAngle = 0;
+            flip = 2;
+            break;
+        case 131:
+            textureAngle = 0;
+            flip = 3;
+            break;
+        case 133:
+            textureAngle = 90;
+            flip = 0;
+            break;
+        case 134:
+            textureAngle = 180;
+            flip = 0;
+            break;
+        case 135:
+            textureAngle = 270;
+            flip = 0;
+            break;
+        default:
+
+            textureAngle = 0;
+            flip = 0;
+            break;
+    }
+    int yoffset = stretch == StretchAndOverflow ? 4 / drawModeScaleX : 0;
+
+    _setSourceRect(0, yoffset);
+
+    pixels = texture->pixels;
+
+    //horizontal flip
+    if (textureAngle == 0 && flip == 1) {
+        for (int y = 0; y < PicoScreenHeight; y ++){
+            for (int x = 0; x < PicoScreenWidth; x ++){
+                uint8_t c = getPixelNibble(x, y, picoFb);
+                uint16_t col = _mapped16BitColors[screenPaletteMap[c]];
+
+                base = ((uint16_t *)pixels) + ( y * PicoScreenHeight + (127 - x));
+                base[0] = col;
+            }
+        }
+    }
+    //vertical flip
+    else if (textureAngle == 0 && flip == 2) {
+        for (int y = 0; y < PicoScreenHeight; y ++){
+            for (int x = 0; x < PicoScreenWidth; x ++){
+                uint8_t c = getPixelNibble(x, y, picoFb);
+                uint16_t col = _mapped16BitColors[screenPaletteMap[c]];
+
+                base = ((uint16_t *)pixels) + ((127 - y) * PicoScreenHeight + x);
+                base[0] = col;
+            }
+        }
+    }
+    //horizontal and vertical flip
+    else if (textureAngle == 0 && flip == 3) {
+        for (int y = 0; y < PicoScreenHeight; y ++){
+            for (int x = 0; x < PicoScreenWidth; x ++){
+                uint8_t c = getPixelNibble(x, y, picoFb);
+                uint16_t col = _mapped16BitColors[screenPaletteMap[c]];
+
+                base = ((uint16_t *)pixels) + ((127 - y) * PicoScreenHeight + (127 - x));
+                base[0] = col;
+            }
+        }
+    }
+    //rotated 90 degrees
+    else if (textureAngle == 90 && flip == 0) {
+        for (int y = 0; y < PicoScreenHeight; y ++){
+            for (int x = 0; x < PicoScreenWidth; x ++){
+                uint8_t c = getPixelNibble(x, y, picoFb);
+                uint16_t col = _mapped16BitColors[screenPaletteMap[c]];
+
+                base = ((uint16_t *)pixels) + (x * PicoScreenHeight + (127 - y));
+                base[0] = col;
+            }
+        }
+    }
+    //rotated 180 degrees
+    else if (textureAngle == 180 && flip == 0) {
+        for (int y = 0; y < PicoScreenHeight; y ++){
+            for (int x = 0; x < PicoScreenWidth; x ++){
+                uint8_t c = getPixelNibble(x, y, picoFb);
+                uint16_t col = _mapped16BitColors[screenPaletteMap[c]];
+
+                base = ((uint16_t *)pixels) + ((127 - y) * PicoScreenHeight + (127 - x));
+                base[0] = col;
+            }
+        }
+    }
+    //rotated 270 degrees
+    else if (textureAngle == 270 && flip == 0) {
+        for (int y = 0; y < PicoScreenHeight; y ++){
+            for (int x = 0; x < PicoScreenWidth; x ++){
+                uint8_t c = getPixelNibble(x, y, picoFb);
+                uint16_t col = _mapped16BitColors[screenPaletteMap[c]];
+
+                base = ((uint16_t *)pixels) + ((127 - x) * PicoScreenHeight + y);
+                base[0] = col;
+            }
+        }
+    }
+    else { //default
+        for (int y = 0; y < PicoScreenHeight; y ++){
+            for (int x = 0; x < pixelBlocksPerLine; x ++){
+                int32_t eightPix = ((int32_t*)picoFb)[y * pixelBlocksPerLine + x];
+
+                int h = (eightPix >> 28) & 0x0f;
+                int g = (eightPix >> 24) & 0x0f;
+                int f = (eightPix >> 20) & 0x0f;
+                int e = (eightPix >> 16) & 0x0f;
+                int d = (eightPix >> 12) & 0x0f;
+                int c = (eightPix >>  8) & 0x0f;
+                int b = (eightPix >>  4) & 0x0f;
+                int a = (eightPix)       & 0x0f;
+
+                int32_t cola = _mapped16BitColors[screenPaletteMap[a]];
+                int32_t colb = _mapped16BitColors[screenPaletteMap[b]];
+                int32_t colc = _mapped16BitColors[screenPaletteMap[c]];
+                int32_t cold = _mapped16BitColors[screenPaletteMap[d]];
+                int32_t cole = _mapped16BitColors[screenPaletteMap[e]];
+                int32_t colf = _mapped16BitColors[screenPaletteMap[f]];
+                int32_t colg = _mapped16BitColors[screenPaletteMap[g]];
+                int32_t colh = _mapped16BitColors[screenPaletteMap[h]];
+
+
+                base = ((uint16_t *)pixels + (y * PicoScreenHeight + x * 8));
+                base[0] = cola;
+                base[1] = colb;
+                base[2] = colc;
+                base[3] = cold;
+                base[4] = cole;
+                base[5] = colf;
+                base[6] = colg;
+                base[7] = colh;
+
+
+                //----OR something like this for further optimization?
+                //not exactly this. its broken
+                /*
+                int32_t* base32 = ((int32_t *)pixels + (y * PicoScreenHeight + x * 8));
+                base32[0] = cola << 16 & colb;
+                base32[1] = colc << 16 & cold;
+                base32[2] = cole << 16 & colf;
+                base32[3] = colg << 16 & colh;
+                */
+
+
+            }
+        }
+    }
+
+    postFlipFunction();
+}
+
+bool Host::shouldFillAudioBuff(){
+    return false;
+}
+
+void* Host::getAudioBufferPointer(){
+    return nullptr;
+}
+
+size_t Host::getAudioBufferSize(){
+    return 0;
+}
+
+void Host::playFilledAudioBuffer(){
+}
+
+bool Host::shouldRunMainLoop(){
+    if (shouldQuit()){
+        return false;
+    }
+
+    return true;
+}
+
+vector<string> Host::listcarts(){
+    vector<string> carts;
+
+    DIR *dir;
+    struct dirent *ent;
+    if ((dir = opendir (_cartDirectory.c_str())) != NULL) {
+        /* print all the files and directories within directory */
+        while ((ent = readdir (dir)) != NULL) {
+            if (isCartFile(ent->d_name)){
+                carts.push_back(_cartDirectory + "/" + ent->d_name);
+            }
+        }
+        closedir (dir);
+    } else {
+        /* could not open directory */
+        perror ("");
+    }
+
+
+    return carts;
+}
+
+const char* Host::logFilePrefix() {
+    return "";
+}
+
+std::string Host::customBiosLua() {
+    return "cartpath = \"roms/pico/\"\n"
+        "selectbtn = \"z\"\n"
+        "pausebtn = \"esc\""
+        "exitbtn = \"close window\""
+        "sizebtn = \"\"";
+}
+
+std::string Host::getCartDirectory() {
+    return _cartDirectory;
+}