diff --git a/libultraship/libultraship/Lib/Fast3D/gfx_pc.cpp b/libultraship/libultraship/Lib/Fast3D/gfx_pc.cpp index 6738f28fa..4d3f40d23 100644 --- a/libultraship/libultraship/Lib/Fast3D/gfx_pc.cpp +++ b/libultraship/libultraship/Lib/Fast3D/gfx_pc.cpp @@ -60,8 +60,7 @@ using namespace std; #define SCALE_3_8(VAL_) ((VAL_) * 0x24) #define SCALE_8_3(VAL_) ((VAL_) / 0x24) -#define SCREEN_WIDTH 320 -#define SCREEN_HEIGHT 240 +// SCREEN_WIDTH and SCREEN_HEIGHT are defined in the headerfile #define HALF_SCREEN_WIDTH (SCREEN_WIDTH / 2) #define HALF_SCREEN_HEIGHT (SCREEN_HEIGHT / 2) @@ -2662,15 +2661,15 @@ void gfx_get_dimensions(uint32_t *width, uint32_t *height) { gfx_wapi->get_dimensions(width, height); } -void gfx_init(struct GfxWindowManagerAPI *wapi, struct GfxRenderingAPI *rapi, const char *game_name, bool start_in_fullscreen) { +void gfx_init(struct GfxWindowManagerAPI *wapi, struct GfxRenderingAPI *rapi, const char *game_name, bool start_in_fullscreen, uint32_t screen_width, uint32_t screen_height) { gfx_wapi = wapi; gfx_rapi = rapi; gfx_wapi->init(game_name, start_in_fullscreen); gfx_rapi->init(); - gfx_rapi->update_framebuffer_parameters(0, SCREEN_WIDTH, SCREEN_HEIGHT, 1, false, true, true, true); + gfx_rapi->update_framebuffer_parameters(0, screen_width, screen_height, 1, false, true, true, true); gfx_current_dimensions.internal_mul = 1; - gfx_current_dimensions.width = SCREEN_WIDTH; - gfx_current_dimensions.height = SCREEN_HEIGHT; + gfx_current_dimensions.width = screen_width; + gfx_current_dimensions.height = screen_height; game_framebuffer = gfx_rapi->create_framebuffer(); game_framebuffer_msaa_resolved = gfx_rapi->create_framebuffer(); diff --git a/libultraship/libultraship/Lib/Fast3D/gfx_pc.h b/libultraship/libultraship/Lib/Fast3D/gfx_pc.h index 2ecb68898..bf3b199fc 100644 --- a/libultraship/libultraship/Lib/Fast3D/gfx_pc.h +++ b/libultraship/libultraship/Lib/Fast3D/gfx_pc.h @@ -8,6 +8,9 @@ #include "U64/PR/ultra64/types.h" +#define SCREEN_WIDTH 320 +#define SCREEN_HEIGHT 240 + struct GfxRenderingAPI; struct GfxWindowManagerAPI; @@ -62,7 +65,7 @@ extern uint32_t gfx_msaa_level; } -void gfx_init(struct GfxWindowManagerAPI* wapi, struct GfxRenderingAPI* rapi, const char* game_name, bool start_in_fullscreen); +void gfx_init(struct GfxWindowManagerAPI* wapi, struct GfxRenderingAPI* rapi, const char* game_name, bool start_in_fullscreen, uint32_t screen_width = SCREEN_WIDTH, uint32_t screen_height = SCREEN_HEIGHT); struct GfxRenderingAPI* gfx_get_current_rendering_api(void); void gfx_start_frame(void); void gfx_run(Gfx* commands, const std::unordered_map& mtx_replacements); diff --git a/libultraship/libultraship/Window.cpp b/libultraship/libultraship/Window.cpp index bbd906c76..d2240928e 100644 --- a/libultraship/libultraship/Window.cpp +++ b/libultraship/libultraship/Window.cpp @@ -264,15 +264,18 @@ namespace Ship { SetAudioPlayer(); bIsFullscreen = Ship::stob(Conf["WINDOW"]["FULLSCREEN"]); - dwWidth = Ship::stoi(Conf["WINDOW"]["WINDOW WIDTH"], 320); - dwHeight = Ship::stoi(Conf["WINDOW"]["WINDOW HEIGHT"], 240); - dwWidth = Ship::stoi(Conf["WINDOW"]["FULLSCREEN WIDTH"], 1920); - dwHeight = Ship::stoi(Conf["WINDOW"]["FULLSCREEN HEIGHT"], 1080); + if (bIsFullscreen) { + dwWidth = Ship::stoi(Conf["WINDOW"]["FULLSCREEN WIDTH"], 1920); + dwHeight = Ship::stoi(Conf["WINDOW"]["FULLSCREEN HEIGHT"], 1080); + } else { + dwWidth = Ship::stoi(Conf["WINDOW"]["WINDOW WIDTH"], 320); + dwHeight = Ship::stoi(Conf["WINDOW"]["WINDOW HEIGHT"], 240); + } dwMenubar = Ship::stoi(Conf["WINDOW"]["menubar"], 0); const std::string& gfx_backend = Conf["WINDOW"]["GFX BACKEND"]; SetWindowManager(&WmApi, &RenderingApi, gfx_backend); - gfx_init(WmApi, RenderingApi, GetContext()->GetName().c_str(), bIsFullscreen); + gfx_init(WmApi, RenderingApi, GetContext()->GetName().c_str(), bIsFullscreen, dwWidth, dwHeight); WmApi->set_fullscreen_changed_callback(Window::OnFullscreenChanged); WmApi->set_keyboard_callbacks(Window::KeyDown, Window::KeyUp, Window::AllKeysUp); }