Skip to content

Commit

Permalink
Remove Slot-1 Touch Mode setting
Browse files Browse the repository at this point in the history
DSi touch mode caused very low quality sound output when nds-bootstrap switches to DS touch mode
  • Loading branch information
RocketRobz committed Sep 22, 2024
1 parent 393ac6f commit 3a268b3
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 79 deletions.
66 changes: 0 additions & 66 deletions booter_fc/arm7/source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,70 +67,6 @@ void powerButtonCB() {
exitflag = true;
}

static void DSiTouchscreenMode(void) {
if (my_cdcReadReg(CDC_SOUND, 0x22) != 0xF0) return;

// Touchscreen
my_cdcWriteReg(0, 0x01, 0x01);
my_cdcWriteReg(0, 0x39, 0x66);
my_cdcWriteReg(1, 0x20, 0x16);
my_cdcWriteReg(0, 0x04, 0x00);
my_cdcWriteReg(0, 0x12, 0x81);
my_cdcWriteReg(0, 0x13, 0x82);
my_cdcWriteReg(0, 0x51, 0x82);
my_cdcWriteReg(0, 0x51, 0x00);
my_cdcWriteReg(0, 0x04, 0x03);
my_cdcWriteReg(0, 0x05, 0xA1);
my_cdcWriteReg(0, 0x06, 0x15);
my_cdcWriteReg(0, 0x0B, 0x87);
my_cdcWriteReg(0, 0x0C, 0x83);
my_cdcWriteReg(0, 0x12, 0x87);
my_cdcWriteReg(0, 0x13, 0x83);
my_cdcWriteReg(3, 0x10, 0x88);
my_cdcWriteReg(4, 0x08, 0x7F);
my_cdcWriteReg(4, 0x09, 0xE1);
my_cdcWriteReg(4, 0x0A, 0x80);
my_cdcWriteReg(4, 0x0B, 0x1F);
my_cdcWriteReg(4, 0x0C, 0x7F);
my_cdcWriteReg(4, 0x0D, 0xC1);
my_cdcWriteReg(0, 0x41, 0x08);
my_cdcWriteReg(0, 0x42, 0x08);
my_cdcWriteReg(0, 0x3A, 0x00);
my_cdcWriteReg(4, 0x08, 0x7F);
my_cdcWriteReg(4, 0x09, 0xE1);
my_cdcWriteReg(4, 0x0A, 0x80);
my_cdcWriteReg(4, 0x0B, 0x1F);
my_cdcWriteReg(4, 0x0C, 0x7F);
my_cdcWriteReg(4, 0x0D, 0xC1);
my_cdcWriteReg(1, 0x2F, 0x2B);
my_cdcWriteReg(1, 0x30, 0x40);
my_cdcWriteReg(1, 0x31, 0x40);
my_cdcWriteReg(1, 0x32, 0x60);
my_cdcWriteReg(0, 0x74, 0x82);
my_cdcWriteReg(0, 0x74, 0x92);
my_cdcWriteReg(0, 0x74, 0xD2);
my_cdcWriteReg(1, 0x21, 0x20);
my_cdcWriteReg(1, 0x22, 0xF0);
my_cdcWriteReg(0, 0x3F, 0xD4);
my_cdcWriteReg(1, 0x23, 0x44);
my_cdcWriteReg(1, 0x1F, 0xD4);
my_cdcWriteReg(1, 0x28, 0x4E);
my_cdcWriteReg(1, 0x29, 0x4E);
my_cdcWriteReg(1, 0x24, 0x9E);
my_cdcWriteReg(1, 0x25, 0x9E);
my_cdcWriteReg(1, 0x20, 0xD4);
my_cdcWriteReg(1, 0x2A, 0x14);
my_cdcWriteReg(1, 0x2B, 0x14);
my_cdcWriteReg(1, 0x26, 0xA7);
my_cdcWriteReg(1, 0x27, 0xA7);
my_cdcWriteReg(0, 0x40, 0x00);
my_cdcWriteReg(0, 0x3A, 0x60);

// Finish up!
my_cdcReadReg (CDC_TOUCHCNT, 0x02);
my_cdcWriteReg(CDC_TOUCHCNT, 0x02, 0x00);
}

