improve previous commit, which was just plain buggy. now card is detected again. but... the game crashes when trying to boot.

This commit is contained in:
zeromus 2014-09-16 04:30:55 +00:00
parent dd13e33401
commit 66e6ba9497
3 changed files with 14 additions and 5 deletions

View File

@ -93,10 +93,10 @@ public:
{
case eSlot1Operation_00_ReadHeader_Unencrypted:
protocol.address = (protocol.command.bytes[1] << 24) | (protocol.command.bytes[2] << 16) | (protocol.command.bytes[3] << 8) | protocol.command.bytes[4];
rom.start(operation,protocol.address);
break;
//case eSlot1Operation_B7_Read:
//???
//case eSlot1Operation_B7_Read: //zero 15-sep-2014 - this was removed during epoch of addon re-engineering to fix a bug
case eSlot1Operation_2x_SecureAreaLoad:
//don't re-generate address here. it was already done, according to different rules, for this operation

View File

@ -89,6 +89,7 @@ void Slot1Comp_Protocol::write_command_KEY1(GC_Command command)
delay = 0x910, length = 4;
//we handle this operation ourselves
break;
case 0x20:
operation = eSlot1Operation_2x_SecureAreaLoad;
delay = 0x910, length = 0x11A8;
@ -101,20 +102,25 @@ void Slot1Comp_Protocol::write_command_KEY1(GC_Command command)
u64 cmd64 = *(u64*)command.bytes;
#endif
//todo - parse into blocknumber
address = (u32)((cmd64 >> 32) & 0xF000);
u32 blocknumber = (cmd64>>44)&0xFFFF;
if(blocknumber<4||blocknumber>7)
printf("SLOT1 WARNING: INVALID BLOCKNUMBER FOR \"Get Secure Area Block\": 0x%04X\n",blocknumber);
address = blocknumber*0x1000;
}
client->slot1client_startOperation(operation);
break;
case 0x40:
//switch to KEY2
delay = 0x910, length = 0;
//well.. not really... yet.
GCLOG("[GC] KEY2 ACTIVATED\n");
break;
case 0x60:
//KEY2 disable? any info?
break;
case 0xA0:
delay = 0x910, length = 0;
mode = eCardMode_NORMAL;

View File

@ -41,7 +41,10 @@ u32 Slot1Comp_Rom::read()
case eSlot1Operation_2x_SecureAreaLoad:
{
//see B7 for details
address &= gameInfo.mask; //sanity check
//zero 15-sep-2014 - this is meaningless. newer mask is actually reasonable
//address &= gameInfo.mask; //sanity check
address &= 0x3FFF; //memory safe sanity test
u32 ret = LE_TO_LOCAL_32(*(u32*)(gameInfo.secureArea + (address - 0x4000)));
address = (address&~0xFFF) + ((address+4)&0xFFF);
return ret;