Merge pull request #999 from cxd4/rsp-dma-compiles

[RSP] Get Dma.c to compile without errors/warnings outside Windows.
This commit is contained in:
zilmar 2016-02-14 16:32:27 +11:00
commit 5b8ae661fb
3 changed files with 20 additions and 14 deletions

View File

@ -141,15 +141,19 @@ uint32_t 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
}
/******************************************************************

View File

@ -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

View File

@ -24,8 +24,10 @@
*
*/
#include <Windows.h>
#include <stdio.h>
#include <string.h>
#include <Common/stdtypes.h>
#include "Rsp.h"
#include "RSP Registers.h"
#include "memory.h"
@ -34,20 +36,20 @@
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;
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;
}
@ -110,20 +112,20 @@ 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;
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;
}