this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Added `DEV MODE` to the game menu options #1814

nesbox c1b4095e d790b953

+85 -23
+3
src/studio/config.c
··· 237 237 .volume = MAX_VOLUME, 238 238 .vsync = true, 239 239 .fullscreen = false, 240 + #if defined(BUILD_EDITORS) 241 + .devmode = false, 242 + #endif 240 243 }, 241 244 }; 242 245
+12
src/studio/screens/console.c
··· 1452 1452 commandDone(console); 1453 1453 } 1454 1454 1455 + static void onGameMenuCommand(Console* console) 1456 + { 1457 + gotoMenu(); 1458 + commandDone(console); 1459 + } 1460 + 1455 1461 static void onSurfCommand(Console* console) 1456 1462 { 1457 1463 gotoSurf(); ··· 2649 2655 NULL, \ 2650 2656 onSurfCommand) \ 2651 2657 \ 2658 + macro("menu", \ 2659 + NULL, \ 2660 + "show game menu where you can setup video, sound and input options.", \ 2661 + NULL, \ 2662 + onGameMenuCommand) \ 2663 + 2652 2664 ADDGET_FILE(macro) 2653 2665 2654 2666 static struct Command
+36 -8
src/studio/screens/main_menu.c
··· 20 20 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 21 // SOFTWARE. 22 22 23 - #include "../studio.h" 24 - #include "../studio_impl.h" 23 + #include "studio/studio.h" 24 + #include "studio/studio_impl.h" 25 25 #include "menu.h" 26 26 #include "main_menu.h" 27 27 28 - struct MenuImpl { 28 + static struct MenuImpl 29 + { 29 30 Menu* menu; 31 + 30 32 struct 31 33 { 32 34 MenuItem* items; 33 35 s32 count; 34 36 }* gameMenu; 35 - Gamepads* gamepads; 37 + 38 + Gamepads* gamepads; 36 39 Config* config; 37 40 tic_mem* mem; 38 41 } menu_impl; ··· 42 45 .count = COUNT_OF(((const char*[])__VA_ARGS__)) 43 46 44 47 // TODO: do we need to lock this down further? 45 - static StudioConfig* rwConfig() { 48 + static StudioConfig* rwConfig() 49 + { 46 50 return &menu_impl.config->data; 47 51 } 48 52 49 - 50 - void initMainMenu(Menu *menu, void *gameMenu, Config *config, tic_mem *mem, Gamepads *gamepads) { 51 - menu_impl = (struct MenuImpl){ 53 + void initMainMenu(Menu *menu, void *gameMenu, Config *config, tic_mem *mem, Gamepads *gamepads) 54 + { 55 + menu_impl = (struct MenuImpl) 56 + { 52 57 .menu = menu, 53 58 .gameMenu = gameMenu, 54 59 .config = config, ··· 137 142 optionVolumeSet, 138 143 }; 139 144 145 + #if defined(BUILD_EDITORS) 146 + 147 + static s32 optionDevModeGet() 148 + { 149 + return getConfig()->options.devmode ? 1 : 0; 150 + } 151 + 152 + static void optionDevModeSet(s32 pos) 153 + { 154 + rwConfig()->options.devmode = pos == 1; 155 + } 156 + 157 + static MenuOption DevModeOption = 158 + { 159 + OPTION_VALUES({OffValue, OnValue}), 160 + optionDevModeGet, 161 + optionDevModeSet, 162 + }; 163 + 164 + #endif 140 165 141 166 static const MenuItem OptionMenu[] = 142 167 { 143 168 #if defined(CRT_SHADER_SUPPORT) 144 169 {"CRT MONITOR", NULL, &CrtMonitorOption}, 170 + #endif 171 + #if defined(BUILD_EDITORS) 172 + {"DEV MODE", NULL, &DevModeOption, "The game menu is disabled in dev mode."}, 145 173 #endif 146 174 {"VSYNC", NULL, &VSyncOption, "VSYNC needs restart!"}, 147 175 {"FULLSCREEN", NULL, &FullscreenOption},
+27 -13
src/studio/studio.c
··· 1542 1542 1543 1543 #endif 1544 1544 1545 - static void enterMainMenu() { 1545 + void gotoMenu() 1546 + { 1546 1547 if(impl.mode != TIC_MENU_MODE) 1547 1548 { 1548 1549 tic_core_pause(impl.studio.tic); ··· 1610 1611 else 1611 1612 { 1612 1613 if (keyWasPressedOnce(tic_key_f11)) tic_sys_fullscreen_set(!tic_sys_fullscreen_get()); 1614 + #if defined(BUILD_EDITORS) 1613 1615 else if(keyWasPressedOnce(tic_key_escape)) 1614 1616 { 1615 1617 switch(impl.mode) 1616 1618 { 1617 - case TIC_MENU_MODE: studio_menu_back(impl.menu); break; 1618 - case TIC_RUN_MODE: enterMainMenu(); break; 1619 - #if defined(BUILD_EDITORS) 1620 - case TIC_CONSOLE_MODE: setStudioMode(impl.prevMode); break; 1619 + case TIC_MENU_MODE: 1620 + getConfig()->options.devmode 1621 + ? setStudioMode(impl.prevMode) 1622 + : studio_menu_back(impl.menu); 1623 + break; 1624 + case TIC_RUN_MODE: 1625 + getConfig()->options.devmode 1626 + ? setStudioMode(impl.prevMode) 1627 + : gotoMenu(); 1628 + break; 1629 + case TIC_CONSOLE_MODE: setStudioMode(impl.prevMode); break; 1621 1630 case TIC_CODE_MODE: 1622 1631 if(impl.code->mode != TEXT_EDIT_MODE) 1623 1632 { ··· 1626 1635 } 1627 1636 default: 1628 1637 setStudioMode(TIC_CONSOLE_MODE); 1629 - #endif 1630 1638 } 1631 - 1632 1639 } 1633 - #if defined(BUILD_EDITORS) 1634 1640 else if(keyWasPressedOnce(tic_key_f8)) takeScreenshot(); 1635 1641 else if(keyWasPressedOnce(tic_key_f9)) startVideoRecord(); 1636 - else if(impl.mode == TIC_RUN_MODE) 1637 - { 1638 - if(keyWasPressedOnce(tic_key_f7)) setCoverImage(); 1639 - } 1640 - else 1642 + else if(impl.mode == TIC_RUN_MODE && keyWasPressedOnce(tic_key_f7)) 1643 + setCoverImage(); 1644 + 1645 + if(getConfig()->options.devmode || impl.mode != TIC_RUN_MODE) 1641 1646 { 1642 1647 if(keyWasPressedOnce(tic_key_f1)) setStudioMode(TIC_CODE_MODE); 1643 1648 else if(keyWasPressedOnce(tic_key_f2)) setStudioMode(TIC_SPRITE_MODE); 1644 1649 else if(keyWasPressedOnce(tic_key_f3)) setStudioMode(TIC_MAP_MODE); 1645 1650 else if(keyWasPressedOnce(tic_key_f4)) setStudioMode(TIC_SFX_MODE); 1646 1651 else if(keyWasPressedOnce(tic_key_f5)) setStudioMode(TIC_MUSIC_MODE); 1652 + } 1653 + #else 1654 + else if(keyWasPressedOnce(tic_key_escape)) 1655 + { 1656 + switch(impl.mode) 1657 + { 1658 + case TIC_MENU_MODE: studio_menu_back(impl.menu); break; 1659 + case TIC_RUN_MODE: gotoMenu(); break; 1660 + } 1647 1661 } 1648 1662 #endif 1649 1663 }
+1
src/studio/studio.h
··· 225 225 bool studioCartChanged(); 226 226 void playSystemSfx(s32 id); 227 227 228 + void gotoMenu(); 228 229 void gotoCode(); 229 230 void gotoSurf(); 230 231
+6 -2
src/studio/system.h
··· 118 118 119 119 struct 120 120 { 121 - #if defined(CRT_SHADER_SUPPORT) 121 + #if defined(CRT_SHADER_SUPPORT) 122 122 bool crt; 123 - #endif 123 + #endif 124 124 125 125 bool fullscreen; 126 126 bool vsync; 127 127 s32 volume; 128 128 tic_mapping mapping; 129 + 130 + #if defined(BUILD_EDITORS) 131 + bool devmode; 132 + #endif 129 133 } options; 130 134 131 135 const tic_cartridge* cart;