mirror of
https://github.com/perfect-dark-pc-port/perfect_dark.git
synced 2026-10-24 00:02:43 +02:00
port: hackfix modeswitching
This commit is contained in:
1 parent
a542e93fe7
commit
46a9888647
7 files changed
+19
-15
No files matched your search
@@ -23,6 +23,7 @@ extern struct GfxDimensions
|
||||
extern struct XYWidthHeight
|
||||
gfx_current_game_window_viewport; // The area of the window the game is drawn to, (0, 0) is top-left corner
|
||||
extern uint32_t gfx_msaa_level;
|
||||
extern struct XYWidthHeight gfx_current_native_viewport; // The internal/native video mode of the game
|
||||
|
||||
void gfx_init(struct GfxWindowManagerAPI* wapi, struct GfxRenderingAPI* rapi, const char* game_name,
|
||||
bool start_in_fullscreen, uint32_t width, uint32_t height,
|
||||
|
||||
@@ -201,6 +201,7 @@ int32_t gfx_current_window_position_y;
|
||||
struct GfxDimensions gfx_current_dimensions;
|
||||
static struct GfxDimensions gfx_prev_dimensions;
|
||||
struct XYWidthHeight gfx_current_game_window_viewport;
|
||||
struct XYWidthHeight gfx_current_native_viewport;
|
||||
|
||||
static bool game_renders_to_framebuffer;
|
||||
static int game_framebuffer;
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
|
||||
#include <PR/gbi.h>
|
||||
|
||||
#define SCREEN_WIDTH 640
|
||||
#define SCREEN_HEIGHT 480
|
||||
#define SCREEN_WIDTH (gfx_current_native_viewport.width)
|
||||
#define SCREEN_HEIGHT (gfx_current_native_viewport.height)
|
||||
|
||||
extern uintptr_t gfxFramebuffer;
|
||||
|
||||
|
||||
@@ -12,4 +12,6 @@ void videoEndFrame(void);
|
||||
|
||||
void *videoGetWindowHandle(void);
|
||||
|
||||
void videoUpdateNativeResolution(const int w, const int h);
|
||||
|
||||
#endif
|
||||
@@ -237,8 +237,10 @@ void mainInit(void)
|
||||
g_VmShowStats = 0;
|
||||
|
||||
// no copyright screen
|
||||
viSetMode(VIMODE_HI);
|
||||
viConfigureForLegal();
|
||||
viBlack(true);
|
||||
viUpdateMode();
|
||||
|
||||
filesInit();
|
||||
|
||||
|
||||
+3
-13
@@ -197,19 +197,9 @@ void __scUpdateViMode(void)
|
||||
var8005ce74 = (var8005ce74 + 1) % 2;
|
||||
|
||||
if (g_SchedViModesPending[1 - var8005ce74]) {
|
||||
if (var8008dd60[1 - var8005ce74]->comRegs.width != var8008dcc0[1 - var8005ce74].comRegs.width
|
||||
|| var8008dd60[1 - var8005ce74]->comRegs.xScale != var8008dcc0[1 - var8005ce74].comRegs.xScale
|
||||
|| var8008dd60[1 - var8005ce74]->fldRegs[0].yScale != var8008dcc0[1 - var8005ce74].fldRegs[0].yScale
|
||||
|| var8008dd60[1 - var8005ce74]->fldRegs[1].yScale != var8008dcc0[1 - var8005ce74].fldRegs[1].yScale
|
||||
|| var8008dd60[1 - var8005ce74]->fldRegs[0].origin != var8008dcc0[1 - var8005ce74].fldRegs[0].origin
|
||||
|| var8008dd60[1 - var8005ce74]->fldRegs[1].origin != var8008dcc0[1 - var8005ce74].fldRegs[1].origin) {
|
||||
osViSetMode(var8008dd60[1 - var8005ce74]);
|
||||
osViBlack(g_ViUnblackTimer);
|
||||
osViSetXScale(g_ViXScalesBySlot[1 - var8005ce74]);
|
||||
osViSetYScale(g_ViYScalesBySlot[1 - var8005ce74]);
|
||||
osViSetSpecialFeatures(OS_VI_GAMMA_OFF | OS_VI_DITHER_FILTER_ON);
|
||||
}
|
||||
|
||||
// TODO: make this a little less awkward
|
||||
extern struct rend_vidat *g_ViBackData;
|
||||
videoUpdateNativeResolution(g_ViBackData->bufx, g_ViBackData->bufy);
|
||||
g_SchedViModesPending[1 - var8005ce74] = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,8 @@ s32 videoInit(void)
|
||||
{
|
||||
wmAPI = &gfx_sdl;
|
||||
renderingAPI = &gfx_opengl_api;
|
||||
gfx_current_native_viewport.width = 320;
|
||||
gfx_current_native_viewport.height = 240;
|
||||
gfx_current_game_window_viewport.width = 640;
|
||||
gfx_current_game_window_viewport.height = 480;
|
||||
gfx_init(wmAPI, renderingAPI, "PD", false, 640, 480, 100, 100);
|
||||
@@ -82,3 +84,9 @@ void *videoGetWindowHandle(void)
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void videoUpdateNativeResolution(const int w, const int h)
|
||||
{
|
||||
gfx_current_native_viewport.width = w;
|
||||
gfx_current_native_viewport.height = h;
|
||||
}
|
||||
Reference in new issue
Block a user