From c857f71e808349470a8d8643e4e7ddf82052e40d Mon Sep 17 00:00:00 2001 From: "sl1nk3.s" Date: Wed, 15 Apr 2009 20:19:25 +0000 Subject: [PATCH] Minor bugfixes : disable Refresh list and Load wii menu when game is running and fix silly init of njoy's rumble git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2973 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/DolphinWX/Src/AboutDolphin.cpp | 2 +- Source/Core/DolphinWX/Src/AboutDolphin.h | 2 +- Source/Core/DolphinWX/Src/ConfigMain.cpp | 2 +- Source/Core/DolphinWX/Src/Frame.cpp | 7 +-- Source/Core/DolphinWX/Src/Frame.h | 3 +- Source/Core/DolphinWX/Src/FrameTools.cpp | 7 +-- Source/Core/DolphinWX/Src/GameListCtrl.cpp | 43 +++++++++++++------ Source/Core/DolphinWX/Src/GameListCtrl.h | 9 ++++ Source/Plugins/Plugin_nJoy_SDL/Src/Rumble.cpp | 12 +----- 9 files changed, 54 insertions(+), 33 deletions(-) diff --git a/Source/Core/DolphinWX/Src/AboutDolphin.cpp b/Source/Core/DolphinWX/Src/AboutDolphin.cpp index 6f9b0e7f48..0d4b96c7f1 100644 --- a/Source/Core/DolphinWX/Src/AboutDolphin.cpp +++ b/Source/Core/DolphinWX/Src/AboutDolphin.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2003-2008 Dolphin Project. +// Copyright (C) 2003-2009 Dolphin Project. // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/Source/Core/DolphinWX/Src/AboutDolphin.h b/Source/Core/DolphinWX/Src/AboutDolphin.h index e612a85c9b..0339c1b69a 100644 --- a/Source/Core/DolphinWX/Src/AboutDolphin.h +++ b/Source/Core/DolphinWX/Src/AboutDolphin.h @@ -1,4 +1,4 @@ -// Copyright (C) 2003-2008 Dolphin Project. +// Copyright (C) 2003-2009 Dolphin Project. // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/Source/Core/DolphinWX/Src/ConfigMain.cpp b/Source/Core/DolphinWX/Src/ConfigMain.cpp index 084617feae..92791d1be0 100644 --- a/Source/Core/DolphinWX/Src/ConfigMain.cpp +++ b/Source/Core/DolphinWX/Src/ConfigMain.cpp @@ -463,7 +463,7 @@ void CConfigMain::CreateGUIControls() sbISOPaths->Add(ISOPaths, 1, wxEXPAND|wxALL, 0); sISOButtons = new wxBoxSizer(wxHORIZONTAL); - sISOButtons->Add(RecersiveISOPath, 0, wxALL, 0); + sISOButtons->Add(RecersiveISOPath, 0, wxALL|wxALIGN_CENTER, 0); sISOButtons->AddStretchSpacer(1); sISOButtons->Add(AddISOPath, 0, wxALL, 0); sISOButtons->Add(RemoveISOPath, 0, wxALL, 0); diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index 4f2ed4ca63..58ef65b83a 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2003-2008 Dolphin Project. +// Copyright (C) 2003-2009 Dolphin Project. // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -254,7 +254,6 @@ EVT_MENU(IDM_CONFIG_DSP_PLUGIN, CFrame::OnPluginDSP) EVT_MENU(IDM_CONFIG_PAD_PLUGIN, CFrame::OnPluginPAD) EVT_MENU(IDM_CONFIG_WIIMOTE_PLUGIN, CFrame::OnPluginWiimote) - #ifdef MUSICMOD EVT_MENU(IDM_MUTE, CFrame::MM_OnMute) EVT_MENU(IDM_MUSIC_PLAY, CFrame::MM_OnPause) @@ -262,6 +261,7 @@ EVT_COMMAND_SCROLL(IDS_VOLUME, CFrame::MM_OnVolume) EVT_MENU(IDT_LOG, CFrame::MM_OnLog) #endif +EVT_MENU(IDM_NETPLAY, CFrame::OnNetPlay) EVT_MENU(IDM_BROWSE, CFrame::OnBrowse) EVT_MENU(IDM_MEMCARD, CFrame::OnMemcard) EVT_MENU(IDM_CHEATS, CFrame::OnShow_CheatsWindow) @@ -430,7 +430,8 @@ void CFrame::OnQuit(wxCommandEvent& WXUNUSED (event)) void CFrame::OnClose(wxCloseEvent& event) { - // Don't forget the skip of the window won't be destroyed + + // Don't forget the skip or the window won't be destroyed event.Skip(); if (Core::GetState() != Core::CORE_UNINITIALIZED) diff --git a/Source/Core/DolphinWX/Src/Frame.h b/Source/Core/DolphinWX/Src/Frame.h index 522aa315a3..a8ff3ee72d 100644 --- a/Source/Core/DolphinWX/Src/Frame.h +++ b/Source/Core/DolphinWX/Src/Frame.h @@ -29,7 +29,6 @@ //////////////////////////////// #include "CDUtils.h" #include "LogWindow.h" - ////////////////////////////////////////////////////////////////////////// // A shortcut to access the bitmaps // ŻŻŻŻŻŻŻŻŻŻ @@ -216,6 +215,7 @@ class CFrame : public wxFrame void OnHostMessage(wxCommandEvent& event); void OnMemcard(wxCommandEvent& event); // Misc + void OnShow_CheatsWindow(wxCommandEvent& event); void OnShow_SDCardWindow(wxCommandEvent& event); void OnLoadWiiMenu(wxCommandEvent& event); @@ -234,6 +234,7 @@ class CFrame : public wxFrame wxMenuItem* m_pPluginOptions; wxMenuItem* m_pMenuItemLoad; wxMenuItem* m_pMenuItemSave; + wxMenuItem* m_pMenuBootWii; wxToolBarToolBase* m_pToolPlay; void BootGame(); diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index 7c6b5c2996..98b8c2668c 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -167,7 +167,7 @@ void CFrame::CreateMenu() if (DiscIO::CNANDContentManager::Access().GetNANDLoader(FULL_WII_MENU_DIR).IsValid()) { - toolsMenu->Append(IDM_LOAD_WII_MENU, _T("Load Wii Menu")); + m_pMenuBootWii = toolsMenu->Append(IDM_LOAD_WII_MENU, _T("Load Wii Menu")); } m_pMenuBar->Append(toolsMenu, _T("&Tools")); @@ -561,7 +561,7 @@ void CFrame::DoStop() #ifdef MUSICMOD MM_OnStop(); #endif - + // Rerecording #ifdef RERECORDING Core::RerecordingStop(); @@ -583,7 +583,7 @@ void CFrame::DoStop() if (bRenderToMain) while(Core::GetState() != Core::CORE_UNINITIALIZED) SLEEP(10); #endif - + UpdateGUI(); } } @@ -837,6 +837,7 @@ void CFrame::UpdateGUI() // Misc m_pMenuChangeDisc->Enable(initialized); + m_pMenuBootWii->Enable(!initialized); if (running) { diff --git a/Source/Core/DolphinWX/Src/GameListCtrl.cpp b/Source/Core/DolphinWX/Src/GameListCtrl.cpp index 60fbdc6bf5..7a03e3dba2 100644 --- a/Source/Core/DolphinWX/Src/GameListCtrl.cpp +++ b/Source/Core/DolphinWX/Src/GameListCtrl.cpp @@ -27,6 +27,7 @@ #include "ConfigManager.h" #include "GameListCtrl.h" #include "Blob.h" +#include "Core.h" #include "ISOProperties.h" #include "IniFile.h" #include "FileUtil.h" @@ -151,12 +152,19 @@ void CGameListCtrl::BrowseForDirectory() void CGameListCtrl::Update() { + // Don't let the user refresh it while the a game is running + if (Core::GetState() != Core::CORE_UNINITIALIZED) + return; if (m_imageListSmall) { delete m_imageListSmall; m_imageListSmall = NULL; } + // NetPlay : Set/Reset the GameList string + m_gameList.clear(); + m_gamePath.clear(); + Hide(); ScanForISOs(); @@ -233,6 +241,15 @@ wxString NiceSizeFormat(s64 _size) return(NiceString); } +std::string CGameListCtrl::GetGamePaths() const +{ + return m_gamePath; +} +std::string CGameListCtrl::GetGameNames() const +{ + return m_gameList; +} + void CGameListCtrl::InsertItemInReportView(long _Index) { // When using wxListCtrl, there is no hope of per-column text colors. @@ -240,10 +257,12 @@ void CGameListCtrl::InsertItemInReportView(long _Index) // title: 0xFF0000 // company: 0x007030 + wxString name, description; GameListItem& rISOFile = m_ISOFiles[_Index]; - + m_gamePath.append(std::string(rISOFile.GetFileName()) + '\n'); + int ImageIndex = -1; - + if (rISOFile.GetImage().IsOk()) { ImageIndex = m_imageListSmall->Add(rISOFile.GetImage()); @@ -255,38 +274,36 @@ void CGameListCtrl::InsertItemInReportView(long _Index) switch (rISOFile.GetCountry()) { case DiscIO::IVolume::COUNTRY_JAP: - { // keep these codes, when we move to wx unicode... //wxCSConv convFrom(wxFontMapper::GetEncodingName(wxFONTENCODING_SHIFT_JIS)); //wxCSConv convTo(wxFontMapper::GetEncodingName(wxFONTENCODING_DEFAULT)); //SetItem(_Index, COLUMN_TITLE, wxString(wxString(rISOFile.GetName()).wc_str(convFrom) , convTo), -1); //SetItem(_Index, COLUMN_NOTES, wxString(wxString(rISOFile.GetDescription()).wc_str(convFrom) , convTo), -1); - wxString name; if (CopySJISToString(name, rISOFile.GetName(0).c_str())) - { SetItem(_Index, COLUMN_TITLE, name, -1); - } - - wxString description; if (CopySJISToString(description, rISOFile.GetDescription(0).c_str())) - { SetItem(_Index, COLUMN_NOTES, description, -1); - } - } + + // NetPLay string + m_gameList.append(std::string(name) + " (J)\n"); + break; case DiscIO::IVolume::COUNTRY_USA: + m_gameList.append(std::string(wxString::From8BitData(rISOFile.GetName(0).c_str())) + " (U)\n"); SetItem(_Index, COLUMN_TITLE, wxString::From8BitData(rISOFile.GetName(0).c_str()), -1); SetItem(_Index, COLUMN_NOTES, wxString::From8BitData(rISOFile.GetDescription(0).c_str()), -1); break; - default: + default: + m_gameList.append(std::string(wxString::From8BitData( + rISOFile.GetName((int)SConfig::GetInstance().m_InterfaceLanguage).c_str()))+ " (E)\n"); SetItem(_Index, COLUMN_TITLE, wxString::From8BitData(rISOFile.GetName((int)SConfig::GetInstance().m_InterfaceLanguage).c_str()), -1); SetItem(_Index, COLUMN_NOTES, wxString::From8BitData(rISOFile.GetDescription((int)SConfig::GetInstance().m_InterfaceLanguage).c_str()), -1); break; } + SetItem(_Index, COLUMN_COMPANY, wxString::From8BitData(rISOFile.GetCompany().c_str()), -1); - SetItem(_Index, COLUMN_SIZE, NiceSizeFormat(rISOFile.GetFileSize()), -1); // Load the INI file for columns that read from it diff --git a/Source/Core/DolphinWX/Src/GameListCtrl.h b/Source/Core/DolphinWX/Src/GameListCtrl.h index fd1bff65c1..f7ebb491e8 100644 --- a/Source/Core/DolphinWX/Src/GameListCtrl.h +++ b/Source/Core/DolphinWX/Src/GameListCtrl.h @@ -32,6 +32,11 @@ public: ~CGameListCtrl(); void Update(); + + // Net Play method + std::string GetGamePaths() const; + std::string GetGameNames() const; + void BrowseForDirectory(); const GameListItem *GetSelectedISO(); const GameListItem *GetISO(int index) const; @@ -53,6 +58,10 @@ private: std::vector m_FlagImageIndex; std::vector m_ISOFiles; + // NetPlay string for the gamelist + std::string m_gameList; + std::string m_gamePath; + int last_column; int last_sort; diff --git a/Source/Plugins/Plugin_nJoy_SDL/Src/Rumble.cpp b/Source/Plugins/Plugin_nJoy_SDL/Src/Rumble.cpp index a444392914..6d3324fe46 100644 --- a/Source/Plugins/Plugin_nJoy_SDL/Src/Rumble.cpp +++ b/Source/Plugins/Plugin_nJoy_SDL/Src/Rumble.cpp @@ -82,16 +82,8 @@ void Pad_Use_Rumble(u8 _numPAD)//, SPADStatus* _pPADStatus) if (PadMapping[_numPAD].rumble) { if (!g_Rumble) { - - HWND rumble_hWnd = GetParent(m_hWnd); - HWND TopLevel = GetParent(rumble_hWnd); - - // Support both rendering to main window and not. - if (GetForegroundWindow() == TopLevel) - rumble_hWnd = TopLevel; - if (GetForegroundWindow() == m_hWnd) - rumble_hWnd = m_hWnd; - if (FAILED(InitRumble(rumble_hWnd))) + // GetForegroundWindow() always sends the good HWND + if (FAILED(InitRumble(GetForegroundWindow()))) PanicAlert("Could not initialize Rumble!"); } else {