Skip to content

Commit 266d427

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents da9dfc8 + c20e406 commit 266d427

File tree

154 files changed

+5801
-4016
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

154 files changed

+5801
-4016
lines changed

.github/workflows/ci-build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ jobs:
5454
key: android-cmake-v1
5555

5656
- name: Setup signing config
57+
if: env.KEYSTORE_FILE_BASE64 != '' && env.KEYSTORE_PROPERTIES_FILE_BASE64 != ''
5758
run: |
5859
cd os/android
5960
echo "$KEYSTORE_FILE_BASE64" | base64 --decode > debug.keystore

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ jobs:
3333
key: android-cmake-v1
3434

3535
- name: Setup signing config
36+
if: env.KEYSTORE_FILE_BASE64 != '' && env.KEYSTORE_PROPERTIES_FILE_BASE64 != ''
3637
run: |
3738
cd os/android
3839
echo "$KEYSTORE_FILE_BASE64" | base64 --decode > release.keystore

CMakeLists.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,8 @@ target_sources(${EXECUTABLE_NAME} PUBLIC
239239
"src/window.h"
240240
"src/word_wrap.cc"
241241
"src/word_wrap.h"
242-
"src/world_map.cc"
243-
"src/world_map.h"
242+
"src/worldmap.cc"
243+
"src/worldmap.h"
244244
"src/xfile.cc"
245245
"src/xfile.h"
246246
)
@@ -283,7 +283,6 @@ if(VITA)
283283
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${VITA_FLAGS}")
284284

285285
add_definitions("-Dmemcpy=sceClibMemcpy")
286-
add_definitions("-Dmemcmp=sceClibMemcmp")
287286
add_definitions("-Dmemset=sceClibMemset")
288287
add_definitions("-Dmemmove=sceClibMemmove")
289288

@@ -300,9 +299,13 @@ if(VITA)
300299
endif()
301300

