// rsrcProbe.c - Phase 3.4 stub-only Resource Manager smoke probe. // // What this verifies right now: // - resourceProbeInit() returns RES_ERR_BLOCKED (the stub-only path), // - iigsLoadResource() returns NULL with err = RES_ERR_BLOCKED, // - iigsGetResourceSize() returns 0 with err = RES_ERR_BLOCKED, // - the runtime resource.o links cleanly under -O2, // - the demo's OMF can be bundled with rsrcBundle.py (post-step in // demos/build.sh when demos/rsrcProbe.rsrc/ is present). // // Marker discipline. Page-1 ($70..$73) per the cursorProbe.c // convention - runViaFinder.sh samples direct-page bytes reliably // across MAME timings, and full-24-bit BSS-style markers (0x025000) // don't survive the Loader/Finder relocation games on GS/OS 6.0.2. // // $70 := 0x99 end-of-main success sentinel // $71 := initRc as int8 (expected 0xff = (uint8_t)RES_ERR_BLOCKED) // $72 := loadErr (expected 0xff) // $73 := 0x01 if resourceRuntimeEnabled()==0 (today's stub answer) // // Build: bash demos/build.sh rsrcProbe // Run: bash scripts/runViaFinder.sh demos/rsrcProbe.omf \ // --check 0x70=0x99 // runViaFinder LAUNCHES the OMF and samples at frame 6000; no keypress // is required because we drop into while(1) immediately after writing // the markers. #include #include "iigs/resource.h" int main(void) { volatile uint8_t *mark0 = (volatile uint8_t *)0x70; volatile uint8_t *mark1 = (volatile uint8_t *)0x71; volatile uint8_t *mark2 = (volatile uint8_t *)0x72; volatile uint8_t *mark3 = (volatile uint8_t *)0x73; *mark0 = 0x10; // entry sentinel: we did reach main() int initRc = resourceProbeInit(); *mark1 = (uint8_t)initRc; int loadErr = 0; void **h = iigsLoadResource(RES_TYPE_RTEXT, 1, &loadErr); (void)h; *mark2 = (uint8_t)loadErr; int sizeErr = 0; uint32_t sz = iigsGetResourceSize(RES_TYPE_RTEXT, 1, &sizeErr); (void)sz; *mark3 = (uint8_t)(resourceRuntimeEnabled() == 0 ? 0x01 : 0x00); // Success marker last - if any of the calls above trapped (which // they shouldn't in stub-only mode), the harness will see $70 // != 0x99 and report failure. *mark0 = 0x99; while (1) { } return 0; }