Skip to content

Commit 515ef33

Browse files
committed
imageview: Add pressing A to switch between regular and temporal dithering
1 parent 9da4ebd commit 515ef33

File tree

4 files changed

+26
-4
lines changed

4 files changed

+26
-4
lines changed

imageview/arm9/source/graphics/graphics.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
#include <nds/ndstypes.h>
2323
#include <string>
2424

25+
extern bool doubleBuffer;
26+
2527
void SetBrightness(u8 screen, s8 bright);
2628
void imageLoad(const char* filename);
2729
void bgLoad(void);

imageview/arm9/source/language.inl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
STRING(A_REGULAR_DITHERING, "\\A Switch to regular dithering")
2+
STRING(A_TEMPORAL_DITHERING, "\\A Switch to temporal dithering")
13
STRING(BACK, "Back")
24

35
// SD removal errors

imageview/arm9/source/main.cpp

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ bool fadeType = false; // false = out, true = in
3232
bool fadeSpeed = true; // false = slow (for DSi launch effect), true = fast
3333
bool controlTopBright = true;
3434
bool controlBottomBright = true;
35+
bool supportsDoubleBuffer = false;
3536

3637
extern void ClearBrightness();
3738
extern int imageType;
@@ -109,6 +110,17 @@ void customSleep() {
109110
*(int*)0x02003004 = 2; // Fade in sound
110111
}
111112

113+
void printText(void) {
114+
if (ms().macroMode) return;
115+
116+
clearText(false);
117+
if (supportsDoubleBuffer) {
118+
printSmall(false, 0, 88, doubleBuffer ? STR_A_REGULAR_DITHERING : STR_A_TEMPORAL_DITHERING, Alignment::center);
119+
}
120+
printSmall(false, -88, 174, STR_BACK, Alignment::center);
121+
updateText(false);
122+
}
123+
112124
//---------------------------------------------------------------------------------
113125
int imageViewer(void) {
114126
//---------------------------------------------------------------------------------
@@ -137,10 +149,8 @@ int imageViewer(void) {
137149

138150
imageLoad((strlen(imagePathChar) >= 2) ? imagePathChar : "nitro:/graphics/test.png");
139151
bgLoad();
140-
if (!ms().macroMode) {
141-
printSmall(false, -88, 174, STR_BACK, Alignment::center);
142-
updateText(false);
143-
}
152+
supportsDoubleBuffer = doubleBuffer;
153+
printText();
144154

145155
snd();
146156
snd().beginStream();
@@ -171,6 +181,12 @@ int imageViewer(void) {
171181
customSleep();
172182
}
173183

184+
if ((pressed & KEY_A) && supportsDoubleBuffer) {
185+
doubleBuffer = !doubleBuffer;
186+
printText();
187+
snd().playSwitch();
188+
}
189+
174190
if ((pressed & KEY_B) || ((pressed & KEY_TOUCH) && touch.px >= 0 && touch.px < 80 && touch.py >= 169 && touch.py < 192)) {
175191
loadROMselect();
176192
}

imageview/nitrofiles/languages/en/language.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
[LANGUAGE]
2+
A_REGULAR_DITHERING = \A Switch to regular dithering
3+
A_TEMPORAL_DITHERING = \A Switch to temporal dithering
24
BACK = Back
35
ERROR_HAS_OCCURRED = An error has occurred.
46
DISABLE_SD_REMOVAL_CHECK = Please turn off the power, turn\nthe power back on, relaunch\nTWiLight Menu++, hold SELECT to\nopen TWLMenu++ Settings, and\ndisable SD removal detection.

0 commit comments

Comments
 (0)