diff --git a/src/main.c b/src/main.c index 60efa93..c518788 100644 --- a/src/main.c +++ b/src/main.c @@ -941,6 +941,11 @@ static void _goFullscreen() SDL_SetWindowFullscreen(platform.window, platform.fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0); } +static void _showMessageBox(const char* title, const char* message) +{ + SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING, title, message, NULL); +} + static System sysHandlers = { .setClipboardText = _setClipboardText, @@ -957,6 +962,7 @@ static System sysHandlers = .file_dialog_save = file_dialog_save, .goFullscreen = _goFullscreen, + .showMessageBox = _showMessageBox, }; s32 main(s32 argc, char **argv) diff --git a/src/studio.c b/src/studio.c index f97a133..b654f92 100644 --- a/src/studio.c +++ b/src/studio.c @@ -2569,18 +2569,18 @@ u32 unzip(u8** dest, const u8* source, size_t size) static void initKeymap() { - // FileSystem* fs = studioImpl.fs; + FileSystem* fs = studioImpl.fs; - // s32 size = 0; - // u8* data = (u8*)fsLoadFile(fs, KEYMAP_DAT_PATH, &size); + s32 size = 0; + u8* data = (u8*)fsLoadFile(fs, KEYMAP_DAT_PATH, &size); - // if(data) - // { - // if(size == KEYMAP_SIZE) - // memcpy(getKeymap(), data, KEYMAP_SIZE); + if(data) + { + if(size == KEYMAP_SIZE) + memcpy(getKeymap(), data, KEYMAP_SIZE); - // free(data); - // } + free(data); + } } static void onFSInitialized(FileSystem* fs) @@ -2803,26 +2803,6 @@ void studioClose() if(studioImpl.tic80local) tic80_delete((tic80*)studioImpl.tic80local); - - // if(studioImpl.audio.cvt.buf) - // free(studioImpl.audio.cvt.buf); - - // SDL_DestroyTexture(studioImpl.gamepad.texture); - // SDL_DestroyTexture(studioImpl.texture); - - // if(studioImpl.mouse.texture) - // SDL_DestroyTexture(studioImpl.mouse.texture); - - // SDL_DestroyRenderer(studioImpl.renderer); - // SDL_DestroyWindow(studioImpl.window); - -// #if !defined (__MACOSX__) - // stucks here on macos - // SDL_CloseAudioDevice(studioImpl.audio.device); - // SDL_Quit(); -// #endif - - // exit(0); } void setClipboardText(const char* text) @@ -3035,5 +3015,5 @@ void netDirRequest(Net* net, const char* path, ListCallback callback, void* data void showMessageBox(const char* title, const char* message) { - // SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING, "Warning", buf, NULL); + studioImpl.system->showMessageBox(title, message); } \ No newline at end of file diff --git a/src/studio.h b/src/studio.h index 672cbd2..2d5f60e 100644 --- a/src/studio.h +++ b/src/studio.h @@ -232,6 +232,7 @@ typedef struct void (*file_dialog_save)(file_dialog_save_callback callback, const char* name, const u8* buffer, size_t size, void* data, u32 mode); void (*goFullscreen)(); + void (*showMessageBox)(const char* title, const char* message); } System;