Commit Graph
42 Commits
Author SHA1 Message Date
LibretroAdmin e6e980de33 android: Play Store builds deliver cores through Play again
play_feature_delivery_enabled() tested the isMetaQuestBuild method ID
rather than the flag read through it. The ID resolves on every build,
so feature delivery was off everywhere and Play Store builds offered
the whole buildbot core list through the core downloader.

The answer now comes from the build flags the frontend reads from Java
at init, and is not cached until it has read them. The
play_feature_delivery sample checks Play Store, Meta Quest and other
builds with both method IDs resolved, as on a device.
2026-10-30 14:09:02 +01:00
LibretroAdmin 88c0088a9b lakka/libnx: their headers to os/lakka and os/libnx
lakka.h and lakka-switch.h join the rest of Lakka's OS layer in
os/lakka; switch_performance_profiles.h, which only HAVE_LIBNX builds
read, starts os/libnx. Includes and the iOS Xcode projects follow.
2026-10-29 21:39:02 +01:00
LibretroAdmin f23cc50ca4 android: play_feature_delivery/ to os/android
The Play Feature Delivery glue is Android's alone - JNI calls into
RetroActivityCommon - and the last platform directory of its kind at
the tree's root. It joins the other OS layers under os/; includes, the
Makefile, griffin, the compile matrix and the two samples that build
it follow.
2026-10-29 21:01:28 +01:00
LibretroAdmin 2179fefa35 Wii U: read-modify-write atomics go through coreinit
The Wii U's Espresso needs a cache flush inside a lwarx/stwcx. pair for
the reservation to hold across its cores, which no compiler emits and
Cafe OS's own atomics carry. retro_atomic.h gains a Wii U backend,
chosen ahead of the C11, C++11 and GCC builtins there: compare-and-swap,
exchange and fetch-add/sub/or/and call coreinit's OS*Atomic between the
fences their ordering asks for, while loads, stores and fences stay
inline. Across the Wii U build that takes every lwarx/stwcx. out of
RetroArch's own code. The newlib lock hooks, the exception handler's
first-fault flag and the SwapAtomic helpers the HID driver uses go
through it too, in place of the builtins they called directly.

libretro-common/samples/atomic/retro_atomic_wiiu_backend checks the
backend against stand-in coreinit exports: one call per
read-modify-write, the right one, with the previous value returned,
none for loads, stores and fences, and no update lost under threads.
2026-10-29 20:33:34 +01:00
LibretroAdmin 5b3ec8d48a Emscripten: its JavaScript runtime moves to os/emscripten
The platform, audio and camera libraries, the pre-js and the closure
externs the web build links in live under os/emscripten.
2026-10-29 20:33:27 +01:00
LibretroAdmin 43ac210fb8 UWP: its runtime moves to os/uwp
The UWP entry point and helpers live under os/uwp. The UWP projects add
os to their include paths, so <uwp/...> as libretro-common names it
keeps resolving; RetroArch's own sources include them by their path.
2026-10-29 20:33:24 +01:00
LibretroAdmin e867b83f42 Lakka: cpufreq and reboot2payload move to os/lakka
The Lakka-only CPU frequency control and the Switch payload reboot live
under os/lakka, out of misc/; what includes them names their real path.
2026-10-29 20:33:21 +01:00
LibretroAdmin d21f92d784 Dingux: its utilities move to os/dingux
The Dingux helpers live under os/dingux with the other platforms' system
code.
2026-10-29 20:33:18 +01:00
LibretroAdmin 4964dfa774 bootstrap/ moves under os/
The libogc 2 linker scripts go to os/gekko/libogc, the PSP kernel
functions PRX to os/psp1 and the Vita heap's sbrk to os/vita, beside
each platform's other system code.
2026-10-29 20:33:15 +01:00
LibretroAdmin bc8ff41a38 Wii: app_booter moves to os/gekko/rvl
The loader stub the libogc builds embed to hand the console to the next
program lives under os/gekko/rvl with the rest of the Wii's own code;
its binary object's symbols are named after the new path.
2026-10-29 18:33:29 +01:00
LibretroAdmin bae87174dc 3DS: the runtime moves to os/ctr, linear allocator in C
The tree's 3DS layer (the custom crt0 and link spec, system and memory
setup, svchax, the old GPU command layer and the 3dsx/CIA launchers)
lives under os/ctr, beside os/gekko and os/wiiu.

