Merge pull request #1004 from cxd4/rsp-EXPORT

[RSP] Get Main.cpp compiling (almost) outside Windows.
This commit is contained in:
zilmar 2016-06-06 05:15:45 +10:00
commit 4d1f65c18d
2 changed files with 43 additions and 23 deletions

View File

@ -30,8 +30,11 @@
#include <commctrl.h> #include <commctrl.h>
#endif #endif
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <Common/StdString.h> #include <Common/StdString.h>
#include <Common/stdtypes.h>
#include "../Settings/Settings.h" #include "../Settings/Settings.h"
extern "C" { extern "C" {
@ -50,7 +53,10 @@ extern "C" {
void ClearAllx86Code(void); void ClearAllx86Code(void);
void ProcessMenuItem(int ID); void ProcessMenuItem(int ID);
#ifdef _WIN32
Boolean CALLBACK CompilerDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); Boolean CALLBACK CompilerDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
HMENU hRSPMenu = NULL;
#endif
Boolean GraphicsHle = TRUE, AudioHle, ConditionalMove; Boolean GraphicsHle = TRUE, AudioHle, ConditionalMove;
Boolean DebuggingEnabled = FALSE, Boolean DebuggingEnabled = FALSE,
@ -62,14 +68,13 @@ Boolean DebuggingEnabled = FALSE,
LogX86Code = FALSE; LogX86Code = FALSE;
uint32_t CPUCore = RecompilerCPU; uint32_t CPUCore = RecompilerCPU;
HANDLE hMutex = NULL; void * hMutex = NULL;
DEBUG_INFO DebugInfo; DEBUG_INFO DebugInfo;
RSP_INFO RSPInfo; RSP_INFO RSPInfo;
void * hinstDLL; void * hinstDLL;
HMENU hRSPMenu = NULL;
extern BYTE * pLastSecondary; extern uint8_t * pLastSecondary;
} }
enum { enum {
@ -164,7 +169,7 @@ void DisplayError(char* Message, ...)
input: none input: none
output: none output: none
*******************************************************************/ *******************************************************************/
__declspec(dllexport) void CloseDLL (void) EXPORT void CloseDLL(void)
{ {
FreeMemory(); FreeMemory();
} }
@ -176,9 +181,13 @@ __declspec(dllexport) void CloseDLL (void)
input: a handle to the window that calls this function input: a handle to the window that calls this function
output: none output: none
*******************************************************************/ *******************************************************************/
__declspec(dllexport) void DllAbout ( HWND hParent ) EXPORT void DllAbout(void * hParent)
{ {
MessageBox(hParent,AboutMsg(),"About",MB_OK | MB_ICONINFORMATION ); #ifdef _WIN32
MessageBox((HWND)hParent, AboutMsg(), "About", MB_OK | MB_ICONINFORMATION);
#else
puts(AboutMsg());
#endif
} }
#ifdef _WIN32 #ifdef _WIN32
@ -217,7 +226,7 @@ void FixMenuState(void)
filled by the function. (see def above) filled by the function. (see def above)
output: none output: none
*******************************************************************/ *******************************************************************/
__declspec(dllexport) void GetDllInfo ( PLUGIN_INFO * PluginInfo ) EXPORT void GetDllInfo(PLUGIN_INFO * PluginInfo)
{ {
PluginInfo->Version = 0x0102; PluginInfo->Version = 0x0102;
PluginInfo->Type = PLUGIN_TYPE_RSP; PluginInfo->Type = PLUGIN_TYPE_RSP;
@ -240,14 +249,16 @@ __declspec(dllexport) void GetDllInfo ( PLUGIN_INFO * PluginInfo )
output: none output: none
*******************************************************************/ *******************************************************************/
__declspec(dllexport) void GetRspDebugInfo ( RSPDEBUG_INFO * DebugInfo ) EXPORT void GetRspDebugInfo(RSPDEBUG_INFO * DebugInfo)
{ {
#ifdef _WIN32
if (hRSPMenu == NULL) if (hRSPMenu == NULL)
{ {
hRSPMenu = LoadMenu((HINSTANCE)hinstDLL,MAKEINTRESOURCE(RspMenu)); hRSPMenu = LoadMenu((HINSTANCE)hinstDLL,MAKEINTRESOURCE(RspMenu));
FixMenuState(); FixMenuState();
} }
DebugInfo->hRSPMenu = hRSPMenu; DebugInfo->hRSPMenu = hRSPMenu;
#endif
DebugInfo->ProcessMenuItem = ProcessMenuItem; DebugInfo->ProcessMenuItem = ProcessMenuItem;
DebugInfo->UseBPoints = TRUE; DebugInfo->UseBPoints = TRUE;
@ -339,7 +350,7 @@ void DetectCpuSpecs(void)
} }
} }
__declspec(dllexport) void InitiateRSP ( RSP_INFO Rsp_Info, uint32_t * CycleCount) EXPORT void InitiateRSP(RSP_INFO Rsp_Info, uint32_t * CycleCount)
{ {
RSPInfo = Rsp_Info; RSPInfo = Rsp_Info;
AudioHle = GetSystemSetting(Set_AudioHle); AudioHle = GetSystemSetting(Set_AudioHle);
@ -364,11 +375,12 @@ __declspec(dllexport) void InitiateRSP ( RSP_INFO Rsp_Info, uint32_t * CycleCoun
above. above.
output: none output: none
*******************************************************************/ *******************************************************************/
__declspec(dllexport) void InitiateRSPDebugger ( DEBUG_INFO Debug_Info) EXPORT void InitiateRSPDebugger(DEBUG_INFO Debug_Info)
{ {
DebugInfo = Debug_Info; DebugInfo = Debug_Info;
} }
#ifdef _WIN32
void ProcessMenuItem(int ID) void ProcessMenuItem(int ID)
{ {
UINT uState; UINT uState;
@ -529,6 +541,7 @@ void ProcessMenuItem(int ID)
break; break;
} }
} }
#endif
/****************************************************************** /******************************************************************
Function: RomOpen Function: RomOpen
@ -536,7 +549,7 @@ void ProcessMenuItem(int ID)
input: none input: none
output: none output: none
*******************************************************************/ *******************************************************************/
__declspec(dllexport) void RomOpen (void) EXPORT void RomOpen(void)
{ {
ClearAllx86Code(); ClearAllx86Code();
if (DebuggingEnabled) if (DebuggingEnabled)
@ -554,7 +567,8 @@ __declspec(dllexport) void RomOpen (void)
input: none input: none
output: none output: none
*******************************************************************/ *******************************************************************/
__declspec(dllexport) void RomClosed (void) { EXPORT void RomClosed(void)
{
if (Profiling) if (Profiling)
{ {
StopTimer(); StopTimer();
@ -700,13 +714,13 @@ BOOL CALLBACK ConfigDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM /*lParam
} }
#endif #endif
/*__declspec(dllexport) void DllConfig (HWND hWnd) /*EXPORT void DllConfig(HWND hWnd)
{ {
// DialogBox(hinstDLL, "RSPCONFIG", hWnd, ConfigDlgProc); // DialogBox(hinstDLL, "RSPCONFIG", hWnd, ConfigDlgProc);
DialogBox(hinstDLL, "RSPCONFIG", GetForegroundWindow(), ConfigDlgProc); DialogBox(hinstDLL, "RSPCONFIG", GetForegroundWindow(), ConfigDlgProc);
}*/ }*/
__declspec(dllexport) void EnableDebugging(Boolean Enabled) EXPORT void EnableDebugging(Boolean Enabled)
{ {
DebuggingEnabled = Enabled; DebuggingEnabled = Enabled;
if (DebuggingEnabled) if (DebuggingEnabled)
@ -731,7 +745,11 @@ __declspec(dllexport) void EnableDebugging(Boolean Enabled)
Compiler.bAlignVector = GetSetting(Set_AlignVector); Compiler.bAlignVector = GetSetting(Set_AlignVector);
SetCPU(CPUCore); SetCPU(CPUCore);
} }
#ifdef _WIN32
FixMenuState(); FixMenuState();
#else
fputs("FixMenuState()\n", stderr);
#endif
if (LogRDP) if (LogRDP)
{ {
StartRDPLog(); StartRDPLog();
@ -742,7 +760,7 @@ __declspec(dllexport) void EnableDebugging(Boolean Enabled)
} }
} }
__declspec(dllexport) void PluginLoaded (void) EXPORT void PluginLoaded(void)
{ {
BreakOnStart = false; BreakOnStart = false;
CPUCore = RecompilerCPU; CPUCore = RecompilerCPU;
@ -794,13 +812,15 @@ __declspec(dllexport) void PluginLoaded (void)
AudioHle = Set_AudioHle != 0 ? GetSystemSetting(Set_AudioHle) : false; AudioHle = Set_AudioHle != 0 ? GetSystemSetting(Set_AudioHle) : false;
GraphicsHle = Set_GraphicsHle != 0 ? GetSystemSetting(Set_GraphicsHle) : true; GraphicsHle = Set_GraphicsHle != 0 ? GetSystemSetting(Set_GraphicsHle) : true;
#ifdef _WIN32
hMutex = CreateMutex(NULL, FALSE, NULL); hMutex = (HANDLE)CreateMutex(NULL, FALSE, NULL);
#endif
SetCPU(CPUCore); SetCPU(CPUCore);
} }
void UseUnregisteredSetting (int /*SettingID*/) #ifdef _WIN32
void UseUnregisteredSetting(int /*SettingID*/)
{ {
DebugBreak(); DebugBreak();
} }
#endif

View File

@ -34,7 +34,7 @@ void Enter_RSP_Commands_Window ( void );
void RefreshRSPCommands ( void ); void RefreshRSPCommands ( void );
void SetRSPCommandToRunning ( void ); void SetRSPCommandToRunning ( void );
void SetRSPCommandToStepping ( void ); void SetRSPCommandToStepping ( void );
void SetRSPCommandViewto ( UINT NewLocation ); void SetRSPCommandViewto(unsigned int NewLocation);
extern DWORD Stepping_Commands, WaitingForStep; extern DWORD Stepping_Commands, WaitingForStep;
extern Boolean InRSPCommandsWindow; extern Boolean InRSPCommandsWindow;