fix cheat file parsing, fix superscope pause button

This commit is contained in:
dborth 2009-04-16 07:18:38 +00:00
parent e033f976b2
commit bcdc1dc56f
2 changed files with 14 additions and 14 deletions

View File

@ -33,8 +33,9 @@ static bool NGCLoadCheatFile (int length)
while (offset < length) while (offset < length)
{ {
if(Cheat.num_cheats < MAX_CHEATS) if(Cheat.num_cheats >= MAX_CHEATS || (length - offset) < 28)
{ break;
memcpy (data, savebuffer+offset, 28); memcpy (data, savebuffer+offset, 28);
offset += 28; offset += 28;
@ -43,11 +44,10 @@ static bool NGCLoadCheatFile (int length)
Cheat.c [Cheat.num_cheats].address = data [2] | (data [3] << 8) | (data [4] << 16); Cheat.c [Cheat.num_cheats].address = data [2] | (data [3] << 8) | (data [4] << 16);
Cheat.c [Cheat.num_cheats].saved_byte = data [5]; Cheat.c [Cheat.num_cheats].saved_byte = data [5];
Cheat.c [Cheat.num_cheats].saved = (data [0] & 8) != 0; Cheat.c [Cheat.num_cheats].saved = (data [0] & 8) != 0;
memmove (Cheat.c [Cheat.num_cheats].name, &data [8], 20); memcpy (Cheat.c [Cheat.num_cheats].name, &data[8], 20);
Cheat.c [Cheat.num_cheats++].name [20] = 0; Cheat.c [Cheat.num_cheats].name[20] = 0;
Cheat.num_cheats++;
} }
}
return true; return true;
} }

View File

@ -466,7 +466,7 @@ void decodepad (int pad)
{ {
// buttons // buttons
offset = 0x50; offset = 0x50;
for (i = 0; i < 5; i++) for (i = 0; i < 6; i++)
{ {
if (jp & btnmap[CTRL_SCOPE][CTRLR_GCPAD][i] if (jp & btnmap[CTRL_SCOPE][CTRLR_GCPAD][i]
#ifdef HW_RVL #ifdef HW_RVL