The linear heap allocator is C: the same first-fit pool, so buffers
land where they did, with live allocations found by address in an
open-addressing table instead of a per-allocation tree node, and list
nodes taken from cache-line-aligned slabs and reused. On the same
trace it runs about half the instructions and practically no
malloc/free calls. With the whole heap allocated, a further allocation
now fails instead of starting the heap over and handing out its first
address again, and the free-space queries no longer fault.

samples/frontend/ctr_linear checks placement, alignment, coalescing,
the full-heap case and pages handed back from the heap's end.
2026-10-29 18:10:30 +01:00
LibretroAdmin 3c0c49e3ce Wii U: elf2rpl rewritten in C89
elf2rpl, the host tool that turns the linked Wii U ELF into an RPL, is
now a single C89 file, os/wiiu/wut/elf2rpl/main.c, in place of the C++
sources, their own ELF header, CRC-32 and endian helpers, and the
Visual Studio project files.

Big-endian fields go through retro_endianness.h; the byte swap the old
be_val.h picked by PLATFORM_WINDOWS/PLATFORM_APPLE/PLATFORM_LINUX is
gone with it, along with those defines - it did not build on any other
host and swapped wrongly on a big-endian one. Section CRCs and import
signatures come from libretro-common's encoding_crc32 instead of the
bundled bytewise table.

The input is read once and its sections used where they lie; symbol
and import lookups by address are hash tables; the output is laid out
in one buffer and written with one call. On a 7 MB core ELF with 41k
relocations the RPL comes out byte for byte as before, and so does the
log at every -v level, in about a quarter of the time (15 ms against
52 ms; 47 ms against 104 ms at -v -v -v -v).

Malformed input now ends in an error instead of a crash: header,
section, symbol and relocation offsets are checked against the file,
a stub with no symbol behind it is reported, and an unknown option is
refused rather than taken for the input file.

The tool is built with the host C compiler (HOST_CC, gcc by default),
which an exported devkitPPC CC no longer reaches.

samples/frontend/wiiu_elf2rpl builds the C tool and adds checks that
every section's SHT_RPL_CRCS entry is the zlib CRC-32 of its contents,
and that truncated ELFs and an unknown option fail cleanly; it no
longer needs the leak and alignment sanitizer exemptions the C++ tool
did.
2026-10-29 17:13:46 +01:00
LibretroAdmin d164f9ab0b Wii U: elf2rpl drops relocations against undefined weak symbols
devkitPPC's newer libc and libstdc++ reach the OS through weak hooks
(__syscall_exit, the __gthread_* ones) that the RetroArch runtime does
not define. A -pie link leaves each reference with its final value
written - zero, or a branch to itself behind a check that the hook
exists - and a relocation against the still-undefined symbol, which
elf2rpl handed the loader against $UNDEF: a symbol it cannot resolve
and a 24-bit branch to address zero, out of reach from the code area.
Every RPX linked this way fails to load with error 160-2203 before any
of it runs. Such a value does not depend on where the module loads, so
elf2rpl drops the relocation. Makefile.wiiu rebuilds elf2rpl when its
source changes.

samples/frontend/wiiu_elf2rpl writes a linked ELF in that shape, runs
elf2rpl on it and checks the RPL carries no relocation against an
undefined symbol while those against resolved targets survive.
2026-10-29 16:14:13 +01:00
LibretroAdmin 8f1e421733 wiiu: take in what it used of libiosuhax, drop deps/libiosuhax
RetroArch used libiosuhax for three things: opening the IOSU handle
and an FSA client in os/wiiu/main.c, the storage_usb devoptab, and the
raw SD/USB sector access libfat reads sd: and usb: through. Those now
live in os/wiiu/fs/iosuhax.c, with everything but what main.c and
libfat call made static. deps/libiosuhax is gone.

