[RSP] dma.c: Replace windows.h by using DisplayError().

This commit is contained in:
2016-02-13 14:58:42 -05:00
parent c8dc0478f0
commit 74b72ba294
3 changed files with 15 additions and 9 deletions

View File

@ -138,15 +138,19 @@ DWORD AsciiToHex (char * HexValue)
return Value; return Value;
} }
void DisplayError (char * Message, ...) void DisplayError(char* Message, ...)
{ {
char Msg[400]; char Msg[400];
va_list ap; va_list ap;
va_start( ap, Message ); va_start( ap, Message );
vsprintf( Msg, Message, ap ); vsprintf( Msg, Message, ap );
va_end( ap ); va_end( ap );
MessageBox(NULL,Msg,"Error",MB_OK|MB_ICONERROR); #ifdef _WIN32
MessageBox(NULL, Msg, "Error", MB_OK | MB_ICONERROR);
#else
fputs(&Msg[0], stderr);
#endif
} }
/****************************************************************** /******************************************************************

View File

@ -146,7 +146,7 @@ EXPORT void EnableDebugging(int Enabled);
EXPORT void PluginLoaded(void); EXPORT void PluginLoaded(void);
uint32_t AsciiToHex(char * HexValue); uint32_t AsciiToHex(char * HexValue);
void DisplayError (char * Message, ...); void DisplayError(char * Message, ...);
int GetStoredWinPos(char * WinName, uint32_t * X, uint32_t * Y); int GetStoredWinPos(char * WinName, uint32_t * X, uint32_t * Y);
#define InterpreterCPU 0 #define InterpreterCPU 0

View File

@ -24,7 +24,9 @@
* *
*/ */
#ifdef _WIN32
#include <Windows.h> #include <Windows.h>
#endif
#include <stdio.h> #include <stdio.h>
#include <Common/stdtypes.h> #include <Common/stdtypes.h>
@ -43,13 +45,13 @@ void SP_DMA_READ (void)
if (addr > 0x7FFFFF) if (addr > 0x7FFFFF)
{ {
MessageBox(NULL,"SP DMA READ\nSP_DRAM_ADDR_REG not in RDRam space","Error",MB_OK); DisplayError("SP DMA READ\nSP_DRAM_ADDR_REG not in RDRam space");
return; return;
} }
if ((*RSPInfo.SP_RD_LEN_REG & 0xFFF) + 1 + (*RSPInfo.SP_MEM_ADDR_REG & 0xFFF) > 0x1000) if ((*RSPInfo.SP_RD_LEN_REG & 0xFFF) + 1 + (*RSPInfo.SP_MEM_ADDR_REG & 0xFFF) > 0x1000)
{ {
MessageBox(NULL,"SP DMA READ\ncould not fit copy in memory segment","Error",MB_OK); DisplayError("SP DMA READ\ncould not fit copy in memory segment");
return; return;
} }
@ -119,13 +121,13 @@ void SP_DMA_WRITE (void)
if (addr > 0x7FFFFF) if (addr > 0x7FFFFF)
{ {
MessageBox(NULL,"SP DMA WRITE\nSP_DRAM_ADDR_REG not in RDRam space","Error",MB_OK); DisplayError("SP DMA WRITE\nSP_DRAM_ADDR_REG not in RDRam space");
return; return;
} }
if ((*RSPInfo.SP_WR_LEN_REG & 0xFFF) + 1 + (*RSPInfo.SP_MEM_ADDR_REG & 0xFFF) > 0x1000) if ((*RSPInfo.SP_WR_LEN_REG & 0xFFF) + 1 + (*RSPInfo.SP_MEM_ADDR_REG & 0xFFF) > 0x1000)
{ {
MessageBox(NULL,"SP DMA WRITE\ncould not fit copy in memory segment","Error",MB_OK); DisplayError("SP DMA WRITE\ncould not fit copy in memory segment");
return; return;
} }