add wii detection to ISOFile, gray refresh list menuitem when core is running, some cleanup

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2979 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2009-04-16 02:32:21 +00:00
parent 0801abdcc8
commit a152639683
6 changed files with 51 additions and 51 deletions

View File

@ -305,7 +305,6 @@ CFrame::CFrame(bool showLogWindow,
, m_pStatusBar(NULL), bRenderToMain(true) , m_pStatusBar(NULL), bRenderToMain(true)
, HaveLeds(false), HaveSpeakers(false) , HaveLeds(false), HaveSpeakers(false)
, m_Panel(NULL) , m_Panel(NULL)
, m_pMenuBar(NULL)
, m_fLastClickTime(0), m_iLastMotionTime(0), LastMouseX(0), LastMouseY(0) , m_fLastClickTime(0), m_iLastMotionTime(0), LastMouseX(0), LastMouseY(0)
#if wxUSE_TIMER #if wxUSE_TIMER
, m_timer(this) , m_timer(this)

View File

@ -222,25 +222,19 @@ class CFrame : public wxFrame
void OnGameListCtrl_ItemActivated(wxListEvent& event); void OnGameListCtrl_ItemActivated(wxListEvent& event);
// Menu items // MenuBar
wxMenuBar* m_pMenuBar; // File - Drive
wxMenuItem* m_pSubMenuDrive;
wxMenuItem* m_pMenuItemOpen; // File // Emulation
wxMenuItem* m_pMenuItemOpenDrive; // Drive wxMenuItem* m_pSubMenuLoad;
wxMenuItem* m_pSubMenuSave;
wxMenuItem* m_pMenuItemPlay; // Emulation
wxMenuItem* m_pMenuItemStop;
wxMenuItem* m_pMenuChangeDisc;
wxMenuItem* m_pPluginOptions;
wxMenuItem* m_pMenuItemLoad;
wxMenuItem* m_pMenuItemSave;
wxMenuItem* m_pMenuBootWii;
wxToolBarToolBase* m_pToolPlay;
void BootGame(); void BootGame();
// Double click and mouse move options // Double click and mouse move options
double m_fLastClickTime, m_iLastMotionTime; int LastMouseX, LastMouseY; double m_fLastClickTime, m_iLastMotionTime;
int LastMouseX, LastMouseY;
#if wxUSE_TIMER #if wxUSE_TIMER
void Update(); void Update();

View File

@ -96,15 +96,17 @@ wxCheatsWindow* CheatsWindow;
// Create menu items // Create menu items
void CFrame::CreateMenu() void CFrame::CreateMenu()
{ {
delete m_pMenuBar; if (GetMenuBar())
m_pMenuBar = new wxMenuBar(wxMB_DOCKABLE); GetMenuBar()->Destroy();
wxMenuBar* menuBar = new wxMenuBar(wxMB_DOCKABLE);
// file menu // file menu
wxMenu* fileMenu = new wxMenu; wxMenu* fileMenu = new wxMenu;
m_pMenuItemOpen = fileMenu->Append(wxID_OPEN, _T("&Open...\tCtrl+O")); fileMenu->Append(wxID_OPEN, _T("&Open...\tCtrl+O"));
wxMenu *externalDrive = new wxMenu; wxMenu *externalDrive = new wxMenu;
m_pMenuItemOpenDrive = fileMenu->AppendSubMenu(externalDrive, _T("&Boot from DVD Drive...")); m_pSubMenuDrive = fileMenu->AppendSubMenu(externalDrive, _T("&Boot from DVD Drive..."));
drives = cdio_get_devices(); drives = cdio_get_devices();
for (int i = 0; drives[i] != NULL && i < 24; i++) { for (int i = 0; drives[i] != NULL && i < 24; i++) {
@ -118,27 +120,27 @@ void CFrame::CreateMenu()
fileMenu->AppendSeparator(); fileMenu->AppendSeparator();
fileMenu->Append(wxID_EXIT, _T("E&xit"), _T("Alt+F4")); fileMenu->Append(wxID_EXIT, _T("E&xit"), _T("Alt+F4"));
m_pMenuBar->Append(fileMenu, _T("&File")); menuBar->Append(fileMenu, _T("&File"));
// Emulation menu // Emulation menu
wxMenu* emulationMenu = new wxMenu; wxMenu* emulationMenu = new wxMenu;
m_pMenuItemPlay = emulationMenu->Append(IDM_PLAY, _T("&Play")); emulationMenu->Append(IDM_PLAY, _T("&Play"));
m_pMenuChangeDisc = emulationMenu->Append(IDM_CHANGEDISC, _T("Change Disc")); emulationMenu->Append(IDM_CHANGEDISC, _T("Change Disc"));
m_pMenuItemStop = emulationMenu->Append(IDM_STOP, _T("&Stop")); emulationMenu->Append(IDM_STOP, _T("&Stop"));
emulationMenu->AppendSeparator(); emulationMenu->AppendSeparator();
wxMenu *saveMenu = new wxMenu; wxMenu *saveMenu = new wxMenu;
wxMenu *loadMenu = new wxMenu; wxMenu *loadMenu = new wxMenu;
m_pMenuItemLoad = emulationMenu->AppendSubMenu(saveMenu, _T("&Load State")); m_pSubMenuLoad = emulationMenu->AppendSubMenu(saveMenu, _T("&Load State"));
m_pMenuItemSave = emulationMenu->AppendSubMenu(loadMenu, _T("Sa&ve State")); m_pSubMenuSave = emulationMenu->AppendSubMenu(loadMenu, _T("Sa&ve State"));
for (int i = 1; i < 10; i++) { for (int i = 1; i < 10; i++) {
saveMenu->Append(IDM_LOADSLOT1 + i - 1, wxString::Format(_T("Slot %i\tF%i"), i, i)); saveMenu->Append(IDM_LOADSLOT1 + i - 1, wxString::Format(_T("Slot %i\tF%i"), i, i));
loadMenu->Append(IDM_SAVESLOT1 + i - 1, wxString::Format(_T("Slot %i\tShift+F%i"), i, i)); loadMenu->Append(IDM_SAVESLOT1 + i - 1, wxString::Format(_T("Slot %i\tShift+F%i"), i, i));
} }
m_pMenuBar->Append(emulationMenu, _T("&Emulation")); menuBar->Append(emulationMenu, _T("&Emulation"));
// Options menu // Options menu
wxMenu* pOptionsMenu = new wxMenu; wxMenu* pOptionsMenu = new wxMenu;
m_pPluginOptions = pOptionsMenu->Append(IDM_CONFIG_MAIN, _T("Co&nfigure...")); pOptionsMenu->Append(IDM_CONFIG_MAIN, _T("Co&nfigure..."));
pOptionsMenu->AppendSeparator(); pOptionsMenu->AppendSeparator();
pOptionsMenu->Append(IDM_CONFIG_GFX_PLUGIN, _T("&Graphics Settings")); pOptionsMenu->Append(IDM_CONFIG_GFX_PLUGIN, _T("&Graphics Settings"));
pOptionsMenu->Append(IDM_CONFIG_DSP_PLUGIN, _T("&DSP Settings")); pOptionsMenu->Append(IDM_CONFIG_DSP_PLUGIN, _T("&DSP Settings"));
@ -148,7 +150,7 @@ void CFrame::CreateMenu()
pOptionsMenu->AppendSeparator(); pOptionsMenu->AppendSeparator();
pOptionsMenu->Append(IDM_TOGGLE_FULLSCREEN, _T("&Fullscreen\tAlt+Enter")); pOptionsMenu->Append(IDM_TOGGLE_FULLSCREEN, _T("&Fullscreen\tAlt+Enter"));
#endif #endif
m_pMenuBar->Append(pOptionsMenu, _T("&Options")); menuBar->Append(pOptionsMenu, _T("&Options"));
// Tools menu // Tools menu
wxMenu* toolsMenu = new wxMenu; wxMenu* toolsMenu = new wxMenu;
@ -167,10 +169,10 @@ void CFrame::CreateMenu()
if (DiscIO::CNANDContentManager::Access().GetNANDLoader(FULL_WII_MENU_DIR).IsValid()) if (DiscIO::CNANDContentManager::Access().GetNANDLoader(FULL_WII_MENU_DIR).IsValid())
{ {
m_pMenuBootWii = toolsMenu->Append(IDM_LOAD_WII_MENU, _T("Load Wii Menu")); toolsMenu->Append(IDM_LOAD_WII_MENU, _T("Load Wii Menu"));
} }
m_pMenuBar->Append(toolsMenu, _T("&Tools")); menuBar->Append(toolsMenu, _T("&Tools"));
// Help menu // Help menu
wxMenu* helpMenu = new wxMenu; wxMenu* helpMenu = new wxMenu;
@ -180,10 +182,10 @@ void CFrame::CreateMenu()
helpMenu->Append(IDM_HELPGOOGLECODE, _T("Dolphin at &Google Code")); helpMenu->Append(IDM_HELPGOOGLECODE, _T("Dolphin at &Google Code"));
helpMenu->AppendSeparator(); helpMenu->AppendSeparator();
helpMenu->Append(IDM_HELPABOUT, _T("&About...")); helpMenu->Append(IDM_HELPABOUT, _T("&About..."));
m_pMenuBar->Append(helpMenu, _T("&Help")); menuBar->Append(helpMenu, _T("&Help"));
// Associate the menu bar with the frame // Associate the menu bar with the frame
SetMenuBar(m_pMenuBar); SetMenuBar(menuBar);
} }
@ -199,7 +201,7 @@ void CFrame::PopulateToolbar(wxToolBar* toolBar)
toolBar->AddTool(IDM_BROWSE, _T("Browse"), m_Bitmaps[Toolbar_Browse], _T("Browse for an ISO directory...")); toolBar->AddTool(IDM_BROWSE, _T("Browse"), m_Bitmaps[Toolbar_Browse], _T("Browse for an ISO directory..."));
toolBar->AddSeparator(); toolBar->AddSeparator();
m_pToolPlay = toolBar->AddTool(IDM_PLAY, _T("Play"), m_Bitmaps[Toolbar_Play], _T("Play")); toolBar->AddTool(IDM_PLAY, _T("Play"), m_Bitmaps[Toolbar_Play], _T("Play"));
toolBar->AddTool(IDM_STOP, _T("Stop"), m_Bitmaps[Toolbar_Stop], _T("Stop")); toolBar->AddTool(IDM_STOP, _T("Stop"), m_Bitmaps[Toolbar_Stop], _T("Stop"));
@ -826,40 +828,41 @@ void CFrame::UpdateGUI()
} }
// File // File
m_pMenuItemOpen->Enable(!initialized); GetMenuBar()->FindItem(wxID_OPEN)->Enable(!initialized);
m_pMenuItemOpenDrive->Enable(!initialized); m_pSubMenuDrive->Enable(!initialized);
GetMenuBar()->FindItem(wxID_REFRESH)->Enable(!initialized);
// Emulation // Emulation
m_pMenuItemStop->Enable(running || paused); GetMenuBar()->FindItem(IDM_STOP)->Enable(running || paused);
m_pMenuItemLoad->Enable(initialized); m_pSubMenuLoad->Enable(initialized);
m_pMenuItemSave->Enable(initialized); m_pSubMenuSave->Enable(initialized);
m_pPluginOptions->Enable(!running && !paused); GetMenuBar()->FindItem(IDM_CONFIG_MAIN)->Enable(!running && !paused);
// Misc // Misc
m_pMenuChangeDisc->Enable(initialized); GetMenuBar()->FindItem(IDM_CHANGEDISC)->Enable(initialized);
if (DiscIO::CNANDContentManager::Access().GetNANDLoader(FULL_WII_MENU_DIR).IsValid()) if (DiscIO::CNANDContentManager::Access().GetNANDLoader(FULL_WII_MENU_DIR).IsValid())
m_pMenuBootWii->Enable(!initialized); GetMenuBar()->FindItem(IDM_LOAD_WII_MENU)->Enable(!initialized);
if (running) if (running)
{ {
if (GetToolBar() != NULL) if (GetToolBar() != NULL)
{ {
m_pToolPlay->SetNormalBitmap(m_Bitmaps[Toolbar_Pause]); GetToolBar()->FindById(IDM_PLAY)->SetNormalBitmap(m_Bitmaps[Toolbar_Pause]);
m_pToolPlay->SetShortHelp(_("Pause")); GetToolBar()->FindById(IDM_PLAY)->SetShortHelp(_("Pause"));
m_pToolPlay->SetLabel(_("Pause")); GetToolBar()->FindById(IDM_PLAY)->SetLabel(_("Pause"));
} }
m_pMenuItemPlay->SetText(_("&Pause")); GetMenuBar()->FindItem(IDM_PLAY)->SetText(_("&Pause"));
} }
else else
{ {
if (GetToolBar() != NULL) if (GetToolBar() != NULL)
{ {
m_pToolPlay->SetNormalBitmap(m_Bitmaps[Toolbar_Play]); GetToolBar()->FindById(IDM_PLAY)->SetNormalBitmap(m_Bitmaps[Toolbar_Play]);
m_pToolPlay->SetShortHelp(_("Play")); GetToolBar()->FindById(IDM_PLAY)->SetShortHelp(_("Play"));
m_pToolPlay->SetLabel(_("Play")); GetToolBar()->FindById(IDM_PLAY)->SetLabel(_("Play"));
} }
m_pMenuItemPlay->SetText(_("&Play")); GetMenuBar()->FindItem(IDM_PLAY)->SetText(_("&Play"));
} }
if (GetToolBar() != NULL) if (GetToolBar() != NULL)

View File

@ -775,7 +775,7 @@ void CGameListCtrl::CompressSelection(bool _compress)
std::string OutputFileName; std::string OutputFileName;
BuildCompleteFilename(OutputFileName, (const char *)browseDialog.GetPath().mb_str(wxConvUTF8), FileName); BuildCompleteFilename(OutputFileName, (const char *)browseDialog.GetPath().mb_str(wxConvUTF8), FileName);
DiscIO::CompressFileToBlob(iso->GetFileName().c_str(), OutputFileName.c_str(), 0, 16384, &MultiCompressCB, &progressDialog); DiscIO::CompressFileToBlob(iso->GetFileName().c_str(), OutputFileName.c_str(), iso->IsWii() ? 1 : 0, 16384, &MultiCompressCB, &progressDialog);
} }
else if (iso->IsCompressed() && !_compress) else if (iso->IsCompressed() && !_compress)
{ {
@ -868,7 +868,7 @@ void CGameListCtrl::OnCompressGCM(wxCommandEvent& WXUNUSED (event))
if (iso->IsCompressed()) if (iso->IsCompressed())
DiscIO::DecompressBlobToFile(iso->GetFileName().c_str(), path.char_str(), &CompressCB, &dialog); DiscIO::DecompressBlobToFile(iso->GetFileName().c_str(), path.char_str(), &CompressCB, &dialog);
else else
DiscIO::CompressFileToBlob(iso->GetFileName().c_str(), path.char_str(), 0, 16384, &CompressCB, &dialog); DiscIO::CompressFileToBlob(iso->GetFileName().c_str(), path.char_str(), iso->IsWii() ? 1 : 0, 16384, &CompressCB, &dialog);
Update(); Update();
} }

