Skip to content
Draft
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
22 changes: 22 additions & 0 deletions .github/workflows/generate-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: generate-release
on:
workflow_dispatch:
jobs:
build-android:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install dependencies
run: sudo apt-get install -y ninja-build
- name: Build SoH
run: |
./gradlew assembleDebug -P elfBuildType=RelWithDebInfo
mv app/build/outputs/apk/debug/app-debug.apk soh.apk
- name: Create release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
file: soh.apk
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ google-services.json

# Android Profiling
*.hprof

# vscode
.vscode
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "app/jni/src/libultraship"]
path = app/jni/src/libultraship
url = https://github.com/Waterdish/libultraship.git
url = https://github.com/robertkirkman/libultraship.git
51 changes: 24 additions & 27 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
def buildAsLibrary = project.hasProperty('BUILD_AS_LIBRARY');
def buildAsLibrary = project.hasProperty('BUILD_AS_LIBRARY')
def buildAsApplication = !buildAsLibrary
if (buildAsApplication) {
apply plugin: 'com.android.application'
Expand All @@ -8,25 +8,21 @@ else {
}

android {
ndkPath "/home/waterdish/Android/Sdk/ndk/26.0.10792818" // Point to your own NDK
compileSdkVersion 31
ndkVersion '27.2.12479018'
compileSdkVersion 34
defaultConfig {
if (buildAsApplication) {
applicationId "com.dishii.soh"
}
minSdkVersion 18
targetSdkVersion 31
minSdkVersion 21
//noinspection OldTargetApi
targetSdkVersion 34
versionCode 6
versionName "1.3.0"
externalNativeBuild {
//ndkBuild {
// arguments "APP_PLATFORM=android-23"
// abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
//}
cmake {
arguments "-DANDROID_APP_PLATFORM=android-23", "-DANDROID_STL=c++_static", "-DHAVE_LD_VERSION_SCRIPT=OFF",'-DUSE_OPENGLES=ON'
arguments "-DANDROID_APPNAME=${applicationId}", "-DANDROID_APP_PLATFORM=android-21", "-DANDROID_STL=c++_static", "-DHAVE_LD_VERSION_SCRIPT=OFF", "-DUSE_OPENGLES=ON", "-DCMAKE_BUILD_TYPE=$elfBuildType"
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
//abiFilters 'arm64-v8a'
}
}
}
Expand All @@ -36,7 +32,14 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
applicationVariants.all { variant ->
buildFeatures {
buildConfig = true
}
namespace 'com.dishii.soh'
lint {
abortOnError false
}
applicationVariants.configureEach { variant ->
tasks["merge${variant.name.capitalize()}Assets"]
.dependsOn("externalNativeBuild${variant.name.capitalize()}")
}
Expand All @@ -45,27 +48,21 @@ android {
jniLibs.srcDir 'libs'
}
externalNativeBuild {
//ndkBuild {
// path 'jni/Android.mk'
//}
cmake {
path 'jni/CMakeLists.txt'
version "3.25.1"
version "3.31.5"
}
}

}
lintOptions {
abortOnError false
}


if (buildAsLibrary) {
libraryVariants.all { variant ->
variant.outputs.each { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith(".aar")) {
def fileName = "org.libsdl.app.aar";
output.outputFile = new File(outputFile.parent, fileName);
def fileName = "com.dishii.soh.aar"
output.outputFile = new File(outputFile.parent, fileName)
}
}
}
Expand All @@ -74,13 +71,13 @@ android {

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.core:core:1.7.0' // Use the latest version
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.core:core:1.13.1'
implementation 'androidx.constraintlayout:constraintlayout:2.2.0'
}

task wrapper(type: Wrapper) {
gradleVersion = '7.3'
tasks.register('wrapper', Wrapper) {
gradleVersion = '8.10.2'
}

task prepareKotlinBuildScriptModel {
tasks.register('prepareKotlinBuildScriptModel') {
}
Binary file removed app/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 0 additions & 5 deletions app/gradle/wrapper/gradle-wrapper.properties

This file was deleted.

2 changes: 1 addition & 1 deletion app/jni/src/libultraship
50 changes: 6 additions & 44 deletions app/jni/src/soh/soh/Extractor/Extract.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ enum class ButtonId : int {
};

#ifdef __ANDROID__
const char* javaRomPath = NULL;
static char javaRomPath[4096] = { 0 };
bool fileDialogOpen = false;

//function to be called from C
Expand All @@ -108,7 +108,7 @@ void openFilePickerFromC(JNIEnv* env, jobject javaObject) {
// Define the native method to handle the selected file path
extern "C" void JNICALL Java_com_dishii_soh_MainActivity_nativeHandleSelectedFile(JNIEnv* env, jobject obj, jstring filePath) {
const char* filePathStr = env->GetStringUTFChars(filePath, 0);
javaRomPath = strdup(filePathStr); // save filepath to string
snprintf(javaRomPath, sizeof(javaRomPath), "%s", filePathStr);
fileDialogOpen = false;
env->ReleaseStringUTFChars(filePath, filePathStr);
}
Expand Down Expand Up @@ -248,7 +248,7 @@ void Extractor::GetRoms(std::vector<std::string>& roms) {
// if (h != nullptr) {
// CloseHandle(h);
//}
#elif unix && !defined(__ANDROID__)
#elif unix
// Open the directory of the app.
DIR* d = opendir(mSearchPath.c_str());
struct dirent* dir;
Expand All @@ -272,33 +272,6 @@ void Extractor::GetRoms(std::vector<std::string>& roms) {
}
}
closedir(d);
#elif defined(__ANDROID__)
const char* androidAssetPath = SDL_AndroidGetExternalStoragePath();
if (androidAssetPath == NULL) {
printf("Error accessing Android assets directory: %s\n", SDL_GetError());
return;
}

// Use androidAssetPath for file operations
// Example: List files in the directory
DIR* dir;
struct dirent* entry;

if ((dir = opendir(androidAssetPath)) != NULL) {
while ((entry = readdir(dir)) != NULL) {
if (entry->d_type == DT_REG) {
char* filename = entry->d_name;
// Check file extension and process accordingly
if (strstr(filename, ".n64") || strstr(filename, ".z64") || strstr(filename, ".v64")) {
std::string fullPath = std::string(androidAssetPath) + "/" + filename;
roms.push_back(fullPath);
}
}
}
closedir(dir);
} else {
printf("Error opening directory: %s\n", androidAssetPath);
}
#else
for (const auto& file : std::filesystem::directory_iterator(mSearchPath)) {
if (file.is_directory())
Expand Down Expand Up @@ -358,29 +331,18 @@ bool Extractor::GetRomPathFromBox() {
//Do nothing until a file is chosen
SDL_Delay(250);
}
SDL_Log("%s",javaRomPath);
selection.push_back(javaRomPath);

if (selection.empty()) {
return false;
}

mCurrentRomPath = selection[0];

if (javaRomPath) {
free((void*)javaRomPath);
javaRomPath = NULL;
}
SDL_Log("javaRomPath: %s", javaRomPath);

selection.push_back(javaRomPath);
#else
auto selection = pfd::open_file("Select a file", mSearchPath, { "N64 Roms", "*.z64 *.n64 *.v64" }).result();
#endif

if (selection.empty()) {
return false;
}

mCurrentRomPath = selection[0];
#endif
mCurRomSize = GetCurRomSize();
return true;
}
Expand Down
7 changes: 3 additions & 4 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
com.gamemaker.game
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dishii.soh"
android:versionCode="6"
android:versionName="1.3.0"
android:installLocation="auto">
Expand Down Expand Up @@ -54,8 +53,8 @@
<!-- Allow access to the vibrator -->
<uses-permission android:name="android.permission.VIBRATE" />

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />

<!-- if you want to capture audio, uncomment this. -->
<!-- <uses-permission android:name="android.permission.RECORD_AUDIO" /> -->
Expand All @@ -73,7 +72,8 @@
android:allowBackup="true"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:hardwareAccelerated="true"
android:appCategory="game" >
android:appCategory="game"
android:requestLegacyExternalStorage="true">


<!-- Example of setting SDL hints from AndroidManifest.xml:
Expand All @@ -84,7 +84,6 @@


<activity android:name="MainActivity"
android:label="@string/app_name"
android:alwaysRetainTaskState="true"
android:launchMode="singleInstance"
android:configChanges="layoutDirection|locale|orientation|uiMode|screenLayout|screenSize|smallestScreenSize|keyboard|keyboardHidden|navigation"
Expand Down
Empty file.
Loading