Never used, so not taken: IOSU memory and kernel read/write, the SVC
call, volume flush, FSA mount/unmount (main.c always registered an
already-mounted path), and chmod, which newlib never reached - the
devoptab table had the chmod handler in the deviceData slot, which
mount_fs then overwrote. The table now has newlib's order, as libfat's
does.

No locks: every FSA call is one IPC request the iosuhax server carries
out on its own, and nothing is shared between threads once a device is
mounted, so the per-device OS mutex is gone. The one shared resource
left is a data buffer, claimed with a retro_atomic exchange; a thread
that finds it held stages through the stack instead.

No allocation per call: every call used to memalign one or two buffers,
every path was malloc'd, and every directory entry too. Requests are
now built in aligned stack buffers and paths written straight into
them. File and sector data go through a stack buffer up to 1 KB, the
shared 128 KB buffer made at mount up to that, and beyond it straight
into the caller's buffer: the server puts its reply header in front of
the data, so the 0x40 bytes in front of the stretch being read are
kept aside and put back. A large ROM read no longer allocates a buffer
its own size and copies it; the data is never copied.

Bugs fixed:
- statvfs had the device info call write 0x64 bytes into an 8-byte
  stack variable
- stat read the path after freeing it
- fstat passed the file state's address as the FSA file handle
- open checked the wrong pointer for allocation failure
- seek with an unknown origin returned with the mutex held
- the device lookup used strtok, which is not thread safe
- read reported an error as end of file; it now returns -1
- seeking from the end after writing past it used the old length

Requests are byte for byte what libiosuhax sent: both were run on
32-bit big-endian PowerPC against a recorder and compared. The data
paths were run against a fake server for every size and alignment,
with the shared buffer free and held, short reads and reads past the
end, under AddressSanitizer, with guard bytes around the caller's
buffer. A compile-matrix lane now builds the file against a stand-in
for newlib's sys/iosupport.h.
2026-10-28 14:58:24 +01:00
LibretroAdmin d97736342a Wii U: the runtime moves to os/wiiu
The tree's Wii U layer (the coreinit, GX2, AX and friends headers, the
RPX import stubs, startup and linker scripts, the newlib hooks, the
exception handler, the SD devoptab, the HBL loader and the elf2rpl and
slang-cafe host tools) lives under os/wiiu, beside os/gekko. Makefile.wiiu
builds from there with -Ios/wiiu -Ios/wiiu/include, so <wiiu/...> headers
resolve as before; the few includes that reached files through the
tree root name os/wiiu.
2026-10-26 05:01:59 +01:00
LibretroAdmin 2c724ff91c GameCube/Wii: build os/gekko on every devkitPPC
newlib.c serves all three generations of devkitPPC's newlib system
hooks, picked at compile time: r49's lock, condition and thread hooks;
newlib 4.3's split plain and recursive lock hooks over int-sized locks;
and the older single set that takes the lock kind at init, which also
leaves __getreent to the system.  On the int-sized locks a plain lock is
a gk_mutex_t word and a recursive one a small handle into a table of
gk_rmutex_t.

rthreads and rcheevos run on os/gekko's own threads and mutexes rather
than newlib's pthreads, which only exist from r49.
2026-10-04 09:50:15 +02:00
LibretroAdmin 73ad914486 GameCube/Wii: build with devkitPPC r49 or later
os/gekko implements newlib's lock, condition and thread hooks, which
devkitPPC has had since r49; an older toolchain now stops at a plain
#error saying so.  The Wii and GameCube workflows build in devkitPro's
own devkitppc image, which carries a current devkitPPC.
2026-10-04 03:21:08 +02:00
LibretroAdmin 2e149e1eaf gekko: USB mice on the Wii
Boot protocol HID mice on the Wii's USB ports are found with the
keyboards (rvl/hidboot.c, which reads both) and add up their motion,
wheel and five buttons for gk_mouse_read().  In the gx input driver all
USB mice together are mouse 0 while there are any; without one, the
Wii Remote's pointer is the mouse as before.  The HID pad driver leaves
mice awake as it does keyboards.
2026-10-04 01:59:51 +02:00
LibretroAdmin a65a23144a gekko: debug output to a USB Gecko
A USB Gecko in memory card slot B or A is found at boot and gets every
line of debug output, stdout and stderr (crash reports included), for a
terminal on the computer it is plugged into.  Output is dropped while
nothing reads it, and the SD adapter code leaves its slot alone.

