Render96ex/guides/Add-Menus.md
kelson8 b5738c5a91 Add test menu to this decomp.
Add guide to creating menus with this code.
2025-01-23 00:23:29 -05:00

2.1 KiB

Adding menus to this decomp

  1. Go into the charmap.txt to get a list of characters needed.
  2. Add a menu into options_menu.c:

To enable the below features:

Add my custom code define under s32 l_counter = 0 in options_menu.c, example:

// Enable my custom menus, and other features in this file.
// kelson8
#define _CUSTOM_CODE

To add a menu into options_menu.c:

  1. Define a string using the charmap.txt into text_options_strings.h, for example to make the word "Test" add this into that file:
#define TEXT_OPT_TEST      0x1D,0x0E,0x1C,0x1D,0xFF
  1. Add a string for the menu in menuStr, and define that in the text_options_strings.h, for example if the menu OPT is test add this into there
    #ifdef _CUSTOM_CODE
    { TEXT_OPT_TEST },
    #endif //_CUSTOM_CODE
  1. Add a string for the option under bindStr in options_menu.c, example:
#ifdef _CUSTOM_CODE
static const u8 testStr[][8] = {
    { TEXT_OPT_TEST }
};
#endif //_CUSTOM_CODE

  1. Add a new option in options_menu.c, example:
#ifdef _CUSTOM_CODE
static struct Option optsTest[] = {
    // TODO Fix this to do something else.
    // First option is the value of the testStr defined
    DEF_OPT_SCROLL( testStr[0], &configMasterVolume, 0, MAX_VOLUME, 1 )
};
#endif //_CUSTOM_CODE
  1. Add the menu to the SubMenu struct under menuAudio in options_menu.c, example:
#ifdef _CUSTOM_CODE
// Get the value from the menuStr
static struct SubMenu menuTest    = DEF_SUBMENU( menuStr[9], optsTest );
static struct SubMenu menuCheats   = DEF_SUBMENU( menuStr[10], optsCheats );
#else
static struct SubMenu menuCheats   = DEF_SUBMENU( menuStr[9], optsCheats );
#endif //_CUSTOM_CODE
  1. Finally, add this under optmenu_act_exit within optsMain in options_menu.c, example:
    #ifdef _CUSTOM_CODE
    DEF_OPT_SUBMENU( menuStr[9], &menuTest ),
    DEF_OPT_SUBMENU( menuStr[10], &menuCheats )
    #else
    DEF_OPT_SUBMENU( menuStr[9], &menuCheats )
    #endif //_CUSTOM_CODE

To add a title for the menu:

  1. Go into include/text_options_strings.h.in
  2. Add this into that file under cheats or wherever:
// Add the text for the test menu
#define TEXT_OPT_TEST      _("TEST")