n64 - fix crash when attempting to read the PC register on frame 0, solved on the c++ side with a null pointer check and a default value returned.

This commit is contained in:
adelikat 2015-01-25 03:54:07 +00:00
parent 69c66d12b1
commit 96e91e7093
2 changed files with 12 additions and 1 deletions

View File

@ -1111,8 +1111,19 @@ EXPORT void CALL GetRegisters(unsigned char * dest)
{
memcpy(dest, reg, 8 * 32);
dest += 8 * 32;
memcpy(dest, &(PC->addr), 4);
if (PC != NULL)
{
memcpy(dest, &(PC->addr), 4);
}
else
{
char stupid[] = "0000";
memcpy(dest, stupid, 4);
}
dest += 4;
memcpy(dest, &llbit, 4);
dest += 4;
memcpy(dest, &lo, 8);

Binary file not shown.