Merge pull request #609 from cxd4/all_RSP_warnings

[RSP] Debug 64-bit -- Conversion:  possible loss of data.
This commit is contained in:
zilmar 2015-09-24 09:47:50 +10:00
commit 9fe5bd8f48
2 changed files with 30 additions and 11 deletions

View File

@ -133,13 +133,17 @@ void Cheat_r4300iOpcodeNoMessage(p_func FunctAddress, char * FunctName) {
void x86_SetBranch8b(void * JumpByte, void * Destination) { void x86_SetBranch8b(void * JumpByte, void * Destination) {
/* calculate 32-bit relative offset */ /* calculate 32-bit relative offset */
signed int n = (BYTE*)Destination - ((BYTE*)JumpByte + 1); size_t n = (BYTE*)Destination - ((BYTE*)JumpByte + 1);
SSIZE_T signed_n = (SSIZE_T)n;
/* check limits, no pun intended */ /* check limits, no pun intended */
if (n > 0x80 || n < -0x7F) { if (signed_n > +128 || signed_n < -127) {
CompilerWarning("FATAL: Jump out of 8b range %i (PC = %04X)", n, CompilePC); CompilerWarning(
} else "FATAL: Jump out of 8b range %i (PC = %04X)", n, CompilePC
*(BYTE*)(JumpByte) = (BYTE)n; );
} else {
*(uint8_t *)(JumpByte) = (uint8_t)(n & 0xFF);
}
} }
void x86_SetBranch32b(void * JumpByte, void * Destination) { void x86_SetBranch32b(void * JumpByte, void * Destination) {

View File

@ -138,12 +138,18 @@ void ShowBPPanel ( void )
void RefreshBpoints ( HWND hList ) void RefreshBpoints ( HWND hList )
{ {
char Message[100]; char Message[100];
int count, location; LRESULT location;
int count;
for (count = 0; count < NoOfBpoints; count ++ ) { for (count = 0; count < NoOfBpoints; count ++ ) {
sprintf(Message," at 0x%03X (RSP)", BPoint[count].Location); sprintf(Message," at 0x%03X (RSP)", BPoint[count].Location);
location = SendMessage(hList, LB_ADDSTRING, 0, (LPARAM)Message); location = SendMessage(hList, LB_ADDSTRING, 0, (LPARAM)Message);
SendMessage(hList,LB_SETITEMDATA,(WPARAM)location,(LPARAM)BPoint[count].Location); SendMessage(
hList,
LB_SETITEMDATA,
(WPARAM)location,
(LPARAM)BPoint[count].Location
);
} }
} }
@ -154,9 +160,18 @@ void RemoveAllBpoint ( void )
void RemoveBpoint ( HWND hList, int index ) void RemoveBpoint ( HWND hList, int index )
{ {
DWORD location; LRESULT response;
uint32_t location;
location = SendMessage(hList,LB_GETITEMDATA,(WPARAM)index,0); response = SendMessage(hList, LB_GETITEMDATA, (WPARAM)index, 0);
if (response < 0 || response > 0x7FFFFFFFL)
{
DisplayError(
"LB_GETITEMDATA response for %i out of DWORD range.",
index
);
}
location = (uint32_t)response;
RemoveRSPBreakPoint(location); RemoveRSPBreakPoint(location);
} }