run-dolphin.sh GECKO=1 puts Dolphin's USB Gecko in slot B and wants
the test's verdict to come through it as well.
2026-10-04 00:03:56 +02:00
LibretroAdmin c4805c7133 gekko: Guitar Hero guitars on the Wii Remote
The guitar is read on the Classic Controller's layout: frets, strum
and +/- on its buttons, the stick as the left stick and the whammy bar,
scaled to the travel it has shown, pushing the right stick right.  It
autoconfigures as "Guitar Hero Guitar", frets bound as on guitars whose
face buttons carry the fret colours.
2026-10-03 23:46:10 +02:00
LibretroAdmin d082f986ce gekko: start IOS 58 when the loader's IOS has no USBv5
USB (pads, keyboards, storage) needs IOS 57 or later.  A program
started on an older IOS launches IOS 58 through ES before main(), waits
for the new IOS to take requests and starts its IPC state over; MEM2
shrinks to what the new IOS leaves.
2026-10-03 23:32:53 +02:00
LibretroAdmin d6f2d54a67 gekko: load only the sections, not the ELF headers
Programs are linked into two segments, code and data, that start where
the image does, so a loader no longer writes the ELF headers over the
low-memory globals (memory sizes, bus clock, IOS version) in front of
it.
2026-10-03 23:32:49 +02:00
LibretroAdmin f4ac9970fb gekko: USB keyboards on the Wii
Boot protocol HID keyboards on the Wii's USB ports type into the menu
and cores and drive the keyboard binds.  os/gekko finds them among the
HID devices IOS lists, sets the boot protocol and turns their reports
into connect, key and disconnect events; the gx input driver turns
those into key events and key state, US layout for characters.  The
HID pad driver leaves keyboards awake.  The USB HID usage key map is
shared with the Wii U as rarch_key_map_hid.
2026-10-03 22:58:07 +02:00
LibretroAdmin b36b192cac gekko: the Wii's L2 with its fetch and castout enhancements
At boot, with everything written back and the L2 invalidated, HID4
turns on 64-byte fetches, the second castout buffer, miss under miss
and castouts finished before a flash invalidate, as the 750CL manual
configures the L2.  They cannot be turned off without a reset, so the
loader's stub loses its own HID4 write before RetroArch returns to it.
2026-10-03 22:58:03 +02:00
LibretroAdmin f5d2119c00 gekko: soft filter and video gamma on the Wii
The A/V encoder's composite video trap filter follows Soft Filter, and
Video Gamma sets its gamma curve, 0.1 to 3.0 in tenths, computed from
x^(1/gamma) over the video range.  host/run.sh checks the curves.
2026-10-03 12:09:08 +02:00
LibretroAdmin 07eea5d21a gekko: SD cards and USB drives come and go on the Wii
A thread checks once a second: a card or drive taken out is unmounted
and one put in is mounted.  An unmounted volume keeps its C library
device, so files and directories still open on it fail with EIO until
closed instead of reaching freed memory, and the same name mounts
again.  The USB drive search looks at each device once while it stays
plugged in.
2026-10-03 10:03:32 +02:00
LibretroAdmin 440c704e6c gekko: salamander
Makefile.wii.salamander builds on os/gekko with HAVE_LIBOGC=0.  It
runs the core retroarch-salamander.cfg names, or the first one in its
directory, and hands it the content a loader passed.
2026-10-03 10:03:30 +02:00
LibretroAdmin 34b717d628 gekko: the Wii Remote's pointer
The remote's IR camera is switched on and configured at the system's
sensitivity, the sensor bar powered, and remotes report in mode 0x37:
buttons, accelerometer, the camera's basic dots and the extension's
bytes.  Register writes and reads go out one at a time, each when the
last is answered.  ir.c turns the dots into the pointer: the bar's
midpoint with the roll taken out, offset for a bar above or below the
screen, held across a dot dropping out.

The native joypad driver hands it to gx_input as mouse and lightgun
for remotes and Nunchuks.  gx_input keeps one pointer per port and
reads every port, where it indexed a resized array by port but filled
it by remote count.

wiimote_test checks the pointer turning with WMPADS=wiimote-ir.pipe
(run-dolphin.sh feeds remote 1 too); the host tests check the pointer
from synthetic dots.
2026-10-03 09:15:40 +02:00
LibretroAdmin add3080afe gekko: USB HID pads on the Wii
os/gekko's USB layer also drives /dev/usb/hid, where IOS puts HID-class
devices: gk_usb_hid_list lists them, and the existing calls take their
ids, with the interface's description and interrupt transfers in the
hid form.  At exit (and before gk_exec) waiting transfers on open
devices are cancelled and both interfaces shut down and close.

The native Wii build gets the "wiiusb" HID driver back: a worker
follows the device list and gives each pad the joypad connection layer
knows a reader thread on its interrupt IN endpoint; queued control
messages go out from the worker.  It also implements set/get_report,
set_idle and set_protocol, which the DualShock 3 driver needs.

usb_test talks to Dolphin's emulated Skylander portal on the hid
interface (run-dolphin.sh plugs it in) and checks the shutdown.
2026-10-03 08:26:57 +02:00
LibretroAdmin 90f90dce45 gekko: networking on the Wii
os/gekko provides BSD sockets over IOS's IP stack (/dev/net/ip/top):
socket, bind, listen, accept, connect, send/recv(from/to), set/
getsockopt, poll, select, fcntl for O_NONBLOCK, gethostbyname and the
inet_* conversions, with IOS's error codes mapped onto errno.  Sockets
are C library descriptors, so close, read and write work on them.  The
interface comes up on first use, or through gk_net_init, which waits
for DHCP.

The native Wii build turns on networking and achievements.  With
GEKKO_NATIVE, libretro-common takes its POSIX socket paths (with
HAVE_SOCKET_LEGACY), connecting with a timeout by connecting again as on
the 3DS, and rcheevos uses pthreads.

net_test runs TCP and UDP over loopback in Dolphin, whose IOS uses the
host's sockets.
2026-10-03 07:48:55 +02:00
LibretroAdmin 4f2636b99f gekko: switching cores runs the other core's program
gk_exec loads a DOL or ELF from memory and starts it with loader
arguments: the image, a small stub and the command line go to the top
of memory, the exit hooks run (FAT volumes synced, audio DMA stopped,
Bluetooth closed), and the stub copies each section into place and
jumps in.  exit() runs the same hooks.  IPC ignores replies to
requests that are not its own.

The native frontend uses it for set_fork: a core switch reads the
core's program before the volumes are unmounted and runs it with the
content as directory and file name, on the Wii and the GameCube.

exec_test runs a copy of itself as an ELF and as a DOL (elf2dol.py),
attached through run-dolphin.sh's ATTACH; the host tests check the
DOL and ELF layouts gk_exec accepts and refuses.
2026-10-03 07:25:37 +02:00
LibretroAdmin c1efc6ee18 gekko: loader arguments, posix_memalign, content test
The argument block lives after the '_arg' tag at the entry point, as
the Homebrew Channel and RetroArch's own loader write it; argv is
built from its command line, copied before the heap can reuse it.
newlib leaves posix_memalign to the system; provide it.

run-dolphin.sh passes arguments (ARGS) and drives the GameCube pad
through Dolphin's pipe input (PADS).  content-test.sh starts RetroArch
with a core and a generated NES ROM and checks that it draws and
follows the pad.
2026-10-03 06:40:44 +02:00
LibretroAdmin e62d8258cb gekko: RetroArch builds and runs on os/gekko
Makefile.wii and Makefile.ngc take HAVE_LIBOGC: 1, the default for
now, builds on libogc as before (EXTERNAL_LIBOGC choosing devkitPro's
or the in-tree copy) and defines HAVE_LIBOGC; 0 builds on os/gekko,
with no libogc at all, defining GEKKO_NATIVE.  RetroArch's own files
choose by HAVE_LIBOGC; libretro-common, which cores compile too, by
GEKKO_NATIVE, so libogc core builds keep its libogc branches.

The native drivers keep the libogc drivers' idents, button numbers
and mode list, so configurations, autoconfig profiles and binds carry
over:
- platform_gekko: SD and USB (Wii) or the SD adapters (GameCube)
  mounted as sd:, usb:, carda:, cardb:; the directory layout under the
  program's own; exit back to the loader.
- gekko_gfx: the frame as a textured quad, RGUI's surface and overlays
  over it, text poked into the EFB, two XFBs swapped on the retrace.
- gekko_audio: the libogc driver's chunk ring on the audio DMA.
- gekko_joypad: GameCube controllers, and remotes with Nunchuk or
  Classic Controller; rumble; reset opens the menu, power quits.
- dispserv_gekko: the console's standard from the VI and SYSCONF, with
  the shared mode rules.
Threads are libsysbase's pthreads on the kernel's, the clock and
memory figures come from os/gekko, and stdout and stderr go to the
debug channel.  Not there yet: networking, USB HID pads, starting
another program (core switching), the IR pointer.

os/gekko/gekko.mk lists the system layer's sources for these builds
and its own tests.
2026-10-03 06:18:56 +02:00
LibretroAdmin 52869518a3 os/gekko: Bluetooth and Wii Remotes
rvl/bt.c is a Bluetooth host for HID devices after the Core
Specification's HCI and L2CAP, over IOS's USB interface to the
controller (/dev/usb/oh1/57e/305): commands as control transfers,
events and ACL data from reads kept queued with IOS, ACL out within
the controller's buffer credits.  It reads the link keys the
controller keeps and leaves it page-scanning, so remotes synced to the
console connect when a button is pressed: the connection is accepted,
the link key request answered, and the remote's HID control and
interrupt channels accepted and configured.  One thread owns all of
it.

rvl/wiimote.c drives the remotes on top: the player LED, a status
request, extension set-up (unencrypted, then the identifier) for the
Nunchuk and Classic Controller, continuous reports with the
accelerometer and the extension's bytes, rumble, and starting over
when an extension is plugged in or pulled out.  gk_wiimote_read()
gives a slot's buttons, accelerometer, sticks and triggers.

The MEM2 buffer pool moves out of usb.c into rvl/iobuf.c for both.

wiimote_test checks in Dolphin that its emulated remote connects to
slot 0, reports about 190 times a second with the accelerometer at
rest, has its extension found with the sticks and triggers at rest
(Nunchuk, or Classic Controller with WIIEXT=Classic), keeps reporting
through rumble, and goes when dropped.
2026-10-03 05:24:31 +02:00
LibretroAdmin c41c17d25d os/gekko: Wii USB and USB drives
gk_usb_* talks to IOS's /dev/usb/ven (USBv5, IOS 57 on): the device
list, kept current by a change request that stays queued with IOS and
is acknowledged before the next; resuming a device and reading its
interface and endpoints, alternate settings; and control, bulk and
interrupt transfers, whose data goes through a pool in MEM2, where IOS
wants it.

