From 50d2ffb207783f4afc56b6643deea580de74dca0 Mon Sep 17 00:00:00 2001 From: StapleButter Date: Tue, 9 May 2017 03:54:37 +0200 Subject: misc. things --- src/ARM.cpp | 3 +++ src/GPU3D.cpp | 1 + src/NDS.cpp | 8 ++++++++ src/SPU.cpp | 6 ++++++ src/Wifi.cpp | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 66 insertions(+) diff --git a/src/ARM.cpp b/src/ARM.cpp index bbfb7f7..a7809f5 100644 --- a/src/ARM.cpp +++ b/src/ARM.cpp @@ -174,6 +174,9 @@ void ARM::JumpTo(u32 addr, bool restorecpsr) // aging cart debug crap //if (addr == 0x0201764C) printf("capture test %d: R1=%08X\n", R[6], R[1]); //if (addr == 0x020175D8) printf("capture test %d: res=%08X\n", R[6], R[0]); + /*if (addr==0x037FBD49) printf("zog! %08X\n", R[15]); + if (addr==0x037FBD4C) printf("zog2 %08X\n", R[15]); + if (R[15]==0x037FBD54) printf("zog jump to %08X %08X\n", addr, CodeRead32(addr));*/ if (addr & 0x1) { diff --git a/src/GPU3D.cpp b/src/GPU3D.cpp index de2916c..0f700d9 100644 --- a/src/GPU3D.cpp +++ b/src/GPU3D.cpp @@ -1001,6 +1001,7 @@ s32 CalculateLighting() // according to some hardware tests // * diffuse level is saturated to 255 // * shininess level mirrors back to 0 and is ANDed with 0xFF, that before being squared + // TODO: check how it behaves when the computed shininess is >=0x200 s32 difflevel = (-(LightDirection[i][0]*normaltrans[0] + LightDirection[i][1]*normaltrans[1] + diff --git a/src/NDS.cpp b/src/NDS.cpp index 6f878ee..5eb8657 100644 --- a/src/NDS.cpp +++ b/src/NDS.cpp @@ -837,6 +837,14 @@ void debug(u32 param) fwrite(&val, 4, 1, shit); } fclose(shit);*/ + /*FILE* + shit = fopen("debug/pictochat7.bin", "wb"); + for (u32 i = 0x037F0000; i < 0x03810000; i+=4) + { + u32 val = ARM7Read32(i); + fwrite(&val, 4, 1, shit); + } + fclose(shit);*/ } diff --git a/src/SPU.cpp b/src/SPU.cpp index 002cde6..5c4a347 100644 --- a/src/SPU.cpp +++ b/src/SPU.cpp @@ -22,6 +22,12 @@ #include "SPU.h" +// SPU TODO +// * loop mode 3, what does it do? +// * the FIFO, whatever it is. GBAtek mentions it but gives no details. +// * consider mixing every sample instead of every 16? + + namespace SPU { diff --git a/src/Wifi.cpp b/src/Wifi.cpp index 37039c5..d454dd0 100644 --- a/src/Wifi.cpp +++ b/src/Wifi.cpp @@ -48,6 +48,32 @@ u16 RFData2; u32 RFRegs[0x40]; +// multiplayer host TX sequence: +// 1. preamble +// 2. IRQ7 +// 3. send data +// 4. wait for client replies (duration: 112 + ((10 * CMD_REPLYTIME) * numclients)) +// 5. IRQ7 +// 6. send ack (16 bytes) +// 7. IRQ12 (and optional IRQ1) +// +// RFSTATUS values: +// 0 = initial +// 1 = RX???? +// 2 = switching from RX to TX +// 3 = TX +// 4 = switching from TX to RX +// 5 = MP host data sent, waiting for replies (RFPINS=0x0084) +// 6 = RX +// 7 = ?? +// 8 = MP host sending ack (RFPINS=0x0046) +// 9 = idle + + +// wifi TODO: +// * work out how power saving works, there are oddities + + void Reset() { memset(RAM, 0, 0x2000); @@ -131,6 +157,13 @@ void SetIRQ14(bool forced) IOPORT(W_TXReqRead) &= 0xFFF2; // todo, eventually? // TODO: actually send beacon + if (IOPORT(W_TXSlotBeacon) & 0x8000) + { + printf("SEND BEACON\n"); + /*FILE* f = fopen("beacon.bin", "wb"); + fwrite(RAM, 0x2000, 1, f); + fclose(f);*/ + } if (IOPORT(W_ListenCount) == 0) IOPORT(W_ListenCount) = IOPORT(W_ListenInterval); @@ -460,6 +493,21 @@ void Write(u32 addr, u16 val) break; + case W_RXCnt: + if (val & 0x0001) + { + IOPORT(W_RXBufWriteCursor) = IOPORT(W_RXBufWriteAddr); + } + if (val & 0x0080) + { + IOPORT(W_TXSlotReply2) = IOPORT(W_TXSlotReply1); + IOPORT(W_TXSlotReply1) = 0; + } + val &= 0xFF0E; + if (val & 0x7FFF) printf("wifi: unknown RXCNT bits set %04X\n", val); + break; + + case W_TXBufDataWrite: { u32 wraddr = IOPORT(W_TXBufWriteAddr) & 0x1FFE; -- cgit v1.2.3