# FAKE-08 as a native Xbox 360 XEX (no XDK) A second Xbox 360 target next to `platform/xenon` (bare-metal libxenon ELF started from XeLL). This one builds a normal `default.xex` that runs under the dashboard and is started from Aurora/FSD like any other app, on RGH/JTAG consoles. It does not use the Microsoft XDK. ## How it is built | Piece | From | |---|---| | Compiler, newlib, libstdc++ | GCC 16 in the `free60/libxenon` docker image (libxenon itself is not linked) | | Import thunks, title entry, kernel/XAM headers | [xenon-forge](https://github.com/landaire/xenon-forge) `src/sdk` (MIT/Apache-2.0), copied to `sdk/` | | ELF -> XEX | `xex-link` from xenon-forge, built by `tools/build-xex-link.sh` | | C/C++ runtime | `runtime/`: start-up (static constructors, `.eh_frame` registration), newlib system calls on the kernel's `Nt*` API, dirent, time, heap | The code is compiled as 32-bit SysV PowerPC (`-m32 -mpowerpc64`), which is what titles run as (32-bit pointers in 64-bit registers). Calls into the kernel go through xenon-forge's thunks, which add the 0x50-byte home area the console ABI needs and convert 64-bit results; the title entry saves r14-r31 in full 64 bits. ## Build From the repository root: # once: build xex-link (static binary in platform/xex/tools/bin) docker run --rm -v $PWD:/build_dir rust:latest \ /bin/sh -ex /build_dir/platform/xex/tools/build-xex-link.sh # runtime + test programs docker run --rm -v $PWD:/build_dir -w /build_dir free60/libxenon:latest \ bash -lc 'make xex' Output: `platform/xex/build/tests//default.xex`. The ELF next to it (`app.elf`) has the symbols for `xenon-addr2line`. The test programs also run in Xenia Canary (`xenia_canary --log_file=xenia.log --log_level=4 default.xex`); their DbgPrint output shows up in the log. Xenia mounts the XEX's folder read-only, so file writes only work on a console. ## Runtime - **Paths:** `game:/...` (folder of the XEX), `usb0:`-`usb2:` (`\Device\Mass0`-`2`), `hdd:` (`\Device\Harddisk0\Partition1`, Aurora's `Hdd1:`). Relative paths are under `game:`. `/` and `\` both work. - **Files:** `open/read/write/lseek/close/stat/fstat/unlink/mkdir`, `opendir/readdir/closedir` (stdio and iostreams work on top). - **Time:** `gettimeofday` (KeQuerySystemTime), `clock()/times()` (time base), `xex_sleep_ms`, `usleep`. - **Heap:** a 96 MB `.bss` arena (`XEX_HEAP_SIZE`). - **Exit:** returning from `main`/`exit()` calls `XamLoaderTerminateTitle`, which goes back to the dashboard. - `xex_runtime.h`: `xex_notify()` (guide notification), timing helpers. ## Tests | Test | Checks | |---|---| | `tests/hello` | static constructors, C++ exceptions, `std::regex`, notifications, exit to dashboard | | `tests/fs` | time, `clock()`, directory listing, write/append/read/seek/stat/mkdir/remove on every device; writes `game:/fs-test-report.txt` |