fix some assorted slot-1 stuff

This commit is contained in:
zeromus 2013-08-28 08:01:47 +00:00
parent d9f04eae64
commit 0ec8ea7282
5 changed files with 30 additions and 8 deletions

View File

@ -1355,6 +1355,9 @@ void FASTCALL MMU_writeToGCControl(u32 val)
} }
else else
{ {
T1WriteLong(MMU.MMU_MEM[0][0x40], 0x1A4, val & 0x7F7FFFFF);
GCLOG("SCUTTLE????\n");
return;
//GCLOG("GC operation terminated or declined. please report, unless you just booted from firmware.\n"); //GCLOG("GC operation terminated or declined. please report, unless you just booted from firmware.\n");
} }

View File

@ -77,6 +77,7 @@ public:
switch(operation) switch(operation)
{ {
case eSlot1Operation_00_ReadHeader_Unencrypted: case eSlot1Operation_00_ReadHeader_Unencrypted:
case eSlot1Operation_2x_SecureAreaLoad:
case eSlot1Operation_B7_Read: case eSlot1Operation_B7_Read:
rom.start(operation,protocol.address); rom.start(operation,protocol.address);
return; return;
@ -113,6 +114,7 @@ public:
switch(operation) switch(operation)
{ {
case eSlot1Operation_00_ReadHeader_Unencrypted: case eSlot1Operation_00_ReadHeader_Unencrypted:
case eSlot1Operation_2x_SecureAreaLoad:
case eSlot1Operation_B7_Read: case eSlot1Operation_B7_Read:
return rom.read(); return rom.read();
} }
@ -142,6 +144,7 @@ public:
{ {
case eSlot1Operation_00_ReadHeader_Unencrypted: case eSlot1Operation_00_ReadHeader_Unencrypted:
case eSlot1Operation_B7_Read: case eSlot1Operation_B7_Read:
case eSlot1Operation_2x_SecureAreaLoad:
return; return;
} }

View File

@ -90,7 +90,7 @@ void Slot1Comp_Protocol::write_command_KEY1(GC_Command command)
GCLOG("[GC] (key1-decrypted):"); command.print(); GCLOG("[GC] (key1-decrypted):"); command.print();
//and process it: //and process it:
int cmd = command.bytes[0]&0xF0; int cmd = command.bytes[0];
switch(cmd&0xF0) switch(cmd&0xF0)
{ {
case 0x10: case 0x10:
@ -99,7 +99,17 @@ void Slot1Comp_Protocol::write_command_KEY1(GC_Command command)
//we handle this operation ourselves //we handle this operation ourselves
break; break;
case 0x20: case 0x20:
operation = eSlot1Operation_2x_SecureAreaLoad;
delay = 0x910, length = 0x11A8; delay = 0x910, length = 0x11A8;
//TODO - more endian-safe way of doing this (theres examples in R4)
{
u64 cmd64 = bswap64(*(u64*)command.bytes);
//todo - parse into blocknumber
address = (u32)((cmd64 >> 32) & 0xF000);
}
client->slot1client_startOperation(operation);
break; break;
case 0x30: case 0x30:
break; break;
@ -130,7 +140,7 @@ void Slot1Comp_Protocol::write_command_NORMAL(GC_Command command)
{ {
operation = eSlot1Operation_B7_Read; operation = eSlot1Operation_B7_Read;
//TODO - more endian-safe way of doing this //TODO - more endian-safe way of doing this (theres examples in R4)
u64 cmd64 = bswap64(*(u64*)command.bytes); u64 cmd64 = bswap64(*(u64*)command.bytes);
address = (u32)((cmd64 >> 24)); address = (u32)((cmd64 >> 24));
length = 0x200; length = 0x200;
@ -191,11 +201,7 @@ u32 Slot1Comp_Protocol::read_GCDATAIN(u8 PROCNUM)
{ {
switch(operation) switch(operation)
{ {
case eSlot1Operation_00_ReadHeader_Unencrypted: default:
case eSlot1Operation_B7_Read:
return client->slot1client_read_GCDATAIN(operation);
case eSlot1Operation_Unknown:
return client->slot1client_read_GCDATAIN(operation); return client->slot1client_read_GCDATAIN(operation);
case eSlot1Operation_90_ChipID: case eSlot1Operation_90_ChipID:

View File

@ -38,8 +38,9 @@ enum eSlot1Operation
//---------- //----------
//---------- //----------
//KEY2 mode operations //KEY1 mode operations
eSlot1Operation_1x_ChipID, eSlot1Operation_1x_ChipID,
eSlot1Operation_2x_SecureAreaLoad,
//---------- //----------
//---------- //----------

View File

@ -38,6 +38,15 @@ u32 Slot1Comp_Rom::read()
} }
break; break;
case eSlot1Operation_2x_SecureAreaLoad:
{
//see B7 for details
address &= gameInfo.mask; //sanity check
u32 ret = T1ReadLong(MMU.CART_ROM, address);
address = (address&~0xFFF) + ((address+4)&0xFFF);
return ret;
}
case eSlot1Operation_B7_Read: case eSlot1Operation_B7_Read:
{ {
//is this legitimate? need some way to verify. //is this legitimate? need some way to verify.