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
2 changes: 0 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ src/midiprogram.h -diff linguist-vendored
src/midisequencer.* -diff linguist-vendored
src/midisynth.* -diff linguist-vendored
CMakePresets.json -diff linguist-generated
builds/android/app/src/main/java/org/libsdl/app/*.java -diff linguist-vendored
builds/android/app/src/main/java/org/libsdl/app/SDLActivity.java diff
src/generated/* -diff linguist-generated

.gitattributes export-ignore
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/stable-compilation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ jobs:
cmake -G Ninja -B build . \
-DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_CXX_FLAGS="-Wall -Wextra -Wdeprecated -fsanitize=address,undefined" \
-DPLAYER_TARGET_PLATFORM=SDL2 \
-DPLAYER_BUILD_LIBLCF=ON -DPLAYER_VERSION_APPEND="$VER"
cmake --build build
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ __MACOSX
# Android
*.iml
local.properties
*.aar

# libretro
easyrpg_libretro.*
Expand Down
7 changes: 4 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ elseif(AMIGA)
elseif(PS4)
set(PLAYER_TARGET_PLATFORM "SDL2" CACHE STRING "Platform to compile for.")
else()
set(PLAYER_TARGET_PLATFORM "SDL2" CACHE STRING "Platform to compile for. Options: SDL3 SDL2 SDL1 libretro")
set(PLAYER_TARGET_PLATFORM "SDL3" CACHE STRING "Platform to compile for. Options: SDL3 SDL2 SDL1 libretro")
set_property(CACHE PLAYER_TARGET_PLATFORM PROPERTY STRINGS SDL3 SDL2 SDL1 libretro)
endif()
set(PLAYER_BUILD_EXECUTABLE ON)
Expand All @@ -578,6 +578,7 @@ if(PLAYER_TARGET_PLATFORM STREQUAL "SDL3")
target_compile_definitions(${PROJECT_NAME} PUBLIC USE_SDL=3)

player_find_package(NAME SDL3
VERSION 3.4.0
TARGET SDL3::SDL3
REQUIRED)

Expand Down Expand Up @@ -1244,9 +1245,9 @@ if(PLAYER_BUILD_EXECUTABLE AND ${PLAYER_TARGET_PLATFORM} MATCHES "^SDL.*$" AND N

set_property(TARGET ${EXE_NAME} PROPERTY LINK_FLAGS
"-sALLOW_MEMORY_GROWTH -sMINIFY_HTML=0 -sMODULARIZE -sEXPORT_NAME=createEasyRpgPlayer \
-sEXIT_RUNTIME --bind --pre-js ${PLAYER_JS_PREJS} --post-js ${PLAYER_JS_POSTJS} \
-sEXIT_RUNTIME=0 --bind --pre-js ${PLAYER_JS_PREJS} --post-js ${PLAYER_JS_POSTJS} \
-sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE=['$autoResumeAudioContext','$dynCall'] \
-sEXPORTED_RUNTIME_METHODS=['FS'] \
-sEXPORTED_RUNTIME_METHODS=['FS','HEAPU8'] \
-sEXPORTED_FUNCTIONS=_main,_malloc,_free")
set_source_files_properties("src/platform/sdl/main.cpp" PROPERTIES
OBJECT_DEPENDS "${PLAYER_JS_PREJS};${PLAYER_JS_POSTJS};${PLAYER_JS_SHELL}")
Expand Down
33 changes: 32 additions & 1 deletion builds/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
apply plugin: 'com.android.application'

android {
namespace "org.easyrpg.player"
ndkVersion '21.4.7075529'
ndkVersion "28.2.13676358"
assetPacks = [":assets"]
buildFeatures {
prefab true
}
defaultConfig {
applicationId "org.easyrpg.player"
compileSdkVersion 36
Expand Down Expand Up @@ -76,6 +80,7 @@ allprojects {
}

dependencies {
implementation files("SDL3-${sdlVersion}.aar")
implementation 'androidx.appcompat:appcompat:1.7.1'
implementation "androidx.activity:activity:1.13.0"
implementation 'com.google.android.material:material:1.13.0'
Expand All @@ -85,3 +90,29 @@ dependencies {
implementation 'androidx.documentfile:documentfile:1.1.0'
implementation 'org.ini4j:ini4j:0.5.4'
}

afterEvaluate {
preBuild.dependsOn downloadSdlAar
}

tasks.register('downloadSdlAar') {
doLast {
def sdlAarDest = file("SDL3-${sdlVersion}.aar")
if (!sdlAarDest.exists()) {
println "Downloading SDL ${sdlVersion} AAR..."
def sdlZipDest = layout.buildDirectory.file("sdl3.zip").get().asFile
sdlZipDest.parentFile.mkdirs()
new URL("https://github.com/libsdl-org/SDL/releases/download/release-${sdlVersion}/SDL3-devel-${sdlVersion}-android.zip")
.withInputStream { i -> sdlZipDest.withOutputStream { it << i } }
copy {
from zipTree(sdlZipDest)
into projectDir
include "**/*.aar"
eachFile { FileCopyDetails fcp ->
fcp.relativePath = new RelativePath(true, fcp.file.name)
}
includeEmptyDirs = false
}
}
}
}
1 change: 1 addition & 0 deletions builds/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
<!-- Setting SDL hints from AndroidManifest.xml: -->
<meta-data android:name="SDL_ENV.SDL_ACCELEROMETER_AS_JOYSTICK" android:value="0" />
<meta-data android:name="SDL_ENV.SDL_APP_NAME" android:value="EasyRPG Player" />
<meta-data android:name="SDL_ENV.SDL_ANDROID_ALLOW_RECREATE_ACTIVITY" android:value="1" />

<!-- Startup Activity -->
<activity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public class GameBrowserActivity extends BaseActivity
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

SDL.setContext(getApplicationContext());
SDL.setContext(this);

setContentView(R.layout.activity_games_browser);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ private int scanFolderHash(Context context, Uri folderURI) {

private void scanRootFolder(Activity activity, Uri folderURI) {
Context context = activity.getApplicationContext();
SDL.setContext(context);
SDL.setContext(activity);

final ArrayList<String> names = new ArrayList<>();
final ArrayList<Uri> fileURIs = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public class EasyRpgPlayerActivity extends SDLActivity implements NavigationView
@Override
protected String[] getLibraries() {
return new String[] {
"SDL2",
"SDL3",
"easyrpg_android"
};
}
Expand Down Expand Up @@ -483,15 +483,12 @@ public void showInputLayout() {
}

public void updateScreenPosition() {
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.MATCH_PARENT,
RelativeLayout.LayoutParams.MATCH_PARENT);

// Determine the multiplier
int screenWidth = getWindowManager().getDefaultDisplay().getWidth();
params.topMargin = topInset;
params.leftMargin = 0;
params.width = screenWidth;
params.height = (int)(screenWidth * 0.75);
mSurface.setLayoutParams(params);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ protected void onCreate(Bundle savedInstanceState) {
fonts1ListLayout = findViewById(R.id.settings_font1_list);
fonts2ListLayout = findViewById(R.id.settings_font2_list);

SDL.setContext(getApplicationContext());
SDL.setContext(this);

// Setup UI components
// The Font Button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class SettingsGamesFolderActivity extends BaseActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setContentView(R.layout.activity_settings_easyrpg_folders);
SDL.setContext(getApplicationContext());
SDL.setContext(this);

safError = GameBrowserHelper.SafError.OK;

Expand Down
22 changes: 0 additions & 22 deletions builds/android/app/src/main/java/org/libsdl/app/HIDDevice.java

This file was deleted.

Loading
Loading