From c8dc0478f0fc2b397d47c9785ca2e23bb6a005f2 Mon Sep 17 00:00:00 2001 From: Date: Sat, 13 Feb 2016 14:33:16 -0500 Subject: [PATCH 1/4] [RSP] dma.c: Use standard integer types. --- Source/RSP/dma.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Source/RSP/dma.c b/Source/RSP/dma.c index 7bdd05e73..064e743f9 100644 --- a/Source/RSP/dma.c +++ b/Source/RSP/dma.c @@ -26,6 +26,8 @@ #include #include +#include + #include "Rsp.h" #include "RSP Registers.h" #include "memory.h" @@ -34,8 +36,8 @@ void SP_DMA_READ (void) { - DWORD i, j, Length, Skip, Count, End, addr; - BYTE *Dest, *Source; + uint32_t i, j, Length, Skip, Count, End, addr; + uint8_t *Dest, *Source; addr = (*RSPInfo.SP_DRAM_ADDR_REG) & 0x00FFFFFF; @@ -110,8 +112,8 @@ void SP_DMA_READ (void) void SP_DMA_WRITE (void) { - DWORD i, j, Length, Skip, Count, addr; - BYTE *Dest, *Source; + uint32_t i, j, Length, Skip, Count, addr; + uint8_t *Dest, *Source; addr = (*RSPInfo.SP_DRAM_ADDR_REG) & 0x00FFFFFF; From 74b72ba2941debc098d779b7879df787285f2d3b Mon Sep 17 00:00:00 2001 From: Date: Sat, 13 Feb 2016 14:58:42 -0500 Subject: [PATCH 2/4] [RSP] dma.c: Replace windows.h by using DisplayError(). --- Source/RSP/Main.cpp | 12 ++++++++---- Source/RSP/Rsp.h | 2 +- Source/RSP/dma.c | 10 ++++++---- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Source/RSP/Main.cpp b/Source/RSP/Main.cpp index dc4d4a468..3c476872d 100644 --- a/Source/RSP/Main.cpp +++ b/Source/RSP/Main.cpp @@ -138,15 +138,19 @@ DWORD AsciiToHex (char * HexValue) return Value; } -void DisplayError (char * Message, ...) +void DisplayError(char* Message, ...) { - char Msg[400]; - va_list ap; + char Msg[400]; + va_list ap; va_start( ap, Message ); vsprintf( Msg, Message, 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 } /****************************************************************** diff --git a/Source/RSP/Rsp.h b/Source/RSP/Rsp.h index 78cc73b00..31680500b 100644 --- a/Source/RSP/Rsp.h +++ b/Source/RSP/Rsp.h @@ -146,7 +146,7 @@ EXPORT void EnableDebugging(int Enabled); EXPORT void PluginLoaded(void); uint32_t AsciiToHex(char * HexValue); -void DisplayError (char * Message, ...); +void DisplayError(char * Message, ...); int GetStoredWinPos(char * WinName, uint32_t * X, uint32_t * Y); #define InterpreterCPU 0 diff --git a/Source/RSP/dma.c b/Source/RSP/dma.c index 064e743f9..ba9d53e42 100644 --- a/Source/RSP/dma.c +++ b/Source/RSP/dma.c @@ -24,7 +24,9 @@ * */ +#ifdef _WIN32 #include +#endif #include #include @@ -43,13 +45,13 @@ void SP_DMA_READ (void) 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; } 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; } @@ -119,13 +121,13 @@ void SP_DMA_WRITE (void) 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; } 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; } From dd6a6fcc94e18fb720f0c97d33ce66d7c8bf4fd0 Mon Sep 17 00:00:00 2001 From: Date: Sat, 13 Feb 2016 15:01:41 -0500 Subject: [PATCH 3/4] [RSP] dma.c: unresolved memcpy() --- Source/RSP/dma.c | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/RSP/dma.c b/Source/RSP/dma.c index ba9d53e42..dfdff27a8 100644 --- a/Source/RSP/dma.c +++ b/Source/RSP/dma.c @@ -28,6 +28,7 @@ #include #endif #include +#include #include #include "Rsp.h" From 1eb6dafd655af08f56d312be36d565e2de9fa4f1 Mon Sep 17 00:00:00 2001 From: Date: Sat, 13 Feb 2016 16:42:58 -0500 Subject: [PATCH 4/4] [RSP] Without MessageBox(), windows.h has no use here. --- Source/RSP/dma.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/Source/RSP/dma.c b/Source/RSP/dma.c index dfdff27a8..ce5647796 100644 --- a/Source/RSP/dma.c +++ b/Source/RSP/dma.c @@ -24,9 +24,6 @@ * */ -#ifdef _WIN32 -#include -#endif #include #include #include