diff --git a/display.c b/display.c index 7253dc0..11ff9ce 100644 --- a/display.c +++ b/display.c @@ -57,7 +57,7 @@ void display_init() // Start the display in progressive mode int screenHeight; - display_reset(GetVideoMode(), 0, &screenHeight); + display_reset(GetVideoMode(), 0, 0, &screenHeight); // Clear double buffer counter db = 0; @@ -73,7 +73,7 @@ void display_init() FntOpen(0, 16, SCREENWIDTH, screenHeight, 0, 512); } -void display_reset(int mode, u_char interlaced, int *outScreenHeight) +void display_reset(int mode, u_char interlaced, u_char widescreen, int *outScreenHeight) { if (mode != GetVideoMode()) SetVideoMode(mode); @@ -125,6 +125,9 @@ void display_reset(int mode, u_char interlaced, int *outScreenHeight) disp[0].isinter = disp[1].isinter = 0; } + // Scale X coordinates to set the aspect ratio for 4:3 or 16:9 widescreen + aspect_scale.vx = SCREENWIDTH * ONE / (widescreen ? 426 : 320); + disp[0].screen.y = disp[1].screen.y = yOffset; disp[0].screen.h = disp[1].screen.h = screenHeight; diff --git a/display.h b/display.h index a3f7f2d..44d097a 100644 --- a/display.h +++ b/display.h @@ -13,7 +13,7 @@ extern u_long *curOT; extern u_short polyCount; void display_init(); -void display_reset(int mode, u_char interlaced, int *outScreenHeight); +void display_reset(int mode, u_char interlaced, u_char widescreen, int *outScreenHeight); void display_start(); void display_finish(); diff --git a/input.c b/input.c index a75241c..622f3b4 100644 --- a/input.c +++ b/input.c @@ -13,6 +13,8 @@ static const char deadZone = 0x30; static u_char dispmode = 0; static u_char dispmode_held = 0; +static u_char widescreen = 0; +static u_char widescreen_held = 0; void input_init() { @@ -107,14 +109,27 @@ void input_process() { dispmode_held = 1; //dispmode = (dispmode + 1) & 0x3; - //display_reset(!!(dispmode & 2), !!(dispmode & 1), NULL); - display_reset(!GetVideoMode(), 0, NULL); + //display_reset(!!(dispmode & 2), !!(dispmode & 1), widescreen, NULL); + display_reset(!GetVideoMode(), 0, widescreen, NULL); } } else { dispmode_held = 0; } + if (!(buttons & PAD_START)) + { + if (!widescreen_held) + { + widescreen_held = 1; + widescreen = !widescreen; + display_reset(GetVideoMode(), 0, widescreen, NULL); + } + } + else + { + widescreen_held = 0; + } // Check for analog controller u_char padType = padBuffer[0][1] >> 4;