diff --git a/deps/libz/zutil.h b/deps/libz/zutil.h index 6a961e1cbb2c..d999a89881e4 100644 --- a/deps/libz/zutil.h +++ b/deps/libz/zutil.h @@ -127,7 +127,7 @@ extern char z_errmsg[10][21]; /* indexed by 2-zlib_error */ # ifndef Z_SOLO # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os # include /* for fdopen */ -# else +# elif !defined(__APPLE__) # ifndef fdopen # define fdopen(fd,mode) NULL /* No fdopen() */ # endif diff --git a/gfx/common/metal/Shaders.metal b/gfx/common/metal/Shaders.metal index 688c29612b0a..b07b310ebf9a 100644 --- a/gfx/common/metal/Shaders.metal +++ b/gfx/common/metal/Shaders.metal @@ -543,7 +543,6 @@ namespace hdr namespace hdr_crt { constant float kBeamWidth = 0.5f; - constant uint kChannelMask = 3u; constant uint kFirstChannelShift = 2u; constant uint kRedId = 0u; diff --git a/gfx/common/metal_common.h b/gfx/common/metal_common.h index 25f4bb281796..2aacc73171c7 100644 --- a/gfx/common/metal_common.h +++ b/gfx/common/metal_common.h @@ -248,7 +248,7 @@ typedef NS_ENUM(NSUInteger, ViewportResetMode) { @interface Filter : NSObject -@property (nonatomic, readwrite) id delegate; +@property (nonatomic, readwrite, assign) id delegate; @property (nonatomic, readonly) id sampler; - (void)apply:(id)cb in:(id)tin out:(id)tout; diff --git a/gfx/display_servers/dispserv_apple.m b/gfx/display_servers/dispserv_apple.m index 26ee580fc658..8a6511c84981 100644 --- a/gfx/display_servers/dispserv_apple.m +++ b/gfx/display_servers/dispserv_apple.m @@ -88,7 +88,7 @@ static bool apple_display_server_set_window_progress(void *data, int progress, b * - qb/top-level Makefile: MRC (not in the per-file ARC * override list at Makefile:275 alongside metal.o / * mfi_joypad.o / coreaudio3.o). - * - pkg/apple/*.xcodeproj: ARC, via griffin_objc.m which + * - pkg/apple/.xcodeproj: ARC, via griffin_objc.m which * #include's this file into a TU compiled with * CLANG_ENABLE_OBJC_ARC=YES (pkg/apple/BaseConfig.xcconfig:182). * diff --git a/gfx/drivers/gl1.c b/gfx/drivers/gl1.c index 7ff12fc7aeda..5eb5c65d15e2 100644 --- a/gfx/drivers/gl1.c +++ b/gfx/drivers/gl1.c @@ -840,14 +840,29 @@ static void gl1_raster_font_render_msg( font->block->fullscreen = full_screen; { - unsigned width = gl->video_width; - unsigned height = gl->video_height; + /* gl->video_width/height holds the core's emulated frame size + * (e.g. 256x224), not the window size — gl1 reuses that field + * for texture upload bookkeeping. The font viewport must cover + * the full window, so use screen_width/height instead. Fall + * back to video_width/height if the context driver did not + * report a screen size yet. */ + unsigned width = gl->screen_width + ? gl->screen_width : gl->video_width; + unsigned height = gl->screen_height + ? gl->screen_height : gl->video_height; float inv_tex_size_x = 1.0f / font->tex_width; float inv_tex_size_y = 1.0f / font->tex_height; - float inv_win_width = 1.0f / gl->vp.width; - float inv_win_height = 1.0f / gl->vp.height; + float inv_win_width; + float inv_win_height; + /* setup_viewport may change gl->vp, so capture inv_win_width/height + * AFTER it runs — otherwise the vertex math uses one viewport while + * the actual glViewport is another, producing stretched/squished + * text. The block path defers setup_viewport to flush time and uses + * gl->vp as-is. */ if (!font->block) gl1_raster_font_setup_viewport(gl, width, height, font, full_screen); + inv_win_width = 1.0f / gl->vp.width; + inv_win_height = 1.0f / gl->vp.height; if (msg && *msg && font->font_data && font->font_driver) diff --git a/gfx/drivers/metal.m b/gfx/drivers/metal.m index ed817bd92552..33ca2653636b 100644 --- a/gfx/drivers/metal.m +++ b/gfx/drivers/metal.m @@ -4300,7 +4300,7 @@ - (void)drawWithEncoder:(id)rce - (void)drawWithContext:(Context *)ctx { - int i; + size_t i; _texture = _engine.frame.texture[0].view; if ( (_format != RPixelFormatBGRA8Unorm) @@ -4938,7 +4938,7 @@ - (bool)loadImages:(const struct texture_image *)images count:(NSUInteger)count - (void)drawWithEncoder:(id)rce { - int i; + size_t i; NSUInteger count; #if !defined(HAVE_COCOATOUCH) if (_vertDirty) diff --git a/gfx/drivers_context/cocoa_gl_ctx.m b/gfx/drivers_context/cocoa_gl_ctx.m index 9c9751a4f5cd..a3ae9dbcbb3b 100644 --- a/gfx/drivers_context/cocoa_gl_ctx.m +++ b/gfx/drivers_context/cocoa_gl_ctx.m @@ -380,8 +380,10 @@ static bool cocoa_gl_gfx_ctx_set_video_mode(void *data, CocoaView *g_view = (CocoaView*)nsview_get_ptr(); #endif cocoa_ctx_data_t *cocoa_ctx = (cocoa_ctx_data_t*)data; +#ifndef HAVE_COCOA_METAL static bool has_went_fullscreen = false; +#endif cocoa_ctx->width = width; cocoa_ctx->height = height; @@ -605,9 +607,9 @@ static bool cocoa_gl_gfx_ctx_set_video_mode(void *data, [[g_view window] setContentSize:NSMakeSize(width, height)]; } -#endif has_went_fullscreen = fullscreen; +#endif return true; } diff --git a/gfx/drivers_context/cocoa_vk_ctx.m b/gfx/drivers_context/cocoa_vk_ctx.m index 462754ab1984..60c5e36b5bc7 100755 --- a/gfx/drivers_context/cocoa_vk_ctx.m +++ b/gfx/drivers_context/cocoa_vk_ctx.m @@ -182,7 +182,7 @@ static void cocoa_vk_gfx_ctx_swap_interval(void *data, int i) unsigned interval = (unsigned)i; cocoa_vk_ctx_data_t *cocoa_ctx = (cocoa_vk_ctx_data_t*)data; - if (cocoa_ctx->swap_interval != interval) + if (cocoa_ctx->swap_interval != (int)interval) { cocoa_ctx->swap_interval = interval; if (cocoa_ctx->vk.swapchain) diff --git a/libretro-common/include/net/net_http.h b/libretro-common/include/net/net_http.h index 14fa8f9ec0f2..98ffad267e94 100644 --- a/libretro-common/include/net/net_http.h +++ b/libretro-common/include/net/net_http.h @@ -103,7 +103,9 @@ bool net_http_error(struct http_t *state); * * @return the response headers. The returned buffer is owned by the * caller of net_http_new; it is not freed by net_http_delete. - * If the status is not 20x and accept_error is false, it returns NULL. + * On a transport error, NULL is returned unless accept_error is true. + * Headers are returned for any response that was parsed successfully, + * including HTTP error statuses such as 401 (needed for auth challenges). **/ struct string_list *net_http_headers(struct http_t *state); struct string_list *net_http_headers_ex(struct http_t *state, bool accept_error); diff --git a/libretro-common/net/net_http.c b/libretro-common/net/net_http.c index ef2fa0346703..a6ffa9332526 100644 --- a/libretro-common/net/net_http.c +++ b/libretro-common/net/net_http.c @@ -1383,7 +1383,7 @@ static ssize_t net_http_receive_header(struct http_t *state, ssize_t len) { len = response->pos; response->pos = 0; - if (response->bodytype == T_LEN) + if (response->bodytype == T_LEN && response->len > 0) { /* Use a tmp pointer so a realloc failure does not leak the * original buffer AND leave response->data NULL for later @@ -1428,7 +1428,7 @@ static bool net_http_receive_body(struct http_t *state, ssize_t newlen) if (response->bodytype != T_FULL) return false; response->part = P_DONE; - if (response->buflen != response->len) + if (response->buflen != response->len && response->len > 0) { /* Shrink response->data from buflen bytes to len bytes. * Use a tmp pointer so a realloc() failure (rare on shrink @@ -1535,7 +1535,7 @@ static bool net_http_receive_body(struct http_t *state, ssize_t newlen) else if (response->pos == response->len) { response->part = P_DONE; - if (response->buflen != response->len) + if (response->buflen != response->len && response->len > 0) { char *tmp = (char*)realloc(response->data, response->len); if (!tmp) @@ -1804,13 +1804,15 @@ int net_http_status(struct http_t *state) * * @return the response headers. The returned buffer is owned by the * caller of net_http_new; it is not freed by net_http_delete(). - * If the status is not 20x and accept_err is false, it returns NULL. + * On a transport error, NULL is returned unless accept_err is true. + * Headers are returned for any response that was parsed successfully, + * including HTTP error statuses such as 401 (needed for auth challenges). **/ struct string_list *net_http_headers_ex(struct http_t *state, bool accept_err) { if (!state) return NULL; - if (!accept_err && !state->err) + if (!accept_err && state->err) return NULL; return state->response.headers; } diff --git a/qb/config.libs.sh b/qb/config.libs.sh index a9966fb96721..73d4b2c0ad34 100644 --- a/qb/config.libs.sh +++ b/qb/config.libs.sh @@ -42,6 +42,8 @@ if [ "$OS" = 'BSD' ]; then [ -d /usr/local/include ] && add_dirs INCLUDE /usr/local/include [ -d /usr/local/lib ] && add_dirs LIBRARY /usr/local/lib DYLIB=-lc; +elif [ "$OS" = 'Darwin' ]; then + DYLIB= elif [ "$OS" = 'Haiku' ]; then DYLIB="" CLIB=-lroot diff --git a/ui/drivers/cocoa/cocoa_common.h b/ui/drivers/cocoa/cocoa_common.h index de713d393067..4a9ed2fece69 100644 --- a/ui/drivers/cocoa/cocoa_common.h +++ b/ui/drivers/cocoa/cocoa_common.h @@ -115,7 +115,7 @@ void get_ios_version(int *major, int *minor); #endif #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 140000 -@property(nonatomic,readwrite) CADisplayLink *displayLink API_AVAILABLE(macos(14.0)); +@property(nonatomic,readwrite,retain) CADisplayLink *displayLink API_AVAILABLE(macos(14.0)); #endif @end diff --git a/ui/drivers/ui_cocoa.m b/ui/drivers/ui_cocoa.m index d5627d2f16ad..a9f6ca23a53d 100644 --- a/ui/drivers/ui_cocoa.m +++ b/ui/drivers/ui_cocoa.m @@ -681,7 +681,7 @@ - (void)dealloc - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { - unsigned i; + int i; apple_platform = self; [self.window setAcceptsMouseMovedEvents: YES];