foxygit / fake-08-xbox360 Log in
commit 923d24fdb14ed50b4fe2ccee438d8b538351a83e
Author:     Jon Bell <j.to.the.bell@gmail.com>
AuthorDate: Sat Feb 27 12:10:21 2021 -0700
Commit:     jtothebell <j.to.the.bell@gmail.com>
CommitDate: Wed Mar 3 20:25:06 2021 -0700

    Initial basic vita support

    building and working in emulator, no CI build yet- cleanup needed
    Also fix pause menu by registering functions in needed order
---
 .github/workflows/build.yml                        |  22 +-
 .github/workflows/buildVita.sh                     |   7 +
 .gitignore                                         |   6 +
 Makefile                                           |  10 +-
 platform/vita/Makefile                             |  72 ++++
 platform/vita/sce_sys/icon0.png                    | Bin 0 -> 781 bytes
 platform/vita/sce_sys/livearea/contents/bg.png     | Bin 0 -> 324 bytes
 .../vita/sce_sys/livearea/contents/startup.png     | Bin 0 -> 1602 bytes
 .../vita/sce_sys/livearea/contents/template.xml    |  11 +
 platform/vita/source/VitaHost.cpp                  | 386 +++++++++++++++++++++
 source/logger.cpp                                  |   4 +
 source/vm.cpp                                      |  42 +--
 12 files changed, 525 insertions(+), 35 deletions(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index e8565f3..1159fa2 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -69,8 +69,28 @@ jobs:
           path: |
             platform/wiiu/*.elf
             platform/wiiu/*.rpx
-
+
   fourth:
+    name: Vita
+    runs-on: ubuntu-latest
+
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v2
+        with:
+          submodules : recursive
+
+      - name: Build
+        run: |
+          docker run -e ENABLE_COMPATIBILITY_REPORTING -v $GITHUB_WORKSPACE:/build_dir vitasdk/vitasdk /bin/sh -ex /build_dir/.github/workflows/buildVita.sh
+
+      - uses: actions/upload-artifact@v2
+        with:
+          name: PS Vita
+          path: |
+            platform/vita/*.vpk
+
+  fifth:
     name: Tests
     runs-on: ubuntu-latest

diff --git a/.github/workflows/buildVita.sh b/.github/workflows/buildVita.sh
new file mode 100644
index 0000000..1124f2f
--- /dev/null
+++ b/.github/workflows/buildVita.sh
@@ -0,0 +1,7 @@
+#install dependencies
+apk add build-base
+
+cd /build_dir
+
+#Build vpk
+make vita
diff --git a/.gitignore b/.gitignore
index ed028b8..df19c97 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,6 +11,8 @@

 *.rpx

+*.o
+
 bin/
 .vscode/
 build/
@@ -29,3 +31,7 @@ platform/SDL2/*.d
 platform/SDL2/fake08
 platform/SDL2/FAKE08
 pico.log
+platform/vita/eboot.bin
+platform/vita/*.velf
+platform/vita/*.vpk
+platform/vita/param.sfo
diff --git a/Makefile b/Makefile
index 14c9b62..e7b4f2f 100644
--- a/Makefile
+++ b/Makefile
@@ -6,11 +6,11 @@ ROOT_INCLUDES	?= include
 export SOURCES   = ../../source ../../libs/z8lua ../../libs/utf8-util ../../libs/lodepng
 export INCLUDES  = ../../include ../../libs/z8lua ../../libs/utf8-util ../../libs/lodepng

-.PHONY: all 3ds switch wiiu sdl2 clean clean-3ds clean-switch clean-wiiu clean-sdl2
+.PHONY: all 3ds switch wiiu vita sdl2 clean clean-3ds clean-switch clean-wiiu clean-vita clean-sdl2

 all: 3ds switch wiiu sdl2

-clean: clean-tests clean-3ds clean-switch clean-wiiu clean-sdl2
+clean: clean-tests clean-3ds clean-switch clean-wiiu clean-vita clean-sdl2

 clean-3ds:
 	@$(MAKE) -C platform/3ds clean
@@ -21,6 +21,9 @@ clean-switch:
 clean-wiiu:
 	@$(MAKE) -C platform/wiiu clean

+clean-vita:
+	@$(MAKE) -C platform/vita clean
+
 clean-sdl2:
 	@$(MAKE) -C platform/SDL2 clean

@@ -36,6 +39,9 @@ switch:
 wiiu:
 	@$(MAKE) -C platform/wiiu

+vita:
+	@$(MAKE) -C platform/vita
+
 sdl2:
 	@$(MAKE) -C platform/SDL2

diff --git a/platform/vita/Makefile b/platform/vita/Makefile
new file mode 100644
index 0000000..a9ed141
--- /dev/null
+++ b/platform/vita/Makefile
@@ -0,0 +1,72 @@
+PROJECT_TITLE := FAKE-08
+PROJECT_TITLEID := FAKE00008
+
+PROJECT := fake_08
+
+PHONY := all package clean
+
+SOURCES	:=	${SOURCES} source
+INCLUDES	:=	${INCLUDES}
+
+LIBS = -lSDL2 -lvita2d -lSceDisplay_stub -lSceCtrl_stub -lSceAudio_stub \
+		-lSceSysmodule_stub -lSceGxm_stub -lSceCommonDialog_stub \
+		-lSceAppMgr_stub -lSceTouch_stub -lSceHid_stub -lSceMotion_stub -lm
+
+CFILES   := $(foreach dir,$(SOURCES), $(wildcard $(dir)/*.c))
+CPPFILES   := $(foreach dir,$(SOURCES), $(wildcard $(dir)/*.cpp))
+OBJS     := $(CFILES:.c=.o) $(CPPFILES:.cpp=.o)
+
+export INCLUDE		:=	$(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
+				$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
+				-I$(CURDIR)/$(BUILD)
+
+PREFIX  = arm-vita-eabi
+CC      = $(PREFIX)-gcc
+CXX      = $(PREFIX)-g++
+STRIP := $(PREFIX)-strip
+CFLAGS  = -g -Wl,-q -O2 -ftree-vectorize -D__VITA__ $(INCLUDE)
+CXXFLAGS  = $(CFLAGS) -fexceptions -std=gnu++11 -fpermissive
+ASFLAGS = $(CFLAGS)
+
+CC = $(CXX)
+
+
+
+all: package
+
+package: $(PROJECT).vpk
+
+$(PROJECT).vpk: eboot.bin param.sfo
+	vita-pack-vpk -s param.sfo -b eboot.bin \
+		--add sce_sys/icon0.png=sce_sys/icon0.png \
+		--add sce_sys/livearea/contents/bg.png=sce_sys/livearea/contents/bg.png \
+		--add sce_sys/livearea/contents/startup.png=sce_sys/livearea/contents/startup.png \
+		--add sce_sys/livearea/contents/template.xml=sce_sys/livearea/contents/template.xml \
+	$(PROJECT).vpk
+
+eboot.bin: $(PROJECT).velf
+	vita-make-fself $(PROJECT).velf eboot.bin
+
+param.sfo:
+	vita-mksfoex -s TITLE_ID="$(PROJECT_TITLEID)" "$(PROJECT_TITLE)" param.sfo
+
+$(PROJECT).velf: $(PROJECT).elf
+	$(STRIP) -g $<
+	vita-elf-create $< $@
+
+$(PROJECT).elf: $(OBJS)
+	$(CXX) $(CXXFLAGS) $^ $(LIBS) -o $@
+
+
+
+
+clean:
+	rm -f $(PROJECT).velf $(PROJECT).elf $(PROJECT).vpk param.sfo eboot.bin $(OBJS)
+
+vpksend: $(PROJECT).vpk
+	curl -T $(PROJECT).vpk ftp://$(PSVITAIP):1337/ux0:/
+	@echo "Sent."
+
+send: eboot.bin
+	curl -T eboot.bin ftp://$(PSVITAIP):1337/ux0:/app/$(TITLE_ID)/
+	@echo "Sent."
diff --git a/platform/vita/sce_sys/icon0.png b/platform/vita/sce_sys/icon0.png
new file mode 100644
index 0000000..c0c0246
Binary files /dev/null and b/platform/vita/sce_sys/icon0.png differ
diff --git a/platform/vita/sce_sys/livearea/contents/bg.png b/platform/vita/sce_sys/livearea/contents/bg.png
new file mode 100644
index 0000000..0589e4a
Binary files /dev/null and b/platform/vita/sce_sys/livearea/contents/bg.png differ
diff --git a/platform/vita/sce_sys/livearea/contents/startup.png b/platform/vita/sce_sys/livearea/contents/startup.png
new file mode 100644
index 0000000..d3ed78e
Binary files /dev/null and b/platform/vita/sce_sys/livearea/contents/startup.png differ
diff --git a/platform/vita/sce_sys/livearea/contents/template.xml b/platform/vita/sce_sys/livearea/contents/template.xml
new file mode 100644
index 0000000..a4d43f0
--- /dev/null
+++ b/platform/vita/sce_sys/livearea/contents/template.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<livearea style="a1" format-ver="01.00" content-rev="1">
+	<livearea-background>
+		<image>bg.png</image>
+	</livearea-background>
+
+	<gate>
+		<startup-image>startup.png</startup-image>
+	</gate>
+</livearea>
diff --git a/platform/vita/source/VitaHost.cpp b/platform/vita/source/VitaHost.cpp
new file mode 100644
index 0000000..14adbfb
--- /dev/null
+++ b/platform/vita/source/VitaHost.cpp
@@ -0,0 +1,386 @@
+
+#include <stdio.h>
+#include <string.h>
+#include <dirent.h>
+#include <errno.h>
+#include <unistd.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 <psp2/kernel/processmgr.h>
+#include <psp2/io/fcntl.h>
+
+// sdl
+#include <SDL2/SDL.h>
+#include <SDL2/SDL_events.h>
+
+#define SCREEN_SIZE_X 512
+#define SCREEN_SIZE_Y 512
+
+#define WIN_WIDTH 960
+#define WIN_HEIGHT 544
+
+
+#define SAMPLERATE 22050
+#define SAMPLESPERBUF (SAMPLERATE / 30)
+#define NUM_BUFFERS 2
+
+#define R_SUCCEEDED(res)   ((res)>=0)
+#define R_FAILED(res)      ((res)<0)
+
+//these controller button defines from: https://github.com/RossMeikleham/Vita_SDL2_Examples
+//MIT license
+#define SDLK_VITA_TRIANGLE 0
+#define SDLK_VITA_CIRCLE 1
+#define SDLK_VITA_CROSS 2
+#define SDLK_VITA_SQUARE 3
+
+#define SDLK_VITA_LTRIGGER 4
+#define SDLK_VITA_RTRIGGER 5
+
+#define SDLK_VITA_DOWN 6
+#define SDLK_VITA_LEFT 7
+#define SDLK_VITA_UP 8
+#define SDLK_VITA_RIGHT 9
+
+//Vita filesystem helpers: https://github.com/joel16/VITAlbum
+//MIT license
+#define SDLK_VITA_SELECT 10
+#define SDLK_VITA_START 11
+
+const int __screenWidth = SCREEN_SIZE_X;
+const int __screenHeight = SCREEN_SIZE_Y;
+
+const int PicoScreenWidth = 128;
+const int PicoScreenHeight = 128;
+
+
+StretchOption stretch;
+uint32_t last_time;
+uint32_t now_time;
+uint32_t frame_time;
+uint32_t targetFrameTimeMs;
+
+uint8_t currKDown;
+uint8_t currKHeld;
+bool lDown = false;
+bool rDown = false;
+
+Color* _paletteColors;
+
+SDL_Window* window;
+SDL_Event event;
+SDL_Renderer *renderer;
+SDL_Texture *texture = NULL;
+int quit = 0;
+void *pixels;
+uint8_t *base;
+int pitch;
+
+SDL_Rect DestR;
+
+void postFlipFunction(){
+    //flush switch frame buffers
+    // We're done rendering, so we end the frame here.
+
+
+    SDL_UnlockTexture(texture);
+    SDL_RenderCopy(renderer, texture, NULL, &DestR);
+
+    SDL_RenderPresent(renderer);
+}
+
+
+void init_fill_buffer(void *audioBuffer,size_t offset, size_t size) {
+
+	uint32_t *dest = (uint32_t*)audioBuffer;
+
+	for (size_t i=0; i<size; i++) {
+		dest[i] = 0;
+	}
+
+	//DSP_FlushDataCache(audioBuffer,size);
+
+}
+
+bool audioInitialized = false;
+uint32_t *audioBuffer;
+uint32_t audioBufferSize;
+//ndspWaveBuf waveBuf[2];
+bool fillBlock = false;
+uint32_t currPos;
+
+
+void audioCleanup(){
+    audioInitialized = false;
+
+    //ndspExit();
+
+    if(audioBuffer != nullptr) {
+        //linearFree(audioBuffer);
+        audioBuffer = nullptr;
+    }
+}
+
+void audioSetup(){
+
+}
+
+Host::Host() { }
+
+
+void Host::oneTimeSetup(Color* paletteColors){
+
+    // ----- Initialize SDL
+    if (SDL_Init(SDL_INIT_EVERYTHING) != 0)
+    {
+        fprintf(stderr, "SDL could not initialize\n");
+        quit = 1;
+        return;
+    }
+
+    //Setup window
+	window = SDL_CreateWindow(nullptr, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 0, 0, SDL_WINDOW_FULLSCREEN_DESKTOP);
+	if (!window)
+    {
+        quit = 1;
+        return;
+    }
+
+	//Setup renderer
+	renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
+	if (!renderer)
+    {
+        quit = 1;
+        return;
+    }
+
+	texture  = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_STREAMING, PicoScreenWidth, PicoScreenHeight);
+	if (texture == NULL)
+    {
+		quit = 1;
+        return;
+	}
+
+    atexit(SDL_Quit);
+
+    DestR.x = WIN_WIDTH / 2 - SCREEN_SIZE_X / 2;
+    DestR.y = WIN_HEIGHT / 2 - SCREEN_SIZE_Y / 2;
+    DestR.w = SCREEN_SIZE_X;
+    DestR.h = SCREEN_SIZE_Y;
+
+    audioSetup();
+
+    for (int i = 0; i < SDL_NumJoysticks(); i++) {
+		if (SDL_JoystickOpen(i) == NULL) {
+			printf("Failed to open joystick %d!\n", i);
+			quit = 1;
+		}
+    }
+
+
+    last_time = 0;
+    now_time = 0;
+    frame_time = 0;
+    targetFrameTimeMs = 0;
+
+    _paletteColors = paletteColors;
+}
+
+void Host::oneTimeCleanup(){
+    audioCleanup();
+
+    SDL_DestroyTexture(texture);
+    SDL_DestroyRenderer(renderer);
+    SDL_DestroyWindow(window);
+    SDL_Quit();
+
+    sceKernelExitProcess(0);
+}
+
+void Host::setTargetFps(int targetFps){
+    targetFrameTimeMs = 1000 / targetFps;
+}
+
+void Host::changeStretch(){
+}
+
+InputState_t Host::scanInput(){
+    currKDown = 0;
+    uint8_t kUp = 0;
+    //Logger::Write("Scan input\n");
+
+
+//check input here (call open joystick):
+//https://github.com/ulquiorra-dev/Simple_SDL_Snake_WiiU_Port/blob/master/source/main.c
+//tetris calls open joystick:
+//https://github.com/ulquiorra-dev/SDL_TETRIS_WiiU_Port/blob/master/src/main.c
+
+    while (SDL_PollEvent(&event)) {
+        switch (event.type) {
+            case SDL_JOYBUTTONDOWN :
+                switch (event.jbutton.button)
+                {
+                    case SDLK_VITA_START:currKDown |= P8_KEY_PAUSE; break;
+                    case SDLK_VITA_LEFT:  currKDown |= P8_KEY_LEFT; break;
+                    case SDLK_VITA_RIGHT: currKDown |= P8_KEY_RIGHT; break;
+                    case SDLK_VITA_UP:    currKDown |= P8_KEY_UP; break;
+                    case SDLK_VITA_DOWN:  currKDown |= P8_KEY_DOWN; break;
+                    case SDLK_VITA_CROSS:     currKDown |= P8_KEY_X; break;
+                    case SDLK_VITA_CIRCLE:     currKDown |= P8_KEY_O; break;
+                    case SDLK_VITA_LTRIGGER: lDown = true; break;
+                    case SDLK_VITA_RTRIGGER: rDown = true; break;
+                }
+                break;
+
+            case SDL_JOYBUTTONUP :
+                switch (event.jbutton.button)
+                {
+                    case SDLK_VITA_START:kUp |= P8_KEY_PAUSE; break;
+                    case SDLK_VITA_LEFT:  kUp |= P8_KEY_LEFT; break;
+                    case SDLK_VITA_RIGHT: kUp |= P8_KEY_RIGHT; break;
+                    case SDLK_VITA_UP:    kUp |= P8_KEY_UP; break;
+                    case SDLK_VITA_DOWN:  kUp |= P8_KEY_DOWN; break;
+                    case SDLK_VITA_CROSS:     kUp |= P8_KEY_X; break;
+                    case SDLK_VITA_CIRCLE:     kUp |= P8_KEY_O; break;
+                    case SDLK_VITA_LTRIGGER: lDown = false; break;
+                    case SDLK_VITA_RTRIGGER: rDown = false; break;
+                }
+               break;
+
+            case SDL_QUIT:
+                quit = 1;
+                break;
+        }
+    }
+
+    if (lDown && rDown){
+        quit = 1;
+    }
+
+    currKHeld |= currKDown;
+    currKHeld ^= kUp;
+
+    return InputState_t {
+        currKDown,
+        currKHeld
+    };
+
+}
+
+bool Host::shouldQuit() {
+    return quit > 0;
+}
+
+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 Host::drawFrame(uint8_t* picoFb, uint8_t* screenPaletteMap){
+    //clear screen to all black
+    SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0);
+    SDL_RenderClear(renderer);
+
+    SDL_LockTexture(texture, NULL, &pixels, &pitch);
+
+    for (int y = 0; y < PicoScreenHeight; y ++){
+        for (int x = 0; x < PicoScreenWidth; x ++){
+            uint8_t c = getPixelNibble(x, y, picoFb);
+            Color col = _paletteColors[screenPaletteMap[c]];
+
+            base = ((Uint8 *)pixels) + (4 * ( y * PicoScreenHeight + x));
+            base[0] = col.Alpha;
+            base[1] = col.Blue;
+            base[2] = col.Green;
+            base[3] = col.Red;
+        }
+    }
+
+
+    postFlipFunction();
+}
+
+bool Host::shouldFillAudioBuff(){
+    //return waveBuf[fillBlock].status == NDSP_WBUF_DONE;
+    return false;
+}
+
+void* Host::getAudioBufferPointer(){
+    //return waveBuf[fillBlock].data_pcm16;
+    return nullptr;
+}
+
+size_t Host::getAudioBufferSize(){
+    //return waveBuf[fillBlock].nsamples;
+    return 0;
+}
+
+void Host::playFilledAudioBuffer(){
+    //DSP_FlushDataCache(waveBuf[fillBlock].data_pcm16, waveBuf[fillBlock].nsamples);
+
+	//ndspChnWaveBufAdd(0, &waveBuf[fillBlock]);
+
+	//fillBlock = !fillBlock;
+}
+
+bool Host::shouldRunMainLoop(){
+
+    //check how tetris handles update loop - quit flag
+    //https://github.com/ulquiorra-dev/SDL_TETRIS_WiiU_Port/blob/master/src/main.c
+    return !quit;
+}
+
+
+vector<string> Host::listcarts(){
+    vector<string> carts;
+
+    std::string cartDir = "p8carts";
+    std::string container = "ux0:/";
+    std::string fullCartDir = container + cartDir;
+
+    SceUID dir = 0;
+    int ret = 0;
+
+    if (R_SUCCEEDED(dir = sceIoDopen(fullCartDir.c_str()))) {
+
+        do {
+            SceIoDirent dirent;
+
+            if (R_FAILED(ret = sceIoDread(dir, &dirent))) {
+                Logger_Write("Error: sceIoDread(%s) failed: 0x%lx\n", fullCartDir.c_str(), ret);
+                continue;
+            }
+
+            if (SCE_S_ISDIR(dirent.d_stat.st_mode)) {
+                continue;
+            }
+
+            carts.push_back(fullCartDir + "/" + dirent.d_name);
+        } while (ret > 0);
+
+        sceIoDclose(dir);
+    }
+
+    return carts;
+}
+
diff --git a/source/logger.cpp b/source/logger.cpp
index 69bcf8b..1a80e32 100644
--- a/source/logger.cpp
+++ b/source/logger.cpp
@@ -8,7 +8,11 @@ bool m_enabled = false;

 void Logger_Initialize()
 {
+    #if __VITA__
+    m_file = freopen("ux0:/pico.log", "w", stderr);
+    #else
     m_file = freopen("pico.log", "w", stderr);
+    #endif
     m_enabled = true;
 }

diff --git a/source/vm.cpp b/source/vm.cpp
index 82895e0..209c379 100644
--- a/source/vm.cpp
+++ b/source/vm.cpp
@@ -149,6 +149,15 @@ bool Vm::loadCart(Cart* cart) {
     luaL_openlibs(_luaState);
     lua_pushglobaltable(_luaState);

+    //system
+    //must be registered before loading globals for pause menu to work
+    lua_register(_luaState, "__listcarts", listcarts);
+    lua_register(_luaState, "__loadcart", loadcart);
+    lua_register(_luaState, "__getbioserror", getbioserror);
+    lua_register(_luaState, "__loadbioscart", loadbioscart);
+    lua_register(_luaState, "__togglepausemenu", togglepausemenu);
+    lua_register(_luaState, "__resetcart", resetcart);
+
     //load in global lua fuctions for pico 8
     auto convertedGlobalLuaFunctions = convert_emojis(p8GlobalLuaFunctions);
     int loadedGlobals = luaL_dostring(_luaState, convertedGlobalLuaFunctions.c_str());
@@ -234,15 +243,7 @@ bool Vm::loadCart(Cart* cart) {
     //rng
     lua_register(_luaState, "rnd", rnd);
     lua_register(_luaState, "srand", srand);
-
-    //system
-    lua_register(_luaState, "__listcarts", listcarts);
-    lua_register(_luaState, "__loadcart", loadcart);
-    lua_register(_luaState, "__getbioserror", getbioserror);
-    lua_register(_luaState, "__loadbioscart", loadbioscart);
-    lua_register(_luaState, "__togglepausemenu", togglepausemenu);
-    lua_register(_luaState, "__resetcart", resetcart);
-
+

     int loadedCart = luaL_loadstring(_luaState, cart->LuaString.c_str());
     if (loadedCart != LUA_OK) {
@@ -372,30 +373,7 @@ void Vm::UpdateAndDraw() {
     }

     if (_pauseMenu){
-        //3 item menu (default) 82x34
-        //23, 47, 23 + 82, 47 + 34
-        //pause menu handled in lua firmware now
-        /*
-        uint8_t preColor = _memory->drawState.color;
-        uint8_t fillp0 = _memory->drawState.fillPattern[0];
-        uint8_t fillp1 = _memory->drawState.fillPattern[1];
-        _memory->drawState.fillPattern[0] = 0;
-        _memory->drawState.fillPattern[1] = 0;
-        _graphics->rectfill(23, 47, 23 + 82, 47 + 34, 0);
-        _graphics->rect(24, 48, 24 + 80, 48 + 32, 7);
-        _graphics->print("paused", 30, 55, 7);
-
-        if (_input->btnp(4)) {
-            togglePauseMenu();
-            QueueCartChange("__FAKE08-BIOS.p8");
-        }

-        _memory->drawState.fillPattern[0] = fillp0;
-        _memory->drawState.fillPattern[1] = fillp1;
-        _memory->drawState.color = preColor;
-        */
-
-        //todo: fix crash here
         lua_getglobal(_luaState, "__f08_menu_update");
         lua_call(_luaState, 0, 0);
         lua_pop(_luaState, 0);