fake enough of WEP processing to make Inazuma Eleven work

This commit is contained in:
Arisotura 2022-09-21 18:53:49 +02:00
parent 3368221aa7
commit c4acc26076
2 changed files with 39 additions and 8 deletions

View File

@ -1977,7 +1977,7 @@ void debug(u32 param)
// printf("VRAM %c: %02X\n", 'A'+i, GPU::VRAMCNT[i]);
FILE*
shit = fopen("debug/tetrisDS.bin", "wb");
shit = fopen("debug/inazuma.bin", "wb");
fwrite(ARM9->ITCM, 0x8000, 1, shit);
for (u32 i = 0x02000000; i < 0x02400000; i+=4)
{
@ -1989,6 +1989,11 @@ void debug(u32 param)
u32 val = ARM7Read32(i);
fwrite(&val, 4, 1, shit);
}
for (u32 i = 0x06000000; i < 0x06040000; i+=4)
{
u32 val = ARM7Read32(i);
fwrite(&val, 4, 1, shit);
}
fclose(shit);
/*FILE*
@ -2974,7 +2979,8 @@ u8 ARM9IORead8(u32 addr)
return (u8)(emuID[idx]);
}
printf("unknown ARM9 IO read8 %08X %08X\n", addr, ARM9->R[15]);
if ((addr & 0xFFFFF000) != 0x04004000)
printf("unknown ARM9 IO read8 %08X %08X\n", addr, ARM9->R[15]);
return 0;
}
@ -3120,7 +3126,8 @@ u16 ARM9IORead16(u32 addr)
return GPU3D::Read16(addr);
}
printf("unknown ARM9 IO read16 %08X %08X\n", addr, ARM9->R[15]);
if ((addr & 0xFFFFF000) != 0x04004000)
printf("unknown ARM9 IO read16 %08X %08X\n", addr, ARM9->R[15]);
return 0;
}
@ -3263,7 +3270,8 @@ u32 ARM9IORead32(u32 addr)
return GPU3D::Read32(addr);
}
printf("unknown ARM9 IO read32 %08X %08X\n", addr, ARM9->R[15]);
if ((addr & 0xFFFFF000) != 0x04004000)
printf("unknown ARM9 IO read32 %08X %08X\n", addr, ARM9->R[15]);
return 0;
}
@ -3799,7 +3807,8 @@ u8 ARM7IORead8(u32 addr)
return SPU::Read8(addr);
}
printf("unknown ARM7 IO read8 %08X %08X\n", addr, ARM7->R[15]);
if ((addr & 0xFFFFF000) != 0x04004000)
printf("unknown ARM7 IO read8 %08X %08X\n", addr, ARM7->R[15]);
return 0;
}
@ -3892,7 +3901,8 @@ u16 ARM7IORead16(u32 addr)
return SPU::Read16(addr);
}
printf("unknown ARM7 IO read16 %08X %08X\n", addr, ARM7->R[15]);
if ((addr & 0xFFFFF000) != 0x04004000)
printf("unknown ARM7 IO read16 %08X %08X\n", addr, ARM7->R[15]);
return 0;
}
@ -3992,7 +4002,8 @@ u32 ARM7IORead32(u32 addr)
return SPU::Read32(addr);
}
printf("unknown ARM7 IO read32 %08X %08X\n", addr, ARM7->R[15]);
if ((addr & 0xFFFFF000) != 0x04004000)
printf("unknown ARM7 IO read32 %08X %08X\n", addr, ARM7->R[15]);
return 0;
}

View File

@ -839,6 +839,21 @@ bool ProcessTX(TXSlot* slot, int num)
slot->CurPhase = 1;
slot->CurPhaseTime = len;
u16 framectl = *(u16*)&RAM[slot->Addr + 0xC];
if (framectl & (1<<14))
{
// WEP frame
// TODO: what happens when sending a WEP frame while WEP processing is off?
// TODO: some form of actual WEP processing?
// for now we just set the WEP FCS to a nonzero value, because some games require it
if (IOPORT(W_WEPCnt) & (1<<15))
{
u32 wep_fcs = (slot->Addr + 0xC + slot->Length - 7) & ~0x1;
*(u32*)&RAM[wep_fcs] = 0x22334466;
}
}
u64 oldts;
if (num == 4)
{
@ -891,7 +906,6 @@ bool ProcessTX(TXSlot* slot, int num)
// any packet sent via CMD/REPLY/BEACON isn't going to have much use outside of local MP
if (num == 0 || num == 2 || num == 3)
{
u16 framectl = *(u16*)&RAM[slot->Addr + 0xC];
if ((framectl & 0x00FF) == 0x0010)
{
u16 aid = *(u16*)&RAM[slot->Addr + 0xC + 24 + 4];
@ -1401,7 +1415,10 @@ void MPClientReplyRX(int client)
// TODO: what are the maximum crop values?
u16 framectl = *(u16*)&reply[12];
if (framectl & (1<<14))
{
framelen -= (IOPORT(W_RXLenCrop) >> 7) & 0x1FE;
if (framelen > 24) memmove(&RXBuffer[12+24], &RXBuffer[12+28], framelen);
}
else
framelen -= (IOPORT(W_RXLenCrop) << 1) & 0x1FE;
@ -1470,7 +1487,10 @@ bool CheckRX(int type) // 0=regular 1=MP replies 2=MP host frames
// TODO: what are the maximum crop values?
if (framectl & (1<<14))
{
framelen -= (IOPORT(W_RXLenCrop) >> 7) & 0x1FE;
if (framelen > 24) memmove(&RXBuffer[12+24], &RXBuffer[12+28], framelen);
}
else
framelen -= (IOPORT(W_RXLenCrop) << 1) & 0x1FE;