disk/usbmsc.c is USB mass storage after the Bulk-Only Transport
specification: command and status wrappers, stalls cleared on the
endpoint that stalled, reset recovery when the exchange breaks, and
SCSI block commands (INQUIRY, TEST UNIT READY with REQUEST SENSE until
the unit spins up, READ CAPACITY, READ and WRITE), switching to the
16-byte commands past 2^32 blocks.  It takes the first LUN with a
medium, at 512 to 4096 bytes a block.  gk_usbstorage_open() finds the
first bulk-only SCSI interface among the USB devices and brings it up.

os/gekko/tests/host runs usbmsc.c against a model drive that holds the
host to the transport's rules and throws stalls, unit attentions and
phase errors at it, for a single-LUN drive that stalls GET MAX LUN, a
4 KiB-block drive whose first LUN has no medium, and a 3 TiB one, then
mounts FAT over it.  usb_test checks in Dolphin, against its emulated
Wii Speak, the device list, both alternate settings' descriptions,
control transfers both ways and a bulk transfer.
2026-10-03 05:06:05 +02:00
LibretroAdmin f7302df6cb os/gekko: external interface, the clock, and SD cards over SPI
gk_exi_* drives the three EXI channels: device select at a clock rate,
immediate transfers of up to four bytes, and DMA that sleeps on the
transfer-complete interrupt.  The C library's wall clock now starts
from the clock chip's counter on the first read, plus the console's
offset (SYSCONF's IPL.CB on the Wii, SRAM on the GameCube), so time()
and FAT timestamps are real.

disk/sdspi.c brings up SD cards in SPI mode after the Physical Layer
Simplified Specification (CMD0, CMD8, ACMD41, CMD58, the CSD for the
size) and moves blocks with single and multi-block reads and writes,
by block number on SDHC cards and byte address on standard ones.
disk/sdgecko.c is its bus on the EXI: memory card slots A and B and
serial port 2, at 16 MHz once up, blocks by DMA through a MEM1 buffer
when the caller's is not aligned or not in MEM1.

os/gekko/tests/host runs sdspi.c against a model card that checks the
protocol (CRCs where they are required, ACMD41 only after CMD55,
response and access delays, busy after writes, the CMD12 stuff byte,
the write tokens) for standard, version 1 and SDHC cards, then mounts
FAT over it.  exi_test checks in Dolphin that time() starts from the
clock chip, that DMA and immediate transfers agree on SRAM in both
directions, and that a probe of an empty port gives up quickly;
run-dolphin.sh sets Dolphin's clock so the time is known.
2026-10-03 04:52:26 +02:00
LibretroAdmin c9a750cdac os/gekko: FAT filesystem and the Wii SD slot
fs/fat.c is FAT12, FAT16 and FAT32 with long names, written from
Microsoft's specification, over any gk_blockdev_t.  It finds the
volume on a bare device or in the first FAT partition of an MBR,
keeps a 64-sector write-back cache (FAT sectors go to every copy as
they leave it), allocates file clusters ahead of a write so they come
out contiguous, and moves whole sectors of file data straight between
the device and the caller in runs as long as the chain is contiguous.
Short aliases follow the ~N scheme, all-lower-case 8.3 names use the
case bits instead of a long name, and the FSInfo free count is kept.
Open files follow a rename of their entry; unlinking one is refused.

fs/fat_devoptab.c mounts a volume as "name:" for the C library's file
calls: stdio, stat, directories, rename, mkdir and rmdir, statvfs,
ftruncate, fsync, and relative paths after chdir.  The first volume
mounted is the default device.

rvl/sdio.c drives the front SD slot through IOS's /dev/sdio/slot0:
the size from the CSD, then select, 512-byte blocks, the 4-bit bus,
and multi-block DMA reads and writes, by block number on SDHC cards
and byte address on standard ones; unaligned buffers go through a
bounce buffer.

os/gekko/tests/host runs fat.c over images made by mkfs.fat: files
mtools wrote read back, a tree written here passes fsck.fat and reads
back in mtools, random file operations match a model through a
remount, and the volume fills and empties again; on FAT12, FAT16,
FAT32, partitioned images and 64 KiB clusters.  sd_test does the same
through the C library on a Wii in Dolphin, with standard and SDHC
images from sd-image.sh.
2026-10-03 04:40:41 +02:00
LibretroAdmin a4fce4ee7b os/gekko: audio DMA and GameCube controllers
gk_audio_* plays 16-bit stereo PCM by DMA at 48 or 32 kHz: the
interrupt at the start of each buffer runs a callback that queues the
next one, which the DMA picks up when the current one ends.

gk_pad_* finds controllers on the serial interface (identify, then the
origin they report for their sticks), polls them once a field and
decodes each report in the interrupt; ports are rescanned every half
second for controllers plugged in later, and rumble rides on the poll.

os/gekko/tests/io_test checks the buffer rate at both sample rates and
the controller Dolphin puts on port 1; run-dolphin.sh makes that
controller count as connected.
2026-10-03 04:12:29 +02:00
LibretroAdmin 1a6ad04e61 os/gekko: graphics processor
gk_gx_* drives the GPU: a command ring the write-gather pipe fills,
with the writer put to sleep on the high-water mark and woken on the
low one, so any amount of commands is safe; draw-done waits on the
pixel engine's finish interrupt; vertex descriptors, formats and
arrays; position matrices, orthographic and perspective projection,
viewport with field jitter and scissor; textures; TEV stages for
modulate, replace and vertex colour; culling, depth, blending; EFB
clears and copies to an XFB, vertically scaled when the line counts
differ; EFB pokes; display lists recorded through the same pipe.

os/gekko/tests/gx_test draws each case in Dolphin's software renderer
and checks the pixels it reads back from the XFB.
2026-10-03 03:56:09 +02:00
LibretroAdmin 8aacd31c22 os/gekko: video interface, A/V encoder, console and crash screen
gk_vi_* programs the video interface from one base timing per
standard (NTSC, PAL, MPAL, EURGB60) and scan (interlaced, 480p, double
strike): a mode smaller than the full picture moves the blanking edges
and keeps the line and field lengths, framebuffers narrower than the
shown width use the horizontal scaler, and black keeps the timing.  A
retrace interrupt per field takes pending framebuffers and runs a
callback.  On the Wii the A/V encoder gets the colour encoding, YUV
output for component cables and the EURGB60 filter over its I2C lines.

Debug output also goes to a text console drawn with RetroArch's bitmap
font; a crash shows its report there and returns to the loader after
ten seconds.

os/gekko/tests/vi_test checks every standard and scan type retraces at
its broadcast rate.
2026-10-03 03:38:24 +02:00
LibretroAdmin d61b027ace os/gekko: IOS requests, buttons, power and console settings on the Wii
gk_ios_* talks to IOS through the IPC mailbox: requests queue behind
the one in flight, complete by waking the caller or by a callback in
interrupt context, and handle the cache for the buffers they carry.
On top of it: the power and reset buttons (STM event hook on the Wii,
the reset switch interrupt on the GameCube), power off and restart,
leaving to a resident loader or else the system menu, and the console
settings RetroArch reads (aspect, progressive scan, PAL60, video mode,
horizontal offset) from SYSCONF and setting.txt.

os/gekko/tests/ios_test runs in Dolphin like the kernel test.
2026-10-03 03:16:05 +02:00
LibretroAdmin fae4c58ae1 os/gekko: boot, exceptions, scheduler and C library for GameCube and Wii
The start of RetroArch's own system layer for the two consoles.  crt0
sets up the processor and memory map; exceptions save into the running
thread and leave through one scheduler decision; threads run by strict
priority with round robin among equals; every blocking primitive sleeps
on a futex word, so newlib's locks are the kernel's mutexes and need no
setup; FP registers move lazily, interrupt handlers included.  newlib's
heap (MEM1, then MEM2), pthreads, thread-local storage and clocks go
through the kernel.

os/gekko/tests holds checks that run in Dolphin:
make -C os/gekko/tests [PLATFORM=dol], then run-dolphin.sh.
2026-10-03 03:01:58 +02:00