From ca741b25268ad125193b6657baf8fc49b8f75051 Mon Sep 17 00:00:00 2001 From: omegadox Date: Sun, 1 Feb 2009 20:20:58 +0000 Subject: [PATCH] More SDIO WIP Code: Added ground work for SDCard Mounter wxDialog git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2067 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../Core/Core/Src/IPC_HLE/HW/SDInterface.cpp | 15 ++++- Source/Core/Core/Src/IPC_HLE/HW/SDInterface.h | 3 + Source/Core/DolphinWX/DolphinWX.vcproj | 8 +++ Source/Core/DolphinWX/Src/CheatsWindow.cpp | 2 +- Source/Core/DolphinWX/Src/Frame.cpp | 1 + Source/Core/DolphinWX/Src/Frame.h | 1 + Source/Core/DolphinWX/Src/FrameTools.cpp | 54 +++------------- Source/Core/DolphinWX/Src/Globals.h | 25 ++------ Source/Core/DolphinWX/Src/SConscript | 1 + Source/Core/DolphinWX/Src/SDCardWindow.cpp | 63 +++++++++++++++++++ Source/Core/DolphinWX/Src/SDCardWindow.h | 45 +++++++++++++ 11 files changed, 151 insertions(+), 67 deletions(-) create mode 100644 Source/Core/DolphinWX/Src/SDCardWindow.cpp create mode 100644 Source/Core/DolphinWX/Src/SDCardWindow.h diff --git a/Source/Core/Core/Src/IPC_HLE/HW/SDInterface.cpp b/Source/Core/Core/Src/IPC_HLE/HW/SDInterface.cpp index ebe6ad59ba..6b54f7f6c5 100644 --- a/Source/Core/Core/Src/IPC_HLE/HW/SDInterface.cpp +++ b/Source/Core/Core/Src/IPC_HLE/HW/SDInterface.cpp @@ -19,12 +19,25 @@ #include "SDInterface.h" -namespace SDInterface { +namespace SDInterface +{ bool g_bIsCardInserted = false; +bool g_bIsDumpFile = false; +std::string sourcePath = ""; bool IsCardInserted() { return g_bIsCardInserted; } + +void SetSourceType(bool isDumpFile) +{ + g_bIsDumpFile = isDumpFile; +} + +void SetSourcePath(const std::string path) +{ + sourcePath = path; +} } \ No newline at end of file diff --git a/Source/Core/Core/Src/IPC_HLE/HW/SDInterface.h b/Source/Core/Core/Src/IPC_HLE/HW/SDInterface.h index f84632ce3b..89895dfe11 100644 --- a/Source/Core/Core/Src/IPC_HLE/HW/SDInterface.h +++ b/Source/Core/Core/Src/IPC_HLE/HW/SDInterface.h @@ -19,10 +19,13 @@ #define _SDINTERFACE_H #include "Common.h" +#include namespace SDInterface { bool IsCardInserted(); + void SetSourceType(bool isDumpFile); + void SetSourcePath(const std::string path); } #endif \ No newline at end of file diff --git a/Source/Core/DolphinWX/DolphinWX.vcproj b/Source/Core/DolphinWX/DolphinWX.vcproj index e8f2d0730e..3901955fd7 100644 --- a/Source/Core/DolphinWX/DolphinWX.vcproj +++ b/Source/Core/DolphinWX/DolphinWX.vcproj @@ -896,6 +896,14 @@ RelativePath=".\Src\PatchAddEdit.h" > + + + + GetBackgroundColour()); + SetBackgroundColour(wxColour(COLOR_GRAY)); SetSize(size); SetPosition(pos); diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index dabbe89a9b..254c469763 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -231,6 +231,7 @@ EVT_MENU(IDM_BROWSE, CFrame::OnBrowse) EVT_MENU(IDM_MEMCARD, CFrame::OnMemcard) EVT_MENU(IDM_CHEATS, CFrame::OnShow_CheatsWindow) EVT_MENU(IDM_CHANGEDISC, CFrame::OnChangeDisc) +EVT_MENU(IDM_SDCARD, CFrame::OnShow_SDCardWindow) EVT_MENU(IDM_TOGGLE_FULLSCREEN, CFrame::OnToggleFullscreen) EVT_MENU(IDM_TOGGLE_DUALCORE, CFrame::OnToggleDualCore) EVT_MENU(IDM_TOGGLE_SKIPIDLE, CFrame::OnToggleSkipIdle) diff --git a/Source/Core/DolphinWX/Src/Frame.h b/Source/Core/DolphinWX/Src/Frame.h index b7249718f0..193fe08471 100644 --- a/Source/Core/DolphinWX/Src/Frame.h +++ b/Source/Core/DolphinWX/Src/Frame.h @@ -201,6 +201,7 @@ class CFrame : public wxFrame void OnMemcard(wxCommandEvent& event); // Misc void OnShow_CheatsWindow(wxCommandEvent& event); + void OnShow_SDCardWindow(wxCommandEvent& event); void OnGameListCtrl_ItemActivated(wxListEvent& event); diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index 5fbf1ef671..23ff824cb4 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -43,6 +43,7 @@ be accessed from Core::GetWindowHandle(). #include "AboutDolphin.h" #include "GameListCtrl.h" #include "BootManager.h" +#include "SDCardWindow.h" #include "Common.h" // Common #include "FileUtil.h" @@ -81,23 +82,13 @@ extern "C" { #include "../resources/KDE.h" }; -// ---------------------------------------------------------------------------- // Constants -// ---------------------------------------------------------------------------- - static const long TOOLBAR_STYLE = wxTB_FLAT | wxTB_DOCKABLE | wxTB_TEXT; - -// ---------------------------------------------------------------------------- // Other Windows -// ---------------------------------------------------------------------------- - wxCheatsWindow* CheatsWindow; - -// ======================================================= // Create menu items -// ------------- void CFrame::CreateMenu() { delete m_pMenuBar; @@ -152,6 +143,7 @@ void CFrame::CreateMenu() miscMenu->AppendSeparator(); miscMenu->Append(IDM_MEMCARD, _T("&Memcard manager")); miscMenu->Append(IDM_CHEATS, _T("Action &Replay Manager")); + // miscMenu->Append(IDM_SDCARD, _T("Mount &SDCard")); // Disable for now m_pMenuBar->Append(miscMenu, _T("&Misc")); // Help menu @@ -169,9 +161,7 @@ void CFrame::CreateMenu() } -// ======================================================= // Create toolbar items -// ------------- void CFrame::PopulateToolbar(wxToolBar* toolBar) { int w = m_Bitmaps[Toolbar_FileOpen].GetWidth(), @@ -215,9 +205,7 @@ void CFrame::PopulateToolbar(wxToolBar* toolBar) } -////////////////////////////////////////////////// // Delete and recreate the toolbar -// ¯¯¯¯¯¯¯¯¯¯ void CFrame::RecreateToolbar() { @@ -234,9 +222,6 @@ void CFrame::RecreateToolbar() SetToolBar(TheToolBar); UpdateGUI(); } -/////////////////////////////// - - void CFrame::InitBitmaps() { // Get selected theme @@ -386,9 +371,7 @@ void CFrame::BootGame() } } -// ======================================================= // Open file to boot or for changing disc -// ------------- void CFrame::OnOpen(wxCommandEvent& WXUNUSED (event)) { // Don't allow this for an initialized core @@ -462,7 +445,7 @@ void CFrame::OnChangeDisc(wxCommandEvent& WXUNUSED (event)) DoOpen(false); DVDInterface::SetLidOpen(false); } -// ============= + void CFrame::OnRefresh(wxCommandEvent& WXUNUSED (event)) @@ -479,16 +462,10 @@ void CFrame::OnBrowse(wxCommandEvent& WXUNUSED (event)) m_GameListCtrl->BrowseForDirectory(); } - -// ======================================================= -// Play button -// ------------- void CFrame::OnPlay(wxCommandEvent& WXUNUSED (event)) { BootGame(); } -// ============= - void CFrame::DoStop() { @@ -594,13 +571,8 @@ void CFrame::OnHelp(wxCommandEvent& event) break; } } -// ========= // Toolbar - -// ======================================================= // Miscellaneous menu -// ------------- - void CFrame::OnMemcard(wxCommandEvent& WXUNUSED (event)) { CMemcardManager MemcardManager(this); @@ -611,14 +583,13 @@ void CFrame::OnShow_CheatsWindow(wxCommandEvent& WXUNUSED (event)) { CheatsWindow = new wxCheatsWindow(this, wxDefaultPosition, wxSize(600, 390)); } -// ============= - - - -// ======================================================= +void CFrame::OnShow_SDCardWindow(wxCommandEvent& WXUNUSED (event)) +{ + wxSDCardWindow SDWindow(this); + SDWindow.ShowModal(); +} /* Toogle fullscreen. In Windows the fullscreen mode is accomplished by expanding the m_Panel to cover the entire screen (when we render to the main window). */ -// ------------- void CFrame::OnToggleFullscreen(wxCommandEvent& WXUNUSED (event)) { ShowFullScreen(true); @@ -658,9 +629,7 @@ void CFrame::OnSaveState(wxCommandEvent& event) } -// ======================================================= // Let us enable and disable the toolbar -// ------------- void CFrame::OnToggleToolbar(wxCommandEvent& event) { wxToolBarBase* toolBar = GetToolBar(); @@ -677,12 +646,8 @@ void CFrame::OnToggleToolbar(wxCommandEvent& event) this->SendSizeEvent(); } -// =================== - -// ======================================================= // Let us enable and disable the status bar -// ------------- void CFrame::OnToggleStatusbar(wxCommandEvent& event) { if (event.IsChecked()) @@ -692,12 +657,9 @@ void CFrame::OnToggleStatusbar(wxCommandEvent& event) this->SendSizeEvent(); } -// =================== -// ======================================================= // Update the enabled/disabled status -// ------------- void CFrame::UpdateGUI() { #ifdef MUSICMOD diff --git a/Source/Core/DolphinWX/Src/Globals.h b/Source/Core/DolphinWX/Src/Globals.h index 35a09b5236..62cb5728aa 100644 --- a/Source/Core/DolphinWX/Src/Globals.h +++ b/Source/Core/DolphinWX/Src/Globals.h @@ -16,27 +16,16 @@ // http://code.google.com/p/dolphin-emu/ -//////////////////////////////////////////////////////////////////////////////////////// -// File description -/* ¯¯¯¯¯¯¯¯¯ - - This file is global in the DolphinWX and DebuggerWX projects. - -////////////////////////*/ - - -//////////////////////////////////////////////////////////////////////////////////////// -// Settings -// ¯¯¯¯¯¯¯¯¯ -// Build with music modification. Define MUSICMOD here. -#include "../../../Branches/MusicMod/Main/Src/Setup.h" -////////////////////////// - +// This holds global data for DolphinWx and DebuggerWx #ifndef _GLOBALS_H #define _GLOBALS_H #include "Common.h" +#include "../../../Branches/MusicMod/Main/Src/Setup.h" // Build with music modification. Define MUSICMOD here. + +// Constant Colors +const unsigned long COLOR_GRAY = 0xDCDCDC; enum { @@ -70,6 +59,7 @@ enum IDM_CHEATS, IDM_CHANGEDISC, IDM_PROPERTIES, + IDM_SDCARD, IDM_HELPABOUT, // Help menu IDM_HELPWEBSITE, @@ -146,10 +136,7 @@ enum #error You need to enable XPM support to use XPM bitmaps with toolbar! #endif // USE_XPM_BITMAPS - - // // custom message macro - // #define EVT_HOST_COMMAND(id, fn) \ DECLARE_EVENT_TABLE_ENTRY(\ wxEVT_HOST_COMMAND, id, wxID_ANY, \ diff --git a/Source/Core/DolphinWX/Src/SConscript b/Source/Core/DolphinWX/Src/SConscript index ea2d0d334e..4642214b85 100644 --- a/Source/Core/DolphinWX/Src/SConscript +++ b/Source/Core/DolphinWX/Src/SConscript @@ -34,6 +34,7 @@ if wxenv['HAVE_WX']: 'CheatsWindow.cpp', 'stdafx.cpp', 'FrameWiimote.cpp', + 'SDCardWindow.cpp', ] CPPDEFINES = [ diff --git a/Source/Core/DolphinWX/Src/SDCardWindow.cpp b/Source/Core/DolphinWX/Src/SDCardWindow.cpp new file mode 100644 index 0000000000..eae948ed54 --- /dev/null +++ b/Source/Core/DolphinWX/Src/SDCardWindow.cpp @@ -0,0 +1,63 @@ +// Copyright (C) 2003-2008 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 +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#include "SDCardWindow.h" +#include "Globals.h" +#include "IPC_HLE/HW/SDInterface.h" + +BEGIN_EVENT_TABLE(wxSDCardWindow, wxWindow) + EVT_CLOSE( wxSDCardWindow::OnEvent_Window_Close) + EVT_BUTTON(ID_BUTTON_CLOSE, wxSDCardWindow::OnEvent_ButtonClose_Press) +END_EVENT_TABLE() + +wxSDCardWindow::wxSDCardWindow(wxWindow* parent) : + wxDialog(parent, wxID_ANY, _T("SDCard Mounter"), wxDefaultPosition, wxSize(400, 400), wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE) +{ + Init_ChildControls(); + Layout(); + Show(); +} + +wxSDCardWindow::~wxSDCardWindow() +{ + // On Disposal +} + +void wxSDCardWindow::Init_ChildControls() +{ + // Button Strip + m_Button_Close = new wxButton(this, ID_BUTTON_CLOSE, _T("Close"), wxDefaultPosition, wxDefaultSize); + wxBoxSizer* sButtons = new wxBoxSizer(wxHORIZONTAL); + sButtons->Add(m_Button_Close, 0, wxALL, 5); + + wxBoxSizer* sMain = new wxBoxSizer(wxVERTICAL); + sMain->Add(sButtons, 0, wxALL, 5); + SetSizer(sMain); + Layout(); + + Fit(); +} + +void wxSDCardWindow::OnEvent_Window_Close(wxCloseEvent& WXUNUSED(event)) +{ + EndModal(0); +} + +void wxSDCardWindow::OnEvent_ButtonClose_Press(wxCommandEvent& WXUNUSED(event)) +{ + EndModal(0); +} \ No newline at end of file diff --git a/Source/Core/DolphinWX/Src/SDCardWindow.h b/Source/Core/DolphinWX/Src/SDCardWindow.h new file mode 100644 index 0000000000..b0c0a3d24c --- /dev/null +++ b/Source/Core/DolphinWX/Src/SDCardWindow.h @@ -0,0 +1,45 @@ +// Copyright (C) 2003-2008 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 +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef __SDCARD_WINDOW_h__ +#define __SDCARD_WINDOW_h__ + +#include + +class wxSDCardWindow : public wxDialog +{ +public: + wxSDCardWindow(wxWindow* parent); + virtual ~wxSDCardWindow(); + +protected: + DECLARE_EVENT_TABLE(); + + wxButton *m_Button_Close; + + enum + { + ID_BUTTON_CLOSE, + }; + + void Init_ChildControls(); + void OnEvent_Window_Close(wxCloseEvent& event); + void OnEvent_ButtonClose_Press(wxCommandEvent& event); +}; + + +#endif \ No newline at end of file