Skip to content

Commit

Permalink
Merge pull request #22 from CleverRaven/master
Browse files Browse the repository at this point in the history
BathroomUpdateSeptember2
  • Loading branch information
xanderrootslayer authored Sep 3, 2019
2 parents 9f45c24 + b56478c commit 9088c1d
Show file tree
Hide file tree
Showing 706 changed files with 45,657 additions and 22,133 deletions.
1 change: 0 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ readability-*,\
-bugprone-misplaced-widening-cast,\
-bugprone-narrowing-conversions,\
-bugprone-unused-return-value,\
-bugprone-use-after-move,\
-cert-err34-c,\
-cert-flp30-c,\
-cert-msc30-c,\
Expand Down
7 changes: 0 additions & 7 deletions .github/workflows/json.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@ name: JSON Validation

on:
push:
branches:
- master
paths:
- "*.json"
pull_request:
branches:
- master
paths:
- "*.json"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-validator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ jobs:
- name: "Validate SUMMARY"
uses: CleverRaven/pr-validator@master
with:
description-regex: '\n\s*`{0,3}SUMMARY: +(None|((Features|Content|Interface|Mods|Balance|Bugfixes|Performance|Infrastructure|Build|I18N) +".*"))`{0,3}\s*\n'
description-regex: '(\n|^)\s*`{0,3}SUMMARY: +(None|((Features|Content|Interface|Mods|Balance|Bugfixes|Performance|Infrastructure|Build|I18N) +".*"))`{0,3}\s*(\n|$)'
39 changes: 7 additions & 32 deletions COMPILING-FLATPAK.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,9 @@
# Compiling Guide for Linux (Flatpak)
The supplied flatpak manifest org.cataclysmdda.CataclysmDDA.json will
download and build the latest release of Cataclysm-DDA. An app built in
this way should be available on flathub:

## Prerequisites
https://flathub.org/apps/detail/org.cataclysmdda.CataclysmDDA

- Install `flatpak` and `flatpak-builder` from your distribution's package manager.
- Install `freedesktop-platform` & `freedesktop-sdk` using `flatpak install flathub org.freedesktop.Platform//18.08 org.freedesktop.Sdk//18.08`

## Build

Clone the source code and run `flatpak-builder --repo=repo --ccache --force-clean build-dir org.Cataclysm.DDA.json` or `flatpak-builder --repo=repo --ccache --force-clean build-dir org.Cataclysm.DDA.Tiles.json` to build the ncurses or tiles version of the application.

## Installation

Run `flatpak --user install test-repo org.Cataclysm.DDA` (or) `flatpak --user install test-repo org.Cataclysm.DDA.Tiles` to install the game.
Note: If you are installing the game for first time you will have to set up local repo. Run this `flatpak --user remote-add --no-gpg-verify test-repo repo`

## Starting the game

`flatpak run org.Cataclysm.DDA` (or) `flatpak run org.Cataclysm.DDA.Tiles`
**or**
Launch the Game from Applications -> Games -> Cataclysm: Dark Days Ahead (or) Cataclysm: Dark Days Ahead - Tiles.
**Note**: For the ncurses version, terminal will just show a blank screen on launch. Just press any button to start the game.

## Permissions

