Cores/Mupen64Plus/PATCHES.md
This document lists all iOS/tvOS-specific patches applied to vendored Mupen64Plus source code. It serves as a porting guide when updating the vendored dependencies.
| Component | Source | Version | Upstream Gap |
|---|---|---|---|
| mupen64plus-core | vendored | v2.5.1 (0x020501) | 424 commits behind (2026-02) |
| GLideN64 | vendored | v2.0.0 (0x020000) | ~854 commits behind provenance_2025 |
| mupen64plus-rsp-hle | vendored | unknown | unknown |
| mupen64plus-rsp-cxd4 | vendored | unknown | unknown |
| mupen64plus-video-rice | vendored | unknown | unknown |
| Mupen64Plus-NX (RetroArch) | real submodule | spm-2024 (388bd4b) | 72 commits behind libretro:develop (2026-03) |
Despite entries in .gitmodules, the source code in Sources/Plugins/Core/Core,
Sources/Plugins/Video/gliden64, etc. is vendored directly as regular files — not
managed as real git submodules. git submodule status will not show these. Any update
requires replacing the files manually and re-applying the patches below.
Only Cores/Mupen64Plus-NX/mupen64plus-libretro-nx is a real git submodule (gitlink).
Sources/PVMupenBridge/These files are entirely Provenance-specific (no upstream equivalent):
vidext.m — Video Extension (iOS/tvOS)The video extension hooks replace the SDL-based windowing system with iOS-native rendering. Key implementations:
VidExt_Init — no-op (iOS manages the GL context lifecycle; returns M64ERR_SUCCESS)VidExt_Quit — sets sActive = 0; not a true no-op (state tracked for VidExt_VideoRunning)VidExt_VideoRunning — returns sActive (1 after VidExt_SetVideoMode, 0 after VidExt_Quit)VidExt_ListFullscreenModes — returns two entries: 640×480 default and current device screen size; note: currently assigns SizeArray to a local stack variable rather than filling the caller-provided buffer — a known bug with no visible impact since GLideN64 ignores the mode listVidExt_SetVideoMode — stores width/height/depth on the bridge object, sets sActive = 1VidExt_GL_GetProcAddress — uses dlsym(RTLD_NEXT, ...) to locate GL symbolsVidExt_GL_SwapBuffers — calls [current swapBuffers] on the bridgeVidExt_GL_SetAttribute / VidExt_GL_GetAttribute — returns M64ERR_UNSUPPORTED (no SDL)VidExt_InFullscreenMode — always returns 1Port requirement: No upstream equivalent. Re-create wholesale when updating. The API is stable (m64p_vidext.h v3.0.0) and unlikely to change.
eventloop.m — Event Loop StubStubs out SDL event loop functions that are not needed on iOS:
event_set_core_defaults, event_initialize — no-opevent_sdl_keydown / event_sdl_keyup — no-op (input handled via bridge)event_gameshark_active / event_set_gameshark — stub (GameShark via cheats API)Port requirement: Check if new event functions were added to main/event.h in upstream.
new_vi_main.m — VI (Vertical Interrupt) HookReplaces main/main.c's new_vi() function to call [current videoInterrupt] on the bridge.
Also applies cheats at boot and every VI as per the cheat API.
Port requirement: Check new_vi() signature in upstream main/main.h for changes.
If g_dev / g_cheat_ctx / g_gs_vi_counter are renamed, update references here.
screenshot.m — Screenshot StubImplements osd/screenshot.h for iOS (likely no-op or writes to app documents).
PVMupenBridge+Mupen.m — Audio and ConfigurationMupenAudioLenChanged — custom audio resampling to 44100 Hz
ringBufferAtIndex:0 for the audio engineMupenAudioSampleRateChanged — forces 44100 Hz sample rateConfigureCore — maps Provenance settings to mupen64plus configConfigureVideoGeneral — screen size from UIWindow boundsConfigureGLideN64 — maps Provenance settings to GLideN64 config
<romFolder>/hires_texture/Port requirement: Verify AUDIO_INFO struct field names, AI_LEN_REG, AI_DRAM_ADDR_REG,
AI_DACRATE_REG in plugin/plugin.h are unchanged. Check ConfigSetParameter signature.
Sources/Plugins/Core/Core/ (mupen64plus-core)From the Provenance-Emu/mupen64plus-core provenance branch (7 commits ahead of upstream master):
src/osal/files_macos.c (or similar)/usr/local/ or system paths; must use app Documentssrc/main/ or src/backends/src/main/main.h or src/main/main.cPROVENANCE guard macro to remove the default new_vi() implementationnew_vi() in new_vi_main.m; having both causes
duplicate-symbol linker errorsSources/Plugins/Video/gliden64/ (GLideN64)From the Provenance-Emu/GLideN64 provenance and provenance_2025 branches:
src/Graphics/OpenGLContext/opengl_TextureManipulationObjectFactory.cppglTexParameteri(GL_TEXTURE_WRAP_S/T) in #if !defined(OS_IOS) && !defined(EMSCRIPTEN) guard;
forces GL_CLAMP_TO_EDGE on iOS/tvOS and Emscripten/WebGL builds, while leaving the
original wrap mode (GL_REPEAT/GL_MIRRORED_REPEAT) on other platforms.GL_CLAMP_TO_EDGE for
non-power-of-two (NPOT) textures. Using GL_REPEAT or GL_MIRRORED_REPEAT on NPOT
textures is undefined and causes rendering artifacts (black textures, GL errors), so the
implementation forces GL_CLAMP_TO_EDGE on those platforms.Provenance-Emu/GLideN64@provenance_2025 commit d0c7c06476int return type for InitiateGFX — ALREADY APPLIEDsrc/CommonPluginAPI.cppEXPORT BOOL CALL InitiateGFX → EXPORT int CALL InitiateGFXBOOL maps to signed char on some platforms; int matches the plugin ABIsrc/osal/osal_files_ios.mmsrc/osal/osal_files_ios.mm/usr/local/ — GLideN64's config/shader cache paths
must point to the app sandbox.src/Log_ios.mm, src/TxDbg_ios.mmsrc/Log_ios.mm, src/TxDbg_ios.mmLog.cpp / TxDbg.cpp.When a future update replaces the vendored source, apply patches in this order:
mupen64plus-core: Apply the 3 patches from Provenance-Emu/mupen64plus-core@provenance
(or cherry-pick onto the new version). The PROVENANCE macro guard for new_vi is critical
— without it the build will fail with a duplicate symbol error.
GLideN64: After replacing files, apply:
glDebugMessageCallback if it exists in the new versionLog_ios.mm, TxDbg_ios.mm, osal/osal_files_ios.mm — these are wholly new filesmupen64plus-video-rice: Verify GLES conditional compilation paths still compile.
Mupen64Plus-NX submodule: Update Cores/Mupen64Plus-NX/mupen64plus-libretro-nx to a
newer commit on Provenance-Emu/mupen64plus-libretro-nx@spm-2024, after the upstream
Provenance fork is rebased onto libretro:develop (72 commits behind as of 2026-03).