Skip to content

Commit

Permalink
#1950: removed devmode and game menu by default, game menu will be sh…
Browse files Browse the repository at this point in the history
…own if the 'game' tag exists in the tags section
  • Loading branch information
nesbox committed May 26, 2024
1 parent 5d60c02 commit a6d0e4d
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 48 deletions.
4 changes: 0 additions & 4 deletions src/studio/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -266,7 +264,6 @@ static void saveOptions(Config* config)
,
"keybindMode":%i,
"tabMode":%i,
"devmode":%s,
"tabSize":%i
#endif
})
Expand All @@ -285,7 +282,6 @@ static void saveOptions(Config* config)
,
options->keybindMode,
options->tabMode,
bool2str(options->devmode),
options->tabSize
#endif
);
Expand Down
2 changes: 1 addition & 1 deletion src/studio/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
25 changes: 0 additions & 25 deletions src/studio/screens/mainmenu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -321,9 +302,6 @@ enum
{
#if defined(CRT_SHADER_SUPPORT)
OptionsMenu_CrtMonitorOption,
#endif
#if defined(BUILD_EDITORS)
OptionsMenu_DevModeOption,
#endif
OptionsMenu_VSyncOption,
OptionsMenu_FullscreenOption,
Expand All @@ -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},
Expand Down
31 changes: 14 additions & 17 deletions src/studio/studio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/studio/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ typedef struct
#if defined(BUILD_EDITORS)
enum KeybindMode keybindMode;
enum TabMode tabMode;
bool devmode;
s32 tabSize;
#endif
} options;
Expand Down

0 comments on commit a6d0e4d

Please sign in to comment.