diff --git a/display.c b/display.c index 9cc0a6b..6fd502e 100644 --- a/display.c +++ b/display.c @@ -106,13 +106,34 @@ void display_reset(u_char interlaced, int *outScreenHeight) aspect_scale.vy = 256 * ONE / 240; } - // Define display environments, first on top and second on bottom - SetDefDispEnv(&disp[0], 0, 0, SCREENWIDTH, screenHeight); - SetDefDispEnv(&disp[1], 0, screenHeight, SCREENWIDTH, screenHeight); + if (interlaced) + { + screenHeight <<= 1; + yOffset <<= 1; + aspect_scale.vy <<= 1; + + // Define display environments, interlaced images cover the same area in VRAM + SetDefDispEnv(&disp[0], 0, 0, SCREENWIDTH, screenHeight); + SetDefDispEnv(&disp[1], 0, 0, SCREENWIDTH, screenHeight); + + // Define drawing environments, interlaced images cover the same area in VRAM + SetDefDrawEnv(&draw[0], 0, 0, SCREENWIDTH, screenHeight); + SetDefDrawEnv(&draw[1], 0, 0, SCREENWIDTH, screenHeight); + + disp[0].isinter = disp[1].isinter = 1; + } + else + { + // Define display environments, first on top and second on bottom + SetDefDispEnv(&disp[0], 0, 0, SCREENWIDTH, screenHeight); + SetDefDispEnv(&disp[1], 0, screenHeight, SCREENWIDTH, screenHeight); - // Define drawing environments, first on bottom and second on top - SetDefDrawEnv(&draw[0], 0, screenHeight, SCREENWIDTH, screenHeight); - SetDefDrawEnv(&draw[1], 0, 0, SCREENWIDTH, screenHeight); + // Define drawing environments, first on bottom and second on top + SetDefDrawEnv(&draw[0], 0, screenHeight, SCREENWIDTH, screenHeight); + SetDefDrawEnv(&draw[1], 0, 0, SCREENWIDTH, screenHeight); + + disp[0].isinter = disp[1].isinter = 0; + } disp[0].screen.y = disp[1].screen.y = yOffset; disp[0].screen.h = disp[1].screen.h = screenHeight; diff --git a/input.c b/input.c index 304e814..2a60cf0 100644 --- a/input.c +++ b/input.c @@ -1,6 +1,7 @@ #include "common.h" #include "input.h" #include "time.h" +#include "display.h" #include @@ -10,6 +11,9 @@ static const int moveSpeed = 1024; static const short rotSpeed = 1024; static const char deadZone = 0x30; +static u_char disp_interlace = 0; +static u_char dispmode_held = 0; + void input_init() { InitPAD(padBuffer[0], 34, padBuffer[1], 34); @@ -96,6 +100,20 @@ void input_process() // Look up cam_rot.vx += rotInterval; } + if (!(buttons & PAD_SELECT)) + { + // Switch display mode + if (!dispmode_held) + { + dispmode_held = 1; + disp_interlace = !disp_interlace; + display_reset(disp_interlace, NULL); + } + } + else + { + dispmode_held = 0; + } // Check for analog controller u_char padType = padBuffer[0][1] >> 4;