Exemplo n.º 1
0
void LoadPlugins() {
	char vdub[MAX_PATH], drv[MAX_PATH], dir[MAX_PATH], find[MAX_PATH], path[MAX_PATH];

	GetModuleFileName(NULL, vdub, MAX_PATH);

	_splitpath(vdub, drv, dir, NULL, NULL);
	wsprintf(find, "%s%s%s%s", drv, dir, "plugins\\", "*.auo");

	HANDLE hFind;
	WIN32_FIND_DATA fd;

	if ((hFind = FindFirstFile(find, &fd)) == INVALID_HANDLE_VALUE)
		return;

	g_menuList.clear();

	do {
		sprintf(path, "%s%s%s%s", drv, dir, "plugins\\", fd.cFileName);
		AviUtlPlugin *auo = new AviUtlPlugin(path);

		if (auo->Init()) {
			MenuItem *item = new MenuItem;

			item->path = std::string(path);
			item->name = std::string(auo->opt->tbl->name);

			g_menuList.push_back(item);
		}
		delete auo;

	} while (FindNextFile(hFind, &fd));

	FindClose(hFind);
}
Exemplo n.º 2
0
MenuItemList MessageListBE::get_popup_items_for_nodes(const std::vector<NodeId> &nodes)
{
  MenuItemList menu;
  MenuItem item;

  item.type= bec::MenuAction;
  item.name= "clear_messages";
  item.caption= _("Clear");
  item.enabled= true;
  menu.push_back(item);

  return menu;
}
Exemplo n.º 3
0
void CMainMenu::FillOutMenu ( HMENU hMenu )
{
	CGuard Guard(m_CS);

	MENU_ITEM Item;

	//Get all flags
	bool inBasicMode = g_Settings->LoadBool(UserInterface_BasicMode);
	bool CPURunning  = g_Settings->LoadBool(GameRunning_CPU_Running);
	bool RomLoading  = g_Settings->LoadBool(GameRunning_LoadingInProgress);
	bool RomLoaded   = g_Settings->LoadString(Game_GameName).length() > 0;
	bool RomList     = g_Settings->LoadBool(RomBrowser_Enabled) && !CPURunning;
	
	CMenuShortCutKey::ACCESS_MODE AccessLevel = CMenuShortCutKey::GAME_NOT_RUNNING;
	if (g_Settings->LoadBool(GameRunning_CPU_Running))
	{
		AccessLevel = g_Settings->LoadBool(UserInterface_InFullScreen)  ? 
			CMenuShortCutKey::GAME_RUNNING_FULLSCREEN : 
			CMenuShortCutKey::GAME_RUNNING_WINDOW;
	}
	
	//Get the system information to make the menu
	LanguageList LangList = g_Lang->GetLangList();
	
	MenuItemList LangMenu;
	int Offset = 0;
	for (LanguageList::iterator Language = LangList.begin(); Language != LangList.end(); Language++)
    {
		Item.Reset(ID_LANG_START + Offset++,EMPTY_STRING,EMPTY_STDSTR,NULL,Language->LanguageName.c_str());
		if (g_Lang->IsCurrentLang(*Language))
		{ 
			Item.SetItemTicked(true);
		}
		LangMenu.push_back(Item);
	}

	//Go through the settings to create a list of Recent Roms
	MenuItemList RecentRomMenu;
	DWORD count, RomsToRemember = g_Settings->LoadDword(File_RecentGameFileCount);

	for (count = 0; count < RomsToRemember; count++) 
    {
		stdstr LastRom = g_Settings->LoadStringIndex(File_RecentGameFileIndex,count);
		if (LastRom.empty())
		{
			break;
		}
		stdstr_f MenuString("&%d %s",(count + 1) % 10,LastRom.c_str());
        RecentRomMenu.push_back(MENU_ITEM(ID_RECENT_ROM_START + count,EMPTY_STRING,EMPTY_STDSTR,NULL,MenuString.ToUTF16().c_str()));
	}

	
	/* Recent Dir
	****************/
	MenuItemList RecentDirMenu;
	DWORD DirsToRemember = g_Settings->LoadDword(Directory_RecentGameDirCount);
	
	for (count = 0; count < DirsToRemember; count++) 
	{
		stdstr LastDir = g_Settings->LoadStringIndex(Directory_RecentGameDirIndex,count);
		if (LastDir.empty())
		{
			break;
		}
		
		stdstr_f MenuString("&%d %s",(count + 1) % 10,LastDir.c_str());
        RecentDirMenu.push_back(MENU_ITEM(ID_RECENT_DIR_START + count,EMPTY_STRING,EMPTY_STDSTR,NULL,MenuString.ToUTF16().c_str()));
	}

	/* File Menu
	****************/
 	MenuItemList FileMenu;
	Item.Reset(ID_FILE_OPEN_ROM, MENU_OPEN, m_ShortCuts.ShortCutString(ID_FILE_OPEN_ROM,AccessLevel));
	FileMenu.push_back(Item);
	if (!inBasicMode) 
    {
		Item.Reset(ID_FILE_ROM_INFO, MENU_ROM_INFO,m_ShortCuts.ShortCutString(ID_FILE_ROM_INFO,AccessLevel));
		Item.SetItemEnabled(RomLoaded);
		FileMenu.push_back(Item);
		FileMenu.push_back(MENU_ITEM(SPLITER));
		Item.Reset(ID_FILE_STARTEMULATION,MENU_START,   m_ShortCuts.ShortCutString(ID_FILE_STARTEMULATION,AccessLevel)   );
		Item.SetItemEnabled(RomLoaded && !CPURunning);
		FileMenu.push_back(Item);
	}
	Item.Reset(ID_FILE_ENDEMULATION, MENU_END, m_ShortCuts.ShortCutString(ID_FILE_ENDEMULATION,AccessLevel)   );
	Item.SetItemEnabled(CPURunning);
	FileMenu.push_back(Item);
	FileMenu.push_back(MENU_ITEM(SPLITER));
	Item.Reset(SUB_MENU, MENU_LANGUAGE, EMPTY_STDSTR, &LangMenu );
	FileMenu.push_back(Item);
	if (RomList) 
    {
		FileMenu.push_back(MENU_ITEM(SPLITER));
		Item.Reset(ID_FILE_ROMDIRECTORY,  MENU_CHOOSE_ROM,m_ShortCuts.ShortCutString(ID_FILE_ROMDIRECTORY,AccessLevel)       );
		FileMenu.push_back(Item);
		Item.Reset(ID_FILE_REFRESHROMLIST,MENU_REFRESH,m_ShortCuts.ShortCutString(ID_FILE_REFRESHROMLIST,AccessLevel)          );
		FileMenu.push_back(Item);
	}
	
	if (!inBasicMode && RomList) 
    {
		FileMenu.push_back(MENU_ITEM(SPLITER));
		Item.Reset(SUB_MENU, MENU_RECENT_ROM,EMPTY_STDSTR, &RecentRomMenu);
		if (RecentRomMenu.size() == 0) 
        {
			RecentRomMenu.push_back(MENU_ITEM(SPLITER));
			Item.SetItemEnabled(false);
		}
		FileMenu.push_back(Item);
		Item.Reset(SUB_MENU, MENU_RECENT_DIR,EMPTY_STDSTR, &RecentDirMenu);
		if (RecentDirMenu.size() == 0) 
        {
			RecentDirMenu.push_back(MENU_ITEM(SPLITER));
			Item.SetItemEnabled(false);
		}
		FileMenu.push_back(Item);
	}
    else 
    {
		if (RecentRomMenu.size() != 0) 
        {
			FileMenu.push_back(MENU_ITEM(SPLITER));
			for (MenuItemList::iterator MenuItem = RecentRomMenu.begin(); MenuItem != RecentRomMenu.end(); MenuItem++) 
			{
				FileMenu.push_back(*MenuItem);
			}
		}
	}
	FileMenu.push_back(MENU_ITEM(SPLITER));
	FileMenu.push_back(MENU_ITEM(ID_FILE_EXIT, MENU_EXIT,m_ShortCuts.ShortCutString(ID_FILE_EXIT,AccessLevel)));

	/* Current Save
	****************/
	MenuItemList CurrentSaveMenu;
	DWORD _CurrentSaveState = g_Settings->LoadDword(Game_CurrentSaveState);
	Item.Reset(ID_CURRENT_SAVE_DEFAULT, EMPTY_STRING,m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_DEFAULT,AccessLevel),NULL,GetSaveSlotString(0));
	if (_CurrentSaveState == 0) {  Item.SetItemTicked(true); }
	CurrentSaveMenu.push_back(Item);
	CurrentSaveMenu.push_back(MENU_ITEM(SPLITER));
	Item.Reset(ID_CURRENT_SAVE_1, EMPTY_STRING,m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_1,AccessLevel),NULL,GetSaveSlotString(1));
	if (_CurrentSaveState == 1) {  Item.SetItemTicked(true); }
	CurrentSaveMenu.push_back(Item);
	Item.Reset(ID_CURRENT_SAVE_2, EMPTY_STRING,m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_2,AccessLevel),NULL,GetSaveSlotString(2));
	if (_CurrentSaveState == 2) {  Item.SetItemTicked(true); }
	CurrentSaveMenu.push_back(Item);
	Item.Reset(ID_CURRENT_SAVE_3, EMPTY_STRING,m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_3,AccessLevel),NULL,GetSaveSlotString(3));
	if (_CurrentSaveState == 3) {  Item.SetItemTicked(true); }
	CurrentSaveMenu.push_back(Item);
	Item.Reset(ID_CURRENT_SAVE_4, EMPTY_STRING,m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_4,AccessLevel),NULL,GetSaveSlotString(4));
	if (_CurrentSaveState == 4) {  Item.SetItemTicked(true); }
	CurrentSaveMenu.push_back(Item);
	Item.Reset(ID_CURRENT_SAVE_5, EMPTY_STRING,m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_5,AccessLevel),NULL,GetSaveSlotString(5));
	if (_CurrentSaveState == 5) {  Item.SetItemTicked(true); }
	CurrentSaveMenu.push_back(Item);
	Item.Reset(ID_CURRENT_SAVE_6, EMPTY_STRING,m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_6,AccessLevel),NULL,GetSaveSlotString(6));
	if (_CurrentSaveState == 6) {  Item.SetItemTicked(true); }
	CurrentSaveMenu.push_back(Item);
	Item.Reset(ID_CURRENT_SAVE_7, EMPTY_STRING,m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_7,AccessLevel),NULL,GetSaveSlotString(7));
	if (_CurrentSaveState == 7) {  Item.SetItemTicked(true); }
	CurrentSaveMenu.push_back(Item);
	Item.Reset(ID_CURRENT_SAVE_8, EMPTY_STRING,m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_8,AccessLevel),NULL,GetSaveSlotString(8));
	if (_CurrentSaveState == 8) {  Item.SetItemTicked(true); }
	CurrentSaveMenu.push_back(Item);
	Item.Reset(ID_CURRENT_SAVE_9, EMPTY_STRING,m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_9,AccessLevel),NULL,GetSaveSlotString(9));
	if (_CurrentSaveState == 9) {  Item.SetItemTicked(true); }
	CurrentSaveMenu.push_back(Item);
	Item.Reset(ID_CURRENT_SAVE_10, EMPTY_STRING,m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_10,AccessLevel),NULL,GetSaveSlotString(10));
	if (_CurrentSaveState == 10) {  Item.SetItemTicked(true); }
	CurrentSaveMenu.push_back(Item);

	/* System Menu
	****************/
	MenuItemList SystemMenu;
	MenuItemList ResetMenu;
	if (inBasicMode) 
	{
		SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_RESET_SOFT, MENU_RESET, m_ShortCuts.ShortCutString(ID_SYSTEM_RESET_SOFT,AccessLevel)     ));
	}
    else 
    {
		ResetMenu.push_back(MENU_ITEM(ID_SYSTEM_RESET_SOFT, MENU_RESET_SOFT, m_ShortCuts.ShortCutString(ID_SYSTEM_RESET_SOFT,AccessLevel)     ));
		ResetMenu.push_back(MENU_ITEM(ID_SYSTEM_RESET_HARD, MENU_RESET_HARD, m_ShortCuts.ShortCutString(ID_SYSTEM_RESET_HARD,AccessLevel)));
		SystemMenu.push_back(MENU_ITEM(SUB_MENU,MENU_RESET,EMPTY_STDSTR,&ResetMenu));
	}
	if (g_Settings->LoadBool(GameRunning_CPU_Paused)) 
    {
		SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_PAUSE, MENU_RESUME, m_ShortCuts.ShortCutString(ID_SYSTEM_PAUSE,AccessLevel)));
	}
    else 
    {
		SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_PAUSE, MENU_PAUSE, m_ShortCuts.ShortCutString(ID_SYSTEM_PAUSE,AccessLevel)));
	}
	SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_BITMAP, MENU_BITMAP, m_ShortCuts.ShortCutString(ID_SYSTEM_BITMAP,AccessLevel)));
	SystemMenu.push_back(MENU_ITEM(SPLITER));
	if (!inBasicMode)
    {
		Item.Reset(ID_SYSTEM_LIMITFPS, MENU_LIMIT_FPS,m_ShortCuts.ShortCutString(ID_SYSTEM_LIMITFPS,AccessLevel) );
		if (g_Settings->LoadBool(GameRunning_LimitFPS)) { Item.SetItemTicked(true); }
		SystemMenu.push_back(Item);
		SystemMenu.push_back(MENU_ITEM(SPLITER));
	}
	SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_SAVE, MENU_SAVE, m_ShortCuts.ShortCutString(ID_SYSTEM_SAVE,AccessLevel)));
	if (!inBasicMode) 
    {
		SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_SAVEAS, MENU_SAVE_AS, m_ShortCuts.ShortCutString(ID_SYSTEM_SAVEAS,AccessLevel)));
	}
	SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_RESTORE, MENU_RESTORE, m_ShortCuts.ShortCutString(ID_SYSTEM_RESTORE,AccessLevel)));
	if (!inBasicMode) 
    {
		SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_LOAD, MENU_LOAD, m_ShortCuts.ShortCutString(ID_SYSTEM_LOAD,AccessLevel)));
	}
	SystemMenu.push_back(MENU_ITEM(SPLITER));
	SystemMenu.push_back(MENU_ITEM(SUB_MENU, MENU_CURRENT_SAVE,  EMPTY_STDSTR, &CurrentSaveMenu ));
	SystemMenu.push_back(MENU_ITEM(SPLITER));
	SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_CHEAT, MENU_CHEAT,    m_ShortCuts.ShortCutString(ID_SYSTEM_CHEAT,AccessLevel)));
	SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_GSBUTTON, MENU_GS_BUTTON,  m_ShortCuts.ShortCutString(ID_SYSTEM_GSBUTTON,AccessLevel)    ));
	
	/* Option Menu
	****************/
	MenuItemList OptionMenu;
	Item.Reset(ID_OPTIONS_FULLSCREEN, MENU_FULL_SCREEN,m_ShortCuts.ShortCutString(ID_OPTIONS_FULLSCREEN,AccessLevel) );
	Item.SetItemEnabled(CPURunning);
	if (g_Plugins->Gfx() && g_Plugins->Gfx()->ChangeWindow == NULL) 
    {
		Item.SetItemEnabled(false);
	}
	OptionMenu.push_back(Item);
	if (!inBasicMode) 
    {
		Item.Reset(ID_OPTIONS_ALWAYSONTOP, MENU_ON_TOP,m_ShortCuts.ShortCutString(ID_OPTIONS_ALWAYSONTOP,AccessLevel) );
		if (g_Settings->LoadDword(UserInterface_AlwaysOnTop)) { Item.SetItemTicked(true); }
		Item.SetItemEnabled(CPURunning);
		OptionMenu.push_back(Item);
	}
	OptionMenu.push_back(MENU_ITEM(SPLITER));

	Item.Reset(ID_OPTIONS_CONFIG_GFX, MENU_CONFG_GFX,m_ShortCuts.ShortCutString(ID_OPTIONS_CONFIG_GFX,AccessLevel));
	if (g_Plugins->Gfx() == NULL || g_Plugins->Gfx()->DllConfig == NULL) 
    {
		Item.SetItemEnabled(false); 
	}
	OptionMenu.push_back(Item);
	Item.Reset(ID_OPTIONS_CONFIG_AUDIO, MENU_CONFG_AUDIO,m_ShortCuts.ShortCutString(ID_OPTIONS_CONFIG_AUDIO,AccessLevel));
	if (g_Plugins->Audio() == NULL || g_Plugins->Audio()->DllConfig == NULL) 
    {
		Item.SetItemEnabled(false); 
	}
	OptionMenu.push_back(Item);
	if (!inBasicMode) 
    {
		Item.Reset(ID_OPTIONS_CONFIG_RSP, MENU_CONFG_RSP,m_ShortCuts.ShortCutString(ID_OPTIONS_CONFIG_RSP,AccessLevel));
		if (g_Plugins->RSP() == NULL || g_Plugins->RSP()->DllConfig == NULL) 
        {
			Item.SetItemEnabled(false); 
		}
		OptionMenu.push_back(Item);
	}
	Item.Reset(ID_OPTIONS_CONFIG_CONT, MENU_CONFG_CTRL,m_ShortCuts.ShortCutString(ID_OPTIONS_CONFIG_CONT,AccessLevel));
	if (g_Plugins->Control() == NULL || g_Plugins->Control()->DllConfig == NULL) 
    {
		Item.SetItemEnabled(false); 
	}
	OptionMenu.push_back(Item);

	OptionMenu.push_back(MENU_ITEM(SPLITER));
	if (!inBasicMode) 
    {
		Item.Reset(ID_OPTIONS_CPU_USAGE, MENU_SHOW_CPU,m_ShortCuts.ShortCutString(ID_OPTIONS_CPU_USAGE,AccessLevel));
		if (g_Settings->LoadDword(UserInterface_ShowCPUPer)) { Item.SetItemTicked(true); }
		OptionMenu.push_back(Item);
	}
	OptionMenu.push_back(MENU_ITEM(ID_OPTIONS_SETTINGS, MENU_SETTINGS,m_ShortCuts.ShortCutString(ID_OPTIONS_SETTINGS,AccessLevel) ));

	/* Profile Menu
	****************/
	MenuItemList DebugProfileMenu;
	if (bHaveDebugger()) 
	{
		Item.Reset(ID_PROFILE_PROFILE,EMPTY_STRING,EMPTY_STDSTR,NULL,L"Profile Code");
		if (g_Settings->LoadBool(Debugger_ProfileCode)) { Item.SetItemTicked(true); }
		DebugProfileMenu.push_back(Item);
		Item.Reset(ID_PROFILE_RESETCOUNTER,EMPTY_STRING,EMPTY_STDSTR,NULL,L"Reset Counters");
		if (!CPURunning) { Item.SetItemEnabled(false); }
		DebugProfileMenu.push_back(Item);
		Item.Reset(ID_PROFILE_GENERATELOG,EMPTY_STRING,EMPTY_STDSTR,NULL,L"Generate Log File");
		if (!CPURunning) { Item.SetItemEnabled(false); }
		DebugProfileMenu.push_back(Item);
	}

	/* Debugger Menu
	****************/
	MenuItemList DebugMenu;
	MenuItemList DebugLoggingMenu;
	MenuItemList DebugAppLoggingMenu;
	MenuItemList DebugR4300Menu;
	MenuItemList DebugMemoryMenu;
	MenuItemList DebugInterrupt;
	MenuItemList DebugNotificationMenu;
	if (bHaveDebugger()) 
    {
		/* Debug - Interrupt
		*******************/
		Item.Reset(ID_DEBUGGER_INTERRUPT_SP,EMPTY_STRING,EMPTY_STDSTR,NULL,L"SP Interrupt");
		Item.SetItemEnabled(CPURunning);
		DebugInterrupt.push_back(Item);
		Item.Reset(ID_DEBUGGER_INTERRUPT_SI,EMPTY_STRING,EMPTY_STDSTR,NULL,L"SI Interrupt");
		Item.SetItemEnabled(CPURunning);
		DebugInterrupt.push_back(Item);
		Item.Reset(ID_DEBUGGER_INTERRUPT_AI,EMPTY_STRING,EMPTY_STDSTR,NULL,L"AI Interrupt");
		Item.SetItemEnabled(CPURunning);
		DebugInterrupt.push_back(Item);
		Item.Reset(ID_DEBUGGER_INTERRUPT_VI,EMPTY_STRING,EMPTY_STDSTR,NULL,L"VI Interrupt");
		Item.SetItemEnabled(CPURunning);
		DebugInterrupt.push_back(Item);
		Item.Reset(ID_DEBUGGER_INTERRUPT_PI,EMPTY_STRING,EMPTY_STDSTR,NULL,L"PI Interrupt");
		Item.SetItemEnabled(CPURunning);
		DebugInterrupt.push_back(Item);
		Item.Reset(ID_DEBUGGER_INTERRUPT_DP,EMPTY_STRING,EMPTY_STDSTR,NULL,L"DP Interrupt");
		Item.SetItemEnabled(CPURunning);
		DebugInterrupt.push_back(Item);

		/* Debug - R4300i
		*******************/
		Item.Reset(ID_DEBUGGER_LOGOPTIONS,EMPTY_STRING,EMPTY_STDSTR,NULL,L"R4300i &Commands...");
		Item.SetItemEnabled(false);
		DebugR4300Menu.push_back(Item);
		Item.Reset(ID_DEBUGGER_R4300REGISTERS,EMPTY_STRING,EMPTY_STDSTR,NULL,L"R4300i &Registers...");
		Item.SetItemEnabled(true);
		DebugR4300Menu.push_back(Item);
		Item.Reset(ID_DEBUG_DISABLE_GAMEFIX,EMPTY_STRING,EMPTY_STDSTR,NULL,L"Disable Game Fixes");
		if (g_Settings->LoadBool(Debugger_DisableGameFixes))
        { 
			Item.SetItemTicked(true);
		}
		DebugR4300Menu.push_back(Item);
		Item.Reset(SUB_MENU, EMPTY_STRING,EMPTY_STDSTR, &DebugInterrupt,L"&Generate Interrupt");
		DebugR4300Menu.push_back(Item);

		/* Debug - Memory
		****************/
		Item.Reset(ID_DEBUGGER_MEMORY,EMPTY_STRING,EMPTY_STDSTR,NULL,L"View...");
		DebugMemoryMenu.push_back(Item);
		Item.Reset(ID_DEBUGGER_SEARCHMEMORY,EMPTY_STRING,EMPTY_STDSTR,NULL,L"Search...");
		DebugMemoryMenu.push_back(Item);
		Item.Reset(ID_DEBUGGER_DUMPMEMORY,EMPTY_STRING,EMPTY_STDSTR,NULL,L"Dump...");
		DebugMemoryMenu.push_back(Item);
		Item.Reset(ID_DEBUGGER_TLBENTRIES,EMPTY_STRING,EMPTY_STDSTR,NULL,L"TLB Entries...");
		DebugMemoryMenu.push_back(Item);

		/* Debug - App logging
		*******************/
		{
			DWORD LogLevel = g_Settings->LoadDword(Debugger_AppLogLevel);
			
			Item.Reset(ID_DEBUGGER_APPLOG_ERRORS,EMPTY_STRING,EMPTY_STDSTR,NULL,L"Error Messages");
			if ((LogLevel & TraceError) != 0) { Item.SetItemTicked(true); }
			DebugAppLoggingMenu.push_back(Item);
			
			Item.Reset(ID_DEBUGGER_APPLOG_SETTINGS,EMPTY_STRING,EMPTY_STDSTR,NULL,L"Settings");
			if ((LogLevel & TraceSettings) != 0) { Item.SetItemTicked(true); }
			DebugAppLoggingMenu.push_back(Item);
			
			Item.Reset(ID_DEBUGGER_APPLOG_RECOMPILER,EMPTY_STRING,EMPTY_STDSTR,NULL,L"Recompiler");
			if ((LogLevel & TraceRecompiler) != 0) { Item.SetItemTicked(true); }
			DebugAppLoggingMenu.push_back(Item);

			Item.Reset(ID_DEBUGGER_APPLOG_RSP,EMPTY_STRING,EMPTY_STDSTR,NULL,L"RSP");
			if ((LogLevel & TraceRSP) != 0) { Item.SetItemTicked(true); }
			DebugAppLoggingMenu.push_back(Item);

			Item.Reset(ID_DEBUGGER_APPLOG_TLB,EMPTY_STRING,EMPTY_STDSTR,NULL,L"TLB");
			if ((LogLevel & TraceTLB) != 0) { Item.SetItemTicked(true); }
			DebugAppLoggingMenu.push_back(Item);

			Item.Reset(ID_DEBUGGER_APPLOG_GFX_PLUGIN,EMPTY_STRING,EMPTY_STDSTR,NULL,L"Gfx Plugin");
			if ((LogLevel & TraceGfxPlugin) != 0) { Item.SetItemTicked(true); }
			DebugAppLoggingMenu.push_back(Item);

			Item.Reset(ID_DEBUGGER_APPLOG_AUDIO_EMU,EMPTY_STRING,EMPTY_STDSTR,NULL,L"Audio Emulation");
			if ((LogLevel & TraceAudio) != 0) { Item.SetItemTicked(true); }
			DebugAppLoggingMenu.push_back(Item);

			Item.Reset(ID_DEBUGGER_APPLOG_DEBUG,EMPTY_STRING,EMPTY_STDSTR,NULL,L"Debug Messages");
			if ((LogLevel & TraceDebug) != 0) { Item.SetItemTicked(true); }
			DebugAppLoggingMenu.push_back(Item);

			DebugAppLoggingMenu.push_back(MENU_ITEM(SPLITER));

			Item.Reset(ID_DEBUGGER_APPLOG_FLUSH,EMPTY_STRING,EMPTY_STDSTR,NULL,L"Auto flush file");
			if (g_Settings->LoadBool(Debugger_AppLogFlush)) { Item.SetItemTicked(true); }
			DebugAppLoggingMenu.push_back(Item);
		}


		/* Debug - Logging
		*******************/
		Item.Reset(ID_DEBUGGER_LOGOPTIONS,EMPTY_STRING,EMPTY_STDSTR,NULL,L"Log Options...");
		DebugLoggingMenu.push_back(Item);
		
		
		Item.Reset(ID_DEBUGGER_GENERATELOG,EMPTY_STRING,EMPTY_STDSTR,NULL,L"Generate Log");
		if (g_Settings->LoadBool(Debugger_GenerateDebugLog)) { Item.SetItemTicked(true); }
		DebugLoggingMenu.push_back(Item);

		/* Debugger Main Menu
		****************/
		Item.Reset(ID_DEBUGGER_BREAKPOINTS, EMPTY_STRING,EMPTY_STDSTR, NULL,L"Breakpoint...");
		Item.SetItemEnabled(CPURunning);
		DebugMenu.push_back(Item);
		DebugMenu.push_back(MENU_ITEM(SPLITER));
		
		/* Debug - RSP
		*******************/
		if (g_Plugins->RSP() != NULL && IsMenu((HMENU)g_Plugins->RSP()->GetDebugMenu())) 
		{ 
			Item.Reset(ID_PLUGIN_MENU,EMPTY_STRING,EMPTY_STDSTR,g_Plugins->RSP()->GetDebugMenu(),L"&RSP");
			DebugMenu.push_back(Item);
		}

		/* Debug - RDP
		*******************/
		if (g_Plugins->Gfx() != NULL && IsMenu((HMENU)g_Plugins->Gfx()->GetDebugMenu())) 
		{ 
			Item.Reset(ID_PLUGIN_MENU,EMPTY_STRING,EMPTY_STDSTR,g_Plugins->Gfx()->GetDebugMenu(),L"&RDP");
			DebugMenu.push_back(Item);
		}

		/* Notification Menu
		*******************/
		Item.Reset(ID_DEBUG_SHOW_UNHANDLED_MEM,EMPTY_STRING,EMPTY_STDSTR,NULL,L"On Unhandled Memory Actions");
		if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) 
        { 
			Item.SetItemTicked(true);
		}
		DebugNotificationMenu.push_back(Item);
		Item.Reset(ID_DEBUG_SHOW_PIF_ERRORS,EMPTY_STRING,EMPTY_STDSTR,NULL,L"On PIF Errors");
		if (g_Settings->LoadBool(Debugger_ShowPifErrors)) 
        {
			Item.SetItemTicked(true);
		}
		DebugNotificationMenu.push_back(Item);
		Item.Reset(ID_DEBUG_SHOW_DIV_BY_ZERO,EMPTY_STRING,EMPTY_STDSTR,NULL,L"On Div By Zero");
		if (g_Settings->LoadBool(Debugger_ShowDivByZero)) 
        { 
			Item.SetItemTicked(true);
		}
		DebugNotificationMenu.push_back(Item);

		Item.Reset(SUB_MENU, EMPTY_STRING,EMPTY_STDSTR, &DebugR4300Menu,L"&R4300i");
		DebugMenu.push_back(Item);
		Item.Reset(SUB_MENU, EMPTY_STRING,EMPTY_STDSTR, &DebugMemoryMenu,L"Memory");
		Item.SetItemEnabled(CPURunning);
		DebugMenu.push_back(Item);
		DebugMenu.push_back(MENU_ITEM(SPLITER));
		Item.Reset(SUB_MENU, EMPTY_STRING,EMPTY_STDSTR, &DebugProfileMenu,L"Profile");
		DebugMenu.push_back(Item);
		Item.Reset(SUB_MENU, EMPTY_STRING,EMPTY_STDSTR, &DebugAppLoggingMenu,L"App Logging");
		DebugMenu.push_back(Item);
		Item.Reset(SUB_MENU, EMPTY_STRING,EMPTY_STDSTR, &DebugLoggingMenu,L"Logging");
		DebugMenu.push_back(Item);
		Item.Reset(SUB_MENU, EMPTY_STRING,EMPTY_STDSTR, &DebugNotificationMenu,L"Notification");
		DebugMenu.push_back(Item);
		DebugMenu.push_back(MENU_ITEM(SPLITER));
		Item.Reset(ID_DEBUG_SHOW_TLB_MISSES,EMPTY_STRING,EMPTY_STDSTR,NULL,L"Show TLB Misses");
		if (g_Settings->LoadBool(Debugger_ShowTLBMisses)) 
        { 
            Item.SetItemTicked(true);
		}
		Item.Reset(ID_DEBUG_SHOW_DLIST_COUNT,EMPTY_STRING,EMPTY_STDSTR,NULL,L"Display Alist/Dlist Count");
		if (g_Settings->LoadBool(Debugger_ShowDListAListCount)) 
        { 
			Item.SetItemTicked(true);
		}
		DebugMenu.push_back(Item);
		Item.Reset(ID_DEBUG_SHOW_RECOMP_MEM_SIZE,EMPTY_STRING,EMPTY_STDSTR,NULL,L"Display Recompiler Code Buffer Size");
		if (g_Settings->LoadBool(Debugger_ShowRecompMemSize)) 
        { 
			Item.SetItemTicked(true);
		}
		DebugMenu.push_back(Item);
		DebugMenu.push_back(MENU_ITEM(SPLITER));
		Item.Reset(ID_DEBUG_GENERATE_LOG_FILES,EMPTY_STRING,EMPTY_STDSTR,NULL,L"Generate Log Files");
		if (g_Settings->LoadBool(Debugger_GenerateLogFiles))
        { 
			Item.SetItemTicked(true);
		}
		DebugMenu.push_back(Item);
	}

	/* Help Menu
	****************/
	MenuItemList HelpMenu;

	HelpMenu.push_back(MENU_ITEM(ID_HELP_SUPPORTFORUM, MENU_FORUM));
	HelpMenu.push_back(MENU_ITEM(ID_HELP_HOMEPAGE, MENU_HOMEPAGE));
	HelpMenu.push_back(MENU_ITEM(SPLITER));
	if (!inBasicMode)
    {
		HelpMenu.push_back(MENU_ITEM(ID_HELP_ABOUTSETTINGFILES, MENU_ABOUT_INI));
	}
	HelpMenu.push_back(MENU_ITEM(ID_HELP_ABOUT, MENU_ABOUT_PJ64));

	/* Main Title bar Menu
	***********************/
	MenuItemList MainTitleMenu;
	Item.Reset(SUB_MENU, MENU_FILE, EMPTY_STDSTR, &FileMenu);
	if (RomLoading) { Item.SetItemEnabled(false); }
	MainTitleMenu.push_back(Item);
	if (CPURunning)
    {
		Item.Reset(SUB_MENU, MENU_SYSTEM, EMPTY_STDSTR, &SystemMenu);
		if (RomLoading) { Item.SetItemEnabled(false); }
		MainTitleMenu.push_back(Item);
	}
	Item.Reset(SUB_MENU, MENU_OPTIONS, EMPTY_STDSTR, &OptionMenu);
	if (RomLoading) { Item.SetItemEnabled(false); }
	MainTitleMenu.push_back(Item);
	if (!inBasicMode)
    {
		if (bHaveDebugger()) 
        {
			Item.Reset(SUB_MENU, MENU_DEBUGGER, EMPTY_STDSTR, &DebugMenu);
			if (RomLoading) { Item.SetItemEnabled(false); }
			MainTitleMenu.push_back(Item);
		}
	}
	Item.Reset(SUB_MENU, MENU_HELP, EMPTY_STDSTR, &HelpMenu);
	if (RomLoading) { Item.SetItemEnabled(false); }
	MainTitleMenu.push_back(Item);

	AddMenu(hMenu,MainTitleMenu);
}
Exemplo n.º 4
0
void ObjectController::handleObjectMenuRequest(Message* message)
{
    //for ever item where we request a radial the client starts by displaying a radial on his own and additionally sends a
    //objectMenuRequest to the server
    //The server then either just resends the radial as send by the client or adds / modifies options on his own
    //this is why sometimes when lag is involved it takes some time for all options to display


    PlayerObject* playerObject = dynamic_cast<PlayerObject*>(mObject);

    message->getUint32(); // unknown
    uint64 requestedObjectId = message->getUint64();
    message->getUint64(); // player id again ?

    Object* requestedObject = gWorldManager->getObjectById(requestedObjectId);

    uint32 itemCount = message->getUint32();

    BString extendedDescription;
    MenuItemList menuItemList;

    MenuItem* menuItem;
    for(uint32 i = 0; i < itemCount; i++)
    {
        menuItem = new(MenuItem);

        menuItem->sItem			= message->getUint8();   // item nr
        menuItem->sSubMenu		= message->getUint8();   // submenu flag
        menuItem->sIdentifier	= message->getUint8();   // item identifier
        menuItem->sOption		= message->getUint8();   // extended option
        message->getStringUnicode16(extendedDescription);
        menuItemList.push_back(menuItem);
    }

    uint8 responseNr = message->getUint8();

    if(!requestedObject)
    {
        if(playerObject->isConnected())
            gMessageLib->sendEmptyObjectMenuResponse(requestedObjectId,playerObject,responseNr,menuItemList);

        //the list is cleared and items are destroyed in the message lib
        //for the default response
        return;
    }

    requestedObject->setMenuList(&menuItemList);



    //are we an item dropped in a structure awaiting to be moved or picked u`p?
    //just implement this virtual function for items as we need just one central point instead
    //of the same code over and over for all items

    CellObject* itemCell = dynamic_cast<CellObject*>(gWorldManager->getObjectById(requestedObject->getParentId()));

    Item* item = dynamic_cast<Item*>(requestedObject);
    ResourceContainer* rC = dynamic_cast<ResourceContainer*>(requestedObject);
    TangibleObject* tO = dynamic_cast<TangibleObject*>(requestedObject);

    //only display that menu when *we* and the item are in the same structure
    if((rC || item) && itemCell && (!tO->getStatic()))
    {
        CellObject* playerCell = dynamic_cast<CellObject*>(gWorldManager->getObjectById(playerObject->getParentId()));
        if(playerCell && (playerCell->getParentId() == itemCell->getParentId()))
        {
            PlayerStructure* pS = dynamic_cast<PlayerStructure*>(gWorldManager->getObjectById(playerCell->getParentId()));
            if(pS)
                requestedObject->prepareCustomRadialMenuInCell(playerObject,static_cast<uint8>(itemCount));
        }
    }
    /*
    if(rc && requestedObject->getParentId())
    {
        if(CellObject* cell = dynamic_cast<CellObject*>(gWorldManager->getObjectById(requestedObject->getParentId())))
        {
            requestedObject->prepareCustomRadialMenuInCell(playerObject,static_cast<uint8>(itemCount));
        }
    }
    */
    //delete the radials after every use or provide every object with set rules when to delete it ?

    if(!requestedObject->getRadialMenu())
        requestedObject->prepareCustomRadialMenu(playerObject,static_cast<uint8>(itemCount));

    if (requestedObject->getRadialMenu())
    {
        if(playerObject->isConnected())
        {
            gMessageLib->sendObjectMenuResponse(requestedObject,playerObject,responseNr);
        }
        //they only reset if the objects virtual function does it
        //by default it stays
        requestedObject->ResetRadialMenu();
        //the radial menu is supposed to be an intelligent pointer deleting itself when no reference is left
        //however during runtime the item always references the radialmenu that was generated for it on the first call.
        //when the circumstances of the item change we need to delete the pointer and thus force it to generate a new radial
    }
    else
    {
        // putting this for static objects/objects that are not known by the server yet
        // send a default menu,so client stops flooding us with requests

        //empty might just mean that the clients radial is sufficient

        if(playerObject->isConnected())
            gMessageLib->sendEmptyObjectMenuResponse(requestedObjectId,playerObject,responseNr,menuItemList);

        //the list is cleared and items are destroyes in the message lib
        //for the default response
    }


    //we need to clear that if the messagelib wont clear it
    //still want to use it for the player radials at some point
    for(MenuItemList::iterator it=menuItemList.begin(); it != menuItemList.end(); it++)
        delete (*it);

    menuItemList.clear();

}