- **Ncurses version**
- Home Directory
- **Tiles Version**
- Home Directory
- Wayland
- Fallback-X11 - (incase Wayland doesn't work)
- IPC - (Required for X11)
- PulseAudio
- DRI
Check the flatpak documentation at http://docs.flatpak.org for
information on how to customise the manifest, build your own copies of
the app, and install or distribute them.
33 changes: 21 additions & 12 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ switch(OperatingSystem.current()) {
}

android {
compileSdkVersion 26
buildToolsVersion "28.0.1"

compileSdkVersion 28

if(OperatingSystem.current().isLinux()) {
exec {
Expand All @@ -67,17 +65,28 @@ android {

defaultConfig {
minSdkVersion 14
targetSdkVersion 26
targetSdkVersion 28
versionCode Integer.valueOf(System.env.UPSTREAM_BUILD_NUMBER ?: 1 )
versionName new File('app/jni/src/version.h').text.split("\"")[1]
if (buildAsApplication) {
applicationId "com.cleverraven.cataclysmdda"
setProperty("archivesBaseName", "cataclysmdda-" + versionName)
}
ndk {
abiFilters "armeabi-v7a"
//abiFilters "x86" // use this for testing on emulators
}

splits {
// Configures multiple APKs based on ABI.
abi {
// Enables building multiple APKs per ABI.
enable true
// Resets the list of ABIs that Gradle should create APKs for to none.
reset()
// Specifies a list of ABIs that Gradle should create APKs for.
include "armeabi-v7a"
// Specifies that we do not want to also generate a universal APK that includes all ABIs.
universalApk false
}
}

externalNativeBuild {
ndkBuild {
arguments "APP_PLATFORM=android-16", "-j$njobs"
Expand Down Expand Up @@ -112,11 +121,11 @@ android {
}
}
}

debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

externalNativeBuild {
ndkBuild {

Expand All @@ -133,12 +142,12 @@ android {
path 'jni/Android.mk'
}
}

}
lintOptions {
abortOnError false
}

if (buildAsLibrary) {
libraryVariants.all { variant ->
variant.outputs.each { output ->
Expand Down
6 changes: 3 additions & 3 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
android:installLocation="auto">

<!-- Android 4.0.1 -->
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="24" />
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="28" />

<!-- OpenGL ES 2.0 -->
<uses-feature android:glEsVersion="0x00020000" />
Expand All @@ -24,7 +24,7 @@

<!-- Create a Java class extending SDLActivity and place it in a
directory under app/src/main/java matching the package, e.g. app/src/main/java/com/gamemaker/game/MyGame.java
then replace "SDLActivity" with the name of your class (e.g. "MyGame")
in the XML below.
Expand All @@ -40,7 +40,7 @@
<!-- Example of setting SDL hints from AndroidManifest.xml:
<meta-data android:name="SDL_ENV.SDL_ACCELEROMETER_AS_JOYSTICK" android:value="0"/>
-->

<activity android:name="SplashScreen"
android:label="@string/app_name"
android:launchMode="singleInstance"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ protected void onCreate(Bundle savedInstanceState) {
startGameActivity(false);
}
else {
new InstallProgramTask().execute();
new InstallProgramTask().execute();
}
}

Expand Down Expand Up @@ -114,14 +114,14 @@ private class InstallProgramTask extends AsyncTask<Void, Integer, Boolean> {
@Override
protected void onPreExecute() {
installationAlert = new AlertDialog.Builder(SplashScreen.this)
.setTitle("Installation Failed")
.setCancelable(false)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
SplashScreen.this.finish();
return;
}
}).create();
.setTitle("Installation Failed")
.setCancelable(false)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
SplashScreen.this.finish();
return;
}
}).create();
AssetManager assetManager = getAssets();
try {
totalFiles = countTotalAssets(assetManager, "data") +
Expand Down Expand Up @@ -162,22 +162,22 @@ protected Boolean doInBackground(Void... params) {
AssetManager assetManager = getAssets();
String externalFilesDir = getExternalFilesDir(null).getPath();

try {
// Clear out the old data if it exists (but preserve custom folders + files)
deleteRecursive(assetManager, externalFilesDir, new File(externalFilesDir + "/data"));
deleteRecursive(assetManager, externalFilesDir, new File(externalFilesDir + "/gfx"));
deleteRecursive(assetManager, externalFilesDir, new File(externalFilesDir + "/lang"));

// Install the new data over the top
copyAssetFolder(assetManager, "data", externalFilesDir + "/data");
copyAssetFolder(assetManager, "gfx", externalFilesDir + "/gfx");
copyAssetFolder(assetManager, "lang", externalFilesDir + "/lang");
try {
// Clear out the old data if it exists (but preserve custom folders + files)
deleteRecursive(assetManager, externalFilesDir, new File(externalFilesDir + "/data"));
deleteRecursive(assetManager, externalFilesDir, new File(externalFilesDir + "/gfx"));
deleteRecursive(assetManager, externalFilesDir, new File(externalFilesDir + "/lang"));

// Install the new data over the top
copyAssetFolder(assetManager, "data", externalFilesDir + "/data");
copyAssetFolder(assetManager, "gfx", externalFilesDir + "/gfx");
copyAssetFolder(assetManager, "lang", externalFilesDir + "/lang");
} catch(Exception e) {
installationAlert.setMessage(e.getMessage());
return false;
installationAlert.setMessage(e.getMessage());
return false;
}

// Remember which version the installed data is
// Remember which version the installed data is
PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).edit().putString("installed", getVersionName()).commit();

publishProgress(++installedFiles);
Expand Down Expand Up @@ -212,14 +212,14 @@ void deleteRecursive(AssetManager assetManager, String externalFilesDir, File fi
// Returns true if an asset exists in the APK (either a directory or a file)
// eg. assetExists("data/sound") or assetExists("data/font", "unifont.ttf") would both return true
private boolean assetExists(AssetManager assetManager, String assetPath) {
return assetExists(assetManager, assetPath, "");
return assetExists(assetManager, assetPath, "");
}

private boolean assetExists(AssetManager assetManager, String assetPath, String assetName) {
try {
String[] files = assetManager.list(assetPath);
if (assetName.isEmpty())
return files.length > 0; // folder exists
return files.length > 0; // folder exists
for (String file : files) {
if (file.equalsIgnoreCase(assetName))
return true; // file exists
Expand Down Expand Up @@ -312,11 +312,11 @@ protected void onProgressUpdate(Integer... values) {
@Override
protected void onPostExecute(Boolean result) {
removeDialog(INSTALL_DIALOG_ID);
if(result) {
if(result) {
settingsAlert.show();
} else {
installationAlert.show();
}
} else {
installationAlert.show();
}
}
}
}
Loading

0 comments on commit 9088c1d

Please sign in to comment.