[Project64] Create RenderWindow interface
This commit is contained in:
parent
69383fcc7e
commit
93c76fe7dc
|
@ -22,7 +22,6 @@ m_SaveUsing((SAVE_CHIP_TYPE)g_Settings->LoadDword(Game_SaveChip)),
|
|||
m_Plugins(Plugins),
|
||||
m_SyncCPU(NULL),
|
||||
m_SyncPlugins(NULL),
|
||||
m_SyncWindow(NULL),
|
||||
m_MMU_VM(this, SavesReadOnly),
|
||||
m_TLB(this),
|
||||
m_Reg(this, this),
|
||||
|
@ -75,11 +74,6 @@ CN64System::~CN64System()
|
|||
delete m_SyncPlugins;
|
||||
m_SyncPlugins = NULL;
|
||||
}
|
||||
if (m_SyncWindow)
|
||||
{
|
||||
delete m_SyncWindow;
|
||||
m_SyncWindow = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void CN64System::ExternalEvent(SystemEvent action)
|
||||
|
@ -269,10 +263,7 @@ bool CN64System::EmulationStarting(HANDLE hThread, DWORD ThreadId)
|
|||
}
|
||||
catch (...)
|
||||
{
|
||||
WriteTraceF(TraceError, __FUNCTION__ ": Exception caught\nFile: %s\nLine: %d", __FILE__, __LINE__);
|
||||
char Message[600];
|
||||
sprintf(Message, __FUNCTION__ ": Exception caught\nFile: %s\nLine: %d", __FILE__, __LINE__);
|
||||
MessageBox(NULL, Message, "Exception", MB_OK);
|
||||
g_Notify->DisplayError(stdstr_f(__FUNCTION__ ": Exception caught\nFile: %s\nLine: %d", __FILE__, __LINE__).ToUTF16().c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -313,17 +304,15 @@ void CN64System::StartEmulation2(bool NewThread)
|
|||
|
||||
if (CpuType == CPU_SyncCores)
|
||||
{
|
||||
if (g_Plugins->SyncWindow() == NULL)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILEW__, __LINE__);
|
||||
}
|
||||
g_Notify->DisplayMessage(5, L"Copy Plugins");
|
||||
g_Plugins->CopyPlugins(g_Settings->LoadStringVal(Directory_PluginSync));
|
||||
#if defined(WINDOWS_UI)
|
||||
m_SyncWindow = new CMainGui(false);
|
||||
m_SyncPlugins = new CPlugins(g_Settings->LoadStringVal(Directory_PluginSync));
|
||||
m_SyncPlugins->SetRenderWindows(m_SyncWindow, m_SyncWindow);
|
||||
|
||||
m_SyncPlugins->SetRenderWindows(g_Plugins->SyncWindow(), NULL);
|
||||
m_SyncCPU = new CN64System(m_SyncPlugins, true);
|
||||
#else
|
||||
g_Notify -> BreakPoint(__FILEW__, __LINE__);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (CpuType == CPU_Recompiler || CpuType == CPU_SyncCores)
|
||||
|
@ -1158,7 +1147,7 @@ void CN64System::DumpSyncErrors(CN64System * SecondCPU)
|
|||
Error.Log("Register, Recompiler, Interpter\r\n");
|
||||
#ifdef TEST_SP_TRACKING
|
||||
if (m_CurrentSP != GPR[29].UW[0]) {
|
||||
Error.Log("m_CurrentSP,%X,%X\r\n",m_CurrentSP,GPR[29].UW[0]);
|
||||
Error.Log("m_CurrentSP,%X,%X\r\n", m_CurrentSP, GPR[29].UW[0]);
|
||||
}
|
||||
#endif
|
||||
if (m_Reg.m_PROGRAM_COUNTER != SecondCPU->m_Reg.m_PROGRAM_COUNTER) {
|
||||
|
@ -2058,7 +2047,7 @@ bool CN64System::WriteToProtectedMemory(uint32_t Address, int length)
|
|||
{
|
||||
g_Notify->BreakPoint(__FILEW__, __LINE__);
|
||||
#ifdef tofix
|
||||
return m_Recomp->ClearRecompCode_Phys(Address,length,CRecompiler::Remove_ProtectedMem);
|
||||
return m_Recomp->ClearRecompCode_Phys(Address, length, CRecompiler::Remove_ProtectedMem);
|
||||
#endif
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -123,7 +123,6 @@ private:
|
|||
CPlugins * const m_Plugins; //The plugin container
|
||||
CN64System * m_SyncCPU;
|
||||
CPlugins * m_SyncPlugins;
|
||||
CMainGui * m_SyncWindow;
|
||||
CMipsMemoryVM m_MMU_VM; //Memory of the n64
|
||||
CTLB m_TLB;
|
||||
CRegisters m_Reg;
|
||||
|
|
|
@ -51,7 +51,7 @@ bool CAudioPlugin::LoadFunctions(void)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool CAudioPlugin::Initiate(CN64System * System, CMainGui * RenderWindow)
|
||||
bool CAudioPlugin::Initiate(CN64System * System, RenderWindow * Window)
|
||||
{
|
||||
struct AUDIO_INFO
|
||||
{
|
||||
|
@ -88,7 +88,7 @@ bool CAudioPlugin::Initiate(CN64System * System, CMainGui * RenderWindow)
|
|||
|
||||
AUDIO_INFO Info = { 0 };
|
||||
|
||||
Info.hwnd = (HWND)RenderWindow->m_hMainWindow;;
|
||||
Info.hwnd = (HWND)Window->GetWindowHandle();
|
||||
Info.hinst = GetModuleHandle(NULL);
|
||||
Info.MemoryBswaped = TRUE;
|
||||
Info.CheckInterrupts = DummyCheckInterrupts;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
#include "Plugin Base.h"
|
||||
|
||||
class CAudioPlugin : public CPlugin
|
||||
{
|
||||
|
@ -17,7 +18,7 @@ public:
|
|||
~CAudioPlugin();
|
||||
|
||||
void DacrateChanged(SYSTEM_TYPE Type);
|
||||
bool Initiate(CN64System * System, CMainGui * RenderWindow);
|
||||
bool Initiate(CN64System * System, RenderWindow * Window);
|
||||
|
||||
void(__cdecl *AiLenChanged)(void);
|
||||
uint32_t(__cdecl *AiReadLength)(void);
|
||||
|
|
|
@ -58,7 +58,7 @@ bool CControl_Plugin::LoadFunctions(void)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool CControl_Plugin::Initiate(CN64System * System, CMainGui * RenderWindow)
|
||||
bool CControl_Plugin::Initiate(CN64System * System, RenderWindow * Window)
|
||||
{
|
||||
for (int32_t i = 0; i < 4; i++)
|
||||
{
|
||||
|
@ -74,7 +74,7 @@ bool CControl_Plugin::Initiate(CN64System * System, CMainGui * RenderWindow)
|
|||
void(__cdecl *InitiateControllers_1_0)(HWND hMainWindow, CONTROL Controls[4]);
|
||||
InitiateControllers_1_0 = (void(__cdecl *)(HWND, CONTROL *))GetProcAddress((HMODULE)m_hDll, "InitiateControllers");
|
||||
if (InitiateControllers_1_0 == NULL) { return false; }
|
||||
InitiateControllers_1_0((HWND)RenderWindow->m_hMainWindow,m_PluginControllers);
|
||||
InitiateControllers_1_0((HWND)Window->GetWindowHandle(),m_PluginControllers);
|
||||
m_Initialized = true;
|
||||
}
|
||||
else if (m_PluginInfo.Version >= 0x0101)
|
||||
|
@ -104,7 +104,7 @@ bool CControl_Plugin::Initiate(CN64System * System, CMainGui * RenderWindow)
|
|||
ControlInfo.Controls = m_PluginControllers;
|
||||
ControlInfo.HEADER = (System == NULL ? Buffer : g_Rom->GetRomAddress());
|
||||
ControlInfo.hinst = GetModuleHandle(NULL);
|
||||
ControlInfo.hMainWindow = (HWND)RenderWindow->m_hMainWindow;
|
||||
ControlInfo.hMainWindow = (HWND)Window->GetWindowHandle();
|
||||
ControlInfo.MemoryBswaped = TRUE;
|
||||
|
||||
InitiateControllers_1_1(&ControlInfo);
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
#include "Plugin Base.h"
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4201) // warning C4201: nonstandard extension used : nameless struct/union
|
||||
|
@ -87,7 +88,7 @@ public:
|
|||
CControl_Plugin(void);
|
||||
~CControl_Plugin();
|
||||
|
||||
bool Initiate(CN64System * System, CMainGui * RenderWindow);
|
||||
bool Initiate(CN64System * System, RenderWindow * Window);
|
||||
void SetControl(CControl_Plugin const * const Plugin);
|
||||
void UpdateKeys(void);
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ bool CGfxPlugin::LoadFunctions(void)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool CGfxPlugin::Initiate(CN64System * System, CMainGui * RenderWindow)
|
||||
bool CGfxPlugin::Initiate(CN64System * System, RenderWindow * Window)
|
||||
{
|
||||
if (m_Initialized)
|
||||
{
|
||||
|
@ -153,8 +153,8 @@ bool CGfxPlugin::Initiate(CN64System * System, CMainGui * RenderWindow)
|
|||
GFX_INFO Info = { 0 };
|
||||
|
||||
Info.MemoryBswaped = TRUE;
|
||||
Info.hWnd = (HWND)RenderWindow->m_hMainWindow;
|
||||
Info.hStatusBar = (HWND)RenderWindow->m_hStatusWnd;
|
||||
Info.hWnd = (HWND)Window->GetWindowHandle();
|
||||
Info.hStatusBar = (HWND)Window->GetStatusBar();
|
||||
Info.CheckInterrupts = DummyCheckInterrupts;
|
||||
|
||||
// We are initializing the plugin before any rom is loaded so we do not have any correct
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
#include "Plugin Base.h"
|
||||
|
||||
class CGfxPlugin : public CPlugin
|
||||
{
|
||||
|
@ -52,7 +53,7 @@ public:
|
|||
~CGfxPlugin();
|
||||
|
||||
bool LoadFunctions(void);
|
||||
bool Initiate(CN64System * System, CMainGui * RenderWindow);
|
||||
bool Initiate(CN64System * System, RenderWindow * Window);
|
||||
|
||||
void(__cdecl *CaptureScreen) (const char *);
|
||||
void(__cdecl *ChangeWindow) (void);
|
||||
|
|
|
@ -9,9 +9,12 @@
|
|||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include <Common\path.h>
|
||||
#include "Plugin Class.h"
|
||||
|
||||
CPlugins::CPlugins(const stdstr & PluginDir) :
|
||||
m_RenderWindow(NULL), m_DummyWindow(NULL),
|
||||
m_MainWindow(NULL),
|
||||
m_SyncWindow(NULL),
|
||||
m_PluginDir(PluginDir),
|
||||
m_Gfx(NULL),
|
||||
m_Audio(NULL),
|
||||
|
@ -215,10 +218,10 @@ void CPlugins::DestroyControlPlugin(void)
|
|||
// g_Settings->UnknownSetting_CTRL = NULL;
|
||||
}
|
||||
|
||||
void CPlugins::SetRenderWindows( CMainGui * RenderWindow, CMainGui * DummyWindow )
|
||||
void CPlugins::SetRenderWindows(RenderWindow * MainWindow, RenderWindow * SyncWindow)
|
||||
{
|
||||
m_RenderWindow = RenderWindow;
|
||||
m_DummyWindow = DummyWindow;
|
||||
m_MainWindow = MainWindow;
|
||||
m_SyncWindow = SyncWindow;
|
||||
}
|
||||
|
||||
void CPlugins::RomOpened(void)
|
||||
|
@ -247,13 +250,13 @@ bool CPlugins::Initiate(CN64System * System)
|
|||
if (m_Control == NULL) { return false; }
|
||||
|
||||
WriteTrace(TraceGfxPlugin, __FUNCTION__ ": Gfx Initiate Starting");
|
||||
if (!m_Gfx->Initiate(System,m_RenderWindow)) { return false; }
|
||||
if (!m_Gfx->Initiate(System, m_MainWindow)) { return false; }
|
||||
WriteTrace(TraceGfxPlugin, __FUNCTION__ ": Gfx Initiate Done");
|
||||
WriteTrace(TraceDebug, __FUNCTION__ ": Audio Initiate Starting");
|
||||
if (!m_Audio->Initiate(System,m_RenderWindow)) { return false; }
|
||||
if (!m_Audio->Initiate(System, m_MainWindow)) { return false; }
|
||||
WriteTrace(TraceDebug, __FUNCTION__ ": Audio Initiate Done");
|
||||
WriteTrace(TraceDebug, __FUNCTION__ ": Control Initiate Starting");
|
||||
if (!m_Control->Initiate(System,m_RenderWindow)) { return false; }
|
||||
if (!m_Control->Initiate(System, m_MainWindow)) { return false; }
|
||||
WriteTrace(TraceDebug, __FUNCTION__ ": Control Initiate Done");
|
||||
WriteTrace(TraceRSP, __FUNCTION__ ": RSP Initiate Starting");
|
||||
if (!m_RSP->Initiate(this, System)) { return false; }
|
||||
|
@ -264,12 +267,7 @@ bool CPlugins::Initiate(CN64System * System)
|
|||
|
||||
bool CPlugins::ResetInUiThread(CN64System * System)
|
||||
{
|
||||
#if defined(WINDOWS_UI)
|
||||
return m_RenderWindow->ResetPlugins(this, System);
|
||||
#else
|
||||
g_Notify -> BreakPoint(__FILEW__, __LINE__);
|
||||
return false;
|
||||
#endif
|
||||
return m_MainWindow->ResetPluginsInUiThread(this, System);
|
||||
}
|
||||
|
||||
bool CPlugins::Reset(CN64System * System)
|
||||
|
@ -295,19 +293,19 @@ bool CPlugins::Reset(CN64System * System)
|
|||
if (m_Gfx && bGfxChange)
|
||||
{
|
||||
WriteTrace(TraceGfxPlugin, __FUNCTION__ ": Gfx Initiate Starting");
|
||||
if (!m_Gfx->Initiate(System,m_RenderWindow)) { return false; }
|
||||
if (!m_Gfx->Initiate(System, m_MainWindow)) { return false; }
|
||||
WriteTrace(TraceGfxPlugin, __FUNCTION__ ": Gfx Initiate Done");
|
||||
}
|
||||
if (m_Audio && bAudioChange)
|
||||
{
|
||||
WriteTrace(TraceDebug, __FUNCTION__ ": Audio Initiate Starting");
|
||||
if (!m_Audio->Initiate(System,m_RenderWindow)) { return false; }
|
||||
if (!m_Audio->Initiate(System, m_MainWindow)) { return false; }
|
||||
WriteTrace(TraceDebug, __FUNCTION__ ": Audio Initiate Done");
|
||||
}
|
||||
if (m_Control && bContChange)
|
||||
{
|
||||
WriteTrace(TraceDebug, __FUNCTION__ ": Control Initiate Starting");
|
||||
if (!m_Control->Initiate(System,m_RenderWindow)) { return false; }
|
||||
if (!m_Control->Initiate(System, m_MainWindow)) { return false; }
|
||||
WriteTrace(TraceDebug, __FUNCTION__ ": Control Initiate Done");
|
||||
}
|
||||
if (m_RSP && bRspChange)
|
||||
|
|
|
@ -81,8 +81,16 @@ enum PLUGIN_TYPE
|
|||
};
|
||||
|
||||
class CSettings;
|
||||
class CMainGui;
|
||||
class CGfxPlugin; class CAudioPlugin; class CRSP_Plugin; class CControl_Plugin;
|
||||
class CN64System;
|
||||
class CPlugins;
|
||||
|
||||
__interface RenderWindow
|
||||
{
|
||||
bool ResetPluginsInUiThread(CPlugins * plugins, CN64System * System) = 0;
|
||||
void * GetWindowHandle(void) const = 0;
|
||||
void * GetStatusBar(void) const = 0;
|
||||
};
|
||||
|
||||
class CPlugins :
|
||||
private CDebugSettings
|
||||
|
@ -95,7 +103,7 @@ public:
|
|||
bool Initiate(CN64System * System);
|
||||
void RomOpened(void);
|
||||
void RomClosed(void);
|
||||
void SetRenderWindows ( CMainGui * RenderWindow, CMainGui * DummyWindow );
|
||||
void SetRenderWindows(RenderWindow * MainWindow, RenderWindow * SyncWindow);
|
||||
void ConfigPlugin(uint32_t hParent, PLUGIN_TYPE Type);
|
||||
bool CopyPlugins(const stdstr & DstDir) const;
|
||||
void CreatePlugins(void);
|
||||
|
@ -108,6 +116,8 @@ public:
|
|||
inline CRSP_Plugin * RSP(void) const { return m_RSP; }
|
||||
inline CControl_Plugin * Control(void) const { return m_Control; }
|
||||
|
||||
inline RenderWindow * MainWindow(void) const { return m_MainWindow; }
|
||||
inline RenderWindow * SyncWindow(void) const { return m_SyncWindow; }
|
||||
|
||||
private:
|
||||
CPlugins(void); // Disable default constructor
|
||||
|
@ -121,8 +131,8 @@ private:
|
|||
|
||||
static void PluginChanged(CPlugins * _this);
|
||||
|
||||
CMainGui * m_RenderWindow;
|
||||
CMainGui * m_DummyWindow;
|
||||
RenderWindow * m_MainWindow;
|
||||
RenderWindow * m_SyncWindow;
|
||||
|
||||
stdstr const m_PluginDir;
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -11,6 +11,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <Project64\N64 System\Debugger\debugger.h>
|
||||
#include <Project64\Plugins\Plugin Class.h>
|
||||
|
||||
class CGfxPlugin; //Plugin that controls the rendering
|
||||
class CAudioPlugin; //Plugin for audio, need the hwnd
|
||||
|
@ -28,6 +29,7 @@ enum
|
|||
};
|
||||
|
||||
class CMainGui :
|
||||
public RenderWindow,
|
||||
public CRomBrowser,
|
||||
public CDebuggerUI,
|
||||
private CGuiSettings
|
||||
|
@ -80,10 +82,11 @@ public:
|
|||
void AboutBox(void);
|
||||
|
||||
//Plugins
|
||||
bool ResetPlugins ( CPlugins * plugins, CN64System * System );
|
||||
bool ResetPluginsInUiThread(CPlugins * plugins, CN64System * System);
|
||||
|
||||
//Get Window Handle
|
||||
inline HWND GetHandle ( void ) const { return m_hMainWindow; }
|
||||
void * GetWindowHandle(void) const { return m_hMainWindow; }
|
||||
void * GetStatusBar(void) const { return m_hStatusWnd; }
|
||||
|
||||
private:
|
||||
CMainGui(void); // Disable default constructor
|
||||
|
|
|
@ -1,335 +1,322 @@
|
|||
#include "stdafx.h"
|
||||
#include <time.h>
|
||||
|
||||
CNotification & Notify ( void )
|
||||
CNotification & Notify(void)
|
||||
{
|
||||
static CNotification g_Notify;
|
||||
return g_Notify;
|
||||
static CNotification g_Notify;
|
||||
return g_Notify;
|
||||
}
|
||||
|
||||
CNotification::CNotification() :
|
||||
m_hWnd(NULL),
|
||||
m_gfxPlugin(NULL),
|
||||
m_NextMsg(0)
|
||||
m_hWnd(NULL),
|
||||
m_gfxPlugin(NULL),
|
||||
m_NextMsg(0)
|
||||
{
|
||||
_tzset();
|
||||
_tzset();
|
||||
}
|
||||
|
||||
void CNotification::AppInitDone(void)
|
||||
{
|
||||
CNotificationSettings::RegisterNotifications();
|
||||
CNotificationSettings::RegisterNotifications();
|
||||
}
|
||||
|
||||
void CNotification::SetMainWindow ( CMainGui * Gui )
|
||||
void CNotification::SetMainWindow(CMainGui * Gui)
|
||||
{
|
||||
m_hWnd = Gui;
|
||||
m_hWnd = Gui;
|
||||
}
|
||||
|
||||
void CNotification::WindowMode ( void ) const
|
||||
void CNotification::WindowMode(void) const
|
||||
{
|
||||
static bool InsideFunc = false;
|
||||
if (InsideFunc)
|
||||
{
|
||||
return;
|
||||
}
|
||||
InsideFunc = true;
|
||||
if (InFullScreen())
|
||||
{
|
||||
ChangeFullScreen();
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
Sleep(50);
|
||||
if (ProcessGuiMessages())
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
InsideFunc = false;
|
||||
static bool InsideFunc = false;
|
||||
if (InsideFunc)
|
||||
{
|
||||
return;
|
||||
}
|
||||
InsideFunc = true;
|
||||
if (InFullScreen())
|
||||
{
|
||||
ChangeFullScreen();
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
Sleep(50);
|
||||
if (ProcessGuiMessages())
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
InsideFunc = false;
|
||||
}
|
||||
|
||||
void CNotification::DisplayError(LanguageStringID StringID) const
|
||||
{
|
||||
DisplayError(g_Lang->GetString(StringID).c_str());
|
||||
DisplayError(g_Lang->GetString(StringID).c_str());
|
||||
}
|
||||
|
||||
void CNotification::DisplayError(const wchar_t * Message) const
|
||||
{
|
||||
if (this == NULL) { return; }
|
||||
if (this == NULL) { return; }
|
||||
|
||||
stdstr TraceMessage;
|
||||
TraceMessage.FromUTF16(Message);
|
||||
WriteTrace(TraceError,TraceMessage.c_str());
|
||||
WindowMode();
|
||||
TraceMessage.FromUTF16(Message);
|
||||
WriteTrace(TraceError, TraceMessage.c_str());
|
||||
WindowMode();
|
||||
|
||||
HWND Parent = NULL;
|
||||
if (m_hWnd)
|
||||
{
|
||||
Parent = m_hWnd->GetHandle();
|
||||
HWND Parent = NULL;
|
||||
if (m_hWnd)
|
||||
{
|
||||
Parent = reinterpret_cast<HWND>(m_hWnd->GetWindowHandle());
|
||||
}
|
||||
MessageBoxW(Parent, Message, GS(MSG_MSGBOX_TITLE), MB_OK | MB_ICONERROR | MB_SETFOREGROUND);
|
||||
MessageBoxW(Parent, Message, GS(MSG_MSGBOX_TITLE), MB_OK | MB_ICONERROR | MB_SETFOREGROUND);
|
||||
}
|
||||
|
||||
void CNotification::DisplayMessage(int DisplayTime, LanguageStringID StringID) const
|
||||
{
|
||||
DisplayMessage(DisplayTime, g_Lang->GetString(StringID).c_str());
|
||||
DisplayMessage(DisplayTime, g_Lang->GetString(StringID).c_str());
|
||||
}
|
||||
|
||||
void CNotification::DisplayMessage(int DisplayTime, const wchar_t * Message) const
|
||||
{
|
||||
if (!m_hWnd) { return; }
|
||||
if (!m_hWnd) { return; }
|
||||
|
||||
if (m_NextMsg > 0 || DisplayTime > 0)
|
||||
{
|
||||
time_t Now = time(NULL);
|
||||
if (DisplayTime == 0 && Now < m_NextMsg)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (DisplayTime > 0)
|
||||
{
|
||||
m_NextMsg = Now + DisplayTime;
|
||||
}
|
||||
if (m_NextMsg == 0)
|
||||
{
|
||||
m_NextMsg = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (InFullScreen())
|
||||
{
|
||||
if (m_gfxPlugin && m_gfxPlugin->DrawStatus)
|
||||
{
|
||||
WriteTrace(TraceGfxPlugin,__FUNCTION__ ": DrawStatus - Starting");
|
||||
stdstr PluginMessage;
|
||||
PluginMessage.FromUTF16(Message);
|
||||
m_gfxPlugin->DrawStatus(PluginMessage.c_str(), FALSE);
|
||||
WriteTrace(TraceGfxPlugin,__FUNCTION__ ": DrawStatus - Done");
|
||||
}
|
||||
}
|
||||
else
|
||||
if (m_NextMsg > 0 || DisplayTime > 0)
|
||||
{
|
||||
#if defined(WINDOWS_UI)
|
||||
m_hWnd->SetStatusText(0, Message);
|
||||
#else
|
||||
g_Notify -> BreakPoint(__FILEW__, __LINE__);
|
||||
#endif
|
||||
}
|
||||
time_t Now = time(NULL);
|
||||
if (DisplayTime == 0 && Now < m_NextMsg)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (DisplayTime > 0)
|
||||
{
|
||||
m_NextMsg = Now + DisplayTime;
|
||||
}
|
||||
if (m_NextMsg == 0)
|
||||
{
|
||||
m_NextMsg = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (InFullScreen())
|
||||
{
|
||||
if (m_gfxPlugin && m_gfxPlugin->DrawStatus)
|
||||
{
|
||||
WriteTrace(TraceGfxPlugin, __FUNCTION__ ": DrawStatus - Starting");
|
||||
stdstr PluginMessage;
|
||||
PluginMessage.FromUTF16(Message);
|
||||
m_gfxPlugin->DrawStatus(PluginMessage.c_str(), FALSE);
|
||||
WriteTrace(TraceGfxPlugin, __FUNCTION__ ": DrawStatus - Done");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_hWnd->SetStatusText(0, Message);
|
||||
}
|
||||
}
|
||||
|
||||
void CNotification::DisplayMessage2 ( const wchar_t * Message ) const
|
||||
void CNotification::DisplayMessage2(const wchar_t * Message) const
|
||||
{
|
||||
if (!m_hWnd) { return; }
|
||||
if (!m_hWnd) { return; }
|
||||
|
||||
#if defined(WINDOWS_UI)
|
||||
m_hWnd->SetStatusText(1, Message);
|
||||
#else
|
||||
g_Notify -> BreakPoint(__FILEW__, __LINE__);
|
||||
#endif
|
||||
m_hWnd->SetStatusText(1, Message);
|
||||
}
|
||||
|
||||
void CNotification::SetGfxPlugin( CGfxPlugin * Plugin )
|
||||
void CNotification::SetGfxPlugin(CGfxPlugin * Plugin)
|
||||
{
|
||||
m_gfxPlugin = Plugin;
|
||||
m_gfxPlugin = Plugin;
|
||||
}
|
||||
|
||||
void CNotification::SetWindowCaption (const wchar_t * Caption)
|
||||
void CNotification::SetWindowCaption(const wchar_t * Caption)
|
||||
{
|
||||
static const size_t TITLE_SIZE = 256;
|
||||
wchar_t WinTitle[TITLE_SIZE];
|
||||
static const size_t TITLE_SIZE = 256;
|
||||
wchar_t WinTitle[TITLE_SIZE];
|
||||
|
||||
_snwprintf(WinTitle, TITLE_SIZE, L"%s - %s", Caption, g_Settings->LoadStringVal(Setting_ApplicationName).ToUTF16().c_str());
|
||||
WinTitle[TITLE_SIZE - 1] = 0;
|
||||
_snwprintf(WinTitle, TITLE_SIZE, L"%s - %s", Caption, g_Settings->LoadStringVal(Setting_ApplicationName).ToUTF16().c_str());
|
||||
WinTitle[TITLE_SIZE - 1] = 0;
|
||||
#if defined(WINDOWS_UI)
|
||||
m_hWnd->Caption(WinTitle);
|
||||
m_hWnd->Caption(WinTitle);
|
||||
#else
|
||||
g_Notify -> BreakPoint(__FILEW__, __LINE__);
|
||||
g_Notify->BreakPoint(__FILEW__, __LINE__);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CNotification::FatalError(LanguageStringID StringID) const
|
||||
{
|
||||
FatalError(g_Lang->GetString(StringID).c_str());
|
||||
FatalError(g_Lang->GetString(StringID).c_str());
|
||||
}
|
||||
|
||||
void CNotification::FatalError(const wchar_t * Message) const
|
||||
{
|
||||
WindowMode();
|
||||
WindowMode();
|
||||
|
||||
HWND Parent = NULL;
|
||||
if (m_hWnd) { Parent = reinterpret_cast<HWND>(m_hWnd->GetHandle()); }
|
||||
MessageBoxW(Parent, Message, L"Error", MB_OK | MB_ICONERROR | MB_SETFOREGROUND);
|
||||
ExitThread(0);
|
||||
HWND Parent = NULL;
|
||||
if (m_hWnd) { Parent = reinterpret_cast<HWND>(m_hWnd->GetWindowHandle()); }
|
||||
MessageBoxW(Parent, Message, L"Error", MB_OK | MB_ICONERROR | MB_SETFOREGROUND);
|
||||
ExitThread(0);
|
||||
}
|
||||
|
||||
void CNotification::AddRecentDir ( const char * RomDir )
|
||||
void CNotification::AddRecentDir(const char * RomDir)
|
||||
{
|
||||
//Validate the passed string
|
||||
if (HIWORD(RomDir) == NULL) { return; }
|
||||
//Validate the passed string
|
||||
if (HIWORD(RomDir) == NULL) { return; }
|
||||
|
||||
//Get Information about the stored rom list
|
||||
size_t MaxRememberedDirs = g_Settings->LoadDword(Directory_RecentGameDirCount);
|
||||
strlist RecentDirs;
|
||||
size_t i;
|
||||
for (i = 0; i < MaxRememberedDirs; i ++ )
|
||||
{
|
||||
stdstr RecentDir = g_Settings->LoadStringIndex(Directory_RecentGameDirIndex,i);
|
||||
if (RecentDir.empty())
|
||||
{
|
||||
break;
|
||||
}
|
||||
RecentDirs.push_back(RecentDir);
|
||||
}
|
||||
|
||||
//See if the dir is already in the list if so then move it to the top of the list
|
||||
strlist::iterator iter;
|
||||
for (iter = RecentDirs.begin(); iter != RecentDirs.end(); iter++)
|
||||
{
|
||||
if (_stricmp(RomDir,iter->c_str()) != 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
RecentDirs.erase(iter);
|
||||
break;
|
||||
}
|
||||
RecentDirs.push_front(RomDir);
|
||||
if (RecentDirs.size() > MaxRememberedDirs)
|
||||
{
|
||||
RecentDirs.pop_back();
|
||||
}
|
||||
|
||||
for (i = 0, iter = RecentDirs.begin(); iter != RecentDirs.end(); iter++, i++)
|
||||
{
|
||||
g_Settings->SaveStringIndex(Directory_RecentGameDirIndex,i,*iter);
|
||||
}
|
||||
}
|
||||
|
||||
void CNotification::AddRecentRom ( const char * ImagePath )
|
||||
{
|
||||
if (HIWORD(ImagePath) == NULL) { return; }
|
||||
|
||||
//Get Information about the stored rom list
|
||||
size_t MaxRememberedFiles = g_Settings->LoadDword(File_RecentGameFileCount);
|
||||
strlist RecentGames;
|
||||
size_t i;
|
||||
for (i = 0; i < MaxRememberedFiles; i ++ )
|
||||
{
|
||||
stdstr RecentGame = g_Settings->LoadStringIndex(File_RecentGameFileIndex,i);
|
||||
if (RecentGame.empty())
|
||||
{
|
||||
break;
|
||||
}
|
||||
RecentGames.push_back(RecentGame);
|
||||
}
|
||||
|
||||
//See if the dir is already in the list if so then move it to the top of the list
|
||||
strlist::iterator iter;
|
||||
for (iter = RecentGames.begin(); iter != RecentGames.end(); iter++)
|
||||
{
|
||||
if (_stricmp(ImagePath,iter->c_str()) != 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
RecentGames.erase(iter);
|
||||
break;
|
||||
}
|
||||
RecentGames.push_front(ImagePath);
|
||||
if (RecentGames.size() > MaxRememberedFiles)
|
||||
{
|
||||
RecentGames.pop_back();
|
||||
}
|
||||
|
||||
for (i = 0, iter = RecentGames.begin(); iter != RecentGames.end(); iter++, i++)
|
||||
{
|
||||
g_Settings->SaveStringIndex(File_RecentGameFileIndex,i,*iter);
|
||||
}
|
||||
}
|
||||
|
||||
void CNotification::RefreshMenu ( void )
|
||||
{
|
||||
if (m_hWnd == NULL) { return; }
|
||||
|
||||
#if defined(WINDOWS_UI)
|
||||
m_hWnd->RefreshMenu();
|
||||
#else
|
||||
g_Notify -> BreakPoint(__FILEW__, __LINE__);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CNotification::HideRomBrowser ( void )
|
||||
{
|
||||
if (m_hWnd == NULL) { return; }
|
||||
m_hWnd->HideRomList();
|
||||
}
|
||||
|
||||
void CNotification::ShowRomBrowser ( void )
|
||||
{
|
||||
if (m_hWnd == NULL) { return; }
|
||||
if (g_Settings->LoadDword(RomBrowser_Enabled))
|
||||
//Get Information about the stored rom list
|
||||
size_t MaxRememberedDirs = g_Settings->LoadDword(Directory_RecentGameDirCount);
|
||||
strlist RecentDirs;
|
||||
size_t i;
|
||||
for (i = 0; i < MaxRememberedDirs; i++)
|
||||
{
|
||||
//Display the rom browser
|
||||
m_hWnd->ShowRomList();
|
||||
m_hWnd->HighLightLastRom();
|
||||
}
|
||||
}
|
||||
|
||||
void CNotification::BringToTop ( void )
|
||||
{
|
||||
if (m_hWnd == NULL) { return; }
|
||||
|
||||
#if defined(WINDOWS_UI)
|
||||
m_hWnd->BringToTop();
|
||||
#else
|
||||
g_Notify -> BreakPoint(__FILEW__, __LINE__);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CNotification::MakeWindowOnTop ( bool OnTop )
|
||||
{
|
||||
if (m_hWnd == NULL) { return; }
|
||||
|
||||
#if defined(WINDOWS_UI)
|
||||
m_hWnd->MakeWindowOnTop(OnTop);
|
||||
#else
|
||||
g_Notify -> BreakPoint(__FILEW__, __LINE__);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CNotification::ChangeFullScreen ( void ) const
|
||||
{
|
||||
if (m_hWnd == NULL) { return; }
|
||||
SendMessage((HWND)(m_hWnd->GetHandle()),WM_COMMAND,MAKELPARAM(ID_OPTIONS_FULLSCREEN2,false),0);
|
||||
}
|
||||
|
||||
bool CNotification::ProcessGuiMessages ( void ) const
|
||||
{
|
||||
if (m_hWnd == NULL) { return false; }
|
||||
|
||||
#if defined(WINDOWS_UI)
|
||||
return m_hWnd->ProcessGuiMessages();
|
||||
#else
|
||||
g_Notify -> BreakPoint(__FILEW__, __LINE__);
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void CNotification::BreakPoint ( const wchar_t * FileName, const int LineNumber )
|
||||
{
|
||||
if (g_Settings->LoadBool(Debugger_Enabled))
|
||||
{
|
||||
DisplayError(stdstr_f("Break point found at\n%ws\n%d", FileName, LineNumber).ToUTF16().c_str());
|
||||
if (IsDebuggerPresent() != 0)
|
||||
{
|
||||
DebugBreak();
|
||||
}
|
||||
else
|
||||
stdstr RecentDir = g_Settings->LoadStringIndex(Directory_RecentGameDirIndex, i);
|
||||
if (RecentDir.empty())
|
||||
{
|
||||
g_BaseSystem->CloseCpu();
|
||||
}
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
RecentDirs.push_back(RecentDir);
|
||||
}
|
||||
|
||||
//See if the dir is already in the list if so then move it to the top of the list
|
||||
strlist::iterator iter;
|
||||
for (iter = RecentDirs.begin(); iter != RecentDirs.end(); iter++)
|
||||
{
|
||||
DisplayError(L"Fatal Error: Stopping emulation");
|
||||
g_BaseSystem->CloseCpu();
|
||||
}
|
||||
if (_stricmp(RomDir, iter->c_str()) != 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
RecentDirs.erase(iter);
|
||||
break;
|
||||
}
|
||||
RecentDirs.push_front(RomDir);
|
||||
if (RecentDirs.size() > MaxRememberedDirs)
|
||||
{
|
||||
RecentDirs.pop_back();
|
||||
}
|
||||
|
||||
for (i = 0, iter = RecentDirs.begin(); iter != RecentDirs.end(); iter++, i++)
|
||||
{
|
||||
g_Settings->SaveStringIndex(Directory_RecentGameDirIndex, i, *iter);
|
||||
}
|
||||
}
|
||||
|
||||
void CNotification::AddRecentRom(const char * ImagePath)
|
||||
{
|
||||
if (HIWORD(ImagePath) == NULL) { return; }
|
||||
|
||||
//Get Information about the stored rom list
|
||||
size_t MaxRememberedFiles = g_Settings->LoadDword(File_RecentGameFileCount);
|
||||
strlist RecentGames;
|
||||
size_t i;
|
||||
for (i = 0; i < MaxRememberedFiles; i++)
|
||||
{
|
||||
stdstr RecentGame = g_Settings->LoadStringIndex(File_RecentGameFileIndex, i);
|
||||
if (RecentGame.empty())
|
||||
{
|
||||
break;
|
||||
}
|
||||
RecentGames.push_back(RecentGame);
|
||||
}
|
||||
|
||||
//See if the dir is already in the list if so then move it to the top of the list
|
||||
strlist::iterator iter;
|
||||
for (iter = RecentGames.begin(); iter != RecentGames.end(); iter++)
|
||||
{
|
||||
if (_stricmp(ImagePath, iter->c_str()) != 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
RecentGames.erase(iter);
|
||||
break;
|
||||
}
|
||||
RecentGames.push_front(ImagePath);
|
||||
if (RecentGames.size() > MaxRememberedFiles)
|
||||
{
|
||||
RecentGames.pop_back();
|
||||
}
|
||||
|
||||
for (i = 0, iter = RecentGames.begin(); iter != RecentGames.end(); iter++, i++)
|
||||
{
|
||||
g_Settings->SaveStringIndex(File_RecentGameFileIndex, i, *iter);
|
||||
}
|
||||
}
|
||||
|
||||
void CNotification::RefreshMenu(void)
|
||||
{
|
||||
if (m_hWnd == NULL) { return; }
|
||||
|
||||
#if defined(WINDOWS_UI)
|
||||
m_hWnd->RefreshMenu();
|
||||
#else
|
||||
g_Notify->BreakPoint(__FILEW__, __LINE__);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CNotification::HideRomBrowser(void)
|
||||
{
|
||||
if (m_hWnd == NULL) { return; }
|
||||
m_hWnd->HideRomList();
|
||||
}
|
||||
|
||||
void CNotification::ShowRomBrowser(void)
|
||||
{
|
||||
if (m_hWnd == NULL) { return; }
|
||||
if (g_Settings->LoadDword(RomBrowser_Enabled))
|
||||
{
|
||||
//Display the rom browser
|
||||
m_hWnd->ShowRomList();
|
||||
m_hWnd->HighLightLastRom();
|
||||
}
|
||||
}
|
||||
|
||||
void CNotification::BringToTop(void)
|
||||
{
|
||||
if (m_hWnd == NULL) { return; }
|
||||
|
||||
#if defined(WINDOWS_UI)
|
||||
m_hWnd->BringToTop();
|
||||
#else
|
||||
g_Notify->BreakPoint(__FILEW__, __LINE__);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CNotification::MakeWindowOnTop(bool OnTop)
|
||||
{
|
||||
if (m_hWnd == NULL) { return; }
|
||||
|
||||
#if defined(WINDOWS_UI)
|
||||
m_hWnd->MakeWindowOnTop(OnTop);
|
||||
#else
|
||||
g_Notify->BreakPoint(__FILEW__, __LINE__);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CNotification::ChangeFullScreen(void) const
|
||||
{
|
||||
if (m_hWnd == NULL) { return; }
|
||||
SendMessage((HWND)(m_hWnd->GetWindowHandle()), WM_COMMAND, MAKELPARAM(ID_OPTIONS_FULLSCREEN2, false), 0);
|
||||
}
|
||||
|
||||
bool CNotification::ProcessGuiMessages(void) const
|
||||
{
|
||||
if (m_hWnd == NULL) { return false; }
|
||||
|
||||
return m_hWnd->ProcessGuiMessages();
|
||||
}
|
||||
|
||||
void CNotification::BreakPoint(const wchar_t * FileName, const int LineNumber)
|
||||
{
|
||||
if (g_Settings->LoadBool(Debugger_Enabled))
|
||||
{
|
||||
DisplayError(stdstr_f("Break point found at\n%ws\n%d", FileName, LineNumber).ToUTF16().c_str());
|
||||
if (IsDebuggerPresent() != 0)
|
||||
{
|
||||
DebugBreak();
|
||||
}
|
||||
else
|
||||
{
|
||||
g_BaseSystem->CloseCpu();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DisplayError(L"Fatal Error: Stopping emulation");
|
||||
g_BaseSystem->CloseCpu();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue