Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,16 @@

/wipeout/
/build/
/.cxx/
/android/app/.cxx/
/android/.gradle/
/android/app/build/
/android/gradle-home/
/android/local.properties
/android/gradle/wrapper/gradle-wrapper.jar
/third_party/

/wipegame
/wipegame.exe
/save.dat
.DS_STORE
gamecontrollerdb.txt
63 changes: 3 additions & 60 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,67 +47,10 @@ find_package(OpenGL)
find_package(GLEW)
find_package(SDL2)

set(common_src
src/wipeout/camera.c
src/wipeout/camera.h
src/wipeout/droid.c
src/wipeout/droid.h
src/wipeout/game.c
src/wipeout/game.h
src/wipeout/hud.c
src/wipeout/hud.h
src/wipeout/image.c
src/wipeout/image.h
src/wipeout/ingame_menus.c
src/wipeout/ingame_menus.h
src/wipeout/intro.c
src/wipeout/intro.h
src/wipeout/main_menu.c
src/wipeout/main_menu.h
src/wipeout/menu.c
src/wipeout/menu.h
src/wipeout/object.c
src/wipeout/object.h
src/wipeout/particle.c
src/wipeout/particle.h
src/wipeout/race.c
src/wipeout/race.h
src/wipeout/scene.c
src/wipeout/scene.h
src/wipeout/sfx.c
src/wipeout/sfx.h
src/wipeout/ship.c
src/wipeout/ship.h
src/wipeout/ship_ai.c
src/wipeout/ship_ai.h
src/wipeout/ship_player.c
src/wipeout/ship_player.h
src/wipeout/title.c
src/wipeout/title.h
src/wipeout/track.c
src/wipeout/track.h
src/wipeout/ui.c
src/wipeout/ui.h
src/wipeout/weapon.c
src/wipeout/weapon.h
src/input.c
src/input.h
src/mem.c
src/mem.h
src/platform.h
src/render.h
src/system.c
src/system.h
src/types.c
src/types.h
src/utils.c
src/utils.h

packaging/windows/wipeout.exe.manifest
packaging/windows/wipeout.rc
)
set(WIPEOUT_ROOT "${CMAKE_SOURCE_DIR}")
include("${CMAKE_SOURCE_DIR}/cmake/wipeout_sources.cmake")

