# Pitfalls These cost us the most time, and none of them were in the code. ## The console runs an old copy We spent a long time chasing a "missing" feature that was in the build all along: Aurora was starting an older `default.xex` than the one we uploaded. - **Log the build id and build time on the first line**, for example with `-DBUILD_ID=\"$(git rev-parse --short HEAD)\"` and `__DATE__ __TIME__`. Check that line before testing anything else. - **Delete the old `default.xex` before uploading** the new one, and check the size in the FTP listing. Don't rely on the size alone, though: two builds can be the same size. - A title writes its data **next to itself**. If you fetch the log from `X:\...\MyTitle\data\`, the XEX that ran is `X:\...\MyTitle\default.xex`. ## Docker makes root-owned folders Without `--user $(id -u):$(id -g)`, the build directories belong to root, and an FTP client can't save the console's logs into them ("permission denied"). Fix existing ones with `docker run --rm -v $PWD:/x free60/libxenon chown -R $(id -u):$(id -g) /x/build`. In containers run as your user, set `HOME=/tmp`, and add `git config --global --add safe.directory /src` if the build calls git. ## Back+Start is taken Some dashboard plugins use Back+Start as a screenshot hotkey, so the title never sees it. Leave through the Guide. ## Ending under the Guide hangs See [The Guide](The-Guide.md). Don't quit on a timer while the Guide is open. ## Kernel callbacks and 64-bit registers The audio callback, the exception handler and the entry point must keep r14-r31 whole. GCC's 32-bit prologues don't. Use `xbox360_entry`. ## Unwritten fields from drivers The FAT32 USB listing bug ([Files and storage](Files-and-Storage.md)) generalises: **clear output buffers before kernel calls fill them**, and bounds-check any offset they return. ## Misaligned 64-bit stores into write-combined memory They fault on the console. GCC may merge two 32-bit stores into one `std`. Write GPU-visible memory (rings, front buffers) through `volatile uint32_t*` or in aligned blocks. ## Assumptions that were wrong - "Xenia works, so the console will": see [Xenia vs. hardware](Xenia-vs-Hardware.md). - "The kernel's scaler program is needed for a picture": it hangs, and isn't needed. - "`XNotifyQueueUICustom` (656) shows a notification": ordinal 656 is `XNotifyQueueUI`, with 5 arguments (type, user, areas as one 64-bit register, text, context). - "The delay is in the TV": it was our own queue. Measure before blaming the output.