Browse Source

First implementation of interlaced mode and switching display modes by pressing Select.

Still a bit buggy, not sure what I'm doing wrong. Will have to revisit this after performance is improved.
tess_experiment
Nico de Poel 3 years ago
parent
commit
a80c6d490b
  1. 33
      display.c
  2. 18
      input.c

33
display.c

@ -106,13 +106,34 @@ void display_reset(u_char interlaced, int *outScreenHeight)
aspect_scale.vy = 256 * ONE / 240; 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.y = disp[1].screen.y = yOffset;
disp[0].screen.h = disp[1].screen.h = screenHeight; disp[0].screen.h = disp[1].screen.h = screenHeight;

18
input.c

@ -1,6 +1,7 @@
#include "common.h" #include "common.h"
#include "input.h" #include "input.h"
#include "time.h" #include "time.h"
#include "display.h"
#include <psxpad.h> #include <psxpad.h>
@ -10,6 +11,9 @@ static const int moveSpeed = 1024;
static const short rotSpeed = 1024; static const short rotSpeed = 1024;
static const char deadZone = 0x30; static const char deadZone = 0x30;
static u_char disp_interlace = 0;
static u_char dispmode_held = 0;
void input_init() void input_init()
{ {
InitPAD(padBuffer[0], 34, padBuffer[1], 34); InitPAD(padBuffer[0], 34, padBuffer[1], 34);
@ -96,6 +100,20 @@ void input_process()
// Look up // Look up
cam_rot.vx += rotInterval; 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 // Check for analog controller
u_char padType = padBuffer[0][1] >> 4; u_char padType = padBuffer[0][1] >> 4;

Loading…
Cancel
Save