mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-24 11:49:05 +02:00
naett has had a complete libcurl backend all along; we just never built it, so Linux ran with HTTPS_NOT_AVAILABLE. That means no homebrew store over HTTPS, and RetroAchievements talking to plain http://retroachievements.org. libcurl is loaded with dlopen rather than linked, the same way we handle the Vulkan loader, so it stays a soft dependency: we need the curl headers at build time, but a build made here still starts on a machine without libcurl installed - it just reports HTTPS as unavailable, exactly like today. Distro packagers get the behavior they'd expect either way, and certificate validation comes free from the system CA store. New net::HTTPSAvailable() answers "did that work", and SDLMain folds it into SYSPROP_SUPPORTS_HTTPS, which everything downstream already degrades on. Four fixes to the backend itself, all noted in ext/naett/README-ppsspp.md: - panic() called exit(1) on a pipe or curl_multi_perform failure. Taking the emulator down because a download failed isn't acceptable - the backend now disables itself and requests complete with naettGenericError. - CURLINFO_RESPONSE_CODE writes a long into res->code, which is an int. Eight bytes into four, getting away with it only because the next field absorbs the zeroes. - curl_easy_setopt is varargs and wants a long for these options; int literals and int variables are UB on LP64. - naettPlatformCloseResponse called through a null function pointer when libcurl was missing. Found by testing that path, which segfaulted. CI needs libcurl4-openssl-dev (curl-dev on Alpine) or it would quietly keep building without HTTPS.
2.1 KiB
2.1 KiB
naett in PPSSPP
Vendored copy of naett by Erik Agsjö (MIT licensed, see LICENSE).
Upstream version: v0.3.3 (5f695cfa9fcbf30668a4d3ac4b4abf1cd89a1302, 2024-04-13)
This used to be a git submodule. It's now in-tree because upstream has been dormant since April 2024 and we need to carry local changes (see below). It's ~1500 lines of C, which is smaller than several other things we already vendor.
Local changes
Keep this list up to date - it's what makes it possible to move to a newer upstream later.
- Dropped the generated single-file amalgam (
naett.c) andsrc/amalgam.h, along withexample/andtestrig/. We buildsrc/*.cdirectly, so that the file you edit is the file that gets compiled. src/naett_internal.h: added#include "../naett.h". The amalgam includednaett.hahead of everything else; building the sources directly, each one needs it.src/naett_linux.c: added#include <stdio.h>/#include <stdlib.h>. It usesexit/calloc/realloc/free/fprintfbut never included either header - in the amalgam it got them fromnaett_core.cfurther up the concatenation. Building it on its own is an error with a modern compiler.src/naett_curl.h/src/naett_curl.c: new, ours. Loads libcurl withdlopeninstead of linking against it, so libcurl stays a soft dependency at runtime.naett_linux.cincludes that header in place of<curl/curl.h>.src/naett_linux.c: replaced thepanic()that calledexit(1)on a pipe orcurl_multi_performfailure. Taking the whole emulator down because a download failed isn't acceptable, so the backend now disables itself and requests complete withnaettGenericError.src/naett_linux.c:CURLINFO_RESPONSE_CODEwrites along, andres->codeis anint- upstream passed&res->codestraight tocurl_easy_getinfo, writing 8 bytes into 4. Reads into alonglocal now.src/naett_linux.c:curl_easy_setoptis varargs and takes alongfor these options; upstream passedintliterals andintvariables, which is UB on LP64 (and what curl's own typecheck macros warn about). They're1L/(long)now.