View File

@ -46,6 +46,7 @@ GameListItem::GameListItem(const std::string& _rFileName)
, m_BlobCompressed(false) , m_BlobCompressed(false)
, m_pImage(NULL) , m_pImage(NULL)
, m_ImageSize(0) , m_ImageSize(0)
, m_IsWii(false)
{ {
if (LoadFromCache()) if (LoadFromCache())
@ -58,6 +59,7 @@ GameListItem::GameListItem(const std::string& _rFileName)
if (pVolume != NULL) if (pVolume != NULL)
{ {
m_IsWii = DiscIO::IsVolumeWiiDisc(pVolume);
m_Company = "N/A"; m_Company = "N/A";
for (int i = 0; i < 6; i++) for (int i = 0; i < 6; i++)
{ {

View File

@ -36,6 +36,7 @@ public:
DiscIO::IVolume::ECountry GetCountry() const {return m_Country;} DiscIO::IVolume::ECountry GetCountry() const {return m_Country;}
const std::string& GetIssues() const {return m_Issues;} const std::string& GetIssues() const {return m_Issues;}
bool IsCompressed() const {return m_BlobCompressed;} bool IsCompressed() const {return m_BlobCompressed;}
bool IsWii() const {return m_IsWii;}
u64 GetFileSize() const {return m_FileSize;} u64 GetFileSize() const {return m_FileSize;}
u64 GetVolumeSize() const {return m_VolumeSize;} u64 GetVolumeSize() const {return m_VolumeSize;}
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
@ -63,6 +64,7 @@ private:
bool m_BlobCompressed; bool m_BlobCompressed;
u8* m_pImage; u8* m_pImage;
u32 m_ImageSize; u32 m_ImageSize;
bool m_IsWii;
bool LoadFromCache(); bool LoadFromCache();
void SaveToCache(); void SaveToCache();