Core mempak, correct behaviour of mempaks, ReadFrom and WriteTo

This commit is contained in:
Emmet Young 2015-03-03 22:46:38 +11:00
parent 1b17b86ef2
commit 2f4e21577a
2 changed files with 4 additions and 14 deletions

View File

@ -119,14 +119,7 @@ BYTE Mempak::CalculateCrc(BYTE * DataToCrc) {
}
void Mempak::ReadFrom(int Control, int Address, BYTE * Buffer) {
if (Address == 0x8001) {
memset(Buffer, 0, 0x20);
Buffer[0x20] = CalculateCrc(Buffer);
return;
}
Address &= 0xFFE0;
if (Address <= 0x7FE0) {
if (Address < 0x8000) {
if (hMempakFile[Control] == NULL) {
LoadMempak(Control);
}
@ -142,10 +135,7 @@ void Mempak::ReadFrom(int Control, int Address, BYTE * Buffer) {
void Mempak::WriteTo(int Control, int Address, BYTE * Buffer) {
DWORD dwWritten;
if (Address == 0x8001) { Buffer[0x20] = CalculateCrc(Buffer); return; }
Address &= 0xFFE0;
if (Address <= 0x7FE0) {
if (Address < 0x8000) {
if (hMempakFile[Control] == NULL) {
LoadMempak(Control);
}

View File

@ -445,7 +445,7 @@ void CPifRam::ProcessControllerCommand ( int Control, BYTE * Command)
if (Command[1] != 33) { g_Notify->DisplayError("What am I meant to do with this Controller Command"); }
}
if (Controllers[Control].Present == TRUE) {
DWORD address = ((Command[3] << 8) | Command[4]);
DWORD address = ((Command[3] << 8) | Command[4] & 0xE0);
switch (Controllers[Control].Plugin) {
case PLUGIN_RUMBLE_PAK:
@ -471,7 +471,7 @@ void CPifRam::ProcessControllerCommand ( int Control, BYTE * Command)
if (Command[1] != 1) { g_Notify->DisplayError("What am I meant to do with this Controller Command"); }
}
if (Controllers[Control].Present == TRUE) {
DWORD address = ((Command[3] << 8) | Command[4]);
DWORD address = ((Command[3] << 8) | Command[4] & 0xE0 );
switch (Controllers[Control].Plugin) {
case PLUGIN_MEMPAK: Mempak::WriteTo(Control, address, &Command[5]); break;
case PLUGIN_RAW: if (g_Plugins->Control()->ControllerCommand) { g_Plugins->Control()->ControllerCommand(Control, Command); } break;