#pragma once #define MAX_SOURCEFILES 64 #undef LoadMenu namespace Components { class Menus : public Component { public: Menus(); ~Menus(); static void FreeEverything(); static void Add(const std::string& menu); private: static std::unordered_map MenuList; static std::unordered_map MenuListList; static std::vector CustomMenus; static Game::XAssetHeader MenuLoad(Game::XAssetType type, const std::string& filename); static Game::XAssetHeader MenuFileLoad(Game::XAssetType type, const std::string& filename); static Game::MenuList* LoadMenuList(Game::MenuList* menuList); static Game::MenuList* LoadScriptMenu(const char* menu); static std::vector> LoadMenu(Game::menuDef_t* menudef); static std::vector> LoadMenu(const std::string& file); static void SafeMergeMenus(std::vector>* menus, std::vector> 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); static void FreeMenuSource(int handle); static void FreeMenuList(Game::MenuList* menuList); 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); // Ugly! static int KeywordHash(char* key); }; }