Skip to content

About

ReXGlue на Андроиде: порт игр Xbox 360 на телефон в три команды — APK с экранным геймпадом и установкой игры. ReXGlue for Android: Xbox 360 recompiled games to APK.

Topics

Resources

Contributing

Stars

3 stars

Watchers

0 watching

Forks

 
 

Repository files navigation

ReXGlue Android Fork

Telegram-канал Discord-сервер

ReXGlue SDK — Android

Русский · English

Без цензуры: я, блять, сделал так, что игры с Xbox 360 идут на телефоне. Это форк ReXGlue SDK под Андроид — и не эмулятор, и не обёртка, сука: игра, переведённая ReXGlue в C++, собирается в обычную .so и работает как родное приложение — Vulkan, SDL3, сенсор и геймпады.

Что уже идёт на телефоне:

  • Project 2099 — Android — Spider-Man: Edge of Time, со своим рендером reeot;
  • Plants vs. Zombies — на обычном рендере ReXGlue (Vulkan-эмуляция видеочипа Xbox), собран в APK одной командой port.ps1.

Связь — Telegram и Discord.

Plants vs. Zombies на телефоне Spider-Man: Edge of Time на телефоне

Plants vs. Zombies и Spider-Man: Edge of Time на POCO X7 Pro — оба с экранным геймпадом

Что это такое — по-простому

Игры с Xbox 360 написаны для процессора, которого нет ни в компьютере, ни в телефоне. ReXGlue переводит код игры с «языка Xbox» на обычный C++, и из него собирается настоящая программа. Это не эмулятор, который притворяется приставкой, а порт: игра работает как родная.

Оригинальный ReXGlue собирает такие порты под Windows, Linux и macOS. ReXGlue Android добавляет телефоны:

  1. Берёшь проект игры на ReXGlue — тот же, что работает на ПК.
  2. Запускаешь одну команду.
  3. Получаешь APK и ставишь его на Андроид как обычное приложение.

В APK уже всё готово, делать ничего не надо:

  • экранный геймпад, как у Xbox, — а подключишь настоящий, он сам спрячется;
  • установка игры прямо с телефона: скопировал папку с игрой, нажал «Установить игру», выбрал папку;
  • сохранения в папке приложения.

Всю ебучую возню с Андроидом — NDK, Gradle, подпись, права на папки — скрипты делают сами. Я на ней неделями сидел, тебе не придётся. Нужен только проект игры и своя копия игры: файлов игр тут нет и не будет.

Почему это ахуенно

  • Одна команда вместо недели ебли. port.ps1 сам правит CMake игры, собирает её под ARM, раскладывает библиотеки, делает ключ подписи и выдаёт готовый APK. Ни Android Studio, ни шаманства с Gradle.
  • Ставится само. setup.ps1 качает всё — JDK, SDK, NDK, CMake, Python — в одну папку и не засирает диск C:. Даже симлинки, которые Git для Windows ломает, чинит сам.
  • Ни строчки кода под Андроид. Лаунчер, установка игры с телефона, экранный геймпад, сохранения — уже лежат в шаблоне.
  • Геймпад для любой игры. Игра видит обычный Xbox-контроллер, поэтому меню и подсказки кнопок работают как есть. Подписать кнопки под свою игру — один текстовый файл.
  • Работает на Mali. Рендер Xenia в оригинальном ReXGlue на Mali даже не запускается — отказывается от видеокарты. Тут запускается, и PvZ играется.
  • Старые проекты не выкидываешь. Проекты от rexglue 0.8–0.10 собираются, имена с подчёркиваниями не ломают сборку.
  • Защита от дурака. Кириллица в пути, заглушка Python из Microsoft Store, запрет скриптов в Windows, не тот tar — на всё это я сам наступил. Скрипты либо обходят, либо по-человечески говорят, что делать.
  • Быстрее даже на ПК. Ожидание событий без опроса, вызовы функций без замка, звук не жрёт память впустую.

Что добавлено к ReXGlue

Андроид:

  • Сборка NDK под arm64-v8a (телефоны) и x86_64 (эмулятор).
  • Свои файберы на ассемблере (в Bionic нет getcontext/swapcontext), обычные мьютексы вместо robust, логи в logcat.
  • Окно — ANativeWindow от SDL3, Vulkan через VK_KHR_android_surface.
  • Vulkan-эмуляция видеочипа работает на Mali: на Андроиде не требуются геометрические шейдеры, каркасная заливка и запись в память из вершинного шейдера, которых у Mali нет.
  • Точка входа SDL_main; пути HOME/XDG ведут в папку приложения Android/data/<пакет>/files — её видно по USB.
  • Модули игры грузятся как lib<имя>.so — другие имена APK не носит.
  • Экранный Xbox-геймпад: игра видит обычный контроллер, меню и подсказки кнопок работают как есть.
  • rexglue init сразу делает проект, который собирается под телефон (libmain.so).
  • Кросс-сборка: генератор кода берётся с ПК через REXGLUE_HOST_TOOL.

