Files
PS5_RetroArch/tests/test_mgba_video.py
T
Mihawk d2a91b395b Port native mGBA and fix core/menu lifecycle rendering
Build pinned mGBA with this PS5 SDK, official metadata and both GB/GBA engines.
Support validated C initializer arrays, native directory/time imports and an
explicit config path. Map large title/core allocations so GBA archives load.
Correct mGBA callback colours and cached frame ownership, crop padded core
textures during presentation, and use the native shell exit after cleanup.

Verified: bash tools/verify.sh (format, unit, build, integration, evidence;
58 tests), then bash tools/run-title.sh --no-build --core-test=mgba --watch 180.
Owner confirms GB/GBC/GBA loading, correct colours/native Quit, and clean menu
and next game. Final capture has zero Vulkan refusals, GPU failure records or
kernel fatal-signal reports; normal frontend exit occurred before window end.

Evidence: evidence/mgba-native/{capture,expectation,iterations,build,abi}.json,
loader/recovery reports and exact linked-driver hashes. Replay with
bash tools/verify.sh evidence. Final build identity:
82024b89e74bbad4ad2ce2e2916d1a49baf26ac325fef20fc71a2c168b862337.

Patch count is deliberately 139: archive diagnostics, menu/cache ownership and
padded-source sampling edits. PS5_Vulkan was not modified. Saves/states,
long-run timing and a fresh FCEUmm/XMB transition matrix remain unverified.
2026-09-19 16:00:01 -04:00

27 lines
939 B
Python

"""mGBA XBGR must become libretro XRGB without changing the native buffer."""
from pathlib import Path
import subprocess
import tempfile
import unittest
ROOT = Path(__file__).resolve().parent.parent
class MgbaVideo(unittest.TestCase):
def test_native_primary_colours_to_libretro(self):
with tempfile.TemporaryDirectory() as directory:
source = Path(directory) / 'colours.c'
source.write_text('''#include <assert.h>
#include "tooling/mgba/ps5-video.h"
int main(void) {
assert(ps5_mgba_xrgb(0x000000ff) == 0x00ff0000);
assert(ps5_mgba_xrgb(0x0000ff00) == 0x0000ff00);
assert(ps5_mgba_xrgb(0x00ff0000) == 0x000000ff);
assert(ps5_mgba_xrgb(0xab123456) == 0xab563412);
return 0;
}
''')
binary = Path(directory) / 'colours'
subprocess.run(['cc', '-I', str(ROOT), str(source), '-o', str(binary)], check=True)
subprocess.run([str(binary)], check=True)