Merge branch 'port' of https://github.com/fgsfdsfgs/perfect_dark into port-debugger

This commit is contained in:
fgsfds committed 2023-12-04 21:36:58 +01:00
commit 75c4905e9b
5 files changed
+16 -7

No files matched your search

+1 -1
View File
@@ -317,4 +317,4 @@ allclean:
rm -rf src/generated
codeclean:
find $(B_DIR)/game $(B_DIR)/inflate $(B_DIR)/lib $(B_DIR)/port -name '*.o' -delete
find $(B_DIR)/ -name '*.o' -delete
+1
View File
@@ -27,6 +27,7 @@ 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
extern float gfx_current_native_aspect; // The aspect ratio of the above mode
extern bool gfx_framebuffers_enabled;
void gfx_init(struct GfxWindowManagerAPI* wapi, struct GfxRenderingAPI* rapi, const char* game_name,
+6 -5
View File
@@ -217,6 +217,7 @@ struct GfxDimensions gfx_current_dimensions;
static struct GfxDimensions gfx_prev_dimensions;
struct XYWidthHeight gfx_current_game_window_viewport;
struct XYWidthHeight gfx_current_native_viewport;
float gfx_current_native_aspect = 4.f / 3.f;
bool gfx_framebuffers_enabled = true;
static bool game_renders_to_framebuffer;
@@ -1652,12 +1653,12 @@ static void gfx_sp_geometry_mode(uint32_t clear, uint32_t set) {
static inline void gfx_update_aspect_mode(void) {
const uint32_t side = rsp.aspect_mode & G_ASPECT_CENTER_EXT;
rsp.aspect_scale = rsp.aspect_mode ? (4.f / 3.f) : gfx_current_window_dimensions.aspect_ratio;
rsp.aspect_scale = rsp.aspect_mode ? gfx_current_native_aspect : gfx_current_window_dimensions.aspect_ratio;
if (side == G_ASPECT_LEFT_EXT) {
rsp.aspect_ofs = 1.f - 3.f * gfx_current_dimensions.aspect_ratio / 4.f;
rsp.aspect_ofs = 1.f - gfx_current_dimensions.aspect_ratio / gfx_current_native_aspect;
} else if (side == G_ASPECT_RIGHT_EXT) {
rsp.aspect_ofs = 3.f * gfx_current_dimensions.aspect_ratio / 4.f - 1.f;
rsp.aspect_ofs = gfx_current_dimensions.aspect_ratio / gfx_current_native_aspect - 1.f;
} else {
rsp.aspect_ofs = 0.f;
}
@@ -1685,8 +1686,8 @@ static void gfx_adjust_viewport_or_scissor(XYWidthHeight* area, bool preserve_as
area->y = SCREEN_HEIGHT - area->y;
area->y *= RATIO_Y;
if (preserve_aspect) {
// preserve 4:3
const float ratio = (4.f / 3.f) / gfx_current_dimensions.aspect_ratio;
// preserve native aspect ratio
const float ratio = gfx_current_native_aspect / gfx_current_dimensions.aspect_ratio;
const float midx = gfx_current_dimensions.width * 0.5f;
area->x = midx + (area->x - midx) * ratio;
area->x += rsp.aspect_ofs * gfx_current_dimensions.width * 0.5f;
+5
View File
@@ -13,6 +13,11 @@
#include "debugger.h"
#include "fs.h"
#if !SDL_VERSION_ATLEAST(2, 0, 14)
// this was added in 2.0.14
#define SDL_CONTROLLER_TYPE_VIRTUAL SDL_CONTROLLER_TYPE_UNKNOWN
#endif
#define CONTROLLERDB_FNAME "gamecontrollerdb.txt"
#define MAX_BIND_STR 256
+3 -1
View File
@@ -39,7 +39,8 @@ s32 videoInit(void)
renderingAPI = &gfx_opengl_api;
gfx_current_native_viewport.width = 320;
gfx_current_native_viewport.height = 240;
gfx_current_native_viewport.height = 220;
gfx_current_native_aspect = 320.f / 220.f;
gfx_framebuffers_enabled = (bool)vidFramebuffers;
gfx_msaa_level = vidMSAA;
@@ -110,6 +111,7 @@ void videoUpdateNativeResolution(s32 w, s32 h)
{
gfx_current_native_viewport.width = w;
gfx_current_native_viewport.height = h;
gfx_current_native_aspect = (float)w / (float)h;
}
s32 videoGetNativeWidth(void)