Скорость (общие правки, работают везде):

  • WaitMultiple спит до сигнала, а не опрашивает хэндлы каждую миллисекунду.
  • GetFunction читает таблицу функций модуля без мьютекса.
  • Декодеры XMA создаются при первом декодировании — минус мегабайты памяти.
  • IsRangeReadable проверяет только нужные страницы, а не весь регион.
  • На Андроиде UI-цикл спит и просыпается, когда ему ставят задачу, а не крутится вхолостую.

Совместимость:

  • Проекты, сгенерированные старым rexglue (0.8–0.10), снова собираются.
  • Проекты с подчёркиваниями в имени больше не ломают свою CMake-связку.
  • Пустая аватарка профиля и USB-камера — как в Xenia (на этом спотыкался PvZ).
  • --gpu_log_resolves — пишет в лог, что игра рисует в свои текстуры, без захвата кадра (работает и на телефоне).

Всё остальное — как в ReXGlue. Изменения — небольшие отдельные коммиты поверх апстрима: их легко читать и переносить.

Порт игры на Андроид за 3 шага

Нужно: Windows 10/11, Git, ~15 ГБ места и проект игры на ReXGlue (тот, что делает rexglue init; рабочий ПК-порт сильно помогает). Телефон — Android 11+, arm64, Vulkan 1.3. Пути к папкам — только латиницей.

  1. Скачай форк вместе с сабмодулями:
    git clone --recursive https://github.com/GenryTheFox0/rexglue-android
  2. Поставь инструменты — один раз. В папке форка:
    powershell -ExecutionPolicy Bypass -File android\setup.ps1
    Скрипт сам скачает JDK 17, Android SDK с NDK r29 и CMake, готовый rexglue.exe и починит ссылки, которые Git для Windows ломает. Всё ляжет в android\tools, на диск C: ничего.
  3. Собери APK:
    powershell -ExecutionPolicy Bypass -File android\port.ps1 -Project E:\Games\MyGame -Name "My Game"
    Скрипт сам допишет в CMakeLists игры ветку под Андроид (старый файл останется как CMakeLists.txt.bak), соберёт игру и положит My Game-android.apk в папку проекта. С -Install он сразу поставит APK на подключённый телефон, а с -Abi arm64-v8a,x86_64 соберёт ещё и под эмулятор.

На телефоне: открой приложение → «УСТАНОВИТЬ ИГРУ» → выбери папку с распакованной игрой (где лежит default.xex). Или скопируй её сам в Android/data/<пакет>/files/game.

Что можно положить в папку android\ проекта игры:

  • icon.png — иконка приложения;
  • touchpad.txt — подписи экранных кнопок, по одной на строку: A=Прыжок;
  • args.txt — настройки игры (cvars ReXGlue), по одной на строку.

Ключ подписи. После первой сборки в проекте появится папка android-key. Сохрани её: без неё новые версии APK не встанут поверх старых.

В APK уже есть: лаунчер с установкой игры, экранный Xbox-геймпад (прячется, когда подключён настоящий), сохранения в папке приложения.

Сборка SDK вручную, без скриптов

Нужно: Android NDK (проверено на r29), CMake 3.25+, Ninja и rexglue, собранный под ПК, — он генерирует код во время сборки.

cmake -S . -B out/android-arm64 -G Ninja \
  -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake \
  -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=android-30 -DANDROID_STL=c++_shared \
  -DCMAKE_BUILD_TYPE=Release -DREXGLUE_BUILD_TESTS=OFF \
  -DREXGLUE_HOST_TOOL=/путь/к/ПК/rexglue
cmake --build out/android-arm64

Для эмулятора — -DANDROID_ABI=x86_64. Игра на этом SDK собирается в libmain.so и кладётся в APK вместе с SDLActivity из SDL3 (thirdparty/sdl3/android-project); шаблон такого APK — в android\template.

Честно

Порт делался вместе с ИИ (Claude), а проверял его я — на живом телефоне: POCO X7 Pro (Dimensity 8400, Mali-G720, Android 16). Adreno (Snapdragon) пока не проверен.

