From a6d0e4ddcd6ebac3c87103c3589dd8a6a2a991b2 Mon Sep 17 00:00:00 2001 From: Vadim Grigoruk Date: Sun, 26 May 2024 07:36:09 +0200 Subject: [PATCH] #1950: removed devmode and game menu by default, game menu will be shown if the 'game' tag exists in the tags section --- src/studio/config.c | 4 ---- src/studio/fs.c | 2 +- src/studio/screens/mainmenu.c | 25 ------------------------- src/studio/studio.c | 31 ++++++++++++++----------------- src/studio/system.h | 1 - 5 files changed, 15 insertions(+), 48 deletions(-) diff --git a/src/studio/config.c b/src/studio/config.c index 2cb914c90..f89e159e1 100644 --- a/src/studio/config.c +++ b/src/studio/config.c @@ -99,7 +99,6 @@ static void setDefault(Config* config) .autosave = false, #if defined(BUILD_EDITORS) .keybindMode = KEYBIND_STANDARD, - .devmode = false, .tabMode = TAB_AUTO, .tabSize = 1, #endif @@ -189,7 +188,6 @@ static void loadOptions(Config* config) #if defined(BUILD_EDITORS) options->keybindMode = json_int("keybindMode", 0); options->tabMode = json_int("tabMode", 0); - options->devmode = json_bool("devmode", 0); options->tabSize = json_int("tabSize", 0); #endif } @@ -266,7 +264,6 @@ static void saveOptions(Config* config) , "keybindMode":%i, "tabMode":%i, - "devmode":%s, "tabSize":%i #endif }) @@ -285,7 +282,6 @@ static void saveOptions(Config* config) , options->keybindMode, options->tabMode, - bool2str(options->devmode), options->tabSize #endif ); diff --git a/src/studio/fs.c b/src/studio/fs.c index a0f1c96f1..912caca62 100644 --- a/src/studio/fs.c +++ b/src/studio/fs.c @@ -955,7 +955,7 @@ const char* fs_apppath() s32 size = readlink("/proc/self/exe", apppath, sizeof apppath); apppath[size] = '\0'; #elif defined(__TIC_MACOSX__) - s32 size = sizeof apppath; + u32 size = sizeof apppath; _NSGetExecutablePath(apppath, &size); #endif diff --git a/src/studio/screens/mainmenu.c b/src/studio/screens/mainmenu.c index 308357a99..985096273 100644 --- a/src/studio/screens/mainmenu.c +++ b/src/studio/screens/mainmenu.c @@ -285,25 +285,6 @@ static MenuOption KeybindModeOption = optionKeybindModeSet, }; -static s32 optionDevModeGet(void* data) -{ - StudioMainMenu* main = data; - return main->options->devmode ? 1 : 0; -} - -static void optionDevModeSet(void* data, s32 pos) -{ - StudioMainMenu* main = data; - main->options->devmode = pos == 1; -} - -static MenuOption DevModeOption = -{ - OPTION_VALUES({OffValue, OnValue}), - optionDevModeGet, - optionDevModeSet, -}; - static void showEditorMenu(void* data, s32 pos); #endif @@ -321,9 +302,6 @@ enum { #if defined(CRT_SHADER_SUPPORT) OptionsMenu_CrtMonitorOption, -#endif -#if defined(BUILD_EDITORS) - OptionsMenu_DevModeOption, #endif OptionsMenu_VSyncOption, OptionsMenu_FullscreenOption, @@ -341,9 +319,6 @@ static const MenuItem OptionMenu[] = { #if defined(CRT_SHADER_SUPPORT) {"CRT MONITOR", NULL, &CrtMonitorOption}, -#endif -#if defined(BUILD_EDITORS) - {"DEV MODE", NULL, &DevModeOption, "The game menu is disabled in dev mode."}, #endif {"VSYNC", NULL, &VSyncOption, "VSYNC needs restart!"}, {"FULLSCREEN", NULL, &FullscreenOption}, diff --git a/src/studio/studio.c b/src/studio/studio.c index e6214cf44..2cc965434 100644 --- a/src/studio/studio.c +++ b/src/studio/studio.c @@ -1736,18 +1736,14 @@ static bool enterWasPressedOnce(Studio* studio) #if defined(BUILD_EDITORS) -static bool isDevMode(Studio* studio) +static bool showGameMenu(Studio* studio) { tic_mem* tic = studio->tic; - const char *devmode = tic_tool_metatag(tic->cart.code.data, "devmode", tic_get_script(tic)->singleComment); - if(strcmp(devmode, "on") == 0) - return true; + char tag[TICNAME_MAX]; + sprintf(tag, "%s menu:", tic_get_script(tic)->singleComment); - else if(strcmp(devmode, "off") == 0) - return false; - - return getConfig(studio)->options.devmode; + return strstr(tic->cart.code.data, tag); } #endif @@ -1822,18 +1818,18 @@ static void processShortcuts(Studio* studio) switch(studio->mode) { case TIC_MENU_MODE: - isDevMode(studio) - ? setStudioMode(studio, studio->prevMode == TIC_RUN_MODE + showGameMenu(studio) + ? studio_menu_back(studio->menu) + : setStudioMode(studio, studio->prevMode == TIC_RUN_MODE ? TIC_CONSOLE_MODE - : studio->prevMode) - : studio_menu_back(studio->menu); + : studio->prevMode); break; case TIC_RUN_MODE: - isDevMode(studio) - ? setStudioMode(studio, studio->prevMode == TIC_RUN_MODE + showGameMenu(studio) + ? gotoMenu(studio) + : setStudioMode(studio, studio->prevMode == TIC_RUN_MODE ? TIC_CONSOLE_MODE - : studio->prevMode) - : gotoMenu(studio); + : studio->prevMode); break; case TIC_CONSOLE_MODE: setStudioMode(studio, TIC_CODE_MODE); @@ -1853,7 +1849,7 @@ static void processShortcuts(Studio* studio) else if(studio->mode == TIC_RUN_MODE && keyWasPressedOnce(studio, tic_key_f7)) setCoverImage(studio); - if(isDevMode(studio) || studio->mode != TIC_RUN_MODE) + if(!showGameMenu(studio) || studio->mode != TIC_RUN_MODE) { if(keyWasPressedOnce(studio, tic_key_f1)) setStudioMode(studio, TIC_CODE_MODE); else if(keyWasPressedOnce(studio, tic_key_f2)) setStudioMode(studio, TIC_SPRITE_MODE); @@ -1868,6 +1864,7 @@ static void processShortcuts(Studio* studio) { case TIC_MENU_MODE: studio_menu_back(studio->menu); break; case TIC_RUN_MODE: gotoMenu(studio); break; + default: break; } } #endif diff --git a/src/studio/system.h b/src/studio/system.h index c12ad7ace..b5ef2cbe8 100644 --- a/src/studio/system.h +++ b/src/studio/system.h @@ -141,7 +141,6 @@ typedef struct #if defined(BUILD_EDITORS) enum KeybindMode keybindMode; enum TabMode tabMode; - bool devmode; s32 tabSize; #endif } options;