aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStapleButter <thetotalworm@gmail.com>2017-10-30 05:45:26 +0100
committerStapleButter <thetotalworm@gmail.com>2017-10-30 05:45:26 +0100
commit0a04efc33e97ccfb78d6c7a97350c89866c0f844 (patch)
tree06fffe230b4ecb8d08a3ce6e331b30b5cc38a7fb
parent85d823d4c71fb3b4f0c525d3a7fd6176c4b5beb7 (diff)
attempt at auto-emphasis mode, emphasizing main screen
-rw-r--r--src/NDS.h2
-rw-r--r--src/libui_sdl/main.cpp45
2 files changed, 43 insertions, 4 deletions
diff --git a/src/NDS.h b/src/NDS.h
index 6b76451..71f6d41 100644
--- a/src/NDS.h
+++ b/src/NDS.h
@@ -92,6 +92,8 @@ extern u32 IE[2];
extern u32 IF[2];
extern Timer Timers[8];
+extern u16 PowerControl9;
+
extern u16 ExMemCnt[2];
extern u8 ROMSeed0[2*8];
extern u8 ROMSeed1[2*8];
diff --git a/src/libui_sdl/main.cpp b/src/libui_sdl/main.cpp
index d3184db..55e9526 100644
--- a/src/libui_sdl/main.cpp
+++ b/src/libui_sdl/main.cpp
@@ -64,6 +64,9 @@ int ScreenGap = 0;
int ScreenLayout = 0;
int ScreenSizing = 0;
+int MainScreenPos[3];
+int AutoScreenSizing;
+
uiRect TopScreenRect;
uiRect BottomScreenRect;
@@ -73,6 +76,9 @@ u32 KeyInputMask;
SDL_Joystick* Joystick;
+void SetupScreenRects(int width, int height);
+
+
void UpdateWindowTitle(void* data)
{
@@ -88,6 +94,11 @@ int EmuThreadFunc(void* burp)
{
NDS::Init();
+ MainScreenPos[0] = 0;
+ MainScreenPos[1] = 0;
+ MainScreenPos[2] = 0;
+ AutoScreenSizing = 0;
+
ScreenDrawInited = false;
Touching = false;
@@ -174,6 +185,35 @@ int EmuThreadFunc(void* burp)
if (EmuRunning == 0) break;
+ // auto screen layout
+ {
+ MainScreenPos[2] = MainScreenPos[1];
+ MainScreenPos[1] = MainScreenPos[0];
+ MainScreenPos[0] = NDS::PowerControl9 >> 15;
+
+ int guess;
+ if (MainScreenPos[0] == MainScreenPos[2] &&
+ MainScreenPos[0] != MainScreenPos[1])
+ {
+ // constant flickering, likely displaying 3D on both screens
+ // TODO: when both screens are used for 2D only...???
+ guess = 0;
+ }
+ else
+ {
+ if (MainScreenPos[0] == 1)
+ guess = 1;
+ else
+ guess = 2;
+ }
+
+ if (guess != AutoScreenSizing)
+ {
+ AutoScreenSizing = guess;
+ SetupScreenRects(Config::WindowWidth, Config::WindowHeight);
+ }
+ }
+
memcpy(ScreenBuffer, GPU::Framebuffer, 256*384*4);
uiAreaQueueRedrawAll(MainDrawArea);
@@ -346,10 +386,7 @@ void SetupScreenRects(int width, int height)
int sizemode;
if (ScreenSizing == 3)
- {
- // TODO!! auto mode
- sizemode = 0;
- }
+ sizemode = AutoScreenSizing;
else
sizemode = ScreenSizing;