//---------------------------------------------------------------------------------
int main() {
//---------------------------------------------------------------------------------
Expand All @@ -141,8 +77,6 @@ int main() {
*(vu16*)(0x04004014) = 0x264C;
*(vu16*)(0x04004C02) = 0x4000; // enable powerbutton irq (Fix for Unlaunch 1.3)

DSiTouchscreenMode(); // Fix disabled audio, if DSi touch mode is set

if ((REG_SNDEXTCNT & SNDEXTCNT_ENABLE) && !(REG_SNDEXTCNT & BIT(13))) {
REG_SNDEXTCNT &= ~SNDEXTCNT_ENABLE; // Disable sound output: Runs before sound frequency change

Expand Down
1 change: 0 additions & 1 deletion settings/arm9/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1452,7 +1452,6 @@ int settingsMode(void)
miscPage
.option(STR_SLOT1SCFGUNLOCK, STR_DESCRIPTION_SLOT1SCFGUNLOCK, Option::Bool(&ms().slot1SCFGUnlock), {STR_ON, STR_OFF}, {true, false})
.option(STR_SLOT1SDACCESS, STR_DESCRIPTION_SLOT1SDACCESS, Option::Bool(&ms().slot1AccessSD), {STR_ON, STR_OFF}, {true, false})
.option(STR_SLOT1TOUCHMODE, STR_DESCRIPTION_SLOT1TOUCHMODE, Option::Bool(&ms().slot1TouchMode), {STR_DSI_MODE, STR_DS_MODE}, {true, false})
.option(STR_S1SDACCESS, STR_DESCRIPTION_S1SDACCESS_1, Option::Bool(&ms().secondaryAccess), {STR_ON, STR_OFF}, {true, false});
}

Expand Down
2 changes: 1 addition & 1 deletion slot1launch/arm9/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ int main() {
CIniFile settingsini("/_nds/TWiLightMenu/settings.ini");

ignoreBlacklists = settingsini.GetInt("SRLOADER","IGNORE_BLACKLISTS",false);
TWLTOUCH = settingsini.GetInt("SRLOADER","SLOT1_TOUCH_MODE",0);
// TWLTOUCH = settingsini.GetInt("SRLOADER","SLOT1_TOUCH_MODE",0);
soundFreq = settingsini.GetInt("NDS-BOOTSTRAP","SOUND_FREQ",0);
sleepMode = settingsini.GetInt("SRLOADER","SLEEP_MODE",1);
runCardEngine = settingsini.GetInt("SRLOADER","SLOT1_CARDENGINE",1);
Expand Down
8 changes: 4 additions & 4 deletions slot1launch/bootloader/source/main.arm7.c
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ static void NDSTouchscreenMode(void) {
writePowerManagement(PM_CONTROL_REG, 0x0D); //*(unsigned char*)0x40001C2 = 0x00, 0x0D; // PWR[0]=0Dh ;<-- also part of TSC !
}

static void DSiTouchscreenMode(void) {
/* static void DSiTouchscreenMode(void) {
if (strncmp((const char*)0x04FFFA00, "no$gba", 6) != 0) {
return;
}
Expand Down Expand Up @@ -721,7 +721,7 @@ static void DSiTouchscreenMode(void) {
// Finish up!
cdcReadReg (CDC_TOUCHCNT, 0x02);
cdcWriteReg(CDC_TOUCHCNT, 0x02, 0x00);
}
} */

// SDK 5
static bool ROMsupportsDsiMode(const tNDSHeader* ndsHeader) {
Expand Down Expand Up @@ -1059,13 +1059,13 @@ void arm7_main (void) {
*(u32*)0x3FFFFC8 = 0x7884; // Fix sound pitch table for DSi mode (works with SDK5 binaries)

if (ndsHeader->unitCode == 0 || (ndsHeader->unitCode > 0 && !(*(u8*)0x02FFE1BF & BIT(0)))) {
twlTouch ? DSiTouchscreenMode() : NDSTouchscreenMode();
NDSTouchscreenMode();
*(vu16*)0x4000500 = 0x807F;
}
} else {
REG_SCFG_ROM = 0x703;

twlTouch ? DSiTouchscreenMode() : NDSTouchscreenMode();
NDSTouchscreenMode();
*(vu16*)0x4000500 = 0x807F;

REG_GPIO_WIFI |= BIT(8); // Old NDS-Wifi mode
Expand Down
6 changes: 3 additions & 3 deletions slot1launch/bootloaderAlt/source/main.arm7.c
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ static void NDSTouchscreenMode(void) {
writePowerManagement(PM_CONTROL_REG, 0x0D); //*(unsigned char*)0x40001C2 = 0x00, 0x0D; // PWR[0]=0Dh ;<-- also part of TSC !
}

static void DSiTouchscreenMode(void) {
/* static void DSiTouchscreenMode(void) {
if (strncmp((const char*)0x04FFFA00, "no$gba", 6) != 0) {
return;
}
Expand Down Expand Up @@ -543,7 +543,7 @@ static void DSiTouchscreenMode(void) {
// Finish up!
cdcReadReg (CDC_TOUCHCNT, 0x02);
cdcWriteReg(CDC_TOUCHCNT, 0x02, 0x00);
}
} */

int arm7_loadBinary (void) {
u32 chipID;
Expand Down Expand Up @@ -762,7 +762,7 @@ void arm7_main (void) {
// REG_SNDEXTCNT |= SNDEXTCNT_ENABLE; // Enable sound output
}

twlTouch ? DSiTouchscreenMode() : NDSTouchscreenMode();
NDSTouchscreenMode();
*(vu16*)0x4000500 = 0x807F;

REG_GPIO_WIFI |= BIT(8); // Old NDS-Wifi mode
Expand Down
1 change: 0 additions & 1 deletion universal/include/common/twlmenusettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,6 @@ class TWLSettings

bool slot1AccessSD;
bool slot1SCFGUnlock;
bool slot1TouchMode;
bool ezFlashRam;
int limitedMode;
bool dontShowDSiWareInDSModeWarning;
Expand Down
3 changes: 0 additions & 3 deletions universal/source/common/twlmenusettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ TWLSettings::TWLSettings()

slot1AccessSD = false;
slot1SCFGUnlock = false;
slot1TouchMode = false;
ezFlashRam = false;
limitedMode = 0;
dontShowDSiWareInDSModeWarning = false;
Expand Down Expand Up @@ -308,7 +307,6 @@ void TWLSettings::loadSettings()

slot1AccessSD = settingsini.GetInt("SRLOADER", "SLOT1_ENABLESD", slot1AccessSD);
slot1SCFGUnlock = settingsini.GetInt("SRLOADER", "SLOT1_SCFG_UNLOCK", slot1SCFGUnlock);
slot1TouchMode = settingsini.GetInt("SRLOADER", "SLOT1_TOUCH_MODE", slot1TouchMode);
ezFlashRam = settingsini.GetInt("SRLOADER", "EZ_FLASH_RAM", ezFlashRam);
limitedMode = settingsini.GetInt("SRLOADER", "LIMITED_MODE", limitedMode);
dontShowDSiWareInDSModeWarning = settingsini.GetInt("SRLOADER", "DONT_SHOW_DSIWARE_IN_DS_MODE_WARNING", dontShowDSiWareInDSModeWarning);
Expand Down Expand Up @@ -474,7 +472,6 @@ void TWLSettings::saveSettings()

settingsini.SetInt("SRLOADER", "SLOT1_ENABLESD", slot1AccessSD);
settingsini.SetInt("SRLOADER", "SLOT1_SCFG_UNLOCK", slot1SCFGUnlock);
settingsini.SetInt("SRLOADER", "SLOT1_TOUCH_MODE", slot1TouchMode);
settingsini.SetInt("SRLOADER", "LIMITED_MODE", limitedMode);
settingsini.SetInt("SRLOADER", "DONT_SHOW_DSIWARE_IN_DS_MODE_WARNING", dontShowDSiWareInDSModeWarning);
settingsini.SetInt("SRLOADER", "DSIWARE_BOOTER", dsiWareBooter);
Expand Down

0 comments on commit 3a268b3

Please sign in to comment.