add_executable(wipeout WIN32 ${common_src})
add_executable(wipeout WIN32 ${WIPEOUT_COMMON_SRC})
set_property(TARGET wipeout PROPERTY C_STANDARD 11)
target_include_directories(wipeout PRIVATE src)
target_include_directories(wipeout SYSTEM PRIVATE src/libs)
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,11 @@ emcmake cmake -S path/to/wipeout-rewrite -B path/to/build-dir -DPLATFORM=SOKOL
cmake --build path/to/build-dir
```

## Android

See `android/README.md` for the Android Studio/NDK build, SDL2 setup, and asset
packing instructions.

## Build Flags for cmake

The following is a table for project specific build flags using CMake:
Expand Down
34 changes: 34 additions & 0 deletions android/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Android build

This project uses the SDL2 Android Java layer plus a native shared library built
with the NDK.

## Prereqs
- Android Studio with SDK Platform **36** installed.
- NDK **r29+** installed.
- CMake **3.22+** (Android Studio can install this).

If your local NDK revision isn't `29.0.0`, pass `-PndkVersion=29.x.y` to Gradle
or edit `android/app/build.gradle`.

## SDL2 source
SDL2 is fetched by CMake on first build (tag `release-2.32.10`) into
`third_party/SDL`. If you want to use a local checkout instead, populate that
folder ahead of time.

## Assets
Place the game data under `android/app/src/main/assets/wipeout/` so paths like
`wipeout/textures/` and `wipeout/music/` resolve inside the APK.

```
android/app/src/main/assets/wipeout/
textures/
sound/
music/
intro.mpeg
```

## Build
Open the `android/` folder in Android Studio and run the app. If you prefer a
CLI build, generate a Gradle wrapper in `android/` or use a local Gradle
install to run `assembleDebug`.
92 changes: 92 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}

def sdlDir = file("${rootDir}/../third_party/SDL")
def sdlDirPath = sdlDir.absolutePath.replace('\\', '/')
def ndkVer = project.findProperty("ndkVersion") ?: "29.0.0"

android {
namespace "com.phoboslab.wipeout"
compileSdk 36
ndkVersion "29.0.14206865"
buildToolsVersion "36.1.0"

defaultConfig {
applicationId "com.phoboslab.wipeout"
minSdk 26
targetSdk 36
versionCode 1
versionName "0.1"

externalNativeBuild {
cmake {
arguments "-DSDL2_SOURCE_DIR=${sdlDirPath}"
}
}

ndk {
abiFilters "arm64-v8a"
}
}

externalNativeBuild {
cmake {
path "src/main/cpp/CMakeLists.txt"
version "3.22.1"
}
}

sourceSets {
main {
java.srcDirs += [
"src/main/java",
"src/main/kotlin",
"${sdlDir}/android-project/app/src/main/java"
]
res.srcDirs += [
"${sdlDir}/android-project/app/src/main/res",
"src/main/res"
]
assets.srcDirs += ["src/main/assets"]
}
}

buildTypes {
release {
minifyEnabled false
signingConfig signingConfigs.debug
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = "17"
}
}

afterEvaluate {
android.applicationVariants.all { variant ->
def cap = variant.name.capitalize()
def nativeTask = tasks.findByName("externalNativeBuild${cap}")
if (nativeTask != null) {
def kotlinTask = tasks.findByName("compile${cap}Kotlin")
if (kotlinTask != null) {
kotlinTask.dependsOn(nativeTask)
}
def javaTask = tasks.findByName("compile${cap}JavaWithJavac")
if (javaTask != null) {
javaTask.dependsOn(nativeTask)
}
}
}
}

dependencies {
}
1 change: 1 addition & 0 deletions android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Placeholder for custom ProGuard rules.
22 changes: 22 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.phoboslab.wipeout">

<application
android:label="@string/wipeout_app_name"
android:allowBackup="false"
android:extractNativeLibs="true"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">

<activity
android:name=".MainActivity"
android:exported="true"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
android:launchMode="singleTask"
android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
2 changes: 2 additions & 0 deletions android/app/src/main/assets/wipeout/game_data_goes_here.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
replace this directory with the one from the wipeout NTSC version and copy
the common/ models from the PC version in.
60 changes: 60 additions & 0 deletions android/app/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
cmake_minimum_required(VERSION 3.22)
project(wipeout_android LANGUAGES C CXX)

set(WIPEOUT_ROOT "${CMAKE_CURRENT_LIST_DIR}/../../../../..")
get_filename_component(WIPEOUT_ROOT "${WIPEOUT_ROOT}" ABSOLUTE)

set(SDL2_SOURCE_DIR "${WIPEOUT_ROOT}/third_party/SDL" CACHE PATH "Path to SDL2 source")
set(SDL2_GIT_TAG "release-2.32.10" CACHE STRING "SDL2 git tag")

set(SDL_SHARED ON CACHE BOOL "" FORCE)
set(SDL_STATIC OFF CACHE BOOL "" FORCE)
set(SDL_TEST OFF CACHE BOOL "" FORCE)

if(EXISTS "${SDL2_SOURCE_DIR}/CMakeLists.txt")
add_subdirectory("${SDL2_SOURCE_DIR}" "${CMAKE_BINARY_DIR}/sdl2")
else()
include(FetchContent)
FetchContent_Declare(SDL2
GIT_REPOSITORY https://github.com/libsdl-org/SDL.git
GIT_TAG ${SDL2_GIT_TAG}
GIT_SHALLOW TRUE
SOURCE_DIR "${SDL2_SOURCE_DIR}"
BINARY_DIR "${CMAKE_BINARY_DIR}/sdl2"
)
FetchContent_MakeAvailable(SDL2)
endif()

include("${WIPEOUT_ROOT}/cmake/wipeout_sources.cmake")

add_library(main SHARED ${WIPEOUT_COMMON_SRC})
set_property(TARGET main PROPERTY C_STANDARD 11)

target_sources(main PRIVATE
"${WIPEOUT_ROOT}/src/platform_sdl.c"
"${WIPEOUT_ROOT}/src/render_gl.c"
)

target_include_directories(main PRIVATE "${WIPEOUT_ROOT}/src")
target_include_directories(main SYSTEM PRIVATE "${WIPEOUT_ROOT}/src/libs")

target_compile_definitions(main PRIVATE RENDERER_GL USE_GLES2 PLM_USE_SDL_RWOPS)

find_library(log-lib log)
find_library(android-lib android)
find_library(egl-lib EGL)
find_library(gles-lib GLESv2)

if(TARGET SDL2::SDL2)
target_link_libraries(main SDL2::SDL2)
elseif(TARGET SDL2)
target_link_libraries(main SDL2)
endif()

target_link_libraries(main
${log-lib}
${android-lib}
${egl-lib}
${gles-lib}
m
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.phoboslab.wipeout

import org.libsdl.app.SDLActivity

class MainActivity : SDLActivity()
3 changes: 3 additions & 0 deletions android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<resources>
<string name="wipeout_app_name">wipEout</string>
</resources>
4 changes: 4 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
plugins {
id 'com.android.application' version '8.5.2' apply false
id 'org.jetbrains.kotlin.android' version '1.9.24' apply false
}
15 changes: 15 additions & 0 deletions android/buildapks.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@echo off
setlocal
set "SCRIPT_DIR=%~dp0"
set "GRADLE_USER_HOME=%SCRIPT_DIR%gradle-home"
call "%SCRIPT_DIR%gradlew.bat" --no-daemon --console=plain assembleDebug
if errorlevel 1 exit /b 1
taskkill /im ninja.exe /f >nul 2>&1
taskkill /im cmake.exe /f >nul 2>&1
rmdir /s /q "%SCRIPT_DIR%app\\.cxx\\RelWithDebInfo" >nul 2>&1
call "%SCRIPT_DIR%gradlew.bat" --no-daemon --console=plain assembleRelease
if errorlevel 1 exit /b 1

echo.
echo APKs written to app\build\outputs\apk
endlocal
5 changes: 5 additions & 0 deletions android/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
org.gradle.jvmargs=-Xmx4g -Dfile.encoding=UTF-8
android.useAndroidX=true
kotlin.code.style=official
ndkVersion=29.0.14206865
android.suppressUnsupportedCompileSdk=36
7 changes: 7 additions & 0 deletions android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading