Skip to content

Commit

Permalink
DSi-based Themes: Don't open select menu when changing brightness on …
Browse files Browse the repository at this point in the history
…DSi (#2454)
  • Loading branch information
DieGo367 committed Aug 16, 2024
1 parent ca04f1e commit 5e8a78b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
14 changes: 14 additions & 0 deletions romsel_dsimenutheme/arm7/source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@ int main() {
}
}

bool reportBacklightLevelChange = false;
u8 currentBacklightLevel;

// Keep the ARM7 mostly idle
while (!exitflag) {
if ( 0 == (REG_KEYINPUT & (KEY_SELECT | KEY_START | KEY_L | KEY_R))) {
Expand Down Expand Up @@ -217,6 +220,17 @@ int main() {
ReturntoDSiMenu();
}

if (fifoCheckValue32(FIFO_USER_04)) {
reportBacklightLevelChange = fifoGetValue32(FIFO_USER_04) == 1;
if (reportBacklightLevelChange) currentBacklightLevel = my_i2cReadRegister(I2C_PM, 0x41);
}
if (reportBacklightLevelChange) {
if (my_i2cReadRegister(I2C_PM, 0x41) != currentBacklightLevel) {
fifoSendValue32(FIFO_USER_04, 1);
reportBacklightLevelChange = false;
}
}

if (*(u32*)(0x2FFFD0C) == 0x54494D52) {
if (rebootTimer == 60*2) {
ReturntoDSiMenu(); // Reboot, if fat init code is stuck in a loop
Expand Down
10 changes: 10 additions & 0 deletions romsel_dsimenutheme/arm9/source/fileBrowse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4316,6 +4316,9 @@ std::string browseForFile(const std::vector<std::string_view> extensionList) {
bannerTextShown = false;
bool runSelectMenu = pressed & KEY_SELECT;
bool break2 = false;
if (pressed & KEY_SELECT && dsiFeatures() && ms().consoleModel < 2) {
fifoSendValue32(FIFO_USER_04, 1); // enable backlight level change reports
}
while (held & KEY_SELECT) {
scanKeys();
pressed = keysDown();
Expand Down Expand Up @@ -4351,7 +4354,14 @@ std::string browseForFile(const std::vector<std::string_view> extensionList) {
return "null";
}
}

// detect backlight level change on DSi consoles
if (runSelectMenu && dsiFeatures() && ms().consoleModel < 2 && fifoGetValue32(FIFO_USER_04)) {
runSelectMenu = false;
fifoSendValue32(FIFO_USER_04, 2); // disable backlight level change report
}
}
if (dsiFeatures() && ms().consoleModel < 2) fifoSendValue32(FIFO_USER_04, 2); // disable backlight level change report
if (break2) break;
if (runSelectMenu && (ms().theme == TWLSettings::EThemeDSi || ms().theme == TWLSettings::EThemeSaturn || ms().theme == TWLSettings::EThemeHBL)) {
if (ms().showSelectMenu) {
Expand Down

0 comments on commit 5e8a78b

Please sign in to comment.