Interface and general: Fixed the hangings and crashes that would occur from repeated Start and Stop, added optional toolbar themes, made the fullscreen mode in the OpenGL plugin more user friendly for Windows users

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1770 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson
2009-01-04 21:53:41 +00:00
parent 1ed27a4fc1
commit eb2ce16a6c
31 changed files with 11580 additions and 1104 deletions
+10 -26
View File
@@ -26,7 +26,7 @@
#include <stdio.h>
#include <windows.h>
//#include <tchar.h>
/////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
@@ -36,30 +36,14 @@
// Enable or disable logging to screen and file
#define MM_DEBUG
//#define MM_DEBUG_FILEONLY
// ---------------------------------------------------------------------------------------
// _T
/*
#ifdef _UNICODE
#define _T(x) L ## x
#else // _UNICODE
#define _T(x) x
#endif // _UNICODE
To be used with
//wprintf(_T("Please enter a number:"));
//wprintf("Please enter a number");
//wprintf(L"Please enter a number");
*/
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
#ifdef MM_DEBUG
FILE* __fStdOut = NULL;
#endif
#ifndef MM_DEBUG_FILEONLY
HANDLE __hStdOut = NULL;
#endif
/////////////////////////////
@@ -70,7 +54,6 @@ To be used with
// Width and height is the size of console window, if you specify fname,
// the output will also be writton to this file. The file pointer is automatically closed
// when you close the app
//void startConsoleWin(int width=80, int height=2225, char* fname = NULL);
void StartConsoleWin(int width, int height, char* fname)
{
#ifdef MM_DEBUG
@@ -103,10 +86,12 @@ void StartConsoleWin(int width, int height, char* fname)
#endif
}
/////////////////////////////
// Use wprintf like TRACE0, TRACE1, ... (The arguments are the same as printf)
//int wprintf(char *fmt, ...)
//////////////////////////////////////////////////////////////////////////////////////////
// Printf function
// ¯¯¯¯¯¯¯¯¯¯
int wprintf(char *fmt, ...)
{
#ifdef MM_DEBUG
@@ -120,14 +105,12 @@ int wprintf(char *fmt, ...)
DWORD cCharsWritten;
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------
#ifndef MM_DEBUG_FILEONLY
if(__hStdOut)
{
WriteConsole(__hStdOut, s, strlen(s), &cCharsWritten, NULL);
}
#endif
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------
if(__fStdOut)
{
@@ -139,4 +122,5 @@ int wprintf(char *fmt, ...)
#else
return 0;
#endif
}
}
/////////////////////////////
+35 -16
View File
@@ -28,6 +28,12 @@
#include "../../../../Source/Core/DolphinWX/Src/Globals.h" // DolphinWX
#include "../../../../Source/Core/DolphinWX/Src/Frame.h"
#include "../../../../Source/Core/DolphinWX/resources/toolbar_plugin_dsp.c" // Icons
#include "../../../../Source/Core/DolphinWX/resources/Boomy.h"
#include "../../../../Source/Core/DolphinWX/resources/Vista.h"
#include "../../../../Source/Core/DolphinWX/resources/KDE.h"
#include "../../../../Source/Core/DolphinWX/resources/X-Plastik.h"
#include "../../Common/Src/Console.h" // Local
#include "../../Player/Src/PlayerExport.h" // Player
//////////////////////////////////
@@ -127,15 +133,33 @@ void ShowConsole()
#ifdef MUSICMOD
void
CFrame::MM_InitBitmaps()
CFrame::MM_InitBitmaps(int Theme)
{
// Gray version
// Define the log bitmaps
switch (Theme)
{
case BOOMY:
m_Bitmaps[Toolbar_Log] = wxGetBitmapFromMemory(Toolbar_Log_png);
break;
case VISTA:
m_Bitmaps[Toolbar_Log] = wxGetBitmapFromMemory(Toolbar_Log1_png);
break;
case XPLASTIK:
m_Bitmaps[Toolbar_Log] = wxGetBitmapFromMemory(Toolbar_Log2_png);
break;
case KDE:
m_Bitmaps[Toolbar_Log] = wxGetBitmapFromMemory(Toolbar_Log3_png);
break;
default: PanicAlert("Theme selection went wrong");
}
//m_Bitmaps[Toolbar_PluginDSP_Dis] = wxBitmap(SetBrightness(m_Bitmaps[Toolbar_PluginDSP], 165, true));
// Create a gray version
m_Bitmaps[Toolbar_PluginDSP_Dis] = wxBitmap(SetBrightness(m_Bitmaps[Toolbar_PluginDSP], 165, true));
m_Bitmaps[Toolbar_Log_Dis] = wxBitmap(SetBrightness(m_Bitmaps[Toolbar_Log], 165, true));
}
// Update in case the bitmap has been updated
//if (GetToolBar() != NULL) TheToolBar->FindById(Toolbar_Log)->SetNormalBitmap(m_Bitmaps[Toolbar_Log]);
}
void
@@ -164,7 +188,7 @@ CFrame::MM_PopulateGUI()
// -----------
wxToolBar* toolBar = theToolBar; // Shortcut
wxToolBar* toolBar = TheToolBar; // Shortcut
toolBar->AddSeparator();
@@ -195,7 +219,7 @@ CFrame::MM_PopulateGUI()
mm_ToolMute = toolBar->AddTool(IDM_MUTE, _T("Mute"), m_Bitmaps[Toolbar_Play], _T("Mute music"));
mm_ToolMute = toolBar->AddTool(IDM_MUTE, _T("Mute"), m_Bitmaps[Toolbar_PluginDSP], _T("Mute music"));
mm_ToolPlay = toolBar->AddTool(IDM_MUSIC_PLAY, _T("Play"), m_Bitmaps[Toolbar_Play], _T("Play or pause music without pausing the game"));
// This cause the disabled tool bitmap to become some kind of monochrome version
@@ -232,34 +256,30 @@ CFrame::MM_PopulateGUI()
}
//////////////////////////////////////////////////////////////////////////////////////////
// Update GUI
// ¯¯¯¯¯¯¯¯¯¯
void
CFrame::MM_UpdateGUI()
{
// ---------------------------------------------------------------------------------------
if(MusicMod::GlobalMute)
{
//m_pMenuItemMute->SetText(_T("Play"));
//GetToolBar()->SetToolNormalBitmap(IDM_MUTE, m_Bitmaps[Toolbar_Pause]);
mm_ToolMute->SetLabel("Unmute");
mm_ToolMute->SetNormalBitmap(m_Bitmaps[Toolbar_PluginDSP_Dis]);
//m_ToolMute->SetToggle(true);
}
else
{
//GetToolBar()->SetToolNormalBitmap(IDM_MUTE, m_Bitmaps[Toolbar_PluginDSP]);
mm_ToolMute->SetLabel("Mute");
mm_ToolMute->SetNormalBitmap(m_Bitmaps[Toolbar_PluginDSP]);
}
if(MusicMod::GlobalPause)
{
//GetToolBar()->SetToolNormalBitmap(IDM_PAUSE, m_Bitmaps[Toolbar_Pause]);
mm_ToolPlay->SetLabel("Play");
mm_ToolPlay->SetNormalBitmap(m_Bitmaps[Toolbar_Play]);
}
else
{
//GetToolBar()->SetToolNormalBitmap(IDM_PAUSE, m_Bitmaps[Toolbar_PluginDSP]);
mm_ToolPlay->SetLabel("Pause");
mm_ToolPlay->SetNormalBitmap(m_Bitmaps[Toolbar_Pause]);
}
@@ -272,9 +292,8 @@ CFrame::MM_UpdateGUI()
{
mm_ToolLog->SetNormalBitmap(m_Bitmaps[Toolbar_Log_Dis]);
}
// ---------------------------------------------------------------------------------------
}
//////////////////////////////////
@@ -435,7 +454,7 @@ void CFrame::MM_OnLog(wxCommandEvent& event)
MusicMod::bShowConsole = !MusicMod::bShowConsole;
if(MusicMod::bShowConsole)
{ ShowConsole(); Player_Console(true); }
{ ShowConsole(); /*Player_Console(true);*/ }
else
{
#if defined (_WIN32)
+1 -3
View File
@@ -109,11 +109,9 @@ ConfBool cbLoop( &bLoop, TEXT( "Loop" ), CONF_MODE_PUBLIC, false );
////////////////////////////////////////////////////////////////////////////////
//
// The first function that is called by the exe
////////////////////////////////////////////////////////////////////////////////
//int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR lpCmdLine, int nCmdShow )
void Player_Main(bool Console)
{
// =======================================================================================
@@ -146,8 +146,7 @@ void Player_Volume(int a)
void ShowConsole()
{
//startConsoleWin(130, 10000, "Console Window"); // give room for 2000 rows
StartConsoleWin(100, 2000, "ConsoleDLL"); // give room for 2000 rows
StartConsoleWin(100, 2000, "MusicMod"); // give room for 2000 rows
}
+86 -41
View File
@@ -15,6 +15,10 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
//////////////////////////////////////////////////////////////////////////////////////////
// Include
// ¯¯¯¯¯¯¯¯¯¯
#ifdef _WIN32
#include <windows.h>
#else
@@ -63,6 +67,8 @@
#ifndef _WIN32
#define WINAPI
#endif
////////////////////////////////////////
// The idea behind the recent restructure is to fix various stupid problems.
// glXMakeCurrent/ wglMakeCurrent takes a context and makes it current on the current thread.
@@ -71,7 +77,12 @@
namespace Core
{
// forwarding
//////////////////////////////////////////////////////////////////////////////////////////
// Declarations and definitions
// ¯¯¯¯¯¯¯¯¯¯
// Function forwarding
//void Callback_VideoRequestWindowSize(int _iWidth, int _iHeight, BOOL _bFullscreen);
void Callback_VideoLog(const TCHAR* _szMessage, int _bDoBreak);
void Callback_VideoCopiedToXFB();
@@ -89,9 +100,9 @@ TPeekMessages Callback_PeekMessages = NULL;
TUpdateFPSDisplay g_pUpdateFPSDisplay = NULL;
#ifdef _WIN32
DWORD WINAPI EmuThread(void *pArg);
DWORD WINAPI EmuThread(void *pArg);
#else
void *EmuThread(void *pArg);
void *EmuThread(void *pArg);
#endif
void Stop();
@@ -102,6 +113,7 @@ Common::Thread* g_pThread = NULL;
SCoreStartupParameter g_CoreStartupParameter; //uck
Common::Event emuThreadGoing;
//////////////////////////////////////
bool PanicAlertToVideo(const char* text, bool yes_no)
@@ -184,19 +196,45 @@ void Stop() // - Hammertime!
// The quit is to get it out of its message loop
// Should be moved inside the plugin.
#ifdef _WIN32
PostMessage((HWND)g_pWindowHandle, WM_QUIT, 0, 0);
#else
PluginVideo::Video_Stop();
#endif
#ifdef _WIN32
PostMessage((HWND)g_pWindowHandle, WM_QUIT, 0, 0);
#else
PluginVideo::Video_Stop();
#endif
delete g_pThread; //Wait for emuthread to close
#ifdef _WIN32
/* I have to use this to avoid the hangings, it seems harmless and it works so I'm
okay with it */
if (GetParent((HWND)g_pWindowHandle) == NULL)
delete g_pThread; // Wait for emuthread to close
#else
delete g_pThread;
#endif
g_pThread = 0;
Core::StopTrace();
LogManager::Shutdown();
Host_SetWaitCursor(false);
}
void Callback_DebuggerBreak()
{
CCPU::EnableStepping(true);
}
const SCoreStartupParameter& GetStartupParameter()
{
return g_CoreStartupParameter;
}
void* GetWindowHandle()
{
return g_pWindowHandle;
}
//////////////////////////////////////////////////////////////////////////////////////////
// Create the CPU thread
// ¯¯¯¯¯¯¯¯¯¯
THREAD_RETURN CpuThread(void *pArg)
{
Common::SetCurrentThreadName("CPU thread");
@@ -239,19 +277,21 @@ THREAD_RETURN CpuThread(void *pArg)
}
return 0;
}
//////////////////////////////////////////
void Callback_DebuggerBreak()
{
CCPU::EnableStepping(true);
}
//////////////////////////////////////////////////////////////////////////////////////////
// Initalize plugins and create emulation thread
// ¯¯¯¯¯¯¯¯¯¯
/* Call browser: Init():g_pThread(). See the BootManager.cpp file description for a completel
call schedule. */
THREAD_RETURN EmuThread(void *pArg)
{
Common::SetCurrentThreadName("Emuthread - starting");
const SCoreStartupParameter& _CoreParameter = *(SCoreStartupParameter*)pArg;
if (_CoreParameter.bLockThreads)
Common::Thread::SetCurrentThreadAffinity(2); //Force to second core
Common::Thread::SetCurrentThreadAffinity(2); // Force to second core
LOG(OSREPORT, "Starting core = %s mode", _CoreParameter.bWii ? "Wii" : "Gamecube");
LOG(OSREPORT, "Dualcore = %s", _CoreParameter.bUseDualCore ? "Yes" : "No");
@@ -265,7 +305,8 @@ THREAD_RETURN EmuThread(void *pArg)
VideoInitialize.pGetMemoryPointer = Memory::GetPointer;
VideoInitialize.pSetPEToken = PixelEngine::SetToken;
VideoInitialize.pSetPEFinish = PixelEngine::SetFinish;
VideoInitialize.pWindowHandle = _CoreParameter.hMainWindow; // NULL; // filled by video_initialize
// This is first the m_Panel handle, then it is updated to have the new window handle
VideoInitialize.pWindowHandle = _CoreParameter.hMainWindow;
VideoInitialize.pLog = Callback_VideoLog;
VideoInitialize.pSysMessage = Host_SysMessage;
VideoInitialize.pRequestWindowSize = NULL; //Callback_VideoRequestWindowSize;
@@ -278,7 +319,7 @@ THREAD_RETURN EmuThread(void *pArg)
VideoInitialize.pMemoryBase = Memory::base;
VideoInitialize.pKeyPress = Callback_KeyPress;
VideoInitialize.bWii = _CoreParameter.bWii;
PluginVideo::Video_Initialize(&VideoInitialize);
PluginVideo::Video_Initialize(&VideoInitialize); // Call the dll
// Under linux, this is an X11 Display, not an HWND!
g_pWindowHandle = (HWND)VideoInitialize.pWindowHandle;
@@ -339,30 +380,31 @@ THREAD_RETURN EmuThread(void *pArg)
//In single core mode, the CPU thread does the graphics. In fact, the
//CPU thread should in this case also create the emuwindow...
//Spawn the CPU thread
// Spawn the CPU thread
Common::Thread *cpuThread = NULL;
//////////////////////////////////////////////////////////////////////////
// ENTER THE VIDEO THREAD LOOP
//////////////////////////////////////////////////////////////////////////
if (!Core::GetStartupParameter().bUseDualCore)
{
#ifdef _WIN32
cpuThread = new Common::Thread(CpuThread, pArg);
//Common::SetCurrentThreadName("Idle thread");
//TODO(ector) : investigate using GetMessage instead .. although
//then we lose the powerdown check. ... unless powerdown sends a message :P
while (PowerPC::state != PowerPC::CPU_POWERDOWN)
{
if (Callback_PeekMessages) {
Callback_PeekMessages();
#ifdef _WIN32
cpuThread = new Common::Thread(CpuThread, pArg);
//Common::SetCurrentThreadName("Idle thread");
//TODO(ector) : investigate using GetMessage instead .. although
//then we lose the powerdown check. ... unless powerdown sends a message :P
while (PowerPC::state != PowerPC::CPU_POWERDOWN)
{
if (Callback_PeekMessages) {
Callback_PeekMessages();
}
Common::SleepCurrentThread(20);
}
Common::SleepCurrentThread(20);
}
#else
// In single-core mode, the Emulation main thread is also the CPU thread
CpuThread(pArg);
#endif
#else
// In single-core mode, the Emulation main thread is also the CPU thread
CpuThread(pArg);
#endif
}
else
{
@@ -378,7 +420,8 @@ THREAD_RETURN EmuThread(void *pArg)
if (g_pUpdateFPSDisplay != NULL)
g_pUpdateFPSDisplay("Stopping...");
if (cpuThread) {
if (cpuThread)
{
delete cpuThread; // This joins the cpu thread.
// Returns after game exited
cpuThread = NULL;
@@ -408,6 +451,10 @@ THREAD_RETURN EmuThread(void *pArg)
return 0;
}
//////////////////////////////////////////////////////////////////////////////////////////
// Set or get the running state
// ¯¯¯¯¯¯¯¯¯¯
bool SetState(EState _State)
{
switch(_State)
@@ -442,7 +489,12 @@ EState GetState()
}
return CORE_UNINITIALIZED;
}
///////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// Save or recreate the emulation state
// ¯¯¯¯¯¯¯¯¯¯
void SaveState() {
State_Save(0);
}
@@ -450,11 +502,8 @@ void SaveState() {
void LoadState() {
State_Load(0);
}
///////////////////////////////////////
const SCoreStartupParameter& GetStartupParameter()
{
return g_CoreStartupParameter;
}
bool MakeScreenshot(const std::string &filename)
{
@@ -468,10 +517,6 @@ bool MakeScreenshot(const std::string &filename)
return bResult;
}
void* GetWindowHandle()
{
return g_pWindowHandle;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////
// --- Callbacks for plugins / engine ---
+2 -1
View File
@@ -67,7 +67,8 @@ struct SCoreStartupParameter
bool bWii; bool bWiiLeds; bool bWiiSpeakers; // Wii settings
bool bConfirmStop; // Interface settings
bool bConfirmStop, bHideCursor, bAutoHideCursor; // Interface settings
int iTheme;
enum EBootBios
{
+10 -3
View File
@@ -76,8 +76,11 @@ CEXIIPL::CEXIIPL() :
{
/* This is a poor way to handle failure. We should either not display this message unless fonts
are actually accessed, or better yet, emulate them using a system font. -bushing */
// PanicAlert("Error: failed to load font_ansi.bin.\nFonts in a few games may not work, or crash the game.");
// JP: But I want to see this error
#ifndef __APPLE__
PanicAlert("Error: failed to load '" FONT_ANSI_FILE "'. Fonts in a few games may not work, or"
" crash the game.");
#endif
}
pStream = fopen(FONT_SJIS_FILE, "rb");
@@ -93,7 +96,11 @@ CEXIIPL::CEXIIPL() :
else
{
// Heh, BIOS fonts don't really work in JAP games anyway ... we get bogus characters.
// PanicAlert("Error: failed to load font_sjis.bin.\nFonts in a few Japanese games may not work or crash the game.");
// JP: But I want to see this error
#ifndef __APPLE__
PanicAlert("Error: failed to load '" FONT_SJIS_FILE "'. Fonts in a few Japanese games may"
" not work or crash the game.");
#endif
}
memcpy(m_pIPL, iplver, sizeof(iplver));
@@ -102,10 +102,15 @@ CEXIMemoryCard::CEXIMemoryCard(const std::string& _rName, const std::string& _rF
}
//////////////////////////////////////////////////////////////////////////////////////////
// Create new memory card
// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
void CEXIMemoryCard::Flush(bool exiting)
{
FILE* pFile = NULL;
pFile = fopen(m_strFilename.c_str(), "wb");
if (!pFile)
{
std::string dir;
@@ -114,18 +119,23 @@ void CEXIMemoryCard::Flush(bool exiting)
File::CreateDir(dir.c_str());
pFile = fopen(m_strFilename.c_str(), "wb");
}
if (!pFile) //Note - pFile changed inside above if
if (!pFile) // Note - pFile changed inside above if
{
PanicAlert("Could not write memory card file %s.\n\n"
"Are you running Dolphin from a CD/DVD, or is the save file maybe write protected?", m_strFilename.c_str());
return;
}
fwrite(memory_card_content, memory_card_size, 1, pFile);
fclose(pFile);
if (!exiting) {
if (!exiting)
{
Core::DisplayMessage(StringFromFormat("Wrote memory card %i contents to %s.", card_index, m_strFilename.c_str()).c_str(), 4000);
}
}
//////////////////////////////////////
CEXIMemoryCard::~CEXIMemoryCard()
@@ -41,8 +41,11 @@ CWII_IPC_HLE_Device_di::CWII_IPC_HLE_Device_di(u32 _DeviceID, const std::string&
CWII_IPC_HLE_Device_di::~CWII_IPC_HLE_Device_di()
{
delete m_pFileSystem;
delete m_pVolume;
if(m_pFileSystem) { delete m_pFileSystem; m_pFileSystem = NULL; }
/* This caused the crash in VolumeHandler.cpp, setting m_pVolume = NULL; didn't help
it still makes VolumeHandler.cpp have a non-NULL pointer with no content so that
delete crashes */
//if(m_pVolume) { delete m_pVolume; m_pVolume = NULL; }
}
bool CWII_IPC_HLE_Device_di::Open(u32 _CommandAddress, u32 _Mode)
+9 -5
View File
@@ -191,14 +191,18 @@ void LogManager::Shutdown()
{
m_bInitialized = false;
// delete all loggers
// Delete all loggers
for (int i=0; i<LogTypes::NUMBER_OF_LOGS; i++)
{
if (m_Log[i] != NULL)
for (int j = 0; j < VERBOSITY_LEVELS; j++)
{
m_Log[i]->Shutdown();
delete m_Log[i];
m_Log[i] = NULL;
int id = i + j*100;
if (m_Log[id] != NULL)
{
m_Log[id]->Shutdown();
delete m_Log[id];
m_Log[id] = NULL;
}
}
}
+1
View File
@@ -38,6 +38,7 @@ CVolumeGC::CVolumeGC(IBlobReader* _pReader)
CVolumeGC::~CVolumeGC()
{
delete m_pReader;
m_pReader = NULL; // I don't think this makes any difference, but anyway
}
bool CVolumeGC::Read(u64 _Offset, u64 _Length, u8* _pBuffer) const
+12 -2
View File
@@ -66,6 +66,12 @@ void SConfig::SaveSettings()
{
// General
ini.Set("Interface", "ConfirmStop", m_LocalCoreStartupParameter.bConfirmStop);
ini.Set("Interface", "HideCursor", m_LocalCoreStartupParameter.bHideCursor);
ini.Set("Interface", "AutoHideCursor", m_LocalCoreStartupParameter.bAutoHideCursor);
ini.Set("Interface", "Theme", m_LocalCoreStartupParameter.iTheme);
// Core
ini.Set("Core", "HLEBios", m_LocalCoreStartupParameter.bHLEBios);
ini.Set("Core", "UseDynarec", m_LocalCoreStartupParameter.bUseJIT);
@@ -77,7 +83,6 @@ void SConfig::SaveSettings()
ini.Set("Core", "OptimizeQuantizers", m_LocalCoreStartupParameter.bOptimizeQuantizers);
ini.Set("Core", "EnableCheats", m_LocalCoreStartupParameter.bEnableCheats);
ini.Set("Core", "SelectedLanguage", m_LocalCoreStartupParameter.SelectedLanguage);
ini.Set("Interface", "ConfirmStop", m_LocalCoreStartupParameter.bConfirmStop);
ini.Set("Core", "RunCompareServer", m_LocalCoreStartupParameter.bRunCompareServer);
ini.Set("Core", "RunCompareClient", m_LocalCoreStartupParameter.bRunCompareClient);
@@ -157,6 +162,12 @@ void SConfig::LoadSettings()
}
{
// General interfance
ini.Get("Interface", "ConfirmStop", &m_LocalCoreStartupParameter.bConfirmStop, false);
ini.Get("Interface", "HideCursor", &m_LocalCoreStartupParameter.bHideCursor, false);
ini.Get("Interface", "AutoHideCursor", &m_LocalCoreStartupParameter.bAutoHideCursor, false);
ini.Get("Interface", "Theme", &m_LocalCoreStartupParameter.iTheme, 0);
// Core
ini.Get("Core", "HLEBios", &m_LocalCoreStartupParameter.bHLEBios, true);
ini.Get("Core", "UseDynarec", &m_LocalCoreStartupParameter.bUseJIT, true);
@@ -168,7 +179,6 @@ void SConfig::LoadSettings()
ini.Get("Core", "OptimizeQuantizers", &m_LocalCoreStartupParameter.bOptimizeQuantizers, true);
ini.Get("Core", "EnableCheats", &m_LocalCoreStartupParameter.bEnableCheats, false);
ini.Get("Core", "SelectedLanguage", &m_LocalCoreStartupParameter.SelectedLanguage, 0);
ini.Get("Interface", "ConfirmStop", &m_LocalCoreStartupParameter.bConfirmStop, false);
ini.Get("Core", "RunCompareServer", &m_LocalCoreStartupParameter.bRunCompareServer, false);
ini.Get("Core", "RunCompareClient", &m_LocalCoreStartupParameter.bRunCompareClient, false);
File diff suppressed because it is too large Load Diff
+13 -8
View File
@@ -36,6 +36,7 @@ class CConfigMain
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE);
virtual ~CConfigMain();
void OnClick(wxMouseEvent& event);
void CloseClick(wxCommandEvent& event);
void OnSelectionChanged(wxCommandEvent& event);
void OnConfig(wxCommandEvent& event);
@@ -44,18 +45,21 @@ class CConfigMain
private:
DECLARE_EVENT_TABLE();
DECLARE_EVENT_TABLE();
wxBoxSizer* sGeneralPage; // General Settings
wxCheckBox* ConfirmStop, * AutoHideCursor, *HideCursor;
wxRadioBox* Theme;
wxBoxSizer* sCore; // Core settings
wxStaticBoxSizer* sbBasic, *sbAdvanced, *sbInterface;
wxCheckBox* UseDualCore;
wxCheckBox* SkipIdle;
wxCheckBox* EnableCheats;
wxCheckBox* ConfirmStop;
wxCheckBox* AllwaysHLEBIOS;
wxCheckBox* UseDynaRec;
wxCheckBox* UseDualCore;
wxCheckBox* LockThreads;
wxCheckBox* OptimizeQuantizers;
wxCheckBox* SkipIdle;
wxCheckBox* EnableCheats;
wxBoxSizer* sGamecube; // GC settings
wxStaticBoxSizer* sbGamecubeIPLSettings;
@@ -81,7 +85,7 @@ class CConfigMain
wxNotebook *Notebook;
wxPanel *GeneralPage;
wxPanel *MainPage;
wxPanel *CorePage;
wxPanel *GamecubePage;
wxPanel *WiiPage;
wxPanel *PathsPage;
@@ -210,7 +214,8 @@ class CConfigMain
ID_GC_SRAM_LNG_TEXT,
ID_GC_SRAM_LNG,
ID_INTERFACE_CONFIRMSTOP, // Interface settings
ID_INTERFACE_CONFIRMSTOP, ID_INTERFACE_HIDECURSOR, ID_INTERFACE_AUTOHIDECURSOR,
ID_INTERFACE_THEME, // Interface settings
ID_WII_BT_BAR_TEXT,
ID_WII_BT_BAR,
@@ -248,7 +253,7 @@ class CConfigMain
ID_GRAPHIC_CB
};
void CreateGUIControls();
void CreateGUIControls(); void UpdateGUI();
void OnClose(wxCloseEvent& event);
void CoreSettingsChanged(wxCommandEvent& event);
void GCSettingsChanged(wxCommandEvent& event);
File diff suppressed because it is too large Load Diff
+74 -27
View File
@@ -16,11 +16,33 @@
// http://code.google.com/p/dolphin-emu/
//////////////////////////////////////////////////////////////////////////
// Includes
// ¯¯¯¯¯¯¯¯¯¯
#ifndef __FRAME_H_
#define __FRAME_H_
#include <wx/wx.h>
#include <wx/wx.h> // wxWidgets
#include <wx/busyinfo.h>
#include <wx/mstream.h>
////////////////////////////////
//////////////////////////////////////////////////////////////////////////
// A shortcut to access the bitmaps
// ¯¯¯¯¯¯¯¯¯¯
#define wxGetBitmapFromMemory(name) _wxGetBitmapFromMemory(name, sizeof(name))
inline wxBitmap _wxGetBitmapFromMemory(const unsigned char* data, int length)
{
wxMemoryInputStream is(data, length);
return(wxBitmap(wxImage(is, wxBITMAP_TYPE_ANY, -1), -1));
}
////////////////////////////////
//////////////////////////////////////////////////////////////////////////
// Class declarations
// ¯¯¯¯¯¯¯¯¯¯
class CGameListCtrl;
class CFrame : public wxFrame
{
@@ -33,21 +55,26 @@ class CFrame : public wxFrame
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE);
void* GetRenderHandle() {
#ifdef _WIN32
return(m_Panel->GetHandle());
#else
return this;
#endif
}
void* GetRenderHandle()
{
#ifdef _WIN32
return(m_Panel->GetHandle());
#else
return this;
#endif
}
virtual ~CFrame();
// These have to be public
wxStatusBar* m_pStatusBar;
void InitBitmaps();
void DoStop();
bool bRenderToMain;
// --------------------------------
// ---------------------------------------
// Wiimote leds
// ---------
// ---------------
void ModifyStatusBar();
void CreateDestroy(int Case);
void CreateLeds(); void CreateSpeakers();
@@ -60,25 +87,24 @@ class CFrame : public wxFrame
wxStaticBitmap *m_StatBmp[7];
u8 g_Leds[4]; u8 g_Leds_[4];
u8 g_Speakers[3]; u8 g_Speakers_[3];
// ---------
// ---------------
private:
wxBoxSizer* sizerPanel;
CGameListCtrl* m_GameListCtrl;
wxPanel* m_Panel;
wxToolBar* theToolBar;
wxToolBar* TheToolBar;
wxToolBarToolBase* m_ToolPlay;
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////
// Music mod
// ¯¯¯¯¯¯¯¯¯¯
#ifdef MUSICMOD
wxToolBarToolBase* mm_ToolMute, * mm_ToolPlay, * mm_ToolLog;
void MM_UpdateGUI(); void MM_PopulateGUI(); void MM_InitBitmaps();
void MM_UpdateGUI(); void MM_PopulateGUI(); void MM_InitBitmaps(int Theme);
void MM_OnPlay();
void MM_OnMute(wxCommandEvent& event);
void MM_OnPause(wxCommandEvent& event);
@@ -88,7 +114,7 @@ class CFrame : public wxFrame
///////////////////////////////////
enum EBitmaps
enum EToolbar
{
Toolbar_FileOpen,
Toolbar_Refresh,
@@ -96,31 +122,41 @@ class CFrame : public wxFrame
Toolbar_Play,
Toolbar_Stop,
Toolbar_Pause,
Toolbar_FullScreen,
Toolbar_PluginOptions,
Toolbar_PluginGFX,
Toolbar_PluginDSP,
Toolbar_PluginPAD,
Toolbar_FullScreen,
Toolbar_Wiimote,
Toolbar_Help,
#ifdef MUSICMOD
#ifdef MUSICMOD // Music modification
Toolbar_Log, Toolbar_PluginDSP_Dis, Toolbar_Log_Dis,
#endif
Bitmaps_Max,
END
EToolbar_Max
};
enum EBitmapsThemes
{
BOOMY,
VISTA,
XPLASTIK,
KDE,
THEMES_MAX
};
enum WiimoteBitmaps // Wiimote speaker bitmaps
{
CREATELEDS = END,
CREATELEDS,
DESTROYLEDS,
CREATESPEAKERS,
DESTROYSPEAKERS
};
wxBitmap m_Bitmaps[Bitmaps_Max];
wxBitmap m_BitmapsMenu[Bitmaps_Max];
wxBitmap m_Bitmaps[EToolbar_Max];
wxBitmap m_BitmapsMenu[EToolbar_Max];
void InitBitmaps();
void PopulateToolbar(wxToolBar* toolBar);
void RecreateToolbar();
void CreateMenu();
@@ -158,6 +194,8 @@ class CFrame : public wxFrame
void OnToggleToolbar(wxCommandEvent& event);
void OnToggleStatusbar(wxCommandEvent& event);
void OnKeyDown(wxKeyEvent& event); void OnKeyUp(wxKeyEvent& event);
void OnDoubleClick(wxMouseEvent& event); void OnMotion(wxMouseEvent& event);
void OnHostMessage(wxCommandEvent& event);
void OnMemcard(wxCommandEvent& event); // Misc
@@ -178,9 +216,18 @@ class CFrame : public wxFrame
void UpdateGUI();
// Old function that could be cool
// Double click and mouse move options
double m_fLastClickTime, m_iLastMotionTime; int LastMouseX, LastMouseY;
#if wxUSE_TIMER
void Update();
void OnTimer(wxTimerEvent& WXUNUSED(event)) { Update(); }
wxTimer m_timer;
#endif
// Event table
DECLARE_EVENT_TABLE();
};
////////////////////////////////
#endif // __FRAME_H_
File diff suppressed because it is too large Load Diff
+2
View File
@@ -109,6 +109,8 @@ enum
IDM_UPDATEBREAKPOINTS,
IDM_HOST_MESSAGE,
IDM_MPANEL, ID_STATUSBAR,
ID_TOOLBAR = 500,
LIST_CTRL = 1000
};
+156 -116
View File
@@ -15,6 +15,10 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
//////////////////////////////////////////////////////////////////////////////////////////
// Includes
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
#include <vector>
#include <string>
#include "svnrev.h"
@@ -42,7 +46,12 @@
#include "LogWindow.h"
#include "ExtendedTrace.h"
#include "BootManager.h"
////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// Declarations and definitions
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
IMPLEMENT_APP(DolphinApp)
#if defined(HAVE_WX) && HAVE_WX
@@ -79,134 +88,150 @@ LONG WINAPI MyUnhandledExceptionFilter(LPEXCEPTION_POINTERS e) {
return EXCEPTION_CONTINUE_SEARCH;
}
#endif
///////////////////////////////////
// The `main program' equivalent, creating the windows and returning the
// main frame
/////////////////////////////////////////////////////////////
/* The `main program' equivalent that creates the mai nwindow and return the main frame */
// ¯¯¯¯¯¯¯¯¯
bool DolphinApp::OnInit()
{
DetectCPU();
#if defined _DEBUG && defined _WIN32
int tmpflag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
tmpflag |= _CRTDBG_DELAY_FREE_MEM_DF;
_CrtSetDbgFlag(tmpflag);
#endif
#if defined(HAVE_WX) && HAVE_WX
RegisterMsgAlertHandler(&wxMsgAlert);
#endif
#ifdef _WIN32
EXTENDEDTRACEINITIALIZE(".");
SetUnhandledExceptionFilter(&MyUnhandledExceptionFilter);
// TODO: if First Boot
if (!cpu_info.bSSE2)
{
MessageBox(0, _T("Hi,\n\nDolphin requires that your CPU has support for SSE2 extensions.\n"
"Unfortunately your CPU does not support them, so Dolphin will not run.\n\n"
"Sayonara!\n"), "Dolphin", MB_ICONINFORMATION);
return false;
}
#else
if (!cpu_info.bSSE2)
{
printf("%s", "Hi,\n\nDolphin requires that your CPU has support for SSE2 extensions.\n"
"Unfortunately your CPU does not support them, so Dolphin will not run.\n\n"
"Sayonara!\n");
exit(0);
}
#endif
// ============
// Check for debugger
// Declarations and definitions
bool UseDebugger = false;
bool UseLogger = false;
bool LoadElf = false; wxString ElfFile;
#if wxUSE_CMDLINE_PARSER
wxCmdLineEntryDesc cmdLineDesc[] =
{
// Detect CPU info and write it to the cpu_info struct
DetectCPU();
//
#if defined _DEBUG && defined _WIN32
int tmpflag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
tmpflag |= _CRTDBG_DELAY_FREE_MEM_DF;
_CrtSetDbgFlag(tmpflag);
#endif
// Register message box handler
#if defined(HAVE_WX) && HAVE_WX
RegisterMsgAlertHandler(&wxMsgAlert);
#endif
// ------------------------------------------
// Show CPU message
// ---------------
#ifdef _WIN32
EXTENDEDTRACEINITIALIZE(".");
SetUnhandledExceptionFilter(&MyUnhandledExceptionFilter);
// TODO: if First Boot
if (!cpu_info.bSSE2)
{
wxCMD_LINE_SWITCH, _T("h"), _T("help"), _T("Show this help message"),
wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP
},
{
wxCMD_LINE_SWITCH, _T("d"), _T("debugger"), _T("Opens the debugger")
},
{
wxCMD_LINE_SWITCH, _T("l"), _T("logger"), _T("Opens The Logger")
},
{
wxCMD_LINE_OPTION, _T("e"), _T("elf"), _T("Loads an elf file"),
wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL
},
{
wxCMD_LINE_NONE
MessageBox(0, _T("Hi,\n\nDolphin requires that your CPU has support for SSE2 extensions.\n"
"Unfortunately your CPU does not support them, so Dolphin will not run.\n\n"
"Sayonara!\n"), "Dolphin", MB_ICONINFORMATION);
return false;
}
};
#else
if (!cpu_info.bSSE2)
{
printf("%s", "Hi,\n\nDolphin requires that your CPU has support for SSE2 extensions.\n"
"Unfortunately your CPU does not support them, so Dolphin will not run.\n\n"
"Sayonara!\n");
exit(0);
}
#endif
// ---------------
#if defined(__APPLE__)
// check to see if ~/Library/Application Support/Dolphin exists; if not, create it
char AppSupportDir[MAXPATHLEN];
snprintf(AppSupportDir, sizeof(AppSupportDir), "%s/Library/Application Support", getenv("HOME"));
if (!File::Exists(AppSupportDir) || !File::IsDirectory(AppSupportDir))
PanicAlert("Could not open ~/Library/Application Support");
strlcat(AppSupportDir, "/Dolphin", sizeof(AppSupportDir));
if (!File::Exists(AppSupportDir))
File::CreateDir(AppSupportDir);
if (!File::IsDirectory(AppSupportDir))
PanicAlert("~/Library/Application Support/Dolphin exists, but is not a directory");
chdir(AppSupportDir);
// ------------------------------------------
// Parse command lines
// ---------------
#if wxUSE_CMDLINE_PARSER
wxCmdLineEntryDesc cmdLineDesc[] =
{
{
wxCMD_LINE_SWITCH, _T("h"), _T("help"), _T("Show this help message"),
wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP
},
{
wxCMD_LINE_SWITCH, _T("d"), _T("debugger"), _T("Opens the debugger")
},
{
wxCMD_LINE_SWITCH, _T("l"), _T("logger"), _T("Opens The Logger")
},
{
wxCMD_LINE_OPTION, _T("e"), _T("elf"), _T("Loads an elf file"),
wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL
},
{
wxCMD_LINE_NONE
}
};
if (!File::Exists("User")) File::CreateDir("User");
if (!File::Exists("User/GC")) File::CreateDir("User/GC");
// HACK: Get rid of bogus osx param
if (argc > 1 && wxString(argv[argc - 1]).StartsWith(_("-psn_"))) {
delete argv[argc-1];
argv[argc-1] = NULL;
argc--;
}
#endif
#if defined(__APPLE__)
// check to see if ~/Library/Application Support/Dolphin exists; if not, create it
char AppSupportDir[MAXPATHLEN];
snprintf(AppSupportDir, sizeof(AppSupportDir), "%s/Library/Application Support", getenv("HOME"));
if (!File::Exists(AppSupportDir) || !File::IsDirectory(AppSupportDir))
PanicAlert("Could not open ~/Library/Application Support");
// Gets the passed media files from command line
wxCmdLineParser parser(cmdLineDesc, argc, argv);
strlcat(AppSupportDir, "/Dolphin", sizeof(AppSupportDir));
if (!File::Exists(AppSupportDir))
File::CreateDir(AppSupportDir);
if (!File::IsDirectory(AppSupportDir))
PanicAlert("~/Library/Application Support/Dolphin exists, but is not a directory");
chdir(AppSupportDir);
// Get filenames from the command line
if (parser.Parse() != 0)
{
return false;
}
if (!File::Exists("User")) File::CreateDir("User");
if (!File::Exists("User/GC")) File::CreateDir("User/GC");
// HACK: Get rid of bogus osx param
if (argc > 1 && wxString(argv[argc - 1]).StartsWith(_("-psn_"))) {
delete argv[argc-1];
argv[argc-1] = NULL;
argc--;
}
#endif
UseDebugger = parser.Found(_T("debugger"));
UseLogger = parser.Found(_T("logger"));
LoadElf = parser.Found(_T("elf"), &ElfFile);
// Gets the passed media files from command line
wxCmdLineParser parser(cmdLineDesc, argc, argv);
if( LoadElf && ElfFile == wxEmptyString )
PanicAlert("You did not specify a file name");
// Get filenames from the command line
if (parser.Parse() != 0)
{
return false;
}
// ============
#endif
UseDebugger = parser.Found(_T("debugger"));
UseLogger = parser.Found(_T("logger"));
LoadElf = parser.Found(_T("elf"), &ElfFile);
if( LoadElf && ElfFile == wxEmptyString )
PanicAlert("You did not specify a file name");
// ============
#endif
// Load CONFIG_FILE settings
SConfig::GetInstance().LoadSettings();
wxInitAllImageHandlers();
// Create the main frame window
#ifdef _DEBUG
const char *title = "Dolphin Debug SVN R " SVN_REV_STR;
#else
const char *title = "Dolphin SVN R " SVN_REV_STR;
#endif
// Enable the PNG image handler
wxInitAllImageHandlers();
// Create the window title
#ifdef _DEBUG
const char *title = "Dolphin Debug SVN R " SVN_REV_STR;
#else
const char *title = "Dolphin SVN R " SVN_REV_STR;
#endif
// ---------------------------------------------------------------------------------------
// If we are debugging let use save the main window position and size
// TODO: Save position and size on exit
// ---------
// ------------
IniFile ini;
ini.Load(DEBUGGER_CONFIG_FILE);
@@ -216,7 +241,7 @@ bool DolphinApp::OnInit()
ini.Get("MainWindow", "y", &y, 100);
ini.Get("MainWindow", "w", &w, 600);
ini.Get("MainWindow", "h", &h, 800);
// ---------
// -------------------
if(UseDebugger)
{
main_frame = new CFrame((wxFrame*) NULL, wxID_ANY, wxString::FromAscii(title),
@@ -227,9 +252,10 @@ bool DolphinApp::OnInit()
main_frame = new CFrame((wxFrame*) NULL, wxID_ANY, wxString::FromAscii(title),
wxPoint(100, 100), wxSize(800, 600));
}
// ---------
// ------------------
// Create debugger
// Create debugging window
if (UseDebugger)
{
g_pCodeWindow = new CCodeWindow(SConfig::GetInstance().m_LocalCoreStartupParameter, main_frame);
@@ -237,15 +263,19 @@ bool DolphinApp::OnInit()
}
if(!UseDebugger && UseLogger)
{
#ifdef LOGGING
// We aren't using debugger, just logger
// Should be fine for a local copy
CLogWindow* m_LogWindow = new CLogWindow(main_frame);
m_LogWindow->Show(true);
#endif
}
#ifdef LOGGING
// We aren't using debugger, just logger
// Should be fine for a local copy
CLogWindow* m_LogWindow = new CLogWindow(main_frame);
m_LogWindow->Show(true);
#endif
}
// First check if we have a elf command line
// ---------------------------------------------------
// Check the autoboot options.
// ---------------------
// First check if we have a elf command line. Todo: Should we place this under #if wxUSE_CMDLINE_PARSER?
if (LoadElf && ElfFile != wxEmptyString)
{
BootManager::BootCore(std::string(ElfFile.ToAscii()));
@@ -267,7 +297,9 @@ bool DolphinApp::OnInit()
BootManager::BootCore(SConfig::GetInstance().m_LastFilename);
}
}
// ---------------------
// Set main parent window
SetTopWindow(main_frame);
return true;
}
@@ -277,6 +309,8 @@ void DolphinApp::OnEndSession()
{
SConfig::GetInstance().SaveSettings();
}
/////////////////////////////////////// Main window created
/////////////////////////////////////////////////////////////
/* We declare this here instead of in Common/MsgHandler.cpp because we want to keep Common
@@ -361,6 +395,9 @@ void Host_UpdateBreakPointView()
}
/////////////////////////////////////////////////////////////
/* Update Wiimote status bar */
// ¯¯¯¯¯¯¯¯¯
void Host_UpdateLeds(int led_bits) {
// Convert it to a simpler byte format
main_frame->g_Leds[0] = led_bits >> 0;
@@ -376,7 +413,8 @@ void Host_UpdateSpeakerStatus(int index, int speaker_bits) {
main_frame->UpdateSpeakers();
}
void Host_UpdateStatus() {
void Host_UpdateStatus()
{
// Debugging
//std::string Tmp = ArrayToString(main_frame->g_Speakers, sizeof(main_frame->g_Speakers));
//std::string Tmp2 = ArrayToString(main_frame->g_Speakers_, sizeof(main_frame->g_Speakers_));
@@ -391,6 +429,8 @@ void Host_UpdateStatus() {
memcpy(main_frame->g_Speakers_, main_frame->g_Speakers, sizeof(main_frame->g_Speakers));
}
}
///////////////////////////
void Host_UpdateMemoryView()
{}
+1
View File
@@ -22,6 +22,7 @@ if wxenv['HAVE_WX']:
'ARCodeAddEdit.cpp',
'ConfigMain.cpp',
'Frame.cpp',
'FrameTools.cpp',
'GameListCtrl.cpp',
'Globals.cpp',
'ISOFile.cpp',

Some files were not shown because too many files have changed in this diff Show More