302301
if(APPLE)
302+
target_sources(${EXECUTABLE_NAME} PUBLIC "os/macos/fallout2-ce.icns")
303+
set_source_files_properties("os/macos/fallout2-ce.icns" PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
304+
303305
set_target_properties(${EXECUTABLE_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_SOURCE_DIR}/os/macos/Info.plist")
304306
set(MACOSX_BUNDLE_GUI_IDENTIFIER "com.alexbatalov.fallout2-ce")
305307
set(MACOSX_BUNDLE_BUNDLE_NAME "${EXECUTABLE_NAME}")
308+
set(MACOSX_BUNDLE_ICON_FILE "fallout2-ce.icns")
306309
set(MACOSX_BUNDLE_DISPLAY_NAME "Fallout 2")
307310
endif()
308311

os/android/app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
An example Java class can be found in README-android.md
5959
-->
6060
<application android:label="@string/app_name"
61+
android:icon="@mipmap/ic_launcher"
6162
android:allowBackup="true"
6263
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
6364
android:hardwareAccelerated="true" >
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
package com.alexbatalov.fallout2ce;
2+
3+
import android.content.ContentResolver;
4+
5+
import androidx.documentfile.provider.DocumentFile;
6+
7+
import java.io.File;
8+
import java.io.FileOutputStream;
9+
import java.io.IOException;
10+
import java.io.InputStream;
11+
import java.io.OutputStream;
12+
13+
public class FileUtils {
14+
15+
static boolean copyRecursively(ContentResolver contentResolver, DocumentFile src, File dest) {
16+
final DocumentFile[] documentFiles = src.listFiles();
17+
for (final DocumentFile documentFile : documentFiles) {
18+
if (documentFile.isFile()) {
19+
if (!copyFile(contentResolver, documentFile, new File(dest, documentFile.getName()))) {
20+
return false;
21+
}
22+
} else if (documentFile.isDirectory()) {
23+
final File subdirectory = new File(dest, documentFile.getName());
24+
if (!subdirectory.exists()) {
25+
subdirectory.mkdir();
26+
}
27+
28+
if (!copyRecursively(contentResolver, documentFile, subdirectory)) {
29+
return false;
30+
}
31+
}
32+
}
33+
return true;
34+
}
35+
36+
private static boolean copyFile(ContentResolver contentResolver, DocumentFile src, File dest) {
37+
try {
38+
final InputStream inputStream = contentResolver.openInputStream(src.getUri());
39+
final OutputStream outputStream = new FileOutputStream(dest);
40+
41+
final byte[] buffer = new byte[16384];
42+
int bytesRead;
43+
while ((bytesRead = inputStream.read(buffer)) != -1) {
44+
outputStream.write(buffer, 0, bytesRead);
45+
}
46+
47+
inputStream.close();
48+
outputStream.close();
49+
} catch (IOException e) {
50+
e.printStackTrace();
51+
return false;
52+
}
53+
54+
return true;
55+
}
56+
}
Lines changed: 28 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
package com.alexbatalov.fallout2ce;
22

33
import android.app.Activity;
4+
import android.app.ProgressDialog;
5+
import android.content.ContentResolver;
46
import android.content.Intent;
57
import android.net.Uri;
68
import android.os.Bundle;
79

810
import androidx.documentfile.provider.DocumentFile;
911

1012
import java.io.File;
11-
import java.io.FileOutputStream;
12-
import java.io.IOException;
13-
import java.io.InputStream;
14-
import java.io.OutputStream;
1513

1614
public class ImportActivity extends Activity {
1715
private static final int IMPORT_REQUEST_CODE = 1;
@@ -31,10 +29,8 @@ protected void onActivityResult(int requestCode, int resultCode, Intent resultDa
3129
if (treeUri != null) {
3230
final DocumentFile treeDocument = DocumentFile.fromTreeUri(this, treeUri);
3331
if (treeDocument != null) {
34-
copyRecursively(treeDocument, getExternalFilesDir(null));
35-
36-
final Intent intent = new Intent(this, MainActivity.class);
37-
startActivity(intent);
32+
copyFiles(treeDocument);
33+
return;
3834
}
3935
}
4036
}
@@ -45,45 +41,34 @@ protected void onActivityResult(int requestCode, int resultCode, Intent resultDa
4541
}
4642
}
4743

48-
private boolean copyRecursively(DocumentFile src, File dest) {
49-
final DocumentFile[] documentFiles = src.listFiles();
50-
for (final DocumentFile documentFile : documentFiles) {
51-
if (documentFile.isFile()) {
52-
if (!copyFile(documentFile, new File(dest, documentFile.getName()))) {
53-
return false;
54-
}
55-
} else if (documentFile.isDirectory()) {
56-
final File subdirectory = new File(dest, documentFile.getName());
57-
if (!subdirectory.exists()) {
58-
subdirectory.mkdir();
59-
}
44+
private void copyFiles(DocumentFile treeDocument) {
45+
ProgressDialog dialog = createProgressDialog();
46+
dialog.show();
6047

61-
if (!copyRecursively(documentFile, subdirectory)) {
62-
return false;
63-
}
64-
}
65-
}
66-
return true;
67-
}
48+
new Thread(() -> {
49+
ContentResolver contentResolver = getContentResolver();
50+
File externalFilesDir = getExternalFilesDir(null);
51+
FileUtils.copyRecursively(contentResolver, treeDocument, externalFilesDir);
6852

69-
private boolean copyFile(DocumentFile src, File dest) {
70-
try {
71-
final InputStream inputStream = getContentResolver().openInputStream(src.getUri());
72-
final OutputStream outputStream = new FileOutputStream(dest);
53+
startMainActivity();
54+
dialog.dismiss();
55+
finish();
56+
}).start();
57+
}
7358

74-
final byte[] buffer = new byte[16384];
75-
int bytesRead;
76-
while ((bytesRead = inputStream.read(buffer)) != -1) {
77-
outputStream.write(buffer, 0, bytesRead);
78-
}
59+
private void startMainActivity() {
60+
Intent intent = new Intent(this, MainActivity.class);
61+
startActivity(intent);
62+
}
7963

80-
inputStream.close();
81-
outputStream.close();
82-
} catch (IOException e) {
83-
e.printStackTrace();
84-
return false;
85-
}
64+
private ProgressDialog createProgressDialog() {
65+
ProgressDialog progressDialog = new ProgressDialog(this,
66+
android.R.style.Theme_Material_Light_Dialog);
67+
progressDialog.setTitle(R.string.loading_dialog_title);
68+
progressDialog.setMessage(getString(R.string.loading_dialog_message));
69+
progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
70+
progressDialog.setCancelable(false);
8671

87-
return true;
72+
return progressDialog;
8873
}
8974
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3+
<background android:drawable="@color/ic_launcher_background"/>
4+
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
5+
</adaptive-icon>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3+
<background android:drawable="@color/ic_launcher_background"/>
4+
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
5+
</adaptive-icon>
8.72 KB
Loading
26.2 KB
Loading

0 commit comments

Comments
 (0)