2017-01-20 08:36:52 -05:00
|
|
|
#pragma once
|
|
|
|
|
2017-01-19 16:23:59 -05:00
|
|
|
#undef LoadMenu
|
|
|
|
|
|
|
|
namespace Components
|
|
|
|
{
|
|
|
|
class Menus : public Component
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Menus();
|
|
|
|
~Menus();
|
|
|
|
|
|
|
|
static void FreeEverything();
|
|
|
|
|
2019-10-03 13:23:06 -04:00
|
|
|
static void Add(const std::string& menu);
|
2019-01-16 23:52:42 -05:00
|
|
|
|
2020-12-09 14:13:34 -05:00
|
|
|
static Game::MenuList* LoadCustomMenuList(const std::string& menu, Utils::Memory::Allocator* allocator);
|
2019-10-03 13:23:06 -04:00
|
|
|
static std::vector<std::pair<bool, Game::menuDef_t*>> LoadMenu(Game::menuDef_t* menudef);
|
2023-01-28 07:31:48 -05:00
|
|
|
static std::vector<std::pair<bool, Game::menuDef_t*>> LoadMenu(const std::string& menu);
|
2019-10-03 13:23:06 -04:00
|
|
|
|
2017-01-19 16:23:59 -05:00
|
|
|
private:
|
2019-10-03 13:23:06 -04:00
|
|
|
static std::unordered_map<std::string, Game::menuDef_t*> MenuList;
|
|
|
|
static std::unordered_map<std::string, Game::MenuList*> MenuListList;
|
|
|
|
static std::vector<std::string> CustomMenus;
|
2019-01-17 16:33:26 -05:00
|
|
|
|
2019-10-03 13:23:06 -04:00
|
|
|
static Game::XAssetHeader MenuFindHook(Game::XAssetType type, const std::string& filename);
|
|
|
|
static Game::XAssetHeader MenuListFindHook(Game::XAssetType type, const std::string& filename);
|
|
|
|
|
|
|
|
static Game::MenuList* LoadMenuList(Game::MenuList* menuList);
|
|
|
|
static Game::MenuList* LoadScriptMenu(const char* menu);
|
|
|
|
|
|
|
|
static void SafeMergeMenus(std::vector<std::pair<bool, Game::menuDef_t*>>* menus, std::vector<std::pair<bool, Game::menuDef_t*>> newMenus);
|
|
|
|
|
|
|
|
static Game::script_t* LoadMenuScript(const std::string& name, const std::string& buffer);
|
|
|
|
static int LoadMenuSource(const std::string& name, const std::string& buffer);
|
|
|
|
|
|
|
|
static int ReserveSourceHandle();
|
|
|
|
static bool IsValidSourceHandle(int handle);
|
|
|
|
|
|
|
|
static Game::menuDef_t* ParseMenu(int handle);
|
2019-01-17 16:33:26 -05:00
|
|
|
|
2023-01-28 07:31:48 -05:00
|
|
|
static void FreeScript(Game::script_s* script);
|
2017-01-19 16:23:59 -05:00
|
|
|
static void FreeMenuSource(int handle);
|
|
|
|
|
2019-10-03 13:23:06 -04:00
|
|
|
static void FreeMenuList(Game::MenuList* menuList);
|
2022-12-14 06:31:03 -05:00
|
|
|
static void Menu_FreeItemMemory(Game::itemDef_s* item);
|
2019-10-03 13:23:06 -04:00
|
|
|
static void FreeMenu(Game::menuDef_t* menudef);
|
|
|
|
|
|
|
|
static void RemoveMenu(const std::string& menu);
|
|
|
|
static void RemoveMenu(Game::menuDef_t* menudef);
|
|
|
|
static void RemoveMenuList(const std::string& menuList);
|
|
|
|
static void RemoveMenuList(Game::MenuList* menuList);
|
|
|
|
|
|
|
|
static void OverrideMenu(Game::menuDef_t* menu);
|
|
|
|
|
|
|
|
static bool IsMenuVisible(Game::UiContext* dc, Game::menuDef_t* menu);
|
|
|
|
|
|
|
|
static void RemoveMenuFromContext(Game::UiContext* dc, Game::menuDef_t* menu);
|
2017-01-19 16:23:59 -05:00
|
|
|
};
|
|
|
|
}
|