commit b62529e0e54b0ff29750696495de6d718d469a3e
Author: mrfox <jens.se@icloud.com>
AuthorDate: Wed Nov 25 19:27:58 2026 +0100
Commit: mrfox <jens.se@icloud.com>
CommitDate: Wed Nov 25 19:27:58 2026 +0100
xex: use xexkit (submodule) for the runtime, SDK, tools and tests
The XEX runtime, xenon-forge SDK, xex-link build script and hardware tests
moved to their own repository, xexkit, so other ports can use them;
platform/xex/xexkit is a submodule pinned to it. platform/xex keeps
FAKE-08's host and a Makefile built on xexkit's mk/xexkit.mk; the output
and behaviour are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---
.gitmodules | 3 +
platform/xex/.gitignore | 2 -
platform/xex/Makefile | 118 +--
platform/xex/README.md | 110 +--
platform/xex/runtime/audio.c | 107 ---
platform/xex/runtime/crt.c | 36 -
platform/xex/runtime/crt0.S | 5 -
platform/xex/runtime/extra_imports.S | 57 --
platform/xex/runtime/fault.c | 146 ----
platform/xex/runtime/fs.c | 652 ---------------
platform/xex/runtime/include/sys/dirent.h | 33 -
platform/xex/runtime/input.c | 25 -
platform/xex/runtime/kernel_entries.S | 7 -
platform/xex/runtime/link.ld | 50 --
platform/xex/runtime/posix.c | 38 -
platform/xex/runtime/sys.c | 146 ----
platform/xex/runtime/video.c | 908 ---------------------
platform/xex/runtime/xex_audio.h | 50 --
platform/xex/runtime/xex_input.h | 41 -
platform/xex/runtime/xex_runtime.h | 38 -
platform/xex/runtime/xex_video.h | 76 --
platform/xex/sdk/LICENSE-APACHE | 190 -----
platform/xex/sdk/LICENSE-MIT | 21 -
platform/xex/sdk/README | 3 -
platform/xex/sdk/crt/entry.inc | 32 -
platform/xex/sdk/include/xbox360/base.h | 189 -----
platform/xex/sdk/include/xbox360/xam.h | 16 -
platform/xex/sdk/include/xbox360/xam/content.h | 220 -----
platform/xex/sdk/include/xbox360/xam/input.h | 155 ----
platform/xex/sdk/include/xbox360/xam/net.h | 550 -------------
platform/xex/sdk/include/xbox360/xam/notify.h | 80 --
platform/xex/sdk/include/xbox360/xam/system.h | 368 ---------
platform/xex/sdk/include/xbox360/xam/ui.h | 177 ----
platform/xex/sdk/include/xbox360/xam/user.h | 264 ------
platform/xex/sdk/include/xbox360/xam/xamdef.h | 35 -
platform/xex/sdk/include/xbox360/xbox360.h | 9 -
platform/xex/sdk/include/xbox360/xboxkrnl.h | 22 -
platform/xex/sdk/include/xbox360/xboxkrnl/ex.h | 325 --------
platform/xex/sdk/include/xbox360/xboxkrnl/hal.h | 351 --------
platform/xex/sdk/include/xbox360/xboxkrnl/io.h | 815 ------------------
platform/xex/sdk/include/xbox360/xboxkrnl/ke.h | 518 ------------
platform/xex/sdk/include/xbox360/xboxkrnl/mm.h | 175 ----
platform/xex/sdk/include/xbox360/xboxkrnl/nic.h | 53 --
platform/xex/sdk/include/xbox360/xboxkrnl/ntdef.h | 95 ---
platform/xex/sdk/include/xbox360/xboxkrnl/ob.h | 149 ----
platform/xex/sdk/include/xbox360/xboxkrnl/rtl.h | 284 -------
platform/xex/sdk/include/xbox360/xboxkrnl/usb.h | 42 -
platform/xex/sdk/include/xbox360/xboxkrnl/vd.h | 239 ------
platform/xex/sdk/include/xbox360/xboxkrnl/xaudio.h | 46 --
platform/xex/sdk/include/xbox360/xboxkrnl/xe.h | 113 ---
platform/xex/sdk/include/xbox360/xboxkrnl/xex.h | 243 ------
platform/xex/sdk/include/xbox360/xboxkrnl/xma.h | 144 ----
platform/xex/sdk/thunks/macros.inc | 152 ----
platform/xex/sdk/thunks/ppc32.S | 862 -------------------
platform/xex/tests/audio/main.cpp | 118 ---
platform/xex/tests/audio/xex.toml | 3 -
platform/xex/tests/fault/main.cpp | 24 -
platform/xex/tests/fault/xex.toml | 3 -
platform/xex/tests/fs/main.cpp | 173 ----
platform/xex/tests/fs/xex.toml | 3 -
platform/xex/tests/hello/main.cpp | 62 --
platform/xex/tests/hello/xex.toml | 3 -
platform/xex/tests/video/main.cpp | 163 ----
platform/xex/tests/video/xex.toml | 3 -
platform/xex/tools/.xenon-forge-src | 1 +
platform/xex/tools/build-xex-link.sh | 31 -
platform/xex/xexkit | 1 +
67 files changed, 54 insertions(+), 10119 deletions(-)
diff --git a/.gitmodules b/.gitmodules
index 6102cb8..d147e76 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,6 @@
[submodule "libs/z8lua"]
path = libs/z8lua
url = https://github.com/jtothebell/z8lua.git
+[submodule "platform/xex/xexkit"]
+ path = platform/xex/xexkit
+ url = https://git.kristoffersson.info/repos/xexkit.git
diff --git a/platform/xex/.gitignore b/platform/xex/.gitignore
index 301492e..567609b 100644
--- a/platform/xex/.gitignore
+++ b/platform/xex/.gitignore
@@ -1,3 +1 @@
build/
-tools/bin/
-tools/.xenon-forge-src/
diff --git a/platform/xex/Makefile b/platform/xex/Makefile
index 7301a30..744fa0c 100644
--- a/platform/xex/Makefile
+++ b/platform/xex/Makefile
@@ -1,108 +1,40 @@
#---------------------------------------------------------------------------------
# FAKE-08 for Xbox 360 as a native XEX (runs under the dashboard, started
-# from Aurora/FSD), built WITHOUT the Microsoft XDK:
-# GCC 16 + newlib + libstdc++ (free60/libxenon image, libxenon itself is
-# not used) -> ELF -> xex-link (from xenon-forge) -> default.xex
+# from Aurora/FSD), built WITHOUT the Microsoft XDK, with xexkit
+# (platform/xex/xexkit, a git submodule: GCC + newlib + libstdc++ from the
+# free60/libxenon image, xex-link from xenon-forge).
#
-# Run inside the free60/libxenon docker image. xex-link must be built first
-# with tools/build-xex-link.sh (see README.md).
+# From the repository root, inside the free60/libxenon docker image:
+# make xex -> platform/xex/build/fake08/default.xex
+# xex-link must be built once with xexkit/tools/build-xex-link.sh (README.md).
#---------------------------------------------------------------------------------
-ifeq ($(strip $(DEVKITXENON)),)
-$(error "Please set DEVKITXENON (run inside the free60/libxenon image)")
-endif
-
-XEX_LINK ?= $(CURDIR)/tools/bin/xex-link
-BUILD := build
-
-CC := xenon-gcc
-CXX := xenon-g++
-MACH := -m32 -mpowerpc64 -mhard-float -maltivec -fno-pic -G0 -msdata=none
-INCLUDES := -I$(CURDIR)/runtime/include -I$(CURDIR)/runtime -I$(CURDIR)/sdk/include
-CFLAGS := $(MACH) -O2 -g -Wall -Wno-attributes -ffunction-sections -fdata-sections $(INCLUDES)
-CXXFLAGS := $(CFLAGS) -std=gnu++17
-ASFLAGS := $(MACH) -Wa,-mppc64
-LDFLAGS := $(MACH) -nostartfiles -nostdlib -T $(CURDIR)/runtime/link.ld -Wl,--gc-sections
-LIBS := -L$(DEVKITXENON)/xenon/lib/32 -Wl,--start-group -lstdc++ -lm -lc -lgcc -Wl,--end-group
-
-RUNTIME_SRC := runtime/crt0.S runtime/crt.c runtime/sys.c runtime/fs.c runtime/posix.c \
- runtime/video.c runtime/input.c runtime/fault.c runtime/audio.c runtime/kernel_entries.S \
- runtime/extra_imports.S sdk/thunks/ppc32.S
-RUNTIME_OBJ := $(patsubst %,$(BUILD)/%.o,$(RUNTIME_SRC))
-
-TESTS := hello fs video fault audio
+XEXKIT := $(CURDIR)/xexkit
+APP_VERSION ?= dev
+BUILD_ID := $(shell git -C $(CURDIR) rev-parse --short HEAD 2>/dev/null || echo unknown)$(shell git -C $(CURDIR) diff --quiet 2>/dev/null || echo -modified)
-#---------------------------------------------------------------------------------
-# FAKE-08: the emulator core (../../source, ../../libs) and source/XexHost.cpp
-#---------------------------------------------------------------------------------
+# the emulator core and this platform's host
CORE_DIRS := ../../source ../../libs/z8lua ../../libs/utf8-util ../../libs/lodepng \
../../libs/simpleini ../../libs/miniz
-CORE_SRC := $(foreach d,$(CORE_DIRS),$(wildcard $(d)/*.c) $(wildcard $(d)/*.cpp))
-CORE_OBJ := $(patsubst ../../%,$(BUILD)/fake08/core/%.o,$(CORE_SRC))
-FAKE08_OBJ := $(CORE_OBJ) $(BUILD)/fake08/XexHost.cpp.o
-APP_VERSION ?= dev
-BUILD_ID := $(shell git -C $(CURDIR) rev-parse --short HEAD 2>/dev/null || echo unknown)$(shell git -C $(CURDIR) diff --quiet 2>/dev/null || echo -modified)
+
+TITLE := fake08
+TITLE_SRC := $(foreach d,$(CORE_DIRS),$(wildcard $(d)/*.c) $(wildcard $(d)/*.cpp)) source/XexHost.cpp
+TITLE_TOML := fake08.toml
# z8lua's .c files are C++ (fix32 math, throw/catch for Lua errors).
+TITLE_C_AS_CXX := 1
# libxenon's headers come last, for the console font only.
-FAKE08_FLAGS := $(MACH) -O2 -g -Wall -Wno-sign-compare -Wno-attributes -ffunction-sections -fdata-sections \
- $(INCLUDES) $(foreach d,$(CORE_DIRS),-I$(d)) -idirafter $(DEVKITXENON)/usr/include \
- -D__XEX__ -DMINIZ_NO_TIME -DVER_STR=\"$(APP_VERSION)\" -DBUILD_ID=\"$(BUILD_ID)\" -std=gnu++17
+TITLE_FLAGS := -Wno-sign-compare $(foreach d,$(CORE_DIRS),-I$(d)) -idirafter $(DEVKITXENON)/usr/include \
+ -D__XEX__ -DMINIZ_NO_TIME -DVER_STR=\"$(APP_VERSION)\" -DBUILD_ID=\"$(BUILD_ID)\"
-.PHONY: all tests runtime fake08 clean
-all: tests fake08
-runtime: $(RUNTIME_OBJ)
-tests: $(foreach t,$(TESTS),$(BUILD)/tests/$(t)/default.xex)
-fake08: $(BUILD)/fake08/default.xex
+.PHONY: all fake08 clean
+all: fake08
+fake08: title
-$(BUILD)/fake08/core/%.c.o: ../../%.c
- @mkdir -p $(dir $@)
- @echo [$(notdir $<)]
- @$(CXX) -x c++ $(FAKE08_FLAGS) -MMD -MP -c $< -o $@
-$(BUILD)/fake08/core/%.cpp.o: ../../%.cpp
- @mkdir -p $(dir $@)
- @echo [$(notdir $<)]
- @$(CXX) $(FAKE08_FLAGS) -MMD -MP -c $< -o $@
# rebuilt every time, for the build id and time in the log
-.PHONY: $(BUILD)/fake08/XexHost.cpp.o
-$(BUILD)/fake08/XexHost.cpp.o: source/XexHost.cpp
- @mkdir -p $(dir $@)
- @echo [$(notdir $<)]
- @$(CXX) $(FAKE08_FLAGS) -MMD -MP -c $< -o $@
-
-$(BUILD)/fake08/app.elf: $(FAKE08_OBJ) $(RUNTIME_OBJ) runtime/link.ld
- @mkdir -p $(dir $@)
- @echo linking $@
- @$(CXX) $(LDFLAGS) -Wl,-Map,$(@:.elf=.map) -o $@ $(filter %.o,$^) $(LIBS)
-
-$(BUILD)/fake08/default.xex: $(BUILD)/fake08/app.elf fake08.toml
- @$(XEX_LINK) $< $@ --manifest fake08.toml
-
-$(BUILD)/%.S.o: %.S
- @mkdir -p $(dir $@)
- @echo [$(notdir $<)]
- @$(CC) $(ASFLAGS) -c $< -o $@
-$(BUILD)/%.c.o: %.c
- @mkdir -p $(dir $@)
- @echo [$(notdir $<)]
- @$(CC) $(CFLAGS) -MMD -MP -c $< -o $@
-$(BUILD)/%.cpp.o: %.cpp
- @mkdir -p $(dir $@)
- @echo [$(notdir $<)]
- @$(CXX) $(CXXFLAGS) -MMD -MP -c $< -o $@
-
-# tests/<name>/*.cpp -> build/tests/<name>/default.xex
-.SECONDEXPANSION:
-$(BUILD)/tests/%/app.elf: $$(addprefix $(BUILD)/,$$(addsuffix .o,$$(wildcard tests/$$*/*.cpp))) $(RUNTIME_OBJ) runtime/link.ld
- @mkdir -p $(dir $@)
- @echo linking $@
- @$(CXX) $(LDFLAGS) -Wl,-Map,$(@:.elf=.map) -o $@ $(filter %.o,$^) $(LIBS)
-
-$(BUILD)/tests/%/default.xex: $(BUILD)/tests/%/app.elf tests/%/xex.toml
- @$(XEX_LINK) $< $@ --manifest tests/$*/xex.toml
+build/fake08/obj/source/XexHost.cpp.o: FORCE
+.PHONY: FORCE
+FORCE:
clean:
- rm -r -f $(CURDIR)/$(BUILD)
-
--include $(shell find $(BUILD) -name '*.d' 2>/dev/null)
+ rm -r -f $(CURDIR)/build
-# keep the ELFs (symbols for addr2line)
-.SECONDARY:
+include $(XEXKIT)/mk/xexkit.mk
diff --git a/platform/xex/README.md b/platform/xex/README.md
index c9d773b..7ed0fcb 100644
--- a/platform/xex/README.md
+++ b/platform/xex/README.md
@@ -5,41 +5,34 @@ 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.
+It is built with [xexkit](https://git.kristoffersson.info/repos/xexkit.git)
+(the `xexkit/` submodule): GCC, newlib and libstdc++ from the
+`free60/libxenon` docker image, a runtime on the kernel's own API (video
+with the Guide, audio, input, files, crash reports) and `xex-link` from
+xenon-forge. xexkit's `docs/wiki/` explains how the console behaves and why.
## Build
-From the repository root:
+From the repository root (with submodules checked out:
+`git submodule update --init`):
- # 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
+ # once: build xex-link (static binary in platform/xex/xexkit/tools/bin)
+ docker run --rm --user $(id -u):$(id -g) -e HOME=/tmp \
+ -e CARGO_HOME=/usr/local/cargo -e RUSTUP_HOME=/usr/local/rustup \
+ -v $PWD/platform/xex/xexkit:/build_dir rust:latest \
+ /bin/sh -e /build_dir/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'
+ # FAKE-08
+ docker run --rm --user $(id -u):$(id -g) -e HOME=/tmp -v $PWD:/build_dir \
+ -w /build_dir free60/libxenon:latest \
+ bash -lc 'git config --global --add safe.directory "*"; make xex'
-Output: `platform/xex/build/fake08/default.xex` (FAKE-08) and
-`platform/xex/build/tests/<name>/default.xex`. The ELF next to it
-(`app.elf`) has the symbols for `xenon-addr2line`.
+Output: `platform/xex/build/fake08/default.xex`; `app.elf` next to it has
+the symbols for `xenon-addr2line` (see `crash.txt` in xexkit's wiki). The
+first line of `fake08/pico.log` names the build (commit and time), so you
+can tell which copy the console ran.
-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.
+The hardware tests (video, audio, files, crash report) are in xexkit.
## FAKE-08
@@ -59,66 +52,11 @@ that folder is read-only).
| Xbox button | Guide; Xbox Home leaves to Aurora |
| Back+Start | quit (some dashboard plugins use it for screenshots) |
+The start menu is a file browser: A opens a cart or folder, B goes up a
+folder, left/right page.
+
Controllers 2-4 are players 2-4. Sound goes through the kernel's audio render
driver at 48 kHz (front left and right).
The source is `source/XexHost.cpp`, the same logic as the libxenon host
(`platform/xenon/source/XenonHost.cpp`) on this platform's runtime.
-
-## 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`. The time base runs at 49.875 MHz, not the
- 50 MHz `KeQueryPerformanceFrequency` reports; `xex_timebase_freq()` gives
- the real rate.
-- **Stack:** 1 MB for the main thread (`tools/build-xex-link.sh` patches
- xex-link's 256 KB).
-- **Heap:** a 96 MB `.bss` arena (`XEX_HEAP_SIZE`).
-- **Exit:** returning from `main`/`exit()` calls `XamLoaderTerminateTitle`,
- which goes back to the dashboard.
-- **Crashes:** a CPU fault (bad pointer, illegal instruction) writes
- `game:/crash.txt` with the exception, the faulting address, the registers
- and the return addresses on the stack, then goes back to the dashboard
- (`RtlSetVectoredExceptionHandler`, as found by xsdk). Look addresses up
- with `xenon-addr2line -f -C -e build/fake08/app.elf <address>`. A stack
- overflow can't be reported.
-- `xex_runtime.h`: `xex_notify()` (guide notification), timing helpers.
-- **Video** (`xex_video.h`): takes the GPU engines like Direct3D, flips two
- tiled 32 bpp front buffers with `VdSwap` at vertical blank. On a
- progressive output the front buffers have the output's size (for example
- 1920x1080) and are shown 1:1 with the display scaler off, so the title
- scales sharply itself; otherwise (interlaced output, Xenia) the kernel's
- 640x480 surface is stretched by its scaler (`xex_video_native = 0` forces
- that). On hardware a
- title's surface only shows once the display LUT is filled and the surface
- is committed the way XAM does it (0x2840/0x2844 + D1GRPH, then 0x60EC = 1);
- found by [xsdk](https://github.com/jessenic/xsdk) (docs/HARDWARE.md).
- Pixels: `B << 24 | G << 16 | R << 8 | A`.
-- **Guide**: every frame goes through `VdSwap` with the kernel's system
- command buffer; while XAM draws the Guide, `VdSwap` hands back XAM's
- surface, which is shown instead (scaler set for its size, the kernel's
- scaling back afterwards), and XAM is told the title's display size
- (graphics notification event 1). As found by xsdk. A title must not end by
- itself while the Guide shows (`xex_video_guide_visible()`).
-- **Audio** (`xex_audio.h`): an XAudio render driver client. The kernel
- calls back every 5.33 ms for a frame of 256 samples at 48 kHz, 6 channels
- of big-endian floats one after the other (xsdk's findings); the title
- queues frames into a 16-frame ring, and the callback plays silence when
- it is empty. Kernel callbacks enter through `kernel_entries.S`, which
- keeps r14-r31 whole.
-- **Input** (`xex_input.h`): `XamInputGetState` per port.
-
-## Tests
-
-| Test | Checks |
-|---|---|
-| `tests/hello` | static constructors, C++ exceptions, `std::regex`, an 896 KB deep stack (progress in `game:/stack-test.txt`), notifications, exit to dashboard |
-| `tests/audio` | latency: a click and a white flash together every second (A: at once); up/down set the frames queued ahead (2, 4, 8, 15); logs the driver's callback rate to `game:/audio-log.txt` |
-| `tests/fault` | stores to address 0 after 2 s: the fault report must land in `game:/crash.txt` and the console go back to the dashboard |
-| `tests/fs` | time, `clock()`, directory listing, write/append/read/seek/stat/mkdir/remove on every device; writes `game:/fs-test-report.txt` |
-| `tests/video` | CPU-drawn frames at 60 fps through the title's own GPU ring, controller input (d-pad moves a square, A/B/X/Y colour it); a row of 16 boxes lights up with the pressed buttons and every controller change is logged to `game:/video-log.txt`; exits after 60 s (not while the Guide shows) or on Back+Start; the Xbox button opens the Guide, whose Xbox Home leaves |
diff --git a/platform/xex/runtime/audio.c b/platform/xex/runtime/audio.c
deleted file mode 100644
index d97c806..0000000
--- a/platform/xex/runtime/audio.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Sound through the kernel's audio render driver; see xex_audio.h.
- * Facts from xsdk's hardware runs (docs/HARDWARE.md, "Runtime, milestone
- * 2" and "Audio's feeding, milestone 58"): the callback runs on a kernel
- * thread every 5.33 ms and may submit the frame itself; frames are in
- * cached physical memory; the callback uses integers only.
- */
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <xbox360/xboxkrnl.h>
-
-#include "xex_audio.h"
-
-#define FRAME_FLOATS (XEX_AUDIO_FRAME_SAMPLES * XEX_AUDIO_CHANNELS)
-#define SILENCE_SLOT XEX_AUDIO_RING_FRAMES
-
-static float *frames; /* ring + one silent frame */
-static PVOID volatile driver; /* 0 while closed */
-static volatile uint32_t queued; /* written by the title */
-static volatile uint32_t taken; /* written by the callback */
-static volatile uint32_t silent;
-static volatile uint32_t calls; /* callbacks so far */
-static XAUDIORENDERDRVCLIENT client;
-
-/* Kernel thread, once per frame. Called through xex_audio_callback_entry
- * (kernel_entries.S), which keeps r14-r31 whole for the kernel. */
-void xex_audio_callback(PXAUDIORENDERDRVCALLBACKDATA data)
-{
- (void)data;
- calls = calls + 1;
- PVOID d = driver;
- if (!d) return;
- uint32_t t = taken;
- const float *frame;
- if (queued != t) {
- frame = frames + (t % XEX_AUDIO_RING_FRAMES) * FRAME_FLOATS;
- __asm__ volatile("lwsync" ::: "memory");
- taken = t + 1;
- } else {
- frame = frames + SILENCE_SLOT * FRAME_FLOATS;
- if (queued) silent = silent + 1;
- }
- XAudioSubmitRenderDriverFrame(d, frame);
-}
-
-extern void xex_audio_callback_entry(PXAUDIORENDERDRVCALLBACKDATA data);
-
-int xex_audio_open(void)
-{
- if (driver) return 0;
- if (!frames) {
- uint32_t bytes = (XEX_AUDIO_RING_FRAMES + 1) * FRAME_FLOATS * sizeof(float);
- frames = (float *)MmAllocatePhysicalMemoryEx(0, bytes, PAGE_READWRITE, 0, 0xffffffffu, 0);
- if (!frames) return -1;
- memset(frames, 0, bytes); /* every channel silent */
- }
- queued = 0;
- taken = 0;
- silent = 0;
- client.Callback = xex_audio_callback_entry;
- client.Context = NULL;
- PVOID d = NULL;
- HRESULT hr = XAudioRegisterRenderDriverClient(&client, &d);
- if (hr < 0 || !d) return -1;
- __asm__ volatile("lwsync" ::: "memory");
- driver = d;
- atexit(xex_audio_close);
- return 0;
-}
-
-unsigned xex_audio_queued(void)
-{
- return queued - taken;
-}
-
-float *xex_audio_next(void)
-{
- if (!driver || queued - taken >= XEX_AUDIO_RING_FRAMES - 1) return NULL;
- return frames + (queued % XEX_AUDIO_RING_FRAMES) * FRAME_FLOATS;
-}
-
-void xex_audio_queue(void)
-{
- __asm__ volatile("lwsync" ::: "memory");
- queued = queued + 1;
-}
-
-unsigned xex_audio_callbacks(void)
-{
- return calls;
-}
-
-unsigned xex_audio_underruns(void)
-{
- return silent;
-}
-
-void xex_audio_close(void)
-{
- PVOID d = driver;
- if (!d) return;
- driver = NULL;
- /* the frames stay allocated: a callback can still run after this */
- XAudioUnregisterRenderDriverClient(d);
-}
diff --git a/platform/xex/runtime/crt.c b/platform/xex/runtime/crt.c
deleted file mode 100644
index cc7b830..0000000
--- a/platform/xex/runtime/crt.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * C/C++ runtime start for GCC-built Xbox 360 titles (newlib + libstdc++).
- *
- * The toolchain uses .ctors (not .init_array) and no crtbegin/crtend, so
- * the link script provides the bounds and we run the constructors here.
- * .eh_frame is registered with libgcc's unwinder so C++ exceptions work.
- */
-#include <stdlib.h>
-
-typedef void (*ctor_fn)(void);
-extern ctor_fn __CTOR_LIST__[];
-extern ctor_fn __CTOR_END__[];
-extern char __eh_frame_start[];
-
-extern void __register_frame(void *);
-extern void xex_mount_devices(void);
-extern void xex_install_fault_handler(void);
-extern int main(int argc, char **argv);
-
-static char *argv_empty[] = { "game:\\default.xex", 0 };
-
-int __xex_crt_main(void)
-{
- xex_install_fault_handler(); /* before constructors, so they're covered */
- __register_frame(__eh_frame_start);
- xex_mount_devices();
-
- /* GCC runs .ctors from the end towards the start */
- for (ctor_fn *p = __CTOR_END__; p > __CTOR_LIST__; ) {
- (*--p)();
- }
-
- int ret = main(1, argv_empty);
- exit(ret);
- return ret;
-}
diff --git a/platform/xex/runtime/crt0.S b/platform/xex/runtime/crt0.S
deleted file mode 100644
index 0e9cb44..0000000
--- a/platform/xex/runtime/crt0.S
+++ /dev/null
@@ -1,5 +0,0 @@
-/* Title entry: saves r14-r31 in full 64 bits (console ABI) and calls the
- * C runtime start in crt.c. See sdk/crt/entry.inc. */
-#include "../sdk/crt/entry.inc"
-
- xbox360_entry _start, __xex_crt_main
diff --git a/platform/xex/runtime/extra_imports.S b/platform/xex/runtime/extra_imports.S
deleted file mode 100644
index d597712..0000000
--- a/platform/xex/runtime/extra_imports.S
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Imports that the xenon-forge headers do not declare yet.
- * Record: type (1 = function) << 24 | library (0 xboxkrnl, 1 xam) << 16 | ordinal */
-#include "../sdk/thunks/macros.inc"
-
-/* VOID XNotifyQueueUI(DWORD Type, DWORD UserIndex, ULONGLONG Areas,
- * PCWSTR Text, PVOID Context) - xam.xex ordinal 656.
- * Areas is one 64-bit register in the console ABI: callers pass it as a
- * 32-bit value in r5 (see xex_notify in runtime/xex.h), Text in r6. */
-xbox360_stub XNotifyQueueUI, 0x01010290
-
-/* VOID VdQueryVideoMode(PVOID Mode) - xboxkrnl ordinal 0x1CA. Mode starts
- * with DisplayWidth, DisplayHeight (ULONG); the block is 0x30 bytes. */
-xbox360_stub VdQueryVideoMode, 0x010001ca
-
-/*
- * ULONG VdInitializeScalerCommandBuffer(
- * ULONG SourceXY, ULONG SourceWH, ULONG OutputXY, ULONG OutputWH,
- * ULONG FrontBufferWH, ULONG VerticalFilterType, PVOID VerticalFilter,
- * ULONG HorizontalFilterType, PVOID HorizontalFilter, ULONG Unknown9,
- * PULONG Commands, ULONG CommandDwords) - xboxkrnl ordinal 0x1C5
- * XY/WH are (x << 16 | y) and (w << 16 | h). Writes scaler packets for the
- * command ring into Commands (Direct3D pre-fills it with 0x80000000 NOPs).
- *
- * 12 arguments: 9-12 are on the stack. SysV callers put them at 8(r1) of
- * their frame, 4 bytes each; console callees read 8-byte slots from 0x50
- * of the caller frame (as in xenon-forge's VdSwap stub).
- */
-.ifndef VdInitializeScalerCommandBuffer
- xbox360_function VdInitializeScalerCommandBuffer
- xbox360_frame 0x70
- li 12, 0
- stw 12, 0x50(1)
- lwz 11, 0x78(1)
- stw 11, 0x54(1)
- stw 12, 0x58(1)
- lwz 11, 0x7c(1)
- stw 11, 0x5c(1)
- stw 12, 0x60(1)
- lwz 11, 0x80(1)
- stw 11, 0x64(1)
- stw 12, 0x68(1)
- lwz 11, 0x84(1)
- stw 11, 0x6c(1)
- xbox360_call VdInitializeScalerCommandBuffer
- xbox360_return 0x70
- xbox360_end VdInitializeScalerCommandBuffer, 0x010001c5
-.endif
-
-
-/* VOID VdCallGraphicsNotificationRoutines(ULONG Event, PVOID Data) - xboxkrnl 0x1B1.
- * Event 1 with 64 bytes describes the title's display to XAM (as D3D does). */
-xbox360_stub VdCallGraphicsNotificationRoutines, 0x010001b1
-
-/* RtlSetVectoredExceptionHandler(handler, handler) - xboxkrnl 0x36D: the
- * kernel calls the handler on the faulting thread with a pointer to the
- * exception record and register context (found by xsdk on hardware). */
-xbox360_stub RtlSetVectoredExceptionHandler, 0x0100036d
diff --git a/platform/xex/runtime/fault.c b/platform/xex/runtime/fault.c
deleted file mode 100644
index 67d7c4d..0000000
--- a/platform/xex/runtime/fault.c
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Fault report: a CPU exception in the title (bad pointer, illegal
- * instruction, ...) writes game:/crash.txt (and DbgPrint) with the
- * exception code, the faulting instruction, the registers and the return
- * addresses along the stack, then ends the title back to the dashboard.
- * Only faults in the title's own code are reported; others are passed on.
- * Look the addresses up with `xenon-addr2line -f -C -e app.elf <addr>`.
- *
- * How the kernel hands a title its faults was found on hardware by xsdk
- * (https://github.com/jessenic/xsdk, MIT; docs/HARDWARE.md, "How the kernel
- * hands a title its faults"): RtlSetVectoredExceptionHandler (0x36D) with
- * the handler as both arguments; the handler gets a pointer to the
- * exception record and the register context. A stack overflow can't be
- * caught (the context goes on the overflowed stack).
- */
-#include <stdint.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <string.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-#include "xex_runtime.h"
-
-extern unsigned long RtlSetVectoredExceptionHandler(void *first, void *handler);
-extern void XamLoaderTerminateTitle(void) __attribute__((noreturn));
-extern unsigned long DbgPrint(const char *format, ...);
-
-/* X_EXCEPTION_RECORD (xenia src/xenia/xbox.h) */
-typedef struct {
- uint32_t code;
- uint32_t flags;
- uint32_t nested;
- uint32_t address;
- uint32_t parameter_count;
- uint32_t parameters[15];
-} exception_record;
-
-typedef struct {
- exception_record *record;
- uint8_t *context;
-} exception_pointers;
-
-/* Register context offsets (xsdk's probe) */
-#define CTX_IAR 0x008
-#define CTX_LR 0x00c
-#define CTX_CTR 0x010
-#define CTX_GPR 0x018 /* r0-r31, 64 bits each */
-#define CTX_CR 0x118
-#define CTX_XER 0x11c
-
-#define CODE_START 0x82000000u
-#define CODE_END 0x84000000u
-
-static int report_fd = -1;
-static char line[256];
-
-static void out(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
-static void out(const char *fmt, ...)
-{
- va_list ap;
- va_start(ap, fmt);
- int n = vsnprintf(line, sizeof(line), fmt, ap);
- va_end(ap);
- if (n < 0) return;
- if (n >= (int)sizeof(line)) n = sizeof(line) - 1;
- DbgPrint("%s", line);
- if (report_fd >= 0) write(report_fd, line, n);
-}
-
-static uint32_t ctx32(const uint8_t *ctx, unsigned offset)
-{
- uint32_t v;
- memcpy(&v, ctx + offset, 4);
- return v;
-}
-
-/* low word of a 64-bit register */
-static uint32_t gpr(const uint8_t *ctx, int n)
-{
- return ctx32(ctx, CTX_GPR + n * 8 + 4);
-}
-
-static const char *code_name(uint32_t code)
-{
- switch (code) {
- case 0xc0000005: return "access violation";
- case 0x80000002: return "misaligned data";
- case 0xc000001d: return "illegal instruction";
- case 0xc0000096: return "privileged instruction";
- case 0xc00000fd: return "stack overflow";
- case 0xc0000094: return "integer divide by zero";
- default: return "exception";
- }
-}
-
-long xex_fault_handler(exception_pointers *pointers)
-{
- static int inside;
- if (inside) XamLoaderTerminateTitle(); /* a fault while reporting */
- inside = 1;
-
- exception_record *rec = pointers->record;
- const uint8_t *ctx = pointers->context;
- if (rec->address < CODE_START || rec->address >= CODE_END) {
- inside = 0;
- return 0; /* EXCEPTION_CONTINUE_SEARCH: not in the title's code */
- }
-
- report_fd = open("game:/crash.txt", O_WRONLY | O_CREAT | O_TRUNC, 0666);
- out("FAKE-08 XEX crash: %s (code %08x) at %08x\n", code_name(rec->code), (unsigned)rec->code,
- (unsigned)rec->address);
- if (rec->code == 0xc0000005 && rec->parameter_count >= 2)
- out(" %s of address %08x\n", rec->parameters[0] ? "write" : "read", (unsigned)rec->parameters[1]);
- else if (rec->parameter_count >= 1)
- out(" parameter %08x\n", (unsigned)rec->parameters[0]);
- out("IAR %08x LR %08x CTR %08x CR %08x XER %08x\n", (unsigned)ctx32(ctx, CTX_IAR),
- (unsigned)ctx32(ctx, CTX_LR), (unsigned)ctx32(ctx, CTX_CTR + 4), (unsigned)ctx32(ctx, CTX_CR),
- (unsigned)ctx32(ctx, CTX_XER));
- for (int r = 0; r < 32; r += 4)
- out("r%-2d %08x %08x %08x %08x\n", r, (unsigned)gpr(ctx, r), (unsigned)gpr(ctx, r + 1),
- (unsigned)gpr(ctx, r + 2), (unsigned)gpr(ctx, r + 3));
-
- /* Return addresses: SysV frames keep LR 4 bytes into the caller's frame. */
- out("stack:\n");
- uint32_t sp = gpr(ctx, 1);
- for (int depth = 0; depth < 24 && sp && (sp & 7) == 0; depth++) {
- uint32_t caller = *(volatile uint32_t *)sp;
- if (caller <= sp || caller - sp > 0x100000) break;
- uint32_t ret = *(volatile uint32_t *)(caller + 4);
- if (ret >= CODE_START && ret < CODE_END) out(" %08x\n", (unsigned)ret);
- sp = caller;
- }
- if (report_fd >= 0) close(report_fd);
-
- XamLoaderTerminateTitle();
-}
-
-/* kernel_entries.S: keeps r14-r31 whole for the kernel when the handler
- * returns (faults outside the title's code are passed on). */
-extern long xex_fault_handler_entry(exception_pointers *pointers);
-
-void xex_install_fault_handler(void)
-{
- RtlSetVectoredExceptionHandler((void *)xex_fault_handler_entry, (void *)xex_fault_handler_entry);
-}
diff --git a/platform/xex/runtime/fs.c b/platform/xex/runtime/fs.c
deleted file mode 100644
index 8fdd8b0..0000000
--- a/platform/xex/runtime/fs.c
+++ /dev/null
@@ -1,652 +0,0 @@
-/*
- * newlib file system calls and dirent for GCC-built Xbox 360 titles, on the
- * kernel's Nt* file API.
- *
- * Paths: "dev:/dir/file" or "dev:\dir\file" (dev = game, usb0..usb2, hdd, or
- * any other symbolic link), relative paths are relative to "game:". They
- * become the object name "\??\dev:\dir\file". Kernel paths starting with
- * '\' are passed through unchanged.
- */
-#include <errno.h>
-#include <fcntl.h>
-#include <reent.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <stdio.h>
-
-#include <xbox360/xboxkrnl.h>
-
-#include "xex_runtime.h"
-
-#define STATUS_END_OF_FILE 0xC0000011
-#define STATUS_NO_MORE_FILES 0x80000006
-#define STATUS_NO_SUCH_FILE 0xC000000F
-#define STATUS_OBJECT_NAME_NOT_FOUND 0xC0000034
-#define STATUS_OBJECT_NAME_COLLISION 0xC0000035
-#define STATUS_OBJECT_PATH_NOT_FOUND 0xC000003A
-#define STATUS_ACCESS_DENIED 0xC0000022
-#define STATUS_FILE_IS_A_DIRECTORY 0xC00000BA
-#define STATUS_NOT_A_DIRECTORY 0xC0000103
-#define STATUS_NO_SUCH_DEVICE 0xC000000E
-#define STATUS_DISK_FULL 0xC000007F
-#define STATUS_SHARING_VIOLATION 0xC0000043
-#define STATUS_CANNOT_DELETE 0xC0000121
-
-#ifndef FILE_LIST_DIRECTORY
-#define FILE_LIST_DIRECTORY 0x00000001
-#endif
-#ifndef FILE_READ_ATTRIBUTES
-#define FILE_READ_ATTRIBUTES 0x00000080
-#endif
-
-#define XEX_PATH_MAX 512
-#define MAX_FDS 64
-#define FIRST_FD 3
-
-typedef struct {
- HANDLE handle;
- long long pos;
- int append;
- int used;
-} xex_file;
-
-static xex_file files[MAX_FDS];
-
-/* ------------------------------------------------------------------------ */
-
-static int status_to_errno(NTSTATUS status)
-{
- switch ((unsigned)status) {
- case STATUS_NO_SUCH_FILE:
- case STATUS_OBJECT_NAME_NOT_FOUND:
- case STATUS_OBJECT_PATH_NOT_FOUND:
- case STATUS_NO_SUCH_DEVICE:
- return ENOENT;
- case STATUS_OBJECT_NAME_COLLISION:
- return EEXIST;
- case STATUS_ACCESS_DENIED:
- return EACCES;
- case STATUS_FILE_IS_A_DIRECTORY:
- return EISDIR;
- case STATUS_NOT_A_DIRECTORY:
- return ENOTDIR;
- case STATUS_DISK_FULL:
- return ENOSPC;
- case STATUS_SHARING_VIOLATION:
- case STATUS_CANNOT_DELETE:
- return EBUSY;
- default:
- return EIO;
- }
-}
-
-static int nt_ok(NTSTATUS status)
-{
- return (int)status >= 0;
-}
-
-/* "usb0:/a/b" -> "\??\usb0:\a\b"; relative -> "\??\game:\..." */
-int xex_kernel_path(const char *in, char *out, size_t size)
-{
- size_t o = 0;
- const char *p = in;
-
- if (!in || !*in) {
- return -1;
- }
-
- if (in[0] == '\\') { /* already a kernel path */
- if (strlen(in) + 1 > size) return -1;
- strcpy(out, in);
- return 0;
- }
-
- const char *colon = strchr(in, ':');
- const char *prefix = "\\??\\";
- for (const char *s = prefix; *s; s++) out[o++] = *s;
- if (!colon) {
- const char *game = "game:\\";
- for (const char *s = game; *s; s++) out[o++] = *s;
- }
-
- char last = 0;
- for (; *p && o + 2 < size; p++) {
- char c = (*p == '/') ? '\\' : *p;
- if (c == '\\' && last == '\\') continue; /* collapse "//" */
- out[o++] = c;
- last = c;
- }
- if (*p) return -1;
-
- /* "dev:" -> "dev:\" (root), strip other trailing separators */
- if (o > 0 && out[o - 1] == ':') {
- out[o++] = '\\';
- } else {
- while (o > 1 && out[o - 1] == '\\' && out[o - 2] != ':') o--;
- }
- out[o] = 0;
- return 0;
-}
-
-static void init_attributes(OBJECT_ATTRIBUTES *attributes, STRING *name, char *path)
-{
- size_t len = strlen(path);
- name->Length = (USHORT)len;
- name->MaximumLength = (USHORT)(len + 1);
- name->Buffer = path;
- attributes->RootDirectory = NULL;
- attributes->ObjectName = name;
- attributes->Attributes = OBJ_CASE_INSENSITIVE;
-}
-
-static NTSTATUS open_path(const char *path, HANDLE *handle, ACCESS_MASK access,
- ULONG disposition, ULONG options)
-{
- char kpath[XEX_PATH_MAX];
- STRING name;
- OBJECT_ATTRIBUTES attributes;
- IO_STATUS_BLOCK iosb;
-
- if (xex_kernel_path(path, kpath, sizeof(kpath)) != 0) {
- return STATUS_OBJECT_PATH_NOT_FOUND;
- }
- init_attributes(&attributes, &name, kpath);
- return NtCreateFile(handle, access | SYNCHRONIZE, &attributes, &iosb, NULL,
- FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ | FILE_SHARE_WRITE,
- (CREATE_DISPOSITION)disposition,
- options | FILE_SYNCHRONOUS_IO_NONALERT);
-}
-
-static xex_file *get_file(int fd)
-{
- if (fd < FIRST_FD || fd >= MAX_FDS || !files[fd].used) {
- return NULL;
- }
- return &files[fd];
-}
-
-/* FileStandardInformation: supported by every NT-style kernel. */
-typedef struct {
- LARGE_INTEGER AllocationSize;
- LARGE_INTEGER EndOfFile;
- ULONG NumberOfLinks;
- BOOLEAN DeletePending;
- BOOLEAN Directory;
-} XEX_FILE_STANDARD_INFORMATION;
-
-/* Size and attributes of an open file. Tries FileStandardInformation
- * first (FileNetworkOpenInformation is not available on every kernel). */
-static int query_file(HANDLE handle, long long *size, ULONG *attributes)
-{
- IO_STATUS_BLOCK iosb;
- XEX_FILE_STANDARD_INFORMATION standard;
- if (nt_ok(NtQueryInformationFile(handle, &iosb, &standard, sizeof(standard), FileStandardInformation))) {
- *size = standard.EndOfFile.QuadPart;
- *attributes = standard.Directory ? FILE_ATTRIBUTE_DIRECTORY : FILE_ATTRIBUTE_NORMAL;
- return 0;
- }
- FILE_NETWORK_OPEN_INFORMATION info;
- if (nt_ok(NtQueryInformationFile(handle, &iosb, &info, sizeof(info), FileNetworkOpenInformation))) {
- *size = info.EndOfFile.QuadPart;
- *attributes = info.FileAttributes;
- return 0;
- }
- return -1;
-}
-
-static long long file_size(HANDLE handle)
-{
- long long size;
- ULONG attributes;
- return query_file(handle, &size, &attributes) == 0 ? size : -1;
-}
-
-/* ------------------------------------------------------------------------ */
-/* newlib system calls */
-
-int _open_r(struct _reent *r, const char *path, int flags, int mode)
-{
- (void)mode;
- int fd;
- for (fd = FIRST_FD; fd < MAX_FDS && files[fd].used; fd++) {}
- if (fd == MAX_FDS) {
- r->_errno = EMFILE;
- return -1;
- }
-
- ACCESS_MASK access = FILE_READ_ATTRIBUTES;
- switch (flags & O_ACCMODE) {
- case O_RDONLY: access |= GENERIC_READ; break;
- case O_WRONLY: access |= GENERIC_WRITE; break;
- default: access |= GENERIC_READ | GENERIC_WRITE; break;
- }
-
- ULONG disposition;
- if ((flags & O_CREAT) && (flags & O_EXCL)) disposition = FILE_CREATE;
- else if ((flags & O_CREAT) && (flags & O_TRUNC)) disposition = FILE_OVERWRITE_IF;
- else if (flags & O_CREAT) disposition = FILE_OPEN_IF;
- else if (flags & O_TRUNC) disposition = FILE_OVERWRITE;
- else disposition = FILE_OPEN;
-
- HANDLE handle;
- NTSTATUS status = open_path(path, &handle, access, disposition, FILE_NON_DIRECTORY_FILE);
- if (!nt_ok(status)) {
- r->_errno = status_to_errno(status);
- return -1;
- }
-
- files[fd].handle = handle;
- files[fd].pos = 0;
- files[fd].append = (flags & O_APPEND) != 0;
- files[fd].used = 1;
- return fd;
-}
-
-int _close_r(struct _reent *r, int fd)
-{
- xex_file *f = get_file(fd);
- if (!f) {
- if (fd >= 0 && fd < FIRST_FD) return 0;
- r->_errno = EBADF;
- return -1;
- }
- NtClose(f->handle);
- f->used = 0;
- return 0;
-}
-
-_ssize_t _read_r(struct _reent *r, int fd, void *buf, size_t len)
-{
- xex_file *f = get_file(fd);
- if (!f) {
- r->_errno = EBADF;
- return -1;
- }
- if (len == 0) return 0;
-
- IO_STATUS_BLOCK iosb;
- LARGE_INTEGER offset;
- offset.QuadPart = f->pos;
- NTSTATUS status = NtReadFile(f->handle, NULL, NULL, NULL, &iosb, buf, (ULONG)len, &offset);
- if ((unsigned)status == STATUS_END_OF_FILE) {
- return 0;
- }
- if (!nt_ok(status)) {
- r->_errno = status_to_errno(status);
- return -1;
- }
- f->pos += iosb.Information;
- return (_ssize_t)iosb.Information;
-}
-
-_ssize_t _write_r(struct _reent *r, int fd, const void *buf, size_t len)
-{
- if (fd == 1 || fd == 2) {
- xex_debug_write(buf, len);
- return (_ssize_t)len;
- }
-
- xex_file *f = get_file(fd);
- if (!f) {
- r->_errno = EBADF;
- return -1;
- }
- if (len == 0) return 0;
-
- if (f->append) {
- long long size = file_size(f->handle);
- if (size >= 0) f->pos = size;
- }
-
- IO_STATUS_BLOCK iosb;
- LARGE_INTEGER offset;
- offset.QuadPart = f->pos;
- NTSTATUS status = NtWriteFile(f->handle, NULL, NULL, NULL, &iosb, (PVOID)buf, (ULONG)len, &offset);
- if (!nt_ok(status)) {
- r->_errno = status_to_errno(status);
- return -1;
- }
- f->pos += iosb.Information;
- return (_ssize_t)iosb.Information;
-}
-
-_off_t _lseek_r(struct _reent *r, int fd, _off_t off, int whence)
-{
- xex_file *f = get_file(fd);
- if (!f) {
- r->_errno = EBADF;
- return -1;
- }
- long long base;
- switch (whence) {
- case SEEK_SET: base = 0; break;
- case SEEK_CUR: base = f->pos; break;
- case SEEK_END:
- base = file_size(f->handle);
- if (base < 0) {
- r->_errno = EIO;
- return -1;
- }
- break;
- default:
- r->_errno = EINVAL;
- return -1;
- }
- if (base + off < 0) {
- r->_errno = EINVAL;
- return -1;
- }
- f->pos = base + off;
- return (_off_t)f->pos;
-}
-
-static void fill_stat(struct stat *st, ULONG attributes, long long size)
-{
- memset(st, 0, sizeof(*st));
- st->st_mode = (attributes & FILE_ATTRIBUTE_DIRECTORY) ? (S_IFDIR | 0777) : (S_IFREG | 0666);
- st->st_size = (off_t)size;
- st->st_nlink = 1;
- st->st_blksize = 4096;
-}
-
-int _fstat_r(struct _reent *r, int fd, struct stat *st)
-{
- if (fd >= 0 && fd < FIRST_FD) {
- memset(st, 0, sizeof(*st));
- st->st_mode = S_IFCHR;
- return 0;
- }
- xex_file *f = get_file(fd);
- if (!f) {
- r->_errno = EBADF;
- return -1;
- }
- long long size;
- ULONG attributes;
- if (query_file(f->handle, &size, &attributes) != 0) {
- r->_errno = EIO;
- return -1;
- }
- fill_stat(st, attributes, size);
- return 0;
-}
-
-int _stat_r(struct _reent *r, const char *path, struct stat *st)
-{
- char kpath[XEX_PATH_MAX];
- STRING name;
- OBJECT_ATTRIBUTES attributes;
- FILE_NETWORK_OPEN_INFORMATION info;
-
- if (xex_kernel_path(path, kpath, sizeof(kpath)) != 0) {
- r->_errno = ENAMETOOLONG;
- return -1;
- }
- init_attributes(&attributes, &name, kpath);
- NTSTATUS status = NtQueryFullAttributesFile(&attributes, &info);
- if (!nt_ok(status)) {
- /* No attributes by name (volume roots like "usb0:\", or kernels
- * without the call): open it and ask the handle. */
- HANDLE handle;
- NTSTATUS open_status = open_path(path, &handle, FILE_READ_ATTRIBUTES, FILE_OPEN, 0);
- if (!nt_ok(open_status)) {
- open_status = open_path(path, &handle, FILE_LIST_DIRECTORY, FILE_OPEN, FILE_DIRECTORY_FILE);
- }
- if (!nt_ok(open_status)) {
- r->_errno = status_to_errno(status);
- return -1;
- }
- long long size = 0;
- ULONG file_attributes = FILE_ATTRIBUTE_DIRECTORY;
- query_file(handle, &size, &file_attributes);
- NtClose(handle);
- fill_stat(st, file_attributes, size);
- return 0;
- }
- fill_stat(st, info.FileAttributes, info.EndOfFile.QuadPart);
- return 0;
-}
-
-int _isatty_r(struct _reent *r, int fd)
-{
- (void)r;
- return fd >= 0 && fd < FIRST_FD;
-}
-
-#ifndef DELETE
-#define DELETE 0x00010000
-#endif
-
-/* Deletes through FileDispositionInformation on an open handle: the
- * standard NT way, used when NtDeleteFile fails. */
-static NTSTATUS delete_by_handle(const char *path, ULONG options)
-{
- HANDLE handle;
- NTSTATUS status = open_path(path, &handle, DELETE, FILE_OPEN, options);
- if (!nt_ok(status)) return status;
- IO_STATUS_BLOCK iosb;
- BOOLEAN delete_file = TRUE;
- status = NtSetInformationFile(handle, &iosb, &delete_file, sizeof(delete_file), FileDispositionInformation);
- NtClose(handle);
- return status;
-}
-
-static int delete_path(const char *path, ULONG options)
-{
- char kpath[XEX_PATH_MAX];
- STRING name;
- OBJECT_ATTRIBUTES attributes;
- if (xex_kernel_path(path, kpath, sizeof(kpath)) != 0) {
- errno = ENAMETOOLONG;
- return -1;
- }
- init_attributes(&attributes, &name, kpath);
- NTSTATUS status = NtDeleteFile(&attributes);
- if (!nt_ok(status)) {
- status = delete_by_handle(path, options);
- }
- if (!nt_ok(status)) {
- errno = status_to_errno(status);
- return -1;
- }
- return 0;
-}
-
-int _unlink_r(struct _reent *r, const char *path)
-{
- if (delete_path(path, FILE_NON_DIRECTORY_FILE) != 0) {
- r->_errno = errno;
- return -1;
- }
- return 0;
-}
-
-int rmdir(const char *path)
-{
- return delete_path(path, FILE_DIRECTORY_FILE);
-}
-
-int _link_r(struct _reent *r, const char *existing, const char *new_path)
-{
- (void)existing; (void)new_path;
- r->_errno = ENOSYS;
- return -1;
-}
-
-int _rename_r(struct _reent *r, const char *old_path, const char *new_path)
-{
- (void)old_path; (void)new_path;
- r->_errno = ENOSYS;
- return -1;
-}
-
-int mkdir(const char *path, mode_t mode)
-{
- (void)mode;
- HANDLE handle;
- NTSTATUS status = open_path(path, &handle, FILE_LIST_DIRECTORY, FILE_CREATE, FILE_DIRECTORY_FILE);
- if (!nt_ok(status)) {
- errno = status_to_errno(status);
- return -1;
- }
- NtClose(handle);
- return 0;
-}
-
-int chdir(const char *path)
-{
- (void)path;
- errno = ENOSYS;
- return -1;
-}
-
-/* ------------------------------------------------------------------------ */
-/* dirent */
-
-struct __xex_dir {
- HANDLE handle;
- struct dirent entry;
- ULONG offset; /* offset of the next entry in buffer, or ~0 */
- int restart;
- unsigned char buffer[8192] __attribute__((aligned(8)));
-};
-
-DIR *opendir(const char *path)
-{
- HANDLE handle;
- NTSTATUS status = open_path(path, &handle, FILE_LIST_DIRECTORY, FILE_OPEN, FILE_DIRECTORY_FILE);
- if (!nt_ok(status)) {
- errno = status_to_errno(status);
- return NULL;
- }
- DIR *dir = (DIR *)malloc(sizeof(DIR));
- if (!dir) {
- NtClose(handle);
- errno = ENOMEM;
- return NULL;
- }
- dir->handle = handle;
- dir->offset = ~0u;
- dir->restart = 1;
- return dir;
-}
-
-struct dirent *readdir(DIR *dir)
-{
- if (!dir) {
- errno = EBADF;
- return NULL;
- }
- if (dir->offset == ~0u) {
- /* A FAT32 USB stick's driver returns one entry per call and leaves
- * NextEntryOffset (and FileIndex) unwritten, so whatever the buffer
- * held stays there: clear it, so a missing offset reads 0 (found by
- * xsdk, docs/HARDWARE.md "Listing a folder on a FAT32 USB stick"). */
- memset(dir->buffer, 0, sizeof(dir->buffer));
- IO_STATUS_BLOCK iosb;
- NTSTATUS status = NtQueryDirectoryFile(dir->handle, NULL, NULL, NULL, &iosb,
- dir->buffer, sizeof(dir->buffer), NULL,
- dir->restart ? TRUE : FALSE);
- dir->restart = 0;
- if (!nt_ok(status) || (unsigned)status == STATUS_NO_MORE_FILES) {
- return NULL;
- }
- dir->offset = 0;
- }
-
- if (dir->offset + sizeof(FILE_DIRECTORY_INFORMATION) > sizeof(dir->buffer)) {
- dir->offset = ~0u;
- return readdir(dir);
- }
- FILE_DIRECTORY_INFORMATION *info = (FILE_DIRECTORY_INFORMATION *)(dir->buffer + dir->offset);
- ULONG len = info->FileNameLength;
- if (len > sizeof(dir->entry.d_name) - 1) len = sizeof(dir->entry.d_name) - 1;
- memcpy(dir->entry.d_name, info->FileName, len);
- dir->entry.d_name[len] = 0;
- dir->entry.d_type = (info->FileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? DT_DIR : DT_REG;
- dir->entry.d_ino = 0;
-
- ULONG next = info->NextEntryOffset;
- dir->offset = (next && dir->offset + next < sizeof(dir->buffer)) ? dir->offset + next : ~0u;
- return &dir->entry;
-}
-
-void rewinddir(DIR *dir)
-{
- if (dir) {
- dir->offset = ~0u;
- dir->restart = 1;
- }
-}
-
-int closedir(DIR *dir)
-{
- if (!dir) {
- errno = EBADF;
- return -1;
- }
- NtClose(dir->handle);
- free(dir);
- return 0;
-}
-
-/* ------------------------------------------------------------------------ */
-/* Mount points */
-
-static NTSTATUS link_device(const char *link, const char *device)
-{
- char link_buf[64], device_buf[96];
- STRING link_name, device_name;
- strcpy(link_buf, link);
- strcpy(device_buf, device);
- link_name.Length = (USHORT)strlen(link_buf);
- link_name.MaximumLength = link_name.Length + 1;
- link_name.Buffer = link_buf;
- device_name.Length = (USHORT)strlen(device_buf);
- device_name.MaximumLength = device_name.Length + 1;
- device_name.Buffer = device_buf;
- return ObCreateSymbolicLink(&link_name, &device_name);
-}
-
-/* name "usbX" -> "\??\usbX:" */
-static void link_name_of(const char *name, char *out, size_t size)
-{
- size_t n = strlen(name);
- if (n > 0 && name[n - 1] == ':') n--;
- snprintf(out, size, "\\??\\%.*s:", (int)n, name);
-}
-
-int xex_mount(const char *name, const char *device)
-{
- char link[64];
- link_name_of(name, link, sizeof(link));
- NTSTATUS status = link_device(link, device);
- if (!nt_ok(status)) {
- errno = status_to_errno(status);
- return -1;
- }
- return 0;
-}
-
-int xex_unmount(const char *name)
-{
- char link[64];
- STRING link_name;
- link_name_of(name, link, sizeof(link));
- link_name.Length = (USHORT)strlen(link);
- link_name.MaximumLength = link_name.Length + 1;
- link_name.Buffer = link;
- return nt_ok(ObDeleteSymbolicLink(&link_name)) ? 0 : -1;
-}
-
-void xex_mount_devices(void)
-{
- link_device("\\??\\usb0:", "\\Device\\Mass0");
- link_device("\\??\\usb1:", "\\Device\\Mass1");
- link_device("\\??\\usb2:", "\\Device\\Mass2");
- link_device("\\??\\hdd:", "\\Device\\Harddisk0\\Partition1");
-}
diff --git a/platform/xex/runtime/include/sys/dirent.h b/platform/xex/runtime/include/sys/dirent.h
deleted file mode 100644
index a3dc358..0000000
--- a/platform/xex/runtime/include/sys/dirent.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Directory listing for GCC-built Xbox 360 titles (implemented in fs.c on
- * NtQueryDirectoryFile). Replaces newlib's "not supported" sys/dirent.h. */
-#ifndef _XEX_SYS_DIRENT_H
-#define _XEX_SYS_DIRENT_H
-
-#include <sys/types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define DT_UNKNOWN 0
-#define DT_DIR 4
-#define DT_REG 8
-
-struct dirent {
- ino_t d_ino;
- unsigned char d_type;
- char d_name[256];
-};
-
-typedef struct __xex_dir DIR;
-
-DIR *opendir(const char *path);
-struct dirent *readdir(DIR *dir);
-int closedir(DIR *dir);
-void rewinddir(DIR *dir);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/platform/xex/runtime/input.c b/platform/xex/runtime/input.c
deleted file mode 100644
index 505c46a..0000000
--- a/platform/xex/runtime/input.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Controllers through XamInputGetState (xam.xex ordinal 401). */
-#include <string.h>
-
-#include <xbox360/base.h>
-#include <xbox360/xam/input.h>
-
-#include "xex_input.h"
-
-int xex_input_get(int port, xex_pad *pad)
-{
- XINPUT_STATE state;
- memset(&state, 0, sizeof(state));
- memset(pad, 0, sizeof(*pad));
- if (XamInputGetState((DWORD)port, XINPUT_FLAG_GAMEPAD, &state) != 0) {
- return -1;
- }
- pad->buttons = state.Gamepad.wButtons;
- pad->left_trigger = state.Gamepad.bLeftTrigger;
- pad->right_trigger = state.Gamepad.bRightTrigger;
- pad->lx = state.Gamepad.sThumbLX;
- pad->ly = state.Gamepad.sThumbLY;
- pad->rx = state.Gamepad.sThumbRX;
- pad->ry = state.Gamepad.sThumbRY;
- return 0;
-}
diff --git a/platform/xex/runtime/kernel_entries.S b/platform/xex/runtime/kernel_entries.S
deleted file mode 100644
index e8eb82b..0000000
--- a/platform/xex/runtime/kernel_entries.S
+++ /dev/null
@@ -1,7 +0,0 @@
-/* Functions the kernel calls with the console calling convention, which
- * expects r14-r31 back in full 64 bits (see sdk/crt/entry.inc): the audio
- * render driver's callback and the vectored exception handler. */
-#include "../sdk/crt/entry.inc"
-
-xbox360_entry xex_audio_callback_entry, xex_audio_callback
-xbox360_entry xex_fault_handler_entry, xex_fault_handler
diff --git a/platform/xex/runtime/link.ld b/platform/xex/runtime/link.ld
deleted file mode 100644
index 2e267d0..0000000
--- a/platform/xex/runtime/link.ld
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Link script for GCC-built titles: code at 0x82010000 (the first 64 KB
- * page holds the XEX headers), each kind of section on its own 64 KB pages
- * like xex-link's own script, plus what newlib/libstdc++ need:
- * .ctors, .eh_frame (kept, zero terminated), .gcc_except_table, .got2. */
-ENTRY(_start)
-
-SECTIONS {
- . = 0x82010000;
- .text : {
- *(.text._start)
- *(.text .text.* .gnu.linkonce.t.*)
- }
- . = ALIGN(4);
- .xthunks : { *(.xthunks .xthunks.*) }
-
- . = ALIGN(0x10000);
- .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) *(.sdata2 .sdata2.*) }
- . = ALIGN(4);
- .eh_frame : {
- PROVIDE(__eh_frame_start = .);
- KEEP(*(.eh_frame))
- LONG(0)
- }
- .gcc_except_table : { *(.gcc_except_table .gcc_except_table.*) }
-
- . = ALIGN(0x10000);
- .ctors : {
- __CTOR_LIST__ = .;
- KEEP(*(SORT(.ctors.*)))
- KEEP(*(.ctors))
- __CTOR_END__ = .;
- }
- .dtors : { KEEP(*(.dtors .dtors.*)) }
- .init_array : { KEEP(*(.init_array .init_array.*)) }
- .got2 : { *(.got2) }
- .got : { *(.got .got.plt) }
- .data : { *(.data .data.* .gnu.linkonce.d.*) *(.sdata .sdata.*) }
- .xvars : { *(.xvars .xvars.*) }
-
- . = ALIGN(0x10000);
- .bss : {
- __bss_start = .;
- *(.bss .bss.*) *(.sbss .sbss.*) *(COMMON)
- __bss_end = .;
- }
- . = ALIGN(8);
- _end = .;
-
- /DISCARD/ : { *(.comment) *(.note .note.*) *(.eh_frame_hdr) }
-}
diff --git a/platform/xex/runtime/posix.c b/platform/xex/runtime/posix.c
deleted file mode 100644
index 1517dee..0000000
--- a/platform/xex/runtime/posix.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * POSIX entry points on top of the reentrant newlib system calls. This
- * newlib build has no "supplied syscalls" layer (libxenon normally provides
- * it), so libstdc++ and application code calling read(), stat() etc. need
- * these wrappers.
- */
-#include <reent.h>
-#include <stdarg.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <fcntl.h>
-
-/* Normally from crtbegin.o: identifies this module for __cxa_atexit. */
-void *__dso_handle = &__dso_handle;
-
-int open(const char *path, int flags, ...)
-{
- int mode = 0;
- if (flags & O_CREAT) {
- va_list ap;
- va_start(ap, flags);
- mode = va_arg(ap, int);
- va_end(ap);
- }
- return _open_r(_REENT, path, flags, mode);
-}
-
-int close(int fd) { return _close_r(_REENT, fd); }
-ssize_t read(int fd, void *buf, size_t len) { return _read_r(_REENT, fd, buf, len); }
-ssize_t write(int fd, const void *buf, size_t len) { return _write_r(_REENT, fd, buf, len); }
-off_t lseek(int fd, off_t off, int whence) { return _lseek_r(_REENT, fd, off, whence); }
-int fstat(int fd, struct stat *st) { return _fstat_r(_REENT, fd, st); }
-int stat(const char *path, struct stat *st) { return _stat_r(_REENT, path, st); }
-int unlink(const char *path) { return _unlink_r(_REENT, path); }
-int isatty(int fd) { return _isatty_r(_REENT, fd); }
-int gettimeofday(struct timeval *tv, void *tz) { return _gettimeofday_r(_REENT, tv, tz); }
diff --git a/platform/xex/runtime/sys.c b/platform/xex/runtime/sys.c
deleted file mode 100644
index 1c58663..0000000
--- a/platform/xex/runtime/sys.c
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * newlib system calls that are not about files: heap, debug output,
- * time, process. Files and directories are in fs.c.
- */
-#include <errno.h>
-#include <reent.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <sys/time.h>
-#include <sys/times.h>
-#include <time.h>
-
-#include <xbox360/xboxkrnl.h>
-/* xam.h is not included: its socket types clash with newlib. */
-extern void XamLoaderTerminateTitle(void) __attribute__((noreturn));
-
-#include "xex_runtime.h"
-
-/* VOID XNotifyQueueUI(DWORD Type, DWORD UserIndex, ULONGLONG Areas,
- * PCWSTR Text, PVOID Context): Areas is one register in the console ABI,
- * so it is passed as a 32-bit value (see extra_imports.S). */
-extern void XNotifyQueueUI(uint32_t type, uint32_t user, uint32_t areas,
- const uint16_t *text, void *context);
-
-/* ------------------------------------------------------------------------ */
-/* Heap: a .bss arena (the loader commits it with the image). */
-
-#ifndef XEX_HEAP_SIZE
-#define XEX_HEAP_SIZE (96 * 1024 * 1024)
-#endif
-static char heap[XEX_HEAP_SIZE] __attribute__((aligned(64)));
-static size_t heap_used;
-
-void *_sbrk_r(struct _reent *r, ptrdiff_t incr)
-{
- if (incr < 0 || heap_used + (size_t)incr > XEX_HEAP_SIZE) {
- r->_errno = ENOMEM;
- return (void *)-1;
- }
- void *p = heap + heap_used;
- heap_used += (size_t)incr;
- return p;
-}
-
-/* ------------------------------------------------------------------------ */
-/* Debug output and notifications */
-
-void xex_debug_write(const void *buf, size_t len)
-{
- char tmp[257];
- size_t done = 0;
- while (done < len) {
- size_t n = len - done > 256 ? 256 : len - done;
- for (size_t i = 0; i < n; i++) tmp[i] = ((const char *)buf)[done + i];
- tmp[n] = 0;
- DbgPrint("%s", tmp);
- done += n;
- }
-}
-
-void xex_notify(const char *text)
-{
- uint16_t wide[128];
- size_t n = 0;
- for (; text[n] && n < 127; n++) wide[n] = (uint8_t)text[n];
- wide[n] = 0;
- XNotifyQueueUI(14 /* XNOTIFYUI_TYPE_PREFERRED_REVIEW */, 0, 2 /* high priority */, wide, NULL);
-}
-
-/* ------------------------------------------------------------------------ */
-/* Time */
-
-uint64_t xex_timebase(void)
-{
- uint64_t tb;
- __asm__ volatile("mftb %0" : "=r"(tb)); /* 64-bit register */
- return tb;
-}
-
-uint64_t xex_timebase_freq(void)
-{
- /* The time base runs at the CPU clock / 64 = 49.875 MHz, while
- * KeQueryPerformanceFrequency reports 50 MHz (measured by xsdk against
- * the 60 Hz display: docs/HARDWARE.md, "The time base runs at 49.875
- * MHz"). Xenia runs it at 50 MHz, so times there read 0.25% long. */
- return 49875000ull;
-}
-
-void xex_sleep_ms(unsigned ms)
-{
- LARGE_INTEGER interval;
- interval.QuadPart = -(LONGLONG)ms * 10000; /* relative, 100 ns units */
- KeDelayExecutionThread(1 /* UserMode */, FALSE, &interval);
-}
-
-int _gettimeofday_r(struct _reent *r, struct timeval *tv, void *tz)
-{
- (void)r; (void)tz;
- LARGE_INTEGER now;
- KeQuerySystemTime(&now); /* 100 ns since 1601-01-01 */
- long long us = (now.QuadPart - 116444736000000000LL) / 10;
- tv->tv_sec = (time_t)(us / 1000000);
- tv->tv_usec = (suseconds_t)(us % 1000000);
- return 0;
-}
-
-clock_t _times_r(struct _reent *r, struct tms *buf)
-{
- (void)r;
- clock_t t = (clock_t)(xex_timebase() / (xex_timebase_freq() / CLOCKS_PER_SEC));
- if (buf) {
- buf->tms_utime = t;
- buf->tms_stime = 0;
- buf->tms_cutime = 0;
- buf->tms_cstime = 0;
- }
- return t;
-}
-
-int usleep(useconds_t us)
-{
- xex_sleep_ms((unsigned)((us + 999) / 1000));
- return 0;
-}
-
-/* ------------------------------------------------------------------------ */
-/* Process */
-
-int _kill_r(struct _reent *r, int pid, int sig)
-{
- (void)pid; (void)sig;
- r->_errno = EINVAL;
- return -1;
-}
-
-int _getpid_r(struct _reent *r)
-{
- (void)r;
- return 1;
-}
-
-void _exit(int status)
-{
- (void)status;
- XamLoaderTerminateTitle();
-}
diff --git a/platform/xex/runtime/video.c b/platform/xex/runtime/video.c
deleted file mode 100644
index 90f10e6..0000000
--- a/platform/xex/runtime/video.c
+++ /dev/null
@@ -1,908 +0,0 @@
-/*
- * Scanout of CPU-drawn frames: C port of xenon-forge's xbox360-video crate
- * (src/crates/xbox360-video: lib.rs, ring.rs, memory.rs, fetch.rs;
- * https://github.com/landaire/xenon-forge, MIT/Apache-2.0).
- *
- * The title takes the GPU engines (VdInitializeEngines with the kernel's
- * microcode), runs a command ring of its own, and flips between two tiled
- * front buffers with VdSwap at vertical blank. xex_video_shutdown (also run
- * at exit) gives the engines back so the dashboard can draw again.
- */
-#include <stdint.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <xbox360/xboxkrnl.h>
-
-#include "xex_video.h"
-
-/* Imports declared in extra_imports.S */
-extern void VdQueryVideoMode(void *mode);
-extern ULONG VdInitializeScalerCommandBuffer(ULONG source_xy, ULONG source_wh, ULONG output_xy,
- ULONG output_wh, ULONG front_buffer_wh,
- ULONG vertical_filter_type, void *vertical_filter,
- ULONG horizontal_filter_type, void *horizontal_filter,
- ULONG unknown9, PULONG commands, ULONG command_dwords);
-
-extern void VdCallGraphicsNotificationRoutines(ULONG event, const void *data);
-
-void (*xex_video_trace)(const char *fmt, ...);
-#define TRACE(...) do { if (xex_video_trace) xex_video_trace(__VA_ARGS__); } while (0)
-
-static inline uint64_t timebase_now(void)
-{
- uint64_t tb;
- __asm__ volatile("mftb %0" : "=r"(tb));
- return tb;
-}
-/* 100 ms at 49.875 MHz */
-#define WAIT_TIMEOUT_TB 4987500ull
-
-/* ------------------------------------------------------------------------ */
-/* GPU registers, memory, processor helpers */
-
-#define GPU_REGISTERS 0x7fc80000u
-
-static inline uint32_t gpu_read(uint32_t index)
-{
- return *(volatile uint32_t *)(GPU_REGISTERS + index * 4);
-}
-
-static inline void gpu_write(uint32_t index, uint32_t value)
-{
- *(volatile uint32_t *)(GPU_REGISTERS + index * 4) = value;
-}
-
-static inline void cpu_sync(void) { __asm__ volatile("sync" ::: "memory"); }
-static inline void low_priority_hint(void) { __asm__ volatile("or 31, 31, 31" ::: "memory"); }
-
-#define MEMORY_REGION_TITLE 1
-#define PAGE_READWRITE_ 0x004
-#define PAGE_NOCACHE_ 0x200
-#define PAGE_WRITECOMBINE_ 0x400
-
-typedef struct {
- uint32_t *words; /* virtual */
- uint32_t physical; /* GPU address */
- uint32_t bytes;
-} phys_buffer;
-
-static int phys_alloc(phys_buffer *b, uint32_t bytes, uint32_t caching)
-{
- bytes = (bytes + 0xfff) & ~0xfffu;
- void *p = MmAllocatePhysicalMemoryEx(MEMORY_REGION_TITLE, bytes, PAGE_READWRITE_ | caching,
- 0, 0x1fffffff, 0x1000);
- if (!p) return -1;
- b->words = (uint32_t *)p;
- b->physical = MmGetPhysicalAddress(p);
- b->bytes = bytes;
- return 0;
-}
-
-static void phys_free(phys_buffer *b)
-{
- if (b->words) {
- MmFreePhysicalMemory(MEMORY_REGION_TITLE, b->words);
- b->words = NULL;
- }
-}
-
-static inline uint32_t read_word(const phys_buffer *b, uint32_t offset)
-{
- return ((volatile uint32_t *)b->words)[offset / 4];
-}
-
-/* ------------------------------------------------------------------------ */
-/* Command ring (ring.rs) */
-
-#define RING_WRITE_POINTER 0x1c5
-#define RING_BYTES 0x8000u
-#define RING_DWORDS (RING_BYTES / 4)
-#define GRANULE_DWORDS 8u
-#define WRITEBACK_BYTES 0x1000u
-#define ENGINE_INIT_MASK 0x3ffu
-#define ENGINE_INIT_STEP 0x80u
-#define ENGINE_INIT_WORD12 0x00010800u
-#define REGISTER_0D02 0x0d02
-#define KERNEL_REGISTER_0D02 0x800u
-#define PIPELINE_CONTROL_05C8 0x05c8
-#define PIPELINE_CONTROL_05C8_VALUE 0x00020000u
-#define ENGINE_INIT_WORD13 7u
-#define WAIT_MEMORY_EQUAL 0x13u
-#define WAIT_INTERVAL 0x100u
-#define EVENT_SHADER_DONE 3u
-#define ENDIAN_8_IN_32 2u
-#define SWAP_IDENTIFIER_OFFSET 0x08u
-#define READ_POINTER_OFFSET 0x3cu
-#define PIPELINE_FENCE_OFFSET 0x40u
-
-#define OPCODE_NOP 0x10
-#define OPCODE_WAIT 0x3c
-#define OPCODE_EVENT_WRITE 0x58
-#define OPCODE_REGISTER_RMW 0x21
-#define OPCODE_ENGINE_INIT 0x48
-
-static inline uint32_t type0(uint32_t reg, uint32_t count)
-{
- return ((count - 1) << 16) | reg;
-}
-
-static inline uint32_t type3(uint32_t opcode, uint32_t count)
-{
- return 0xc0000000u | ((count - 1) << 16) | (opcode << 8);
-}
-
-typedef struct {
- phys_buffer commands;
- phys_buffer writeback;
- uint32_t write; /* next dword, from the ring base */
- uint32_t read; /* last read pointer read back */
- uint32_t fence;
-} ring_t;
-
-static uint32_t ring_read_pointer(const ring_t *r)
-{
- return read_word(&r->writeback, READ_POINTER_OFFSET);
-}
-
-static uint32_t ring_free(const ring_t *r)
-{
- return (r->read - r->write - 1) % RING_DWORDS;
-}
-
-static void ring_kick(ring_t *r)
-{
- uint32_t next = (r->write + GRANULE_DWORDS - 1) / GRANULE_DWORDS * GRANULE_DWORDS;
- uint32_t pad = next - r->write;
- if (pad == 1) pad += GRANULE_DWORDS; /* a NOP is at least two dwords */
- if (pad != 0) {
- r->commands.words[r->write] = type3(OPCODE_NOP, pad - 1);
- }
- r->write = (r->write + pad) % RING_DWORDS;
- cpu_sync(); /* write-combined stores reach memory before the GPU looks */
- gpu_write(RING_WRITE_POINTER, r->write);
-}
-
-static void ring_wait_free(ring_t *r, uint32_t dwords)
-{
- while (ring_free(r) < dwords) {
- r->read = ring_read_pointer(r);
- if (ring_free(r) < dwords) low_priority_hint();
- }
-}
-
-static uint32_t *ring_reserve(ring_t *r, uint32_t dwords)
-{
- uint32_t needed = dwords + GRANULE_DWORDS + 1;
- if (r->write + needed > RING_DWORDS || ring_free(r) < needed) {
- ring_kick(r);
- }
- if (r->write + needed > RING_DWORDS) {
- uint32_t tail = RING_DWORDS - r->write;
- ring_wait_free(r, tail);
- r->commands.words[r->write] = type3(OPCODE_NOP, tail - 1);
- r->write = 0;
- ring_kick(r);
- }
- ring_wait_free(r, needed);
- return &r->commands.words[r->write];
-}
-
-static void ring_commit(ring_t *r, uint32_t dwords)
-{
- r->write += dwords;
-}
-
-static void ring_wait_for_pipeline(ring_t *r)
-{
- r->fence++;
- uint32_t address = r->writeback.physical + PIPELINE_FENCE_OFFSET;
- uint32_t *w = ring_reserve(r, 10);
- w[0] = type3(OPCODE_EVENT_WRITE, 3);
- w[1] = EVENT_SHADER_DONE;
- w[2] = address | ENDIAN_8_IN_32;
- w[3] = r->fence;
- w[4] = type3(OPCODE_WAIT, 5);
- w[5] = WAIT_MEMORY_EQUAL;
- w[6] = address | ENDIAN_8_IN_32;
- w[7] = r->fence;
- w[8] = 0xffffffffu;
- w[9] = WAIT_INTERVAL;
- ring_commit(r, 10);
-}
-
-static int ring_pipeline_drained(const ring_t *r)
-{
- return read_word(&r->writeback, PIPELINE_FENCE_OFFSET) == r->fence;
-}
-
-static void ring_block_until_idle(ring_t *r)
-{
- uint32_t *w = ring_reserve(r, 2);
- w[0] = type0(PIPELINE_CONTROL_05C8, 1);
- w[1] = PIPELINE_CONTROL_05C8_VALUE;
- ring_commit(r, 2);
- ring_wait_for_pipeline(r);
- ring_kick(r);
- while (!ring_pipeline_drained(r)) low_priority_hint();
-}
-
-static void ring_wait_idle(const ring_t *r)
-{
- while (ring_read_pointer(r) != r->write) low_priority_hint();
-}
-
-static int ring_init(ring_t *r)
-{
- memset(r, 0, sizeof(*r));
- if (phys_alloc(&r->commands, RING_BYTES, PAGE_WRITECOMBINE_) != 0) return -1;
- if (phys_alloc(&r->writeback, WRITEBACK_BYTES, PAGE_NOCACHE_) != 0) {
- phys_free(&r->commands);
- return -1;
- }
- memset(r->writeback.words, 0, WRITEBACK_BYTES);
-
- /* log2(dwords) - 1 and log2(bytes / 512), as D3D derives them */
- VdInitializeRingBuffer(r->commands.physical, 12 /* log2(0x2000) - 1 */);
- VdEnableRingBufferRPtrWriteBack(r->writeback.physical + READ_POINTER_OFFSET, 6 /* log2(0x8000 >> 9) */);
- VdSetSystemCommandBufferGpuIdentifierAddress((PULONG)((uint32_t)r->writeback.words + SWAP_IDENTIFIER_OFFSET));
-
- uint32_t *w = ring_reserve(r, 21);
- w[0] = type3(OPCODE_ENGINE_INIT, 18);
- w[1] = ENGINE_INIT_MASK;
- w[2] = 0;
- w[3] = 0;
- for (int i = 0; i < 8; i++) w[4 + i] = (uint32_t)i * ENGINE_INIT_STEP;
- w[12] = ENGINE_INIT_WORD12;
- w[13] = ENGINE_INIT_WORD13;
- for (int i = 14; i < 19; i++) w[i] = 0;
- w[19] = type0(REGISTER_0D02, 1);
- w[20] = ENGINE_INIT_WORD12;
- ring_commit(r, 21);
- ring_kick(r);
- return 0;
-}
-
-static void ring_detach(ring_t *r)
-{
- ring_block_until_idle(r);
- ring_wait_idle(r);
- gpu_write(REGISTER_0D02, KERNEL_REGISTER_0D02);
- VdSetSystemCommandBufferGpuIdentifierAddress(NULL);
-}
-
-/* ------------------------------------------------------------------------ */
-/* Display (lib.rs) */
-
-#define TILE_EDGE 32
-#define SCANOUT_CONTROL 0x1841
-#define SCANOUT_ADDRESS 0x1844
-#define SCANOUT_UPDATE 0x1851
-#define UPDATE_PENDING (1u << 0)
-#define UPDATE_TAKEN (1u << 1)
-#define SCANOUT_FORMAT_1930 0x1930
-#define SCANOUT_CONTROL_KEEP 0xfffff8ffu
-#define SWAP_DWORDS 64u
-#define FLIP_DWORDS (2u + 4u + 2u)
-#define RETRAIN_COMMAND_DWORDS 0x1000u
-#define RETRAIN_WORK_BYTES 0x800u
-
-typedef struct {
- phys_buffer memory;
- uint32_t fetch_constant[6];
-} front_buffer;
-
-typedef struct { uint32_t address, pitch, x_end, y_end; } display_surface_t;
-
-static struct {
- int open;
- ring_t ring;
- front_buffer buffers[2];
- int back;
- uint32_t pitch_tiles;
- uint32_t tile_x, tile_y, width, height;
- int pending;
- uint32_t pending_identifier;
- uint32_t pending_address;
- const char *error;
- int presented;
- uint32_t surface_height;
- /* The Guide: XAM's surface shows in place of ours while VdSwap hands it back. */
- int pending_system;
- display_surface_t pending_surface;
- int showing_system;
- unsigned system_frames;
- int guide_supported;
- /* A display controller answers (the LUT autofill finishes): show
- * surfaces through its registers. Xenia has none and shows what VdSwap
- * names; writing its scanout register directly turns its picture white. */
- int controller;
- /* front buffers of the output's size, scaler off */
- int native;
- uint32_t output_width, output_height;
-} display;
-
-/* fetch.rs: texture fetch constant of a tiled 8:8:8:8 front buffer */
-static void front_buffer_fetch(uint32_t out[6], uint32_t base, uint32_t pitch_tiles,
- uint32_t width, uint32_t height)
-{
- out[0] = (1u << 31) | (pitch_tiles << 22) | 2u; /* tiled, pitch, texture */
- out[1] = base | (2u << 6) | 6u; /* 8-in-32, k_8_8_8_8 */
- out[2] = (width - 1) | ((height - 1) << 13);
- out[3] = 0;
- out[4] = 0;
- out[5] = 1u << 9; /* 2D */
-}
-
-static int retraining_after_swap_due;
-
-static void retrain_edram(int at_init)
-{
- static uint8_t work[RETRAIN_WORK_BYTES] __attribute__((aligned(16)));
- ULONG flags = at_init ? 1 : 0;
-
- memset(work, 0, sizeof(work));
- KeEnterCriticalRegion();
- if (at_init) {
- VdRetrainEDRAMWorker(0);
- }
- ULONG state = 0;
- PULONG commands = NULL;
- ULONG due = VdRetrainEDRAM(flags, &commands, RETRAIN_COMMAND_DWORDS, &state, work, RETRAIN_WORK_BYTES);
- if (at_init || due) TRACE("retrain(%s): due=%u state=%u", at_init ? "init" : "swap", (unsigned)due, (unsigned)state);
- if (due) {
- if (!at_init) {
- ring_block_until_idle(&display.ring);
- }
- for (;;) {
- uint32_t *start = ring_reserve(&display.ring, RETRAIN_COMMAND_DWORDS);
- PULONG cursor = (PULONG)start;
- ULONG more = VdRetrainEDRAM(flags, &cursor, RETRAIN_COMMAND_DWORDS, &state, work, RETRAIN_WORK_BYTES);
- ring_commit(&display.ring, (uint32_t)((uint32_t *)cursor - start));
- ring_block_until_idle(&display.ring);
- if (!more) break;
- }
- retraining_after_swap_due = 1;
- }
- KeLeaveCriticalRegion();
-}
-
-static unsigned flip_count;
-
-/*
- * Showing a surface the way XAM does (found on hardware by xsdk,
- * https://github.com/jessenic/xsdk src/display.c, MIT): the surface goes
- * into 0x2840/0x2844 and the D1GRPH registers, then 0x60EC
- * (D1CRTC_DOUBLE_BUFFER_CONTROL) = 1 makes the display take it; the
- * display clears it again. Without this the screen stays black.
- */
-#define REG_SURFACE_2840 (0x2840 / 4)
-#define REG_PITCH_2844 (0x2844 / 4)
-#define REG_D1GRPH_PITCH (0x6120 / 4)
-#define REG_D1GRPH_X_END (0x6134 / 4)
-#define REG_D1GRPH_Y_END (0x6138 / 4)
-#define REG_DOUBLE_BUFFER_CTL (0x60ec / 4)
-
-typedef display_surface_t display_surface;
-static display_surface old_surface;
-
-/*
- * Scaler registers (byte offsets; xsdk src/display.c): enable, tap control,
- * viewport size, viewport width / 4 - 1, then filter control, scale (8.24)
- * and start phase, horizontal and vertical. 0x65CC bit 16 holds them until
- * it's released.
- */
-#define SCALER_REGISTERS 10
-static const uint16_t scaler_offsets[SCALER_REGISTERS] = {
- 0x6590, 0x6594, 0x6584, 0x65e8, 0x65b0, 0x65b4, 0x65b8, 0x65c0, 0x65c4, 0x65c8};
-#define REG_SCALER_UPDATE (0x65cc / 4)
-static uint32_t kernel_scaler[SCALER_REGISTERS];
-static uint32_t own_scaler[SCALER_REGISTERS]; /* for the title's surface */
-
-static void scaler_write(const uint32_t values[SCALER_REGISTERS])
-{
- if (!display.controller) return;
- gpu_write(REG_SCALER_UPDATE, 0x10000);
- for (int i = 0; i < SCALER_REGISTERS; i++) gpu_write(scaler_offsets[i] / 4, values[i]);
- gpu_write(REG_SCALER_UPDATE, 0);
-}
-
-/* The scaler filling the output with a width x height surface: 2 taps each
- * way through the built-in filter, phase (scale + taps + 1) / 2. */
-static void scaler_plan(uint32_t width, uint32_t height, uint32_t values[SCALER_REGISTERS])
-{
- uint32_t h = (uint32_t)(((uint64_t)width << 24) / display.output_width);
- uint32_t v = (uint32_t)(((uint64_t)height << 24) / display.output_height);
- values[0] = (h != 1u << 24 || v != 1u << 24);
- values[1] = 0x101;
- values[2] = (width << 16) | height;
- values[3] = width / 4 - 1;
- values[4] = kernel_scaler[4] | 0x100;
- values[5] = h;
- values[6] = (3u << 15) + (h >> 9);
- values[7] = kernel_scaler[7] | 0x100;
- values[8] = v;
- values[9] = (3u << 15) + (v >> 9);
-}
-
-static int display_apply(const display_surface *s)
-{
- if (!display.controller) return 1;
- gpu_write(REG_SURFACE_2840, s->address);
- gpu_write(REG_PITCH_2844, s->pitch);
- gpu_write(SCANOUT_ADDRESS, s->address);
- gpu_write(REG_D1GRPH_PITCH, s->pitch);
- gpu_write(REG_D1GRPH_X_END, s->x_end);
- gpu_write(REG_D1GRPH_Y_END, s->y_end);
- gpu_write(REG_DOUBLE_BUFFER_CTL, 1);
- uint64_t start = timebase_now();
- int ok = 1;
- while (gpu_read(REG_DOUBLE_BUFFER_CTL)) {
- if (timebase_now() - start > 49875) { ok = 0; break; } /* 1 ms; the display clears it at once */
- }
- gpu_write(REG_DOUBLE_BUFFER_CTL, 0);
- return ok;
-}
-
-static int display_show(uint32_t address)
-{
- display_surface s = { address, display.pitch_tiles * TILE_EDGE, display.pitch_tiles * TILE_EDGE,
- display.surface_height };
- return display_apply(&s);
-}
-
-static void show_system_surface(void)
-{
- static uint32_t planned_for = 0;
- static uint32_t values[SCALER_REGISTERS];
- display_surface *sys = &display.pending_surface;
- uint32_t key = (sys->pitch << 16) | sys->y_end;
- if (!display.showing_system || planned_for != key) {
- scaler_plan(sys->x_end, sys->y_end, values);
- scaler_write(values);
- planned_for = key;
- if (display.system_frames < 2)
- TRACE("guide: XAM surface %08x %ux%u pitch %u", sys->address, sys->x_end, sys->y_end, sys->pitch);
- }
- display_surface s = *sys;
- s.x_end = s.pitch;
- display_apply(&s);
- display.showing_system = 1;
- display.system_frames++;
-}
-
-static void wait_for_flip(void)
-{
- if (!display.pending) return;
- uint64_t start = timebase_now();
- int verbose = flip_count < 4;
- /* the swap identifier lands first ... */
- for (;;) {
- uint32_t completed = read_word(&display.ring.writeback, SWAP_IDENTIFIER_OFFSET);
- if ((int32_t)(completed - display.pending_identifier) >= 0) break;
- if (timebase_now() - start > WAIT_TIMEOUT_TB) {
- TRACE("flip %u: TIMEOUT waiting for identifier %08x (completed %08x, rptr %u, wptr %u)",
- flip_count, display.pending_identifier, completed,
- read_word(&display.ring.writeback, READ_POINTER_OFFSET), display.ring.write);
- display.pending = 0;
- return;
- }
- low_priority_hint();
- }
- if (display.pending_system) {
- /* XAM's commands have drawn the Guide into its surface. Nothing
- * latches at vertical blank on this path, so keep one frame per
- * refresh (60 Hz) by the clock, or the title runs fast under it. */
- static uint64_t last_system_flip;
- const uint64_t frame = 49875000ull / 60;
- uint64_t t = timebase_now();
- if (last_system_flip && t - last_system_flip < frame) {
- while (timebase_now() - last_system_flip < frame) low_priority_hint();
- last_system_flip += frame;
- } else {
- last_system_flip = t;
- }
- show_system_surface();
- display.pending = 0;
- return;
- }
- if (display.showing_system) {
- /* the Guide closed: our surface's scaling again */
- scaler_write(own_scaler);
- display.showing_system = 0;
- TRACE("guide: closed after %u frames", display.system_frames);
- }
- /* ... then the display controller takes the address ... */
- start = timebase_now();
- while (gpu_read(SCANOUT_ADDRESS) != display.pending_address) {
- if (timebase_now() - start > WAIT_TIMEOUT_TB) {
- TRACE("flip %u: TIMEOUT scanout address %08x, expected %08x",
- flip_count, gpu_read(SCANOUT_ADDRESS), display.pending_address);
- display.pending = 0;
- return;
- }
- low_priority_hint();
- }
- /* ... and latches it at the next blank: one flip per refresh */
- start = timebase_now();
- while (gpu_read(SCANOUT_UPDATE) & (UPDATE_PENDING | UPDATE_TAKEN)) {
- if (timebase_now() - start > WAIT_TIMEOUT_TB) {
- TRACE("flip %u: TIMEOUT scanout update %08x", flip_count, gpu_read(SCANOUT_UPDATE));
- break;
- }
- low_priority_hint();
- }
- int shown = display_show(display.pending_address);
- if (verbose) {
- TRACE("flip %u: done, scanout %08x control %08x update %08x, 60EC %s",
- flip_count, gpu_read(SCANOUT_ADDRESS), gpu_read(SCANOUT_CONTROL), gpu_read(SCANOUT_UPDATE),
- shown ? "taken" : "TIMEOUT");
- }
- display.pending = 0;
-}
-
-static void submit_flip(uint32_t address, const uint32_t fetch_constant[6], uint32_t virtual_address)
-{
- VD_SYSTEM_COMMAND_BUFFER system_buffer;
- ULONG identifier = 0;
- memset(&system_buffer, 0, sizeof(system_buffer));
- VdGetSystemCommandBuffer(&system_buffer, &identifier);
-
- uint32_t identifier_address = (uint32_t)display.ring.writeback.words + SWAP_IDENTIFIER_OFFSET;
- uint32_t *w = ring_reserve(&display.ring, FLIP_DWORDS + SWAP_DWORDS);
- w[0] = type0(SCANOUT_ADDRESS, 1);
- w[1] = address;
- w[2] = type3(OPCODE_REGISTER_RMW, 3);
- w[3] = SCANOUT_CONTROL;
- w[4] = SCANOUT_CONTROL_KEEP;
- w[5] = 0;
- w[6] = type0(SCANOUT_FORMAT_1930, 1);
- w[7] = 0;
-
- /* VdSwap hands back XAM's surface here while the Guide shows
- * (xsdk docs/HARDWARE.md, "The Guide shows through VdSwap"). */
- ULONG shown_address = virtual_address, format = 6, color_space = 0;
- ULONG shown_width = display.pitch_tiles * TILE_EDGE, shown_height = display.surface_height;
- VdSwap((PULONG)(w + FLIP_DWORDS), (const ULONG *)fetch_constant, (PULONG)identifier_address,
- &system_buffer, identifier, &shown_address, &format, &color_space, &shown_width, &shown_height);
-
- display.pending_system = 0;
- if (display.guide_supported && system_buffer.Address && system_buffer.Dwords &&
- shown_address != virtual_address && shown_address && format == 6 && color_space == 0 &&
- shown_width && shown_height) {
- /* show XAM's surface, not ours: the scanout writes become NOPs */
- for (unsigned i = 0; i < FLIP_DWORDS; i++) w[i] = 0x80000000u;
- display.pending_system = 1;
- display.pending_surface.address = MmGetPhysicalAddress((PVOID)shown_address);
- display.pending_surface.pitch = (shown_width + 31) & ~31u;
- display.pending_surface.x_end = shown_width;
- display.pending_surface.y_end = shown_height;
- }
-
- ring_commit(&display.ring, FLIP_DWORDS + SWAP_DWORDS);
- ring_kick(&display.ring);
- if (flip_count < 4) {
- TRACE("flip %u: submitted address %08x identifier %08x sysbuf %08x/%u state %u",
- flip_count, address, (unsigned)identifier, (unsigned)system_buffer.Address,
- (unsigned)system_buffer.Dwords, (unsigned)system_buffer.State);
- }
- flip_count++;
- retrain_edram(0);
-
- display.pending = 1;
- display.pending_identifier = identifier;
- display.pending_address = address;
-}
-
-/*
- * Optional (xex_video_scaler_via_kernel): the scaler program Direct3D gets
- * from the kernel. Not needed to show a picture (the kernel's scaler
- * setting is kept), and it hung on hardware with these arguments.
- */
-#define SCALER_COMMAND_DWORDS 200 /* 0x320 bytes, as D3D uses */
-
-static void setup_scaler(uint32_t surface_w, uint32_t surface_h)
-{
- uint32_t mode[16];
- memset(mode, 0, sizeof(mode));
- VdQueryVideoMode(mode);
- uint32_t out_w = mode[0] ? mode[0] : surface_w;
- uint32_t out_h = mode[1] ? mode[1] : surface_h;
- TRACE("video mode: %ux%u interlaced %u widescreen %u hidef %u",
- (unsigned)mode[0], (unsigned)mode[1], (unsigned)mode[2], (unsigned)mode[3], (unsigned)mode[4]);
-
- static uint32_t vertical_filter[4] __attribute__((aligned(16)));
- static uint32_t horizontal_filter[4] __attribute__((aligned(16)));
- static uint32_t commands[SCALER_COMMAND_DWORDS] __attribute__((aligned(16)));
- memset(vertical_filter, 0, sizeof(vertical_filter));
- memset(horizontal_filter, 0, sizeof(horizontal_filter));
- for (int i = 0; i < SCALER_COMMAND_DWORDS; i++) commands[i] = 0x80000000u;
-
- uint32_t surface_wh = (surface_w << 16) | surface_h;
- ULONG written = VdInitializeScalerCommandBuffer(0, surface_wh, 0, (out_w << 16) | out_h, surface_wh,
- 1, vertical_filter, 1, horizontal_filter, 0,
- (PULONG)commands, SCALER_COMMAND_DWORDS);
- int used = 0;
- for (int i = 0; i < SCALER_COMMAND_DWORDS; i++) if (commands[i] != 0x80000000u) used = i + 1;
- TRACE("scaler: %ux%u -> %ux%u, returned %u, %d dwords written, first %08x %08x %08x %08x",
- (unsigned)surface_w, (unsigned)surface_h, (unsigned)out_w, (unsigned)out_h,
- (unsigned)written, used, commands[0], commands[1], commands[2], commands[3]);
- TRACE("scaler filters: v %08x %08x %08x %08x h %08x %08x %08x %08x",
- vertical_filter[0], vertical_filter[1], vertical_filter[2], vertical_filter[3],
- horizontal_filter[0], horizontal_filter[1], horizontal_filter[2], horizontal_filter[3]);
-
- uint32_t *w = ring_reserve(&display.ring, SCALER_COMMAND_DWORDS);
- memcpy(w, commands, sizeof(commands));
- ring_commit(&display.ring, SCALER_COMMAND_DWORDS);
- ring_kick(&display.ring);
-}
-
-/* Display controller registers (byte offsets as in libxenon's xenos.c). */
-static const struct { uint16_t offset; const char *name; } display_registers[] = {
- {0x6000, "CRTC_H_TOTAL"}, {0x6020, "CRTC_V_TOTAL"}, {0x6028, "CRTC_6028"},
- {0x6080, "CRTC_CONTROL"}, {0x6084, "CRTC_BLANK"}, {0x609c, "CRTC_STATUS"},
- {0x6100, "GRPH_ENABLE"}, {0x6104, "GRPH_CONTROL"}, {0x6110, "GRPH_SURFACE"},
- {0x6120, "GRPH_PITCH"}, {0x6124, "GRPH_OFS_X"}, {0x6128, "GRPH_OFS_Y"},
- {0x612c, "GRPH_X_START"}, {0x6130, "GRPH_Y_START"}, {0x6134, "GRPH_X_END"},
- {0x6138, "GRPH_Y_END"}, {0x6144, "GRPH_UPDATE"}, {0x6148, "GRPH_FLIP"},
- {0x6520, "MODE_6520"}, {0x6524, "MODE_6524"}, {0x6528, "MODE_DATA_FMT"},
- {0x652c, "DESKTOP_H"}, {0x6548, "MODE_6548"}, {0x6550, "MODE_6550"},
- {0x6580, "VIEWPORT_START"}, {0x6584, "VIEWPORT_SIZE"}, {0x6590, "SCL_ENABLE"},
- {0x6594, "SCL_TAP"}, {0x65a0, "SCL_65a0"}, {0x65b0, "SCL_65b0"}, {0x65b4, "SCL_65b4"},
- {0x65b8, "SCL_65b8"}, {0x65c0, "SCL_65c0"}, {0x65c4, "SCL_65c4"}, {0x65c8, "SCL_65c8"},
- {0x65cc, "SCL_UPDATE"}, {0x65d0, "SCL_65d0"}, {0x65dc, "SCL_65dc"}, {0x65e8, "SCL_65e8"},
- {0x6108, "GRPH_LUT_SEL"}, {0x6058, "MVP_BLACK_KEYER"},
- {0x6380, "CMATRIX_CNTL"}, {0x6384, "CM_1_1"}, {0x6388, "CM_1_2"}, {0x638c, "CM_1_3"},
- {0x6390, "CM_1_4"}, {0x6394, "CM_2_1"}, {0x6398, "CM_2_2"}, {0x639c, "CM_2_3"},
- {0x63a0, "CM_2_4"}, {0x63a4, "CM_3_1"}, {0x63a8, "CM_3_2"}, {0x63ac, "CM_3_3"},
- {0x63b0, "CM_3_4"}, {0x63b4, "CM_63b4"},
- {0x6484, "LUT_RW_MODE"}, {0x6488, "LUT_RW_INDEX"}, {0x649c, "LUT_WRITE_EN"},
- {0x64a0, "LUT_AUTOFILL"}, {0x64c0, "LUTA_CONTROL"}, {0x64c4, "LUTA_64c4"},
- {0x64c8, "LUTA_64c8"}, {0x64cc, "LUTA_64cc"}, {0x64d0, "LUTA_64d0"},
- {0x64d4, "LUTA_64d4"}, {0x64d8, "LUTA_64d8"},
- {0x2840, "DETILE_BASE"}, {0x2844, "DETILE_PITCH"}, {0x2848, "DETILE_2848"},
- {0x7900, "OUT_7900"}, {0x7938, "OUT_7938"}, {0x793c, "OUT_793c"},
-};
-
-void xex_video_dump_registers(const char *label)
-{
- char line[200];
- int n = 0;
- TRACE("registers (%s):", label);
- for (unsigned i = 0; i < sizeof(display_registers) / sizeof(display_registers[0]); i++) {
- n += snprintf(line + n, sizeof(line) - n, " %s=%08x", display_registers[i].name,
- (unsigned)gpu_read(display_registers[i].offset / 4));
- if (n > 120 || i + 1 == sizeof(display_registers) / sizeof(display_registers[0])) {
- TRACE(" %s", line);
- n = 0;
- }
- }
-}
-
-uint32_t xex_video_read_register(uint32_t offset) { return gpu_read(offset / 4); }
-void xex_video_write_register(uint32_t offset, uint32_t value) { gpu_write(offset / 4, value); }
-
-void xex_video_dump_lut(void)
-{
- static const int entries[] = {0, 1, 64, 128, 192, 255};
- for (unsigned i = 0; i < sizeof(entries) / sizeof(entries[0]); i++) {
- gpu_write(0x6488 / 4, entries[i]);
- TRACE(" LUT[%d] = %08x", entries[i], (unsigned)gpu_read(0x6494 / 4));
- }
-}
-
-/* The kernel leaves the display LUT zeroed for a starting title (every
- * colour maps to black); load an identity ramp like libxenon does. */
-static int load_identity_gamma(void)
-{
- gpu_write(0x6108 / 4, 0); /* D1GRPH_LUT_SEL: LUT A */
- gpu_write(0x64c0 / 4, 0); /* DC_LUTA_CONTROL */
- gpu_write(0x6488 / 4, 0); /* DC_LUT_RW_INDEX */
- gpu_write(0x6484 / 4, 0); /* DC_LUT_RW_MODE */
- gpu_write(0x649c / 4, 7); /* DC_LUT_WRITE_EN_MASK */
- gpu_write(0x64a0 / 4, 1); /* DC_LUT_AUTOFILL */
- uint64_t start = timebase_now();
- while (!(gpu_read(0x64a0 / 4) & 2) && timebase_now() - start < WAIT_TIMEOUT_TB) {}
- int loaded = (gpu_read(0x64a0 / 4) & 2) != 0;
- TRACE("gamma: identity LUT %s", loaded ? "loaded" : "timed out (no display controller: Xenia?)");
- return loaded;
-}
-
-int xex_video_scaler_via_kernel = 0;
-
-/*
- * Tells XAM the title's display (graphics notification event 1, 64 bytes,
- * as D3D does), so it draws the frame under the Guide at the right size
- * (xsdk src/present.c describe_display).
- */
-typedef struct {
- uint16_t front_width, front_height, output_width, output_height;
- uint32_t left, top, right, bottom;
- uint32_t scaled_width, scaled_height;
- uint32_t filters[8];
-} display_description;
-
-static void describe_display(uint32_t width, uint32_t height)
-{
- uint32_t mode[16];
- memset(mode, 0, sizeof(mode));
- VdQueryVideoMode(mode);
- display.output_width = mode[0];
- display.output_height = mode[1];
- /* XAM's surface is scaled by hand; xsdk only tried progressive modes */
- display.guide_supported = display.controller && mode[0] && mode[1] && !mode[2];
- TRACE("guide: output %ux%u interlaced %u -> %s", (unsigned)mode[0], (unsigned)mode[1], (unsigned)mode[2],
- display.guide_supported ? "supported" : "not supported");
- if (!display.guide_supported) return;
- display_description d;
- memset(&d, 0, sizeof(d));
- d.front_width = (uint16_t)width;
- d.front_height = (uint16_t)height;
- d.output_width = (uint16_t)display.output_width;
- d.output_height = (uint16_t)display.output_height;
- d.right = width;
- d.bottom = height;
- d.scaled_width = display.output_width;
- d.scaled_height = display.output_height;
- VdCallGraphicsNotificationRoutines(1, &d);
-}
-
-int xex_video_guide_visible(void) { return display.showing_system; }
-
-const char *xex_video_error(void)
-{
- return display.error ? display.error : "";
-}
-
-int xex_video_native = 1;
-
-int xex_video_init(void)
-{
- if (display.open) return 0;
-
- VD_DISPLAY_INFORMATION info;
- memset(&info, 0, sizeof(info));
- VdGetCurrentDisplayInformation(&info);
- uint32_t sw = info.SurfaceWidth, sh = info.SurfaceHeight;
- TRACE("display: surface %ux%u window %u,%u-%u,%u colorspace %u",
- (unsigned)sw, (unsigned)sh, (unsigned)info.Left, (unsigned)info.Top,
- (unsigned)info.Right, (unsigned)info.Bottom, (unsigned)info.ColorSpace);
- if (sw == 0 || sh == 0 || sw % TILE_EDGE != 0) {
- display.error = "unsupported display mode";
- return -1;
- }
- if (info.Left % TILE_EDGE || info.Top % TILE_EDGE || info.Right <= info.Left ||
- info.Bottom <= info.Top || info.Right > sw || info.Bottom > sh) {
- display.error = "unsupported display window";
- return -1;
- }
-
- /* Null microcode selects the kernel's own. */
- ULONG engines = VdInitializeEngines(0, NULL, NULL, NULL, NULL);
- TRACE("VdInitializeEngines -> %u, scanout before: %08x control %08x",
- (unsigned)engines, gpu_read(SCANOUT_ADDRESS), gpu_read(SCANOUT_CONTROL));
- if (ring_init(&display.ring) != 0) {
- VdShutdownEngines();
- display.error = "out of memory (ring)";
- return -1;
- }
- TRACE("ring: commands %08x writeback %08x, rptr %u wptr %u",
- (unsigned)display.ring.commands.physical, (unsigned)display.ring.writeback.physical,
- read_word(&display.ring.writeback, READ_POINTER_OFFSET), display.ring.write);
- display.open = 1;
- display.back = 0;
- display.pending = 0;
- retrain_edram(1);
- /* VdInitializeScalerCommandBuffer hangs on hardware with these
- * arguments, so it is off unless a test turns it on. */
- if (xex_video_scaler_via_kernel) setup_scaler(sw, sh);
- display.presented = 0;
-
- /* The display's LUT is zero while a title runs: load a ramp. Whether
- * the autofill finishes also tells whether a display controller is
- * there (not in Xenia). */
- display.controller = load_identity_gamma();
- old_surface.address = gpu_read(SCANOUT_ADDRESS);
- old_surface.pitch = gpu_read(REG_D1GRPH_PITCH);
- old_surface.x_end = gpu_read(REG_D1GRPH_X_END);
- old_surface.y_end = gpu_read(REG_D1GRPH_Y_END);
- for (int i = 0; i < SCALER_REGISTERS; i++) kernel_scaler[i] = gpu_read(scaler_offsets[i] / 4);
-
- /* Native mode: front buffers of the output's size shown 1:1 with the
- * scaler off (as libxenon does; xsdk docs/HARDWARE.md, "a 1280x720
- * surface shows 1:1"), instead of the kernel's 640x480 surface that the
- * scaler stretches (blurry, and 4:3 pulled to 16:9). Progressive modes
- * only. */
- uint32_t mode[16];
- memset(mode, 0, sizeof(mode));
- VdQueryVideoMode(mode);
- display.output_width = mode[0];
- display.output_height = mode[1];
- display.native = xex_video_native && display.controller && mode[0] && mode[1] && !mode[2] &&
- mode[0] % TILE_EDGE == 0 && mode[0] <= 1920 && mode[1] <= 1088;
- TRACE("output %ux%u interlaced %u -> %s", (unsigned)mode[0], (unsigned)mode[1], (unsigned)mode[2],
- display.native ? "native surface, scaler off" : "kernel surface, kernel scaling");
- if (display.native) {
- sw = mode[0];
- sh = mode[1];
- info.Left = info.Top = 0;
- info.Right = sw;
- info.Bottom = sh;
- }
- display.pitch_tiles = sw / TILE_EDGE;
- display.tile_x = info.Left / TILE_EDGE;
- display.tile_y = info.Top / TILE_EDGE;
- display.width = info.Right - info.Left;
- display.height = info.Bottom - info.Top;
- display.surface_height = sh;
-
- uint32_t tiles_high = (sh + TILE_EDGE - 1) / TILE_EDGE;
- uint32_t bytes = display.pitch_tiles * tiles_high * TILE_EDGE * TILE_EDGE * 4;
- for (int i = 0; i < 2; i++) {
- front_buffer *fb = &display.buffers[i];
- if (phys_alloc(&fb->memory, bytes, PAGE_WRITECOMBINE_) != 0) {
- display.error = "out of memory (front buffer)";
- xex_video_shutdown();
- return -1;
- }
- volatile uint32_t *w = fb->memory.words;
- for (uint32_t j = 0; j < fb->memory.bytes / 4; j++) w[j] = 0x000000ffu; /* opaque black */
- front_buffer_fetch(fb->fetch_constant, (uint32_t)fb->memory.words, display.pitch_tiles, sw, sh);
- TRACE("front buffer %d: %ux%u virtual %08x physical %08x bytes %u", i, (unsigned)sw, (unsigned)sh,
- (unsigned)(uint32_t)fb->memory.words, (unsigned)fb->memory.physical, (unsigned)fb->memory.bytes);
- }
-
- if (display.native) {
- scaler_plan(sw, sh, own_scaler);
- scaler_write(own_scaler);
- } else {
- memcpy(own_scaler, kernel_scaler, sizeof(own_scaler));
- }
- describe_display(sw, sh);
- int shown = display_show(display.buffers[1].memory.physical);
- TRACE("show buffer 1: %s, scanout %08x", shown ? "taken" : "TIMEOUT", gpu_read(SCANOUT_ADDRESS));
- atexit(xex_video_shutdown);
- return 0;
-}
-
-xex_frame xex_video_begin(void)
-{
- xex_frame f;
- memset(&f, 0, sizeof(f));
- if (!display.open) return f;
- wait_for_flip();
- f.pixels = display.buffers[display.back].memory.words;
- f.pitch = (int)(display.pitch_tiles * TILE_EDGE);
- f.window_x = (int)(display.tile_x * TILE_EDGE);
- f.window_y = (int)(display.tile_y * TILE_EDGE);
- f.window_width = (int)display.width;
- f.window_height = (int)display.height;
- return f;
-}
-
-void xex_video_present(void)
-{
- if (!display.open) return;
- front_buffer *fb = &display.buffers[display.back];
- submit_flip(fb->memory.physical, fb->fetch_constant, (uint32_t)fb->memory.words);
- display.back ^= 1;
- if (display.presented++ == 0) xex_video_dump_registers("after first flip");
-}
-
-void xex_video_shutdown(void)
-{
- if (!display.open) return;
- wait_for_flip();
- /* leave the scanout at address 0 as the kernel's own ring does */
- submit_flip(0, display.buffers[display.back ^ 1].fetch_constant, 0);
- wait_for_flip();
- if (display.native || display.showing_system) scaler_write(kernel_scaler);
- display_apply(&old_surface);
- ring_detach(&display.ring);
- VdShutdownEngines();
- display.open = 0;
- for (int i = 0; i < 2; i++) phys_free(&display.buffers[i].memory);
- phys_free(&display.ring.commands);
- phys_free(&display.ring.writeback);
-}
diff --git a/platform/xex/runtime/xex_audio.h b/platform/xex/runtime/xex_audio.h
deleted file mode 100644
index cc02a2b..0000000
--- a/platform/xex/runtime/xex_audio.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Sound through the kernel's audio render driver (XAudio render driver
- * client, as found on hardware by xsdk, https://github.com/jessenic/xsdk):
- * the driver takes a frame every 5.33 ms, 256 samples at 48 kHz in 6
- * channels (front left, front right, centre, LFE, back left, back right),
- * each channel's 256 big-endian floats after the other.
- *
- * The title fills frames ahead into a ring; the driver's callback takes the
- * oldest, or plays silence when the ring is empty.
- */
-#ifndef XEX_AUDIO_H
-#define XEX_AUDIO_H
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define XEX_AUDIO_RATE 48000
-#define XEX_AUDIO_FRAME_SAMPLES 256
-#define XEX_AUDIO_CHANNELS 6
-#define XEX_AUDIO_RING_FRAMES 16
-
-/* Registers with the driver. 0 on success. */
-int xex_audio_open(void);
-
-/* Frames queued and not yet taken by the driver. */
-unsigned xex_audio_queued(void);
-
-/* The next frame to fill (6 x 256 floats, channel after channel; the
- * centre, LFE and back channels start out silent and may stay so), or
- * NULL when the ring is full. Call xex_audio_queue() once it is filled. */
-float *xex_audio_next(void);
-void xex_audio_queue(void);
-
-/* Callbacks from the driver so far (one per 5.33 ms frame). */
-unsigned xex_audio_callbacks(void);
-
-/* Frames the driver played silence for, because the ring was empty. */
-unsigned xex_audio_underruns(void);
-
-/* Unregisters (also done at exit). */
-void xex_audio_close(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/platform/xex/runtime/xex_input.h b/platform/xex/runtime/xex_input.h
deleted file mode 100644
index 511e19d..0000000
--- a/platform/xex/runtime/xex_input.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Controllers through XamInputGetState. */
-#ifndef XEX_INPUT_H
-#define XEX_INPUT_H
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* XINPUT_GAMEPAD_* button bits */
-#define XEX_PAD_UP 0x0001
-#define XEX_PAD_DOWN 0x0002
-#define XEX_PAD_LEFT 0x0004
-#define XEX_PAD_RIGHT 0x0008
-#define XEX_PAD_START 0x0010
-#define XEX_PAD_BACK 0x0020
-#define XEX_PAD_LTHUMB 0x0040
-#define XEX_PAD_RTHUMB 0x0080
-#define XEX_PAD_LB 0x0100
-#define XEX_PAD_RB 0x0200
-#define XEX_PAD_A 0x1000
-#define XEX_PAD_B 0x2000
-#define XEX_PAD_X 0x4000
-#define XEX_PAD_Y 0x8000
-
-typedef struct {
- uint16_t buttons;
- uint8_t left_trigger, right_trigger;
- int16_t lx, ly, rx, ry;
-} xex_pad;
-
-/* Reads controller `port` (0-3). Returns 0 when connected; otherwise the
- * state is zeroed and -1 is returned. */
-int xex_input_get(int port, xex_pad *pad);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/platform/xex/runtime/xex_runtime.h b/platform/xex/runtime/xex_runtime.h
deleted file mode 100644
index 3a2cae1..0000000
--- a/platform/xex/runtime/xex_runtime.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Helpers of the GCC Xbox 360 title runtime (runtime/ sources). */
-#ifndef XEX_RUNTIME_H
-#define XEX_RUNTIME_H
-
-#include <stddef.h>
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* DbgPrint without format interpretation. */
-void xex_debug_write(const void *buf, size_t len);
-
-/* Creates usb0:..usb2: (\Device\Mass0..2) and hdd: (Partition1). */
-void xex_mount_devices(void);
-
-/* Mounts a kernel device ("\\Device\\Mass0") as "name:" ("usb0"). */
-int xex_mount(const char *name, const char *device);
-int xex_unmount(const char *name);
-
-/* "usb0:/a/b" -> "\??\usb0:\a\b" (relative paths are under game:). */
-int xex_kernel_path(const char *path, char *out, size_t size);
-
-/* Xbox guide notification with an ASCII text. */
-void xex_notify(const char *text);
-
-void xex_sleep_ms(unsigned ms);
-
-/* Time base (mftb) ticks and frequency (49.875 MHz on retail consoles). */
-uint64_t xex_timebase(void);
-uint64_t xex_timebase_freq(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/platform/xex/runtime/xex_video.h b/platform/xex/runtime/xex_video.h
deleted file mode 100644
index 790345e..0000000
--- a/platform/xex/runtime/xex_video.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Scanout of CPU-drawn frames for a title: the title takes the GPU engines
- * like Direct3D does and flips between two tiled 32 bpp front buffers at
- * vertical blank. C port of xenon-forge's xbox360-video crate
- * (https://github.com/landaire/xenon-forge, MIT/Apache-2.0).
- */
-#ifndef XEX_VIDEO_H
-#define XEX_VIDEO_H
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct {
- /* Back buffer: tiled surface, 32x32-pixel tiles of 4 KB (see
- * xex_video_tiled_index). Write-combined: write in address order. */
- uint32_t *pixels;
- /* Surface width in pixels (multiple of 32), for tiled indexing. */
- int pitch;
- /* Displayed window inside the surface (tile aligned). */
- int window_x, window_y, window_width, window_height;
-} xex_frame;
-
-/* Takes the GPU and creates two front buffers of the current display
- * size. Returns 0 on success, -1 on failure (see xex_video_error). */
-int xex_video_init(void);
-const char *xex_video_error(void);
-
-/* Waits until the previous flip has been latched (so the back buffer is
- * off screen) and returns the back buffer. */
-xex_frame xex_video_begin(void);
-
-/* Flips to the back buffer at the next vertical blank. */
-void xex_video_present(void);
-
-/* Optional trace of initialization and flips (diagnostics). */
-extern void (*xex_video_trace)(const char *fmt, ...);
-
-/* Diagnostics: traces the display controller registers. */
-void xex_video_dump_registers(const char *label);
-/* Diagnostics: raw display register access (byte offsets) and a few LUT entries. */
-uint32_t xex_video_read_register(uint32_t offset);
-void xex_video_write_register(uint32_t offset, uint32_t value);
-void xex_video_dump_lut(void);
-/* Nonzero: program the scaler with VdInitializeScalerCommandBuffer at init
- * (hangs on hardware so far). */
-extern int xex_video_scaler_via_kernel;
-
-/* Nonzero while the Guide (XAM's surface) is on screen. Don't end the
- * title by itself then: XAM waits for a swap that never comes. */
-int xex_video_guide_visible(void);
-
-/* Gives the GPU back to the system (also done at exit). */
-void xex_video_shutdown(void);
-
-/* Word index of pixel (x, y) in a tiled surface of `pitch` pixels. The
- * pixel word is B << 24 | G << 16 | R << 8 | A (opaque: A = 0xff). */
-static inline int xex_video_tiled_index(int x, int y, int pitch)
-{
- return (((y >> 5) * 32 * pitch + ((x >> 5) << 10)
- + (x & 3) + ((y & 1) << 2) + (((x & 31) >> 2) << 3) + (((y & 31) >> 1) << 6))
- ^ ((y & 8) << 2));
-}
-
-static inline uint32_t xex_video_rgb(uint8_t r, uint8_t g, uint8_t b)
-{
- return ((uint32_t)b << 24) | ((uint32_t)g << 16) | ((uint32_t)r << 8) | 0xffu;
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/platform/xex/sdk/LICENSE-APACHE b/platform/xex/sdk/LICENSE-APACHE
deleted file mode 100644
index 8007ffd..0000000
--- a/platform/xex/sdk/LICENSE-APACHE
+++ /dev/null
@@ -1,190 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
-TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to the Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by the Licensor and
- subsequently incorporated within the Work.
-
-2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
-3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
-4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding any notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
-5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
-6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
-7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
-8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
-9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
-END OF TERMS AND CONDITIONS
-
-Copyright 2026 Lander Brandt
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
diff --git a/platform/xex/sdk/LICENSE-MIT b/platform/xex/sdk/LICENSE-MIT
deleted file mode 100644
index 72e631e..0000000
--- a/platform/xex/sdk/LICENSE-MIT
+++ /dev/null
@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2026 Lander Brandt
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/platform/xex/sdk/README b/platform/xex/sdk/README
deleted file mode 100644
index 81add22..0000000
--- a/platform/xex/sdk/README
+++ /dev/null
@@ -1,3 +0,0 @@
-Files in this directory come from xenon-forge
-(https://github.com/landaire/xenon-forge, commit 2fcc78c),
-dual licensed MIT / Apache-2.0 (see LICENSE-MIT, LICENSE-APACHE).
diff --git a/platform/xex/sdk/crt/entry.inc b/platform/xex/sdk/crt/entry.inc
deleted file mode 100644
index ec31921..0000000
--- a/platform/xex/sdk/crt/entry.inc
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Entries of C and C++ modules.
- *
- * The loader calls the entry of a module with the console calling
- * convention, which expects r14-r31 back in full 64 bits. Code of the
- * powerpc (SysV) code generation saves only their low words. The entry
- * saves them in full, reserves the home area that console callees store
- * their arguments in, and calls `target` with r3-r10 unchanged.
- */
-
-.macro xbox360_entry name, target
- .section .text.\name, "ax", @progbits
- .globl \name
- .type \name, @function
- .balign 4
-\name:
- stwu 1, -0xe0(1)
- mflr 0
- stw 0, 0x8(1)
- .irp reg, 14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31
- std \reg, 0x50 + 8 * (\reg - 14)(1)
- .endr
- bl \target
- .irp reg, 14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31
- ld \reg, 0x50 + 8 * (\reg - 14)(1)
- .endr
- lwz 0, 0x8(1)
- mtlr 0
- addi 1, 1, 0xe0
- blr
- .size \name, .-\name
-.endm
diff --git a/platform/xex/sdk/include/xbox360/base.h b/platform/xex/sdk/include/xbox360/base.h
deleted file mode 100644
index 8d38c8a..0000000
--- a/platform/xex/sdk/include/xbox360/base.h
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Base types and macros of the Xbox 360 headers.
- *
- * Titles use 32-bit pointers, int and long on 64-bit registers. Clang's
- * powerpc-unknown-none-eabi and powerpc64-unknown-xbox360-ilp32 targets both give
- * this data model. The headers include no system header.
- *
- * Every import is declared with XBOX360_IMPORT(library, ordinal). The
- * annotation names the library and export ordinal. xbox360-bindgen reads it
- * to generate the import thunks that C and Rust code link with. A module
- * exports a function with XBOX360_EXPORT(ordinal, function).
- */
-
-#ifndef XBOX360_BASE_H
-#define XBOX360_BASE_H
-
-#ifdef __cplusplus
-#define XBOX360_EXTERN_C_START extern "C" {
-#define XBOX360_EXTERN_C_END }
-#else
-#define XBOX360_EXTERN_C_START
-#define XBOX360_EXTERN_C_END
-#endif
-
-/*
- * An import of `library` (xboxkrnl, xam or xbdm) by `ordinal`. The thunk
- * library defines a function import under its own name. A data import is
- * declared as its slot, `__imp_<name>`, which holds the address of the
- * export after the loader resolves it.
- */
-#define XBOX360_IMPORT(library, ordinal) \
- __attribute__((annotate("xbox360_import," #library "," #ordinal)))
-
-#define XBOXKRNL_IMPORT(ordinal) XBOX360_IMPORT(xboxkrnl, ordinal)
-#define XAM_IMPORT(ordinal) XBOX360_IMPORT(xam, ordinal)
-#define XBDM_IMPORT(ordinal) XBOX360_IMPORT(xbdm, ordinal)
-
-#define DECLSPEC_NORETURN __attribute__((noreturn))
-#define DECLSPEC_ALIGN(Alignment) __attribute__((aligned(Alignment)))
-#define C_ASSERT(Expression) _Static_assert(Expression, #Expression)
-
-XBOX360_EXTERN_C_START
-
-typedef void VOID, *PVOID;
-typedef const void *PCVOID;
-
-typedef char CHAR, *PCHAR, *PSTR;
-typedef const char *PCSTR, *PCSZ;
-typedef unsigned char UCHAR, *PUCHAR;
-typedef unsigned char BYTE, *PBYTE;
-typedef const unsigned char *PCBYTE;
-
-typedef short SHORT, *PSHORT;
-typedef unsigned short USHORT, *PUSHORT;
-typedef unsigned short WORD, *PWORD;
-/* wchar_t is 32 bits on powerpc-unknown-none-eabi; the console's is 16. */
-typedef unsigned short WCHAR, *PWCHAR, *PWSTR;
-typedef const unsigned short *PCWSTR;
-
-typedef int INT, *PINT;
-typedef unsigned int UINT, *PUINT;
-typedef long LONG, *PLONG;
-typedef unsigned long ULONG, *PULONG;
-typedef unsigned long DWORD, *PDWORD;
-typedef long long LONGLONG, *PLONGLONG;
-typedef unsigned long long ULONGLONG, *PULONGLONG;
-typedef unsigned long long QWORD, *PQWORD;
-typedef float FLOAT, *PFLOAT;
-typedef double DOUBLE, *PDOUBLE;
-
-typedef LONG LONG_PTR, *PLONG_PTR;
-typedef ULONG ULONG_PTR, *PULONG_PTR;
-typedef ULONG SIZE_T, *PSIZE_T;
-typedef ULONG DWORD_PTR, *PDWORD_PTR;
-
-typedef UCHAR BOOLEAN, *PBOOLEAN;
-typedef int BOOL, *PBOOL;
-
-typedef LONG NTSTATUS;
-typedef LONG HRESULT;
-typedef PVOID HANDLE, *PHANDLE;
-typedef ULONG ACCESS_MASK, *PACCESS_MASK;
-
-/* A user's Xbox Live identity. */
-typedef ULONGLONG XUID, *PXUID;
-
-#define TRUE 1
-#define FALSE 0
-#ifndef NULL
-#ifdef __cplusplus
-#define NULL 0
-#else
-#define NULL ((void *)0)
-#endif
-#endif
-
-#define NT_SUCCESS(Status) ((NTSTATUS)(Status) >= 0)
-
-/* Doubly linked list entry; a list head is its own entry when empty. */
-typedef struct _LIST_ENTRY {
- struct _LIST_ENTRY *Flink;
- struct _LIST_ENTRY *Blink;
-} LIST_ENTRY, *PLIST_ENTRY;
-
-typedef struct _SINGLE_LIST_ENTRY {
- struct _SINGLE_LIST_ENTRY *Next;
-} SINGLE_LIST_ENTRY, *PSINGLE_LIST_ENTRY;
-
-/* 64-bit integers also addressed as two halves; the high half comes first. */
-typedef union _LARGE_INTEGER {
- struct {
- LONG HighPart;
- ULONG LowPart;
- };
- LONGLONG QuadPart;
-} LARGE_INTEGER, *PLARGE_INTEGER;
-
-typedef union _ULARGE_INTEGER {
- struct {
- ULONG HighPart;
- ULONG LowPart;
- };
- ULONGLONG QuadPart;
-} ULARGE_INTEGER, *PULARGE_INTEGER;
-
-C_ASSERT(sizeof(PVOID) == 4);
-C_ASSERT(sizeof(LONG) == 4);
-C_ASSERT(sizeof(LONGLONG) == 8);
-C_ASSERT(sizeof(LIST_ENTRY) == 8);
-C_ASSERT(sizeof(LARGE_INTEGER) == 8);
-
-XBOX360_EXTERN_C_END
-
-/*
- * Export `function` at `ordinal`, an integer literal from 1 to 0xFFFF, at
- * file scope. xex-link rejects two exports at one ordinal. Ordinals that
- * share a function are declared once each.
- *
- * Callers use the console calling convention, which expects r14-r31 back in
- * full 64 bits. Code of the powerpc (SysV) code generation saves only their
- * low words, so the export is an entry like the `_start` of the C runtime:
- * it saves r14-r31 in full, reserves the home area that console callees
- * store their arguments in, and calls `function` with r3-r10 unchanged.
- * `function` takes at most eight 32-bit integer or pointer arguments and
- * returns a 32-bit result or none.
- *
- * The export is an 8-byte `.xexports` record, as `xbox360_sys::export!`
- * writes: the big-endian ordinal, then the address of the entry. xex-link
- * turns the records into the XEX export table.
- */
-#define XBOX360_EXPORT(ordinal, function) \
- XBOX360_EXPORT_IMPL(ordinal, function, __xbox360_export_##ordinal)
-
-/* XBOX360_EXPORT with `name`, the symbol of the entry. */
-#define XBOX360_EXPORT_IMPL(ordinal, function, name) \
- _Static_assert((ordinal) >= 1 && (ordinal) <= 0xFFFF, \
- "export ordinals are 1 to 0xFFFF"); \
- __attribute__((used)) static __typeof__(function) *const name##_target \
- __asm__(#name "_target") = function; \
- extern VOID name(VOID) __asm__(#name); \
- __attribute__((used, retain, section(".xexports"))) static const struct { \
- ULONG Ordinal; \
- VOID (*Entry)(VOID); \
- } name##_record = {(ordinal), name}; \
- __asm__(".pushsection .text." #name ", \"ax\", @progbits\n" \
- ".globl " #name "\n" \
- ".type " #name ", @function\n" \
- ".balign 4\n" #name ":\n" \
- "stwu 1, -0xe0(1)\n" \
- "mflr 0\n" \
- "stw 0, 0x8(1)\n" \
- ".irp reg, 14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31\n" \
- "std \\reg, 0x50 + 8 * (\\reg - 14)(1)\n" \
- ".endr\n" \
- "lis 12, " #name "_target@ha\n" \
- "lwz 12, " #name "_target@l(12)\n" \
- "mtctr 12\n" \
- "bctrl\n" \
- ".irp reg, 14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31\n" \
- "ld \\reg, 0x50 + 8 * (\\reg - 14)(1)\n" \
- ".endr\n" \
- "lwz 0, 0x8(1)\n" \
- "mtlr 0\n" \
- "addi 1, 1, 0xe0\n" \
- "blr\n" \
- ".size " #name ", . - " #name "\n" \
- ".popsection")
-
-#endif
diff --git a/platform/xex/sdk/include/xbox360/xam.h b/platform/xex/sdk/include/xbox360/xam.h
deleted file mode 100644
index 4f409d0..0000000
--- a/platform/xex/sdk/include/xbox360/xam.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/* xam.xex imports and the types they use. */
-
-#ifndef XBOX360_XAM_H
-#define XBOX360_XAM_H
-
-#include <xbox360/xboxkrnl.h>
-#include <xbox360/xam/xamdef.h>
-#include <xbox360/xam/net.h>
-#include <xbox360/xam/content.h>
-#include <xbox360/xam/user.h>
-#include <xbox360/xam/ui.h>
-#include <xbox360/xam/input.h>
-#include <xbox360/xam/notify.h>
-#include <xbox360/xam/system.h>
-
-#endif
diff --git a/platform/xex/sdk/include/xbox360/xam/content.h b/platform/xex/sdk/include/xbox360/xam/content.h
deleted file mode 100644
index acd782d..0000000
--- a/platform/xex/sdk/include/xbox360/xam/content.h
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * XAM content packages: create, open, enumerate, copy and delete packages
- * on storage devices.
- */
-
-#ifndef XBOX360_XAM_CONTENT_H
-#define XBOX360_XAM_CONTENT_H
-
-#include <xbox360/xam/xamdef.h>
-
-XBOX360_EXTERN_C_START
-
-/* Kind of a content package, with Xenia's values. */
-typedef enum _XCONTENT_TYPE {
- XCONTENTTYPE_SAVEDGAME = 0x00000001,
- XCONTENTTYPE_MARKETPLACE = 0x00000002,
- XCONTENTTYPE_PUBLISHER = 0x00000003,
- XCONTENTTYPE_XBOX360TITLE = 0x00001000,
- XCONTENTTYPE_IPTVPAUSEBUFFER = 0x00002000,
- XCONTENTTYPE_XNACOMMUNITY = 0x00003000,
- XCONTENTTYPE_INSTALLEDGAME = 0x00004000,
- XCONTENTTYPE_XBOXTITLE = 0x00005000,
- XCONTENTTYPE_SOCIALTITLE = 0x00006000,
- XCONTENTTYPE_GAMESONDEMAND = 0x00007000,
- XCONTENTTYPE_STORAGEPACK = 0x00008000,
- XCONTENTTYPE_AVATARITEM = 0x00009000,
- XCONTENTTYPE_PROFILE = 0x00010000,
- XCONTENTTYPE_GAMERPICTURE = 0x00020000,
- XCONTENTTYPE_THEME = 0x00030000,
- XCONTENTTYPE_CACHEFILE = 0x00040000,
- XCONTENTTYPE_STORAGEDOWNLOAD = 0x00050000,
- XCONTENTTYPE_XBOXSAVEDGAME = 0x00060000,
- XCONTENTTYPE_XBOXDOWNLOAD = 0x00070000,
- XCONTENTTYPE_GAMEDEMO = 0x00080000,
- XCONTENTTYPE_VIDEO = 0x00090000,
- XCONTENTTYPE_GAMETITLE = 0x000A0000,
- XCONTENTTYPE_INSTALLER = 0x000B0000,
- XCONTENTTYPE_GAMETRAILER = 0x000C0000,
- XCONTENTTYPE_ARCADE = 0x000D0000,
- XCONTENTTYPE_XNA = 0x000E0000,
- XCONTENTTYPE_LICENSESTORE = 0x000F0000,
- XCONTENTTYPE_MOVIE = 0x00100000,
- XCONTENTTYPE_TV = 0x00200000,
- XCONTENTTYPE_MUSICVIDEO = 0x00300000,
- XCONTENTTYPE_GAMEVIDEO = 0x00400000,
- XCONTENTTYPE_PODCASTVIDEO = 0x00500000,
- XCONTENTTYPE_VIRALVIDEO = 0x00600000,
- XCONTENTTYPE_COMMUNITYGAME = 0x02000000,
-} XCONTENT_TYPE;
-
-/* Length of the display name, in UTF-16 units including the NUL. */
-#define XCONTENT_MAX_DISPLAYNAME_LENGTH 128
-/* Length of the file name in bytes. A name of this length has no NUL. */
-#define XCONTENT_MAX_FILENAME_LENGTH 42
-
-/* What XamContentCreate did. */
-#define XCONTENT_CREATED_NEW 1
-#define XCONTENT_OPENED_EXISTING 2
-
-/* The device, kind and names of a package. */
-typedef struct _XCONTENT_DATA {
- DWORD DeviceID;
- DWORD dwContentType;
- WCHAR szDisplayName[XCONTENT_MAX_DISPLAYNAME_LENGTH];
- CHAR szFileName[XCONTENT_MAX_FILENAME_LENGTH];
- BYTE Padding[2];
-} XCONTENT_DATA, *PXCONTENT_DATA;
-
-C_ASSERT(sizeof(XCONTENT_DATA) == 0x134);
-C_ASSERT(__builtin_offsetof(XCONTENT_DATA, szFileName) == 0x108);
-
-/**
- * Creates or opens a content package and maps it to the drive RootName.
- * Flags holds the creation disposition in its low four bits. The disposition taken
- * (XCONTENT_CREATED_NEW or XCONTENT_OPENED_EXISTING) is stored at Disposition when not
- * NULL. Returns a Win32 error code, or ERROR_IO_PENDING with an Overlapped.
- */
-XAM_IMPORT(0x258) DWORD XamContentCreate(
- DWORD UserIndex,
- PCSTR RootName,
- const XCONTENT_DATA *ContentData,
- DWORD Flags,
- PDWORD Disposition,
- PDWORD LicenseMask,
- PXOVERLAPPED Overlapped);
-
-/** Closes the content drive RootName. Returns a Win32 error code, or ERROR_IO_PENDING with an Overlapped. */
-XAM_IMPORT(0x25A) DWORD XamContentClose(PCSTR RootName, PXOVERLAPPED Overlapped);
-
-/**
- * Deletes a content package.
- * Returns a Win32 error code, or ERROR_IO_PENDING with an Overlapped.
- */
-XAM_IMPORT(0x25B) DWORD XamContentDelete(DWORD UserIndex, const XCONTENT_DATA *ContentData, PXOVERLAPPED Overlapped);
-
-/**
- * Creates an enumerator of the storage devices accepting ContentTypes, returning
- * ItemsPerCall 0x50-byte device records per XamEnumerate. Returns a Win32 error code.
- */
-XAM_IMPORT(0x25D) DWORD XamContentCreateDeviceEnumerator(
- DWORD ContentTypes,
- DWORD Flags,
- DWORD ItemsPerCall,
- PDWORD BufferSize,
- PHANDLE Handle);
-
-/** Fills the 0x50-byte device record of DeviceId. Returns a Win32 error code. */
-XAM_IMPORT(0x25E) DWORD XamContentGetDeviceData(DWORD DeviceId, PBYTE DeviceData);
-
-/**
- * Commits the writes to the content drive RootName. The 2.0.6717 dashboard flushes
- * DASHUSER after it writes DashPreferences. Returns a Win32 error code.
- */
-XAM_IMPORT(0x267) DWORD XamContentFlush(PCSTR RootName, PXOVERLAPPED Overlapped);
-
-/**
- * Copies the package of the 0x200-byte aggregate record Content to the device DeviceId
- * points to, owned by the XUID NewOwner points to. The 2.0.6717 dashboard passes NULL
- * for DeviceId when the destination is the package's device and NULL for NewOwner
- * when the owner does not change.
- * XAM calls Progress with a 64-bit byte count in r4, a reason in r8 and Context in
- * the stack slot at 0x50 of its caller. The dashboard's routine (0x9225BF00) adds the
- * growth of the count to its total, takes the count to start again at 0 on reason 1, and
- * returns 0. The dashboard passes 0 for Unknown, whose meaning is not known. Returns a
- * Win32 error code, or ERROR_IO_PENDING with an Overlapped.
- */
-XAM_IMPORT(0x26C) DWORD XamContentCopyInternal(
- const XUID *NewOwner,
- const DWORD *DeviceId,
- PCBYTE Content,
- PCVOID Progress,
- PVOID Context,
- DWORD Unknown,
- PXOVERLAPPED Overlapped);
-
-/** Moves a package; the arguments are those of XamContentCopyInternal. */
-XAM_IMPORT(0x26D) DWORD XamContentMoveInternal(
- const XUID *NewOwner,
- const DWORD *DeviceId,
- PCBYTE Content,
- PCVOID Progress,
- PVOID Context,
- DWORD Unknown,
- PXOVERLAPPED Overlapped);
-
-/**
- * Reads the header of the package of the 0x200-byte aggregate record Content into
- * Buffer, 0x93D6 bytes in the 2.0.6717 dashboard. Returns a Win32 error code.
- */
-XAM_IMPORT(0x26E) DWORD XamContentGetMetaDataInternal(PCBYTE Content, PBYTE Buffer, PXOVERLAPPED Overlapped);
-
-/**
- * Deletes the package of the 0x200-byte aggregate record Content. Returns a Win32 error
- * code, or ERROR_IO_PENDING with an Overlapped.
- */
-XAM_IMPORT(0x270) DWORD XamContentDeleteInternal(PCBYTE Content, PXOVERLAPPED Overlapped);
-
-/**
- * Opens the package of the 0x200-byte aggregate record Content and maps it to the drive
- * RootName, as XamContentCreate. The 2.0.6717 dashboard opens existing packages
- * (Flags 3) and passes 0 for Reserved and Size. Returns a Win32 error code.
- */
-XAM_IMPORT(0x271) DWORD XamContentCreateInternal(
- PCSTR RootName,
- PCBYTE Content,
- DWORD Flags,
- PDWORD Disposition,
- PDWORD LicenseMask,
- DWORD Reserved,
- ULONGLONG Size,
- PXOVERLAPPED Overlapped);
-
-/**
- * Launches the NUL-terminated executable path Image inside the package of the 0x200-byte
- * aggregate record Content. Returns 0 on success; the system then ends the caller.
- */
-XAM_IMPORT(0x273) DWORD XamContentLaunchImageInternal(PCBYTE Content, PCSTR Image);
-
-/**
- * Writes the path of the package of the 0x200-byte aggregate record Content to Path as a
- * NUL-terminated string of at most Capacity bytes. The 2.0.6717 dashboard passes 0x104
- * and 0 for the reserved arguments. Returns a Win32 error code.
- */
-XAM_IMPORT(0x276) DWORD XamContentResolveInternal(
- PCBYTE Content,
- PSTR Path,
- DWORD Capacity,
- DWORD Reserved1,
- DWORD Reserved2,
- DWORD Reserved3);
-
-/**
- * Writes the 0x24-byte attribute block of the package of the 0x200-byte aggregate record
- * Content to Attributes; +0x4 holds the creation FILETIME. Returns a Win32 error code,
- * or ERROR_IO_PENDING with an Overlapped.
- */
-XAM_IMPORT(0x277) DWORD XamContentGetAttributesInternal(PCBYTE Content, PBYTE Attributes, PXOVERLAPPED Overlapped);
-
-/**
- * Opens an enumeration of the packages of ContentType and TitleId on DeviceId (0: every
- * device). The 2.0.6717 dashboard passes 0 as the first argument; its Memory area passes a
- * device id, other callers 0. Returns a Win32 error code.
- */
-XAM_IMPORT(0x279) DWORD XamContentAggregateCreateEnumerator(
- DWORD Reserved,
- DWORD DeviceId,
- DWORD ContentType,
- DWORD TitleId,
- PHANDLE Handle);
-
-/**
- * Stores the id of the default content device at DeviceId. Returns a Win32 error code,
- * ERROR_FUNCTION_FAILED when no device is the default. The 2.0.6717 dashboard passes the
- * device word of a 0x200-byte content record and does not read the result.
- */
-XAM_IMPORT(0x284) DWORD XamContentGetDefaultDevice(PDWORD DeviceId);
-
-XBOX360_EXTERN_C_END
-
-#endif
diff --git a/platform/xex/sdk/include/xbox360/xam/input.h b/platform/xex/sdk/include/xbox360/xam/input.h
deleted file mode 100644
index caf87bf..0000000
--- a/platform/xex/sdk/include/xbox360/xam/input.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * XAM controller input: state, capabilities, vibration and keystrokes.
- */
-
-#ifndef XBOX360_XAM_INPUT_H
-#define XBOX360_XAM_INPUT_H
-
-#include <xbox360/xam/xamdef.h>
-
-XBOX360_EXTERN_C_START
-
-/* Devices a controller query covers. */
-#define XINPUT_FLAG_GAMEPAD 0x00000001
-
-/* XamInputGetKeystrokeEx: every device class, and a keystroke of any user. */
-#define XINPUT_FLAG_ANYDEVICE 0x000000FF
-#define XINPUT_FLAG_ANYUSER 0x40000000
-
-/* Device type and subtype. */
-#define XINPUT_DEVTYPE_GAMEPAD 0x01
-#define XINPUT_DEVSUBTYPE_GAMEPAD 0x01
-
-/* Pressed buttons of a gamepad. */
-#define XINPUT_GAMEPAD_DPAD_UP 0x0001
-#define XINPUT_GAMEPAD_DPAD_DOWN 0x0002
-#define XINPUT_GAMEPAD_DPAD_LEFT 0x0004
-#define XINPUT_GAMEPAD_DPAD_RIGHT 0x0008
-#define XINPUT_GAMEPAD_START 0x0010
-#define XINPUT_GAMEPAD_BACK 0x0020
-#define XINPUT_GAMEPAD_LEFT_THUMB 0x0040
-#define XINPUT_GAMEPAD_RIGHT_THUMB 0x0080
-#define XINPUT_GAMEPAD_LEFT_SHOULDER 0x0100
-#define XINPUT_GAMEPAD_RIGHT_SHOULDER 0x0200
-#define XINPUT_GAMEPAD_GUIDE 0x0400
-#define XINPUT_GAMEPAD_A 0x1000
-#define XINPUT_GAMEPAD_B 0x2000
-#define XINPUT_GAMEPAD_X 0x4000
-#define XINPUT_GAMEPAD_Y 0x8000
-
-/* Capability flags. */
-#define XINPUT_CAPS_FFB_SUPPORTED 0x0001
-#define XINPUT_CAPS_WIRELESS 0x0002
-#define XINPUT_CAPS_VOICE_SUPPORTED 0x0004
-#define XINPUT_CAPS_PMD_SUPPORTED 0x0008
-#define XINPUT_CAPS_NO_NAVIGATION 0x0010
-
-/* Keystroke flags. */
-#define XINPUT_KEYSTROKE_KEYDOWN 0x0001
-#define XINPUT_KEYSTROKE_KEYUP 0x0002
-#define XINPUT_KEYSTROKE_REPEAT 0x0004
-
-typedef struct _XINPUT_GAMEPAD {
- WORD wButtons;
- BYTE bLeftTrigger;
- BYTE bRightTrigger;
- SHORT sThumbLX;
- SHORT sThumbLY;
- SHORT sThumbRX;
- SHORT sThumbRY;
-} XINPUT_GAMEPAD, *PXINPUT_GAMEPAD;
-
-C_ASSERT(sizeof(XINPUT_GAMEPAD) == 12);
-
-typedef struct _XINPUT_STATE {
- /* Changes whenever the controller state changes. */
- DWORD dwPacketNumber;
- XINPUT_GAMEPAD Gamepad;
-} XINPUT_STATE, *PXINPUT_STATE;
-
-C_ASSERT(sizeof(XINPUT_STATE) == 16);
-
-/* Motor speeds, 0 to 65535. */
-typedef struct _XINPUT_VIBRATION {
- WORD wLeftMotorSpeed;
- WORD wRightMotorSpeed;
-} XINPUT_VIBRATION, *PXINPUT_VIBRATION;
-
-C_ASSERT(sizeof(XINPUT_VIBRATION) == 4);
-
-/* The gamepad and vibration fields hold the ranges the device supports. */
-typedef struct _XINPUT_CAPABILITIES {
- BYTE Type;
- BYTE SubType;
- WORD Flags;
- XINPUT_GAMEPAD Gamepad;
- XINPUT_VIBRATION Vibration;
-} XINPUT_CAPABILITIES, *PXINPUT_CAPABILITIES;
-
-C_ASSERT(sizeof(XINPUT_CAPABILITIES) == 20);
-C_ASSERT(__builtin_offsetof(XINPUT_CAPABILITIES, Vibration) == 16);
-
-/* One key transition. Controller buttons arrive as virtual keys 0x5800 and up. */
-typedef struct _XINPUT_KEYSTROKE {
- WORD VirtualKey;
- WCHAR Unicode;
- WORD Flags;
- BYTE UserIndex;
- BYTE HidCode;
-} XINPUT_KEYSTROKE, *PXINPUT_KEYSTROKE;
-
-C_ASSERT(sizeof(XINPUT_KEYSTROKE) == 8);
-
-/*
- * Controller keys as XamInputGetKeystrokeEx reports them in VirtualKey.
- * Keyboard keys use Windows virtual key codes, not listed here.
- */
-typedef enum _XINPUT_PAD_KEY {
- VK_PAD_A = 0x5800,
- VK_PAD_B = 0x5801,
- VK_PAD_X = 0x5802,
- VK_PAD_Y = 0x5803,
- VK_PAD_RSHOULDER = 0x5804,
- VK_PAD_LSHOULDER = 0x5805,
- VK_PAD_LTRIGGER = 0x5806,
- VK_PAD_RTRIGGER = 0x5807,
- VK_PAD_DPAD_UP = 0x5810,
- VK_PAD_DPAD_DOWN = 0x5811,
- VK_PAD_DPAD_LEFT = 0x5812,
- VK_PAD_DPAD_RIGHT = 0x5813,
- VK_PAD_START = 0x5814,
- VK_PAD_BACK = 0x5815,
- VK_PAD_LTHUMB_UP = 0x5820,
- VK_PAD_LTHUMB_DOWN = 0x5821,
- VK_PAD_LTHUMB_RIGHT = 0x5822,
- VK_PAD_LTHUMB_LEFT = 0x5823,
-} XINPUT_PAD_KEY;
-
-/**
- * Reads the capabilities of the controller of a user slot.
- * Returns a Win32 error code: ERROR_DEVICE_NOT_CONNECTED without a controller.
- */
-XAM_IMPORT(0x190) DWORD XamInputGetCapabilities(DWORD UserIndex, DWORD Flags, PXINPUT_CAPABILITIES Capabilities);
-
-/**
- * Reads the state of the controller of a user slot.
- * Returns a Win32 error code: ERROR_DEVICE_NOT_CONNECTED without a controller.
- */
-XAM_IMPORT(0x191) DWORD XamInputGetState(DWORD UserIndex, DWORD Flags, PXINPUT_STATE State);
-
-/**
- * Sets the motor speeds of the controller of a user slot. Xenia ignores Flags.
- * Returns a Win32 error code.
- */
-XAM_IMPORT(0x192) DWORD XamInputSetState(DWORD UserIndex, DWORD Flags, const XINPUT_VIBRATION *Vibration);
-
-/**
- * Takes the next queued key transition. UserIndex points to the user slot, or
- * with XINPUT_FLAG_ANYUSER in Flags receives the slot of the keystroke.
- * Returns a Win32 error code; nonzero when no keystroke is queued.
- */
-XAM_IMPORT(0x198) DWORD XamInputGetKeystrokeEx(PDWORD UserIndex, DWORD Flags, PXINPUT_KEYSTROKE Keystroke);
-
-XBOX360_EXTERN_C_END
-
-#endif
diff --git a/platform/xex/sdk/include/xbox360/xam/net.h b/platform/xex/sdk/include/xbox360/xam/net.h
deleted file mode 100644
index 2774402..0000000
--- a/platform/xex/sdk/include/xbox360/xam/net.h
+++ /dev/null
@@ -1,550 +0,0 @@
-/*
- * Winsock, XNet, HTTP and UPnP exports of xam.xex (NetDll_*) and the Xbox
- * LIVE logon exports (XNetLogon*).
- *
- * Every NetDll_* export takes an XNCALLER first. Multi-byte socket
- * addresses and ports are in network byte order.
- */
-
-#ifndef XBOX360_XAM_NET_H
-#define XBOX360_XAM_NET_H
-
-#include <xbox360/xam/xamdef.h>
-
-XBOX360_EXTERN_C_START
-
-/* On whose behalf a network call is made. */
-typedef enum _XNCALLER {
- XNCALLER_TITLE = 1,
- XNCALLER_SYSAPP = 2,
- XNCALLER_XBDM = 3,
-} XNCALLER;
-
-/*
- * Winsock
- */
-
-/* A socket, or INVALID_SOCKET from a call that failed. */
-typedef ULONG SOCKET, *PSOCKET;
-
-#define INVALID_SOCKET ((SOCKET)~0)
-/* Result of a call that has no count to return: 0 or this. */
-#define SOCKET_ERROR (-1)
-
-/* Address family. */
-#define AF_INET 2
-
-/* Socket type. */
-#define SOCK_STREAM 1
-#define SOCK_DGRAM 2
-
-/* Protocol, also an option level. */
-#define IPPROTO_TCP 6
-#define IPPROTO_UDP 17
-
-/* Option level of IP options. */
-#define IPPROTO_IP 0
-
-/* What NetDll_shutdown disables. */
-#define SD_RECEIVE 0
-#define SD_SEND 1
-#define SD_BOTH 2
-
-/* NetDll_ioctlsocket commands. */
-/* Sets non-blocking mode from a nonzero argument. */
-#define FIONBIO 0x8004667EUL
-/* Stores the number of bytes ready to read. */
-#define FIONREAD 0x4004667FUL
-
-/* Option level of socket options. */
-#define SOL_SOCKET 0xFFFF
-
-/* Options of level SOL_SOCKET. The console rejects SO_KEEPALIVE and
- SO_ERROR with WSAENOPROTOOPT. SO_DONTLINGER and SO_EXCLUSIVEADDRUSE can
- only be set. */
-#define SO_REUSEADDR 0x0004
-#define SO_KEEPALIVE 0x0008
-#define SO_BROADCAST 0x0020
-#define SO_LINGER 0x0080
-#define SO_SNDBUF 0x1001
-#define SO_RCVBUF 0x1002
-#define SO_SNDTIMEO 0x1005
-#define SO_RCVTIMEO 0x1006
-#define SO_ERROR 0x1007
-#define SO_TYPE 0x1008
-#define SO_DONTLINGER (~SO_LINGER)
-#define SO_EXCLUSIVEADDRUSE (~SO_REUSEADDR)
-
-/* Options of the console only. Their names are this SDK's; the official ones
- are unknown. */
-
-/* Level SOL_SOCKET. */
-/* Marks the socket insecure: its traffic bypasses XNet security. A title
- needs the XEX_SYSTEM_INSECURE_SOCKETS privilege, or setting it fails with
- WSAEACCES. */
-#define SO_INSECURE 0x5801
-/* Limits the socket to the local network: connect and sendto fail with
- WSAEHOSTUNREACH for an address that is not private (10/8, 172.16/12,
- 192.168/16), on the console's subnet, loopback, broadcast or multicast. */
-#define SO_LAN_ONLY 0x5802
-
-/* Level IPPROTO_TCP. A TCP socket only; the MSS values are 88 to 1460. */
-/* The peer's receive window, scaled. Can only be read. */
-#define TCP_SEND_WINDOW 0x5802
-/* The segment size of sends: 512 until the connection is established, then
- the peer's MSS, at most TCP_LOCAL_MSS. */
-#define TCP_SEND_MSS 0x5803
-/* The MSS that the socket announces and the most it sends. Unless set, the
- connection picks 1460 for an address on the console's subnet, 1324 for
- another, and 1264 for an XNet secure address. */
-#define TCP_LOCAL_MSS 0x5804
-/* Nonzero offers selective acknowledgments (RFC 2018), which the connection
- uses if the peer permits them. Can only be set. */
-#define TCP_SACK 0x5805
-
-/* Level IPPROTO_IP. The DSCP of sent packets: one byte, 0 to 63. */
-#define IP_DSCP 0x64
-
-/* Option of level IPPROTO_TCP. */
-#define TCP_NODELAY 0x0001
-
-/* Options of level IPPROTO_IP, with their Winsock 1 numbers. IP_TTL takes 1
- to 255. The membership options take the group address (the start of an
- ip_mreq) on a bound socket that is not TCP, at most four groups per socket;
- they can only be set. */
-#define IP_ADD_MEMBERSHIP 5
-#define IP_DROP_MEMBERSHIP 6
-#define IP_TTL 7
-
-/* Flags of sends and receives. */
-#define MSG_OOB 0x1
-#define MSG_PEEK 0x2
-#define MSG_DONTROUTE 0x4
-
-/* Network events of NetDll_WSAEventSelect. */
-#define FD_READ 0x01
-#define FD_WRITE 0x02
-#define FD_OOB 0x04
-#define FD_ACCEPT 0x08
-#define FD_CONNECT 0x10
-#define FD_CLOSE 0x20
-
-/* Sockets per select set. */
-#define FD_SETSIZE 64
-
-/* WSADATA, as NetDll_WSAStartup stores it. */
-typedef struct WSAData {
- WORD wVersion;
- WORD wHighVersion;
- CHAR szDescription[257];
- CHAR szSystemStatus[129];
- USHORT iMaxSockets;
- USHORT iMaxUdpDg;
- PCHAR lpVendorInfo;
-} WSADATA, *PWSADATA, *LPWSADATA;
-
-C_ASSERT(__builtin_offsetof(WSADATA, iMaxSockets) == 0x186);
-C_ASSERT(sizeof(WSADATA) == 0x190);
-
-/* IPv4 address. */
-typedef struct in_addr {
- ULONG s_addr;
-} IN_ADDR, *PIN_ADDR;
-
-C_ASSERT(sizeof(IN_ADDR) == 4);
-
-/* Generic socket address. */
-typedef struct sockaddr {
- USHORT sa_family;
- CHAR sa_data[14];
-} SOCKADDR, *PSOCKADDR;
-
-C_ASSERT(sizeof(SOCKADDR) == 16);
-
-/* IPv4 socket address. */
-typedef struct sockaddr_in {
- USHORT sin_family;
- USHORT sin_port;
- struct in_addr sin_addr;
- CHAR sin_zero[8];
-} SOCKADDR_IN, *PSOCKADDR_IN;
-
-C_ASSERT(sizeof(SOCKADDR_IN) == 16);
-
-/* Descriptor set of NetDll_select. */
-typedef struct fd_set {
- UINT fd_count;
- SOCKET fd_array[FD_SETSIZE];
-} fd_set, *PFD_SET;
-
-C_ASSERT(sizeof(fd_set) == 0x104);
-
-/* Time interval. */
-typedef struct timeval {
- LONG tv_sec;
- LONG tv_usec;
-} TIMEVAL, *PTIMEVAL;
-
-C_ASSERT(sizeof(TIMEVAL) == 8);
-
-/*
- * XNet
- */
-
-/* NetDll_XNetGetTitleXnAddr and NetDll_XNetGetDebugXnAddr results. */
-#define XNET_GET_XNADDR_PENDING 0x0000
-#define XNET_GET_XNADDR_NONE 0x0001
-#define XNET_GET_XNADDR_ETHERNET 0x0002
-#define XNET_GET_XNADDR_STATIC 0x0004
-#define XNET_GET_XNADDR_DHCP 0x0008
-#define XNET_GET_XNADDR_PPPOE 0x0010
-#define XNET_GET_XNADDR_GATEWAY 0x0020
-#define XNET_GET_XNADDR_DNS 0x0040
-#define XNET_GET_XNADDR_ONLINE 0x0080
-#define XNET_GET_XNADDR_TROUBLESHOOT 0x8000
-
-/* NetDll_XNetGetEthernetLinkStatus flags. */
-#define XNET_ETHERNET_LINK_ACTIVE 0x01
-#define XNET_ETHERNET_LINK_100MBPS 0x02
-#define XNET_ETHERNET_LINK_10MBPS 0x04
-#define XNET_ETHERNET_LINK_FULL_DUPLEX 0x08
-#define XNET_ETHERNET_LINK_HALF_DUPLEX 0x10
-
-/* XNetStartupParams flags. */
-/* Accept insecure connections, as development kits allow. */
-#define XNET_STARTUP_BYPASS_SECURITY 0x01
-
-/* Options of NetDll_XNetGetOpt and NetDll_XNetSetOpt. */
-/* The XNetStartupParams the stack was started with. */
-#define XNET_OPTID_STARTUP_PARAMS 0x0001
-/* A ULONGLONG that changes with network traffic. */
-#define XNET_OPTID_ACTIVITY_COUNTER 0x0004
-/* Promiscuous receive. */
-#define XNET_OPTID_PROMISCUOUS 0x1390
-/* Link flags of the network interface. */
-#define XNET_OPTID_LINK_FLAGS 0x1395
-/* Reports the secondary network interface. */
-#define XNET_OPTID_SECONDARY_NIC 0x2F00
-/* A ULONG state of the USB wireless adapter; bit 0 is set while attached. */
-#define XNET_OPTID_WIRELESS_ADAPTER_STATE 0x2AF9
-/* The wireless security type and key, in a 0x48-byte record. */
-#define XNET_OPTID_WIRELESS_KEY 0x2AFA
-/* The wireless adapter information record. */
-#define XNET_OPTID_WIRELESS_ADAPTER_INFO 0x2AFC
-/* A count followed by at most ten wireless security capabilities. */
-#define XNET_OPTID_WIRELESS_CAPABILITIES 0x2AFD
-/* A 0x24-byte record with the SSID length and 32 SSID bytes. */
-#define XNET_OPTID_WIRELESS_SSID 0x0D010102
-/* A ULONG BSS type: 0 ad-hoc, 1 infrastructure. */
-#define XNET_OPTID_WIRELESS_BSS_TYPE 0x0D010108
-/* A ULONG radio mode: 1 802.11b, 2 802.11a, 3 802.11g, 4 any. */
-#define XNET_OPTID_WIRELESS_MODE 0x0D010204
-/* A LONG: received signal strength of the wireless adapter in dBm. */
-#define XNET_OPTID_WIRELESS_RSSI 0x0D010206
-/* Variable-length wireless scan records. */
-#define XNET_OPTID_WIRELESS_SCAN_RESULTS 0x0D010217
-/* Starts a wireless network scan. WSAEINPROGRESS means one is active. */
-#define XNET_OPTID_WIRELESS_SCAN_START 0x0D01021A
-
-/*
- * Network address of a console. Addresses and the port are in network byte
- * order.
- */
-typedef struct _XNADDR {
- /* IP address; zero without a static or DHCP address. */
- IN_ADDR ina;
- /* Online IP address; zero when not online. */
- IN_ADDR inaOnline;
- WORD wPortOnline;
- BYTE abEnet[6];
- BYTE abOnline[20];
-} XNADDR, *PXNADDR;
-
-C_ASSERT(sizeof(XNADDR) == 0x24);
-
-/*
- * Network stack settings of NetDll_XNetStartup. A zero field selects the
- * default of the network stack.
- */
-typedef struct _XNetStartupParams {
- /* sizeof(XNetStartupParams), 13. */
- BYTE cfgSizeOfStruct;
- /* XNET_STARTUP_* flags. */
- BYTE cfgFlags;
- BYTE cfgSockMaxDgramSockets;
- BYTE cfgSockMaxStreamSockets;
- BYTE cfgSockDefaultRecvBufsizeInK;
- BYTE cfgSockDefaultSendBufsizeInK;
- BYTE cfgKeyRegMax;
- BYTE cfgSecRegMax;
- BYTE cfgQosDataLimitDiv4;
- BYTE cfgQosProbeTimeoutInSeconds;
- BYTE cfgQosProbeRetries;
- BYTE cfgQosSrvMaxSimultaneousResponses;
- BYTE cfgQosPairWaitTimeInSeconds;
-} XNetStartupParams, *PXNetStartupParams;
-
-C_ASSERT(__builtin_offsetof(XNetStartupParams, cfgSockDefaultRecvBufsizeInK) == 4);
-C_ASSERT(sizeof(XNetStartupParams) == 13);
-
-/*
- * Saved network configuration, the 0x1EC-byte record of
- * NetDll_XnpLoadConfigParams, NetDll_XnpSaveConfigParams and
- * NetDll_XnpConfig. Fields without a known meaning are reserved; a caller
- * zeroes them.
- */
-typedef struct _XNetConfigParams {
- BYTE Reserved0[0x4C];
- /* Meaning of each bit unknown; a debug monitor sets 0xC with a static
- address, subnet and gateway. */
- USHORT Flags;
- BYTE Reserved1[6];
- /* Static IP address, network byte order. */
- ULONG Address;
- /* Subnet mask, network byte order. */
- ULONG Subnet;
- /* Default gateway, network byte order. */
- ULONG Gateway;
- BYTE Reserved2[8];
- /* DHCP host name, NUL-terminated. */
- CHAR HostName[0x184];
-} XNetConfigParams, *PXNetConfigParams;
-
-C_ASSERT(__builtin_offsetof(XNetConfigParams, Flags) == 0x4C);
-C_ASSERT(__builtin_offsetof(XNetConfigParams, Address) == 0x54);
-C_ASSERT(__builtin_offsetof(XNetConfigParams, Subnet) == 0x58);
-C_ASSERT(__builtin_offsetof(XNetConfigParams, Gateway) == 0x5C);
-C_ASSERT(__builtin_offsetof(XNetConfigParams, HostName) == 0x68);
-C_ASSERT(sizeof(XNetConfigParams) == 0x1EC);
-
-/*
- * Winsock exports
- */
-
-/** Initializes Winsock. VersionRequested is MAKEWORD(major, minor). */
-XAM_IMPORT(0x001) INT NetDll_WSAStartup(XNCALLER Caller, WORD VersionRequested, PWSADATA Data);
-
-/** Creates a socket. Returns the socket or INVALID_SOCKET. */
-XAM_IMPORT(0x003) SOCKET NetDll_socket(XNCALLER Caller, INT AddressFamily, INT Type, INT Protocol);
-
-/** Closes a socket. */
-XAM_IMPORT(0x004) INT NetDll_closesocket(XNCALLER Caller, SOCKET Socket);
-
-/** Disables sends, receives or both (SD_*) on a socket. */
-XAM_IMPORT(0x005) INT NetDll_shutdown(XNCALLER Caller, SOCKET Socket, INT How);
-
-/** Controls a socket mode. */
-XAM_IMPORT(0x006) INT NetDll_ioctlsocket(XNCALLER Caller, SOCKET Socket, ULONG Command, PULONG Argument);
-
-/** Sets a socket option. */
-XAM_IMPORT(0x007) INT NetDll_setsockopt(XNCALLER Caller, SOCKET Socket, INT Level, INT OptionName,
- PCSTR OptionValue, INT OptionLength);
-
-/** Reads a socket option. */
-XAM_IMPORT(0x008) INT NetDll_getsockopt(XNCALLER Caller, SOCKET Socket, INT Level, INT OptionName,
- PCHAR OptionValue, PINT OptionLength);
-
-/** Stores the local address of a socket. */
-XAM_IMPORT(0x009) INT NetDll_getsockname(XNCALLER Caller, SOCKET Socket, struct sockaddr *Name,
- PINT NameLength);
-
-/** Stores the remote address of a connected socket. */
-XAM_IMPORT(0x00A) INT NetDll_getpeername(XNCALLER Caller, SOCKET Socket, struct sockaddr *Name,
- PINT NameLength);
-
-/** Binds a socket to a local address. */
-XAM_IMPORT(0x00B) INT NetDll_bind(XNCALLER Caller, SOCKET Socket, const struct sockaddr *Name,
- INT NameLength);
-
-/** Connects a socket to a remote address. */
-XAM_IMPORT(0x00C) INT NetDll_connect(XNCALLER Caller, SOCKET Socket, const struct sockaddr *Name,
- INT NameLength);
-
-/** Places a socket in the listening state. */
-XAM_IMPORT(0x00D) INT NetDll_listen(XNCALLER Caller, SOCKET Socket, INT Backlog);
-
-/** Accepts a connection. Returns the new socket or INVALID_SOCKET. */
-XAM_IMPORT(0x00E) SOCKET NetDll_accept(XNCALLER Caller, SOCKET Socket, struct sockaddr *Address,
- PINT AddressLength);
-
-/** Waits until sockets are readable, writable or in error. Returns the number of ready sockets. */
-XAM_IMPORT(0x00F) INT NetDll_select(XNCALLER Caller, INT Count, fd_set *ReadFds, fd_set *WriteFds,
- fd_set *ExceptFds, const struct timeval *Timeout);
-
-/** Receives from a connected socket. Returns the byte count or SOCKET_ERROR. */
-XAM_IMPORT(0x012) INT NetDll_recv(XNCALLER Caller, SOCKET Socket, PCHAR Buffer, INT Length, INT Flags);
-
-/** Receives a datagram and its source address. */
-XAM_IMPORT(0x014) INT NetDll_recvfrom(XNCALLER Caller, SOCKET Socket, PCHAR Buffer, INT Length, INT Flags,
- struct sockaddr *From, PINT FromLength);
-
-/** Sends on a connected socket. Returns the byte count or SOCKET_ERROR. */
-XAM_IMPORT(0x016) INT NetDll_send(XNCALLER Caller, SOCKET Socket, PCSTR Buffer, INT Length, INT Flags);
-
-/** Sends a datagram to an address. */
-XAM_IMPORT(0x018) INT NetDll_sendto(XNCALLER Caller, SOCKET Socket, PCSTR Buffer, INT Length, INT Flags,
- const struct sockaddr *To, INT ToLength);
-
-/** Returns the last Winsock error of the current thread. */
-XAM_IMPORT(0x01B) INT NetDll_WSAGetLastError(XNCALLER Caller);
-
-/**
- * Associates network events (FD_*) of a socket with an event object. A NULL
- * EventObject and no events end the association.
- */
-XAM_IMPORT(0x023) INT NetDll_WSAEventSelect(XNCALLER Caller, SOCKET Socket, HANDLE EventObject,
- LONG NetworkEvents);
-
-/*
- * XNet exports
- */
-
-/** Initializes the network stack. Params may be NULL. */
-XAM_IMPORT(0x033) INT NetDll_XNetStartup(XNCALLER Caller, const XNetStartupParams *Params);
-
-/** Fills a buffer with random bytes. */
-XAM_IMPORT(0x035) INT NetDll_XNetRandom(XNCALLER Caller, PBYTE Buffer, UINT Length);
-
-/** Stores the title XNADDR. Returns XNET_GET_XNADDR_* flags. */
-XAM_IMPORT(0x049) DWORD NetDll_XNetGetTitleXnAddr(XNCALLER Caller, PXNADDR Address);
-
-/** Stores the debug XNADDR. Returns XNET_GET_XNADDR_* flags. */
-XAM_IMPORT(0x04A) DWORD NetDll_XNetGetDebugXnAddr(XNCALLER Caller, PXNADDR Address);
-
-/** Returns the link status (XNET_ETHERNET_LINK_*) of the network interface. */
-XAM_IMPORT(0x04B) DWORD NetDll_XNetGetEthernetLinkStatus(XNCALLER Caller);
-
-/** Reads a network stack option (XNET_OPTID_*). */
-XAM_IMPORT(0x04E) INT NetDll_XNetGetOpt(XNCALLER Caller, DWORD OptionId, PBYTE Value, PINT ValueLength);
-
-/** Writes a network stack option (XNET_OPTID_*). */
-XAM_IMPORT(0x04F) INT NetDll_XNetSetOpt(XNCALLER Caller, DWORD OptionId, PCBYTE Value, DWORD ValueLength);
-
-/**
- * NetDll_XNetStartup with a third argument. The 2.0.6717 dashboard calls it
- * in place of NetDll_XNetStartup when XamGetSystemVersion is 0x200A3200 or
- * more, with Version 0x2017F400, and treats the result as that of
- * NetDll_XNetStartup.
- */
-XAM_IMPORT(0x050) INT NetDll_XNetStartupVersion(XNCALLER Caller, const XNetStartupParams *Params,
- DWORD Version);
-
-/** Reads the saved network configuration, a 0x1EC-byte record, into Params. */
-XAM_IMPORT(0x065) HRESULT NetDll_XnpLoadConfigParams(XNCALLER Caller, PXNetConfigParams Params);
-
-/**
- * Saves the 0x1EC-byte network configuration record Params. Returns
- * E_PENDING while the save has not finished; the 2.0.6717 dashboard calls it
- * again until it does.
- */
-XAM_IMPORT(0x066) HRESULT NetDll_XnpSaveConfigParams(XNCALLER Caller, const XNetConfigParams *Params);
-
-/** Applies a network configuration. The meaning of Flags is unknown; a debug monitor passes 0. */
-XAM_IMPORT(0x068) INT NetDll_XnpConfig(XNCALLER Caller, const XNetConfigParams *Config, DWORD Flags);
-
-/** Stores the network configuration status. The layout of the record is unknown. */
-XAM_IMPORT(0x069) INT NetDll_XnpGetConfigStatus(XNCALLER Caller, PVOID Status);
-
-/**
- * Installs or removes Ethernet frame transmit and receive callbacks. The
- * callback signatures and the meaning of each Flags bit are unknown; a debug
- * monitor's network simulator sets 0x2 and a frame capture sets none.
- */
-XAM_IMPORT(0x06D) INT NetDll_XnpEthernetInterceptSetCallbacks(XNCALLER Caller, PVOID Transmit, PVOID Receive,
- PVOID Context, DWORD Flags);
-
-/** Transmits a raw Ethernet frame. */
-XAM_IMPORT(0x06E) DWORD NetDll_XnpEthernetInterceptXmit(XNCALLER Caller, PBYTE Frame, DWORD Length);
-
-/** Delivers a raw Ethernet frame to the network stack. */
-XAM_IMPORT(0x06F) DWORD NetDll_XnpEthernetInterceptRecv(XNCALLER Caller, PBYTE Frame, DWORD Length);
-
-/** Stores the list of open sockets. Count holds the capacity on entry and the count on return. */
-XAM_IMPORT(0x07A) DWORD NetDll_XnpGetActiveSocketList(XNCALLER Caller, PVOID Buffer, PDWORD Count);
-
-/** Informs the network stack that the system time changed. */
-XAM_IMPORT(0x07B) DWORD NetDll_XnpNoteSystemTime(XNCALLER Caller);
-
-/*
- * HTTP exports. Session, connection and request handles are DWORD values; 0
- * means failure.
- */
-
-/** Initializes the HTTP client. */
-XAM_IMPORT(0x0C9) BOOL NetDll_XHttpStartup(XNCALLER Caller, DWORD Reserved, DWORD Parameters);
-
-/** Shuts down the HTTP client. */
-XAM_IMPORT(0x0CA) BOOL NetDll_XHttpShutdown(XNCALLER Caller);
-
-/** Opens an HTTP session. Returns the session handle or 0. */
-XAM_IMPORT(0x0CB) DWORD NetDll_XHttpOpen(XNCALLER Caller, PCSTR UserAgent, DWORD AccessType, DWORD ProxyName,
- DWORD ProxyBypass, DWORD Flags);
-
-/** Closes an HTTP handle. */
-XAM_IMPORT(0x0CC) BOOL NetDll_XHttpCloseHandle(XNCALLER Caller, DWORD Handle);
-
-/** Opens an HTTP connection to a server. Returns the connection handle or 0. */
-XAM_IMPORT(0x0CD) DWORD NetDll_XHttpConnect(XNCALLER Caller, DWORD Session, PCSTR ServerName, DWORD ServerPort,
- DWORD Flags);
-
-/** Installs a status callback on an HTTP handle. The callback signature is unknown. */
-XAM_IMPORT(0x0CE) DWORD NetDll_XHttpSetStatusCallback(XNCALLER Caller, DWORD Handle, DWORD Callback,
- DWORD NotificationFlags, DWORD Reserved);
-
-/** Opens an HTTP request. Returns the request handle or 0. */
-XAM_IMPORT(0x0CF) DWORD NetDll_XHttpOpenRequest(XNCALLER Caller, DWORD Connection, PCSTR Verb, PCSTR ObjectName,
- DWORD Version, DWORD Referrer, DWORD AcceptTypes, DWORD Flags);
-
-/** Sends an HTTP request. */
-XAM_IMPORT(0x0D1) BOOL NetDll_XHttpSendRequest(XNCALLER Caller, DWORD Request, DWORD Headers, DWORD HeadersLength,
- DWORD Optional, DWORD OptionalLength, DWORD TotalLength,
- DWORD Context);
-
-/** Waits for the response to an HTTP request. */
-XAM_IMPORT(0x0D2) BOOL NetDll_XHttpReceiveResponse(XNCALLER Caller, DWORD Request, DWORD Reserved);
-
-/** Reads response header information. */
-XAM_IMPORT(0x0D3) BOOL NetDll_XHttpQueryHeaders(XNCALLER Caller, DWORD Request, DWORD InfoLevel, DWORD Name,
- PDWORD Buffer, PDWORD BufferLength, DWORD Index);
-
-/** Reads response body data. The byte count is stored at BytesRead. */
-XAM_IMPORT(0x0D4) BOOL NetDll_XHttpReadData(XNCALLER Caller, DWORD Request, PVOID Buffer, DWORD Length,
- PDWORD BytesRead);
-
-/** Sets an option on an HTTP handle. */
-XAM_IMPORT(0x0D7) BOOL NetDll_XHttpSetOption(XNCALLER Caller, DWORD Handle, DWORD Option, PDWORD Buffer,
- DWORD BufferLength);
-
-/** Processes pending HTTP work for a session. */
-XAM_IMPORT(0x0D8) BOOL NetDll_XHttpDoWork(XNCALLER Caller, DWORD Session, DWORD Timeout);
-
-/*
- * UPnP exports
- */
-
-/** Starts the UPnP client. */
-XAM_IMPORT(0x0FB) INT NetDll_UpnpStartup(XNCALLER Caller);
-
-/** Stops the UPnP client. */
-XAM_IMPORT(0x0FC) INT NetDll_UpnpCleanup(XNCALLER Caller);
-
-/*
- * Xbox LIVE logon exports
- */
-
-/** Stores the Xbox LIVE logon status and extended status. */
-XAM_IMPORT(0x13B) DWORD XNetLogonGetExtendedStatus(PDWORD Status, PDWORD ExtendedStatus);
-
-/**
- * Discards the cached Xbox LIVE tickets. The 2.0.6717 dashboard passes 0; the
- * meaning of the argument is unknown.
- */
-XAM_IMPORT(0x13C) DWORD XNetLogonClearTicketCaches(DWORD Unknown);
-
-/* Ordinal 0x139 from Xenia's export table; 0x1C6 is XamGetWCNConfigFile. */
-/** Stores a NUL-terminated Xbox LIVE service DNS name in Buffer. */
-XAM_IMPORT(0x139) DWORD XNetLogonGetDnsString(DWORD Index, PCHAR Buffer, DWORD Capacity);
-
-XBOX360_EXTERN_C_END
-
-#endif
diff --git a/platform/xex/sdk/include/xbox360/xam/notify.h b/platform/xex/sdk/include/xbox360/xam/notify.h
deleted file mode 100644
index a7957c5..0000000
--- a/platform/xex/sdk/include/xbox360/xam/notify.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * XAM notifications and messages to XAM applications.
- */
-
-#ifndef XBOX360_XAM_NOTIFY_H
-#define XBOX360_XAM_NOTIFY_H
-
-#include <xbox360/xam/xamdef.h>
-
-XBOX360_EXTERN_C_START
-
-/* Notification areas of XamNotifyCreateListenerInternal. */
-#define XNOTIFY_SYSTEM 0x00000001
-
-/**
- * Takes the next queued notification of Listener and stores its id and parameter.
- * A nonzero MatchId takes only notifications with that id.
- * Returns nonzero when a notification was taken.
- */
-XAM_IMPORT(0x28B) BOOLEAN XNotifyGetNext(HANDLE Listener, DWORD MatchId, PDWORD Id, PDWORD Parameter);
-
-/**
- * Sends the notification Id with Parameter to every listener. The 2.0.6717 dashboard
- * sends 0x8000000F with the bit of the user whose background changed and does not read
- * the result, so none is declared.
- */
-XAM_IMPORT(0x28E) VOID XNotifyBroadcast(DWORD Id, DWORD Parameter);
-
-/** Creates a notification listener for the notification areas in Mask. Returns the listener handle. */
-XAM_IMPORT(0x291) HANDLE XamNotifyCreateListenerInternal(ULONGLONG Mask, DWORD IsSystem, DWORD MaxVersion);
-
-/**
- * Calls a XAM application in the calling process. The meaning of the parameters depends
- * on Message.
- */
-XAM_IMPORT(0x1F4) HRESULT XMsgInProcessCall(DWORD App, DWORD Message, PDWORD Parameter1, PDWORD Parameter2);
-
-/**
- * Calls a XAM application synchronously. The dashboard reports a language change with
- * App 0xFE, Message 0x8000000D and no buffer.
- */
-XAM_IMPORT(0x1F6) HRESULT XMsgSystemProcessCall(DWORD App, DWORD Message, PVOID Buffer, DWORD BufferLength);
-
-/**
- * Starts an I/O request to a XAM application. Completes through Overlapped when not NULL.
- *
- * With Overlapped, the result is the Win32 code ERROR_IO_PENDING (997) and not an
- * HRESULT, so it reads as a success with facility 0. The outcome of the request is in
- * Overlapped.
- */
-XAM_IMPORT(0x1F7) HRESULT XMsgStartIORequest(
- DWORD App,
- DWORD Message,
- PXOVERLAPPED Overlapped,
- PVOID Buffer,
- DWORD BufferLength);
-
-/**
- * Cancels the request of Overlapped. With Wait, returns after the request completed.
- * The 2.0.6717 dashboard always waits and does not use the result.
- */
-XAM_IMPORT(0x1F8) DWORD XMsgCancelIORequest(PXOVERLAPPED Overlapped, BOOL Wait);
-
-/**
- * Starts an I/O request to a XAM application with an extra parameter block. The 2.0.6717
- * dashboard queries a video license with App 0xFA, Message 0x7005D, a 16-byte request and
- * Extended pointing to the words 0x20080002 and 0. Without Overlapped the call completes
- * before it returns; the dashboard then also takes a nonzero thread error as failure.
- */
-XAM_IMPORT(0x1FC) HRESULT XMsgStartIORequestEx(
- DWORD App,
- DWORD Message,
- PXOVERLAPPED Overlapped,
- PVOID Buffer,
- DWORD BufferLength,
- PDWORD Extended);
-
-XBOX360_EXTERN_C_END
-
-#endif
diff --git a/platform/xex/sdk/include/xbox360/xam/system.h b/platform/xex/sdk/include/xbox360/xam/system.h
deleted file mode 100644
index a990fc8..0000000
--- a/platform/xex/sdk/include/xbox360/xam/system.h
+++ /dev/null
@@ -1,368 +0,0 @@
-/*
- * XAM loader, system, Win32-style, automation, media and play timer imports.
- */
-
-#ifndef XBOX360_XAM_SYSTEM_H
-#define XBOX360_XAM_SYSTEM_H
-
-#include <xbox360/xboxkrnl/ntdef.h>
-#include <xbox360/xam/xamdef.h>
-
-XBOX360_EXTERN_C_START
-
-/* Wait time without limit. */
-#define INFINITE 0xFFFFFFFF
-
-/* Results of WaitForSingleObject. */
-#define WAIT_OBJECT_0 0x00000000
-#define WAIT_ABANDONED_0 0x00000080
-#define WAIT_TIMEOUT 0x00000102
-#define WAIT_FAILED 0xFFFFFFFF
-
-/* Flags of RtlAllocateHeap and RtlFreeHeap. */
-#define HEAP_ZERO_MEMORY 0x00000008
-
-/* Options of DuplicateHandle. */
-#define DUPLICATE_CLOSE_SOURCE 0x00000001
-#define DUPLICATE_SAME_ACCESS 0x00000002
-
-/* CreateFileA result of a failed call. */
-#define INVALID_HANDLE_VALUE ((HANDLE)(LONG_PTR)-1)
-
-/* Creation disposition of CreateFileA. */
-typedef enum _CREATION_DISPOSITION {
- CREATE_NEW = 1,
- CREATE_ALWAYS = 2,
- OPEN_EXISTING = 3,
- OPEN_ALWAYS = 4,
- TRUNCATE_EXISTING = 5
-} CREATION_DISPOSITION;
-
-/* Date and time, as GetLocalTime stores it. */
-typedef struct _SYSTEMTIME {
- WORD wYear;
- WORD wMonth;
- WORD wDayOfWeek;
- WORD wDay;
- WORD wHour;
- WORD wMinute;
- WORD wSecond;
- WORD wMilliseconds;
-} SYSTEMTIME, *PSYSTEMTIME;
-
-C_ASSERT(sizeof(SYSTEMTIME) == 0x10);
-
-/* Video mode, filled by XGetVideoMode. Layout from Xenia. */
-typedef struct _XVIDEO_MODE {
- DWORD dwDisplayWidth;
- DWORD dwDisplayHeight;
- /* Nonzero for an interlaced mode. */
- BOOL fIsInterlaced;
- /* Nonzero for a 16:9 display. */
- BOOL fIsWideScreen;
- /* Nonzero for a high definition mode. */
- BOOL fIsHiDef;
- FLOAT RefreshRate;
- DWORD VideoStandard;
- DWORD Reserved[5];
-} XVIDEO_MODE, *PXVIDEO_MODE;
-
-C_ASSERT(sizeof(XVIDEO_MODE) == 0x30);
-C_ASSERT(__builtin_offsetof(XVIDEO_MODE, RefreshRate) == 0x14);
-
-/* Record of XamPlayTimerGetData and XamPlayTimerSetData. */
-typedef struct _XPLAY_TIMER_DATA {
- /* Next reset, written by XamPlayTimerGetNextResetDate. */
- DWORD NextReset[2];
- /* Period flags: 0 is off, 2 daily, 4 weekly. */
- DWORD Period;
- /* Play time allowed per period, in milliseconds. */
- DWORD Allowance;
- /* Play time remaining in the period, in milliseconds. */
- DWORD Remaining;
-} XPLAY_TIMER_DATA, *PXPLAY_TIMER_DATA;
-
-C_ASSERT(sizeof(XPLAY_TIMER_DATA) == 0x14);
-C_ASSERT(__builtin_offsetof(XPLAY_TIMER_DATA, Remaining) == 0x10);
-
-/** Applies the configured inactivity timeout. */
-XAM_IMPORT(0x1A2) DWORD XamSetInactivityTimeFromConfig(DWORD Apply);
-
-/**
- * Writes the media type of the disc in the console drive to MediaType and its title id to
- * TitleId. The 2.0.6717 dashboard reads media 1 as an Xbox 360 game and -1 as unknown.
- */
-XAM_IMPORT(0x1A3) VOID XamLoaderGetMediaInfo(PDWORD MediaType, PDWORD TitleId);
-
-/**
- * Ends the running title and launches the executable at Path (NULL or a NUL-terminated path)
- * with Flags. A NULL Path returns to the dashboard.
- * Call it only from a thread of the title process: XAM then ends the title and the calling
- * thread with it.
- */
-XAM_IMPORT(0x1A4) DECLSPEC_NORETURN VOID XamLoaderLaunchTitle(PCSTR Path, DWORD Flags);
-
-/**
- * Launches the executable at Path with Flags, as XamLoaderLaunchTitle does. The purpose of
- * Second and Third (NUL-terminated strings or NULL) is not known; the 2.0.6717 dashboard
- * passes NULL for all three strings to launch the disc.
- */
-XAM_IMPORT(0x1A5) VOID XamLoaderLaunchTitleEx(PCSTR Path, PCSTR Second, PCSTR Third, DWORD Flags);
-
-/**
- * Sets the launch data the next title reads with XamLoaderGetLaunchData. Returns a Win32
- * error code.
- */
-XAM_IMPORT(0x1A6) DWORD XamLoaderSetLaunchData(PCVOID Data, DWORD Size);
-
-/**
- * Copies the launch data the previous title set to Buffer, at most Size bytes.
- * Returns a Win32 error code; nonzero when no launch data is set.
- */
-XAM_IMPORT(0x1A8) DWORD XamLoaderGetLaunchData(PVOID Buffer, DWORD Size);
-
-/**
- * Ends the running title.
- * Call it only from a thread of the title process: XAM then ends the title and the calling
- * thread with it.
- */
-XAM_IMPORT(0x1A9) DECLSPEC_NORETURN VOID XamLoaderTerminateTitle(VOID);
-
-/** Returns the optical drive tray state. */
-XAM_IMPORT(0x1AA) DWORD XamLoaderGetDvdTrayState(VOID);
-
-/** Returns 1 when TitleId is a system title id. */
-XAM_IMPORT(0x1BB) BOOLEAN XamIsSystemTitleId(DWORD TitleId);
-
-/** Returns the title id of the title that ran before the current one, or 0. */
-XAM_IMPORT(0x1BE) DWORD XamLoaderGetPriorTitleId(VOID);
-
-/** Returns nonzero when TitleId is an original Xbox title. */
-XAM_IMPORT(0x1BF) BOOLEAN XamIsXbox1TitleId(DWORD TitleId);
-
-/**
- * Gives the PNG of the default gamer picture: stores its address at Image and its length at
- * Size. The 2.0.6717 dashboard does not read the result.
- */
-XAM_IMPORT(0x1C5) DWORD XamGetDefaultSystemImage(PCBYTE *Image, PDWORD Size);
-
-/**
- * Writes the NUL-terminated path of the Windows Connect Now configuration file found on a
- * storage device to Path, at most Capacity bytes. Returns ERROR_FILE_NOT_FOUND when no device
- * holds one, or another Win32 error code.
- */
-XAM_IMPORT(0x1C6) DWORD XamGetWCNConfigFile(PSTR Path, DWORD Capacity);
-
-/** Mutes (nonzero) or unmutes the sounds of the system UI. */
-XAM_IMPORT(0x1CA) VOID XamMuteSound(DWORD Mute);
-
-/**
- * Sets the dashboard context XAM reports to the system UI. The 2.0.6717 dashboard passes 3
- * when initial setup starts and 0 when it completes.
- */
-XAM_IMPORT(0x1CC) VOID XamSetDashContext(DWORD Context);
-
-/** Returns the title id of the running title, 0 for none. */
-XAM_IMPORT(0x1CF) DWORD XamGetCurrentTitleId(VOID);
-
-/**
- * Returns the Win32 result of the request of Overlapped, or ERROR_IO_INCOMPLETE while it runs
- * and Wait is FALSE. Stores the result length at Length when not NULL.
- */
-XAM_IMPORT(0x1FB) DWORD XamGetOverlappedResult(PXOVERLAPPED Overlapped, PDWORD Length, BOOL Wait);
-
-/**
- * Unloads the XAM applications stacked above the dashboard. The 2.0.6717 dashboard passes 0
- * for Flags; the result is not used.
- */
-XAM_IMPORT(0x246) DWORD XamAppUnloadStack(DWORD Flags);
-
-/**
- * Creates an enumeration handle served by XAM application App: XamEnumerate on it sends
- * EnumerateMessage, closing it sends CloseMessage. The handle carries a private block of
- * PrivateSize bytes for the application. The 2.0.6717 dashboard passes user -1 and Flags
- * 0x20000001 for its media enumerations. Returns a Win32 error code.
- */
-XAM_IMPORT(0x24E) DWORD XamCreateEnumeratorHandle(DWORD UserIndex, DWORD App, DWORD EnumerateMessage,
- DWORD CloseMessage, DWORD PrivateSize, DWORD Count, DWORD Flags, PHANDLE Handle);
-
-/**
- * Stores the object of the private block of an enumeration Handle at Object, with a reference
- * the caller releases with ObDereferenceObject. The 2.0.6717 dashboard zeroes PrivateSize bytes
- * from the object's +0x18, passes that address in its start request and does not read the
- * result, so none is declared.
- */
-XAM_IMPORT(0x24F) VOID XamGetPrivateEnumStructureFromHandle(HANDLE Handle, PVOID *Object);
-
-/**
- * Reads the next records of an enumeration into Buffer. Stores the record count at Items when
- * not NULL. Returns a Win32 error code: ERROR_NO_MORE_FILES after the last record, or
- * ERROR_IO_PENDING with an Overlapped, which then holds the count in its length.
- */
-XAM_IMPORT(0x250) DWORD XamEnumerate(HANDLE Handle, DWORD Flags, PVOID Buffer, DWORD Size, PDWORD Items,
- PXOVERLAPPED Overlapped);
-
-/**
- * Unloads the system application App. The 2.0.6717 dashboard passes app 0xF6 with Unknown 1
- * before a format, before it deletes the package named IptvClient, and in the IPTV client
- * download (0x9228B9A0); the meaning of Unknown is not known and the result is not read.
- */
-XAM_IMPORT(0x252) DWORD XamUnloadSysApp(DWORD App, DWORD Unknown);
-
-/** Returns the system software version. */
-XAM_IMPORT(0x282) DWORD XamGetSystemVersion(VOID);
-
-/**
- * Writes the cached name of TitleId as NUL-terminated UTF-16 to Buffer, at most *Length units.
- * Returns a Win32 error code.
- */
-XAM_IMPORT(0x2B6) DWORD XamGetCachedTitleName(DWORD TitleId, PWSTR Buffer, PDWORD Length);
-
-/**
- * Clears XAM's content and title caches. The 2.0.6717 dashboard passes zero during storage
- * maintenance and ignores the result.
- */
-XAM_IMPORT(0x2B7) DWORD XamCacheReset(DWORD Flags);
-
-/** Returns nonzero when the running system UI was opened by a title. */
-XAM_IMPORT(0x2EB) DWORD XamIsSysUiInvokedByTitle(VOID);
-
-/** Returns nonzero while a system UI is shown. */
-XAM_IMPORT(0x2EC) BOOLEAN XamIsUIActive(VOID);
-
-/**
- * Writes the locator of the system resource Name to Locator, at most Capacity UTF-16 units:
- * `section://<xam.xex module handle>,shrdres#<name>`, or a `memory://` locator for eight legacy
- * names. In system software 2.0.21256.0 it asserts (`twi 31`) unless the running title is one
- * of two system titles, which halts other titles under the debug monitor.
- */
-XAM_IMPORT(0x31C) HRESULT XamBuildLegacySystemResourceLocator(PCWSTR Name, PWSTR Locator, DWORD Capacity);
-
-/** Returns the audio flags (XConfig user setting 0xB). */
-XAM_IMPORT(0x3CA) DWORD XGetAudioFlags(VOID);
-
-/** Returns the AV pack value. */
-XAM_IMPORT(0x3CB) DWORD XGetAVPack(VOID);
-
-/** Returns the game region of the console (XConfig). */
-XAM_IMPORT(0x3CC) DWORD XGetGameRegion(VOID);
-
-/** Stores the current video mode. */
-XAM_IMPORT(0x3D1) VOID XGetVideoMode(PXVIDEO_MODE VideoMode);
-
-/** Returns the console language. */
-XAM_IMPORT(0x3D2) DWORD XamGetLanguage(VOID);
-
-/** Binds an automation controller to a user slot. */
-XAM_IMPORT(0x3D5) DWORD XAutomationpBindController(DWORD UserIndex);
-
-/** Removes the automation controller from a user slot. */
-XAM_IMPORT(0x3D6) DWORD XAutomationpUnbindController(DWORD UserIndex);
-
-/** Sends a Guide button press from the automation controller of a user slot. */
-XAM_IMPORT(0x3D7) DWORD XAutomationpInputXenonButton(DWORD UserIndex);
-
-/** Allocates from a heap. Returns the address or NULL. */
-XAM_IMPORT(0x3FC) PVOID RtlAllocateHeap(HANDLE HeapHandle, DWORD Flags, SIZE_T Size);
-
-/** Frees a heap block. */
-XAM_IMPORT(0x3FF) BOOL RtlFreeHeap(HANDLE HeapHandle, DWORD Flags, PVOID BaseAddress);
-
-/** Returns the ID of the current thread. */
-XAM_IMPORT(0x410) DWORD GetCurrentThreadId(VOID);
-
-/** Waits on a handle for Milliseconds, or without limit for INFINITE. */
-XAM_IMPORT(0x425) DWORD WaitForSingleObject(HANDLE Handle, DWORD Milliseconds);
-
-/** Sets an event to not signaled. */
-XAM_IMPORT(0x42B) BOOL ResetEvent(HANDLE Event);
-
-/** Stores the performance counter. */
-XAM_IMPORT(0x42F) BOOL QueryPerformanceCounter(PLARGE_INTEGER PerformanceCount);
-
-/** Stores the performance counter frequency. */
-XAM_IMPORT(0x430) BOOL QueryPerformanceFrequency(PLARGE_INTEGER Frequency);
-
-/** Decrements the suspend count of a thread. Returns the previous count. */
-XAM_IMPORT(0x43D) DWORD ResumeThread(HANDLE Thread);
-
-/** Stores the local time. */
-XAM_IMPORT(0x444) VOID GetLocalTime(PSYSTEMTIME SystemTime);
-
-/** Creates an event. Returns the handle or NULL. */
-XAM_IMPORT(0x446) HANDLE CreateEventA(PVOID EventAttributes, BOOL ManualReset, BOOL InitialState, PCSTR Name);
-
-/**
- * Creates or opens a file. FileName is a NUL-terminated path. Returns the handle or
- * INVALID_HANDLE_VALUE.
- */
-XAM_IMPORT(0x447) HANDLE CreateFileA(PCSTR FileName, ACCESS_MASK DesiredAccess, DWORD ShareMode,
- PVOID SecurityAttributes, CREATION_DISPOSITION CreationDisposition, DWORD FlagsAndAttributes,
- HANDLE TemplateFile);
-
-/** Duplicates a handle. */
-XAM_IMPORT(0x45B) BOOL DuplicateHandle(HANDLE SourceProcessHandle, HANDLE SourceHandle,
- HANDLE TargetProcessHandle, PHANDLE TargetHandle, ACCESS_MASK DesiredAccess, BOOL InheritHandle,
- DWORD Options);
-
-/** Removes the IPTV service registration. */
-XAM_IMPORT(0x517) HRESULT XamIptvUninstall(VOID);
-
-/**
- * Stores the DVR storage in megabytes: the space given to recordings, the space they use, and
- * the largest allocation the service accepts.
- */
-XAM_IMPORT(0x518) HRESULT XamGetDvrStorage(PDWORD Allocated, PDWORD Used, PDWORD Maximum);
-
-/**
- * Sets the space given to recordings, in megabytes. Completes through Overlapped; the 2.0.6717
- * dashboard treats a negative result as a failure.
- */
-XAM_IMPORT(0x519) HRESULT XamSetDvrStorage(DWORD Allocated, PXOVERLAPPED Overlapped);
-
-/** Stores a pointer to the NUL-terminated UTF-16 name of the IPTV service at Name. */
-XAM_IMPORT(0x51A) HRESULT XamIptvGetServiceName(PCWSTR *Name);
-
-/** Returns the default heap of the process. */
-XAM_IMPORT(0x7D2) HANDLE GetProcessHeap(VOID);
-
-/**
- * Copies the background download queue of UserIndex to Items, 0x250-byte records with the
- * package path at +0x138. Count holds the capacity in records on entry and the number copied
- * on return. The 2.0.6717 dashboard passes a capacity of 6 and reads only Count.
- */
-XAM_IMPORT(0x9C7) DWORD XamBackgroundDownloadGetItems(DWORD UserIndex, PVOID Items, PDWORD Count);
-
-/** Copies the play timer record to Data. The 2.0.6717 dashboard does not read the result. */
-XAM_IMPORT(0xA5A) VOID XamPlayTimerGetData(PXPLAY_TIMER_DATA Data);
-
-/**
- * Replaces the play timer record with Data. The 2.0.6717 dashboard passes 1 for Save and does
- * not read the result.
- */
-XAM_IMPORT(0xA5B) VOID XamPlayTimerSetData(const XPLAY_TIMER_DATA *Data, DWORD Save);
-
-/** Resumes the play timer. The 2.0.6717 dashboard passes 1. */
-XAM_IMPORT(0xA5C) VOID XamPlayTimerResume(DWORD Resume);
-
-/** Suspends the play timer. */
-XAM_IMPORT(0xA5D) VOID XamPlayTimerSuspend(VOID);
-
-/** Whether the play timer is counting. */
-XAM_IMPORT(0xA5E) BOOLEAN XamPlayTimerIsRunning(VOID);
-
-/** Whether a play timer period is set. */
-XAM_IMPORT(0xA5F) BOOLEAN XamPlayTimerIsEnabled(VOID);
-
-/** Writes the next reset of Period to Data->NextReset. */
-XAM_IMPORT(0xA60) VOID XamPlayTimerGetNextResetDate(DWORD Period, PXPLAY_TIMER_DATA Data);
-
-/** Posts the play timer notification. */
-XAM_IMPORT(0xA64) VOID XamPlayTimerForceNotification(VOID);
-
-/** The security violations the system has detected, as a 64-bit value. */
-XAM_IMPORT(0xAF3) ULONGLONG XamGetSecurityViolationsDetected(VOID);
-
-XBOX360_EXTERN_C_END
-
-#endif
diff --git a/platform/xex/sdk/include/xbox360/xam/ui.h b/platform/xex/sdk/include/xbox360/xam/ui.h
deleted file mode 100644
index 8aaa4ef..0000000
--- a/platform/xex/sdk/include/xbox360/xam/ui.h
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * XAM system UI: sign-in, keyboard, message box, device selector, gamer
- * cards, marketplace and other system screens.
- */
-
-#ifndef XBOX360_XAM_UI_H
-#define XBOX360_XAM_UI_H
-
-#include <xbox360/xam/xamdef.h>
-
-XBOX360_EXTERN_C_START
-
-/* Icon of a message box, in the low four bits of the XamShowMessageBoxUI flags. */
-typedef enum _XMB_ICON {
- XMB_NOICON = 0,
- XMB_ERRORICON = 1,
- XMB_WARNINGICON = 2,
- XMB_ALERTICON = 3,
-} XMB_ICON;
-
-/* The user enters a four-key passcode, returned in MESSAGEBOX_RESULT. The box takes no buttons. */
-#define XMB_PASSCODEMODE 0x00010000
-/* XAM compares the entered passcode with the one the result block holds. */
-#define XMB_VERIFYPASSCODEMODE 0x00020000
-
-/* The index of the chosen button, or the four virtual key codes of a passcode. */
-typedef union _MESSAGEBOX_RESULT {
- DWORD dwButtonPressed;
- WORD rgwPasscode[4];
-} MESSAGEBOX_RESULT, *PMESSAGEBOX_RESULT;
-
-C_ASSERT(sizeof(MESSAGEBOX_RESULT) == 8);
-
-/**
- * Opens the sign-in UI with Panes user panes. Returns a Win32 error code; the UI does
- * not report when it closes.
- */
-XAM_IMPORT(0x2BC) DWORD XamShowSigninUI(DWORD Panes, DWORD Flags);
-
-/**
- * XamShowSigninUI for the controller UserIndex. Returns a Win32 error code; the UI
- * does not report when it closes.
- */
-XAM_IMPORT(0x2BE) DWORD XamShowSigninUIp(DWORD UserIndex, DWORD Panes, DWORD Flags);
-
-/**
- * Shows the virtual keyboard. DefaultText, Title and Description are NUL-terminated
- * UTF-16 strings. Completes through Overlapped and writes the NUL-terminated text to
- * Buffer, at most Length units. Returns ERROR_IO_PENDING when the keyboard is shown,
- * or another Win32 error code.
- */
-XAM_IMPORT(0x2C1) DWORD XamShowKeyboardUI(
- DWORD UserIndex,
- DWORD Flags,
- PCWSTR DefaultText,
- PCWSTR Title,
- PCWSTR Description,
- PWSTR Buffer,
- DWORD Length,
- PXOVERLAPPED Overlapped);
-
-/**
- * Opens the gamer card of the profile signed in on UserIndex. Returns a Win32 error code.
- * An index above 3 reaches RtlRip.
- */
-XAM_IMPORT(0x2C4) DWORD XamShowGamerCardUI(DWORD UserIndex);
-
-/**
- * Opens the achievements of TitleId for UserIndex. Returns a Win32 error code. An index
- * above 3 reaches RtlRip.
- */
-XAM_IMPORT(0x2C5) DWORD XamShowAchievementsUI(DWORD UserIndex, DWORD TitleId);
-
-/**
- * Shows a message box with up to three buttons. Title, Text and each entry of Buttons are
- * NUL-terminated UTF-16 strings. Completes through Overlapped and stores the result at
- * Result; dwButtonPressed is the chosen button index. Returns ERROR_IO_PENDING when the
- * box is shown, or another Win32 error code.
- */
-XAM_IMPORT(0x2CA) DWORD XamShowMessageBoxUI(
- DWORD UserIndex,
- PCWSTR Title,
- PCWSTR Text,
- DWORD ButtonCount,
- const PCWSTR *Buttons,
- DWORD FocusButton,
- DWORD Flags,
- PMESSAGEBOX_RESULT Result,
- PXOVERLAPPED Overlapped);
-
-/**
- * Shows the storage device selector for content of type ContentType (0 for any) that
- * needs BytesRequested free bytes (0 for any). DeviceId holds the device selected
- * first and receives the chosen device id. Completes through Overlapped. Returns
- * ERROR_IO_PENDING when the selector is shown, or another Win32 error code.
- */
-XAM_IMPORT(0x2CB) DWORD XamShowDeviceSelectorUI(
- DWORD UserIndex,
- DWORD ContentType,
- DWORD Flags,
- ULONGLONG BytesRequested,
- PDWORD DeviceId,
- PXOVERLAPPED Overlapped);
-
-/**
- * Opens the profile creation UI for UserIndex. In system software 2.0.21256.0 the export
- * passes Unknown on to XamShowCreateProfileUIEx, which stores it in the request and
- * selects one of two modes by it (1, 0xB and 0xE against any other value); the 2.0.6717.0
- * export takes only UserIndex and stores 0 there. Returns a Win32 error code. An index
- * above 3 reaches RtlRip.
- */
-XAM_IMPORT(0x2CF) DWORD XamShowCreateProfileUI(DWORD UserIndex, DWORD Unknown);
-
-/**
- * Opens the played games list of UserIndex. The 2.0.6717 dashboard passes 0 for
- * Unknown. Returns a Win32 error code. An index above 3 reaches RtlRip.
- */
-XAM_IMPORT(0x2D0) DWORD XamShowGamesUI(DWORD UserIndex, DWORD Unknown);
-
-/**
- * Opens the Xbox LIVE signup UI for UserIndex. The 2.0.6717 dashboard passes 1 to
- * recover an existing account and 0 to join. Returns a Win32 error code.
- */
-XAM_IMPORT(0x2D1) DWORD XamShowLiveSignupUI(DWORD UserIndex, DWORD Mode);
-
-/**
- * Opens the gamer card of Xuid for UserIndex. A nonzero Flags sets bit 0x80 of the
- * request; the 2.0.6717 dashboard passes 0. Returns a Win32 error code. An index above 3
- * reaches RtlRip.
- */
-XAM_IMPORT(0x2D5) DWORD XamShowGamerCardUIForXUID(DWORD UserIndex, XUID Xuid, DWORD Flags);
-
-/**
- * Opens the details of AchievementId of TitleId for UserIndex. Returns a Win32 error
- * code. An index above 3 reaches RtlRip.
- */
-XAM_IMPORT(0x2E0) DWORD XamShowAchievementDetailsUI(DWORD UserIndex, DWORD TitleId, DWORD AchievementId);
-
-/**
- * In system software 2.0.6717.0 opens the theme picker for UserIndex, copying 0x200 bytes
- * from InitialSelection when it is not NULL. In 2.0.21256.0 it opens no UI: it writes
- * 0x144 bytes of the selection to <drive>:\ThematicSkin and sends notification
- * 0x8000000F, and a NULL InitialSelection reaches RtlRip. The purpose of Unknown is
- * not known.
- */
-XAM_IMPORT(0x2E1) DWORD XamShowPersonalizationUI(DWORD UserIndex, PCBYTE InitialSelection, DWORD Unknown);
-
-/**
- * Opens the marketplace at Entry for UserIndex, with the offer OfferId and the title
- * TitleId. The 2.0.6717 dashboard passes 0xFFFFFFFF, 0xFFFFFFFF, 0 and 0 for the four
- * unknown arguments. Returns a Win32 error code.
- */
-XAM_IMPORT(0x2E8) DWORD XamShowMarketplaceUIEx(
- DWORD UserIndex,
- DWORD Entry,
- ULONGLONG OfferId,
- DWORD Unknown1,
- DWORD Unknown2,
- DWORD Unknown3,
- DWORD Unknown4,
- DWORD TitleId);
-
-/**
- * Opens the Xbox LIVE upsell UI for UserIndex. XamShowLiveUpsellUI (0x2D7) takes no
- * arguments and calls this export with 0. Returns a Win32 error code.
- */
-XAM_IMPORT(0x300) DWORD XamShowLiveUpsellUIEx(DWORD UserIndex);
-
-/**
- * Opens the join session in progress UI for the player Xuid for UserIndex. Returns a
- * Win32 error code. An index above 3 reaches RtlRip.
- */
-XAM_IMPORT(0x301) DWORD XamShowJoinSessionInProgressUI(DWORD UserIndex, XUID Xuid);
-
-XBOX360_EXTERN_C_END
-
-#endif
diff --git a/platform/xex/sdk/include/xbox360/xam/user.h b/platform/xex/sdk/include/xbox360/xam/user.h
deleted file mode 100644
index a1a8287..0000000
--- a/platform/xex/sdk/include/xbox360/xam/user.h
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- * XAM users and profiles: sign-in, XUIDs, profile settings, profiles on
- * storage, achievements and tiles.
- */
-
-#ifndef XBOX360_XAM_USER_H
-#define XBOX360_XAM_USER_H
-
-#include <xbox360/xam/xamdef.h>
-
-XBOX360_EXTERN_C_START
-
-/* A user slot, or a choice the export makes. UserIndex arguments take these values. */
-typedef enum _XUSER_INDEX {
- XUSER_INDEX_0 = 0,
- XUSER_INDEX_1 = 1,
- XUSER_INDEX_2 = 2,
- XUSER_INDEX_3 = 3,
- /* No user, for operations on behalf of the title itself. */
- XUSER_INDEX_NONE = 0xFE,
- /* Any signed-in user or connected controller, as the export decides. */
- XUSER_INDEX_ANY = 0xFF,
-} XUSER_INDEX;
-
-/* Sign-in state of a user slot. */
-typedef enum _XUSER_SIGNIN_STATE {
- eXUserSigninState_NotSignedIn = 0,
- eXUserSigninState_SignedInLocally = 1,
- eXUserSigninState_SignedInToLive = 2,
-} XUSER_SIGNIN_STATE;
-
-/* Data type of a NUL-terminated UTF-16 string in XUSER_DATA. */
-#define XUSER_DATA_TYPE_UNICODE 4
-
-/*
- * A typed setting value. The type byte is at +0 and the value at +8; a
- * string is its byte length at +8 and its address at +0xC.
- */
-typedef struct _XUSER_DATA {
- BYTE type;
- BYTE Reserved[7];
- union {
- LONG nData;
- struct {
- DWORD cbData;
- PWSTR pwszData;
- } string;
- DWORD Value[2];
- };
-} XUSER_DATA, *PXUSER_DATA;
-
-C_ASSERT(sizeof(XUSER_DATA) == 0x10);
-C_ASSERT(__builtin_offsetof(XUSER_DATA, string) == 8);
-
-/*
- * One profile of XamProfileEnumerate. The first 8 bytes are the offline
- * XUID; the account data after it is not decoded here.
- */
-typedef struct _XPROFILE_ENUM_RESULT {
- XUID xuidOffline;
- BYTE Account[0x180];
-} XPROFILE_ENUM_RESULT, *PXPROFILE_ENUM_RESULT;
-
-C_ASSERT(sizeof(XPROFILE_ENUM_RESULT) == 0x188);
-
-/**
- * Stores the XUID of a user slot at Xuid. Flags selects the XUID kinds accepted
- * (the 2.0.6717 dashboard passes 1, 3, 4 and 7). Fails when the slot has no such XUID.
- */
-XAM_IMPORT(0x20A) HRESULT XamUserGetXUID(DWORD UserIndex, DWORD Flags, PXUID Xuid);
-
-/**
- * Signs in the users of the four XUIDs at Xuids, one per user slot; zero XUIDs sign
- * those slots out. XAM copies the XUIDs during the call. Returns ERROR_IO_PENDING (a
- * success value as an HRESULT) with an Overlapped.
- */
-XAM_IMPORT(0x20B) HRESULT XamUserLogon(const XUID *Xuids, DWORD Flags, PXOVERLAPPED Overlapped);
-
-/**
- * Writes the gamertag of a signed-in user slot to Buffer as NUL-terminated UTF-16,
- * at most Length units. The 2.0.6717 dashboard passes 16 units.
- */
-XAM_IMPORT(0x20C) HRESULT XamUserGetGamerTag(DWORD UserIndex, PWSTR Buffer, DWORD Length);
-
-/** Returns the sign-in state of a user slot. */
-XAM_IMPORT(0x210) XUSER_SIGNIN_STATE XamUserGetSigninState(DWORD UserIndex);
-
-/**
- * Stores at UserIndex the user slot the profile Xuid is signed in on. Flags
- * selects the XUID kinds compared, as for XamUserGetXUID; the 2.0.6717 dashboard's
- * Memory area passes 1. Fails when no slot has the profile.
- */
-XAM_IMPORT(0x211) HRESULT XamUserGetIndexFromXUID(XUID Xuid, DWORD Flags, PDWORD UserIndex);
-
-/**
- * Reads the profile settings SettingIds (SettingIdCount entries) of TitleId for UserIndex,
- * or of the XuidCount profiles at Xuids. Without Buffer, stores the size needed at
- * BufferSize. Returns a Win32 error code, or ERROR_IO_PENDING with an Overlapped.
- */
-XAM_IMPORT(0x219) DWORD XamUserReadProfileSettings(
- DWORD TitleId,
- DWORD UserIndex,
- DWORD XuidCount,
- const XUID *Xuids,
- DWORD SettingIdCount,
- const DWORD *SettingIds,
- PDWORD BufferSize,
- PBYTE Buffer,
- PXOVERLAPPED Overlapped);
-
-/** Returns the Xbox LIVE membership type of UserIndex in the low byte. */
-XAM_IMPORT(0x21B) DWORD XamUserGetMembershipType(DWORD UserIndex);
-
-/**
- * Processes the queued Xbox LIVE logons. Returns ERROR_IO_PENDING (a success value as an
- * HRESULT) with an Overlapped.
- */
-XAM_IMPORT(0x220) HRESULT XamUserFlushLogonQueue(PXOVERLAPPED Overlapped);
-
-/** Returns nonzero when the profile of a user slot has an Xbox LIVE account. */
-XAM_IMPORT(0x221) BOOLEAN XamUserIsOnlineEnabled(DWORD UserIndex);
-
-/**
- * Starts the creation of an offline profile on the device DeviceId points to and stores
- * the creation handle. Account is a zeroed 0x17C-byte XAMACCOUNTINFO with the
- * big-endian UTF-16 gamertag (16 units) at +8; Block is a zeroed 0x8F0-byte block. The
- * 2.0.6717 dashboard passes 1 for Flags and 0 for Reserved0, Reserved1 and Reserved2.
- * XAM uses the buffers until the creation completes.
- */
-XAM_IMPORT(0x230) HRESULT XamProfileCreate(
- DWORD Flags,
- const DWORD *DeviceId,
- DWORD Reserved0,
- PBYTE Account,
- PBYTE Block,
- DWORD Reserved1,
- DWORD Reserved2,
- PHANDLE Handle);
-
-/**
- * Opens an enumeration of the profiles on DeviceId (0 for all devices) and stores its handle.
- * Close the handle with NtClose. Returns a Win32 error code.
- */
-XAM_IMPORT(0x231) DWORD XamProfileCreateEnumerator(DWORD DeviceId, PHANDLE Handle);
-
-/**
- * Stores the next profile of an enumeration at Result. Returns a Win32 error code;
- * nonzero once no profile remains.
- */
-XAM_IMPORT(0x232) DWORD XamProfileEnumerate(HANDLE Handle, DWORD Flags, PXPROFILE_ENUM_RESULT Result, PXOVERLAPPED Overlapped);
-
-/**
- * Deletes the profile Xuid. The 2.0.6717 dashboard passes 0 for Unknown, whose meaning
- * is not known, and calls it without an overlapped block. Returns an HRESULT.
- */
-XAM_IMPORT(0x233) HRESULT XamProfileDelete(DWORD Unknown, XUID Xuid);
-
-/**
- * Stores the XUID of the profile a XamProfileCreate handle creates. Returns
- * E_PENDING while the creation runs.
- */
-XAM_IMPORT(0x234) HRESULT XamProfileGetCreationStatus(HANDLE Handle, PXUID Xuid);
-
-/**
- * Mounts the dashboard settings of the profile Xuid as the drive MountName
- * (NUL-terminated ASCII, such as DASHUSER). The 2.0.6717 dashboard passes 0 and NULL
- * for Flags and ContentData. Returns a Win32 error code.
- */
-XAM_IMPORT(0x237) DWORD XamProfileOpen(XUID Xuid, PCSTR MountName, DWORD Flags, PBYTE ContentData);
-
-/** Unmounts a drive that XamProfileOpen mounted. Returns a Win32 error code. */
-XAM_IMPORT(0x238) DWORD XamProfileClose(PCSTR MountName);
-
-/**
- * Reads the 0x17C-byte account record of the profile Xuid from its package on
- * DeviceId into Account; the gamertag is NUL-terminated UTF-16 at +0x08. Returns an
- * HRESULT.
- */
-XAM_IMPORT(0x23A) HRESULT XamProfileLoadAccountInfo(DWORD DeviceId, XUID Xuid, PBYTE Account);
-
-/**
- * Opens an enumeration of the achievements of TitleId for UserIndex or Xuid (0 for the
- * user). Stores the buffer size for Count records at BufferSize. Returns a Win32 error code.
- */
-XAM_IMPORT(0x2EE) DWORD XamUserCreateAchievementEnumerator(
- DWORD TitleId,
- DWORD UserIndex,
- XUID Xuid,
- DWORD DetailFlags,
- DWORD StartingIndex,
- DWORD Count,
- PDWORD BufferSize,
- PHANDLE Handle);
-
-/**
- * Reads a tile PNG into Buffer. Without Buffer, stores the size needed at BufferSize.
- * Returns a Win32 error code, or ERROR_IO_PENDING with an Overlapped.
- */
-XAM_IMPORT(0x2EF) DWORD XamReadTile(
- DWORD TileType,
- DWORD TitleId,
- ULONGLONG TileId,
- DWORD UserIndex,
- PBYTE Buffer,
- PDWORD BufferSize,
- PXOVERLAPPED Overlapped);
-
-/**
- * Writes the gamer picture of TitleId with the key words KeyHigh and KeyLow to the
- * profile signed in on UserIndex. The 2.0.6717 dashboard passes 0 for Reserved.
- * Returns a Win32 error code, ERROR_IO_PENDING with an Overlapped.
- */
-XAM_IMPORT(0x2F0) DWORD XamWriteGamerTile(
- DWORD UserIndex,
- DWORD TitleId,
- DWORD KeyHigh,
- DWORD KeyLow,
- DWORD Reserved,
- PXOVERLAPPED Overlapped);
-
-/**
- * Opens an enumeration of the titles UserIndex or Xuid (0 for the user) has played.
- * Stores the buffer size for Count records at BufferSize. Returns a Win32 error code.
- */
-XAM_IMPORT(0x2F3) DWORD XamUserCreateTitlesPlayedEnumerator(
- DWORD TitleId,
- DWORD UserIndex,
- XUID Xuid,
- DWORD StartingIndex,
- DWORD Count,
- PDWORD BufferSize,
- PHANDLE Handle);
-
-/**
- * Reads a tile PNG into Buffer of *BufferSize bytes and stores the length at BufferSize.
- * Key is the picture key setting for tile type 0xC; the 2.0.6717 dashboard passes
- * HasKey 0 with it. Returns a Win32 error code, or ERROR_IO_PENDING with an Overlapped.
- */
-XAM_IMPORT(0x2FC) DWORD XamReadTileEx(
- DWORD TileType,
- DWORD TitleId,
- ULONGLONG TileId,
- DWORD UserIndex,
- DWORD HasKey,
- const XUSER_DATA *Key,
- PBYTE Buffer,
- PDWORD BufferSize,
- PXOVERLAPPED Overlapped);
-
-/**
- * Writes the time of the local FILETIME Time for UserIndex as NUL-terminated UTF-16,
- * at most Length units. The 2.0.6717 dashboard does not read the result.
- */
-XAM_IMPORT(0x1E7) VOID XamFormatTimeString(DWORD UserIndex, ULONGLONG Time, PWSTR Buffer, DWORD Length);
-
-/**
- * Writes the date of the local FILETIME Time for UserIndex as NUL-terminated UTF-16,
- * at most Length units. The 2.0.6717 dashboard does not read the result.
- */
-XAM_IMPORT(0x1E8) VOID XamFormatDateString(DWORD UserIndex, ULONGLONG Time, PWSTR Buffer, DWORD Length);
-
-XBOX360_EXTERN_C_END
-
-#endif
diff --git a/platform/xex/sdk/include/xbox360/xam/xamdef.h b/platform/xex/sdk/include/xbox360/xam/xamdef.h
deleted file mode 100644
index 5186d43..0000000
--- a/platform/xex/sdk/include/xbox360/xam/xamdef.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * XAM types that most imports use.
- */
-
-#ifndef XBOX360_XAM_XAMDEF_H
-#define XBOX360_XAM_XAMDEF_H
-
-#include <xbox360/xboxkrnl/ntdef.h>
-
-XBOX360_EXTERN_C_START
-
-struct _XOVERLAPPED;
-
-typedef VOID (*PXOVERLAPPED_COMPLETION_ROUTINE)(DWORD ErrorCode, DWORD Length, struct _XOVERLAPPED *Overlapped);
-
-/*
- * State of an asynchronous XAM request. InternalLow holds the Win32 error
- * code, ERROR_IO_PENDING until the request completes.
- */
-typedef struct _XOVERLAPPED {
- ULONG_PTR InternalLow;
- ULONG_PTR InternalHigh;
- ULONG_PTR InternalContext;
- /* Event that XAM signals on completion, or NULL. */
- HANDLE hEvent;
- PXOVERLAPPED_COMPLETION_ROUTINE pCompletionRoutine;
- DWORD_PTR dwCompletionContext;
- DWORD dwExtendedError;
-} XOVERLAPPED, *PXOVERLAPPED;
-
-C_ASSERT(sizeof(XOVERLAPPED) == 0x1c);
-
-XBOX360_EXTERN_C_END
-
-#endif
diff --git a/platform/xex/sdk/include/xbox360/xbox360.h b/platform/xex/sdk/include/xbox360/xbox360.h
deleted file mode 100644
index b5d15a2..0000000
--- a/platform/xex/sdk/include/xbox360/xbox360.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/* Every Xbox 360 header. */
-
-#ifndef XBOX360_H
-#define XBOX360_H
-
-#include <xbox360/xboxkrnl.h>
-#include <xbox360/xam.h>
-
-#endif
diff --git a/platform/xex/sdk/include/xbox360/xboxkrnl.h b/platform/xex/sdk/include/xbox360/xboxkrnl.h
deleted file mode 100644
index 44c010a..0000000
--- a/platform/xex/sdk/include/xbox360/xboxkrnl.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* xboxkrnl.exe imports and the kernel types they use. */
-
-#ifndef XBOX360_XBOXKRNL_H
-#define XBOX360_XBOXKRNL_H
-
-#include <xbox360/xboxkrnl/ntdef.h>
-#include <xbox360/xboxkrnl/ke.h>
-#include <xbox360/xboxkrnl/ob.h>
-#include <xbox360/xboxkrnl/rtl.h>
-#include <xbox360/xboxkrnl/ex.h>
-#include <xbox360/xboxkrnl/mm.h>
-#include <xbox360/xboxkrnl/io.h>
-#include <xbox360/xboxkrnl/hal.h>
-#include <xbox360/xboxkrnl/xex.h>
-#include <xbox360/xboxkrnl/xe.h>
-#include <xbox360/xboxkrnl/vd.h>
-#include <xbox360/xboxkrnl/xma.h>
-#include <xbox360/xboxkrnl/xaudio.h>
-#include <xbox360/xboxkrnl/nic.h>
-#include <xbox360/xboxkrnl/usb.h>
-
-#endif
diff --git a/platform/xex/sdk/include/xbox360/xboxkrnl/ex.h b/platform/xex/sdk/include/xbox360/xboxkrnl/ex.h
deleted file mode 100644
index 1ffe646..0000000
--- a/platform/xex/sdk/include/xbox360/xboxkrnl/ex.h
+++ /dev/null
@@ -1,325 +0,0 @@
-/*
- * Executive: pool memory, threads, notifications, configuration settings,
- * events, semaphores, waits and the loaded image name.
- */
-
-#ifndef XBOX360_XBOXKRNL_EX_H
-#define XBOX360_XBOXKRNL_EX_H
-
-#include <xbox360/xboxkrnl/ntdef.h>
-#include <xbox360/xboxkrnl/ke.h>
-
-XBOX360_EXTERN_C_START
-
-/*
- * Pool of ExAllocatePoolTypeWithTag. CurrentProcessPool selects the title
- * pool for a title thread and the system pool otherwise.
- */
-typedef enum _POOL_TYPE {
- CurrentProcessPool = 0,
- TitlePool = 1,
- SystemPool = 2,
- TitleDebugPool = 3,
- SystemDebugPool = 4,
-} POOL_TYPE;
-
-/*
- * CreationFlags of ExCreateThread. Bits 24 to 29 select the hardware
- * threads the new thread may run on.
- */
-#define EX_CREATE_FLAG_SUSPENDED 0x00000001
-#define EX_CREATE_FLAG_SYSTEM 0x00000002
-/* Allocate the TLS data block with the thread and copy the TLS template into it. */
-#define EX_CREATE_FLAG_TLS_DATA 0x00000008
-/* Priority class 13; takes precedence over EX_CREATE_FLAG_PRIORITY_CLASS_LOW. */
-#define EX_CREATE_FLAG_PRIORITY_CLASS_HIGH 0x00000020
-/* Priority class 5. */
-#define EX_CREATE_FLAG_PRIORITY_CLASS_LOW 0x00000040
-/* ThreadHandle receives a referenced thread object instead of a handle. */
-#define EX_CREATE_FLAG_RETURN_KTHREAD 0x00000080
-/* Entry thread of a title. */
-#define EX_CREATE_FLAG_TITLE_ENTRY 0x00000100
-/* A debug monitor does not stop the thread. */
-#define EX_CREATE_FLAG_EXEMPT_FROM_STOPS 0x00000200
-/* A debug monitor does not debug the thread. */
-#define EX_CREATE_FLAG_NOT_DEBUGGABLE 0x00000400
-#define EX_CREATE_FLAG_PROCESSOR0 0x01000000
-#define EX_CREATE_FLAG_PROCESSOR1 0x02000000
-#define EX_CREATE_FLAG_PROCESSOR2 0x04000000
-#define EX_CREATE_FLAG_PROCESSOR3 0x08000000
-#define EX_CREATE_FLAG_PROCESSOR4 0x10000000
-#define EX_CREATE_FLAG_PROCESSOR5 0x20000000
-#define EX_CREATE_AFFINITY_SHIFT 24
-
-/*
- * Thread notification. The routine gets Creating 1 when the thread starts
- * and 0 when it ends. Routines of higher Priority run first. The kernel
- * owns ListEntry while the record is registered.
- */
-struct _EX_THREAD_REGISTRATION;
-
-typedef VOID (*PEX_THREAD_NOTIFICATION_ROUTINE)(
- struct _EX_THREAD_REGISTRATION *Registration,
- PKTHREAD Thread,
- BOOLEAN Creating
-);
-
-typedef struct _EX_THREAD_REGISTRATION {
- PEX_THREAD_NOTIFICATION_ROUTINE NotificationRoutine;
- LONG Priority;
- LIST_ENTRY ListEntry;
-} EX_THREAD_REGISTRATION, *PEX_THREAD_REGISTRATION;
-
-C_ASSERT(sizeof(EX_THREAD_REGISTRATION) == 16);
-C_ASSERT(__builtin_offsetof(EX_THREAD_REGISTRATION, ListEntry) == 8);
-
-/* Title termination notification, laid out as EX_THREAD_REGISTRATION. */
-struct _EX_TITLE_TERMINATE_REGISTRATION;
-
-typedef VOID (*PEX_TITLE_TERMINATE_ROUTINE)(struct _EX_TITLE_TERMINATE_REGISTRATION *Registration);
-
-typedef struct _EX_TITLE_TERMINATE_REGISTRATION {
- PEX_TITLE_TERMINATE_ROUTINE NotificationRoutine;
- LONG Priority;
- LIST_ENTRY ListEntry;
-} EX_TITLE_TERMINATE_REGISTRATION, *PEX_TITLE_TERMINATE_REGISTRATION;
-
-C_ASSERT(sizeof(EX_TITLE_TERMINATE_REGISTRATION) == 16);
-C_ASSERT(__builtin_offsetof(EX_TITLE_TERMINATE_REGISTRATION, ListEntry) == 8);
-
-/*
- * Categories of the configuration settings. Setting 0 of a category is the
- * whole category record.
- */
-#define XCONFIG_STATIC_CATEGORY 0
-#define XCONFIG_STATISTIC_CATEGORY 1
-#define XCONFIG_SECURED_CATEGORY 2
-#define XCONFIG_USER_CATEGORY 3
-#define XCONFIG_XNET_MACHINE_ACCOUNT_CATEGORY 4
-#define XCONFIG_XNET_PARAMETERS_CATEGORY 5
-#define XCONFIG_MEDIA_CENTER_CATEGORY 6
-#define XCONFIG_CONSOLE_CATEGORY 7
-#define XCONFIG_DVD_CATEGORY 8
-#define XCONFIG_IPTV_CATEGORY 9
-#define XCONFIG_SYSTEM_CATEGORY 10
-
-/* Settings of XCONFIG_SECURED_CATEGORY. */
-#define XCONFIG_SECURED_GAME_REGION 3
-#define XCONFIG_SECURED_SYSTEM_FLAGS 6
-
-/* Settings of XCONFIG_USER_CATEGORY. */
-#define XCONFIG_USER_RETAIL_FLAGS 12
-
-/* Services of ExDebugMonitorService. */
-#define ExDmRegisterDebugMonitor 0
-#define ExDmGetDebugMonitorData 1
-#define ExDmEnableProfiling 2
-#define ExDmGetHvStatistics 3
-#define ExDmGetCdRomEmulationRoutines 4
-#define ExDmGetCdRomSenseData 5
-#define ExDmGetPreDebugRoutine 6
-#define ExDmSetDvdEmulationMode 7
-#define ExDmQueryDevkitStatistics 8
-
-/* Sizes of ExLoadedImageName and ExLoadedCommandLine. */
-#define EX_LOADED_IMAGE_NAME_SIZE 256
-#define EX_LOADED_COMMAND_LINE_SIZE 512
-
-struct _EXCEPTION_RECORD;
-struct _CONTEXT;
-
-/** Writes a crash dump for an exception record and context. */
-XBOXKRNL_IMPORT(0x006) NTSTATUS DumpWriteDump(
- struct _EXCEPTION_RECORD *ExceptionRecord,
- struct _CONTEXT *ContextRecord,
- ULONG Flags
-);
-
-/**
- * Allocates NumberOfBytes of pool memory with a four-character tag.
- * Returns the address or NULL.
- */
-XBOXKRNL_IMPORT(0x00A) PVOID ExAllocatePoolWithTag(SIZE_T NumberOfBytes, ULONG Tag);
-
-/**
- * Allocates pool memory of type PoolType with a four-character tag.
- * Returns the address or NULL.
- */
-XBOXKRNL_IMPORT(0x00B) PVOID ExAllocatePoolTypeWithTag(SIZE_T NumberOfBytes, ULONG Tag, POOL_TYPE PoolType);
-
-/**
- * Console game region. The dashboard 2.0.6717 compares the first 16 bits
- * with 0x0101 to select Japanese video mode names.
- */
-XBOXKRNL_IMPORT(0x00C) extern PUSHORT __imp_ExConsoleGameRegion;
-#define ExConsoleGameRegion (*__imp_ExConsoleGameRegion)
-
-/**
- * Creates a thread. With SystemRoutine NULL the thread enters StartRoutine
- * with StartContext. Returning from the start routine ends the thread with
- * the returned value as its exit code, as ExTerminateThread does. Zero
- * CreationFlags start it at once. ThreadHandle receives the thread handle,
- * or the referenced thread object with EX_CREATE_FLAG_RETURN_KTHREAD.
- */
-XBOXKRNL_IMPORT(0x00D) NTSTATUS ExCreateThread(
- PHANDLE ThreadHandle,
- SIZE_T StackSize,
- PULONG ThreadId,
- PKSYSTEM_ROUTINE SystemRoutine,
- PKSTART_ROUTINE StartRoutine,
- PVOID StartContext,
- ULONG CreationFlags
-);
-
-/** Frees pool memory. */
-XBOXKRNL_IMPORT(0x00F) VOID ExFreePool(PVOID P);
-
-/**
- * Reads a configuration setting into Buffer. The setting size is stored at
- * ResultSize when not null.
- */
-XBOXKRNL_IMPORT(0x010) NTSTATUS ExGetXConfigSetting(
- USHORT Category,
- USHORT Setting,
- PVOID Buffer,
- USHORT BufferSize,
- PUSHORT ResultSize
-);
-
-/**
- * Registers a thread creation and deletion callback when Register is true
- * and removes it otherwise. Registration must stay valid while registered.
- */
-XBOXKRNL_IMPORT(0x014) VOID ExRegisterThreadNotification(PEX_THREAD_REGISTRATION Registration, BOOLEAN Register);
-
-/**
- * Registers a title termination callback when Register is true and removes
- * it otherwise. Registration must stay valid while registered.
- */
-XBOXKRNL_IMPORT(0x015) VOID ExRegisterTitleTerminateNotification(
- PEX_TITLE_TERMINATE_REGISTRATION Registration,
- BOOLEAN Register
-);
-
-/** Writes a configuration setting from Buffer. */
-XBOXKRNL_IMPORT(0x018) NTSTATUS ExSetXConfigSetting(USHORT Category, USHORT Setting, PVOID Buffer, USHORT BufferSize);
-
-/** Ends the current thread with ExitStatus without unwinding its stack. */
-XBOXKRNL_IMPORT(0x019) DECLSPEC_NORETURN VOID ExTerminateThread(NTSTATUS ExitStatus);
-
-/** Object type of thread objects. */
-XBOXKRNL_IMPORT(0x01B) extern struct _OBJECT_TYPE *__imp_ExThreadObjectType;
-#define ExThreadObjectType (*__imp_ExThreadObjectType)
-
-/** Calls a debug monitor service (ExDm*) of the kernel. */
-XBOXKRNL_IMPORT(0x1AA) NTSTATUS ExDebugMonitorService(ULONG Service, PVOID Argument1, ULONG Argument2, PVOID Argument3);
-
-/** Command line of the running executable, NUL-terminated. */
-XBOXKRNL_IMPORT(0x1AE) extern CHAR (*__imp_ExLoadedCommandLine)[EX_LOADED_COMMAND_LINE_SIZE];
-#define ExLoadedCommandLine (*__imp_ExLoadedCommandLine)
-
-/** Object path of the running executable, NUL-terminated. */
-XBOXKRNL_IMPORT(0x1AF) extern CHAR (*__imp_ExLoadedImageName)[EX_LOADED_IMAGE_NAME_SIZE];
-#define ExLoadedImageName (*__imp_ExLoadedImageName)
-
-/** Replaces a 4-byte configuration setting with (old & AndMask) | OrMask. */
-XBOXKRNL_IMPORT(0x2BC) NTSTATUS ExReadModifyWriteXConfigSettingUlong(
- USHORT Category,
- USHORT Setting,
- ULONG AndMask,
- ULONG OrMask
-);
-
-/* Largest image of ExExpansionInstall, and the multiple its size must be. */
-#define EX_EXPANSION_MAX_SIZE 0x10000
-#define EX_EXPANSION_SIZE_ALIGNMENT 128
-
-/**
- * Hands a signed expansion image to the hypervisor, which verifies and
- * installs it. Fails with STATUS_INVALID_PARAMETER when ImageSize is above
- * EX_EXPANSION_MAX_SIZE or not a multiple of EX_EXPANSION_SIZE_ALIGNMENT,
- * and with STATUS_UNSUCCESSFUL when the hypervisor refuses the image.
- *
- * The kernel passes MmGetPhysicalAddress(ImageBase) to the hypervisor
- * without copying. The image must be physically contiguous, start on a
- * multiple of 0x80 and stay within one 64 KiB physical block; a physical
- * address below 0x40000 or above the top of memory halts the console. The
- * hypervisor moves the buffer into integrity-protected memory and zeroes
- * it afterwards. A buffer that covers only part of its pages halts the
- * stock 16547 hypervisor, so pass a whole 64 KiB block with the image at
- * its start and ImageSize EX_EXPANSION_MAX_SIZE: memory from
- * MmAllocatePhysicalMemoryEx with MEM_LARGE_PAGES, a lowest address of
- * 0x40000 and a 64 KiB alignment. The hypervisor reads the image size
- * from the image header.
- */
-XBOXKRNL_IMPORT(0x30B) NTSTATUS ExExpansionInstall(PVOID ImageBase, ULONG ImageSize);
-
-/**
- * Calls the installed kernel expansion ExpansionId with four arguments and
- * returns its status. Fails with STATUS_NOT_IMPLEMENTED when no expansion
- * of that id is installed. The meaning of the arguments is the
- * expansion's.
- */
-XBOXKRNL_IMPORT(0x30C) NTSTATUS ExExpansionCall(
- ULONG ExpansionId,
- ULONG_PTR Argument1,
- ULONG_PTR Argument2,
- ULONG_PTR Argument3,
- ULONG_PTR Argument4
-);
-
-/** Sets an event to not signaled. */
-XBOXKRNL_IMPORT(0x0CE) NTSTATUS NtClearEvent(HANDLE EventHandle);
-
-/** Closes a handle. */
-XBOXKRNL_IMPORT(0x0CF) NTSTATUS NtClose(HANDLE Handle);
-
-/** Creates an event. */
-XBOXKRNL_IMPORT(0x0D1) NTSTATUS NtCreateEvent(
- PHANDLE EventHandle,
- POBJECT_ATTRIBUTES ObjectAttributes,
- EVENT_TYPE EventType,
- BOOLEAN InitialState
-);
-
-/** Creates a semaphore with a count and limit. */
-XBOXKRNL_IMPORT(0x0D5) NTSTATUS NtCreateSemaphore(
- PHANDLE SemaphoreHandle,
- POBJECT_ATTRIBUTES ObjectAttributes,
- LONG InitialCount,
- LONG MaximumCount
-);
-
-/** Releases a semaphore. The previous count is stored at PreviousCount when not null. */
-XBOXKRNL_IMPORT(0x0F3) NTSTATUS NtReleaseSemaphore(HANDLE SemaphoreHandle, LONG ReleaseCount, PLONG PreviousCount);
-
-/** Sets an event to signaled. The previous state is stored at PreviousState when not null. */
-XBOXKRNL_IMPORT(0x0F6) NTSTATUS NtSetEvent(HANDLE EventHandle, PLONG PreviousState);
-
-/** Sets the system time as a FILETIME. The previous time is stored at PreviousTime when not null. */
-XBOXKRNL_IMPORT(0x0F9) NTSTATUS NtSetSystemTime(PLARGE_INTEGER SystemTime, PLARGE_INTEGER PreviousTime);
-
-/** Waits on a handle. A null Timeout waits without limit. */
-XBOXKRNL_IMPORT(0x0FD) NTSTATUS NtWaitForSingleObjectEx(
- HANDLE Handle,
- KPROCESSOR_MODE WaitMode,
- BOOLEAN Alertable,
- PLARGE_INTEGER Timeout
-);
-
-/** Waits on several handles. */
-XBOXKRNL_IMPORT(0x0FE) NTSTATUS NtWaitForMultipleObjectsEx(
- ULONG Count,
- const HANDLE *Handles,
- WAIT_TYPE WaitType,
- KPROCESSOR_MODE WaitMode,
- BOOLEAN Alertable,
- PLARGE_INTEGER Timeout
-);
-
-/** Yields the remainder of the time slice of the current thread. */
-XBOXKRNL_IMPORT(0x101) NTSTATUS NtYieldExecution(VOID);
-
-XBOX360_EXTERN_C_END
-
-#endif
diff --git a/platform/xex/sdk/include/xbox360/xboxkrnl/hal.h b/platform/xex/sdk/include/xbox360/xboxkrnl/hal.h
deleted file mode 100644
index 74bf50a..0000000
--- a/platform/xex/sdk/include/xbox360/xboxkrnl/hal.h
+++ /dev/null
@@ -1,351 +0,0 @@
-/*
- * Hardware abstraction layer: the system management controller (SMC),
- * firmware reentry, console hardware information and kernel version.
- */
-
-#ifndef XBOX360_XBOXKRNL_HAL_H
-#define XBOX360_XBOXKRNL_HAL_H
-
-#include <xbox360/xboxkrnl/ntdef.h>
-
-XBOX360_EXTERN_C_START
-
-/*
- * A request to the SMC and its reply are 16 bytes; byte 0 is the command.
- * Commands below 0x80 are queries: the reply repeats the command in byte 0
- * and reply byte n + 1 is Data[n]. Commands from 0x80 on get no reply, so
- * HalSendSMCMessage takes a null Reply for them. The SMC does not answer
- * a query it does not know, and HalSendSMCMessage with a Reply then waits
- * for good on a retail kernel.
- *
- * The names and layouts follow SMC firmware 510301; the SMC firmware
- * differs between consoles. Query SMC_COMMAND_QUERY_VERSION for the build.
- */
-#define SMC_MESSAGE_LENGTH 16
-
-/* SMC commands and message kinds (byte 0 of an SMC_MESSAGE). */
-#define SMC_COMMAND_QUERY_POWER_UP_CAUSE 0x01 /* reply SMC_POWER_UP_CAUSE_REPLY */
-#define SMC_COMMAND_QUERY_TEMPERATURES 0x07 /* reply SMC_TEMPERATURES_REPLY */
-#define SMC_COMMAND_I2C 0x11
-#define SMC_COMMAND_QUERY_VERSION 0x12 /* reply SMC_VERSION_REPLY */
-#define SMC_COMMAND_QUERY_IR_ADDRESS 0x16 /* low nibble of reply byte 1 */
-#define SMC_COMMAND_TRAY_STATE 0x83 /* byte 1 is 0x60 plus the state */
-#define SMC_COMMAND_SET_FAN_ALGORITHM 0x88 /* SMC_FAN_ALGORITHM_REQUEST */
-#define SMC_COMMAND_SET_FAN_SPEED 0x89 /* SMC_FAN_SPEED_REQUEST */
-#define SMC_COMMAND_SET_POWER_LED 0x8C /* SMC_POWER_LED_REQUEST */
-#define SMC_COMMAND_SET_FAN2_SPEED 0x94 /* SMC_FAN_SPEED_REQUEST; some SMC builds only */
-#define SMC_COMMAND_SET_IR_ADDRESS 0x95 /* low nibble of byte 1 */
-#define SMC_COMMAND_SET_RING_OF_LIGHT 0x99 /* SMC_RING_OF_LIGHT_REQUEST */
-
-/* Bus address of the EEPROM that holds the debug monitor settings. */
-#define SMC_I2C_SETTINGS_EEPROM 0xD4
-
-typedef struct _SMC_MESSAGE {
- UCHAR Command;
- UCHAR Data[SMC_MESSAGE_LENGTH - 1];
-} SMC_MESSAGE, *PSMC_MESSAGE;
-
-C_ASSERT(sizeof(SMC_MESSAGE) == 16);
-
-/*
- * Reply of SMC_COMMAND_QUERY_POWER_UP_CAUSE. The values of Cause are not
- * established.
- */
-typedef struct _SMC_POWER_UP_CAUSE_REPLY {
- UCHAR Command;
- UCHAR Cause;
- UCHAR Reserved1;
- UCHAR BootAttempts;
- UCHAR Status; /* SMC_POWER_UP_STATUS_* */
- UCHAR Reserved2[11];
-} SMC_POWER_UP_CAUSE_REPLY, *PSMC_POWER_UP_CAUSE_REPLY;
-
-C_ASSERT(sizeof(SMC_POWER_UP_CAUSE_REPLY) == 16);
-
-/* SMC_POWER_UP_CAUSE_REPLY.Status: the SMC configuration block is invalid. */
-#define SMC_POWER_UP_STATUS_CONFIG_INVALID 0x01
-
-/*
- * A temperature of SMC_TEMPERATURES_REPLY: 8.8 fixed point degrees,
- * fraction byte first. Degrees Celsius is inferred from the kernel's log.
- */
-typedef struct _SMC_TEMPERATURE {
- UCHAR Fraction; /* 1/256 degrees */
- UCHAR Degrees;
-} SMC_TEMPERATURE, *PSMC_TEMPERATURE;
-
-C_ASSERT(sizeof(SMC_TEMPERATURE) == 2);
-
-/*
- * Reply of SMC_COMMAND_QUERY_TEMPERATURES. Only EdramTemperature has a
- * known source; the devices Temperature0, Temperature1 and Temperature3
- * measure are not established. FanSpeed is the requested speed in
- * percent, not the measured duty.
- */
-typedef struct _SMC_TEMPERATURES_REPLY {
- UCHAR Command;
- SMC_TEMPERATURE Temperature0;
- SMC_TEMPERATURE Temperature1;
- SMC_TEMPERATURE EdramTemperature;
- SMC_TEMPERATURE Temperature3;
- UCHAR FanSpeed;
- UCHAR Reserved[6];
-} SMC_TEMPERATURES_REPLY, *PSMC_TEMPERATURES_REPLY;
-
-C_ASSERT(sizeof(SMC_TEMPERATURES_REPLY) == 16);
-C_ASSERT(__builtin_offsetof(SMC_TEMPERATURES_REPLY, EdramTemperature) == 5);
-C_ASSERT(__builtin_offsetof(SMC_TEMPERATURES_REPLY, FanSpeed) == 9);
-
-/*
- * Reply of SMC_COMMAND_QUERY_VERSION. Version holds the firmware build as
- * hex digits: 51 03 01 is build 510301. BootCause0 and BootCause1 are the
- * bytes the host last set with SMC command 0x9c; the kernel reads the boot
- * cause from BootCause1 bits 7-4. PowerButtonPresses counts power button
- * presses. Layout of SMC 510301.
- */
-typedef struct _SMC_VERSION_REPLY {
- UCHAR Command;
- UCHAR Version[3];
- UCHAR BootCause0;
- UCHAR BootCause1;
- UCHAR PowerButtonPresses;
- UCHAR Reserved[9];
-} SMC_VERSION_REPLY, *PSMC_VERSION_REPLY;
-
-C_ASSERT(sizeof(SMC_VERSION_REPLY) == 16);
-C_ASSERT(__builtin_offsetof(SMC_VERSION_REPLY, BootCause0) == 4);
-C_ASSERT(__builtin_offsetof(SMC_VERSION_REPLY, PowerButtonPresses) == 6);
-
-/*
- * Request of SMC_COMMAND_SET_FAN_ALGORITHM. SMC_FAN_ALGORITHM_FULL_SPEED
- * is dangerous: the SMC keeps it until power-down and stops polling the
- * temperature sensors meanwhile, so it reports a sensor timeout and shuts
- * the console down.
- */
-typedef struct _SMC_FAN_ALGORITHM_REQUEST {
- UCHAR Command;
- UCHAR Algorithm; /* SMC_FAN_ALGORITHM_* */
- UCHAR Reserved[14];
-} SMC_FAN_ALGORITHM_REQUEST, *PSMC_FAN_ALGORITHM_REQUEST;
-
-C_ASSERT(sizeof(SMC_FAN_ALGORITHM_REQUEST) == 16);
-
-#define SMC_FAN_ALGORITHM_QUIET 0x01
-#define SMC_FAN_ALGORITHM_FULL_SPEED 0x02
-
-/*
- * Request of SMC_COMMAND_SET_FAN_SPEED and SMC_COMMAND_SET_FAN2_SPEED.
- * Speed with SMC_FAN_SPEED_FIXED set selects a fixed duty of
- * Speed & SMC_FAN_SPEED_PERCENT_MASK percent, at most 100; with it clear,
- * the SMC controls the fan. SMC_COMMAND_SET_FAN2_SPEED drives a second fan
- * output and exists only in some SMC builds (21010d has it, 510301
- * ignores it). The setting lasts until the console restarts.
- */
-typedef struct _SMC_FAN_SPEED_REQUEST {
- UCHAR Command;
- UCHAR Speed;
- UCHAR Reserved[14];
-} SMC_FAN_SPEED_REQUEST, *PSMC_FAN_SPEED_REQUEST;
-
-C_ASSERT(sizeof(SMC_FAN_SPEED_REQUEST) == 16);
-
-#define SMC_FAN_SPEED_AUTOMATIC 0x00
-#define SMC_FAN_SPEED_FIXED 0x80
-#define SMC_FAN_SPEED_PERCENT_MASK 0x7F
-#define SMC_FAN_SPEED_MAX_PERCENT 100
-
-/*
- * Request of SMC_COMMAND_SET_POWER_LED. Mode SMC_POWER_LED_AUTOMATIC
- * returns the LED to the SMC, with Option bit 0 as a one-shot request
- * whose effect is not established. Modes SMC_POWER_LED_PATTERN_FIRST to
- * SMC_POWER_LED_PATTERN_LAST select a pattern of the SMC's table, whose
- * looks are not established. The SMC ignores other modes.
- */
-typedef struct _SMC_POWER_LED_REQUEST {
- UCHAR Command;
- UCHAR Mode;
- UCHAR Option;
- UCHAR Reserved[13];
-} SMC_POWER_LED_REQUEST, *PSMC_POWER_LED_REQUEST;
-
-C_ASSERT(sizeof(SMC_POWER_LED_REQUEST) == 16);
-
-#define SMC_POWER_LED_AUTOMATIC 1
-#define SMC_POWER_LED_OPTION_ONE_SHOT 0x01
-#define SMC_POWER_LED_PATTERN_FIRST 2
-#define SMC_POWER_LED_PATTERN_LAST 9
-
-/*
- * Request of SMC_COMMAND_SET_RING_OF_LIGHT. With SMC_RING_OF_LIGHT_OVERRIDE
- * in Flags, the high nibble of Quadrants turns the four ring quadrants on
- * (bit set) or off; which bit lights which physical quadrant is not
- * established. Without it, control returns to the system. Keep the low
- * nibble of Quadrants zero: SMC build 21010d also reads it. The ring has
- * no colour or brightness control, and the setting lasts until the
- * console restarts.
- */
-typedef struct _SMC_RING_OF_LIGHT_REQUEST {
- UCHAR Command;
- UCHAR Flags;
- UCHAR Quadrants;
- UCHAR Reserved[13];
-} SMC_RING_OF_LIGHT_REQUEST, *PSMC_RING_OF_LIGHT_REQUEST;
-
-C_ASSERT(sizeof(SMC_RING_OF_LIGHT_REQUEST) == 16);
-
-#define SMC_RING_OF_LIGHT_OVERRIDE 0x01
-#define SMC_RING_OF_LIGHT_QUADRANT_SHIFT 4
-#define SMC_RING_OF_LIGHT_QUADRANT_MASK 0xF0
-
-struct _HAL_SMC_REGISTRATION;
-
-/* SMC notification routine; it runs at dispatch level. */
-typedef VOID (*PHAL_SMC_NOTIFICATION)(struct _HAL_SMC_REGISTRATION *Registration, PSMC_MESSAGE Message);
-
-/*
- * Registration of an SMC notification routine. Routines of higher
- * Priority run first. The kernel owns ListEntry while it is registered.
- */
-typedef struct _HAL_SMC_REGISTRATION {
- PHAL_SMC_NOTIFICATION NotificationRoutine;
- LONG Priority;
- LIST_ENTRY ListEntry;
-} HAL_SMC_REGISTRATION, *PHAL_SMC_REGISTRATION;
-
-C_ASSERT(sizeof(HAL_SMC_REGISTRATION) == 16);
-C_ASSERT(__builtin_offsetof(HAL_SMC_REGISTRATION, ListEntry) == 8);
-
-/* Routine of HalReturnToFirmware. */
-typedef enum _FIRMWARE_REENTRY {
- HalHaltRoutine = 0,
- HalRebootRoutine = 1,
- HalKdRebootRoutine = 2,
- HalReserved3Routine = 3,
- HalFatalErrorRebootRoutine = 4, /* reset through the SMC */
- HalPowerDownRoutine = 5,
- HalRebootQuiesceRoutine = 6, /* restarts the system software */
- HalForcedPowerDownRoutine = 7,
- HalForcedRebootQuiesceRoutine = 8,
-} FIRMWARE_REENTRY;
-
-/*
- * XBOX_HARDWARE_INFO.Flags. The top four bits hold the hardware generation.
- * DEVKIT_KERNEL is set by the static initializer of development kit
- * kernels (15574, 16547) and clear in retail kernels (17559). No kernel
- * sets TEST_KIT; XBDM reports a test kit when it is set.
- */
-#define XBOX_HW_FLAG_GENERATION_DETECTED 0x00000004 /* VdDetectSystemType set the generation */
-#define XBOX_HW_FLAG_HOST_BRIDGE_EBEB 0x00000008
-#define XBOX_HW_FLAG_DEVKIT_KERNEL 0x00000010
-#define XBOX_HW_FLAG_HDD 0x00000020
-#define XBOX_HW_FLAG_KERNEL_DEBUGGER_ENABLED 0x00000080 /* enabled at boot */
-#define XBOX_HW_FLAG_KERNEL_DEBUGGER_ATTACHED 0x00000100
-#define XBOX_HW_FLAG_LARGE_MEMORY 0x00010000 /* 1 GB of memory */
-#define XBOX_HW_FLAG_MMC_FLASH 0x00020000
-#define XBOX_HW_FLAG_TEST_KIT 0x02000000
-
-/*
- * Hardware generation (motherboard), Flags >> XBOX_HW_GENERATION_SHIFT,
- * as XBDM names it. Other values have no known name.
- */
-#define XBOX_HW_GENERATION_SHIFT 28
-#define XBOX_HW_GENERATION_XENON 0
-#define XBOX_HW_GENERATION_ZEPHYR 1
-#define XBOX_HW_GENERATION_FALCON 2
-#define XBOX_HW_GENERATION_JASPER 3
-#define XBOX_HW_GENERATION_TRINITY 4
-#define XBOX_HW_GENERATION_CORONA 5
-#define XBOX_HW_GENERATION_WINCHESTER 6
-#define XBOX_HW_GENERATION_RIDGEWAY 8
-
-/* Platform, Flags & XBOX_HW_PLATFORM_MASK, as XBDM names it. */
-#define XBOX_HW_PLATFORM_MASK 0x00000003
-#define XBOX_HW_PLATFORM_ALPHA 0
-#define XBOX_HW_PLATFORM_MONGREL 1
-#define XBOX_HW_PLATFORM_SHIVA 2
-#define XBOX_HW_PLATFORM_WATERNOOSE 3
-
-/*
- * XBOX_HARDWARE_INFO.BootFlags, which the boot loaders and the hypervisor
- * set and pass to the kernel. SB and SD are the second and fourth stage
- * boot loaders. Bit 0x0800 is tested by SB and has no known meaning.
- */
-#define XBOX_BOOT_FLAG_UNBOUND_BOOT_LOADER 0x0001 /* SB console binding is zero; SMC check skipped */
-#define XBOX_BOOT_FLAG_LOCK_FUSES_BLOWN 0x0002 /* fuse row 0 bits 0-55 nonzero */
-#define XBOX_BOOT_FLAG_CONSOLE_TYPE_MATCH 0x0004 /* fuse row 1 equals the SB console type */
-#define XBOX_BOOT_FLAG_FUSE_VERSION_MATCH 0x0008 /* fuse row 2 count equals the SB version */
-#define XBOX_BOOT_FLAG_CONSOLE_KEY_VALID 0x0010 /* fuse rows 3-6 hold a valid console key */
-#define XBOX_BOOT_FLAG_DEVKIT_MEMORY 0x0080 /* memory above 512 MB */
-#define XBOX_BOOT_FLAG_KD_LITE_ONLY 0x0100 /* kernel debugger lite only; setter unknown */
-#define XBOX_BOOT_FLAG_SHADOW_BOOTED 0x0200 /* started by a shadow boot */
-#define XBOX_BOOT_FLAG_CDROM_SYSTEM_ROOT 0x0400 /* shadow boot from CD-ROM; \SystemRoot is the CD-ROM */
-#define XBOX_BOOT_FLAG_FLASH_PATCH1 0x1000 /* SD loaded the first flash patch slot */
-#define XBOX_BOOT_FLAG_FLASH_PATCH2 0x2000 /* SD loaded the second flash patch slot */
-#define XBOX_BOOT_FLAG_UPDATE_SEQUENCE_PENDING 0x4000 /* the patch requests the next update sequence */
-#define XBOX_BOOT_FLAG_UPDATE_SEQUENCE_PROGRAMMED 0x8000 /* the update sequence fuses hold it */
-
-/* Console hardware description. The debug monitor changes Flags at run time. */
-typedef struct _XBOX_HARDWARE_INFO {
- ULONG Flags;
- UCHAR NumberOfProcessors;
- UCHAR Revision;
- UCHAR Reserved1[6];
- USHORT BootLoaderData;
- USHORT BootFlags;
-} XBOX_HARDWARE_INFO, *PXBOX_HARDWARE_INFO;
-
-C_ASSERT(sizeof(XBOX_HARDWARE_INFO) == 0x10);
-C_ASSERT(__builtin_offsetof(XBOX_HARDWARE_INFO, BootFlags) == 0xE);
-
-typedef struct _XBOX_KRNL_VERSION {
- USHORT Major;
- USHORT Minor;
- USHORT Build;
- USHORT Qfe;
-} XBOX_KRNL_VERSION, *PXBOX_KRNL_VERSION;
-
-C_ASSERT(sizeof(XBOX_KRNL_VERSION) == 8);
-
-/** Returns the AV pack value the hardware reports. */
-XBOXKRNL_IMPORT(0x022) ULONG HalGetCurrentAVPack(VOID);
-
-/** Opens or closes the optical drive tray. */
-XBOXKRNL_IMPORT(0x024) VOID HalOpenCloseODDTray(ULONG Open);
-
-/**
- * Registers a system management controller event callback when Register
- * is true and removes it otherwise. Registration must stay valid while
- * registered.
- */
-XBOXKRNL_IMPORT(0x027) VOID HalRegisterSMCNotification(PHAL_SMC_REGISTRATION Registration, BOOLEAN Register);
-
-/**
- * Restarts or shuts down the console. Stock XBDM code continues after the
- * call, so it is not declared to diverge.
- */
-XBOXKRNL_IMPORT(0x028) VOID HalReturnToFirmware(FIRMWARE_REENTRY Routine);
-
-/**
- * Sends a 16-byte message to the system management controller and
- * receives the 16-byte reply.
- */
-XBOXKRNL_IMPORT(0x029) VOID HalSendSMCMessage(PSMC_MESSAGE Request, PSMC_MESSAGE Reply);
-
-/** True while the power-down deferred procedure call runs. */
-XBOXKRNL_IMPORT(0x267) ULONG HalIsExecutingPowerDownDpc(VOID);
-
-/** Console hardware information. */
-XBOXKRNL_IMPORT(0x156) extern PXBOX_HARDWARE_INFO __imp_XboxHardwareInfo;
-#define XboxHardwareInfo (*__imp_XboxHardwareInfo)
-
-/** Version of the base kernel. */
-XBOXKRNL_IMPORT(0x157) extern PXBOX_KRNL_VERSION __imp_XboxKrnlBaseVersion;
-#define XboxKrnlBaseVersion (*__imp_XboxKrnlBaseVersion)
-
-/** Version of the running kernel. */
-XBOXKRNL_IMPORT(0x158) extern PXBOX_KRNL_VERSION __imp_XboxKrnlVersion;
-#define XboxKrnlVersion (*__imp_XboxKrnlVersion)
-
-XBOX360_EXTERN_C_END
-
-#endif
diff --git a/platform/xex/sdk/include/xbox360/xboxkrnl/io.h b/platform/xex/sdk/include/xbox360/xboxkrnl/io.h
deleted file mode 100644
index 40bc690..0000000
--- a/platform/xex/sdk/include/xbox360/xboxkrnl/io.h
+++ /dev/null
@@ -1,815 +0,0 @@
-#ifndef XBOX360_XBOXKRNL_IO_H
-#define XBOX360_XBOXKRNL_IO_H
-
-#include <xbox360/xboxkrnl/ntdef.h>
-
-XBOX360_EXTERN_C_START
-
-/* ------------------------------------------------------------------------- */
-/* File access, share, attribute and create constants */
-/* ------------------------------------------------------------------------- */
-
-/* FILE_SHARE_*: what other opens of a file may do. */
-#define FILE_SHARE_READ 0x00000001
-#define FILE_SHARE_WRITE 0x00000002
-#define FILE_SHARE_DELETE 0x00000004
-
-/* FILE_ATTRIBUTE_*. */
-#define FILE_ATTRIBUTE_READONLY 0x00000001
-#define FILE_ATTRIBUTE_HIDDEN 0x00000002
-#define FILE_ATTRIBUTE_SYSTEM 0x00000004
-#define FILE_ATTRIBUTE_DIRECTORY 0x00000010
-#define FILE_ATTRIBUTE_ARCHIVE 0x00000020
-#define FILE_ATTRIBUTE_DEVICE 0x00000040
-#define FILE_ATTRIBUTE_NORMAL 0x00000080
-#define FILE_ATTRIBUTE_TEMPORARY 0x00000100
-#define FILE_ATTRIBUTE_COMPRESSED 0x00000800
-#define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
-
-/* Create disposition of NtCreateFile: what to do when the file exists or does not. */
-typedef enum _CREATE_DISPOSITION {
- /* Replace the file if it exists, create it otherwise. */
- FILE_SUPERSEDE = 0,
- /* Open the file; fail if it does not exist. */
- FILE_OPEN = 1,
- /* Create the file; fail if it exists. */
- FILE_CREATE = 2,
- /* Open the file, or create it if it does not exist. */
- FILE_OPEN_IF = 3,
- /* Open and truncate the file; fail if it does not exist. */
- FILE_OVERWRITE = 4,
- /* Open and truncate the file, or create it if it does not exist. */
- FILE_OVERWRITE_IF = 5
-} CREATE_DISPOSITION;
-
-/* IoStatusBlock->Information of a successful create. */
-#define FILE_SUPERSEDED 0x00000000
-#define FILE_OPENED 0x00000001
-#define FILE_CREATED 0x00000002
-#define FILE_OVERWRITTEN 0x00000003
-#define FILE_EXISTS 0x00000004
-#define FILE_DOES_NOT_EXIST 0x00000005
-
-/* Create options of NtCreateFile and open options of NtOpenFile. */
-#define FILE_DIRECTORY_FILE 0x00000001
-#define FILE_WRITE_THROUGH 0x00000002
-#define FILE_SEQUENTIAL_ONLY 0x00000004
-#define FILE_NO_INTERMEDIATE_BUFFERING 0x00000008
-#define FILE_SYNCHRONOUS_IO_ALERT 0x00000010
-#define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020
-#define FILE_NON_DIRECTORY_FILE 0x00000040
-#define FILE_RANDOM_ACCESS 0x00000800
-#define FILE_DELETE_ON_CLOSE 0x00001000
-#define FILE_OPEN_BY_FILE_ID 0x00002000
-#define FILE_OPEN_FOR_BACKUP_INTENT 0x00004000
-
-/* ByteOffset values of NtReadFile and NtWriteFile (LowPart, HighPart -1). */
-#define FILE_WRITE_TO_END_OF_FILE 0xffffffff
-#define FILE_USE_FILE_POINTER_POSITION 0xfffffffe
-
-/* File system flags of FILE_FS_ATTRIBUTE_INFORMATION.FileSystemAttributes. */
-#define FILE_CASE_SENSITIVE_SEARCH 0x00000001
-#define FILE_CASE_PRESERVED_NAMES 0x00000002
-#define FILE_UNICODE_ON_DISK 0x00000004
-#define FILE_PERSISTENT_ACLS 0x00000008
-#define FILE_FILE_COMPRESSION 0x00000010
-#define FILE_VOLUME_IS_COMPRESSED 0x00008000
-#define FILE_READ_ONLY_VOLUME 0x00080000
-
-/* ------------------------------------------------------------------------- */
-/* File information */
-/* ------------------------------------------------------------------------- */
-
-/* Classes of NtQueryInformationFile and NtSetInformationFile (Xenia's values). */
-typedef enum _FILE_INFORMATION_CLASS {
- FileDirectoryInformation = 1,
- FileFullDirectoryInformation = 2,
- FileBothDirectoryInformation = 3,
- FileBasicInformation = 4,
- FileStandardInformation = 5,
- FileInternalInformation = 6,
- FileEaInformation = 7,
- FileAccessInformation = 8,
- FileNameInformation = 9,
- FileRenameInformation = 10,
- FileLinkInformation = 11,
- FileNamesInformation = 12,
- FileDispositionInformation = 13,
- FilePositionInformation = 14,
- FileFullEaInformation = 15,
- FileModeInformation = 16,
- FileAlignmentInformation = 17,
- FileAllInformation = 18,
- FileAllocationInformation = 19,
- FileEndOfFileInformation = 20,
- FileAlternateNameInformation = 21,
- FileStreamInformation = 22,
- /* Mounts a file of the volume as a partition device. */
- FileMountPartitionInformation = 23,
- FileMountPartitionsInformation = 24,
- FilePipeRemoteInformation = 25,
- FileSectorInformation = 26,
- FileXctdCompressionInformation = 27,
- FileCompressionInformation = 28,
- FileObjectIdInformation = 29,
- FileCompletionInformation = 30,
- FileMoveClusterInformation = 31,
- FileIoPriorityInformation = 32,
- FileReparsePointInformation = 33,
- FileNetworkOpenInformation = 34,
- FileAttributeTagInformation = 35,
- FileTrackingInformation = 36,
- FileMaximumInformation = 37
-} FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS;
-
-/* Classes of NtQueryVolumeInformationFile. */
-typedef enum _FS_INFORMATION_CLASS {
- FileFsVolumeInformation = 1,
- FileFsLabelInformation = 2,
- FileFsSizeInformation = 3,
- FileFsDeviceInformation = 4,
- FileFsAttributeInformation = 5,
- FileFsControlInformation = 6,
- FileFsFullSizeInformation = 7,
- FileFsObjectIdInformation = 8,
- FileFsMaximumInformation = 9
-} FS_INFORMATION_CLASS, *PFS_INFORMATION_CLASS;
-
-/*
- * Result of NtQueryFullAttributesFile and of NtQueryInformationFile with
- * FileNetworkOpenInformation. Times are FILETIMEs.
- */
-typedef struct _FILE_NETWORK_OPEN_INFORMATION {
- LARGE_INTEGER CreationTime;
- LARGE_INTEGER LastAccessTime;
- LARGE_INTEGER LastWriteTime;
- LARGE_INTEGER ChangeTime;
- LARGE_INTEGER AllocationSize;
- /* File size in bytes. */
- LARGE_INTEGER EndOfFile;
- ULONG FileAttributes;
- ULONG Reserved;
-} FILE_NETWORK_OPEN_INFORMATION, *PFILE_NETWORK_OPEN_INFORMATION;
-
-C_ASSERT(__builtin_offsetof(FILE_NETWORK_OPEN_INFORMATION, EndOfFile) == 0x28);
-C_ASSERT(__builtin_offsetof(FILE_NETWORK_OPEN_INFORMATION, FileAttributes) == 0x30);
-C_ASSERT(sizeof(FILE_NETWORK_OPEN_INFORMATION) == 0x38);
-
-/*
- * An entry of NtQueryDirectoryFile. The name, FileNameLength bytes, follows
- * at 0x40. Times are FILETIMEs.
- */
-typedef struct _FILE_DIRECTORY_INFORMATION {
- /* Offset of the next entry, or 0 for the last one. */
- ULONG NextEntryOffset;
- ULONG FileIndex;
- LARGE_INTEGER CreationTime;
- LARGE_INTEGER LastAccessTime;
- LARGE_INTEGER LastWriteTime;
- LARGE_INTEGER ChangeTime;
- /* File size in bytes. */
- LARGE_INTEGER EndOfFile;
- LARGE_INTEGER AllocationSize;
- ULONG FileAttributes;
- ULONG FileNameLength;
- CHAR FileName[];
-} FILE_DIRECTORY_INFORMATION, *PFILE_DIRECTORY_INFORMATION;
-
-C_ASSERT(__builtin_offsetof(FILE_DIRECTORY_INFORMATION, CreationTime) == 0x08);
-C_ASSERT(__builtin_offsetof(FILE_DIRECTORY_INFORMATION, EndOfFile) == 0x28);
-C_ASSERT(__builtin_offsetof(FILE_DIRECTORY_INFORMATION, FileAttributes) == 0x38);
-C_ASSERT(__builtin_offsetof(FILE_DIRECTORY_INFORMATION, FileNameLength) == 0x3c);
-C_ASSERT(__builtin_offsetof(FILE_DIRECTORY_INFORMATION, FileName) == 0x40);
-C_ASSERT(sizeof(FILE_DIRECTORY_INFORMATION) == 0x40);
-
-/* Information of FileBasicInformation. Times are FILETIMEs. */
-typedef struct _FILE_BASIC_INFORMATION {
- LARGE_INTEGER CreationTime;
- LARGE_INTEGER LastAccessTime;
- LARGE_INTEGER LastWriteTime;
- LARGE_INTEGER ChangeTime;
- ULONG FileAttributes;
- ULONG Reserved;
-} FILE_BASIC_INFORMATION, *PFILE_BASIC_INFORMATION;
-
-C_ASSERT(__builtin_offsetof(FILE_BASIC_INFORMATION, FileAttributes) == 0x20);
-C_ASSERT(sizeof(FILE_BASIC_INFORMATION) == 0x28);
-
-/* Information of FileDispositionInformation. */
-typedef struct _FILE_DISPOSITION_INFORMATION {
- /* Delete the file when its last handle is closed. */
- BOOLEAN DeleteFile;
-} FILE_DISPOSITION_INFORMATION, *PFILE_DISPOSITION_INFORMATION;
-
-C_ASSERT(sizeof(FILE_DISPOSITION_INFORMATION) == 1);
-
-/* Information of FilePositionInformation. */
-typedef struct _FILE_POSITION_INFORMATION {
- LARGE_INTEGER CurrentByteOffset;
-} FILE_POSITION_INFORMATION, *PFILE_POSITION_INFORMATION;
-
-C_ASSERT(sizeof(FILE_POSITION_INFORMATION) == 8);
-
-/* Information of FileEndOfFileInformation. */
-typedef struct _FILE_END_OF_FILE_INFORMATION {
- LARGE_INTEGER EndOfFile;
-} FILE_END_OF_FILE_INFORMATION, *PFILE_END_OF_FILE_INFORMATION;
-
-C_ASSERT(sizeof(FILE_END_OF_FILE_INFORMATION) == 8);
-
-/* Information of FileRenameInformation. */
-typedef struct _FILE_RENAME_INFORMATION {
- BOOLEAN ReplaceIfExists;
- /* Directory the name is relative to, or NULL. */
- HANDLE RootDirectory;
- OBJECT_STRING FileName;
-} FILE_RENAME_INFORMATION, *PFILE_RENAME_INFORMATION;
-
-C_ASSERT(__builtin_offsetof(FILE_RENAME_INFORMATION, RootDirectory) == 0x04);
-C_ASSERT(__builtin_offsetof(FILE_RENAME_INFORMATION, FileName) == 0x08);
-C_ASSERT(sizeof(FILE_RENAME_INFORMATION) == 0x10);
-
-/* Information of FileFsSizeInformation. */
-typedef struct _FILE_FS_SIZE_INFORMATION {
- LARGE_INTEGER TotalAllocationUnits;
- LARGE_INTEGER AvailableAllocationUnits;
- ULONG SectorsPerAllocationUnit;
- ULONG BytesPerSector;
-} FILE_FS_SIZE_INFORMATION, *PFILE_FS_SIZE_INFORMATION;
-
-C_ASSERT(sizeof(FILE_FS_SIZE_INFORMATION) == 0x18);
-
-/* Information of FileFsDeviceInformation. */
-typedef struct _FILE_FS_DEVICE_INFORMATION {
- /* A FILE_DEVICE_* value. */
- ULONG DeviceType;
- ULONG Characteristics;
-} FILE_FS_DEVICE_INFORMATION, *PFILE_FS_DEVICE_INFORMATION;
-
-C_ASSERT(sizeof(FILE_FS_DEVICE_INFORMATION) == 8);
-
-/*
- * Information of FileFsAttributeInformation. The file system name,
- * FileSystemNameLength bytes, follows at 0xc.
- */
-typedef struct _FILE_FS_ATTRIBUTE_INFORMATION {
- /* FILE_* file system flags. */
- ULONG FileSystemAttributes;
- LONG MaximumComponentNameLength;
- ULONG FileSystemNameLength;
- CHAR FileSystemName[];
-} FILE_FS_ATTRIBUTE_INFORMATION, *PFILE_FS_ATTRIBUTE_INFORMATION;
-
-C_ASSERT(__builtin_offsetof(FILE_FS_ATTRIBUTE_INFORMATION, FileSystemName) == 0xc);
-C_ASSERT(sizeof(FILE_FS_ATTRIBUTE_INFORMATION) == 0xc);
-
-/* Element of the segment array of NtReadFileScatter and NtWriteFileGather: a page address. */
-typedef PVOID FILE_SEGMENT_ELEMENT, *PFILE_SEGMENT_ELEMENT;
-
-/* ------------------------------------------------------------------------- */
-/* Devices and device control */
-/* ------------------------------------------------------------------------- */
-
-/* FILE_DEVICE_*: the type of a device. */
-#define FILE_DEVICE_CD_ROM 0x02
-#define FILE_DEVICE_CD_ROM_FILE_SYSTEM 0x03
-#define FILE_DEVICE_CONTROLLER 0x04
-#define FILE_DEVICE_DISK 0x07
-#define FILE_DEVICE_DISK_FILE_SYSTEM 0x08
-#define FILE_DEVICE_FILE_SYSTEM 0x09
-#define FILE_DEVICE_NETWORK_FILE_SYSTEM 0x14
-#define FILE_DEVICE_MASS_STORAGE 0x2d
-#define FILE_DEVICE_FLASH 0x3c
-#define FILE_DEVICE_STFS 0x3d
-#define FILE_DEVICE_SVOD 0x40
-#define FILE_DEVICE_MMC_FLASH 0x48
-#define FILE_DEVICE_MMC_FLASH_PARTITION 0x49
-
-/* Device control codes: device type, required access, function and buffering method. */
-#define CTL_CODE(DeviceType, Function, Method, Access) \
- (((ULONG)(DeviceType) << 16) | ((ULONG)(Access) << 14) | ((ULONG)(Function) << 2) | \
- (ULONG)(Method))
-
-#define METHOD_BUFFERED 0
-#define METHOD_IN_DIRECT 1
-#define METHOD_OUT_DIRECT 2
-#define METHOD_NEITHER 3
-
-#define FILE_ANY_ACCESS 0
-#define FILE_READ_ACCESS 0x0001
-#define FILE_WRITE_ACCESS 0x0002
-
-/* The sector count and the sector size: a DISK_GEOMETRY. */
-#define IOCTL_DISK_GET_DRIVE_GEOMETRY \
- CTL_CODE(FILE_DEVICE_DISK, 0, METHOD_BUFFERED, FILE_ANY_ACCESS)
-/* The start offset and the length in bytes: a PARTITION_INFORMATION. */
-#define IOCTL_DISK_GET_PARTITION_INFO \
- CTL_CODE(FILE_DEVICE_DISK, 1, METHOD_BUFFERED, FILE_READ_ACCESS)
-/* A SCSI command described by a SCSI_PASS_THROUGH_DIRECT input. */
-#define IOCTL_SCSI_PASS_THROUGH_DIRECT 0x0004D014
-/* The 0x14-byte flash geometry; words 0 and 2 multiply to the write unit of the device. */
-#define IOCTL_FLASH_GEOMETRY 0x003C0028
-/* The authentication state of the optical drive. */
-#define IOCTL_ODD_AUTH_STATE 0x000240CC
-
-/* Output of IOCTL_DISK_GET_DRIVE_GEOMETRY. */
-typedef struct _DISK_GEOMETRY {
- ULONG Sectors;
- ULONG BytesPerSector;
-} DISK_GEOMETRY, *PDISK_GEOMETRY;
-
-C_ASSERT(sizeof(DISK_GEOMETRY) == 8);
-
-/* Output of IOCTL_DISK_GET_PARTITION_INFO. */
-typedef struct _PARTITION_INFORMATION {
- /* Byte offset of the partition on the disk. */
- LARGE_INTEGER StartingOffset;
- /* Length of the partition in bytes. */
- LARGE_INTEGER PartitionLength;
-} PARTITION_INFORMATION, *PPARTITION_INFORMATION;
-
-C_ASSERT(sizeof(PARTITION_INFORMATION) == 0x10);
-
-/*
- * Input of IOCTL_SCSI_PASS_THROUGH_DIRECT. The device transfers data
- * directly to or from DataBuffer.
- */
-typedef struct _SCSI_PASS_THROUGH_DIRECT {
- /* Size of the structure in bytes. */
- USHORT Length;
- UCHAR Reserved02[5];
- /* Meaning unknown. */
- UCHAR Unknown07;
- /* Bytes to transfer. */
- ULONG DataTransferLength;
- ULONG Reserved0C;
- /* Address of the transfer buffer. */
- PVOID DataBuffer;
- /* Command descriptor block. */
- UCHAR Cdb[16];
-} SCSI_PASS_THROUGH_DIRECT, *PSCSI_PASS_THROUGH_DIRECT;
-
-C_ASSERT(__builtin_offsetof(SCSI_PASS_THROUGH_DIRECT, Unknown07) == 0x07);
-C_ASSERT(__builtin_offsetof(SCSI_PASS_THROUGH_DIRECT, DataTransferLength) == 0x08);
-C_ASSERT(__builtin_offsetof(SCSI_PASS_THROUGH_DIRECT, DataBuffer) == 0x10);
-C_ASSERT(__builtin_offsetof(SCSI_PASS_THROUGH_DIRECT, Cdb) == 0x14);
-C_ASSERT(sizeof(SCSI_PASS_THROUGH_DIRECT) == 0x24);
-
-/* The standard data of a SCSI INQUIRY command. */
-typedef struct _SCSI_INQUIRY_DATA {
- /* Peripheral qualifier and device type. */
- UCHAR DeviceType;
- /* Bit 7: removable medium. */
- UCHAR Removable;
- UCHAR Version;
- /* Response data format in the low four bits. */
- UCHAR ResponseFormat;
- /* Bytes that follow this one. */
- UCHAR AdditionalLength;
- UCHAR Flags[3];
- /* ASCII vendor identification. */
- CHAR VendorId[8];
- /* ASCII product identification. */
- CHAR ProductId[16];
- /* ASCII product revision level. */
- CHAR ProductRevision[4];
-} SCSI_INQUIRY_DATA, *PSCSI_INQUIRY_DATA;
-
-C_ASSERT(__builtin_offsetof(SCSI_INQUIRY_DATA, VendorId) == 0x08);
-C_ASSERT(__builtin_offsetof(SCSI_INQUIRY_DATA, ProductId) == 0x10);
-C_ASSERT(__builtin_offsetof(SCSI_INQUIRY_DATA, ProductRevision) == 0x20);
-C_ASSERT(sizeof(SCSI_INQUIRY_DATA) == 0x24);
-
-/* ------------------------------------------------------------------------- */
-/* I/O request packets, devices and drivers */
-/* ------------------------------------------------------------------------- */
-
-/* IRP_MJ_*: the major function of an I/O request. */
-#define IRP_MJ_CREATE 0x00
-#define IRP_MJ_CLOSE 0x01
-#define IRP_MJ_READ 0x02
-#define IRP_MJ_WRITE 0x03
-#define IRP_MJ_QUERY_INFORMATION 0x04
-#define IRP_MJ_SET_INFORMATION 0x05
-#define IRP_MJ_FLUSH_BUFFERS 0x06
-#define IRP_MJ_QUERY_VOLUME_INFORMATION 0x07
-#define IRP_MJ_DIRECTORY_CONTROL 0x08
-#define IRP_MJ_DEVICE_CONTROL 0x09
-#define IRP_MJ_CLEANUP 0x0a
-#define IRP_MJ_MAXIMUM_FUNCTION 0x0a
-
-/* Flags of IO_STACK_LOCATION. */
-/* The buffer of a read or write is the transfer address, not an offset into Irp->UserBuffer. */
-#define SL_FSCACHE_REQUEST 0x01
-
-/* SL_* control bits of IO_STACK_LOCATION. */
-#define SL_PENDING_RETURNED 0x01
-#define SL_INVOKE_ON_CANCEL 0x20
-#define SL_INVOKE_ON_SUCCESS 0x40
-#define SL_INVOKE_ON_ERROR 0x80
-
-/* DO_* flags of DEVICE_OBJECT. */
-#define DO_DIRECT_IO 0x00000004
-#define DO_DEVICE_HAS_NAME 0x00000008
-/* Set at creation. The driver clears it once the device is ready. */
-#define DO_DEVICE_INITIALIZING 0x00000010
-
-/* Priority boosts of IoCompleteRequest. */
-#define IO_NO_INCREMENT 0
-#define IO_CD_ROM_INCREMENT 1
-#define IO_DISK_INCREMENT 1
-
-struct _DEVICE_OBJECT;
-struct _IRP;
-
-typedef NTSTATUS (*PIO_COMPLETION_ROUTINE)(
- struct _DEVICE_OBJECT *DeviceObject,
- struct _IRP *Irp,
- PVOID Context);
-
-/*
- * The part of a request for one driver. The locations of a request are
- * contiguous; the next driver's location is the one before the current one.
- * The parameters are 4-byte aligned: ByteOffset is at offset 12.
- */
-#pragma pack(push, 4)
-typedef struct _IO_STACK_LOCATION {
- /* An IRP_MJ_* value. */
- UCHAR MajorFunction;
- UCHAR MinorFunction;
- UCHAR Flags;
- UCHAR Control;
- union {
- struct {
- ULONG Length;
- union {
- /* Offset into Irp->UserBuffer, without SL_FSCACHE_REQUEST. */
- ULONG BufferOffset;
- /* With SL_FSCACHE_REQUEST. */
- PVOID CacheBuffer;
- };
- LARGE_INTEGER ByteOffset;
- } Read;
- struct {
- ULONG Length;
- union {
- ULONG BufferOffset;
- PVOID CacheBuffer;
- };
- LARGE_INTEGER ByteOffset;
- } Write;
- struct {
- ULONG OutputBufferLength;
- PVOID InputBuffer;
- ULONG InputBufferLength;
- ULONG IoControlCode;
- } DeviceIoControl;
- struct {
- ULONG Length;
- FILE_INFORMATION_CLASS FileInformationClass;
- } QueryFile;
- struct {
- ULONG Length;
- FS_INFORMATION_CLASS FsInformationClass;
- } QueryVolume;
- struct {
- PVOID Argument1;
- PVOID Argument2;
- PVOID Argument3;
- PVOID Argument4;
- } Others;
- } Parameters;
- struct _DEVICE_OBJECT *DeviceObject;
- struct _FILE_OBJECT *FileObject;
- PIO_COMPLETION_ROUTINE CompletionRoutine;
- PVOID Context;
-} IO_STACK_LOCATION, *PIO_STACK_LOCATION;
-#pragma pack(pop)
-
-C_ASSERT(__builtin_offsetof(IO_STACK_LOCATION, Control) == 3);
-C_ASSERT(__builtin_offsetof(IO_STACK_LOCATION, Parameters) == 4);
-C_ASSERT(__builtin_offsetof(IO_STACK_LOCATION, Parameters.Read.ByteOffset) == 12);
-C_ASSERT(__builtin_offsetof(IO_STACK_LOCATION, DeviceObject) == 0x14);
-C_ASSERT(__builtin_offsetof(IO_STACK_LOCATION, CompletionRoutine) == 0x1c);
-C_ASSERT(__builtin_offsetof(IO_STACK_LOCATION, Context) == 0x20);
-C_ASSERT(sizeof(IO_STACK_LOCATION) == 0x24);
-
-/* An I/O request packet. The kernel allocates it with its stack locations. */
-typedef struct _IRP {
- SHORT Type;
- USHORT Size;
- ULONG Flags;
- LIST_ENTRY ThreadListEntry;
- IO_STATUS_BLOCK IoStatus;
- CHAR StackCount;
- /* Index of the current stack location. */
- CHAR CurrentLocation;
- BOOLEAN PendingReturned;
- BOOLEAN Cancel;
- PVOID UserBuffer;
- PIO_STATUS_BLOCK UserIosb;
- PKEVENT UserEvent;
- union {
- struct {
- PIO_APC_ROUTINE UserApcRoutine;
- PVOID UserApcContext;
- } AsynchronousParameters;
- LARGE_INTEGER AllocationSize;
- } Overlay;
- union {
- struct {
- /* KDEVICE_QUEUE_ENTRY (ke.h), or the key of an I/O completion packet. */
- ULONG DeviceQueueEntry[4];
- /* Length of the buffer locked by IoLockUserBuffer. */
- ULONG LockedBufferLength;
- struct _ETHREAD *Thread;
- LIST_ENTRY ListEntry;
- PIO_STACK_LOCATION CurrentStackLocation;
- struct _FILE_OBJECT *OriginalFileObject;
- } Overlay;
- /* KAPC (ke.h). */
- ULONG Apc[10];
- } Tail;
- /* Called with the cancel spin lock held; it releases the lock. */
- VOID (*CancelRoutine)(struct _DEVICE_OBJECT *DeviceObject, struct _IRP *Irp);
- ULONG Reserved1;
-} IRP, *PIRP;
-
-C_ASSERT(__builtin_offsetof(IRP, IoStatus) == 0x10);
-C_ASSERT(__builtin_offsetof(IRP, CurrentLocation) == 0x19);
-C_ASSERT(__builtin_offsetof(IRP, UserBuffer) == 0x1c);
-C_ASSERT(__builtin_offsetof(IRP, UserIosb) == 0x20);
-C_ASSERT(__builtin_offsetof(IRP, Overlay) == 0x28);
-C_ASSERT(__builtin_offsetof(IRP, Tail.Overlay.LockedBufferLength) == 0x40);
-C_ASSERT(__builtin_offsetof(IRP, Tail.Overlay.CurrentStackLocation) == 0x50);
-C_ASSERT(__builtin_offsetof(IRP, Tail.Overlay.OriginalFileObject) == 0x54);
-C_ASSERT(sizeof(IRP) == 0x60);
-
-/* A driver routine for a request. */
-typedef NTSTATUS (*PDRIVER_DISPATCH)(struct _DEVICE_OBJECT *DeviceObject, PIRP Irp);
-/* The start I/O routine of a driver. */
-typedef VOID (*PDRIVER_STARTIO)(struct _DEVICE_OBJECT *DeviceObject, PIRP Irp);
-typedef VOID (*PDRIVER_DELETEDEVICE)(struct _DEVICE_OBJECT *DeviceObject);
-typedef NTSTATUS (*PDRIVER_DISMOUNTVOLUME)(struct _DEVICE_OBJECT *DeviceObject);
-
-/* The routines of a driver. */
-typedef struct _DRIVER_OBJECT {
- PDRIVER_STARTIO DriverStartIo;
- PDRIVER_DELETEDEVICE DriverDeleteDevice;
- PDRIVER_DISMOUNTVOLUME DriverDismountVolume;
- /* The routine of each IRP_MJ_* function. */
- PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION + 1];
-} DRIVER_OBJECT, *PDRIVER_OBJECT;
-
-C_ASSERT(__builtin_offsetof(DRIVER_OBJECT, MajorFunction) == 0xc);
-C_ASSERT(sizeof(DRIVER_OBJECT) == 0x38);
-
-/* A device object. The kernel allocates it and its extension. */
-typedef struct _DEVICE_OBJECT {
- SHORT Type;
- USHORT Size;
- LONG ReferenceCount;
- PDRIVER_OBJECT DriverObject;
- /* File system device mounted on this device, or the device itself. */
- struct _DEVICE_OBJECT *MountedOrSelfDevice;
- PIRP CurrentIrp;
- /* DO_* flags. */
- ULONG Flags;
- PVOID DeviceExtension;
- UCHAR DeviceType;
- UCHAR StartIoFlags;
- /* Stack locations a request to the device needs. */
- CHAR StackSize;
- BOOLEAN DeletePending;
- ULONG SectorSize;
- /* Mask of the address bits a transfer buffer must have clear. */
- ULONG AlignmentRequirement;
- /* KDEVICE_QUEUE (ke.h). */
- ULONG DeviceQueue[4];
- KEVENT DeviceLock;
- ULONG StartIoCount;
- ULONG StartIoKey;
-} DEVICE_OBJECT, *PDEVICE_OBJECT;
-
-C_ASSERT(__builtin_offsetof(DEVICE_OBJECT, DriverObject) == 8);
-C_ASSERT(__builtin_offsetof(DEVICE_OBJECT, CurrentIrp) == 0x10);
-C_ASSERT(__builtin_offsetof(DEVICE_OBJECT, Flags) == 0x14);
-C_ASSERT(__builtin_offsetof(DEVICE_OBJECT, DeviceExtension) == 0x18);
-C_ASSERT(__builtin_offsetof(DEVICE_OBJECT, StackSize) == 0x1e);
-C_ASSERT(__builtin_offsetof(DEVICE_OBJECT, AlignmentRequirement) == 0x24);
-C_ASSERT(__builtin_offsetof(DEVICE_OBJECT, DeviceQueue) == 0x28);
-C_ASSERT(__builtin_offsetof(DEVICE_OBJECT, DeviceLock) == 0x38);
-C_ASSERT(sizeof(DEVICE_OBJECT) == 0x50);
-
-/* ------------------------------------------------------------------------- */
-/* File system cache */
-/* ------------------------------------------------------------------------- */
-
-/** Returns the element count of a file system cache. ProcessType is a KPROCESS_TYPE value. */
-XBOXKRNL_IMPORT(0x020) ULONG FscGetCacheElementCount(ULONG ProcessType);
-
-/** Sets the element count of a file system cache. ProcessType is a KPROCESS_TYPE value. */
-XBOXKRNL_IMPORT(0x021) NTSTATUS FscSetCacheElementCount(ULONG ProcessType, ULONG ElementCount);
-
-/* ------------------------------------------------------------------------- */
-/* I/O manager */
-/* ------------------------------------------------------------------------- */
-
-/** Acquires the device object lock. Returns the IRQL that IoReleaseDeviceObjectLock restores. */
-XBOXKRNL_IMPORT(0x02E) KIRQL IoAcquireDeviceObjectLock(VOID);
-
-/** Allocates an I/O request packet with StackSize stack locations. Returns it or NULL. */
-XBOXKRNL_IMPORT(0x02F) PIRP IoAllocateIrp(CHAR StackSize);
-
-/** Completes an I/O request packet. */
-XBOXKRNL_IMPORT(0x035) VOID IoCompleteRequest(PIRP Irp, CHAR PriorityBoost);
-
-/** Creates a device object for a driver. The device object address is stored at DeviceObject. */
-XBOXKRNL_IMPORT(0x037) NTSTATUS IoCreateDevice(
- PDRIVER_OBJECT DriverObject,
- ULONG DeviceExtensionSize,
- POBJECT_STRING DeviceName,
- ULONG DeviceType,
- ULONG Attributes,
- PDEVICE_OBJECT *DeviceObject);
-
-/** Object type of device objects. */
-XBOXKRNL_IMPORT(0x03A) extern struct _OBJECT_TYPE *__imp_IoDeviceObjectType;
-#define IoDeviceObjectType (*__imp_IoDeviceObjectType)
-
-/** Dismounts the file system volume on a device object. */
-XBOXKRNL_IMPORT(0x03B) NTSTATUS IoDismountVolume(PDEVICE_OBJECT DeviceObject);
-
-/** Dismounts the file system volume that an open file belongs to. */
-XBOXKRNL_IMPORT(0x03C) NTSTATUS IoDismountVolumeByFileHandle(HANDLE FileHandle);
-
-/** Completes an I/O request packet with an invalid device request status. */
-XBOXKRNL_IMPORT(0x041) NTSTATUS IoInvalidDeviceRequest(PDEVICE_OBJECT DeviceObject, PIRP Irp);
-
-/** Releases the device object lock and restores OldIrql. */
-XBOXKRNL_IMPORT(0x044) VOID IoReleaseDeviceObjectLock(KIRQL OldIrql);
-
-/** Starts the next queued I/O request packet of a device. */
-XBOXKRNL_IMPORT(0x048) VOID IoStartNextPacket(PDEVICE_OBJECT DeviceObject);
-
-/** Starts or queues an I/O request packet on a device. */
-XBOXKRNL_IMPORT(0x04A) VOID IoStartPacket(PDEVICE_OBJECT DeviceObject, PIRP Irp, PULONG Key);
-
-/** Sends a device I/O control request to a device object and waits for it. */
-XBOXKRNL_IMPORT(0x04B) NTSTATUS IoSynchronousDeviceIoControlRequest(
- ULONG IoControlCode,
- PDEVICE_OBJECT DeviceObject,
- PVOID InputBuffer,
- ULONG InputBufferLength,
- PVOID OutputBuffer,
- ULONG OutputBufferLength,
- PULONG ReturnedOutputBufferLength);
-
-/** Sends a read or write request (an IRP_MJ_* value) to a device object and waits for it. */
-XBOXKRNL_IMPORT(0x04C) NTSTATUS IoSynchronousFsdRequest(
- ULONG MajorFunction,
- PDEVICE_OBJECT DeviceObject,
- PVOID Buffer,
- ULONG Length,
- PLARGE_INTEGER StartingOffset);
-
-/* ------------------------------------------------------------------------- */
-/* File system calls */
-/* ------------------------------------------------------------------------- */
-
-/** Creates or opens a file. */
-XBOXKRNL_IMPORT(0x0D2) NTSTATUS NtCreateFile(
- PHANDLE FileHandle,
- ACCESS_MASK DesiredAccess,
- POBJECT_ATTRIBUTES ObjectAttributes,
- PIO_STATUS_BLOCK IoStatusBlock,
- PLARGE_INTEGER AllocationSize,
- ULONG FileAttributes,
- ULONG ShareAccess,
- CREATE_DISPOSITION CreateDisposition,
- ULONG CreateOptions);
-
-/** Deletes a file. */
-XBOXKRNL_IMPORT(0x0D8) NTSTATUS NtDeleteFile(POBJECT_ATTRIBUTES ObjectAttributes);
-
-/** Sends a device I/O control request through a file handle. */
-XBOXKRNL_IMPORT(0x0D9) NTSTATUS NtDeviceIoControlFile(
- HANDLE FileHandle,
- HANDLE Event,
- PIO_APC_ROUTINE ApcRoutine,
- PVOID ApcContext,
- PIO_STATUS_BLOCK IoStatusBlock,
- ULONG IoControlCode,
- PVOID InputBuffer,
- ULONG InputBufferLength,
- PVOID OutputBuffer,
- ULONG OutputBufferLength);
-
-/** Writes buffered data of a file to the device. */
-XBOXKRNL_IMPORT(0x0DB) NTSTATUS NtFlushBuffersFile(
- HANDLE FileHandle,
- PIO_STATUS_BLOCK IoStatusBlock);
-
-/** Opens a file. */
-XBOXKRNL_IMPORT(0x0DF) NTSTATUS NtOpenFile(
- PHANDLE FileHandle,
- ACCESS_MASK DesiredAccess,
- POBJECT_ATTRIBUTES ObjectAttributes,
- PIO_STATUS_BLOCK IoStatusBlock,
- ULONG ShareAccess,
- ULONG OpenOptions);
-
-/** Reads directory entries. FileName is an optional wildcard pattern. */
-XBOXKRNL_IMPORT(0x0E4) NTSTATUS NtQueryDirectoryFile(
- HANDLE FileHandle,
- HANDLE Event,
- PIO_APC_ROUTINE ApcRoutine,
- PVOID ApcContext,
- PIO_STATUS_BLOCK IoStatusBlock,
- PVOID FileInformation,
- ULONG Length,
- POBJECT_STRING FileName,
- BOOLEAN RestartScan);
-
-/** Reads the network open information of a file by name. */
-XBOXKRNL_IMPORT(0x0E7) NTSTATUS NtQueryFullAttributesFile(
- POBJECT_ATTRIBUTES ObjectAttributes,
- PFILE_NETWORK_OPEN_INFORMATION FileInformation);
-
-/** Reads information of class FileInformationClass about an open file. */
-XBOXKRNL_IMPORT(0x0E8) NTSTATUS NtQueryInformationFile(
- HANDLE FileHandle,
- PIO_STATUS_BLOCK IoStatusBlock,
- PVOID FileInformation,
- ULONG Length,
- FILE_INFORMATION_CLASS FileInformationClass);
-
-/** Reads information of class FsInformationClass about a volume. */
-XBOXKRNL_IMPORT(0x0EF) NTSTATUS NtQueryVolumeInformationFile(
- HANDLE FileHandle,
- PIO_STATUS_BLOCK IoStatusBlock,
- PVOID FsInformation,
- ULONG Length,
- FS_INFORMATION_CLASS FsInformationClass);
-
-/**
- * Reads from a file. A NULL ByteOffset reads at the current position. A NULL
- * Event signals the file handle.
- */
-XBOXKRNL_IMPORT(0x0F0) NTSTATUS NtReadFile(
- HANDLE FileHandle,
- HANDLE Event,
- PIO_APC_ROUTINE ApcRoutine,
- PVOID ApcContext,
- PIO_STATUS_BLOCK IoStatusBlock,
- PVOID Buffer,
- ULONG Length,
- PLARGE_INTEGER ByteOffset);
-
-/** Reads from a file into a list of page-sized segments. */
-XBOXKRNL_IMPORT(0x0F1) NTSTATUS NtReadFileScatter(
- HANDLE FileHandle,
- HANDLE Event,
- PIO_APC_ROUTINE ApcRoutine,
- PVOID ApcContext,
- PIO_STATUS_BLOCK IoStatusBlock,
- PFILE_SEGMENT_ELEMENT SegmentArray,
- ULONG Length,
- PLARGE_INTEGER ByteOffset);
-
-/** Writes information of class FileInformationClass about an open file. */
-XBOXKRNL_IMPORT(0x0F7) NTSTATUS NtSetInformationFile(
- HANDLE FileHandle,
- PIO_STATUS_BLOCK IoStatusBlock,
- PVOID FileInformation,
- ULONG Length,
- FILE_INFORMATION_CLASS FileInformationClass);
-
-/**
- * Writes to a file. A NULL ByteOffset writes at the current position. A NULL
- * Event signals the file handle.
- */
-XBOXKRNL_IMPORT(0x0FF) NTSTATUS NtWriteFile(
- HANDLE FileHandle,
- HANDLE Event,
- PIO_APC_ROUTINE ApcRoutine,
- PVOID ApcContext,
- PIO_STATUS_BLOCK IoStatusBlock,
- PVOID Buffer,
- ULONG Length,
- PLARGE_INTEGER ByteOffset);
-
-/** Writes to a file from a list of page-sized segments. */
-XBOXKRNL_IMPORT(0x100) NTSTATUS NtWriteFileGather(
- HANDLE FileHandle,
- HANDLE Event,
- PIO_APC_ROUTINE ApcRoutine,
- PVOID ApcContext,
- PIO_STATUS_BLOCK IoStatusBlock,
- PFILE_SEGMENT_ELEMENT SegmentArray,
- ULONG Length,
- PLARGE_INTEGER ByteOffset);
-
-XBOX360_EXTERN_C_END
-
-#endif
diff --git a/platform/xex/sdk/include/xbox360/xboxkrnl/ke.h b/platform/xex/sdk/include/xbox360/xboxkrnl/ke.h
deleted file mode 100644
index d7618f0..0000000
--- a/platform/xex/sdk/include/xbox360/xboxkrnl/ke.h
+++ /dev/null
@@ -1,518 +0,0 @@
-/*
- * Kernel executive (Ke): dispatcher objects (semaphores, timers, DPCs),
- * spin locks, interrupt levels, waits, threads and processor registers.
- */
-
-#ifndef XBOX360_XBOXKRNL_KE_H
-#define XBOX360_XBOXKRNL_KE_H
-
-#include <xbox360/base.h>
-#include <xbox360/xboxkrnl/ntdef.h>
-
-XBOX360_EXTERN_C_START
-
-/* Interrupt request levels. */
-#define PASSIVE_LEVEL 0
-#define APC_LEVEL 1
-#define DISPATCH_LEVEL 2
-
-/* KeSetEvent priority increment for the waiters an event releases. */
-#define EVENT_INCREMENT 1
-
-/* Bug check codes; codes not named here are module-specific. */
-#define KMODE_EXCEPTION_NOT_HANDLED 0x0000001E
-
-/* KeTlsAlloc result when no index is free. */
-#define TLS_OUT_OF_INDEXES 0xFFFFFFFF
-
-/* A set of hardware threads; bit n is hardware thread n. */
-typedef ULONG KAFFINITY, *PKAFFINITY;
-
-/* Spin lock: one word, 0 when free. */
-typedef ULONG_PTR KSPIN_LOCK, *PKSPIN_LOCK;
-
-/* Process type of a thread, as KeGetCurrentProcessType reports it. */
-typedef enum _KPROCESS_TYPE {
- PROCESS_TYPE_IDLE = 0,
- /* The title process. */
- PROCESS_TYPE_TITLE = 1,
- PROCESS_TYPE_SYSTEM = 2,
-} KPROCESS_TYPE;
-
-typedef enum _TIMER_TYPE {
- /* Stays signaled until set again and releases every waiter. */
- NotificationTimer = 0,
- /* Releases one waiter and resets itself. */
- SynchronizationTimer = 1,
-} TIMER_TYPE;
-
-/* How a wait on several objects ends. */
-typedef enum _WAIT_TYPE {
- /* When every object is signaled. */
- WaitAll = 0,
- /* When any object is signaled; the status is STATUS_WAIT_0 plus its index. */
- WaitAny = 1,
-} WAIT_TYPE;
-
-/* Why a thread waits. */
-typedef enum _KWAIT_REASON {
- Executive = 0,
- DelayExecution = 1,
- Suspended = 2,
- UserRequest = 3,
- WrQueue = 4,
- WrFsCacheIn = 5,
- WrFsCacheOut = 6,
- WrExecutive = 7,
- WrCriticalSection = 8,
-} KWAIT_REASON;
-
-typedef struct _KSEMAPHORE {
- DISPATCHER_HEADER Header;
- LONG Limit;
-} KSEMAPHORE, *PKSEMAPHORE;
-
-C_ASSERT(sizeof(KSEMAPHORE) == 0x14);
-
-struct _KDPC;
-
-/* Routine of a deferred procedure call. */
-typedef VOID (*PKDEFERRED_ROUTINE)(
- struct _KDPC *Dpc,
- PVOID DeferredContext,
- PVOID SystemArgument1,
- PVOID SystemArgument2);
-
-/*
- * Deferred procedure call. InsertedNumber is the hardware thread whose
- * queue holds the DPC plus one, 0 when not queued. TargetNumber is the
- * hardware thread that runs it plus one, 0 for the one that queues it;
- * KeInitializeDpc clears it, so set it afterwards.
- */
-typedef struct _KDPC {
- SHORT Type;
- UCHAR InsertedNumber;
- UCHAR TargetNumber;
- LIST_ENTRY DpcListEntry;
- PKDEFERRED_ROUTINE DeferredRoutine;
- PVOID DeferredContext;
- PVOID SystemArgument1;
- PVOID SystemArgument2;
-} KDPC, *PKDPC;
-
-C_ASSERT(__builtin_offsetof(KDPC, TargetNumber) == 3);
-C_ASSERT(__builtin_offsetof(KDPC, DeferredRoutine) == 0x0C);
-C_ASSERT(sizeof(KDPC) == 0x1C);
-
-typedef struct _KTIMER {
- DISPATCHER_HEADER Header;
- ULARGE_INTEGER DueTime;
- LIST_ENTRY TimerListEntry;
- PKDPC Dpc;
- LONG Period;
-} KTIMER, *PKTIMER;
-
-C_ASSERT(__builtin_offsetof(KTIMER, DueTime) == 0x10);
-C_ASSERT(__builtin_offsetof(KTIMER, TimerListEntry) == 0x18);
-C_ASSERT(__builtin_offsetof(KTIMER, Dpc) == 0x20);
-C_ASSERT(sizeof(KTIMER) == 0x28);
-
-/* Links a waiting thread to one object of its wait. */
-typedef struct _KWAIT_BLOCK {
- LIST_ENTRY WaitListEntry;
- struct _KTHREAD *Thread;
- PVOID Object;
- struct _KWAIT_BLOCK *NextWaitBlock;
- USHORT WaitKey;
- USHORT WaitType;
-} KWAIT_BLOCK, *PKWAIT_BLOCK;
-
-C_ASSERT(__builtin_offsetof(KWAIT_BLOCK, WaitKey) == 0x14);
-C_ASSERT(sizeof(KWAIT_BLOCK) == 0x18);
-
-/* Start routine of a thread. */
-typedef VOID (*PKSTART_ROUTINE)(PVOID StartContext);
-
-/* Routine that a new thread runs first; it calls StartRoutine(StartContext). */
-typedef VOID (*PKSYSTEM_ROUTINE)(PKSTART_ROUTINE StartRoutine, PVOID StartContext);
-
-/* Routine that KeIpiGenericCall runs on every processor. */
-typedef ULONG_PTR (*PKIPI_BROADCAST_WORKER)(ULONG_PTR Argument);
-
-/*
- * Registers the kernel saves on an interrupt or exception, up to the last
- * field in use.
- */
-typedef struct _KTRAP_FRAME {
- ULONG StackFrameHeader[0x14];
- ULONGLONG Gpr[32];
- /* Exception record or interrupt state. */
- ULONG Reserved1[0x14];
- ULONGLONG Ctr;
- ULONG Lr;
- ULONG Iar;
- ULONG Cr;
- /* Low word of the saved MSR. */
- ULONG Msr;
- ULONG Xer;
- ULONG UserModeState;
-} KTRAP_FRAME, *PKTRAP_FRAME;
-
-C_ASSERT(__builtin_offsetof(KTRAP_FRAME, Gpr) == 0x50);
-C_ASSERT(__builtin_offsetof(KTRAP_FRAME, Lr) == 0x1A8);
-C_ASSERT(__builtin_offsetof(KTRAP_FRAME, Iar) == 0x1AC);
-C_ASSERT(__builtin_offsetof(KTRAP_FRAME, Msr) == 0x1B4);
-C_ASSERT(__builtin_offsetof(KTRAP_FRAME, Xer) == 0x1B8);
-C_ASSERT(sizeof(KTRAP_FRAME) == 0x1C0);
-
-/*
- * Thread object, up to the last field in use. The kernel allocates it and
- * frees it after the thread ends.
- */
-typedef struct _KTHREAD {
- /* SignalState is nonzero once the thread has ended. */
- DISPATCHER_HEADER Header;
- UCHAR Reserved1[0x48];
- /* 1 ms clock ticks that the thread ran. */
- ULONG RunTime;
- /* Highest address of the stack. */
- PVOID StackBase;
- /* Lowest address of the stack. */
- PVOID StackLimit;
- /* Frame the thread saved when it last stopped running. */
- PVOID SwitchFrame;
- /* Thread local storage block. */
- PVOID TlsData;
- UCHAR Reserved2[4];
- UCHAR Priority;
- UCHAR Reserved3;
- /* KPROCESS_TYPE of the process that owns the thread. */
- UCHAR ProcessType;
- /* KPROCESS_TYPE that KeGetCurrentProcessType reports for the thread. */
- UCHAR CurrentProcessType;
- UCHAR Reserved4[0x10];
- /* Process that owns the thread. */
- struct _KPROCESS *Process;
- UCHAR Reserved5[0x30];
- UCHAR PriorityDecrement;
- UCHAR BasePriority;
- UCHAR Reserved6;
- UCHAR Saturation;
- UCHAR SuspendCount;
- UCHAR Reserved7[2];
- /* Hardware thread the thread runs or last ran on. */
- UCHAR CurrentProcessor;
- UCHAR Reserved8[9];
- /* Priority that KeSetBasePriorityThread adds its increment to. */
- UCHAR ProcessPriority;
- /* Highest base priority that KeSetBasePriorityThread sets. */
- UCHAR PriorityLimit;
- UCHAR Reserved9[0x45];
- /* Link in the thread list of the process. */
- LIST_ENTRY ThreadListEntry;
- UCHAR Reserved10[0x18];
- /* Creation time as a FILETIME. */
- ULARGE_INTEGER CreateTime;
- UCHAR Reserved11[8];
- NTSTATUS ExitStatus;
- UCHAR Reserved12[8];
- ULONG UniqueThread;
- PVOID StartAddress;
- UCHAR Reserved13[8];
- /* Word for the debug monitor's own use. */
- ULONG DebugMonitorData;
- /* Win32 last error. */
- ULONG LastWin32ErrorCode;
- UCHAR Reserved14[8];
- /* ExCreateThread creation flags. */
- ULONG CreateOptions;
-} KTHREAD, *PKTHREAD;
-
-C_ASSERT(__builtin_offsetof(KTHREAD, RunTime) == 0x58);
-C_ASSERT(__builtin_offsetof(KTHREAD, TlsData) == 0x68);
-C_ASSERT(__builtin_offsetof(KTHREAD, Priority) == 0x70);
-C_ASSERT(__builtin_offsetof(KTHREAD, CurrentProcessType) == 0x73);
-C_ASSERT(__builtin_offsetof(KTHREAD, Process) == 0x84);
-C_ASSERT(__builtin_offsetof(KTHREAD, PriorityDecrement) == 0xB8);
-C_ASSERT(__builtin_offsetof(KTHREAD, SuspendCount) == 0xBC);
-C_ASSERT(__builtin_offsetof(KTHREAD, CurrentProcessor) == 0xBF);
-C_ASSERT(__builtin_offsetof(KTHREAD, ProcessPriority) == 0xC9);
-C_ASSERT(__builtin_offsetof(KTHREAD, PriorityLimit) == 0xCA);
-C_ASSERT(__builtin_offsetof(KTHREAD, ThreadListEntry) == 0x110);
-C_ASSERT(__builtin_offsetof(KTHREAD, CreateTime) == 0x130);
-C_ASSERT(__builtin_offsetof(KTHREAD, ExitStatus) == 0x140);
-C_ASSERT(__builtin_offsetof(KTHREAD, UniqueThread) == 0x14C);
-C_ASSERT(__builtin_offsetof(KTHREAD, StartAddress) == 0x150);
-C_ASSERT(__builtin_offsetof(KTHREAD, DebugMonitorData) == 0x15C);
-C_ASSERT(__builtin_offsetof(KTHREAD, LastWin32ErrorCode) == 0x160);
-C_ASSERT(__builtin_offsetof(KTHREAD, CreateOptions) == 0x16C);
-C_ASSERT(sizeof(KTHREAD) == 0x170);
-
-/* Process object, up to the thread list. */
-typedef struct _KPROCESS {
- /* Guards ThreadListHead. */
- KSPIN_LOCK ThreadListLock;
- /* Head of the list of KTHREAD.ThreadListEntry links. */
- LIST_ENTRY ThreadListHead;
-} KPROCESS, *PKPROCESS;
-
-C_ASSERT(__builtin_offsetof(KPROCESS, ThreadListHead) == 4);
-C_ASSERT(sizeof(KPROCESS) == 12);
-
-/* Times that the kernel updates on each clock tick. */
-typedef struct _KTIME_STAMP_BUNDLE {
- ULONGLONG InterruptTime;
- ULONGLONG SystemTime;
- /* Milliseconds since boot. */
- ULONG TickCount;
- ULONG Reserved;
-} KTIME_STAMP_BUNDLE, *PKTIME_STAMP_BUNDLE;
-
-C_ASSERT(__builtin_offsetof(KTIME_STAMP_BUNDLE, TickCount) == 0x10);
-C_ASSERT(sizeof(KTIME_STAMP_BUNDLE) == 0x18);
-
-/* Special purpose registers of KeGetSpecialPurposeRegister and KeSetSpecialPurposeRegister. */
-/* Data address breakpoint register. */
-#define SPR_DABR 0x3F5
-/* Performance monitor control: bit 1 freezes and bit 2 enables the counters. */
-#define SPR_MONITOR_CONTROL 0x3F6
-/* Performance monitor event selection. */
-#define SPR_EVENT_SELECT 0x3FA
-
-/* Performance monitor bus registers of KeGetPMWRegister and KeSetPMWRegister. */
-#define PMW_NCU0 0x480
-#define PMW_NCU1 0x580
-#define PMW_NCU2 0x680
-#define PMW_CIU 0x708
-#define PMW_BIU 0xB50
-#define PMW_L2_GROUP 0x310
-#define PMW_L2 0x318
-#define PMW_L2_ECC 0x860
-
-/* Performance monitor registers of KeSetPRVRegister; values are in the high word. */
-#define PRV_RUN 0x1C0
-#define PRV_INTERVAL_CONTROL 0x1C8
-#define PRV_TRIGGER 0x1D8
-#define PRV_INTERVAL 0x1E0
-#define PRV_INTERVAL_RELOAD 0x1E8
-/* Value and control registers of counter Counter (0 to 15). */
-#define PRV_COUNTER_VALUE(Counter) (0x200 + (Counter) * 8)
-#define PRV_COUNTER_CONTROL(Counter) (0x280 + (Counter) * 8)
-
-/** Acquires a spin lock. The caller is already at DISPATCH_LEVEL. */
-XBOXKRNL_IMPORT(0x04D) VOID KeAcquireSpinLockAtRaisedIrql(PKSPIN_LOCK SpinLock);
-
-/** Halts the system with a bug check code. */
-XBOXKRNL_IMPORT(0x052) DECLSPEC_NORETURN VOID KeBugCheck(ULONG BugCheckCode);
-
-/** Halts the system with a bug check code and four parameters. */
-XBOXKRNL_IMPORT(0x053) DECLSPEC_NORETURN VOID KeBugCheckEx(
- ULONG BugCheckCode,
- ULONG_PTR BugCheckParameter1,
- ULONG_PTR BugCheckParameter2,
- ULONG_PTR BugCheckParameter3,
- ULONG_PTR BugCheckParameter4);
-
-/** Cancels a timer. True when the timer was set. */
-XBOXKRNL_IMPORT(0x054) BOOLEAN KeCancelTimer(PKTIMER Timer);
-
-/* CONTEXT is defined in rtl.h; DEBUG_MONITOR_DATA belongs to the debug monitor service. */
-struct _CONTEXT;
-struct _DEBUG_MONITOR_DATA;
-
-/** Builds a thread context from kernel trap frames. */
-XBOXKRNL_IMPORT(0x056) VOID KeContextFromKframes(PKTRAP_FRAME TrapFrame, struct _CONTEXT *ContextRecord);
-
-/**
- * Address of the debug monitor data block that the kernel reads, or 0.
- * The debug monitor stores it. While a block is published, the kernel
- * calls the routines it names, so the block must stay valid and its
- * routine fields must hold routines of the expected form.
- */
-XBOXKRNL_IMPORT(0x059) extern struct _DEBUG_MONITOR_DATA **__imp_KeDebugMonitorData;
-#define KeDebugMonitorData (*__imp_KeDebugMonitorData)
-
-/** Suspends the current thread for Interval (100 ns units; negative is relative). */
-XBOXKRNL_IMPORT(0x05A) NTSTATUS KeDelayExecutionThread(
- KPROCESSOR_MODE WaitMode,
- BOOLEAN Alertable,
- PLARGE_INTEGER Interval);
-
-/** Enables the processor performance monitor. */
-XBOXKRNL_IMPORT(0x05E) ULONG KeEnablePPUPerformanceMonitor(VOID);
-
-/** Disables normal kernel APC delivery to the current thread. */
-XBOXKRNL_IMPORT(0x05F) VOID KeEnterCriticalRegion(VOID);
-
-/** Flushes the data cache for an address range. */
-XBOXKRNL_IMPORT(0x061) VOID KeFlushCacheRange(PVOID BaseAddress, ULONG Length);
-
-/** Returns the process type of the current thread. */
-XBOXKRNL_IMPORT(0x066) KPROCESS_TYPE KeGetCurrentProcessType(VOID);
-
-/** Reads a performance monitor register. */
-XBOXKRNL_IMPORT(0x067) ULONGLONG KeGetPMWRegister(ULONG Register);
-
-/** Reads a special purpose register. Only the low word of the result is returned. */
-XBOXKRNL_IMPORT(0x06A) ULONG KeGetSpecialPurposeRegister(ULONG Register);
-
-/** Initializes a deferred procedure call object. */
-XBOXKRNL_IMPORT(0x06F) VOID KeInitializeDpc(
- PKDPC Dpc,
- PKDEFERRED_ROUTINE DeferredRoutine,
- PVOID DeferredContext);
-
-/** Initializes an event object. */
-XBOXKRNL_IMPORT(0x070) VOID KeInitializeEvent(PKEVENT Event, EVENT_TYPE Type, BOOLEAN State);
-
-/** Initializes a semaphore object with a count and limit. */
-XBOXKRNL_IMPORT(0x074) VOID KeInitializeSemaphore(PKSEMAPHORE Semaphore, LONG Count, LONG Limit);
-
-/**
- * Initializes a timer object for processes of ProcessType. Stock XBDM
- * passes PROCESS_TYPE_SYSTEM for its capture timer.
- */
-XBOXKRNL_IMPORT(0x075) VOID KeInitializeTimerEx(PKTIMER Timer, TIMER_TYPE Type, UCHAR ProcessType);
-
-/** Queues a deferred procedure call. True when it was queued. */
-XBOXKRNL_IMPORT(0x07B) BOOLEAN KeInsertQueueDpc(
- PKDPC Dpc,
- PVOID SystemArgument1,
- PVOID SystemArgument2);
-
-/** Runs BroadcastFunction(Context) on every processor at IPI level. */
-XBOXKRNL_IMPORT(0x07C) ULONG_PTR KeIpiGenericCall(
- PKIPI_BROADCAST_WORKER BroadcastFunction,
- ULONG_PTR Context);
-
-/** Enables normal kernel APC delivery to the current thread. */
-XBOXKRNL_IMPORT(0x07D) VOID KeLeaveCriticalRegion(VOID);
-
-/** Returns the timebase frequency. */
-XBOXKRNL_IMPORT(0x083) ULONGLONG KeQueryPerformanceFrequency(VOID);
-
-/** Stores the system time as a FILETIME. */
-XBOXKRNL_IMPORT(0x084) VOID KeQuerySystemTime(PLARGE_INTEGER CurrentTime);
-
-/** Raises the IRQL to DISPATCH_LEVEL. Returns the previous IRQL. */
-XBOXKRNL_IMPORT(0x085) KIRQL KeRaiseIrqlToDpcLevel(VOID);
-
-/** Releases a semaphore object. Returns the previous count. */
-XBOXKRNL_IMPORT(0x088) LONG KeReleaseSemaphore(
- PKSEMAPHORE Semaphore,
- KPRIORITY Increment,
- LONG Adjustment,
- BOOLEAN Wait);
-
-/** Releases a spin lock without changing the IRQL. */
-XBOXKRNL_IMPORT(0x089) VOID KeReleaseSpinLockFromRaisedIrql(PKSPIN_LOCK SpinLock);
-
-/** Removes a deferred procedure call from the queue. True when it was queued. */
-XBOXKRNL_IMPORT(0x08E) BOOLEAN KeRemoveQueueDpc(PKDPC Dpc);
-
-/** Sets an event object to not signaled. Returns the previous state. */
-XBOXKRNL_IMPORT(0x08F) LONG KeResetEvent(PKEVENT Event);
-
-/** Decrements the suspend count of a thread object. Returns the previous count. */
-XBOXKRNL_IMPORT(0x092) ULONG KeResumeThread(PKTHREAD Thread);
-
-/** Sets the processor affinity of a thread. The previous affinity is stored at PreviousAffinity. */
-XBOXKRNL_IMPORT(0x097) NTSTATUS KeSetAffinityThread(
- PKTHREAD Thread,
- KAFFINITY Affinity,
- PKAFFINITY PreviousAffinity);
-
-/** Sets the base priority increment of a thread object. */
-XBOXKRNL_IMPORT(0x099) LONG KeSetBasePriorityThread(PKTHREAD Thread, LONG Increment);
-
-/**
- * Sets an event object to signaled. Returns the previous state. Increment
- * is usually EVENT_INCREMENT.
- */
-XBOXKRNL_IMPORT(0x09D) LONG KeSetEvent(PKEVENT Event, KPRIORITY Increment, BOOLEAN Wait);
-
-/** Writes a performance monitor register. The export takes the 64-bit Value in one register. */
-XBOXKRNL_IMPORT(0x09F) VOID KeSetPMWRegister(ULONG Register, ULONGLONG Value);
-
-/** Writes a performance monitor register. The export takes the 64-bit Value in one register. */
-XBOXKRNL_IMPORT(0x0A1) VOID KeSetPRVRegister(ULONG Register, ULONGLONG Value);
-
-/** Sets the priority of a thread object. Returns the previous priority. */
-XBOXKRNL_IMPORT(0x0A3) KPRIORITY KeSetPriorityThread(PKTHREAD Thread, KPRIORITY Priority);
-
-/** Writes a special purpose register. The export takes the 64-bit Value in one register. */
-XBOXKRNL_IMPORT(0x0A5) ULONG KeSetSpecialPurposeRegister(ULONG Register, ULONGLONG Value);
-
-/**
- * Sets a timer to expire at DueTime (100 ns units; negative is relative to
- * now), then every Period milliseconds when Period is not 0. Dpc is queued
- * at expiry when not NULL. True when the timer was already set.
- * DueTime is a LARGE_INTEGER passed by value, in one register.
- */
-XBOXKRNL_IMPORT(0x0A7) BOOLEAN KeSetTimerEx(PKTIMER Timer, LONGLONG DueTime, LONG Period, PKDPC Dpc);
-
-/** Busy-waits for MicroSeconds. */
-XBOXKRNL_IMPORT(0x0A8) VOID KeStallExecutionProcessor(ULONG MicroSeconds);
-
-/** Increments the suspend count of a thread object. Returns the previous count. */
-XBOXKRNL_IMPORT(0x0A9) ULONG KeSuspendThread(PKTHREAD Thread);
-
-/** Invalidates the instruction cache for an address range. */
-XBOXKRNL_IMPORT(0x0AB) VOID KeSweepIcacheRange(PVOID BaseAddress, SIZE_T Length);
-
-/** Kernel time stamp bundle. */
-XBOXKRNL_IMPORT(0x0AD) extern PKTIME_STAMP_BUNDLE __imp_KeTimeStampBundle;
-#define KeTimeStampBundle (*__imp_KeTimeStampBundle)
-
-/** Tries to acquire a spin lock at DISPATCH_LEVEL. True when acquired. */
-XBOXKRNL_IMPORT(0x0AE) BOOLEAN KeTryToAcquireSpinLockAtRaisedIrql(PKSPIN_LOCK SpinLock);
-
-/**
- * Waits on several dispatcher objects. WaitBlockArray may be NULL for up
- * to four objects.
- */
-XBOXKRNL_IMPORT(0x0AF) NTSTATUS KeWaitForMultipleObjects(
- ULONG Count,
- PVOID *Object,
- WAIT_TYPE WaitType,
- KWAIT_REASON WaitReason,
- KPROCESSOR_MODE WaitMode,
- BOOLEAN Alertable,
- PLARGE_INTEGER Timeout,
- PKWAIT_BLOCK WaitBlockArray);
-
-/** Waits on a dispatcher object. A NULL Timeout waits without limit. */
-XBOXKRNL_IMPORT(0x0B0) NTSTATUS KeWaitForSingleObject(
- PVOID Object,
- KWAIT_REASON WaitReason,
- KPROCESSOR_MODE WaitMode,
- BOOLEAN Alertable,
- PLARGE_INTEGER Timeout);
-
-/** Raises the IRQL to DISPATCH_LEVEL and acquires a spin lock. Returns the previous IRQL. */
-XBOXKRNL_IMPORT(0x0B1) KIRQL KfAcquireSpinLock(PKSPIN_LOCK SpinLock);
-
-/** Raises the IRQL. Returns the previous IRQL. */
-XBOXKRNL_IMPORT(0x0B2) KIRQL KfRaiseIrql(KIRQL NewIrql);
-
-/** Lowers the IRQL. */
-XBOXKRNL_IMPORT(0x0B3) VOID KfLowerIrql(KIRQL NewIrql);
-
-/** Releases a spin lock and restores OldIrql. */
-XBOXKRNL_IMPORT(0x0B4) VOID KfReleaseSpinLock(PKSPIN_LOCK SpinLock, KIRQL OldIrql);
-
-/** Allocates a thread local storage index. Returns TLS_OUT_OF_INDEXES when none is free. */
-XBOXKRNL_IMPORT(0x152) ULONG KeTlsAlloc(VOID);
-
-/** Frees a thread local storage index. True on success. */
-XBOXKRNL_IMPORT(0x153) BOOLEAN KeTlsFree(ULONG Index);
-
-/** Returns the value of a thread local storage index for the current thread. */
-XBOXKRNL_IMPORT(0x154) PVOID KeTlsGetValue(ULONG Index);
-
-/** Sets the value of a thread local storage index for the current thread. True on success. */
-XBOXKRNL_IMPORT(0x155) BOOLEAN KeTlsSetValue(ULONG Index, PVOID Value);
-
-XBOX360_EXTERN_C_END
-
-#endif
diff --git a/platform/xex/sdk/include/xbox360/xboxkrnl/mm.h b/platform/xex/sdk/include/xbox360/xboxkrnl/mm.h
deleted file mode 100644
index f669850..0000000
--- a/platform/xex/sdk/include/xbox360/xboxkrnl/mm.h
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Memory manager: virtual and physical memory, page protection and memory
- * statistics.
- */
-
-#ifndef XBOX360_XBOXKRNL_MM_H
-#define XBOX360_XBOXKRNL_MM_H
-
-#include <xbox360/xboxkrnl/ntdef.h>
-
-XBOX360_EXTERN_C_START
-
-/* Allocation and free types of the virtual memory calls. */
-#define MEM_COMMIT 0x00001000
-#define MEM_RESERVE 0x00002000
-#define MEM_DECOMMIT 0x00004000
-#define MEM_RELEASE 0x00008000
-#define MEM_FREE 0x00010000
-#define MEM_PRIVATE 0x00020000
-#define MEM_RESET 0x00080000
-#define MEM_TOP_DOWN 0x00100000
-#define MEM_NOZERO 0x00800000
-#define MEM_LARGE_PAGES 0x20000000 /* 64 KB pages */
-#define MEM_HEAP 0x40000000
-#define MEM_16MB_PAGES 0x80000000 /* 16 MB pages */
-
-/*
- * Page protection. The physical memory calls take MEM_LARGE_PAGES or
- * MEM_16MB_PAGES in the same word.
- */
-#define PAGE_NOACCESS 0x0001
-#define PAGE_READONLY 0x0002
-#define PAGE_READWRITE 0x0004
-#define PAGE_WRITECOPY 0x0008
-#define PAGE_EXECUTE 0x0010
-#define PAGE_EXECUTE_READ 0x0020
-#define PAGE_EXECUTE_READWRITE 0x0040
-#define PAGE_EXECUTE_WRITECOPY 0x0080
-#define PAGE_GUARD 0x0100
-#define PAGE_NOCACHE 0x0200
-#define PAGE_WRITECOMBINE 0x0400
-
-/*
- * Memory region of the physical and virtual memory calls. The kernel
- * rejects other values. The debug regions count as the extra memory of a
- * development kit.
- */
-#define MM_CURRENT_PROCESS_REGION 0 /* title region for a title thread, else system */
-#define MM_TITLE_REGION 1
-#define MM_SYSTEM_REGION 2
-#define MM_TITLE_DEBUG_REGION 3
-#define MM_SYSTEM_DEBUG_REGION 4
-
-/* Region that contains an address, as NtQueryVirtualMemory fills it. */
-typedef struct _MEMORY_BASIC_INFORMATION {
- PVOID BaseAddress;
- PVOID AllocationBase;
- ULONG AllocationProtect;
- SIZE_T RegionSize;
- ULONG State; /* MEM_COMMIT, MEM_RESERVE or MEM_FREE */
- ULONG Protect;
- ULONG Type; /* MEM_PRIVATE for an allocated region */
-} MEMORY_BASIC_INFORMATION, *PMEMORY_BASIC_INFORMATION;
-
-C_ASSERT(sizeof(MEMORY_BASIC_INFORMATION) == 0x1C);
-C_ASSERT(__builtin_offsetof(MEMORY_BASIC_INFORMATION, RegionSize) == 0xC);
-
-/* Memory statistics of MmQueryStatistics. The caller sets Length. */
-typedef struct _MM_STATISTICS {
- ULONG Length;
- ULONG TotalPhysicalPages;
- ULONG KernelPages;
- ULONG TitleAvailablePages;
- ULONG TitleTotalVirtualMemoryBytes;
- ULONG TitleReservedVirtualMemoryBytes;
- ULONG TitlePhysicalPages;
- ULONG TitlePoolPages;
- ULONG TitleStackPages;
- ULONG TitleImagePages;
- ULONG TitleHeapPages;
- ULONG TitleVirtualPages;
- ULONG TitlePageTablePages;
- ULONG TitleCachePages;
- ULONG SystemAvailablePages;
- ULONG SystemTotalVirtualMemoryBytes;
- ULONG SystemReservedVirtualMemoryBytes;
- ULONG SystemPhysicalPages;
- ULONG SystemPoolPages;
- ULONG SystemStackPages;
- ULONG SystemImagePages;
- ULONG SystemHeapPages;
- ULONG SystemVirtualPages;
- ULONG SystemPageTablePages;
- ULONG SystemCachePages;
- ULONG HighestPhysicalPage;
-} MM_STATISTICS, *PMM_STATISTICS;
-
-C_ASSERT(sizeof(MM_STATISTICS) == 0x68);
-C_ASSERT(__builtin_offsetof(MM_STATISTICS, TitleAvailablePages) == 0xC);
-C_ASSERT(__builtin_offsetof(MM_STATISTICS, SystemAvailablePages) == 0x38);
-C_ASSERT(__builtin_offsetof(MM_STATISTICS, HighestPhysicalPage) == 0x64);
-
-/** Allocates physical memory. Returns the address or NULL. */
-XBOXKRNL_IMPORT(0x0B9) PVOID MmAllocatePhysicalMemory(LONG MemoryRegionType, SIZE_T NumberOfBytes, ULONG Protect);
-
-/**
- * Allocates physical memory within an address range and alignment.
- * Returns the address or NULL.
- */
-XBOXKRNL_IMPORT(0x0BA) PVOID MmAllocatePhysicalMemoryEx(
- LONG MemoryRegionType,
- SIZE_T NumberOfBytes,
- ULONG Protect,
- ULONG_PTR LowestAcceptableAddress,
- ULONG_PTR HighestAcceptableAddress,
- ULONG_PTR Alignment
-);
-
-/** Frees physical memory that MmAllocatePhysicalMemoryEx allocated in MemoryRegionType. */
-XBOXKRNL_IMPORT(0x0BD) VOID MmFreePhysicalMemory(LONG MemoryRegionType, PVOID BaseAddress);
-
-/** Translates a mapped virtual address to its physical address. */
-XBOXKRNL_IMPORT(0x0BE) ULONG MmGetPhysicalAddress(PVOID BaseAddress);
-
-/** True when an address is mapped. */
-XBOXKRNL_IMPORT(0x0BF) BOOLEAN MmIsAddressValid(PVOID VirtualAddress);
-
-/** Returns the page protection of an address. */
-XBOXKRNL_IMPORT(0x0C4) ULONG MmQueryAddressProtect(PVOID VirtualAddress);
-
-/** Returns the size of the allocation that contains an address. */
-XBOXKRNL_IMPORT(0x0C5) SIZE_T MmQueryAllocationSize(PVOID BaseAddress);
-
-/** Fills MemoryStatistics, whose Length field the caller sets. */
-XBOXKRNL_IMPORT(0x0C6) NTSTATUS MmQueryStatistics(PMM_STATISTICS MemoryStatistics);
-
-/** Returns the address when the debugger may read it, else NULL. */
-XBOXKRNL_IMPORT(0x1AB) PVOID MmDbgReadCheck(PVOID VirtualAddress);
-
-/** Releases a mapping that MmDbgWriteCheck created. */
-XBOXKRNL_IMPORT(0x1AC) VOID MmDbgReleaseAddress(PVOID VirtualAddress, PULONG Opaque);
-
-/**
- * Maps VirtualAddress writable for the debugger. Returns the mapped
- * address, else NULL. Opaque receives the state MmDbgReleaseAddress restores.
- */
-XBOXKRNL_IMPORT(0x1AD) PVOID MmDbgWriteCheck(PVOID VirtualAddress, PULONG Opaque);
-
-/** Reserves or commits virtual memory. Base and size are updated in place. */
-XBOXKRNL_IMPORT(0x0CC) NTSTATUS NtAllocateVirtualMemory(
- PVOID *BaseAddress,
- PSIZE_T RegionSize,
- ULONG AllocationType,
- ULONG Protect,
- LONG MemoryRegionType
-);
-
-/** Decommits or releases virtual memory. Base and size are updated in place. */
-XBOXKRNL_IMPORT(0x0DC) NTSTATUS NtFreeVirtualMemory(
- PVOID *BaseAddress,
- PSIZE_T RegionSize,
- ULONG FreeType,
- LONG MemoryRegionType
-);
-
-/** Fills a memory basic information structure for an address. */
-XBOXKRNL_IMPORT(0x0EE) NTSTATUS NtQueryVirtualMemory(
- PVOID BaseAddress,
- PMEMORY_BASIC_INFORMATION MemoryInformation,
- LONG MemoryRegionType
-);
-
-XBOX360_EXTERN_C_END
-
-#endif
diff --git a/platform/xex/sdk/include/xbox360/xboxkrnl/nic.h b/platform/xex/sdk/include/xbox360/xboxkrnl/nic.h
deleted file mode 100644
index 9012c3c..0000000
--- a/platform/xex/sdk/include/xbox360/xboxkrnl/nic.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Network controller driver statistics.
- */
-
-#ifndef XBOX360_XBOXKRNL_NIC_H
-#define XBOX360_XBOXKRNL_NIC_H
-
-#include <xbox360/xboxkrnl/ntdef.h>
-
-XBOX360_EXTERN_C_START
-
-/* Devices behind the NIC driver, as bits of a device mask. */
-#define NIC_DEVICE_EMAC 0x00000001
-#define NIC_DEVICE_WIRELESS 0x00000002
-#define NIC_DEVICE_KD 0x00000010
-
-/* Classes of a received frame by its destination address. */
-typedef enum _NIC_FRAME_CLASS {
- NicFrameOther,
- NicFramePrimaryUnicast,
- NicFrameSecondaryUnicast,
- NicFrameMulticast,
- NicFrameBroadcast,
- NicFrameClassCount
-} NIC_FRAME_CLASS;
-
-/*
- * Counters of one device; NicGetStats adds them over the devices of a mask.
- * The structure is 4-byte packed.
- */
-#pragma pack(push, 4)
-typedef struct _NIC_STATS {
- ULONGLONG XmitBytes;
- ULONGLONG RecvBytes[NicFrameClassCount];
- ULONG XmitPackets;
- ULONG RecvPackets[NicFrameClassCount];
- ULONG XmitUnderrunErrors;
- ULONG XmitOtherErrors;
- ULONG RecvOverrunErrors;
- ULONG RecvFrameErrors;
- ULONG RecvOtherErrors;
-} NIC_STATS, *PNIC_STATS;
-#pragma pack(pop)
-
-C_ASSERT(__builtin_offsetof(NIC_STATS, XmitPackets) == 0x30);
-C_ASSERT(sizeof(NIC_STATS) == 0x5C);
-
-/** Fills a network interface statistics structure for the NIC_DEVICE_* bits of DeviceMask. */
-XBOXKRNL_IMPORT(0x209) ULONG NicGetStats(ULONG DeviceMask, PNIC_STATS Stats);
-
-XBOX360_EXTERN_C_END
-
-#endif
diff --git a/platform/xex/sdk/include/xbox360/xboxkrnl/ntdef.h b/platform/xex/sdk/include/xbox360/xboxkrnl/ntdef.h
deleted file mode 100644
index 64e5121..0000000
--- a/platform/xex/sdk/include/xbox360/xboxkrnl/ntdef.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Kernel types that most imports use: counted strings, object attributes,
- * I/O status blocks and the dispatcher header of waitable objects.
- */
-
-#ifndef XBOX360_XBOXKRNL_NTDEF_H
-#define XBOX360_XBOXKRNL_NTDEF_H
-
-#include <xbox360/base.h>
-
-XBOX360_EXTERN_C_START
-
-typedef UCHAR KPROCESSOR_MODE;
-typedef UCHAR KIRQL, *PKIRQL;
-typedef LONG KPRIORITY;
-
-#define KernelMode 0
-#define UserMode 1
-
-/* Counted 8-bit string; lengths are in bytes. */
-typedef struct _STRING {
- USHORT Length;
- USHORT MaximumLength;
- PCHAR Buffer;
-} STRING, *PSTRING;
-
-typedef STRING ANSI_STRING, *PANSI_STRING;
-typedef STRING OBJECT_STRING, *POBJECT_STRING;
-
-/* Counted 16-bit string; lengths are in bytes. */
-typedef struct _UNICODE_STRING {
- USHORT Length;
- USHORT MaximumLength;
- PWSTR Buffer;
-} UNICODE_STRING, *PUNICODE_STRING;
-
-C_ASSERT(sizeof(STRING) == 8);
-C_ASSERT(sizeof(UNICODE_STRING) == 8);
-
-/* Object attributes. The console layout has no length or security fields. */
-typedef struct _OBJECT_ATTRIBUTES {
- HANDLE RootDirectory;
- POBJECT_STRING ObjectName;
- ULONG Attributes;
-} OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES;
-
-C_ASSERT(sizeof(OBJECT_ATTRIBUTES) == 12);
-
-#define OBJ_INHERIT 0x00000002
-#define OBJ_PERMANENT 0x00000010
-#define OBJ_EXCLUSIVE 0x00000020
-#define OBJ_CASE_INSENSITIVE 0x00000040
-#define OBJ_OPENIF 0x00000080
-#define OBJ_OPENLINK 0x00000100
-#define OBJ_KERNEL_HANDLE 0x00000200
-
-/* Final status and information of an I/O request. */
-typedef struct _IO_STATUS_BLOCK {
- union {
- NTSTATUS Status;
- PVOID Pointer;
- };
- ULONG_PTR Information;
-} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
-
-C_ASSERT(sizeof(IO_STATUS_BLOCK) == 8);
-
-typedef VOID (*PIO_APC_ROUTINE)(PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock, ULONG Reserved);
-
-/* Header of every object a thread can wait on. */
-typedef struct _DISPATCHER_HEADER {
- UCHAR Type;
- UCHAR Absolute;
- UCHAR ProcessType;
- UCHAR Inserted;
- LONG SignalState;
- LIST_ENTRY WaitListHead;
-} DISPATCHER_HEADER, *PDISPATCHER_HEADER;
-
-C_ASSERT(sizeof(DISPATCHER_HEADER) == 16);
-
-typedef enum _EVENT_TYPE {
- NotificationEvent = 0,
- SynchronizationEvent = 1,
-} EVENT_TYPE;
-
-typedef struct _KEVENT {
- DISPATCHER_HEADER Header;
-} KEVENT, *PKEVENT;
-
-C_ASSERT(sizeof(KEVENT) == 16);
-
-XBOX360_EXTERN_C_END
-
-#endif
diff --git a/platform/xex/sdk/include/xbox360/xboxkrnl/ob.h b/platform/xex/sdk/include/xbox360/xboxkrnl/ob.h
deleted file mode 100644
index 958da31..0000000
--- a/platform/xex/sdk/include/xbox360/xboxkrnl/ob.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Object manager (Ob): object types, access masks, object directories and
- * symbolic links.
- */
-
-#ifndef XBOX360_XBOXKRNL_OB_H
-#define XBOX360_XBOXKRNL_OB_H
-
-#include <xbox360/base.h>
-#include <xbox360/xboxkrnl/ntdef.h>
-#include <xbox360/xboxkrnl/ke.h>
-
-XBOX360_EXTERN_C_START
-
-/* Standard and generic rights of an ACCESS_MASK. */
-#define DELETE 0x00010000
-#define READ_CONTROL 0x00020000
-#define WRITE_DAC 0x00040000
-#define WRITE_OWNER 0x00080000
-#define SYNCHRONIZE 0x00100000
-#define MAXIMUM_ALLOWED 0x02000000
-#define GENERIC_ALL 0x10000000
-#define GENERIC_EXECUTE 0x20000000
-#define GENERIC_WRITE 0x40000000
-#define GENERIC_READ 0x80000000
-
-/* Allocate the object from title or system memory regardless of the caller. */
-#define OBJ_TITLE_OBJECT 0x00001000
-#define OBJ_SYSTEM_OBJECT 0x00002000
-
-struct _OBJECT_TYPE;
-
-typedef PVOID (*OB_ALLOCATE_METHOD)(SIZE_T NumberOfBytes, ULONG Tag, ULONG PoolType);
-typedef VOID (*OB_FREE_METHOD)(PVOID Pointer);
-typedef VOID (*OB_CLOSE_METHOD)(PVOID Object, ULONG SystemHandleCount);
-typedef VOID (*OB_DELETE_METHOD)(PVOID Object);
-typedef NTSTATUS (*OB_PARSE_METHOD)(
- PVOID ParseObject,
- struct _OBJECT_TYPE *ObjectType,
- ULONG Attributes,
- POBJECT_STRING CompleteName,
- POBJECT_STRING RemainingName,
- PVOID Context,
- PVOID *Object);
-
-/* An object type, such as ExThreadObjectType. Object calls take its address. */
-typedef struct _OBJECT_TYPE {
- OB_ALLOCATE_METHOD AllocateProcedure;
- OB_FREE_METHOD FreeProcedure;
- OB_CLOSE_METHOD CloseProcedure;
- OB_DELETE_METHOD DeleteProcedure;
- OB_PARSE_METHOD ParseProcedure;
- PVOID DefaultObject;
- ULONG PoolTag;
-} OBJECT_TYPE, *POBJECT_TYPE;
-
-C_ASSERT(sizeof(OBJECT_TYPE) == 28);
-
-/* Entry of NtQueryDirectoryObject; the name characters follow it. */
-typedef struct _OBJECT_DIRECTORY_INFORMATION {
- OBJECT_STRING Name;
- /* PoolTag of the object's type. */
- ULONG Type;
-} OBJECT_DIRECTORY_INFORMATION, *POBJECT_DIRECTORY_INFORMATION;
-
-C_ASSERT(sizeof(OBJECT_DIRECTORY_INFORMATION) == 12);
-
-/** Creates an object directory. */
-XBOXKRNL_IMPORT(0x0D0) NTSTATUS NtCreateDirectoryObject(
- PHANDLE DirectoryHandle,
- POBJECT_ATTRIBUTES ObjectAttributes);
-
-/** Opens an object directory. */
-XBOXKRNL_IMPORT(0x0DE) NTSTATUS NtOpenDirectoryObject(
- PHANDLE DirectoryHandle,
- POBJECT_ATTRIBUTES ObjectAttributes);
-
-/** Reads one entry of an object directory. Context holds the enumeration position. */
-XBOXKRNL_IMPORT(0x0E5) NTSTATUS NtQueryDirectoryObject(
- HANDLE DirectoryHandle,
- POBJECT_DIRECTORY_INFORMATION DirectoryInformation,
- ULONG Length,
- BOOLEAN RestartScan,
- PULONG Context,
- PULONG ReturnLength);
-
-/** Allocates an object of type ObjectType with a body of ObjectBodySize bytes. */
-XBOXKRNL_IMPORT(0x102) NTSTATUS ObCreateObject(
- POBJECT_TYPE ObjectType,
- POBJECT_ATTRIBUTES ObjectAttributes,
- ULONG ObjectBodySize,
- PVOID *Object);
-
-/** Creates a symbolic link object from SymbolicLinkName to DeviceName. */
-XBOXKRNL_IMPORT(0x103) NTSTATUS ObCreateSymbolicLink(
- POBJECT_STRING SymbolicLinkName,
- POBJECT_STRING DeviceName);
-
-/** Deletes the symbolic link object SymbolicLinkName. */
-XBOXKRNL_IMPORT(0x104) NTSTATUS ObDeleteSymbolicLink(POBJECT_STRING SymbolicLinkName);
-
-/** Releases a reference to an object. */
-XBOXKRNL_IMPORT(0x105) VOID ObDereferenceObject(PVOID Object);
-
-/**
- * Inserts an object into the handle table and object directory. The handle
- * is stored at Handle.
- */
-XBOXKRNL_IMPORT(0x108) NTSTATUS ObInsertObject(
- PVOID Object,
- POBJECT_ATTRIBUTES ObjectAttributes,
- ULONG ObjectPointerBias,
- PHANDLE Handle);
-
-/** Finds a thread object by thread ID and references it. */
-XBOXKRNL_IMPORT(0x10A) NTSTATUS ObLookupAnyThreadByThreadId(HANDLE ThreadId, PKTHREAD *Thread);
-
-/** Removes the permanent flag of a named object. */
-XBOXKRNL_IMPORT(0x10C) VOID ObMakeTemporaryObject(PVOID Object);
-
-/** Opens a named object and stores a handle. */
-XBOXKRNL_IMPORT(0x10D) NTSTATUS ObOpenObjectByName(
- POBJECT_ATTRIBUTES ObjectAttributes,
- POBJECT_TYPE ObjectType,
- PVOID ParseContext,
- PHANDLE Handle);
-
-/** References the object of a handle. A NULL ObjectType accepts any type. */
-XBOXKRNL_IMPORT(0x110) NTSTATUS ObReferenceObjectByHandle(
- HANDLE Handle,
- POBJECT_TYPE ObjectType,
- PVOID *ReturnedObject);
-
-/** References a named object. Attributes are OBJ_* flags. */
-XBOXKRNL_IMPORT(0x111) NTSTATUS ObReferenceObjectByName(
- POBJECT_STRING ObjectName,
- ULONG Attributes,
- POBJECT_TYPE ObjectType,
- PVOID ParseContext,
- PVOID *Object);
-
-/** Reads the target of a symbolic link object into OutputString. */
-XBOXKRNL_IMPORT(0x113) NTSTATUS ObTranslateSymbolicLink(
- POBJECT_ATTRIBUTES ObjectAttributes,
- POBJECT_STRING OutputString);
-
-XBOX360_EXTERN_C_END
-
-#endif
diff --git a/platform/xex/sdk/include/xbox360/xboxkrnl/rtl.h b/platform/xex/sdk/include/xbox360/xboxkrnl/rtl.h
deleted file mode 100644
index 7aaabc8..0000000
--- a/platform/xex/sdk/include/xbox360/xboxkrnl/rtl.h
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
- * Run-time library (Rtl): critical sections, singly linked lists, thread
- * contexts, image headers, debug output and formatting.
- */
-
-#ifndef XBOX360_XBOXKRNL_RTL_H
-#define XBOX360_XBOXKRNL_RTL_H
-
-#include <xbox360/base.h>
-#include <xbox360/xboxkrnl/ntdef.h>
-#include <xbox360/xboxkrnl/ke.h>
-
-XBOX360_EXTERN_C_START
-
-/* Register groups of a CONTEXT that hold values (ContextFlags). */
-/* MSR, IAR, LR and CTR. */
-#define CONTEXT_CONTROL 0x00000001
-/* FPR and FPSCR. */
-#define CONTEXT_FLOATING_POINT 0x00000002
-/* GPR, CR and XER. */
-#define CONTEXT_INTEGER 0x00000004
-/* VR and VSCR. */
-#define CONTEXT_VECTOR 0x00000010
-/* Every register group, as RtlCaptureContext requests. */
-#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER | CONTEXT_VECTOR)
-
-/* The registers of a thread. The vector registers need 16-byte alignment. */
-typedef struct DECLSPEC_ALIGN(16) _CONTEXT {
- ULONG ContextFlags;
- ULONG Msr;
- ULONG Iar;
- ULONG Lr;
- ULONGLONG Ctr;
- ULONGLONG Gpr[32];
- ULONG Cr;
- ULONG Xer;
- /* Floating point values as IEEE bits. */
- ULONGLONG Fpscr;
- ULONGLONG Fpr[32];
- ULONG UserModeState;
- ULONG Reserved1;
- ULONG Vscr[4];
- ULONG Vr[128][4];
-} CONTEXT, *PCONTEXT;
-
-C_ASSERT(__builtin_offsetof(CONTEXT, Ctr) == 0x10);
-C_ASSERT(__builtin_offsetof(CONTEXT, Gpr) == 0x18);
-C_ASSERT(__builtin_offsetof(CONTEXT, Cr) == 0x118);
-C_ASSERT(__builtin_offsetof(CONTEXT, Fpscr) == 0x120);
-C_ASSERT(__builtin_offsetof(CONTEXT, Fpr) == 0x128);
-C_ASSERT(__builtin_offsetof(CONTEXT, Vscr) == 0x230);
-C_ASSERT(__builtin_offsetof(CONTEXT, Vr) == 0x240);
-C_ASSERT(sizeof(CONTEXT) == 0xA40);
-
-/*
- * Critical section: a synchronization event that waiters block on, with the
- * spin count in the second byte of the event header, and the ownership
- * state. LockCount is -1 when the section is free.
- */
-typedef struct _RTL_CRITICAL_SECTION {
- union {
- KEVENT Event;
- struct {
- UCHAR Type;
- UCHAR SpinCount;
- } Synchronization;
- };
- /* Count of entries minus one. */
- LONG LockCount;
- /* Count of recursive entries of the owner. */
- LONG RecursionCount;
- /* Thread that owns the section, or NULL. */
- struct _KTHREAD *OwningThread;
-} RTL_CRITICAL_SECTION, *PRTL_CRITICAL_SECTION;
-
-C_ASSERT(__builtin_offsetof(RTL_CRITICAL_SECTION, LockCount) == 0x10);
-C_ASSERT(__builtin_offsetof(RTL_CRITICAL_SECTION, RecursionCount) == 0x14);
-C_ASSERT(__builtin_offsetof(RTL_CRITICAL_SECTION, OwningThread) == 0x18);
-C_ASSERT(sizeof(RTL_CRITICAL_SECTION) == 0x1C);
-
-/*
- * Head of a sequenced singly linked list: Next in the high word, Depth and
- * Sequence in the low word, updated as one doubleword.
- */
-typedef union _SLIST_HEADER {
- ULONGLONG Alignment;
- struct {
- SINGLE_LIST_ENTRY Next;
- USHORT Depth;
- USHORT Sequence;
- };
-} SLIST_HEADER, *PSLIST_HEADER;
-
-C_ASSERT(sizeof(SLIST_HEADER) == 8);
-
-/*
- * PE image headers. Image files are little-endian: multibyte fields hold
- * the stored bytes and must be byte-swapped on read.
- */
-
-/* IMAGE_FILE_HEADER.Characteristics */
-#define IMAGE_FILE_DLL 0x2000
-
-typedef struct _IMAGE_FILE_HEADER {
- USHORT Machine;
- USHORT NumberOfSections;
- ULONG TimeDateStamp;
- ULONG PointerToSymbolTable;
- ULONG NumberOfSymbols;
- USHORT SizeOfOptionalHeader;
- USHORT Characteristics;
-} IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER;
-
-C_ASSERT(sizeof(IMAGE_FILE_HEADER) == 20);
-
-typedef struct _IMAGE_DATA_DIRECTORY {
- ULONG VirtualAddress;
- ULONG Size;
-} IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY;
-
-C_ASSERT(sizeof(IMAGE_DATA_DIRECTORY) == 8);
-
-#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
-
-typedef struct _IMAGE_OPTIONAL_HEADER {
- USHORT Magic;
- UCHAR MajorLinkerVersion;
- UCHAR MinorLinkerVersion;
- ULONG SizeOfCode;
- ULONG SizeOfInitializedData;
- ULONG SizeOfUninitializedData;
- ULONG AddressOfEntryPoint;
- ULONG BaseOfCode;
- ULONG BaseOfData;
- ULONG ImageBase;
- ULONG SectionAlignment;
- ULONG FileAlignment;
- USHORT MajorOperatingSystemVersion;
- USHORT MinorOperatingSystemVersion;
- USHORT MajorImageVersion;
- USHORT MinorImageVersion;
- USHORT MajorSubsystemVersion;
- USHORT MinorSubsystemVersion;
- ULONG Win32VersionValue;
- ULONG SizeOfImage;
- ULONG SizeOfHeaders;
- ULONG CheckSum;
- USHORT Subsystem;
- USHORT DllCharacteristics;
- ULONG SizeOfStackReserve;
- ULONG SizeOfStackCommit;
- ULONG SizeOfHeapReserve;
- ULONG SizeOfHeapCommit;
- ULONG LoaderFlags;
- ULONG NumberOfRvaAndSizes;
- IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
-} IMAGE_OPTIONAL_HEADER, *PIMAGE_OPTIONAL_HEADER;
-
-C_ASSERT(__builtin_offsetof(IMAGE_OPTIONAL_HEADER, SizeOfImage) == 56);
-C_ASSERT(__builtin_offsetof(IMAGE_OPTIONAL_HEADER, CheckSum) == 64);
-C_ASSERT(sizeof(IMAGE_OPTIONAL_HEADER) == 224);
-
-/* NT headers, as RtlImageNtHeader returns them. The section table follows the optional header. */
-typedef struct _IMAGE_NT_HEADERS {
- ULONG Signature;
- IMAGE_FILE_HEADER FileHeader;
- IMAGE_OPTIONAL_HEADER OptionalHeader;
-} IMAGE_NT_HEADERS, *PIMAGE_NT_HEADERS;
-
-C_ASSERT(__builtin_offsetof(IMAGE_NT_HEADERS, OptionalHeader) == 24);
-C_ASSERT(sizeof(IMAGE_NT_HEADERS) == 248);
-
-#define IMAGE_SIZEOF_SHORT_NAME 8
-
-typedef struct _IMAGE_SECTION_HEADER {
- /* The name, padded with NULs. A name of eight bytes has no NUL. */
- UCHAR Name[IMAGE_SIZEOF_SHORT_NAME];
- ULONG VirtualSize;
- /* Offset of the section from the image base. */
- ULONG VirtualAddress;
- ULONG SizeOfRawData;
- ULONG PointerToRawData;
- ULONG PointerToRelocations;
- ULONG PointerToLinenumbers;
- USHORT NumberOfRelocations;
- USHORT NumberOfLinenumbers;
- ULONG Characteristics;
-} IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER;
-
-C_ASSERT(sizeof(IMAGE_SECTION_HEADER) == 40);
-
-/* IMAGE_DEBUG_DIRECTORY.Type */
-#define IMAGE_DEBUG_TYPE_CODEVIEW 2
-
-/* One entry of the debug data directory. */
-typedef struct _IMAGE_DEBUG_DIRECTORY {
- ULONG Characteristics;
- ULONG TimeDateStamp;
- USHORT MajorVersion;
- USHORT MinorVersion;
- ULONG Type;
- ULONG SizeOfData;
- /* Offset of the debug data from the image base. */
- ULONG AddressOfRawData;
- ULONG PointerToRawData;
-} IMAGE_DEBUG_DIRECTORY, *PIMAGE_DEBUG_DIRECTORY;
-
-C_ASSERT(__builtin_offsetof(IMAGE_DEBUG_DIRECTORY, AddressOfRawData) == 20);
-C_ASSERT(sizeof(IMAGE_DEBUG_DIRECTORY) == 28);
-
-/* Index of a PE data directory. */
-typedef enum _IMAGE_DIRECTORY_ENTRY {
- /* The function table (.pdata). */
- IMAGE_DIRECTORY_ENTRY_EXCEPTION = 3,
- IMAGE_DIRECTORY_ENTRY_DEBUG = 6,
-} IMAGE_DIRECTORY_ENTRY;
-
-/** Raises a breakpoint exception to the attached debugger. */
-XBOXKRNL_IMPORT(0x001) VOID DbgBreakPoint(VOID);
-
-/** Writes a formatted string to the debug output. */
-XBOXKRNL_IMPORT(0x003) ULONG DbgPrint(PCSZ Format, ...);
-
-/** Removes all entries from a singly linked list. Returns the first entry. */
-XBOXKRNL_IMPORT(0x02B) PSINGLE_LIST_ENTRY InterlockedFlushSList(PSLIST_HEADER ListHead);
-
-/** Removes the first entry from a singly linked list. Returns the entry or NULL. */
-XBOXKRNL_IMPORT(0x02C) PSINGLE_LIST_ENTRY InterlockedPopEntrySList(PSLIST_HEADER ListHead);
-
-/** Reports a failed assertion to the debugger. */
-XBOXKRNL_IMPORT(0x118) VOID RtlAssert(
- PVOID FailedAssertion,
- PVOID FileName,
- ULONG LineNumber,
- PCSZ Message);
-
-/** Stores the context of the current thread. */
-XBOXKRNL_IMPORT(0x119) VOID RtlCaptureContext(PCONTEXT ContextRecord);
-
-/** Enters a critical section. */
-XBOXKRNL_IMPORT(0x125) VOID RtlEnterCriticalSection(PRTL_CRITICAL_SECTION CriticalSection);
-
-/** Stores the low and high stack limits of the current thread. */
-XBOXKRNL_IMPORT(0x12A) VOID RtlGetStackLimits(PULONG_PTR StackLimit, PULONG_PTR StackBase);
-
-/** Returns the value or address of an optional header field of a XEX header. Key is an XEX_HEADER_* key. */
-XBOXKRNL_IMPORT(0x12B) PVOID RtlImageXexHeaderField(PVOID XexHeaderBase, ULONG Key);
-
-/** Initializes a critical section. */
-XBOXKRNL_IMPORT(0x12E) VOID RtlInitializeCriticalSection(PRTL_CRITICAL_SECTION CriticalSection);
-
-/** Initializes a critical section with a spin count. */
-XBOXKRNL_IMPORT(0x12F) NTSTATUS RtlInitializeCriticalSectionAndSpinCount(
- PRTL_CRITICAL_SECTION CriticalSection,
- ULONG SpinCount);
-
-/** Leaves a critical section. */
-XBOXKRNL_IMPORT(0x130) VOID RtlLeaveCriticalSection(PRTL_CRITICAL_SECTION CriticalSection);
-
-/** Converts an NTSTATUS value to a Win32 error code. */
-XBOXKRNL_IMPORT(0x135) ULONG RtlNtStatusToDosError(NTSTATUS Status);
-
-/** Tries to enter a critical section. True when entered. */
-XBOXKRNL_IMPORT(0x141) BOOLEAN RtlTryEnterCriticalSection(PRTL_CRITICAL_SECTION CriticalSection);
-
-/**
- * Formats into Buffer from a va_list. ArgList is a console va_list: 8-byte
- * slots, 32-bit values in the low word.
- */
-XBOXKRNL_IMPORT(0x14D) INT _vsnprintf(PCHAR Buffer, SIZE_T Count, PCSZ Format, PVOID ArgList);
-
-/** Returns the address of a PE data directory of an image. Its size is stored at Size. */
-XBOXKRNL_IMPORT(0x1A8) PVOID RtlImageDirectoryEntryToData(
- PVOID Base,
- BOOLEAN MappedAsImage,
- IMAGE_DIRECTORY_ENTRY DirectoryEntry,
- PULONG Size);
-
-/** Returns the PE NT headers of an image, or NULL. */
-XBOXKRNL_IMPORT(0x1A9) PIMAGE_NT_HEADERS RtlImageNtHeader(PVOID Base);
-
-XBOX360_EXTERN_C_END
-
-#endif
diff --git a/platform/xex/sdk/include/xbox360/xboxkrnl/usb.h b/platform/xex/sdk/include/xbox360/xboxkrnl/usb.h
deleted file mode 100644
index 156253b..0000000
--- a/platform/xex/sdk/include/xbox360/xboxkrnl/usb.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * USB devices: controller radio and USB camera driver.
- */
-
-#ifndef XBOX360_XBOXKRNL_USB_H
-#define XBOX360_XBOXKRNL_USB_H
-
-#include <xbox360/xboxkrnl/ntdef.h>
-
-XBOX360_EXTERN_C_START
-
-/* Completion routine of an asynchronous USB camera request. */
-typedef VOID (*PXUSBCAM_COMPLETION_ROUTINE)(LONG Status, PVOID Context);
-
-/** Turns the controller radio on or off. */
-XBOXKRNL_IMPORT(0x1EF) ULONG XInputdSetRFPowerMode(ULONG Enable);
-
-/** Writes one USB camera configuration value. */
-XBOXKRNL_IMPORT(0x21C) LONG XUsbcamSetConfig(
- ULONG Camera,
- ULONG Request,
- ULONG Selector,
- const UCHAR *Value,
- ULONG Length,
- PXUSBCAM_COMPLETION_ROUTINE CompletionRoutine,
- PVOID Context);
-
-/** State of the USB camera driver. The dashboard reads 2 as ready. */
-XBOXKRNL_IMPORT(0x21D) ULONG XUsbcamGetState(VOID);
-
-/**
- * Creates the USB camera driver context in Workspace and stores its camera
- * handle. Returns zero on success.
- */
-XBOXKRNL_IMPORT(0x222) ULONG XUsbcamCreate(PVOID Workspace, ULONG WorkspaceSize, PULONG Camera);
-
-/** Destroys a USB camera driver context. */
-XBOXKRNL_IMPORT(0x223) VOID XUsbcamDestroy(ULONG Camera);
-
-XBOX360_EXTERN_C_END
-
-#endif
diff --git a/platform/xex/sdk/include/xbox360/xboxkrnl/vd.h b/platform/xex/sdk/include/xbox360/xboxkrnl/vd.h
deleted file mode 100644
index 25707ef..0000000
--- a/platform/xex/sdk/include/xbox360/xboxkrnl/vd.h
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * Video display driver: display modes, the GPU command processor and front
- * buffer swaps.
- */
-
-#ifndef XBOX360_XBOXKRNL_VD_H
-#define XBOX360_XBOXKRNL_VD_H
-
-#include <xbox360/xboxkrnl/ntdef.h>
-
-XBOX360_EXTERN_C_START
-
-/* Display information block that VdGetCurrentDisplayInformation fills. */
-typedef struct _VD_DISPLAY_INFORMATION {
- USHORT SurfaceWidth;
- USHORT SurfaceHeight;
- UCHAR ColorSpace;
- UCHAR Reserved005[3];
- ULONG Left;
- ULONG Top;
- ULONG Right;
- ULONG Bottom;
- ULONG ScaledWidth;
- ULONG ScaledHeight;
- ULONG Reserved020[14];
-} VD_DISPLAY_INFORMATION, *PVD_DISPLAY_INFORMATION;
-
-C_ASSERT(__builtin_offsetof(VD_DISPLAY_INFORMATION, ColorSpace) == 4);
-C_ASSERT(__builtin_offsetof(VD_DISPLAY_INFORMATION, Left) == 8);
-C_ASSERT(__builtin_offsetof(VD_DISPLAY_INFORMATION, ScaledHeight) == 0x1C);
-C_ASSERT(sizeof(VD_DISPLAY_INFORMATION) == 0x58);
-
-/*
- * System command buffer descriptor that VdGetSystemCommandBuffer fills and
- * VdSwap reads.
- */
-typedef struct _VD_SYSTEM_COMMAND_BUFFER {
- /* GPU address of the buffer, or 0 when the kernel has none. */
- ULONG Address;
- ULONG Dwords;
- /* Nonzero when the following state is valid for the swap outputs. */
- ULONG State;
- ULONG Reserved00C[34];
-} VD_SYSTEM_COMMAND_BUFFER, *PVD_SYSTEM_COMMAND_BUFFER;
-
-C_ASSERT(sizeof(VD_SYSTEM_COMMAND_BUFFER) == 0x94);
-
-/* Parameter block of VdSetDisplayModeOverride. */
-typedef struct _VD_DISPLAY_MODE_OVERRIDE_PARAMETERS {
- /* sizeof(VD_DISPLAY_MODE_OVERRIDE_PARAMETERS). */
- ULONG Size;
- ULONG Reserved004[2];
- /* Retry index of the override. */
- UCHAR Attempt;
- UCHAR Reserved00D[3];
-} VD_DISPLAY_MODE_OVERRIDE_PARAMETERS, *PVD_DISPLAY_MODE_OVERRIDE_PARAMETERS;
-
-C_ASSERT(__builtin_offsetof(VD_DISPLAY_MODE_OVERRIDE_PARAMETERS, Attempt) == 0xC);
-C_ASSERT(sizeof(VD_DISPLAY_MODE_OVERRIDE_PARAMETERS) == 0x10);
-
-/*
- * Block that VdGetDisplayDiscoveryData fills. Only bytes +0, +4 and the
- * unaligned ULONG at +0x1D are known to be used.
- */
-typedef struct _VD_DISPLAY_DISCOVERY_DATA {
- ULONG Reserved000[20];
-} VD_DISPLAY_DISCOVERY_DATA, *PVD_DISPLAY_DISCOVERY_DATA;
-
-C_ASSERT(sizeof(VD_DISPLAY_DISCOVERY_DATA) == 0x50);
-
-/*
- * Mode reported by VdEnumerateVideoModes. Source and Preference rank the
- * EDID entry the mode came from; DisplayType is the display type value.
- */
-#pragma pack(push, 2)
-typedef struct _VD_VIDEO_MODE_INFO {
- USHORT Size;
- USHORT Width;
- USHORT Height;
- UCHAR Source;
- UCHAR Preference;
- FLOAT RefreshRate;
- ULONG ModeID : 8;
- ULONG Reserved : 19;
- ULONG Audio : 1;
- ULONG YCbCr : 1;
- ULONG Interlaced : 1;
- ULONG StandardAspectRatio : 1;
- ULONG Valid : 1;
- ULONG PixelRate;
- UCHAR DisplayType;
- UCHAR PixelRepetition;
-} VD_VIDEO_MODE_INFO, *PVD_VIDEO_MODE_INFO;
-#pragma pack(pop)
-
-C_ASSERT(__builtin_offsetof(VD_VIDEO_MODE_INFO, RefreshRate) == 8);
-C_ASSERT(sizeof(VD_VIDEO_MODE_INFO) == 0x16);
-
-/* Called for each mode by VdEnumerateVideoModes; returns zero to stop. */
-typedef ULONG (*PVD_ENUMERATE_VIDEO_MODES_ROUTINE)(const VD_VIDEO_MODE_INFO *Mode, PVOID Context);
-
-/* Called by VdShutdownEngines with the context given to VdInitializeEngines. */
-typedef VOID (*PVD_ENGINES_SHUTDOWN_ROUTINE)(PVOID Context);
-
-/* Called by the graphics interrupt handler with (0, Context). */
-typedef VOID (*PVD_GRAPHICS_INTERRUPT_ROUTINE)(ULONG Source, PVOID Context);
-
-/**
- * Makes the command processor write its ring read pointer, in dwords, to
- * PhysicalAddress (dword aligned). BlockSizeLog2 is the read pointer block
- * size field of the ring control register.
- */
-XBOXKRNL_IMPORT(0x1B6) VOID VdEnableRingBufferRPtrWriteBack(ULONG PhysicalAddress, ULONG BlockSizeLog2);
-
-/** Fills a display information structure. */
-XBOXKRNL_IMPORT(0x1BA) VOID VdGetCurrentDisplayInformation(PVD_DISPLAY_INFORMATION DisplayInformation);
-
-/**
- * Copies the next of the kernel's three system command buffer descriptors
- * to Buffer and stores in Identifier the value the GPU writes to the
- * identifier address once that buffer has run.
- */
-XBOXKRNL_IMPORT(0x1BD) VOID VdGetSystemCommandBuffer(PVD_SYSTEM_COMMAND_BUFFER Buffer, PULONG Identifier);
-
-/**
- * Gives the GPU command processor to the calling title: loads the CP
- * microcode (the kernel's own when both pointers are null), stores
- * ShutdownRoutine and Context for VdShutdownEngines and resets the engines.
- * Unused is not read. Returns 1. Traps when the engines are already owned.
- */
-XBOXKRNL_IMPORT(0x1C2) ULONG VdInitializeEngines(
- ULONG Unused,
- PVD_ENGINES_SHUTDOWN_ROUTINE ShutdownRoutine,
- PVOID Context,
- const ULONG *PrefetchMicrocode,
- const ULONG *EngineMicrocode);
-
-/**
- * Points the command processor ring at PhysicalAddress with
- * 2^(SizeLog2 + 1) dwords and resets its read and write pointers.
- */
-XBOXKRNL_IMPORT(0x1C3) VOID VdInitializeRingBuffer(ULONG PhysicalAddress, ULONG SizeLog2);
-
-/** Reads a video encoder register. */
-XBOXKRNL_IMPORT(0x1CB) ULONG VdReadDVERegisterUlong(ULONG Register);
-
-/**
- * Programs the configured video mode. Flags selects display-off,
- * forced-output, color-space, and pixel-format options.
- */
-XBOXKRNL_IMPORT(0x1D3) VOID VdSetDisplayMode(ULONG Flags);
-
-/**
- * Overrides the display mode; nonzero on success. Scan is 1 for interlaced
- * and 2 for progressive [INFERENCE]; Parameters may be null. All zero
- * arguments remove the override. RefreshRate is passed in f1 and the console
- * ABI also reserves r5 for it, so Scan and Parameters are in r6 and r7.
- */
-XBOXKRNL_IMPORT(0x1D4) ULONG VdSetDisplayModeOverride(
- ULONG Width,
- ULONG Height,
- DOUBLE RefreshRate,
- ULONG Scan,
- const VD_DISPLAY_MODE_OVERRIDE_PARAMETERS *Parameters);
-
-/** Sets the routine the graphics interrupt handler calls with (0, Context), or none when null. */
-XBOXKRNL_IMPORT(0x1D5) VOID VdSetGraphicsInterruptCallback(PVD_GRAPHICS_INTERRUPT_ROUTINE Routine, PVOID Context);
-
-/**
- * Sets the virtual address of the dword where the GPU writes the identifier
- * of each finished system command buffer, or none when null.
- */
-XBOXKRNL_IMPORT(0x1D9) VOID VdSetSystemCommandBufferGpuIdentifierAddress(PULONG Address);
-
-/**
- * Waits for the GPU to idle, returns the command processor to the kernel's
- * own ring and calls the shutdown routine of VdInitializeEngines.
- */
-XBOXKRNL_IMPORT(0x1DC) VOID VdShutdownEngines(VOID);
-
-/** Writes a video encoder register. */
-XBOXKRNL_IMPORT(0x1E0) ULONG VdWriteDVERegisterUlong(ULONG Register, ULONG Value);
-
-/**
- * Writes a 64-dword front buffer flip into Commands: when SystemBuffer holds
- * a buffer, fetch constant 15 from the 6-dword FetchConstant (base address
- * virtual) and an indirect buffer call of it, then an event write of
- * Identifier to IdentifierAddress (virtual), padded with a NOP. The five
- * outputs are written only when SystemBuffer carries optional state.
- */
-XBOXKRNL_IMPORT(0x25B) VOID VdSwap(
- PULONG Commands,
- const ULONG *FetchConstant,
- PULONG IdentifierAddress,
- const VD_SYSTEM_COMMAND_BUFFER *SystemBuffer,
- ULONG Identifier,
- PULONG FrontBuffer,
- PULONG TextureFormat,
- PULONG ColorSpace,
- PULONG Width,
- PULONG Height);
-
-/**
- * A step of EDRAM retraining. Returns 0 when nothing is due: VdHSIOTrainCount
- * (export 0x26B) is nonzero and Flags has bit 1 clear. In state 0 it sets
- * *State to 1, returns 1 and leaves *Commands alone, so a call with a null
- * *Commands asks whether retraining is due. D3D then calls it with *Commands
- * at free ring space until it returns 0, and takes the advanced *Commands as
- * the end of what was written. Returns 0 without effect when *State is above
- * 7, Capacity (dwords) below 0x928 or WorkBytes below 0x5C. A null State
- * traps.
- */
-XBOXKRNL_IMPORT(0x269) ULONG VdRetrainEDRAM(
- ULONG Flags,
- PULONG *Commands,
- ULONG Capacity,
- PULONG State,
- PUCHAR Work,
- ULONG WorkBytes);
-
-/**
- * When VdHSIOTrainCount is 0: sends message 7 to the system management
- * controller and stores byte 6 of the reply as the current EDRAM temperature
- * of the retraining state. Returns 0.
- */
-XBOXKRNL_IMPORT(0x26A) ULONG VdRetrainEDRAMWorker(ULONG Reserved);
-
-/**
- * Calls Routine with each display mode the attached display supports; the
- * routine returns nonzero to continue.
- */
-XBOXKRNL_IMPORT(0x270) VOID VdEnumerateVideoModes(PVD_ENUMERATE_VIDEO_MODES_ROUTINE Routine, PVOID Context);
-
-/** Fills Data with the display discovery result; nonzero on success. */
-XBOXKRNL_IMPORT(0x27E) ULONG VdGetDisplayDiscoveryData(PVD_DISPLAY_DISCOVERY_DATA Data);
-
-XBOX360_EXTERN_C_END
-
-#endif
diff --git a/platform/xex/sdk/include/xbox360/xboxkrnl/xaudio.h b/platform/xex/sdk/include/xbox360/xboxkrnl/xaudio.h
deleted file mode 100644
index e9e39c9..0000000
--- a/platform/xex/sdk/include/xbox360/xboxkrnl/xaudio.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Audio render driver.
- */
-
-#ifndef XBOX360_XBOXKRNL_XAUDIO_H
-#define XBOX360_XBOXKRNL_XAUDIO_H
-
-#include <xbox360/xboxkrnl/ntdef.h>
-
-XBOX360_EXTERN_C_START
-
-/* Argument of a render driver client callback, built for each frame. */
-typedef struct _XAUDIORENDERDRVCALLBACKDATA {
- PVOID Context;
-} XAUDIORENDERDRVCALLBACKDATA, *PXAUDIORENDERDRVCALLBACKDATA;
-
-C_ASSERT(sizeof(XAUDIORENDERDRVCALLBACKDATA) == 4);
-
-typedef VOID (*PXAUDIORENDERDRVCALLBACK)(PXAUDIORENDERDRVCALLBACKDATA CallbackData);
-
-/* Render driver client: the callback runs once per audio frame. */
-typedef struct _XAUDIORENDERDRVCLIENT {
- PXAUDIORENDERDRVCALLBACK Callback;
- PVOID Context;
-} XAUDIORENDERDRVCLIENT, *PXAUDIORENDERDRVCLIENT;
-
-C_ASSERT(sizeof(XAUDIORENDERDRVCLIENT) == 8);
-
-/** Registers an audio render client. The client handle is stored at Client. */
-XBOXKRNL_IMPORT(0x1F3) HRESULT XAudioRegisterRenderDriverClient(const XAUDIORENDERDRVCLIENT *ClientData, PVOID *Client);
-
-/** Removes an audio render client. */
-XBOXKRNL_IMPORT(0x1F4) HRESULT XAudioUnregisterRenderDriverClient(PVOID Client);
-
-/** Submits a frame of samples for an audio render client. */
-XBOXKRNL_IMPORT(0x1F5) HRESULT XAudioSubmitRenderDriverFrame(PVOID Client, const FLOAT *Samples);
-
-/** Returns the audio render driver thread object. */
-XBOXKRNL_IMPORT(0x1FE) struct _KTHREAD *XAudioGetRenderDriverThread(VOID);
-
-/** Sets the speaker configuration (the XConfig audio flags value). */
-XBOXKRNL_IMPORT(0x200) HRESULT XAudioSetSpeakerConfig(ULONG SpeakerConfig, ULONG Reserved);
-
-XBOX360_EXTERN_C_END
-
-#endif
diff --git a/platform/xex/sdk/include/xbox360/xboxkrnl/xe.h b/platform/xex/sdk/include/xbox360/xboxkrnl/xe.h
deleted file mode 100644
index 3e940b6..0000000
--- a/platform/xex/sdk/include/xbox360/xboxkrnl/xe.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Kernel cryptography (XeCrypt) and security key (XeKeys) routines.
- */
-
-#ifndef XBOX360_XBOXKRNL_XE_H
-#define XBOX360_XBOXKRNL_XE_H
-
-#include <xbox360/xboxkrnl/ntdef.h>
-
-XBOX360_EXTERN_C_START
-
-/* DES key schedule of XeCryptDesKey: 16 rounds of two words. */
-typedef struct _XECRYPT_DES_STATE {
- ULONG KeyTable[32];
-} XECRYPT_DES_STATE, *PXECRYPT_DES_STATE;
-
-C_ASSERT(sizeof(XECRYPT_DES_STATE) == 0x80);
-
-/* Key id of XeKeysGetKey: the 12-digit console serial number. */
-#define XEKEYS_KEY_CONSOLE_SERIAL_NUMBER 0x14
-
-/* Console identifier: 5 bytes. */
-#define XE_CONSOLE_ID_SIZE 5
-
-typedef struct _XE_CONSOLE_ID {
- UCHAR Bytes[XE_CONSOLE_ID_SIZE];
-} XE_CONSOLE_ID, *PXE_CONSOLE_ID;
-
-C_ASSERT(sizeof(XE_CONSOLE_ID) == 5);
-
-/** Sets the parity bit of each byte of a DES key of InputSize bytes. */
-XBOXKRNL_IMPORT(0x174) VOID XeCryptDesParity(PCBYTE Input, ULONG InputSize, PBYTE Output);
-
-/** Expands an 8-byte DES key into DesState. */
-XBOXKRNL_IMPORT(0x175) VOID XeCryptDesKey(PXECRYPT_DES_STATE DesState, PCBYTE Key);
-
-/** Encrypts (Encrypt nonzero) or decrypts one 8-byte block in ECB mode. */
-XBOXKRNL_IMPORT(0x176) VOID XeCryptDesEcb(const XECRYPT_DES_STATE *DesState, PCBYTE Input, PBYTE Output, BOOL Encrypt);
-
-/**
- * HMAC-SHA1 of the concatenation of up to three buffers under Key; the
- * first OutputSize bytes of the digest go to Output. The dashboard passes
- * null buffers of size 0 for the unused ones.
- */
-XBOXKRNL_IMPORT(0x182) VOID XeCryptHmacSha(
- PCBYTE Key,
- ULONG KeySize,
- PCBYTE Input1,
- ULONG Input1Size,
- PCBYTE Input2,
- ULONG Input2Size,
- PCBYTE Input3,
- ULONG Input3Size,
- PBYTE Output,
- ULONG OutputSize
-);
-
-/**
- * MD5 of the concatenation of up to three buffers; the first OutputSize
- * bytes of the digest go to Output. The dashboard passes null buffers of
- * size 0 for the unused ones.
- */
-XBOXKRNL_IMPORT(0x187) VOID XeCryptMd5(
- PCBYTE Input1,
- ULONG Input1Size,
- PCBYTE Input2,
- ULONG Input2Size,
- PCBYTE Input3,
- ULONG Input3Size,
- PBYTE Output,
- ULONG OutputSize
-);
-
-/** Fills a buffer with random bytes. */
-XBOXKRNL_IMPORT(0x18A) VOID XeCryptRandom(PBYTE Buffer, ULONG Length);
-
-/**
- * Writes a boot loader image to flash. A nonzero StartOffset value on
- * return also indicates failure.
- */
-XBOXKRNL_IMPORT(0x23D) NTSTATUS XeKeysSaveBootLoader(PULONG StartOffset, PULONG Length, PVOID Buffer);
-
-/** Stores the security key status flags. */
-XBOXKRNL_IMPORT(0x23F) VOID XeKeysGetStatus(PULONG Status);
-
-/**
- * Copies the key KeyId into Buffer; Length holds the buffer size on entry
- * and the key size on return. Key 0x14 is the 12-digit console serial number.
- */
-XBOXKRNL_IMPORT(0x244) NTSTATUS XeKeysGetKey(ULONG KeyId, PVOID Buffer, PULONG Length);
-
-/**
- * Stores the 5-byte console ID and, when ConsoleIdString is not null, its
- * 12-character text form.
- */
-XBOXKRNL_IMPORT(0x246) NTSTATUS XeKeysGetConsoleID(PXE_CONSOLE_ID ConsoleId, PCHAR ConsoleIdString);
-
-/*
- * XeKeysGetConsoleType value bit: the console certificate is signed with
- * public key 0x3A; without it, with key 0x3C.
- */
-#define XE_CONSOLE_TYPE_KEY_3A 0x80000000
-
-/**
- * Stores the console type field of the console certificate (key 0x36).
- * Which values mean a development kit, a test kit or a retail console is
- * not established.
- */
-XBOXKRNL_IMPORT(0x247) NTSTATUS XeKeysGetConsoleType(PULONG ConsoleType);
-
-XBOX360_EXTERN_C_END
-
-#endif
diff --git a/platform/xex/sdk/include/xbox360/xboxkrnl/xex.h b/platform/xex/sdk/include/xbox360/xboxkrnl/xex.h
deleted file mode 100644
index e99d783..0000000
--- a/platform/xex/sdk/include/xbox360/xboxkrnl/xex.h
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * XEX loader: loaded module records, XEX headers and the Xex routines.
- */
-
-#ifndef XBOX360_XBOXKRNL_XEX_H
-#define XBOX360_XBOXKRNL_XEX_H
-
-#include <xbox360/xboxkrnl/ntdef.h>
-
-XBOX360_EXTERN_C_START
-
-/* XEX_HEADER.ModuleFlags, and the module flags of XexLoadImage. */
-#define XEX_MODULE_FLAG_TITLE 0x00000001
-#define XEX_MODULE_FLAG_EXPORTS_TO_TITLE 0x00000002
-#define XEX_MODULE_FLAG_SYSTEM_DEBUGGER 0x00000004
-#define XEX_MODULE_FLAG_DLL 0x00000008
-#define XEX_MODULE_FLAG_PATCH 0x00000010
-#define XEX_MODULE_FLAG_PATCH_FULL 0x00000020
-#define XEX_MODULE_FLAG_PATCH_DELTA 0x00000040
-#define XEX_MODULE_FLAG_USER_MODE 0x00000080
-
-/* Options of XexLoadImage, beside the module flags. */
-#define XEX_LOAD_FLAG_REQUIRE_DEVICE_ID 0x20000000
-#define XEX_LOAD_FLAG_REQUIRE_BOUND_PATH 0x40000000
-#define XEX_LOAD_FLAG_NO_FAILURE_REPORT 0x80000000
-
-/*
- * Packed XEX version: 4, 4, 16 and 8 bits of major, minor, build and qfe
- * from the top. As a minimum version, XEX_VERSION_ANY accepts every image.
- */
-#define XEX_VERSION(Major, Minor, Build, Qfe) \
- ((ULONG)(((Major) & 0xF) << 28 | ((Minor) & 0xF) << 24 | ((Build) & 0xFFFF) << 8 | ((Qfe) & 0xFF)))
-#define XEX_VERSION_ANY 0
-
-/* Module handle argument that stands for the module of the caller. */
-#define XEX_MODULE_HANDLE_CALLER ((PLDR_DATA_TABLE_ENTRY)-1)
-
-/* Reason the loader passes to the entry point of a module. */
-#define DLL_PROCESS_DETACH 0
-#define DLL_PROCESS_ATTACH 1
-
-/*
- * Entry of a C or C++ DLL or system module that links xbox360//src/sdk:crt-dll,
- * which calls it with C linkage. FALSE on DLL_PROCESS_ATTACH fails the load.
- */
-BOOL DllMain(HANDLE Module, DWORD Reason, PVOID Reserved);
-
-/*
- * Optional header entry. The low byte of Key gives the form of the data:
- * 0, Value is the data; 1, Value holds one ULONG; 0xFF, Value is the offset
- * of data that starts with its ULONG size; otherwise Value is the offset of
- * Key & 0xFF ULONGs. XEX headers are big-endian.
- */
-typedef struct _XEX_OPTIONAL_HEADER {
- ULONG Key;
- ULONG Value;
-} XEX_OPTIONAL_HEADER, *PXEX_OPTIONAL_HEADER;
-
-C_ASSERT(sizeof(XEX_OPTIONAL_HEADER) == 8);
-
-#define XEX_HEADER_MAGIC 0x58455832 /* 'XEX2' */
-
-typedef struct _XEX_HEADER {
- ULONG Magic;
- ULONG ModuleFlags;
- ULONG SizeOfHeaders;
- ULONG SizeOfDiscardableHeaders;
- ULONG SecurityInfo;
- ULONG OptionalHeaderCount;
- XEX_OPTIONAL_HEADER OptionalHeaders[1];
-} XEX_HEADER, *PXEX_HEADER;
-
-C_ASSERT(sizeof(XEX_HEADER) == 0x20);
-C_ASSERT(__builtin_offsetof(XEX_HEADER, OptionalHeaders) == 0x18);
-
-/* Optional header keys. */
-#define XEX_HEADER_RESOURCE_INFO 0x000002FF
-#define XEX_HEADER_FILE_FORMAT_INFO 0x000003FF
-#define XEX_HEADER_DELTA_PATCH_DESCRIPTOR 0x000005FF
-#define XEX_HEADER_CONSOLE_FEATURES 0x00004004
-#define XEX_HEADER_VALIDITY_PERIOD 0x00004104
-#define XEX_HEADER_CONSOLE_ID_LIST 0x000042FF
-#define XEX_HEADER_BOUNDING_PATH 0x000080FF
-#define XEX_HEADER_DEVICE_ID 0x00008105
-#define XEX_HEADER_ORIGINAL_BASE_ADDRESS 0x00010001
-#define XEX_HEADER_ENTRY_POINT 0x00010100
-#define XEX_HEADER_IMAGE_BASE_ADDRESS 0x00010201
-#define XEX_HEADER_IMPORT_LIBRARIES 0x000103FF
-#define XEX_HEADER_CHECKSUM_TIMESTAMP 0x00018002
-#define XEX_HEADER_ENABLED_FOR_CALLCAP 0x00018102
-#define XEX_HEADER_ENABLED_FOR_FASTCAP 0x00018200
-#define XEX_HEADER_ORIGINAL_PE_NAME 0x000183FF
-/* 16-byte entries {Name[8], Major, Minor, Build, Qfe} after the size. */
-#define XEX_HEADER_STATIC_LIBRARIES 0x000200FF
-#define XEX_HEADER_TLS_INFO 0x00020104
-#define XEX_HEADER_DEFAULT_STACK_SIZE 0x00020200
-#define XEX_HEADER_FILESYSTEM_CACHE_SIZE 0x00020301
-#define XEX_HEADER_SYSTEM_FLAGS 0x00030000
-#define XEX_HEADER_EXECUTION_INFO 0x00040006
-#define XEX_HEADER_TITLE_WORKSPACE_SIZE 0x00040201
-#define XEX_HEADER_LAN_KEY 0x00040404
-#define XEX_HEADER_ADDITIONAL_TITLE_MEMORY 0x00040801
-
-/* Data of XEX_HEADER_EXECUTION_INFO. */
-typedef struct _XEX_EXECUTION_INFO {
- ULONG MediaId;
- ULONG Version;
- ULONG BaseVersion;
- ULONG TitleId;
- UCHAR Platform;
- UCHAR ExecutableType;
- UCHAR DiscNumber;
- UCHAR DiscCount;
- ULONG SavegameId;
-} XEX_EXECUTION_INFO, *PXEX_EXECUTION_INFO;
-
-C_ASSERT(sizeof(XEX_EXECUTION_INFO) == 0x18);
-C_ASSERT(__builtin_offsetof(XEX_EXECUTION_INFO, TitleId) == 0xC);
-C_ASSERT(__builtin_offsetof(XEX_EXECUTION_INFO, SavegameId) == 0x14);
-
-/* Imports of a module: Count entries, NULL for an import that is not loaded. */
-typedef struct _LDR_IMPORT_TABLE {
- ULONG Count;
- struct _LDR_DATA_TABLE_ENTRY *Entries[1];
-} LDR_IMPORT_TABLE, *PLDR_IMPORT_TABLE;
-
-C_ASSERT(sizeof(LDR_IMPORT_TABLE) == 8);
-
-/*
- * The loader's record of a loaded module. Its address is the module
- * handle. The loader changes the links and the flags under its lock.
- */
-typedef struct _LDR_DATA_TABLE_ENTRY {
- LIST_ENTRY InLoadOrderLinks;
- LIST_ENTRY InClosureOrderLinks;
- LIST_ENTRY InInitializationOrderLinks;
- PVOID NtHeadersBase; /* address the image is loaded at */
- PVOID ImageBase;
- ULONG SizeOfNtImage;
- UNICODE_STRING FullDllName;
- UNICODE_STRING BaseDllName;
- ULONG Flags;
- ULONG SizeOfFullImage;
- PVOID EntryPoint;
- USHORT LoadCount;
- USHORT ModuleIndex;
- PVOID OriginalBaseAddress; /* function table in kernel 17559 and later */
- ULONG CheckSum;
- ULONG ModuleFlags; /* XEX_HEADER.ModuleFlags */
- ULONG TimeDateStamp;
- PLDR_IMPORT_TABLE LoadedImports;
- PXEX_HEADER XexHeaderBase;
- union {
- ANSI_STRING LoadFileName;
- struct {
- struct _LDR_DATA_TABLE_ENTRY *ClosureRoot;
- struct _LDR_DATA_TABLE_ENTRY *TraversalParent;
- } s;
- } u;
-} LDR_DATA_TABLE_ENTRY, *PLDR_DATA_TABLE_ENTRY;
-
-C_ASSERT(sizeof(LDR_DATA_TABLE_ENTRY) == 0x64);
-C_ASSERT(__builtin_offsetof(LDR_DATA_TABLE_ENTRY, NtHeadersBase) == 0x18);
-C_ASSERT(__builtin_offsetof(LDR_DATA_TABLE_ENTRY, SizeOfNtImage) == 0x20);
-C_ASSERT(__builtin_offsetof(LDR_DATA_TABLE_ENTRY, FullDllName) == 0x24);
-C_ASSERT(__builtin_offsetof(LDR_DATA_TABLE_ENTRY, BaseDllName) == 0x2C);
-C_ASSERT(__builtin_offsetof(LDR_DATA_TABLE_ENTRY, Flags) == 0x34);
-C_ASSERT(__builtin_offsetof(LDR_DATA_TABLE_ENTRY, TimeDateStamp) == 0x50);
-C_ASSERT(__builtin_offsetof(LDR_DATA_TABLE_ENTRY, XexHeaderBase) == 0x58);
-
-/* LDR_DATA_TABLE_ENTRY.Flags */
-#define LDR_FLAG_LOAD_IN_PROGRESS 0x00001000
-#define LDR_FLAG_UNLOAD_PENDING 0x00002000
-
-/** Module handle of the running executable: the address of its loader entry. */
-XBOXKRNL_IMPORT(0x193) extern PLDR_DATA_TABLE_ENTRY *__imp_XexExecutableModuleHandle;
-#define XexExecutableModuleHandle (*__imp_XexExecutableModuleHandle)
-
-/** Finds a loaded module by name and stores its handle. */
-XBOXKRNL_IMPORT(0x195) NTSTATUS XexGetModuleHandle(PCSZ ModuleName, PLDR_DATA_TABLE_ENTRY *ModuleHandle);
-
-/**
- * Finds the resource SectionName of a module and stores its address and
- * size. SectionName must equal the stored name, which is at most 8 bytes,
- * byte for byte, so case is significant. XEX_MODULE_HANDLE_CALLER as Module
- * names the caller's module. Fails with STATUS_NOT_FOUND when the module
- * has no such resource.
- */
-XBOXKRNL_IMPORT(0x196) NTSTATUS XexGetModuleSection(
- PLDR_DATA_TABLE_ENTRY Module,
- PCSZ SectionName,
- PVOID *SectionData,
- PULONG SectionSize
-);
-
-/**
- * Finds an export of a module by ordinal and stores its address. Ordinal
- * may instead be the address of a NUL-terminated export name.
- */
-XBOXKRNL_IMPORT(0x197) NTSTATUS XexGetProcedureAddress(
- PLDR_DATA_TABLE_ENTRY ModuleHandle,
- ULONG Ordinal,
- PVOID *ProcedureAddress
-);
-
-/**
- * Loads a XEX image and stores its module handle. MinimumVersion is the
- * oldest version accepted (see XEX_VERSION).
- */
-XBOXKRNL_IMPORT(0x199) NTSTATUS XexLoadImage(
- PCSZ ImageName,
- ULONG LoadFlags,
- ULONG MinimumVersion,
- PLDR_DATA_TABLE_ENTRY *ModuleHandle
-);
-
-/**
- * Loads a XEX image from ImageSize bytes at ImageBuffer under the module
- * name ImageName and stores its module handle. ImageName must be a bare
- * name without a path (STATUS_OBJECT_PATH_INVALID otherwise), and a
- * module of that name must not be loaded (STATUS_OBJECT_NAME_COLLISION).
- * The DLL bit of LoadFlags must equal that of the image's module flags;
- * without it the image loads as the title. MinimumVersion is the oldest
- * version accepted (see XEX_VERSION).
- */
-XBOXKRNL_IMPORT(0x19A) NTSTATUS XexLoadImageFromMemory(
- PVOID ImageBuffer,
- ULONG ImageSize,
- PCSZ ImageName,
- ULONG LoadFlags,
- ULONG MinimumVersion,
- PLDR_DATA_TABLE_ENTRY *ModuleHandle
-);
-
-/** Finds the loader entry of the module that contains an address. Returns the image base. */
-XBOXKRNL_IMPORT(0x19C) PVOID XexPcToFileHeader(PVOID PcValue, PLDR_DATA_TABLE_ENTRY *DataTableEntry);
-
-/** Unloads a XEX image. */
-XBOXKRNL_IMPORT(0x1A1) NTSTATUS XexUnloadImage(PLDR_DATA_TABLE_ENTRY ModuleHandle);
-
-XBOX360_EXTERN_C_END
-
-#endif
diff --git a/platform/xex/sdk/include/xbox360/xboxkrnl/xma.h b/platform/xex/sdk/include/xbox360/xboxkrnl/xma.h
deleted file mode 100644
index efb5423..0000000
--- a/platform/xex/sdk/include/xbox360/xboxkrnl/xma.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Hardware XMA audio decoder contexts.
- */
-
-#ifndef XBOX360_XBOXKRNL_XMA_H
-#define XBOX360_XBOXKRNL_XMA_H
-
-#include <xbox360/xboxkrnl/ntdef.h>
-
-XBOX360_EXTERN_C_START
-
-/*
- * Hardware context of the XMA decoder, 64 bytes in an array that the decoder
- * reads from physical memory. Bitfields are assigned from the most
- * significant bit. Buffer offsets and counts are in the units of the
- * decoder: input packets of 2 KB, output blocks of 256 bytes.
- */
-typedef struct _XMA_CONTEXT_DATA {
- /* DWORD 0 */
- DWORD OutputBufferWriteOffset : 5;
- DWORD OutputBufferBlockCount : 5;
- DWORD InputBuffer1Valid : 1;
- DWORD InputBuffer0Valid : 1;
- DWORD LoopCount : 8;
- DWORD InputBuffer0PacketCount : 12;
-
- /* DWORD 1 */
- DWORD OutputBufferValid : 1;
- DWORD Reserved1A : 1;
- DWORD IsStereo : 1;
- DWORD SampleRate : 2;
- DWORD Reserved1B : 3;
- DWORD SubframeDecodeCount : 4;
- DWORD LoopSubframeSkip : 3;
- DWORD Reserved1C : 3;
- DWORD LoopSubframeEnd : 2;
- DWORD InputBuffer1PacketCount : 12;
-
- /* DWORD 2 */
- DWORD Reserved2 : 6;
- DWORD InputBufferReadOffset : 26;
-
- /* DWORD 3 */
- DWORD Reserved3 : 6;
- DWORD LoopStartOffset : 26;
-
- /* DWORD 4 */
- DWORD Reserved4A : 1;
- DWORD PacketMetadata : 5;
- DWORD LoopEndOffset : 26;
-
- /* DWORDs 5 to 8: physical addresses. */
- DWORD InputBuffer0;
- DWORD InputBuffer1;
- DWORD OutputBuffer;
- DWORD WorkBuffer;
-
- /* DWORD 9 */
- DWORD Reserved9 : 27;
- DWORD OutputBufferReadOffset : 5;
-
- /* DWORDs 10 to 15. */
- DWORD Reserved[6];
-} XMA_CONTEXT_DATA, *PXMA_CONTEXT_DATA;
-
-C_ASSERT(__builtin_offsetof(XMA_CONTEXT_DATA, InputBuffer0) == 0x14);
-C_ASSERT(sizeof(XMA_CONTEXT_DATA) == 0x40);
-
-/* Loop region of a context. Offsets are bit offsets in the input stream. */
-typedef struct _XMA_LOOP_DATA {
- DWORD LoopStartOffset;
- DWORD LoopEndOffset;
- UCHAR LoopCount;
- UCHAR LoopSubframeEnd;
- UCHAR LoopSubframeSkip;
- UCHAR Reserved;
-} XMA_LOOP_DATA, *PXMA_LOOP_DATA;
-
-C_ASSERT(sizeof(XMA_LOOP_DATA) == 0xC);
-
-/*
- * Initial state of a context for XMAInitializeContext. Buffers are virtual
- * addresses of physically contiguous memory.
- */
-typedef struct _XMA_CONTEXT_INIT {
- PVOID InputBuffer0;
- DWORD InputBuffer0PacketCount;
- PVOID InputBuffer1;
- DWORD InputBuffer1PacketCount;
- DWORD InputBufferReadOffset;
- PVOID OutputBuffer;
- DWORD OutputBufferBlockCount;
- PVOID WorkBuffer;
- DWORD SubframeDecodeCount;
- DWORD IsStereo;
- DWORD SampleRate;
- XMA_LOOP_DATA LoopData;
-} XMA_CONTEXT_INIT, *PXMA_CONTEXT_INIT;
-
-C_ASSERT(__builtin_offsetof(XMA_CONTEXT_INIT, LoopData) == 0x2C);
-C_ASSERT(sizeof(XMA_CONTEXT_INIT) == 0x38);
-
-/** Allocates one hardware XMA decoder context. */
-XBOXKRNL_IMPORT(0x224) HRESULT XMACreateContext(PXMA_CONTEXT_DATA *Context);
-
-/** Initializes an allocated XMA decoder context. */
-XBOXKRNL_IMPORT(0x225) VOID XMAInitializeContext(PXMA_CONTEXT_DATA Context, const XMA_CONTEXT_INIT *ContextInit);
-
-/** Releases a hardware XMA decoder context. */
-XBOXKRNL_IMPORT(0x226) VOID XMAReleaseContext(PXMA_CONTEXT_DATA Context);
-
-/** Enables a hardware XMA decoder context. */
-XBOXKRNL_IMPORT(0x227) VOID XMAEnableContext(PXMA_CONTEXT_DATA Context);
-
-/** Disables a hardware XMA decoder context. Wait waits for in-flight decoder work. */
-XBOXKRNL_IMPORT(0x228) HRESULT XMADisableContext(PXMA_CONTEXT_DATA Context, BOOL Wait);
-
-/** Returns the decoder's output ring write offset in 256-byte blocks. */
-XBOXKRNL_IMPORT(0x229) DWORD XMAGetOutputBufferWriteOffset(PXMA_CONTEXT_DATA Context);
-
-/** Sets the output ring read offset in 256-byte blocks. */
-XBOXKRNL_IMPORT(0x22A) VOID XMASetOutputBufferReadOffset(PXMA_CONTEXT_DATA Context, DWORD Offset);
-
-/** Returns the output ring read offset in 256-byte blocks. */
-XBOXKRNL_IMPORT(0x22B) DWORD XMAGetOutputBufferReadOffset(PXMA_CONTEXT_DATA Context);
-
-/** Marks the output ring of an XMA decoder context valid. */
-XBOXKRNL_IMPORT(0x22C) VOID XMASetOutputBufferValid(PXMA_CONTEXT_DATA Context);
-
-/** Returns whether the output ring is valid. */
-XBOXKRNL_IMPORT(0x22D) BOOL XMAIsOutputBufferValid(PXMA_CONTEXT_DATA Context);
-
-/** Marks input buffer zero of an XMA decoder context valid. */
-XBOXKRNL_IMPORT(0x22E) VOID XMASetInputBuffer0Valid(PXMA_CONTEXT_DATA Context);
-
-/** Returns whether input buffer zero is valid. */
-XBOXKRNL_IMPORT(0x22F) BOOL XMAIsInputBuffer0Valid(PXMA_CONTEXT_DATA Context);
-
-/** Waits until the decoder is not working on Context. */
-XBOXKRNL_IMPORT(0x235) VOID XMABlockWhileInUse(PXMA_CONTEXT_DATA Context);
-
-XBOX360_EXTERN_C_END
-
-#endif
diff --git a/platform/xex/sdk/thunks/macros.inc b/platform/xex/sdk/thunks/macros.inc
deleted file mode 100644
index 506424a..0000000
--- a/platform/xex/sdk/thunks/macros.inc
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Macros of the import thunk library. src/tools/xbox360-bindgen writes one
- * invocation of them per import into ppc32.S and ppc64.S.
- *
- * A thunk is 16 bytes: the import record (type << 24 | library << 16 |
- * ordinal), then nop; nop; blr, which only runs if the loader never patches
- * it. The loader rewrites the thunk to call the export.
- *
- * Each function, thunk and slot is in its own section, so that
- * --gc-sections drops the imports nobody uses. Each symbol is weak and
- * defined once per assembly unit, so separate copies of the library link
- * together and can share one unit, such as a fat LTO module.
- */
-
-.ifndef .Lxbox360_thunk_macros
-.set .Lxbox360_thunk_macros, 1
-
-.macro xbox360_thunk_words record
- .long \record
- .long 0x60000000
- .long 0x60000000
- .long 0x4e800020
-.endm
-
-/* A function import that is its thunk (powerpc64 ILP32 callers). */
-.macro xbox360_thunk name, record
-.ifndef \name
- .pushsection .xthunks.\name, "ax", @progbits
- .balign 4
- .weak \name
- .type \name, @function
-\name:
- xbox360_thunk_words \record
- .size \name, 16
- .popsection
-.endif
-.endm
-
-/* A data import slot, which the loader sets to the address of the export. */
-.macro xbox360_slot name, record
-.ifndef \name
- .pushsection .xvars.\name, "aw", @progbits
- .balign 4
- .weak \name
- .type \name, @object
- .size \name, 4
-\name:
- .long \record
- .popsection
-.endif
-.endm
-
-/*
- * The start of a function \name that calls the thunk of the import. Close
- * it with xbox360_end.
- */
-.macro xbox360_function name
- .pushsection .text.xbox360_import.\name, "ax", @progbits
- .balign 4
- .weak \name
- .type \name, @function
-\name:
-.endm
-
-/*
- * A frame of \frame bytes with the home area of r3-r10 at 0x10-0x50, which
- * console callees store their arguments in.
- */
-.macro xbox360_frame frame
- stwu 1, -\frame(1)
- mflr 0
- stw 0, \frame+4(1)
-.endm
-
-.macro xbox360_call name
- bl .Lxbox360_thunk_\name
-.endm
-
-/*
- * Convert the result of the export for a SysV caller: a 64-bit integer goes
- * to r3 (high) and r4 (low), and the bits above a narrow integer, which the
- * export leaves undefined, are extended.
- */
-.macro xbox360_result kind
-.ifc \kind, u64
- mr 4, 3
- rldicl 3, 3, 32, 32
-.endif
-.ifc \kind, u8
- clrlwi 3, 3, 24
-.endif
-.ifc \kind, u16
- clrlwi 3, 3, 16
-.endif
-.ifc \kind, i8
- extsb 3, 3
-.endif
-.ifc \kind, i16
- extsh 3, 3
-.endif
-.endm
-
-.macro xbox360_return frame
- lwz 0, \frame+4(1)
- mtlr 0
- addi 1, 1, \frame
- blr
-.endm
-
-/* The end of the function \name, and its thunk. */
-.macro xbox360_end name, record
- .size \name, .-\name
- .section .xthunks.\name, "ax", @progbits
- .balign 4
-.Lxbox360_thunk_\name:
- xbox360_thunk_words \record
- .popsection
-.endm
-
-/*
- * A function import for SysV (powerpc) callers whose arguments need no
- * moves: it adds the home area and converts the result `kind`.
- */
-.macro xbox360_stub name, record, kind=word
-.ifndef \name
- xbox360_function \name
- xbox360_frame 0x50
- xbox360_call \name
- xbox360_result \kind
- xbox360_return 0x50
- xbox360_end \name, \record
-.endif
-.endm
-
-/*
- * A function import that does not return. It traps if the export returns
- * anyway, as Xenia's KeBugCheck does. `frame` is 0 when the caller already
- * reserves the home area (powerpc64 ILP32).
- */
-.macro xbox360_noreturn name, record, frame=0x50
-.ifndef \name
- xbox360_function \name
-.if \frame
- xbox360_frame \frame
-.endif
- xbox360_call \name
- trap
- xbox360_end \name, \record
-.endif
-.endm
-
-.endif
diff --git a/platform/xex/sdk/thunks/ppc32.S b/platform/xex/sdk/thunks/ppc32.S
deleted file mode 100644
index 6777226..0000000
--- a/platform/xex/sdk/thunks/ppc32.S
+++ /dev/null
@@ -1,862 +0,0 @@
-/* @generated by src/tools/xbox360-bindgen from src/sdk/include. Do not edit. */
-#include "macros.inc"
-
-xbox360_stub CreateEventA, 0x01010446
-xbox360_stub CreateFileA, 0x01010447
-xbox360_stub DbgBreakPoint, 0x01000001
-xbox360_stub DbgPrint, 0x01000003
-xbox360_stub DumpWriteDump, 0x01000006
-xbox360_stub DuplicateHandle, 0x0101045b
-xbox360_stub ExAllocatePoolTypeWithTag, 0x0100000b
-xbox360_stub ExAllocatePoolWithTag, 0x0100000a
-xbox360_stub ExCreateThread, 0x0100000d
-xbox360_stub ExDebugMonitorService, 0x010001aa
-xbox360_stub ExExpansionCall, 0x0100030c
-xbox360_stub ExExpansionInstall, 0x0100030b
-xbox360_stub ExFreePool, 0x0100000f
-xbox360_stub ExGetXConfigSetting, 0x01000010
-xbox360_stub ExReadModifyWriteXConfigSettingUlong, 0x010002bc
-xbox360_stub ExRegisterThreadNotification, 0x01000014
-xbox360_stub ExRegisterTitleTerminateNotification, 0x01000015
-xbox360_stub ExSetXConfigSetting, 0x01000018
-xbox360_noreturn ExTerminateThread, 0x01000019
-xbox360_stub FscGetCacheElementCount, 0x01000020
-xbox360_stub FscSetCacheElementCount, 0x01000021
-xbox360_stub GetCurrentThreadId, 0x01010410
-xbox360_stub GetLocalTime, 0x01010444
-xbox360_stub GetProcessHeap, 0x010107d2
-xbox360_stub HalGetCurrentAVPack, 0x01000022
-xbox360_stub HalIsExecutingPowerDownDpc, 0x01000267
-xbox360_stub HalOpenCloseODDTray, 0x01000024
-xbox360_stub HalRegisterSMCNotification, 0x01000027
-xbox360_stub HalReturnToFirmware, 0x01000028
-xbox360_stub HalSendSMCMessage, 0x01000029
-xbox360_stub InterlockedFlushSList, 0x0100002b
-xbox360_stub InterlockedPopEntrySList, 0x0100002c
-xbox360_stub IoAcquireDeviceObjectLock, 0x0100002e, u8
-xbox360_stub IoAllocateIrp, 0x0100002f
-xbox360_stub IoCompleteRequest, 0x01000035
-xbox360_stub IoCreateDevice, 0x01000037
-xbox360_stub IoDismountVolume, 0x0100003b
-xbox360_stub IoDismountVolumeByFileHandle, 0x0100003c
-xbox360_stub IoInvalidDeviceRequest, 0x01000041
-xbox360_stub IoReleaseDeviceObjectLock, 0x01000044
-xbox360_stub IoStartNextPacket, 0x01000048
-xbox360_stub IoStartPacket, 0x0100004a
-xbox360_stub IoSynchronousDeviceIoControlRequest, 0x0100004b
-xbox360_stub IoSynchronousFsdRequest, 0x0100004c
-xbox360_stub KeAcquireSpinLockAtRaisedIrql, 0x0100004d
-xbox360_noreturn KeBugCheck, 0x01000052
-xbox360_noreturn KeBugCheckEx, 0x01000053
-xbox360_stub KeCancelTimer, 0x01000054, u8
-xbox360_stub KeContextFromKframes, 0x01000056
-xbox360_stub KeDelayExecutionThread, 0x0100005a
-xbox360_stub KeEnablePPUPerformanceMonitor, 0x0100005e
-xbox360_stub KeEnterCriticalRegion, 0x0100005f
-xbox360_stub KeFlushCacheRange, 0x01000061
-xbox360_stub KeGetCurrentProcessType, 0x01000066
-xbox360_stub KeGetPMWRegister, 0x01000067, u64
-xbox360_stub KeGetSpecialPurposeRegister, 0x0100006a
-xbox360_stub KeInitializeDpc, 0x0100006f
-xbox360_stub KeInitializeEvent, 0x01000070
-xbox360_stub KeInitializeSemaphore, 0x01000074
-xbox360_stub KeInitializeTimerEx, 0x01000075
-xbox360_stub KeInsertQueueDpc, 0x0100007b, u8
-xbox360_stub KeIpiGenericCall, 0x0100007c
-xbox360_stub KeLeaveCriticalRegion, 0x0100007d
-xbox360_stub KeQueryPerformanceFrequency, 0x01000083, u64
-xbox360_stub KeQuerySystemTime, 0x01000084
-xbox360_stub KeRaiseIrqlToDpcLevel, 0x01000085, u8
-xbox360_stub KeReleaseSemaphore, 0x01000088
-xbox360_stub KeReleaseSpinLockFromRaisedIrql, 0x01000089
-xbox360_stub KeRemoveQueueDpc, 0x0100008e, u8
-xbox360_stub KeResetEvent, 0x0100008f
-xbox360_stub KeResumeThread, 0x01000092
-xbox360_stub KeSetAffinityThread, 0x01000097
-xbox360_stub KeSetBasePriorityThread, 0x01000099
-xbox360_stub KeSetEvent, 0x0100009d
-
-.ifndef KeSetPMWRegister
- xbox360_function KeSetPMWRegister
- xbox360_frame 0x50
- stw 5, 0x18(1)
- stw 6, 0x1c(1)
- lwz 4, 0x1c(1)
- lwz 11, 0x18(1)
- rldimi 4, 11, 32, 0
- xbox360_call KeSetPMWRegister
- xbox360_return 0x50
- xbox360_end KeSetPMWRegister, 0x0100009f
-.endif
-
-
-.ifndef KeSetPRVRegister
- xbox360_function KeSetPRVRegister
- xbox360_frame 0x50
- stw 5, 0x18(1)
- stw 6, 0x1c(1)
- lwz 4, 0x1c(1)
- lwz 11, 0x18(1)
- rldimi 4, 11, 32, 0
- xbox360_call KeSetPRVRegister
- xbox360_return 0x50
- xbox360_end KeSetPRVRegister, 0x010000a1
-.endif
-
-xbox360_stub KeSetPriorityThread, 0x010000a3
-
-.ifndef KeSetSpecialPurposeRegister
- xbox360_function KeSetSpecialPurposeRegister
- xbox360_frame 0x50
- stw 5, 0x18(1)
- stw 6, 0x1c(1)
- lwz 4, 0x1c(1)
- lwz 11, 0x18(1)
- rldimi 4, 11, 32, 0
- xbox360_call KeSetSpecialPurposeRegister
- xbox360_return 0x50
- xbox360_end KeSetSpecialPurposeRegister, 0x010000a5
-.endif
-
-
-.ifndef KeSetTimerEx
- xbox360_function KeSetTimerEx
- xbox360_frame 0x50
- stw 5, 0x18(1)
- stw 6, 0x1c(1)
- stw 7, 0x20(1)
- stw 8, 0x24(1)
- lwz 4, 0x1c(1)
- lwz 11, 0x18(1)
- rldimi 4, 11, 32, 0
- lwz 5, 0x20(1)
- lwz 6, 0x24(1)
- xbox360_call KeSetTimerEx
- xbox360_result u8
- xbox360_return 0x50
- xbox360_end KeSetTimerEx, 0x010000a7
-.endif
-
-xbox360_stub KeStallExecutionProcessor, 0x010000a8
-xbox360_stub KeSuspendThread, 0x010000a9
-xbox360_stub KeSweepIcacheRange, 0x010000ab
-xbox360_stub KeTlsAlloc, 0x01000152
-xbox360_stub KeTlsFree, 0x01000153, u8
-xbox360_stub KeTlsGetValue, 0x01000154
-xbox360_stub KeTlsSetValue, 0x01000155, u8
-xbox360_stub KeTryToAcquireSpinLockAtRaisedIrql, 0x010000ae, u8
-xbox360_stub KeWaitForMultipleObjects, 0x010000af
-xbox360_stub KeWaitForSingleObject, 0x010000b0
-xbox360_stub KfAcquireSpinLock, 0x010000b1, u8
-xbox360_stub KfLowerIrql, 0x010000b3
-xbox360_stub KfRaiseIrql, 0x010000b2, u8
-xbox360_stub KfReleaseSpinLock, 0x010000b4
-xbox360_stub MmAllocatePhysicalMemory, 0x010000b9
-xbox360_stub MmAllocatePhysicalMemoryEx, 0x010000ba
-xbox360_stub MmDbgReadCheck, 0x010001ab
-xbox360_stub MmDbgReleaseAddress, 0x010001ac
-xbox360_stub MmDbgWriteCheck, 0x010001ad
-xbox360_stub MmFreePhysicalMemory, 0x010000bd
-xbox360_stub MmGetPhysicalAddress, 0x010000be
-xbox360_stub MmIsAddressValid, 0x010000bf, u8
-xbox360_stub MmQueryAddressProtect, 0x010000c4
-xbox360_stub MmQueryAllocationSize, 0x010000c5
-xbox360_stub MmQueryStatistics, 0x010000c6
-xbox360_stub NetDll_UpnpCleanup, 0x010100fc
-xbox360_stub NetDll_UpnpStartup, 0x010100fb
-xbox360_stub NetDll_WSAEventSelect, 0x01010023
-xbox360_stub NetDll_WSAGetLastError, 0x0101001b
-xbox360_stub NetDll_WSAStartup, 0x01010001
-xbox360_stub NetDll_XHttpCloseHandle, 0x010100cc
-xbox360_stub NetDll_XHttpConnect, 0x010100cd
-xbox360_stub NetDll_XHttpDoWork, 0x010100d8
-xbox360_stub NetDll_XHttpOpen, 0x010100cb
-xbox360_stub NetDll_XHttpOpenRequest, 0x010100cf
-xbox360_stub NetDll_XHttpQueryHeaders, 0x010100d3
-xbox360_stub NetDll_XHttpReadData, 0x010100d4
-xbox360_stub NetDll_XHttpReceiveResponse, 0x010100d2
-xbox360_stub NetDll_XHttpSendRequest, 0x010100d1
-xbox360_stub NetDll_XHttpSetOption, 0x010100d7
-xbox360_stub NetDll_XHttpSetStatusCallback, 0x010100ce
-xbox360_stub NetDll_XHttpShutdown, 0x010100ca
-xbox360_stub NetDll_XHttpStartup, 0x010100c9
-xbox360_stub NetDll_XNetGetDebugXnAddr, 0x0101004a
-xbox360_stub NetDll_XNetGetEthernetLinkStatus, 0x0101004b
-xbox360_stub NetDll_XNetGetOpt, 0x0101004e
-xbox360_stub NetDll_XNetGetTitleXnAddr, 0x01010049
-xbox360_stub NetDll_XNetRandom, 0x01010035
-xbox360_stub NetDll_XNetSetOpt, 0x0101004f
-xbox360_stub NetDll_XNetStartup, 0x01010033
-xbox360_stub NetDll_XNetStartupVersion, 0x01010050
-xbox360_stub NetDll_XnpConfig, 0x01010068
-xbox360_stub NetDll_XnpEthernetInterceptRecv, 0x0101006f
-xbox360_stub NetDll_XnpEthernetInterceptSetCallbacks, 0x0101006d
-xbox360_stub NetDll_XnpEthernetInterceptXmit, 0x0101006e
-xbox360_stub NetDll_XnpGetActiveSocketList, 0x0101007a
-xbox360_stub NetDll_XnpGetConfigStatus, 0x01010069
-xbox360_stub NetDll_XnpLoadConfigParams, 0x01010065
-xbox360_stub NetDll_XnpNoteSystemTime, 0x0101007b
-xbox360_stub NetDll_XnpSaveConfigParams, 0x01010066
-xbox360_stub NetDll_accept, 0x0101000e
-xbox360_stub NetDll_bind, 0x0101000b
-xbox360_stub NetDll_closesocket, 0x01010004
-xbox360_stub NetDll_connect, 0x0101000c
-xbox360_stub NetDll_getpeername, 0x0101000a
-xbox360_stub NetDll_getsockname, 0x01010009
-xbox360_stub NetDll_getsockopt, 0x01010008
-xbox360_stub NetDll_ioctlsocket, 0x01010006
-xbox360_stub NetDll_listen, 0x0101000d
-xbox360_stub NetDll_recv, 0x01010012
-xbox360_stub NetDll_recvfrom, 0x01010014
-xbox360_stub NetDll_select, 0x0101000f
-xbox360_stub NetDll_send, 0x01010016
-xbox360_stub NetDll_sendto, 0x01010018
-xbox360_stub NetDll_setsockopt, 0x01010007
-xbox360_stub NetDll_shutdown, 0x01010005
-xbox360_stub NetDll_socket, 0x01010003
-xbox360_stub NicGetStats, 0x01000209
-xbox360_stub NtAllocateVirtualMemory, 0x010000cc
-xbox360_stub NtClearEvent, 0x010000ce
-xbox360_stub NtClose, 0x010000cf
-xbox360_stub NtCreateDirectoryObject, 0x010000d0
-xbox360_stub NtCreateEvent, 0x010000d1
-
-.ifndef NtCreateFile
- xbox360_function NtCreateFile
- xbox360_frame 0x60
- li 12, 0
- stw 12, 0x50(1)
- lwz 11, 0x68(1)
- stw 11, 0x54(1)
- xbox360_call NtCreateFile
- xbox360_return 0x60
- xbox360_end NtCreateFile, 0x010000d2
-.endif
-
-xbox360_stub NtCreateSemaphore, 0x010000d5
-xbox360_stub NtDeleteFile, 0x010000d8
-
-.ifndef NtDeviceIoControlFile
- xbox360_function NtDeviceIoControlFile
- xbox360_frame 0x60
- li 12, 0
- stw 12, 0x50(1)
- lwz 11, 0x68(1)
- stw 11, 0x54(1)
- li 12, 0
- stw 12, 0x58(1)
- lwz 11, 0x6c(1)
- stw 11, 0x5c(1)
- xbox360_call NtDeviceIoControlFile
- xbox360_return 0x60
- xbox360_end NtDeviceIoControlFile, 0x010000d9
-.endif
-
-xbox360_stub NtFlushBuffersFile, 0x010000db
-xbox360_stub NtFreeVirtualMemory, 0x010000dc
-xbox360_stub NtOpenDirectoryObject, 0x010000de
-xbox360_stub NtOpenFile, 0x010000df
-
-.ifndef NtQueryDirectoryFile
- xbox360_function NtQueryDirectoryFile
- xbox360_frame 0x60
- li 12, 0
- stw 12, 0x50(1)
- lwz 11, 0x68(1)
- stw 11, 0x54(1)
- xbox360_call NtQueryDirectoryFile
- xbox360_return 0x60
- xbox360_end NtQueryDirectoryFile, 0x010000e4
-.endif
-
-xbox360_stub NtQueryDirectoryObject, 0x010000e5
-xbox360_stub NtQueryFullAttributesFile, 0x010000e7
-xbox360_stub NtQueryInformationFile, 0x010000e8
-xbox360_stub NtQueryVirtualMemory, 0x010000ee
-xbox360_stub NtQueryVolumeInformationFile, 0x010000ef
-xbox360_stub NtReadFile, 0x010000f0
-xbox360_stub NtReadFileScatter, 0x010000f1
-xbox360_stub NtReleaseSemaphore, 0x010000f3
-xbox360_stub NtSetEvent, 0x010000f6
-xbox360_stub NtSetInformationFile, 0x010000f7
-xbox360_stub NtSetSystemTime, 0x010000f9
-xbox360_stub NtWaitForMultipleObjectsEx, 0x010000fe
-xbox360_stub NtWaitForSingleObjectEx, 0x010000fd
-xbox360_stub NtWriteFile, 0x010000ff
-xbox360_stub NtWriteFileGather, 0x01000100
-xbox360_stub NtYieldExecution, 0x01000101
-xbox360_stub ObCreateObject, 0x01000102
-xbox360_stub ObCreateSymbolicLink, 0x01000103
-xbox360_stub ObDeleteSymbolicLink, 0x01000104
-xbox360_stub ObDereferenceObject, 0x01000105
-xbox360_stub ObInsertObject, 0x01000108
-xbox360_stub ObLookupAnyThreadByThreadId, 0x0100010a
-xbox360_stub ObMakeTemporaryObject, 0x0100010c
-xbox360_stub ObOpenObjectByName, 0x0100010d
-xbox360_stub ObReferenceObjectByHandle, 0x01000110
-xbox360_stub ObReferenceObjectByName, 0x01000111
-xbox360_stub ObTranslateSymbolicLink, 0x01000113
-xbox360_stub QueryPerformanceCounter, 0x0101042f
-xbox360_stub QueryPerformanceFrequency, 0x01010430
-xbox360_stub ResetEvent, 0x0101042b
-xbox360_stub ResumeThread, 0x0101043d
-xbox360_stub RtlAllocateHeap, 0x010103fc
-xbox360_stub RtlAssert, 0x01000118
-xbox360_stub RtlCaptureContext, 0x01000119
-xbox360_stub RtlEnterCriticalSection, 0x01000125
-xbox360_stub RtlFreeHeap, 0x010103ff
-xbox360_stub RtlGetStackLimits, 0x0100012a
-xbox360_stub RtlImageDirectoryEntryToData, 0x010001a8
-xbox360_stub RtlImageNtHeader, 0x010001a9
-xbox360_stub RtlImageXexHeaderField, 0x0100012b
-xbox360_stub RtlInitializeCriticalSection, 0x0100012e
-xbox360_stub RtlInitializeCriticalSectionAndSpinCount, 0x0100012f
-xbox360_stub RtlLeaveCriticalSection, 0x01000130
-xbox360_stub RtlNtStatusToDosError, 0x01000135
-xbox360_stub RtlTryEnterCriticalSection, 0x01000141, u8
-xbox360_stub VdEnableRingBufferRPtrWriteBack, 0x010001b6
-xbox360_stub VdEnumerateVideoModes, 0x01000270
-xbox360_stub VdGetCurrentDisplayInformation, 0x010001ba
-xbox360_stub VdGetDisplayDiscoveryData, 0x0100027e
-xbox360_stub VdGetSystemCommandBuffer, 0x010001bd
-xbox360_stub VdInitializeEngines, 0x010001c2
-xbox360_stub VdInitializeRingBuffer, 0x010001c3
-xbox360_stub VdReadDVERegisterUlong, 0x010001cb
-xbox360_stub VdRetrainEDRAM, 0x01000269
-xbox360_stub VdRetrainEDRAMWorker, 0x0100026a
-xbox360_stub VdSetDisplayMode, 0x010001d3
-
-.ifndef VdSetDisplayModeOverride
- xbox360_function VdSetDisplayModeOverride
- xbox360_frame 0x50
- stw 5, 0x18(1)
- stw 6, 0x1c(1)
- lwz 6, 0x18(1)
- lwz 7, 0x1c(1)
- xbox360_call VdSetDisplayModeOverride
- xbox360_return 0x50
- xbox360_end VdSetDisplayModeOverride, 0x010001d4
-.endif
-
-xbox360_stub VdSetGraphicsInterruptCallback, 0x010001d5
-xbox360_stub VdSetSystemCommandBufferGpuIdentifierAddress, 0x010001d9
-xbox360_stub VdShutdownEngines, 0x010001dc
-
-.ifndef VdSwap
- xbox360_function VdSwap
- xbox360_frame 0x60
- li 12, 0
- stw 12, 0x50(1)
- lwz 11, 0x68(1)
- stw 11, 0x54(1)
- li 12, 0
- stw 12, 0x58(1)
- lwz 11, 0x6c(1)
- stw 11, 0x5c(1)
- xbox360_call VdSwap
- xbox360_return 0x60
- xbox360_end VdSwap, 0x0100025b
-.endif
-
-xbox360_stub VdWriteDVERegisterUlong, 0x010001e0
-xbox360_stub WaitForSingleObject, 0x01010425
-xbox360_stub XAudioGetRenderDriverThread, 0x010001fe
-xbox360_stub XAudioRegisterRenderDriverClient, 0x010001f3
-xbox360_stub XAudioSetSpeakerConfig, 0x01000200
-xbox360_stub XAudioSubmitRenderDriverFrame, 0x010001f5
-xbox360_stub XAudioUnregisterRenderDriverClient, 0x010001f4
-xbox360_stub XAutomationpBindController, 0x010103d5
-xbox360_stub XAutomationpInputXenonButton, 0x010103d7
-xbox360_stub XAutomationpUnbindController, 0x010103d6
-xbox360_stub XGetAVPack, 0x010103cb
-xbox360_stub XGetAudioFlags, 0x010103ca
-xbox360_stub XGetGameRegion, 0x010103cc
-xbox360_stub XGetVideoMode, 0x010103d1
-xbox360_stub XInputdSetRFPowerMode, 0x010001ef
-xbox360_stub XMABlockWhileInUse, 0x01000235
-xbox360_stub XMACreateContext, 0x01000224
-xbox360_stub XMADisableContext, 0x01000228
-xbox360_stub XMAEnableContext, 0x01000227
-xbox360_stub XMAGetOutputBufferReadOffset, 0x0100022b
-xbox360_stub XMAGetOutputBufferWriteOffset, 0x01000229
-xbox360_stub XMAInitializeContext, 0x01000225
-xbox360_stub XMAIsInputBuffer0Valid, 0x0100022f
-xbox360_stub XMAIsOutputBufferValid, 0x0100022d
-xbox360_stub XMAReleaseContext, 0x01000226
-xbox360_stub XMASetInputBuffer0Valid, 0x0100022e
-xbox360_stub XMASetOutputBufferReadOffset, 0x0100022a
-xbox360_stub XMASetOutputBufferValid, 0x0100022c
-xbox360_stub XMsgCancelIORequest, 0x010101f8
-xbox360_stub XMsgInProcessCall, 0x010101f4
-xbox360_stub XMsgStartIORequest, 0x010101f7
-xbox360_stub XMsgStartIORequestEx, 0x010101fc
-xbox360_stub XMsgSystemProcessCall, 0x010101f6
-xbox360_stub XNetLogonClearTicketCaches, 0x0101013c
-xbox360_stub XNetLogonGetDnsString, 0x01010139
-xbox360_stub XNetLogonGetExtendedStatus, 0x0101013b
-xbox360_stub XNotifyBroadcast, 0x0101028e
-xbox360_stub XNotifyGetNext, 0x0101028b, u8
-xbox360_stub XUsbcamCreate, 0x01000222
-xbox360_stub XUsbcamDestroy, 0x01000223
-xbox360_stub XUsbcamGetState, 0x0100021d
-xbox360_stub XUsbcamSetConfig, 0x0100021c
-xbox360_stub XamAppUnloadStack, 0x01010246
-xbox360_stub XamBackgroundDownloadGetItems, 0x010109c7
-xbox360_stub XamBuildLegacySystemResourceLocator, 0x0101031c
-xbox360_stub XamCacheReset, 0x010102b7
-xbox360_stub XamContentAggregateCreateEnumerator, 0x01010279
-xbox360_stub XamContentClose, 0x0101025a
-xbox360_stub XamContentCopyInternal, 0x0101026c
-xbox360_stub XamContentCreate, 0x01010258
-xbox360_stub XamContentCreateDeviceEnumerator, 0x0101025d
-
-.ifndef XamContentCreateInternal
- xbox360_function XamContentCreateInternal
- xbox360_frame 0x50
- stw 9, 0x28(1)
- stw 10, 0x2c(1)
- lwz 9, 0x2c(1)
- lwz 11, 0x28(1)
- rldimi 9, 11, 32, 0
- lwz 10, 0x58(1)
- xbox360_call XamContentCreateInternal
- xbox360_return 0x50
- xbox360_end XamContentCreateInternal, 0x01010271
-.endif
-
-xbox360_stub XamContentDelete, 0x0101025b
-xbox360_stub XamContentDeleteInternal, 0x01010270
-xbox360_stub XamContentFlush, 0x01010267
-xbox360_stub XamContentGetAttributesInternal, 0x01010277
-xbox360_stub XamContentGetDefaultDevice, 0x01010284
-xbox360_stub XamContentGetDeviceData, 0x0101025e
-xbox360_stub XamContentGetMetaDataInternal, 0x0101026e
-xbox360_stub XamContentLaunchImageInternal, 0x01010273
-xbox360_stub XamContentMoveInternal, 0x0101026d
-xbox360_stub XamContentResolveInternal, 0x01010276
-xbox360_stub XamCreateEnumeratorHandle, 0x0101024e
-xbox360_stub XamEnumerate, 0x01010250
-
-.ifndef XamFormatDateString
- xbox360_function XamFormatDateString
- xbox360_frame 0x50
- stw 5, 0x18(1)
- stw 6, 0x1c(1)
- stw 7, 0x20(1)
- stw 8, 0x24(1)
- lwz 4, 0x1c(1)
- lwz 11, 0x18(1)
- rldimi 4, 11, 32, 0
- lwz 5, 0x20(1)
- lwz 6, 0x24(1)
- xbox360_call XamFormatDateString
- xbox360_return 0x50
- xbox360_end XamFormatDateString, 0x010101e8
-.endif
-
-
-.ifndef XamFormatTimeString
- xbox360_function XamFormatTimeString
- xbox360_frame 0x50
- stw 5, 0x18(1)
- stw 6, 0x1c(1)
- stw 7, 0x20(1)
- stw 8, 0x24(1)
- lwz 4, 0x1c(1)
- lwz 11, 0x18(1)
- rldimi 4, 11, 32, 0
- lwz 5, 0x20(1)
- lwz 6, 0x24(1)
- xbox360_call XamFormatTimeString
- xbox360_return 0x50
- xbox360_end XamFormatTimeString, 0x010101e7
-.endif
-
-xbox360_stub XamGetCachedTitleName, 0x010102b6
-xbox360_stub XamGetCurrentTitleId, 0x010101cf
-xbox360_stub XamGetDefaultSystemImage, 0x010101c5
-xbox360_stub XamGetDvrStorage, 0x01010518
-xbox360_stub XamGetLanguage, 0x010103d2
-xbox360_stub XamGetOverlappedResult, 0x010101fb
-xbox360_stub XamGetPrivateEnumStructureFromHandle, 0x0101024f
-xbox360_stub XamGetSecurityViolationsDetected, 0x01010af3, u64
-xbox360_stub XamGetSystemVersion, 0x01010282
-xbox360_stub XamGetWCNConfigFile, 0x010101c6
-xbox360_stub XamInputGetCapabilities, 0x01010190
-xbox360_stub XamInputGetKeystrokeEx, 0x01010198
-xbox360_stub XamInputGetState, 0x01010191
-xbox360_stub XamInputSetState, 0x01010192
-xbox360_stub XamIptvGetServiceName, 0x0101051a
-xbox360_stub XamIptvUninstall, 0x01010517
-xbox360_stub XamIsSysUiInvokedByTitle, 0x010102eb
-xbox360_stub XamIsSystemTitleId, 0x010101bb, u8
-xbox360_stub XamIsUIActive, 0x010102ec, u8
-xbox360_stub XamIsXbox1TitleId, 0x010101bf, u8
-xbox360_stub XamLoaderGetDvdTrayState, 0x010101aa
-xbox360_stub XamLoaderGetLaunchData, 0x010101a8
-xbox360_stub XamLoaderGetMediaInfo, 0x010101a3
-xbox360_stub XamLoaderGetPriorTitleId, 0x010101be
-xbox360_noreturn XamLoaderLaunchTitle, 0x010101a4
-xbox360_stub XamLoaderLaunchTitleEx, 0x010101a5
-xbox360_stub XamLoaderSetLaunchData, 0x010101a6
-xbox360_noreturn XamLoaderTerminateTitle, 0x010101a9
-xbox360_stub XamMuteSound, 0x010101ca
-
-.ifndef XamNotifyCreateListenerInternal
- xbox360_function XamNotifyCreateListenerInternal
- xbox360_frame 0x50
- stw 3, 0x10(1)
- stw 4, 0x14(1)
- stw 5, 0x18(1)
- stw 6, 0x1c(1)
- lwz 3, 0x14(1)
- lwz 11, 0x10(1)
- rldimi 3, 11, 32, 0
- lwz 4, 0x18(1)
- lwz 5, 0x1c(1)
- xbox360_call XamNotifyCreateListenerInternal
- xbox360_return 0x50
- xbox360_end XamNotifyCreateListenerInternal, 0x01010291
-.endif
-
-xbox360_stub XamPlayTimerForceNotification, 0x01010a64
-xbox360_stub XamPlayTimerGetData, 0x01010a5a
-xbox360_stub XamPlayTimerGetNextResetDate, 0x01010a60
-xbox360_stub XamPlayTimerIsEnabled, 0x01010a5f, u8
-xbox360_stub XamPlayTimerIsRunning, 0x01010a5e, u8
-xbox360_stub XamPlayTimerResume, 0x01010a5c
-xbox360_stub XamPlayTimerSetData, 0x01010a5b
-xbox360_stub XamPlayTimerSuspend, 0x01010a5d
-xbox360_stub XamProfileClose, 0x01010238
-xbox360_stub XamProfileCreate, 0x01010230
-xbox360_stub XamProfileCreateEnumerator, 0x01010231
-
-.ifndef XamProfileDelete
- xbox360_function XamProfileDelete
- xbox360_frame 0x50
- stw 5, 0x18(1)
- stw 6, 0x1c(1)
- lwz 4, 0x1c(1)
- lwz 11, 0x18(1)
- rldimi 4, 11, 32, 0
- xbox360_call XamProfileDelete
- xbox360_return 0x50
- xbox360_end XamProfileDelete, 0x01010233
-.endif
-
-xbox360_stub XamProfileEnumerate, 0x01010232
-xbox360_stub XamProfileGetCreationStatus, 0x01010234
-
-.ifndef XamProfileLoadAccountInfo
- xbox360_function XamProfileLoadAccountInfo
- xbox360_frame 0x50
- stw 5, 0x18(1)
- stw 6, 0x1c(1)
- stw 7, 0x20(1)
- lwz 4, 0x1c(1)
- lwz 11, 0x18(1)
- rldimi 4, 11, 32, 0
- lwz 5, 0x20(1)
- xbox360_call XamProfileLoadAccountInfo
- xbox360_return 0x50
- xbox360_end XamProfileLoadAccountInfo, 0x0101023a
-.endif
-
-
-.ifndef XamProfileOpen
- xbox360_function XamProfileOpen
- xbox360_frame 0x50
- stw 3, 0x10(1)
- stw 4, 0x14(1)
- stw 5, 0x18(1)
- stw 6, 0x1c(1)
- stw 7, 0x20(1)
- lwz 3, 0x14(1)
- lwz 11, 0x10(1)
- rldimi 3, 11, 32, 0
- lwz 4, 0x18(1)
- lwz 5, 0x1c(1)
- lwz 6, 0x20(1)
- xbox360_call XamProfileOpen
- xbox360_return 0x50
- xbox360_end XamProfileOpen, 0x01010237
-.endif
-
-
-.ifndef XamReadTile
- xbox360_function XamReadTile
- xbox360_frame 0x50
- stw 5, 0x18(1)
- stw 6, 0x1c(1)
- stw 7, 0x20(1)
- stw 8, 0x24(1)
- stw 9, 0x28(1)
- stw 10, 0x2c(1)
- lwz 5, 0x1c(1)
- lwz 11, 0x18(1)
- rldimi 5, 11, 32, 0
- lwz 6, 0x20(1)
- lwz 7, 0x24(1)
- lwz 8, 0x28(1)
- lwz 9, 0x2c(1)
- xbox360_call XamReadTile
- xbox360_return 0x50
- xbox360_end XamReadTile, 0x010102ef
-.endif
-
-
-.ifndef XamReadTileEx
- xbox360_function XamReadTileEx
- xbox360_frame 0x60
- stw 5, 0x18(1)
- stw 6, 0x1c(1)
- stw 7, 0x20(1)
- stw 8, 0x24(1)
- stw 9, 0x28(1)
- stw 10, 0x2c(1)
- lwz 5, 0x1c(1)
- lwz 11, 0x18(1)
- rldimi 5, 11, 32, 0
- lwz 6, 0x20(1)
- lwz 7, 0x24(1)
- lwz 8, 0x28(1)
- lwz 9, 0x2c(1)
- lwz 10, 0x68(1)
- li 12, 0
- stw 12, 0x50(1)
- lwz 11, 0x6c(1)
- stw 11, 0x54(1)
- xbox360_call XamReadTileEx
- xbox360_return 0x60
- xbox360_end XamReadTileEx, 0x010102fc
-.endif
-
-xbox360_stub XamSetDashContext, 0x010101cc
-xbox360_stub XamSetDvrStorage, 0x01010519
-xbox360_stub XamSetInactivityTimeFromConfig, 0x010101a2
-xbox360_stub XamShowAchievementDetailsUI, 0x010102e0
-xbox360_stub XamShowAchievementsUI, 0x010102c5
-xbox360_stub XamShowCreateProfileUI, 0x010102cf
-
-.ifndef XamShowDeviceSelectorUI
- xbox360_function XamShowDeviceSelectorUI
- xbox360_frame 0x50
- stw 7, 0x20(1)
- stw 8, 0x24(1)
- stw 9, 0x28(1)
- stw 10, 0x2c(1)
- lwz 6, 0x24(1)
- lwz 11, 0x20(1)
- rldimi 6, 11, 32, 0
- lwz 7, 0x28(1)
- lwz 8, 0x2c(1)
- xbox360_call XamShowDeviceSelectorUI
- xbox360_return 0x50
- xbox360_end XamShowDeviceSelectorUI, 0x010102cb
-.endif
-
-xbox360_stub XamShowGamerCardUI, 0x010102c4
-
-.ifndef XamShowGamerCardUIForXUID
- xbox360_function XamShowGamerCardUIForXUID
- xbox360_frame 0x50
- stw 5, 0x18(1)
- stw 6, 0x1c(1)
- stw 7, 0x20(1)
- lwz 4, 0x1c(1)
- lwz 11, 0x18(1)
- rldimi 4, 11, 32, 0
- lwz 5, 0x20(1)
- xbox360_call XamShowGamerCardUIForXUID
- xbox360_return 0x50
- xbox360_end XamShowGamerCardUIForXUID, 0x010102d5
-.endif
-
-xbox360_stub XamShowGamesUI, 0x010102d0
-
-.ifndef XamShowJoinSessionInProgressUI
- xbox360_function XamShowJoinSessionInProgressUI
- xbox360_frame 0x50
- stw 5, 0x18(1)
- stw 6, 0x1c(1)
- lwz 4, 0x1c(1)
- lwz 11, 0x18(1)
- rldimi 4, 11, 32, 0
- xbox360_call XamShowJoinSessionInProgressUI
- xbox360_return 0x50
- xbox360_end XamShowJoinSessionInProgressUI, 0x01010301
-.endif
-
-xbox360_stub XamShowKeyboardUI, 0x010102c1
-xbox360_stub XamShowLiveSignupUI, 0x010102d1
-xbox360_stub XamShowLiveUpsellUIEx, 0x01010300
-
-.ifndef XamShowMarketplaceUIEx
- xbox360_function XamShowMarketplaceUIEx
- xbox360_frame 0x50
- stw 5, 0x18(1)
- stw 6, 0x1c(1)
- stw 7, 0x20(1)
- stw 8, 0x24(1)
- stw 9, 0x28(1)
- stw 10, 0x2c(1)
- lwz 5, 0x1c(1)
- lwz 11, 0x18(1)
- rldimi 5, 11, 32, 0
- lwz 6, 0x20(1)
- lwz 7, 0x24(1)
- lwz 8, 0x28(1)
- lwz 9, 0x2c(1)
- lwz 10, 0x58(1)
- xbox360_call XamShowMarketplaceUIEx
- xbox360_return 0x50
- xbox360_end XamShowMarketplaceUIEx, 0x010102e8
-.endif
-
-
-.ifndef XamShowMessageBoxUI
- xbox360_function XamShowMessageBoxUI
- xbox360_frame 0x60
- li 12, 0
- stw 12, 0x50(1)
- lwz 11, 0x68(1)
- stw 11, 0x54(1)
- xbox360_call XamShowMessageBoxUI
- xbox360_return 0x60
- xbox360_end XamShowMessageBoxUI, 0x010102ca
-.endif
-
-xbox360_stub XamShowPersonalizationUI, 0x010102e1
-xbox360_stub XamShowSigninUI, 0x010102bc
-xbox360_stub XamShowSigninUIp, 0x010102be
-xbox360_stub XamUnloadSysApp, 0x01010252
-
-.ifndef XamUserCreateAchievementEnumerator
- xbox360_function XamUserCreateAchievementEnumerator
- xbox360_frame 0x50
- stw 5, 0x18(1)
- stw 6, 0x1c(1)
- stw 7, 0x20(1)
- stw 8, 0x24(1)
- stw 9, 0x28(1)
- stw 10, 0x2c(1)
- lwz 5, 0x1c(1)
- lwz 11, 0x18(1)
- rldimi 5, 11, 32, 0
- lwz 6, 0x20(1)
- lwz 7, 0x24(1)
- lwz 8, 0x28(1)
- lwz 9, 0x2c(1)
- lwz 10, 0x58(1)
- xbox360_call XamUserCreateAchievementEnumerator
- xbox360_return 0x50
- xbox360_end XamUserCreateAchievementEnumerator, 0x010102ee
-.endif
-
-
-.ifndef XamUserCreateTitlesPlayedEnumerator
- xbox360_function XamUserCreateTitlesPlayedEnumerator
- xbox360_frame 0x50
- stw 5, 0x18(1)
- stw 6, 0x1c(1)
- stw 7, 0x20(1)
- stw 8, 0x24(1)
- stw 9, 0x28(1)
- stw 10, 0x2c(1)
- lwz 5, 0x1c(1)
- lwz 11, 0x18(1)
- rldimi 5, 11, 32, 0
- lwz 6, 0x20(1)
- lwz 7, 0x24(1)
- lwz 8, 0x28(1)
- lwz 9, 0x2c(1)
- xbox360_call XamUserCreateTitlesPlayedEnumerator
- xbox360_return 0x50
- xbox360_end XamUserCreateTitlesPlayedEnumerator, 0x010102f3
-.endif
-
-xbox360_stub XamUserFlushLogonQueue, 0x01010220
-xbox360_stub XamUserGetGamerTag, 0x0101020c
-
-.ifndef XamUserGetIndexFromXUID
- xbox360_function XamUserGetIndexFromXUID
- xbox360_frame 0x50
- stw 3, 0x10(1)
- stw 4, 0x14(1)
- stw 5, 0x18(1)
- stw 6, 0x1c(1)
- lwz 3, 0x14(1)
- lwz 11, 0x10(1)
- rldimi 3, 11, 32, 0
- lwz 4, 0x18(1)
- lwz 5, 0x1c(1)
- xbox360_call XamUserGetIndexFromXUID
- xbox360_return 0x50
- xbox360_end XamUserGetIndexFromXUID, 0x01010211
-.endif
-
-xbox360_stub XamUserGetMembershipType, 0x0101021b
-xbox360_stub XamUserGetSigninState, 0x01010210
-xbox360_stub XamUserGetXUID, 0x0101020a
-xbox360_stub XamUserIsOnlineEnabled, 0x01010221, u8
-xbox360_stub XamUserLogon, 0x0101020b
-
-.ifndef XamUserReadProfileSettings
- xbox360_function XamUserReadProfileSettings
- xbox360_frame 0x60
- li 12, 0
- stw 12, 0x50(1)
- lwz 11, 0x68(1)
- stw 11, 0x54(1)
- xbox360_call XamUserReadProfileSettings
- xbox360_return 0x60
- xbox360_end XamUserReadProfileSettings, 0x01010219
-.endif
-
-xbox360_stub XamWriteGamerTile, 0x010102f0
-xbox360_stub XeCryptDesEcb, 0x01000176
-xbox360_stub XeCryptDesKey, 0x01000175
-xbox360_stub XeCryptDesParity, 0x01000174
-
-.ifndef XeCryptHmacSha
- xbox360_function XeCryptHmacSha
- xbox360_frame 0x60
- li 12, 0
- stw 12, 0x50(1)
- lwz 11, 0x68(1)
- stw 11, 0x54(1)
- li 12, 0
- stw 12, 0x58(1)
- lwz 11, 0x6c(1)
- stw 11, 0x5c(1)
- xbox360_call XeCryptHmacSha
- xbox360_return 0x60
- xbox360_end XeCryptHmacSha, 0x01000182
-.endif
-
-xbox360_stub XeCryptMd5, 0x01000187
-xbox360_stub XeCryptRandom, 0x0100018a
-xbox360_stub XeKeysGetConsoleID, 0x01000246
-xbox360_stub XeKeysGetConsoleType, 0x01000247
-xbox360_stub XeKeysGetKey, 0x01000244
-xbox360_stub XeKeysGetStatus, 0x0100023f
-xbox360_stub XeKeysSaveBootLoader, 0x0100023d
-xbox360_stub XexGetModuleHandle, 0x01000195
-xbox360_stub XexGetModuleSection, 0x01000196
-xbox360_stub XexGetProcedureAddress, 0x01000197
-xbox360_stub XexLoadImage, 0x01000199
-xbox360_stub XexLoadImageFromMemory, 0x0100019a
-xbox360_stub XexPcToFileHeader, 0x0100019c
-xbox360_stub XexUnloadImage, 0x010001a1
-xbox360_slot __imp_ExConsoleGameRegion, 0x0000000c
-xbox360_slot __imp_ExLoadedCommandLine, 0x000001ae
-xbox360_slot __imp_ExLoadedImageName, 0x000001af
-xbox360_slot __imp_ExThreadObjectType, 0x0000001b
-xbox360_slot __imp_IoDeviceObjectType, 0x0000003a
-xbox360_slot __imp_KeDebugMonitorData, 0x00000059
-xbox360_slot __imp_KeTimeStampBundle, 0x000000ad
-xbox360_slot __imp_XboxHardwareInfo, 0x00000156
-xbox360_slot __imp_XboxKrnlBaseVersion, 0x00000157
-xbox360_slot __imp_XboxKrnlVersion, 0x00000158
-xbox360_slot __imp_XexExecutableModuleHandle, 0x00000193
-xbox360_stub _vsnprintf, 0x0100014d
diff --git a/platform/xex/tests/audio/main.cpp b/platform/xex/tests/audio/main.cpp
deleted file mode 100644
index 27b25fd..0000000
--- a/platform/xex/tests/audio/main.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-// Runtime check 5: audio latency. Every second a click and a white flash
-// start in the same frame; A clicks and flashes at once. Up/down choose how
-// many 5.33 ms frames are kept queued ahead (2, 4, 8, 15): if the click
-// trails the flash by the same amount at 2 as at 15, the delay is past the
-// title (the kernel's driver or the output). Logs to game:/audio-log.txt.
-// Back+Start or the Guide's Xbox Home leaves.
-#include <cstdio>
-#include <cstdarg>
-#include <cstring>
-#include <cmath>
-
-#include "xex_runtime.h"
-#include "xex_video.h"
-#include "xex_input.h"
-#include "xex_audio.h"
-
-static void logLine(const char *fmt, ...) {
- char line[256];
- va_list ap;
- va_start(ap, fmt);
- vsnprintf(line, sizeof line, fmt, ap);
- va_end(ap);
- printf("audio: %s\n", line);
- if (FILE *f = fopen("game:/audio-log.txt", "a")) {
- fprintf(f, "%s\n", line);
- fclose(f);
- }
-}
-
-static const unsigned AheadChoices[4] = {2, 4, 8, 15};
-
-int main(int, char **) {
- remove("game:/audio-log.txt");
- xex_video_trace = logLine;
- if (xex_video_init() != 0) {
- logLine("video init failed: %s", xex_video_error());
- return 1;
- }
- xex_video_trace = nullptr;
- if (xex_audio_open() != 0) {
- logLine("audio open failed");
- xex_notify("audio test: XAudio registration failed");
- xex_sleep_ms(3000);
- return 1;
- }
- logLine("audio open");
-
- const uint64_t freq = xex_timebase_freq();
- uint64_t start = xex_timebase(), lastLog = start;
- unsigned lastCalls = xex_audio_callbacks();
- int aheadChoice = 1;
- uint16_t lastButtons = 0;
- int clickSamplesLeft = 0; // samples of the current click still to queue
- double phase = 0;
- int flashFrames = 0;
- uint64_t nextBeat = start + freq;
-
- for (;;) {
- xex_pad pad;
- xex_input_get(0, &pad);
- uint16_t pressed = pad.buttons & ~lastButtons;
- lastButtons = pad.buttons;
- if ((pad.buttons & XEX_PAD_BACK) && (pad.buttons & XEX_PAD_START)) break;
- if (pressed & XEX_PAD_UP && aheadChoice < 3) aheadChoice++;
- if (pressed & XEX_PAD_DOWN && aheadChoice > 0) aheadChoice--;
- if (pressed & (XEX_PAD_UP | XEX_PAD_DOWN)) logLine("frames ahead: %u", AheadChoices[aheadChoice]);
-
- uint64_t now = xex_timebase();
- bool click = (pressed & XEX_PAD_A) != 0;
- if (now >= nextBeat) { click = true; nextBeat += freq; }
- if (click) { clickSamplesLeft = 2400; flashFrames = 3; } // 50 ms tone
-
- // keep the queue at the chosen depth; the click starts in the next
- // frame queued, the same video frame as the flash
- unsigned ahead = AheadChoices[aheadChoice];
- while (xex_audio_queued() < ahead) {
- float *frame = xex_audio_next();
- if (!frame) break;
- for (int i = 0; i < XEX_AUDIO_FRAME_SAMPLES; i++) {
- float v = 0;
- if (clickSamplesLeft > 0) {
- v = 0.5f * (float)sin(phase);
- phase += 2 * M_PI * 1000.0 / XEX_AUDIO_RATE;
- clickSamplesLeft--;
- }
- frame[i] = v;
- frame[XEX_AUDIO_FRAME_SAMPLES + i] = v;
- }
- xex_audio_queue();
- }
-
- xex_frame f = xex_video_begin();
- uint32_t bg = flashFrames > 0 ? xex_video_rgb(255, 255, 255) : xex_video_rgb(20, 20, 40);
- if (flashFrames > 0) flashFrames--;
- for (int y = 0; y < f.window_height; y++)
- for (int x = 0; x < f.window_width; x++) {
- uint32_t c = bg;
- // bars: frames ahead chosen (yellow), queued now (green)
- if (y >= 40 && y < 80 && x >= 40 && x < 40 + (int)ahead * 40 && (x - 40) % 40 < 34)
- c = xex_video_rgb(255, 236, 39);
- if (y >= 100 && y < 140 && x >= 40 && x < 40 + (int)xex_audio_queued() * 40 && (x - 40) % 40 < 34)
- c = xex_video_rgb(0, 228, 54);
- f.pixels[xex_video_tiled_index(f.window_x + x, f.window_y + y, f.pitch)] = c;
- }
- xex_video_present();
-
- if (now - lastLog >= 2 * freq) {
- unsigned calls = xex_audio_callbacks();
- logLine("%.1f s: callbacks %u/s, queued %u (ahead %u), underruns %u",
- (double)(now - start) / freq, (unsigned)((calls - lastCalls) * freq / (now - lastLog)),
- xex_audio_queued(), ahead, xex_audio_underruns());
- lastCalls = calls;
- lastLog = now;
- }
- }
- logLine("exit");
- return 0;
-}
diff --git a/platform/xex/tests/audio/xex.toml b/platform/xex/tests/audio/xex.toml
deleted file mode 100644
index 0854722..0000000
--- a/platform/xex/tests/audio/xex.toml
+++ /dev/null
@@ -1,3 +0,0 @@
-title_id = 0x46383038 # "F808"
-load_address = 0x82000000
-module_flags = ["TITLE"]
diff --git a/platform/xex/tests/fault/main.cpp b/platform/xex/tests/fault/main.cpp
deleted file mode 100644
index c88ef9e..0000000
--- a/platform/xex/tests/fault/main.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-// Runtime check 4: the fault report. Stores to address 0 after 2 s; the
-// runtime's handler should write game:/crash.txt (exception, address,
-// registers, stack) and go back to the dashboard.
-#include <cstdio>
-#include "xex_runtime.h"
-
-static void __attribute__((noinline)) crashHere(volatile int *p) {
- *p = 42;
-}
-
-static void __attribute__((noinline)) caller(volatile int *p) {
- crashHere(p);
- printf("fault: still alive after the store\n");
-}
-
-int main(int, char **) {
- remove("game:/crash.txt");
- xex_notify("fault test: crashing in 2 s");
- xex_sleep_ms(2000);
- caller((volatile int *)nullptr);
- xex_notify("fault test: NOT caught");
- xex_sleep_ms(4000);
- return 0;
-}
diff --git a/platform/xex/tests/fault/xex.toml b/platform/xex/tests/fault/xex.toml
deleted file mode 100644
index 0854722..0000000
--- a/platform/xex/tests/fault/xex.toml
+++ /dev/null
@@ -1,3 +0,0 @@
-title_id = 0x46383038 # "F808"
-load_address = 0x82000000
-module_flags = ["TITLE"]
diff --git a/platform/xex/tests/fs/main.cpp b/platform/xex/tests/fs/main.cpp
deleted file mode 100644
index e311949..0000000
--- a/platform/xex/tests/fs/main.cpp
+++ /dev/null
@@ -1,173 +0,0 @@
-// Runtime check 2: files, directories and time through newlib on the
-// kernel's Nt* API. Writes a report to every writable device and shows a
-// summary as guide notifications; the full report is also on DbgPrint.
-#include <cstdio>
-#include <cstring>
-#include <string>
-#include <vector>
-#include <fstream>
-#include <dirent.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <ctime>
-#include <cerrno>
-
-#include "xex_runtime.h"
-
-static std::string report;
-
-static void log(const std::string &line) {
- report += line + "\n";
- printf("fs-test: %s\n", line.c_str());
-}
-
-static int listDir(const std::string &path, int maxShow) {
- DIR *d = opendir(path.c_str());
- if (!d) {
- log("opendir " + path + " FAILED");
- return -1;
- }
- int n = 0;
- while (struct dirent *e = readdir(d)) {
- if (n < maxShow) log(std::string(" ") + (e->d_type == DT_DIR ? "[" : "") + e->d_name + (e->d_type == DT_DIR ? "]" : ""));
- n++;
- }
- closedir(d);
- log("opendir " + path + ": " + std::to_string(n) + " entries");
- return n;
-}
-
-#include <cerrno>
-#include <unistd.h>
-
-static std::string g_failStep;
-
-static bool fail(const std::string &step) {
- if (g_failStep.empty()) g_failStep = step + " (" + strerror(errno) + ")";
- log(step + " FAILED errno=" + std::to_string(errno) + " " + strerror(errno));
- return false;
-}
-
-// write, read back with stdio and iostream, stat, append, seek
-static bool fileRoundTrip(const std::string &dir) {
- g_failStep.clear();
- std::string path = dir + "/fake08-xex-test.txt";
- FILE *f = fopen(path.c_str(), "w");
- if (!f) return fail("fopen(w)");
- fputs("hello xbox\n", f);
- fclose(f);
-
- f = fopen(path.c_str(), "a");
- if (!f) return fail("fopen(a)");
- fputs("line2\n", f);
- fclose(f);
-
- struct stat st;
- st.st_size = -1;
- if (stat(path.c_str(), &st) != 0) return fail("stat");
- if (st.st_size != 17) { errno = 0; return fail("size=" + std::to_string((long)st.st_size)); }
-
- std::ifstream in(path);
- std::string a, b;
- std::getline(in, a);
- std::getline(in, b);
- in.close(); // an open file cannot be deleted on the console (sharing violation)
- if (a != "hello xbox" || b != "line2") { errno = 0; return fail("readback '" + a + "'"); }
-
- f = fopen(path.c_str(), "rb");
- fseek(f, 0, SEEK_END);
- long size = ftell(f);
- fseek(f, 6, SEEK_SET);
- char buf[5] = {0};
- fread(buf, 1, 4, f);
- fclose(f);
- if (size != 17 || strcmp(buf, "xbox") != 0) { errno = 0; return fail("seek size=" + std::to_string(size)); }
-
- std::string sub = dir + "/fake08-xex-dir";
- mkdir(sub.c_str(), 0777);
- struct stat sd;
- bool dirOk = stat(sub.c_str(), &sd) == 0 && S_ISDIR(sd.st_mode);
- log(std::string("mkdir/stat dir: ") + (dirOk ? "ok" : "FAILED"));
- if (!dirOk) fail("mkdir");
- if (dirOk && rmdir(sub.c_str()) != 0) fail("rmdir");
-
- if (remove(path.c_str()) != 0) fail("remove");
- bool gone = stat(path.c_str(), &st) != 0;
- log(std::string("remove: ") + (gone ? "ok" : "FAILED"));
- if (!gone) { errno = 0; fail("still there"); }
- return dirOk && gone;
-}
-
-int main(int, char **) {
- std::vector<std::string> summary;
-
- struct timeval tv;
- gettimeofday(&tv, nullptr);
- time_t t = tv.tv_sec;
- char date[64];
- strftime(date, sizeof date, "%Y-%m-%d %H:%M:%S", gmtime(&t));
- log(std::string("time: ") + date + " UTC");
-
- clock_t c0 = clock();
- xex_sleep_ms(500);
- long ms = (long)((clock() - c0) * 1000 / CLOCKS_PER_SEC);
- log("clock over sleep(500): " + std::to_string(ms) + " ms");
- summary.push_back(std::string("time ") + date + " clk " + std::to_string(ms));
-
- // Which kernel device names exist on this console? (USB naming differs
- // between FAT32 sticks and sticks configured as Xbox storage.)
- const char *probes[] = {
- "\\Device\\Mass0", "\\Device\\Mass1", "\\Device\\Mass2",
- "\\Device\\Mass0PartitionFile\\Storage", "\\Device\\Mass1PartitionFile\\Storage",
- "\\Device\\Mass2PartitionFile\\Storage",
- "\\Device\\Mass0\\Partition1", "\\Device\\Mass0\\Partition0",
- "\\Device\\Harddisk1\\Partition1", "\\Device\\Harddisk1\\Partition0",
- "\\Device\\Harddisk0\\Partition1", "\\Device\\Cdrom0",
- };
- std::string found = "dev:";
- for (const char *probe : probes) {
- xex_unmount("probe");
- if (xex_mount("probe", probe) != 0) {
- log(std::string("probe ") + probe + ": mount failed");
- continue;
- }
- DIR *d = opendir("probe:");
- bool ok = d != nullptr;
- int n = 0;
- if (d) { while (readdir(d)) n++; closedir(d); }
- xex_unmount("probe");
- log(std::string("probe ") + probe + ": " + (ok ? "OK, " + std::to_string(n) + " entries" : std::string("no (") + strerror(errno) + ")"));
- if (ok) {
- const char *tail = strrchr(probe, '\\');
- found += std::string(" ") + (strncmp(probe, "\\Device\\Mass", 13) == 0 ? probe + 8 : tail + 1);
- }
- }
- summary.push_back(found);
-
- const char *devices[] = {"game:", "usb0:", "usb1:", "usb2:", "hdd:"};
- for (const char *dev : devices) {
- struct stat st;
- if (stat(dev, &st) != 0) {
- log(std::string(dev) + " not present");
- continue;
- }
- int n = listDir(dev, 8);
- bool rw = fileRoundTrip(dev);
- std::string s = std::string(dev) + " " + std::to_string(n) + " files, rw " + (rw ? "ok" : "FAIL: " + g_failStep);
- log(s);
- summary.push_back(s);
- }
- listDir("usb0:/p8carts", 5);
-
- // keep the full report next to the XEX
- if (FILE *f = fopen("game:/fs-test-report.txt", "w")) {
- fputs(report.c_str(), f);
- fclose(f);
- }
-
- for (auto &s : summary) {
- xex_notify(s.c_str());
- xex_sleep_ms(4000);
- }
- return 0;
-}
diff --git a/platform/xex/tests/fs/xex.toml b/platform/xex/tests/fs/xex.toml
deleted file mode 100644
index 0854722..0000000
--- a/platform/xex/tests/fs/xex.toml
+++ /dev/null
@@ -1,3 +0,0 @@
-title_id = 0x46383038 # "F808"
-load_address = 0x82000000
-module_flags = ["TITLE"]
diff --git a/platform/xex/tests/hello/main.cpp b/platform/xex/tests/hello/main.cpp
deleted file mode 100644
index 95d3d8f..0000000
--- a/platform/xex/tests/hello/main.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-// Runtime check 1: C++ runtime in a GCC-built XEX (static constructor,
-// exception, std::regex, a 896 KB deep stack), reported with guide
-// notifications.
-#include <string>
-#include <regex>
-#include <stdexcept>
-#include <cstdio>
-
-#include "xex_runtime.h"
-
-struct StaticInit {
- int value;
- StaticInit() : value(42) {}
-};
-static StaticInit g_static;
-
-// Stack probe: recurses in 32 KB frames, logging each 64 KB to
-// game:/stack-test.txt, so a crash shows how deep the main thread's stack
-// goes (xex-link asks for 1 MB).
-static void stackLog(int kb) {
- if (FILE *f = fopen("game:/stack-test.txt", "a")) {
- fprintf(f, "stack %d KB ok\n", kb);
- fclose(f);
- }
-}
-
-static int __attribute__((noinline)) stackDepth(int kb, int limitKb) {
- volatile char frame[32 * 1024];
- for (unsigned i = 0; i < sizeof(frame); i += 512) frame[i] = (char)kb;
- if (kb % 64 == 0) stackLog(kb);
- int r = kb >= limitKb ? kb : stackDepth(kb + 32, limitKb);
- return r + frame[0] - (char)kb; // keeps the frame live
-}
-
-int main(int, char **) {
- std::string result = "GCC XEX ok:";
- result += g_static.value == 42 ? " ctor" : " CTOR-FAIL";
-
- try {
- throw std::runtime_error("x");
- } catch (const std::exception &) {
- result += " exc";
- } catch (...) {
- result += " EXC-WRONG";
- }
-
- std::smatch m;
- std::string s = "#include foo.lua";
- bool re = std::regex_search(s, m, std::regex("#include\\s+([a-z.]+)")) && m[1] == "foo.lua";
- result += re ? " regex" : " REGEX-FAIL";
-
- remove("game:/stack-test.txt");
- int deepest = stackDepth(32, 896);
- result += deepest >= 896 ? " stack896K" : " STACK-FAIL";
-
- printf("hello: %s\n", result.c_str());
- xex_notify("Hello from FAKE-08 XEX (GCC)");
- xex_sleep_ms(3000);
- xex_notify(result.c_str());
- xex_sleep_ms(5000);
- return 0;
-}
diff --git a/platform/xex/tests/hello/xex.toml b/platform/xex/tests/hello/xex.toml
deleted file mode 100644
index 0854722..0000000
--- a/platform/xex/tests/hello/xex.toml
+++ /dev/null
@@ -1,3 +0,0 @@
-title_id = 0x46383038 # "F808"
-load_address = 0x82000000
-module_flags = ["TITLE"]
diff --git a/platform/xex/tests/video/main.cpp b/platform/xex/tests/video/main.cpp
deleted file mode 100644
index feaa023..0000000
--- a/platform/xex/tests/video/main.cpp
+++ /dev/null
@@ -1,163 +0,0 @@
-// Runtime check 3: CPU-drawn frames through the title's own GPU ring
-// (xex_video) and controller input (xex_input). Moving gradient, a square
-// moved with the d-pad/left stick, A/B/X/Y change its colour, a bar shows
-// the frame rate. The Xbox button opens the Guide (Xbox Home leaves);
-// Back+Start returns to the dashboard.
-#include <cstdio>
-#include <cstdint>
-#include <cstdarg>
-
-#include "xex_runtime.h"
-#include "xex_video.h"
-#include "xex_input.h"
-
-// Diagnostics: every trace line is appended to game:/video-log.txt (the
-// file is closed after each line so it survives a hang).
-static void logLine(const char *fmt, ...) {
- char line[256];
- va_list ap;
- va_start(ap, fmt);
- vsnprintf(line, sizeof line, fmt, ap);
- va_end(ap);
- printf("video: %s\n", line);
- if (FILE *f = fopen("game:/video-log.txt", "a")) {
- fprintf(f, "%s\n", line);
- fclose(f);
- }
-}
-
-static const char *const buttonNames[16] = {
- "UP", "DOWN", "LEFT", "RIGHT", "START", "BACK", "LTHUMB", "RTHUMB",
- "LB", "RB", "bit10", "bit11", "A", "B", "X", "Y"};
-
-// Logs every change of a controller: buttons by name, triggers past half,
-// sticks past half in each direction.
-static void logPadChanges(int port, int connected, const xex_pad &pad) {
- static int lastConnected[4] = {-2, -2, -2, -2};
- static xex_pad last[4];
- if (connected != lastConnected[port]) {
- logLine("pad %d: %s", port, connected == 0 ? "connected" : "not connected");
- lastConnected[port] = connected;
- }
- if (connected != 0) return;
- uint16_t changed = pad.buttons ^ last[port].buttons;
- for (int b = 0; b < 16; b++) {
- if (changed & (1 << b))
- logLine("pad %d: %s %s", port, buttonNames[b], (pad.buttons & (1 << b)) ? "down" : "up");
- }
- auto zone = [](int v) { return v > 16000 ? 1 : v < -16000 ? -1 : 0; };
- const int16_t now[4] = {pad.lx, pad.ly, pad.rx, pad.ry};
- const int16_t before[4] = {last[port].lx, last[port].ly, last[port].rx, last[port].ry};
- static const char *const axis[4] = {"left stick x", "left stick y", "right stick x", "right stick y"};
- for (int a = 0; a < 4; a++) {
- if (zone(now[a]) != zone(before[a])) logLine("pad %d: %s %d (%s)", port, axis[a], now[a],
- zone(now[a]) > 0 ? "+" : zone(now[a]) < 0 ? "-" : "centre");
- }
- if ((pad.left_trigger > 128) != (last[port].left_trigger > 128))
- logLine("pad %d: LT %u", port, pad.left_trigger);
- if ((pad.right_trigger > 128) != (last[port].right_trigger > 128))
- logLine("pad %d: RT %u", port, pad.right_trigger);
- last[port] = pad;
-}
-
-int main(int, char **) {
- remove("game:/video-log.txt");
- logLine("start");
- xex_video_trace = logLine;
- xex_video_dump_registers("before init");
- if (xex_video_init() != 0) {
- logLine("init failed: %s", xex_video_error());
- xex_notify("video init failed");
- xex_sleep_ms(4000);
- return 1;
- }
-
- int sx = 200, sy = 200;
- uint32_t colour = xex_video_rgb(255, 0, 77);
- uint64_t freq = xex_timebase_freq();
- uint64_t last = xex_timebase(), second = last;
- int frames = 0, fps = 0;
- unsigned t = 0;
-
- logLine("init ok");
- xex_video_dump_registers("after init");
- uint64_t startTime = xex_timebase();
- int seconds = 0;
- for (;;) {
- xex_pad pad;
- int connected = xex_input_get(0, &pad);
- logPadChanges(0, connected, pad);
- for (int port = 1; port < 4; port++) {
- xex_pad other;
- logPadChanges(port, xex_input_get(port, &other), other);
- }
- // stop by itself after 20 s, so a black screen still tells whether the loop runs
- // never end by ourselves while the Guide shows: XAM would wait for a
- // swap that never comes
- if (xex_timebase() - startTime > 60 * freq && !xex_video_guide_visible()) {
- logLine("60 s elapsed, exiting");
- break;
- }
- if ((pad.buttons & XEX_PAD_BACK) && (pad.buttons & XEX_PAD_START)) break;
-
- int speed = 6;
- if ((pad.buttons & XEX_PAD_LEFT) || pad.lx < -12000) sx -= speed;
- if ((pad.buttons & XEX_PAD_RIGHT) || pad.lx > 12000) sx += speed;
- if ((pad.buttons & XEX_PAD_UP) || pad.ly > 12000) sy -= speed;
- if ((pad.buttons & XEX_PAD_DOWN) || pad.ly < -12000) sy += speed;
- if (pad.buttons & XEX_PAD_A) colour = xex_video_rgb(0, 228, 54);
- if (pad.buttons & XEX_PAD_B) colour = xex_video_rgb(255, 0, 77);
- if (pad.buttons & XEX_PAD_X) colour = xex_video_rgb(41, 173, 255);
- if (pad.buttons & XEX_PAD_Y) colour = xex_video_rgb(255, 236, 39);
-
- xex_frame f = xex_video_begin();
- if (sx < 0) sx = 0;
- if (sy < 0) sy = 0;
- if (sx > f.window_width - 128) sx = f.window_width - 128;
- if (sy > f.window_height - 128) sy = f.window_height - 128;
-
- for (int y = 0; y < f.window_height; y++) {
- int py = f.window_y + y;
- for (int x = 0; x < f.window_width; x++) {
- uint32_t c;
- if (x >= sx && x < sx + 128 && y >= sy && y < sy + 128) {
- c = colour;
- } else if (y >= f.window_height - 40 && y < f.window_height - 16 && x >= 16 &&
- x < 16 + 16 * 36 && (x - 16) % 36 < 30) {
- int b = (x - 16) / 36;
- c = (pad.buttons & (1 << b)) ? xex_video_rgb(255, 255, 255) : xex_video_rgb(40, 40, 40);
- } else if (y >= f.window_height - 64 && y < f.window_height - 52 &&
- ((x >= 16 && x < 16 + pad.left_trigger) ||
- (x >= 320 && x < 320 + pad.right_trigger))) {
- c = xex_video_rgb(255, 163, 0);
- } else if (y < 24 && x < fps * 8) {
- c = xex_video_rgb(255, 255, 255);
- } else {
- c = xex_video_rgb((uint8_t)(x + t), (uint8_t)(y + t / 2), 96);
- }
- f.pixels[xex_video_tiled_index(f.window_x + x, py, f.pitch)] = c;
- }
- }
- xex_video_present();
- t += 2;
-
- frames++;
- uint64_t now = xex_timebase();
- if (now - second >= freq) {
- fps = frames;
- logLine("second %d: %d fps, %dx%d window at %d,%d, pad %s buttons %04x",
- ++seconds, fps, f.window_width, f.window_height, f.window_x, f.window_y,
- connected == 0 ? "ok" : "none", pad.buttons);
- if (seconds == 2) {
- xex_video_dump_registers("running");
- xex_video_dump_lut();
- }
- frames = 0;
- second = now;
- }
- last = now;
- }
- (void)last;
- logLine("exit");
- return 0;
-}
diff --git a/platform/xex/tests/video/xex.toml b/platform/xex/tests/video/xex.toml
deleted file mode 100644
index 0854722..0000000
--- a/platform/xex/tests/video/xex.toml
+++ /dev/null
@@ -1,3 +0,0 @@
-title_id = 0x46383038 # "F808"
-load_address = 0x82000000
-module_flags = ["TITLE"]
diff --git a/platform/xex/tools/.xenon-forge-src b/platform/xex/tools/.xenon-forge-src
new file mode 160000
index 0000000..2fcc78c
--- /dev/null
+++ b/platform/xex/tools/.xenon-forge-src
@@ -0,0 +1 @@
+Subproject commit 2fcc78c40f410b52f0bd86b1c68257d79da645ee
diff --git a/platform/xex/tools/build-xex-link.sh b/platform/xex/tools/build-xex-link.sh
deleted file mode 100755
index d35c80d..0000000
--- a/platform/xex/tools/build-xex-link.sh
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/sh
-# Builds xex-link (ELF -> XEX converter of xenon-forge) as a static binary
-# into platform/xex/tools/bin/xex-link. Run from the repository root:
-# docker run --rm -v $PWD:/build_dir rust:latest \
-# /bin/sh -ex /build_dir/platform/xex/tools/build-xex-link.sh
-# The xenon-forge checkout is kept in tools/.xenon-forge-src (git-ignored).
-set -e
-XENON_FORGE_REPO=https://github.com/landaire/xenon-forge.git
-XENON_FORGE_COMMIT=2fcc78c
-HERE=$(cd "$(dirname "$0")" && pwd)
-SRC="$HERE/.xenon-forge-src"
-
-if [ ! -d "$SRC/.git" ]; then
- git clone -q "$XENON_FORGE_REPO" "$SRC"
-fi
-cd "$SRC"
-git fetch -q origin
-git checkout -q -f "$XENON_FORGE_COMMIT"
-
-# Main thread stack: 1 MB instead of 256 KB (Lua and the emulator core
-# recurse deeper than 256 KB allows; xsdk also gives titles 1 MB).
-sed -i 's/w32(&mut headers, 0x40000); \/\/ SizeOfStackReserve/w32(\&mut headers, 0x100000); \/\/ SizeOfStackReserve/' \
- src/crates/xex-link/src/pe.rs
-grep -q '0x100000); // SizeOfStackReserve' src/crates/xex-link/src/pe.rs
-
-rustup target add x86_64-unknown-linux-musl
-cargo build --release -p xex-link --target x86_64-unknown-linux-musl
-
-mkdir -p "$HERE/bin"
-cp target/x86_64-unknown-linux-musl/release/xex-link "$HERE/bin/xex-link"
-"$HERE/bin/xex-link" --help | head -1
diff --git a/platform/xex/xexkit b/platform/xex/xexkit
new file mode 160000
index 0000000..9af765d
--- /dev/null
+++ b/platform/xex/xexkit
@@ -0,0 +1 @@
+Subproject commit 9af765d755cd17ab996c911d926dfe7fa59470cc