Известные косяки первой версии:

  • Vulkan-эмуляция видеочипа на телефоне тяжёлая: PvZ идёт, но звук подтормаживает. Свой рендер (как reeot у Project 2099) работает намного быстрее.
  • В PvZ у полупрозрачного горохострела при выборе клетки тёмный квадрат. Он есть и на ПК, и в Xenia — это старая ошибка эмуляции, разбираюсь.
  • Отрисовки с записью в память из вершинного шейдера на Mali пропускаются (у Mali нет такой возможности). В PvZ таких нет, в других играх могут быть.

Это неофициальный форк: команда ReXGlue за него не отвечает. Баги форка — сюда, в Issues, а не к ним.

Лицензия и авторы

BSD-3-Clause, как у ReXGlue, — LICENSE не тронут.

ReXGlue не связан с Microsoft и Xbox. Для игр нужна своя копия; пиратство этот проект не поддерживает.


English

No censorship: I fucking made Xbox 360 games run on a phone. This is a fork of the ReXGlue SDK for Android — not an emulator, not a wrapper: a game that ReXGlue turned into C++ is built into a plain .so and runs as a native app — Vulkan, SDL3, touch and gamepads.

Running on a phone already:

  • Project 2099 — Android — Spider-Man: Edge of Time, with its own reeot renderer;
  • Plants vs. Zombies — on ReXGlue's usual renderer (Vulkan emulation of the Xbox GPU), made into an APK by one port.ps1 command.

Contact — Telegram and Discord.

What it is, in plain words

Xbox 360 games are written for a processor that neither a PC nor a phone has. ReXGlue translates a game's code from "Xbox language" into ordinary C++, which builds into a real program. It is not an emulator pretending to be a console but a port: the game runs natively.

The original ReXGlue builds such ports for Windows, Linux and macOS. ReXGlue Android adds phones:

  1. Take a ReXGlue project of a game — the same one that runs on PC.
  2. Run one command.
  3. Get an APK and install it on Android like any app.

The APK has everything ready, nothing to do:

  • an on-screen gamepad like an Xbox one — plug a real one in and it hides itself;
  • installing the game right from the phone: copy the game's folder, tap INSTALL THE GAME, pick the folder;
  • saves in the app's folder.

All the Android bullshit — NDK, Gradle, signing, folder permissions — the scripts do themselves. I spent weeks on it so you don't have to. You need only the game's project and your own copy of the game: there are no game files here and never will be.

Why it's fucking great

  • One command instead of a week of pain. port.ps1 patches the game's CMake, builds it for ARM, lays out the libraries, makes a signing key and hands you a finished APK. No Android Studio, no Gradle voodoo.
  • Installs itself. setup.ps1 downloads everything — JDK, SDK, NDK, CMake, Python — into one folder and leaves your C: drive alone. It even fixes the symlinks Git for Windows breaks.
  • Not a line of Android code to write. The launcher, installing the game from the phone, the on-screen gamepad, saves — all in the template already.
  • A gamepad for any game. The game sees an ordinary Xbox controller, so menus and button prompts just work. Labelling the buttons for your game is one text file.
  • Runs on Mali. The original ReXGlue's Xenia renderer won't even start on Mali — it rejects the GPU. Here it starts, and Plants vs. Zombies plays.
  • Old projects keep working. Projects from rexglue 0.8–0.10 build; names with underscores don't break the build.
  • Idiot-proof. Cyrillic in a path, the Microsoft Store Python stub, Windows blocking scripts, the wrong tar — I stepped on all of it myself. The scripts either get around it or tell you in plain words what to do.
  • Faster even on PC. Event waits without polling, function lookups without a lock, sound that doesn't waste memory.

What it adds to ReXGlue

Android:

  • NDK builds for arm64-v8a (phones) and x86_64 (the emulator).
  • Fibers of its own in assembly (Bionic has no getcontext/swapcontext), plain mutexes instead of robust ones, logs in logcat.
  • The window is SDL3's ANativeWindow; Vulkan goes through VK_KHR_android_surface.
  • The Vulkan GPU emulation runs on Mali: on Android it does not require geometry shaders, wireframe fill and vertex shader memory stores, which Mali lacks.
  • A SDL_main entry point; HOME/XDG paths lead to the app's Android/data/<package>/files folder, which is reachable over USB.
  • Game modules load as lib<name>.so — the only names an APK can carry.
  • An on-screen Xbox pad: the game sees an ordinary controller, its menus and button prompts work as they are.
  • rexglue init makes a project that builds for a phone right away (libmain.so).
  • Cross builds: code generation runs a desktop rexglue named by REXGLUE_HOST_TOOL.

