Skip to content

Commit

Permalink
Update main.c
Browse files Browse the repository at this point in the history
  • Loading branch information
RocketRobz committed Dec 8, 2024
1 parent f1c821c commit 349c3f6
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions 3dssplash/arm7/source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ int main() {
*(u16*)0x02FFFC36 = *(u16*)0x0800015E; // Header CRC16
*(u32*)0x02FFFC38 = *(u32*)0x0800000C; // Game Code

*(u32*)0x02FFFDF0 = REG_SCFG_EXT;

// clear sound registers
dmaFillWords(0, (void*)0x04000400, 0x100);

Expand Down Expand Up @@ -124,22 +126,26 @@ int main() {

// 01: Fade Out
// 02: Return
// 03: status (Bit 0: hasRegulableBacklight, Bit 1: scfgEnabled, Bit 2: REG_SNDEXTCNT, Bit 3: isDSPhat, Bit 4: i2cBricked)
// 03: status (Bit 0: hasRegulableBacklight, Bit 1: scfgSdmmcEnabled, Bit 2: REG_SNDEXTCNT, Bit 3: isDSPhat, Bit 4: i2cBricked)


// 03: Status: Init/Volume/Battery/SD
// https://problemkaputt.de/gbatek.htm#dsii2cdevice4ahbptwlchip
// Battery is 7 bits -- bits 0-7
// Volume is 00h to 1Fh = 5 bits -- bits 8-12
// SD status -- bits 13-14
// Init status -- bits 15-18 (Bit 0 (15): hasRegulableBacklight, Bit 1 (16): scfgEnabled, Bit 2 (17): REG_SNDEXTCNT, Bit 3 (18): isDSPhat, Bit 4 (19): i2cBricked)
// Init status -- bits 15-18 (Bit 0 (15): hasRegulableBacklight, Bit 1 (16): scfgSdmmcEnabled, Bit 2 (17): REG_SNDEXTCNT, Bit 3 (18): isDSPhat, Bit 4 (19): i2cBricked)

*(vu32*)0x4004820 = 0x8B7F0305;

u8 initStatus = (BIT_SET(!!(REG_SNDEXTCNT), SNDEXTCNT_BIT)
| BIT_SET(!!(REG_SCFG_EXT), REGSCFG_BIT)
| BIT_SET(*(vu32*)0x4004820, SCFGSDMMC_BIT)
| BIT_SET(!!(pmBacklight & BIT(4) || pmBacklight & BIT(5) || pmBacklight & BIT(6) || pmBacklight & BIT(7)), BACKLIGHT_BIT)
| BIT_SET(isPhat(), DSPHAT_BIT)
| BIT_SET(i2cBricked, I2CBRICKED_BIT));

*(vu32*)0x4004820 = 0;

status = (status & ~INIT_MASK) | ((initStatus << INIT_OFF) & INIT_MASK);
fifoSendValue32(FIFO_USER_03, status);

Expand Down

0 comments on commit 349c3f6

Please sign in to comment.