diff --git a/docs/ACTIVE.md b/docs/ACTIVE.md index 5d658e0..6d85454 100644 --- a/docs/ACTIVE.md +++ b/docs/ACTIVE.md @@ -4,46 +4,40 @@ _Updated: 2026-09-19_ ## Now -**Owner confirms XMB crashes and periodic stutter are fixed.** -Landing on `main` with current logging unchanged. Details: `docs/XMB_LIST_SAFETY.md`. -Acceptance and build evidence: `evidence/xmb-safe-list-run/`. +**Owner accepted the thumbnail and configuration-reset fixes: “Perfect. Commit”.** +Landing on `main`; evidence: `evidence/thumbnail-input-defaults/`. +Details and regression checks: `docs/THUMBNAIL_INPUT_DEFAULTS.md`. -- Tested diagnostic: `88d30106ce625e783e899c97ddeab43d4ca16949ddd98cfb129a06190e0c4ec6`. - Owner ran it manually and reports brief hitches roughly every five seconds. - Read-only capture: `klog/xmb-stutter-20260919-200720/`; sanitized evidence: - `evidence/xmb-safe-list-run/`. No launch or kill was sent by the agent. -- The matching 55.422-second session has zero allocation failures/dropped records, - zero failed image creations or queue-idle calls, and clean frontend/native quit. - First sample includes 7,385 compact XMB nodes and 7,386 callbacks. Native peak - is 6,518,064 requested bytes; tracked mapped allocations return to zero at exit. - Frontend ERROR lines and trace GPU API failure/refusal records are zero. -- Post-run kernel collection includes backlog; it is not a full launch-to-exit - capture. Repeated native dlopen failures at Vulkan init are the existing - libvulkan.so.1/libvulkan.so probes, followed by the statically linked entry point. -- Diagnostic tick runs before presentation: every five seconds it holds the - observer mutex, scans 131,072 slots and synchronously writes summary/caller rows. - This matches the reported hitch cadence; exact stall duration was not measured. -- Normal identity: `2d0743abbcf289efd0a549929d25ce7512968fc93cba8163467fdd3641c8fcf6`. - PS5_MEMORY_DIAGNOSTICS=0; all five gates pass, 71 tests, 278/278 sources. ELF - inspection confirms observer functions/hooks absent and safe allocator present. - `klog/xmb-normal/` preserves exact artifacts, gate log and inspection. - Uploaded/readback verified; config preserved; no launch. Capture: - `klog/xmb-normal-upload-20260919-201708/`. -- All four saved driver archives match the tested diagnostic. Mesa utility object - bytes differ only in debug compilation-directory information; stripping debug - info makes all three byte-identical. PS5_Vulkan source remains unchanged. -- Accepted changes: nodes 15,488 -> 96 bytes, visible-only optional icon paths, - reclaimable mapped node/callback slabs, checked append/prepend/copy operations, - first-failure population stop and retry reset on clear. Shared patched headers - participate in the full frontend build fingerprint. No driver sources changed. -- Diagnostic passed all five gates, 71 tests, 278/278 frontend sources. Exact ELF, - map, title, manifest, archive hashes and log: `klog/xmb-safe-lists/`. - Linked libps5vk is 11ff0f410c80 (older crash used 8c2a1c46a38e). -- Owner confirmed the normal build fixed the hitches and requested the commit. - No new normal-run logs were captured; this acceptance is the owner observation. - RetroArch.log, trace and passive klog remain; the observer stays opt-in. - Broader RGUI/XMB and game/menu visual checks remain useful follow-ups. - The separate unsafe driver error logger under genuine OOM is not fixed here. +- Async image loading discarded the requested RGBA flag; patch 0081 preserves it. + Gameplay pixels and saved PNG encoding are unchanged. +- Compiled input was ps5 but joypad default was null; patch 0082 selects ps5. + Reset also clears auto-binds without recreating the driver, so the next pad poll + now reannounces the connected controller once to restore the built-in profile. +- Three regression tests failed before the fixes; all four focused tests pass + afterward, including native-pad recovery without new samples or a device reopen. +- All five gates pass: 74 tests, 278 frontend sources; normal diagnostics mode. + Identity: `e11018a79a62ce91fa723deaad6939c1e48a47bace21b3527ae84f4452148451`. + Exact artifacts/gate logs: `klog/thumbnail-input-build/`; sanitized host report + in evidence/thumbnail-input-defaults/. Driver archives and Mesa utility objects + match the accepted normal XMB build. Logging and PS5_Vulkan unchanged. +- Uploaded eboot only after idle checks, runtime identity read back, live config + unchanged. Capture: `klog/thumbnail-input-upload-20260919-205531/`. Saved joypad + selection was empty (automatic), not null; no configuration repair was needed. + No launch/kill sent. Owner accepted the fixes after deployment. No fresh console + logs or individual checklist results were captured; acceptance is owner observation. + +## Accepted XMB baseline + +`601e575` fixed large-list allocation failures; `6b857a9` merged the remote README. +Owner confirmed crash-free navigation, then normal build removed five-second hitches. +Normal identity: `2d0743abbcf289efd0a549929d25ce7512968fc93cba8163467fdd3641c8fcf6`. +Both build modes passed all five gates and 71 tests; current logging was retained. +Evidence: `evidence/xmb-safe-list-run/`; detail: `docs/XMB_LIST_SAFETY.md`. +Diagnostic capture had zero allocation failures/drops/image or idle failures, +zero frontend ERROR/GPU refusals and clean quit. Native requested peak: 6,518,064 +bytes. Kernel capture was post-run backlog, not a full launch-to-exit recording. +Normal acceptance was owner observation, without a fresh normal-run log capture. +The unsafe driver error logger under arbitrary OOM remains outside the frontend fix. ## Failure being addressed diff --git a/docs/PHASE_LOG.md b/docs/PHASE_LOG.md index d8a7b3b..2b966ba 100644 --- a/docs/PHASE_LOG.md +++ b/docs/PHASE_LOG.md @@ -2574,3 +2574,39 @@ latencies are claimed. The unsafe driver logger under arbitrary OOM remains outs this frontend fix. Sanitized evidence: evidence/xmb-safe-list-run/. Replay with `bash tools/verify.sh format evidence`; runtime and current logging are unchanged since the accepted normal build. + + +## 2026-09-19 — Thumbnail channel order and input after configuration reset + +Owner reported swapped save-state thumbnail colours and loss of input after Reset +to Defaults. Patch 0081 preserves the asynchronous image task's supports_rgba flag, +so decoded pixels match the Vulkan menu texture upload format. Gameplay conversion, +PNG encoding and synchronous asset loading are unchanged. Patch 0082 defaults the +joypad backend to ps5 (input already did), and asks the connected controller to +announce itself again after a live reset clears auto-binds. The next poll restores +profile discovery once without reopening the device or requiring a new pad sample. +Logging and PS5_Vulkan sources are unchanged. + +Three executable regressions were seen failing before the fixes: wrong red pixel, +null joypad default, and absent binding refresh. Focused image/default/input tests +pass afterward. Full verification used: +`PS5_MEMORY_DIAGNOSTICS=0 PS5_VULKAN_DIR="$PWD/build/xmb-normal-vulkan" bash tools/verify.sh`. +All five gates passed, with 74 tests, 278 frontend sources and 179 patch edits. The +first full attempt failed the old four-edit configuration.c inventory; it now counts +the added joypad-default edit as the fifth. Total inventory grows from 176 to 179. +No new SDK, dependency, compiler flag or version pin is introduced. The existing +archive override retains the accepted XMB driver inputs; all four archives and +three Mesa utility objects match that build. + +Identity: e11018a79a62ce91fa723deaad6939c1e48a47bace21b3527ae84f4452148451. +Exact ELF/map/title/manifest and gate/regression logs: klog/thumbnail-input-build/. +Eboot-only upload: klog/thumbnail-input-upload-20260919-205531/. Idle was checked, +runtime identity was read back, and live configuration remained byte-identical. +Saved input was ps5 with automatic joypad selection, so no config repair was needed. +No agent launch or kill was sent. Owner subsequently replied “Perfect. Commit”. +This is acceptance of the reported fixes; individual checklist results and fresh +runtime/kernel logs were not captured, so no new log-health claim is made. + +Evidence: evidence/thumbnail-input-defaults/ (source/artifact hashes, sanitized +machine deployment report, owner acceptance). Replay: `bash tools/verify.sh format evidence`. +Future manual checks and scope: docs/THUMBNAIL_INPUT_DEFAULTS.md. diff --git a/docs/THUMBNAIL_INPUT_DEFAULTS.md b/docs/THUMBNAIL_INPUT_DEFAULTS.md new file mode 100644 index 0000000..6bcae9f --- /dev/null +++ b/docs/THUMBNAIL_INPUT_DEFAULTS.md @@ -0,0 +1,79 @@ +# Thumbnail colours and configuration reset + +The owner reported swapped save-state thumbnail colours and loss of input after +Reset to Defaults, then confirmed the uploaded fixes with “Perfect. Commit”. +Build, deployment and acceptance evidence: `evidence/thumbnail-input-defaults/`. +Uploads are authorized; do not launch or interrupt a title without owner intervention. + +## Findings and changes + +- The asynchronous image task receives `supports_rgba` but initializes its texture + with false. Its completion conversion consequently leaves ARGB words unchanged, + while this port's Vulkan texture uploader consumes RGBA bytes. Patch 0081 passes + the requested flag into the image. PNG files/core framebuffer formats and the + synchronous asset loader are unchanged. Existing correctly saved thumbnails + should display correctly when loaded again; no file rewriting is needed. +- Compiled input defaults already select ps5, but joypad defaults select null. + Patch 0082 selects ps5 for the joypad default as well. +- Reset to Defaults clears auto-binds and device identity without restarting input. + The driver remembers its connected pad and would not announce it again. The reset + command now marks that announcement stale; the next poll re-requests the built-in + controller profile once, even with no fresh native pad sample. This avoids a full + driver teardown or per-frame autoconfiguration tasks. +- No PS5_Vulkan edits or logging changes. Build against the previously accepted + four driver archives in build/xmb-normal-vulkan through the existing override. + No new dependency, toolchain option or source pin is introduced. + +## Host checks + +`python3 -m unittest tests.test_thumbnail_defaults tests.test_input_ps5 -v` +executes the real task initializer, upload callback and pixel conversion with +stubbed file decode/scheduling. Known red, blue and partially transparent pixels +must match both RGBA and the existing non-RGBA path. It executes the compiled +default selectors and the Reset to Defaults command arm. Native input mocks verify +one reannouncement with no reopen, including no new sample and no active driver. + +All three new regressions were observed failing before the fixes: wrong red pixel, +null joypad default, and absent binding refresh. All four focused tests now pass. +Patch inventory grows from 176 to 179 edits, including a fifth configuration.c +edit for the joypad default. The first full run stopped on the old four-edit +configuration inventory assertion; that expected count now includes the added +default. All 74 host tests pass. Full verification command: + +``` +PS5_MEMORY_DIAGNOSTICS=0 PS5_VULKAN_DIR="$PWD/build/xmb-normal-vulkan" bash tools/verify.sh +``` + +## Regression checklist + +Preserve old logs, live config, and the exact ELF/map/build identity before upload. +Check console idle, upload the verified eboot only, read back runtime identity and +confirm live config unchanged. Start passive klog before the owner launches. + +1. Load a game with recognizable red/blue colours; save a state and inspect its + thumbnail. Revisit an existing thumbnail and confirm both match gameplay. +2. Return to XMB; use Configuration File -> Reset to Defaults. Immediately check + buttons and left-stick navigation, then input binding capture. +3. Save the reset defaults and restart manually. Confirm native input still works. +4. Confirm gameplay and Close Content/menu colours remain correct. + +Collect retroarch.log/trace/klog for each run and match the uploaded identity. +No console success is claimed by the host tests; no launch is authorized by this plan. + +## Verified build and upload + +All five gates passed: format, 74 host tests, build (278 frontend sources), +integration (74 tests and manifest) and 30 replayed evidence captures. Normal +identity: `e11018a79a62ce91fa723deaad6939c1e48a47bace21b3527ae84f4452148451`. +Exact ELF/map/title/manifest/logs: klog/thumbnail-input-build/; host-report.json +in `evidence/thumbnail-input-defaults/` records their hashes. The same four driver archives and all three Mesa +utility objects match the previously accepted normal XMB build. The expensive +memory observer is absent and the reset hook is linked into the frontend/title. + +Upload: klog/thumbnail-input-upload-20260919-205531/. Console idle checked before +upload; runtime identity read back; only eboot replaced. Live configuration is +byte-identical. Its input backend is ps5 and joypad selection is empty (automatic), +so no stale null selection needed repair. No title launch or kill was sent. +Owner confirmation accepts the reported fixes. Individual checklist results were +not separately reported, and no fresh console logs were captured after acceptance. +Existing logs/settings were preserved. diff --git a/evidence/thumbnail-input-defaults/capture.json b/evidence/thumbnail-input-defaults/capture.json new file mode 100644 index 0000000..ab5ed3e --- /dev/null +++ b/evidence/thumbnail-input-defaults/capture.json @@ -0,0 +1,16 @@ +{ + "step": "thumbnail-input-defaults", + "revision": "6b857a9 plus changes identified by host-report.json source hashes", + "build_identity": "e11018a79a62ce91fa723deaad6939c1e48a47bace21b3527ae84f4452148451", + "command": "PS5_MEMORY_DIAGNOSTICS=0 PS5_VULKAN_DIR=\"$PWD/build/xmb-normal-vulkan\" bash tools/verify.sh", + "raw_capture": "klog/thumbnail-input-upload-20260919-205531/report.json", + "lines": [ + "All five gates passed; 74 tests; 278 frontend sources; 179 patch edits.", + "Async thumbnail conversion preserves requested RGBA order; non-RGBA conversion also passes.", + "Compiled input and joypad defaults select ps5; reset restores auto-binding discovery on next poll.", + "Three regression tests failed before the fix and pass afterward.", + "Uploaded executable runtime identity verified; configuration unchanged; no agent launch or kill.", + "Owner response after deployment: Perfect. Commit", + "Acceptance is owner confirmation; no fresh console logs or separately reported checklist results." + ] +} diff --git a/evidence/thumbnail-input-defaults/deployment.json b/evidence/thumbnail-input-defaults/deployment.json new file mode 100644 index 0000000..49ca3cf --- /dev/null +++ b/evidence/thumbnail-input-defaults/deployment.json @@ -0,0 +1,9 @@ +{ + "utc": "2026-09-20T00:55:42.288413+00:00", + "uploaded": "eboot.bin", + "runtime_identity_verified": true, + "configuration_unchanged": true, + "launched": false, + "local_sha256": "aca3f171a2b7d553d5fd035424c53d17b58d4d97bd300659d26e8aefb0c4630a", + "served_sha256": "3c3b05f79c1568608585251a558f25e4a2d9b6a0e924d793d31f3c93085850fa" +} diff --git a/evidence/thumbnail-input-defaults/expectation.json b/evidence/thumbnail-input-defaults/expectation.json new file mode 100644 index 0000000..33cb222 --- /dev/null +++ b/evidence/thumbnail-input-defaults/expectation.json @@ -0,0 +1,14 @@ +{ + "step": "thumbnail-input-defaults", + "note": "Host regression/build results and machine-verified deployment, with owner acceptance; no new runtime-log assertion.", + "must_contain": [ + "All five gates passed; 74 tests", + "preserves requested RGBA order", + "joypad defaults select ps5", + "configuration unchanged", + "Perfect. Commit", + "no fresh console logs" + ], + "must_not_contain": [], + "human_check": "Owner confirmed the uploaded fixes and requested commit: Perfect. Commit" +} diff --git a/evidence/thumbnail-input-defaults/host-report.json b/evidence/thumbnail-input-defaults/host-report.json new file mode 100644 index 0000000..008828b --- /dev/null +++ b/evidence/thumbnail-input-defaults/host-report.json @@ -0,0 +1,58 @@ +{ + "kind": "host verification and owner acceptance", + "build_identity": "e11018a79a62ce91fa723deaad6939c1e48a47bace21b3527ae84f4452148451", + "command": "PS5_MEMORY_DIAGNOSTICS=0 PS5_VULKAN_DIR=\"$PWD/build/xmb-normal-vulkan\" bash tools/verify.sh", + "returncode": 0, + "gates": [ + "format", + "unit", + "build", + "integration", + "evidence" + ], + "tests": 74, + "frontend_sources": 278, + "patch_edits": 179, + "regressions_observed_before_fix": [ + "async thumbnail red/blue order", + "compiled joypad selected null", + "reset did not request auto-bind refresh" + ], + "first_full_attempt": "unit failure: expected four configuration.c edits, now five; inventory corrected", + "driver_archives": { + "libps5vk.ps5.a": "11ff0f410c80ba99863bca4c5545ed100a49f720a480fc2d5bb312ebcd3969d1", + "libvk_runtime.ps5.a": "4106a2c56b269bc52a3976b6bc0134c00b5006ff5358a4b45355afce4a907aa7", + "libpsbc_driver.ps5.a": "a7605370c28895a3b5a13d0718ebfea2abf1b9cf842633de07533775745b21b8", + "libpsbc_support.ps5.a": "e36d3e2a3fa93b0a74db15b9efce7aad4ed7ac4e024de98d5f23dc5fee90acf8" + }, + "mesa_objects_match_accepted_normal_build": true, + "memory_observer_present": false, + "reset_hook_linked": true, + "raw_artifacts": "klog/thumbnail-input-build/", + "artifact_sha256": { + "llvm-pie.elf": "a4d88f792a52e27a489f3670da013abc16ec6dcd71d0343bd87f530adeeae1e2", + "title.map": "c7e018a007f6f834c426eaa43261558cc0bd74c1e010af30015f1143ed019dee", + "title_build_identity.h": "a0381722ef138d47f3e23917c050ac322e38e9ef7dfd590b9d2cf1aaeac93951", + "eboot.bin": "aca3f171a2b7d553d5fd035424c53d17b58d4d97bd300659d26e8aefb0c4630a", + "manifest.sha256": "3e368f09952578786674131e24c8f4b5f02d68887d63aa241a2b4581040821c1" + }, + "source_sha256": { + "src/input_ps5.cpp": "17f0c7b0706c736ccd41de36246cdda0eaa1cb5c788ebb0c4cd1964c181690b1", + "tools/apply-port-patches.py": "84ffbf56217422537d4400b1555a4a09d1abc2d0dfa9edd0746b6649354f577b", + "tests/test_thumbnail_defaults.py": "5dafbf3d349dcf448db3302d19a91fc073f438b406b6b5acd655588eabd6f784", + "tests/input_ps5_test.cpp": "b5e43ca730c8eccc3e9c2ce6121c8f464f6751b031b52e093adefe4afd275749", + "tests/test_frontend.py": "43e35cab58a8b1444f19888c7fe0f2bc48a97e71f9d486a29c2789a274ee7d3d" + }, + "deployment": { + "raw_capture": "klog/thumbnail-input-upload-20260919-205531/", + "runtime_identity_verified": true, + "configuration_unchanged": true, + "launched": false + }, + "owner_acceptance": { + "quote": "Perfect. Commit", + "scope": "confirmation of the uploaded thumbnail and configuration-reset fixes", + "fresh_console_logs_captured": false, + "individual_checklist_results": "not separately reported" + } +} diff --git a/patches/series b/patches/series index 8f0b95e..95db56f 100644 --- a/patches/series +++ b/patches/series @@ -100,3 +100,9 @@ # Compact XMB nodes, mapped menu objects and checked list construction. 0080-safe-xmb-list-allocations + +# Preserve requested pixel order in asynchronous thumbnail loading. +0081-async-thumbnail-colour-order + +# Native joypad defaults and live auto-binding recovery after reset. +0082-reset-native-input-defaults diff --git a/src/input_ps5.cpp b/src/input_ps5.cpp index 0a5158a..138e94c 100644 --- a/src/input_ps5.cpp +++ b/src/input_ps5.cpp @@ -492,6 +492,14 @@ extern "C" input_driver_t input_ps5 = { nullptr, /* keypress_vibrate */ }; +// Defaults clear RetroArch's auto-binds without recreating the pad driver. +// Reannounce once on the next poll, after all default settings have been applied. +extern "C" void ps5_input_reset_autoconfig() noexcept +{ + if (active_pad) + active_pad->announced = false; +} + extern "C" input_device_driver_t ps5_joypad = { joypad_init, joypad_query, joypad_destroy, joypad_button, joypad_state, joypad_get_buttons, joypad_axis, joypad_poll, nullptr, nullptr, nullptr, nullptr, diff --git a/tests/input_ps5_test.cpp b/tests/input_ps5_test.cpp index 35c0087..95b6af2 100644 --- a/tests/input_ps5_test.cpp +++ b/tests/input_ps5_test.cpp @@ -204,6 +204,12 @@ int main() p = sample(); feed(p); assert(connects == 2); + // A config reset must refresh automatic binds without a physical reconnect. + ps5_input_reset_autoconfig(); + ps5_joypad.poll(); // No new samples; the connected sample is retained. + assert(connects == 3 && opens == 1 && ps5_joypad.query_pad(0)); + ps5_joypad.poll(); + assert(connects == 3); // No per-frame announcement/task storm. read_result = -1; ps5_joypad.poll(); assert(!ps5_joypad.query_pad(0) && mapped(RETRO_DEVICE_ID_JOYPAD_MASK) == 0); @@ -219,6 +225,7 @@ int main() assert(ps5_joypad.init(input)); ps5_joypad.destroy(); assert(opens == 2 && closes == 2); + ps5_input_reset_autoconfig(); // Safe before/after driver lifetime. std::puts( "PS5 joypad: raw binding capture, axes, user mappings, poll retention and lifecycle PASS"); } diff --git a/tests/test_frontend.py b/tests/test_frontend.py index a5221ef..e955c42 100644 --- a/tests/test_frontend.py +++ b/tests/test_frontend.py @@ -300,7 +300,7 @@ class PortPatches(unittest.TestCase): change deliberately, in a commit that says why. """ self.assertEqual( - len(self.blocks()), 176, + len(self.blocks()), 179, "the patch count changed: if a block was added or removed on purpose, " "update this number in the same commit and say why in its message") @@ -310,8 +310,8 @@ class PortPatches(unittest.TestCase): for edit in edits: per_file[edit[0]] = per_file.get(edit[0], 0) + 1 self.assertEqual( - per_file.get("configuration.c"), 4, - f"configuration.c should carry four distinct edits (audio, asset path, input default and " + per_file.get("configuration.c"), 5, + f"configuration.c should carry five distinct edits (audio, asset path, input and joypad defaults, and " f"the video default); counts are {per_file}") self.assertEqual( per_file.get("input/input_driver.c"), 4, diff --git a/tests/test_thumbnail_defaults.py b/tests/test_thumbnail_defaults.py new file mode 100644 index 0000000..bc34858 --- /dev/null +++ b/tests/test_thumbnail_defaults.py @@ -0,0 +1,89 @@ +"""Execute upstream async-image conversion and platform default selectors. + +File decoding/task scheduling are stubs; real task initialization and decoded +pixel conversion must preserve the renderer's channel contract. +""" +from pathlib import Path +import re +import subprocess +import tempfile +import unittest +from tests.test_xmb_safe_lists import patched, probe, ROOT + + +class ThumbnailDefaults(unittest.TestCase): + def run_c(self, program): + with tempfile.TemporaryDirectory() as td: + source = Path(td, 'probe.c') + source.write_text(program) + binary = Path(td, 'probe') + subprocess.run(['cc', '-std=gnu11', '-O1', '-g', + '-Ivendor/retroarch', '-Ivendor/retroarch/libretro-common/include', + str(source), '-o', str(binary)], cwd=ROOT, check=True) + subprocess.run([str(binary)], check=True, timeout=15) + + def test_async_thumbnail_channel_order(self): + task = patched('tasks/task_image.c') + image = patched('libretro-common/formats/image_texture.c') + structs = task[task.index('enum image_status_enum'):task.index('static int cb_image_upload_generic')] + self.run_c(r''' +#include +#include +#include +#include +#include +#include "tasks/task_file_transfer.h" +static retro_task_t *queued; +retro_task_t *task_init(void) { return calloc(1, sizeof(retro_task_t)); } +bool task_queue_push(retro_task_t *t) { queued=t; return true; } +static void task_file_load_handler(retro_task_t *t) { (void)t; } +static void task_image_load_free(retro_task_t *t) { (void)t; } +static int cb_nbio_image_thumbnail(void *p,size_t n) { (void)p;(void)n;return 0; } +enum image_type_enum image_texture_get_type(const char *p) { (void)p;return IMAGE_TYPE_PNG; } +''' + structs + '\n' + '\n'.join([ + probe.function(image, 'image_texture_set_color_shifts'), + probe.function(image, 'image_texture_color_convert'), + probe.function(task, 'cb_image_upload_generic'), + probe.function(task, 'task_push_image_load')]) + r''' +int main(void) { + for(unsigned rgba=0;rgba<2;rgba++) { + assert(task_push_image_load("test.state.png",rgba,0,NULL,NULL)); + nbio_handle_t *nbio=queued->state; + struct nbio_image_handle *im=nbio->data; + /* The decoder outputs ARGB words. Include red, blue and partial alpha. */ + uint32_t pixels[]={0xffff0000,0xff0000ff,0x7f123456}; + im->ti.pixels=pixels; im->ti.width=3;im->ti.height=1; + im->processing_final_state=IMAGE_PROCESS_END; + assert(cb_image_upload_generic(nbio,0)==0); + assert(pixels[0]==(rgba?0xff0000ff:0xffff0000)); + assert(pixels[1]==(rgba?0xffff0000:0xff0000ff)); + assert(pixels[2]==(rgba?0x7f563412:0x7f123456)); + assert(im->ti.supports_rgba==(bool)rgba); + free(nbio->path);free(im);free(nbio);free(queued); + } +} +''') + + def test_compiled_input_defaults(self): + source = patched('configuration.c') + funcs = [probe.function(source, 'config_get_default_' + name) for name in ('input', 'joypad')] + enums = [] + for name, body in zip(('input', 'joypad'), funcs): + values = sorted(set(re.findall(r'case (\w+):', body))) + enums.append('enum ' + name + '_driver_enum {' + ','.join(values) + '};') + self.run_c('#include \n#include \n' + '\n'.join(enums) + + '\n#define INPUT_DEFAULT_DRIVER INPUT_NULL\n#define JOYPAD_DEFAULT_DRIVER JOYPAD_NULL\n' + + '\n'.join(funcs) + '\nint main(void) { assert(!strcmp(config_get_default_input(),"ps5"));' + 'assert(!strcmp(config_get_default_joypad(),"ps5")); }') + + def test_reset_reannounces_connected_controller(self): + source = patched('retroarch.c') + start = source.index(' case CMD_EVENT_MENU_RESET_TO_DEFAULT_CONFIG:') + end = source.index(' case CMD_EVENT_MENU_SAVE_CURRENT_CONFIG:', start) + self.run_c('#include \nstatic int reset,refresh;\n' + 'void *global_get_ptr(void) { return 0; }\n' + 'void config_set_defaults(void *p) { (void)p;reset++; }\n' + 'void ps5_input_reset_autoconfig(void) { assert(reset);refresh++; }\n' + '#define CMD_EVENT_MENU_RESET_TO_DEFAULT_CONFIG 1\n' + 'int main(void) { switch(1) {\n' + source[start:end] + + '} assert(reset==1 && refresh==1); }') diff --git a/tools/apply-port-patches.py b/tools/apply-port-patches.py index 0a48b2e..a9fc4f9 100755 --- a/tools/apply-port-patches.py +++ b/tools/apply-port-patches.py @@ -2425,6 +2425,9 @@ EDITS = [ ('menu/menu_driver.c', 'static menu_list_t *menu_list_new(const menu_ctx_driver_t *menu_driver_ctx)\n{\n unsigned i;\n menu_list_t *list = (menu_list_t*)malloc(sizeof(*list));\n\n if (!list)\n return NULL;\n\n list->menu_stack_size = 1;\n list->selection_buf_size = 1;\n list->selection_buf = NULL;\n list->menu_stack = (file_list_t**)\n calloc(list->menu_stack_size, sizeof(*list->menu_stack));\n\n if (!list->menu_stack)\n goto error;\n\n list->selection_buf = (file_list_t**)\n calloc(list->selection_buf_size, sizeof(*list->selection_buf));\n\n if (!list->selection_buf)\n goto error;\n\n for (i = 0; i < list->menu_stack_size; i++)\n {\n list->menu_stack[i] = (file_list_t*)\n malloc(sizeof(*list->menu_stack[i]));\n list->menu_stack[i]->list = NULL;\n list->menu_stack[i]->capacity = 0;\n list->menu_stack[i]->size = 0;\n }\n\n for (i = 0; i < list->selection_buf_size; i++)\n {\n list->selection_buf[i] = (file_list_t*)\n malloc(sizeof(*list->selection_buf[i]));\n list->selection_buf[i]->list = NULL;\n list->selection_buf[i]->capacity = 0;\n list->selection_buf[i]->size = 0;\n }\n\n return list;\n\nerror:\n menu_list_free(menu_driver_ctx, list);\n return NULL;\n}', '/* patches/series, 0080: initialize and check list containers */\nstatic menu_list_t *menu_list_new(const menu_ctx_driver_t *menu_driver_ctx)\n{\n unsigned i;\n menu_list_t *list = (menu_list_t*)malloc(sizeof(*list));\n\n if (!list)\n return NULL;\n\n list->menu_stack_size = 1;\n list->selection_buf_size = 1;\n list->selection_buf = NULL;\n list->menu_stack = (file_list_t**)\n calloc(list->menu_stack_size, sizeof(*list->menu_stack));\n\n if (!list->menu_stack)\n goto error;\n\n list->selection_buf = (file_list_t**)\n calloc(list->selection_buf_size, sizeof(*list->selection_buf));\n\n if (!list->selection_buf)\n goto error;\n\n for (i = 0; i < list->menu_stack_size; i++)\n {\n list->menu_stack[i] = (file_list_t*)calloc(1, sizeof(*list->menu_stack[i]));\n if (!list->menu_stack[i])\n goto error;\n }\n\n for (i = 0; i < list->selection_buf_size; i++)\n {\n list->selection_buf[i] = (file_list_t*)calloc(1, sizeof(*list->selection_buf[i]));\n if (!list->selection_buf[i])\n goto error;\n }\n\n return list;\n\nerror:\n menu_list_free(menu_driver_ctx, list);\n return NULL;\n}', 'patches/series, 0080: initialize and check list containers'), ('menu/menu_displaylist.c', ' /* Preallocate the file list */\n file_list_reserve(info_list, list_size);', ' /* patches/series, 0080: checked playlist preallocation */\n if (info_list->capacity < list_size && !file_list_reserve(info_list, list_size))\n {\n info_list->allocation_failed = true;\n RARCH_ERR("[Menu] Playlist list allocation failed; population stopped.\\n");\n return 0;\n }', 'patches/series, 0080: checked playlist preallocation'), ('menu/menu_displaylist.c', ' for (i = 0; i < list_size; i++)\n {\n char menu_entry_lbl[NAME_MAX_LENGTH];', ' /* patches/series, 0080: stop playlist at first rejected entry */\n for (i = 0; i < list_size && !info_list->allocation_failed; i++)\n {\n char menu_entry_lbl[NAME_MAX_LENGTH];', 'patches/series, 0080: stop playlist at first rejected entry'), + ('tasks/task_image.c', " /* TODO/FIXME - shouldn't we set this ? */\n image->ti.supports_rgba = false;", ' /* patches/series, 0081: async images honor the renderer channel order. */\n image->ti.supports_rgba = supports_rgba;', 'patches/series, 0081: async images'), + ('configuration.c', ' case JOYPAD_NULL:\n break;', ' case JOYPAD_NULL:\n /* patches/series, 0082: native joypad survives configuration reset. */\n return "ps5";', 'patches/series, 0082: native joypad'), + ('retroarch.c', ' case CMD_EVENT_MENU_RESET_TO_DEFAULT_CONFIG:\n config_set_defaults(global_get_ptr());\n break;', ' case CMD_EVENT_MENU_RESET_TO_DEFAULT_CONFIG:\n {\n /* patches/series, 0082: resetting defaults also clears auto-binds. */\n extern void ps5_input_reset_autoconfig(void);\n config_set_defaults(global_get_ptr());\n ps5_input_reset_autoconfig();\n break;\n }', 'patches/series, 0082: resetting defaults'), ]