Speed (generic changes, every platform gets them):

  • WaitMultiple sleeps until it is signalled instead of polling its handles every millisecond.
  • GetFunction reads a module's function table without the mutex.
  • XMA decoders are made when a context first decodes — megabytes of memory saved.
  • IsRangeReadable checks only the pages it needs, not the whole region.
  • On Android the UI loop sleeps and wakes when work is queued for it, instead of spinning.

Compatibility:

  • Projects generated by an older rexglue (0.8–0.10) build again.
  • Projects with underscores in their name no longer break their CMake glue.
  • An empty gamer tile and the USB camera, as in Xenia (Plants vs. Zombies tripped on them).
  • --gpu_log_resolves logs what a game draws into its own textures, without a frame capture (on a phone too).

Everything else is ReXGlue as is. The changes are small separate commits on top of upstream, easy to read and to port.

Porting a game to Android in 3 steps

You need Windows 10/11, Git, ~15 GB of space and a ReXGlue project of the game (the one rexglue init makes; a working PC port helps a lot). The phone needs Android 11+, arm64 and Vulkan 1.3. Folder paths must be plain Latin letters.

  1. Clone the fork with its submodules:
    git clone --recursive https://github.com/GenryTheFox0/rexglue-android
  2. Install the tools — once. In the fork's folder:
    powershell -ExecutionPolicy Bypass -File android\setup.ps1
    It downloads JDK 17, the Android SDK with NDK r29 and CMake, a ready rexglue.exe, and fixes the links Git for Windows breaks. Everything goes into android\tools, nothing onto C:.
  3. Build the APK:
    powershell -ExecutionPolicy Bypass -File android\port.ps1 -Project E:\Games\MyGame -Name "My Game"
    It adds the Android branch to the game's CMakeLists (the old file stays as CMakeLists.txt.bak), builds the game and puts My Game-android.apk into the project folder. -Install puts the APK straight onto a connected phone; -Abi arm64-v8a,x86_64 also builds for the emulator.

On the phone: open the app → INSTALL THE GAME → pick the folder with the extracted game (where default.xex is). Or copy it yourself into Android/data/<package>/files/game.

What can go into the game project's android\ folder:

  • icon.png — the app icon;
  • touchpad.txt — labels for the on-screen buttons, one per line: A=Jump;
  • args.txt — the game's settings (ReXGlue cvars), one per line.

The signing key. After the first build the project gets an android-key folder. Keep it: without it new APK versions will not install over old ones.

The APK already has a launcher that installs the game, an on-screen Xbox pad (hidden while a real one is connected), and saves in the app's folder.

Building the SDK by hand, without the scripts

You need the Android NDK (tested with r29), CMake 3.25+, Ninja, and a desktop build of rexglue, which generates code during the build.

cmake -S . -B out/android-arm64 -G Ninja \
  -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake \
  -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=android-30 -DANDROID_STL=c++_shared \
  -DCMAKE_BUILD_TYPE=Release -DREXGLUE_BUILD_TESTS=OFF \
  -DREXGLUE_HOST_TOOL=/path/to/desktop/rexglue
cmake --build out/android-arm64

Use -DANDROID_ABI=x86_64 for the emulator. A game on this SDK builds into libmain.so and goes into an APK together with SDL3's SDLActivity (thirdparty/sdl3/android-project); a template of such an APK is in android\template.

Honestly

The port was made together with an AI (Claude) and tested by me on real hardware: a POCO X7 Pro (Dimensity 8400, Mali-G720, Android 16). Adreno (Snapdragon) is untested so far.

Known issues of the first version:

  • The Vulkan GPU emulation is heavy on a phone: Plants vs. Zombies runs, but its sound stutters. A renderer of its own (like Project 2099's reeot) is much faster.
  • In Plants vs. Zombies the translucent Peashooter shown while picking a tile has a dark box around it. It is there on PC and in Xenia too — an old emulation bug, being looked into.
  • On Mali, draws whose vertex shader stores to memory are skipped (Mali cannot do it). Plants vs. Zombies has none; other games may.

This is an unofficial fork; the ReXGlue team is not responsible for it. Report the fork's bugs here, in Issues, not to them.

License and credits

BSD-3-Clause, like ReXGlue — the LICENSE is untouched.

ReXGlue is not affiliated with Microsoft or Xbox. Games need your own copy; this project does not support piracy.

About

ReXGlue на Андроиде: порт игр Xbox 360 на телефон в три команды — APK с экранным геймпадом и установкой игры. ReXGlue for Android: Xbox 360 recompiled games to APK.

Topics

Resources

Contributing

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages