From 25099b06183753e300aebb586963d0fec6acdda8 Mon Sep 17 00:00:00 2001 From: "C.W. Betts" Date: Sun, 15 Oct 2023 00:43:19 -0600 Subject: [PATCH] Well, it links. Probably won't even work. --- Boxer/BXCoalface.mm | 102 +++++++++++++++++++++++++++++++++++++++- Boxer/BXVideoHandler.mm | 7 +-- DOSBox-Staging | 2 +- 3 files changed, 105 insertions(+), 6 deletions(-) diff --git a/Boxer/BXCoalface.mm b/Boxer/BXCoalface.mm index 4fc419ed..1175e985 100644 --- a/Boxer/BXCoalface.mm +++ b/Boxer/BXCoalface.mm @@ -113,13 +113,19 @@ void boxer_setShader(const ShaderInfo& shader_info, const std::string& shader_so //TODO: implement! } -Bitu boxer_prepareForFrameSize(Bitu width, Bitu height, Bitu gfx_flags, double scalex, double scaley, GFX_CallBack_t callback, double pixel_aspect) +Bitu boxer_prepareForFrameSize(const int width, const int height, + const Fraction& render_pixel_aspect_ratio, const uint8_t flags, + const VideoMode& video_mode, GFX_CallBack_t callback) { BXEmulator *emulator = [BXEmulator currentEmulator]; + + const bool double_width = flags & GFX_DBL_W; + const bool double_height = flags & GFX_DBL_H; NSSize outputSize = NSMakeSize((CGFloat)width, (CGFloat)height); - NSSize scale = NSMakeSize((CGFloat)scalex, (CGFloat)scaley); + NSSize scale = NSMakeSize(double_width ? 2 : 1, double_height ? 2 : 1); [[emulator videoHandler] prepareForOutputSize: outputSize atScale: scale withCallback: callback]; + //TODO: store callback! return GFX_CAN_32; } @@ -631,6 +637,97 @@ void restart_program(std::vector & parameters) { return "Boxer-build"; } +#pragma mark - to work on + +void GFX_CenterMouse() +{ +// assert(sdl.window); +// +// int width = 0; +// int height = 0; +// +//#if defined(WIN32) && !SDL_VERSION_ATLEAST(2, 28, 1) +// const auto window_canvas_size = get_canvas_size(sdl.rendering_backend); +// +// width = window_canvas_size.w; +// height = window_canvas_size.h; +//#else +// SDL_GetWindowSize(sdl.window, &width, &height); +//#endif +// +// SDL_WarpMouseInWindow(sdl.window, width / 2, height / 2); +} + +SDL_Rect GFX_CalcViewport(const int canvas_width, const int canvas_height, + const int draw_width, const int draw_height, + const Fraction& render_pixel_aspect_ratio) +{ + return SDL_Rect(); +} + +void GFX_RefreshTitle() +{ +// constexpr int8_t refresh_cycle_count = -1; +// GFX_SetTitle(refresh_cycle_count); +} + +SDL_Rect GFX_GetCanvasSize() +{ +// return get_canvas_size(sdl.rendering_backend); + return SDL_Rect(); +} + + +void GFX_SetMouseHint(const MouseHint hint_id) +{ + +} + +void GFX_SetMouseCapture(const bool requested_capture) +{ + +} + +void GFX_SetMouseRawInput(const bool requested_raw_input) +{ + +} + +void GFX_SetMouseVisibility(const bool requested_visible) +{ + +} + +RenderingBackend GFX_GetRenderingBackend() +{ + return RenderingBackend::Texture; +} + +InterpolationMode GFX_GetInterpolationMode() +{ + return InterpolationMode::NearestNeighbour; +} + +IntegerScalingMode GFX_GetIntegerScalingMode() +{ + return IntegerScalingMode::Auto; +} + +void GFX_SetIntegerScalingMode(const IntegerScalingMode mode) +{ + +} + +bool GFX_HaveDesktopEnvironment() +{ + return true; +} + +void GFX_SetTitle(const int32_t new_num_cycles, const bool is_paused = false) +{ + +} + #pragma mark - No-ops //These used to be defined in sdl_mapper.cpp, which we no longer include in Boxer. @@ -639,6 +736,7 @@ void MAPPER_AddHandler(MAPPER_Handler *handler, SDL_Scancode key, uint32_t mods, void MAPPER_Init(void) {} void MAPPER_StartUp(Section * sec) {} void MAPPER_Run(bool pressed) {} +void MAPPER_AutoTypeStopImmediately() {} void MAPPER_RunInternal() {} void MAPPER_LosingFocus(void) {} void MAPPER_AutoType(std::vector &sequence, diff --git a/Boxer/BXVideoHandler.mm b/Boxer/BXVideoHandler.mm index 9eac3541..0cba5430 100644 --- a/Boxer/BXVideoHandler.mm +++ b/Boxer/BXVideoHandler.mm @@ -378,10 +378,11 @@ - (void) applyRenderingStrategy //Finally, apply the values to DOSBox - render.aspect = NO; //We apply our own aspect correction separately - render.scale.forced = YES; + //TODO: fix/update this! +// render.aspect = NO; //We apply our own aspect correction separately +// render.scale.forced = YES; render.scale.size = (Bitu)filterScale; - render.scale.op = (scalerOperation_t)activeType; +// render.scale.op = (scalerOperation_t)activeType; //While we're here, sync up the CGA and hercules color modes if appropriate diff --git a/DOSBox-Staging b/DOSBox-Staging index fd2fe6dc..cb19d64a 160000 --- a/DOSBox-Staging +++ b/DOSBox-Staging @@ -1 +1 @@ -Subproject commit fd2fe6dc6e3040c14a4d92ac20a61f4a84bcff75 +Subproject commit cb19d64a6bc60f8504bb34d03a79f2050ca8e8cd