Compare commits
22 Commits
reversebug
...
0fdfae6e23
| Author | SHA1 | Date | |
|---|---|---|---|
| 0fdfae6e23 | |||
| 2a29c45ce5 | |||
| 11ec9c45ce | |||
| 2e4198eb2b | |||
|
|
5b329fc179 | ||
| b3c1773b67 | |||
| 013f0563a8 | |||
| ee92d30eda | |||
|
|
9f0b3bb8e6 | ||
|
|
cd54bbabcf | ||
| bdd5308e52 | |||
| b161a2993f | |||
| 3e653ee166 | |||
| d074c487bc | |||
| 861076cd49 | |||
|
|
21c2c6c2a3 | ||
|
|
a5e59139f0 | ||
|
|
99121a0a03 | ||
| 55b750c446 | |||
|
|
68e5f9525e | ||
|
|
2eafb395a0 | ||
|
|
2a86ec6734 |
@@ -9,7 +9,7 @@ endif()
|
||||
|
||||
# This can be read from ${PROJECT_NAME} after project() is called
|
||||
project(minetest)
|
||||
set(PROJECT_NAME_CAPITALIZED "Minetest")
|
||||
set(PROJECT_NAME_CAPITALIZED "SussyCraft")
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
apply plugin: 'com.android.application'
|
||||
android {
|
||||
compileSdkVersion 30
|
||||
compileSdkVersion 31
|
||||
buildToolsVersion '30.0.3'
|
||||
ndkVersion "$ndk_version"
|
||||
defaultConfig {
|
||||
applicationId 'xyz.cubesoftware.sussycraft'
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 30
|
||||
targetSdkVersion 31
|
||||
versionName "${versionMajor}.${versionMinor}.${versionPatch}"
|
||||
versionCode project.versionCode
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ import java.util.Objects;
|
||||
// Native code finds these methods by name (see porting_android.cpp).
|
||||
// This annotation prevents the minifier/Proguard from mangling them.
|
||||
@Keep
|
||||
@SuppressWarnings("unused")
|
||||
public class GameActivity extends NativeActivity {
|
||||
static {
|
||||
System.loadLibrary("c++_shared");
|
||||
|
||||
@@ -127,8 +127,12 @@ public class MainActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode,
|
||||
@NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||
public void onRequestPermissionsResult(
|
||||
int requestCode,
|
||||
@NonNull String[] permissions,
|
||||
@NonNull int[] grantResults
|
||||
) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
if (requestCode == PERMISSIONS) {
|
||||
for (int grantResult : grantResults) {
|
||||
if (grantResult != PackageManager.PERMISSION_GRANTED) {
|
||||
|
||||
@@ -29,10 +29,10 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.annotation.StringRes;
|
||||
|
||||
import java.io.File;
|
||||
@@ -77,9 +77,6 @@ public class UnzipService extends IntentService {
|
||||
try {
|
||||
setIsRunning(true);
|
||||
File userDataDirectory = Utils.getUserDataDirectory(this);
|
||||
if (userDataDirectory == null) {
|
||||
throw new IOException("Unable to find user data directory");
|
||||
}
|
||||
|
||||
try (InputStream in = this.getAssets().open(zipFile.getName())) {
|
||||
try (OutputStream out = new FileOutputStream(zipFile)) {
|
||||
@@ -98,7 +95,9 @@ public class UnzipService extends IntentService {
|
||||
failureMessage = e.getLocalizedMessage();
|
||||
} finally {
|
||||
setIsRunning(false);
|
||||
zipFile.delete();
|
||||
if (!zipFile.delete()) {
|
||||
Log.w("UnzipService", "Minetest installation ZIP cannot be deleted");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,8 +130,12 @@ public class UnzipService extends IntentService {
|
||||
Intent notificationIntent = new Intent(this, MainActivity.class);
|
||||
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP
|
||||
| Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
int pendingIntentFlag = 0;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||
pendingIntentFlag = PendingIntent.FLAG_MUTABLE;
|
||||
}
|
||||
PendingIntent intent = PendingIntent.getActivity(this, 0,
|
||||
notificationIntent, 0);
|
||||
notificationIntent, pendingIntentFlag);
|
||||
|
||||
builder.setContentTitle(getString(R.string.notification_title))
|
||||
.setSmallIcon(R.mipmap.ic_launcher)
|
||||
@@ -165,8 +168,17 @@ public class UnzipService extends IntentService {
|
||||
continue;
|
||||
}
|
||||
publishProgress(notificationBuilder, R.string.loading, 100 * ++per / size);
|
||||
try (OutputStream outputStream = new FileOutputStream(
|
||||
new File(userDataDirectory, ze.getName()))) {
|
||||
|
||||
// "Zip Path Traversal Vulnerability" fixed according to this article: https://support.google.com/faqs/answer/9294009
|
||||
File new_file = new File(userDataDirectory, ze.getName());
|
||||
|
||||
String canonicalPath = new_file.getCanonicalPath();
|
||||
|
||||
if (!canonicalPath.startsWith(String.valueOf(userDataDirectory))) {
|
||||
throw new IOException("Unzipping failed due to security issue!");
|
||||
}
|
||||
|
||||
try (OutputStream outputStream = new FileOutputStream(new_file)) {
|
||||
while ((readLen = zipInputStream.read(readBuffer)) != -1) {
|
||||
outputStream.write(readBuffer, 0, readLen);
|
||||
}
|
||||
@@ -210,7 +222,9 @@ public class UnzipService extends IntentService {
|
||||
return;
|
||||
|
||||
publishProgress(notificationBuilder, R.string.migrating, 0);
|
||||
newLocation.mkdir();
|
||||
if (!newLocation.mkdir()) {
|
||||
Log.e("UnzipService", "New installation folder cannot be made");
|
||||
}
|
||||
|
||||
String[] dirs = new String[] { "worlds", "games", "mods", "textures", "client" };
|
||||
for (int i = 0; i < dirs.length; i++) {
|
||||
@@ -228,7 +242,9 @@ public class UnzipService extends IntentService {
|
||||
}
|
||||
}
|
||||
|
||||
recursivelyDeleteDirectory(oldLocation);
|
||||
if (!recursivelyDeleteDirectory(oldLocation)) {
|
||||
Log.w("UnzipService", "Old installation files cannot be deleted successfully");
|
||||
}
|
||||
}
|
||||
|
||||
private void publishProgress(@Nullable Notification.Builder notificationBuilder, @StringRes int message, int progress) {
|
||||
|
||||
@@ -1,36 +1,43 @@
|
||||
package net.minetest.minetest;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import java.io.File;
|
||||
import java.util.Objects;
|
||||
|
||||
public class Utils {
|
||||
public static @NonNull File createDirs(File root, String dir) {
|
||||
@NonNull
|
||||
public static File createDirs(@NonNull File root, @NonNull String dir) {
|
||||
File f = new File(root, dir);
|
||||
if (!f.isDirectory())
|
||||
f.mkdirs();
|
||||
if (!f.mkdirs())
|
||||
Log.e("Utils", "Directory " + dir + " cannot be created");
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
public static @Nullable File getUserDataDirectory(Context context) {
|
||||
File extDir = context.getExternalFilesDir(null);
|
||||
if (extDir == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public static File getUserDataDirectory(@NonNull Context context) {
|
||||
File extDir = Objects.requireNonNull(
|
||||
context.getExternalFilesDir(null),
|
||||
"Cannot get external file directory"
|
||||
);
|
||||
return createDirs(extDir, "Minetest");
|
||||
}
|
||||
|
||||
public static @Nullable File getCacheDirectory(Context context) {
|
||||
return context.getCacheDir();
|
||||
@NonNull
|
||||
public static File getCacheDirectory(@NonNull Context context) {
|
||||
return Objects.requireNonNull(
|
||||
context.getCacheDir(),
|
||||
"Cannot get cache directory"
|
||||
);
|
||||
}
|
||||
|
||||
public static boolean isInstallValid(Context context) {
|
||||
public static boolean isInstallValid(@NonNull Context context) {
|
||||
File userDataDirectory = getUserDataDirectory(context);
|
||||
return userDataDirectory != null && userDataDirectory.isDirectory() &&
|
||||
return userDataDirectory.isDirectory() &&
|
||||
new File(userDataDirectory, "games").isDirectory() &&
|
||||
new File(userDataDirectory, "builtin").isDirectory() &&
|
||||
new File(userDataDirectory, "client").isDirectory() &&
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
<string name="label">SussyCraft</string>
|
||||
<string name="loading">Loading…</string>
|
||||
<string name="migrating">Migrating save data from old install… (this may take a while)</string>
|
||||
<string name="not_granted">Required permission wasn\'t granted, Minetest can\'t run without it</string>
|
||||
<string name="notification_title">Loading Minetest</string>
|
||||
<string name="not_granted">Required permission wasn\'t granted, SussyCraft can\'t run without it</string>
|
||||
<string name="notification_title">Loading SussyCraft</string>
|
||||
<string name="notification_description">Less than 1 minute…</string>
|
||||
<string name="ime_dialog_done">Done</string>
|
||||
<string name="no_external_storage">External storage isn\'t available. If you use an SDCard, please reinsert it. Otherwise, try restarting your phone or contacting the Minetest developers</string>
|
||||
<string name="no_external_storage">External storage isn\'t available. If you use an SD Card, please reinsert it. Otherwise, try restarting your phone or contacting the SussyCraft developers</string>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
project.ext.set("versionMajor", 5) // Version Major
|
||||
project.ext.set("versionMinor", 6) // Version Minor
|
||||
project.ext.set("versionMajor", 1) // Version Major
|
||||
project.ext.set("versionMinor", 1) // Version Minor
|
||||
project.ext.set("versionPatch", 0) // Version Patch
|
||||
project.ext.set("versionExtra", "") // Version Extra
|
||||
project.ext.set("versionCode", 42) // Android Version Code
|
||||
project.ext.set("versionCode", 43) // Android Version Code
|
||||
project.ext.set("developmentBuild", 0) // Whether it is a development build, or a release
|
||||
// NOTE: +2 after each release!
|
||||
// +1 for ARM and +1 for ARM64 APK's, because
|
||||
// each APK must have a larger `versionCode` than the previous
|
||||
|
||||
buildscript {
|
||||
ext.ndk_version = '23.2.8568313'
|
||||
ext.ndk_version = '25.1.8937393'
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:7.0.3'
|
||||
classpath 'com.android.tools.build:gradle:7.2.2'
|
||||
classpath 'de.undercouch:gradle-download-task:4.1.1'
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
@@ -27,7 +27,7 @@ buildscript {
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#Fri Feb 24 12:42:36 CET 2023
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -2,12 +2,12 @@ apply plugin: 'com.android.library'
|
||||
apply plugin: 'de.undercouch.download'
|
||||
|
||||
android {
|
||||
compileSdkVersion 30
|
||||
compileSdkVersion 31
|
||||
buildToolsVersion '30.0.3'
|
||||
ndkVersion "$ndk_version"
|
||||
defaultConfig {
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 30
|
||||
targetSdkVersion 31
|
||||
externalNativeBuild {
|
||||
ndkBuild {
|
||||
arguments '-j' + Runtime.getRuntime().availableProcessors(),
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
rootProject.name = "Minetest"
|
||||
rootProject.name = "SussyCraft"
|
||||
include ':app', ':native'
|
||||
|
||||
@@ -1024,7 +1024,7 @@ local function create_settings_formspec(tabview, _, tabdata)
|
||||
formspec = formspec:sub(1, -2) -- remove trailing comma
|
||||
end
|
||||
formspec = formspec .. ";" .. selected_setting .. "]" ..
|
||||
"button[0,4.9;4,1;btn_back;".. fgettext("< Back to Settings page") .. "]" ..
|
||||
"button[0,4.9;4.5,1;btn_back;".. fgettext("< Back to Settings page") .. "]" ..
|
||||
"button[10,4.9;2,1;btn_edit;" .. fgettext("Edit") .. "]" ..
|
||||
"button[7,4.9;3,1;btn_restore;" .. fgettext("Restore Default") .. "]" ..
|
||||
"checkbox[0,4.3;cb_tech_settings;" .. fgettext("Show technical names") .. ";"
|
||||
|
||||
@@ -17,22 +17,32 @@
|
||||
|
||||
-- IMPORTANT! some lines had to be split up to new lines because they didn't fit in the window
|
||||
local sussycraft_authors = {
|
||||
"SussyCraft Game Authors:",
|
||||
|
||||
"Kacper Kostka (kacperks) <kacperks@cubesoftware.xyz>",
|
||||
"Kacper Kostka (kacperks)",
|
||||
"<kacperks@cubesoftware.xyz>",
|
||||
"(Programming, Textures)",
|
||||
|
||||
"-----------------------------------------------------------",
|
||||
|
||||
"Łukasz Brzostowski (Looki2000)",
|
||||
"<electro.brzostek@gmail.com or looki2000@cubesoftware.xyz>",
|
||||
"(Programming, Textures, 3D Models, Soundtrack, Sounds)",
|
||||
|
||||
"Karol Rostek (karoltoja200) discord:karoltoja200#6809",
|
||||
"-----------------------------------------------------------",
|
||||
|
||||
"Karol Rostek (karoltoja200)",
|
||||
"<discord: karoltoja200#6809>",
|
||||
"(Textures)",
|
||||
|
||||
"Dawid Cholewiusz (D47 0_o) discord:D46 0_o#8952",
|
||||
"-----------------------------------------------------------",
|
||||
|
||||
"Dawid Cholewiusz (D47 0_o)",
|
||||
"<discord: D46 0_o#8952>",
|
||||
"(Structures builder)",
|
||||
|
||||
"Kacper Brzostowski (wooden plank texture)",
|
||||
"-----------------------------------------------------------",
|
||||
|
||||
"Kacper Brzostowski",
|
||||
"(wooden plank texture)",
|
||||
}
|
||||
|
||||
-- https://github.com/orgs/minetest/teams/engine/members
|
||||
@@ -148,6 +158,7 @@ return {
|
||||
prepare_credits(credit_list, sussycraft_authors)
|
||||
|
||||
table.insert_all(credit_list, {
|
||||
"",
|
||||
core.colorize("#ffdd33", fgettext("Minetest Engine Developers"))
|
||||
})
|
||||
prepare_credits(credit_list, core_developers)
|
||||
@@ -183,43 +194,38 @@ return {
|
||||
local credit_fs, scroll_height = build_hacky_list(credit_list)
|
||||
-- account for the visible portion
|
||||
scroll_height = math.max(0, scroll_height - 6.9)
|
||||
|
||||
local fs = "image[1.5,0.6;2.5,2.5;" .. core.formspec_escape(logofile) .. "]" ..
|
||||
"style[label_button;border=false]" ..
|
||||
"button[0.1,3.4;5.3,0.5;label_button;" ..
|
||||
core.formspec_escape("SussyCraft 0.8") .. "]" ..
|
||||
"button[1.5,4.1;2.5,0.8;homepage;Privacy Policy]" ..
|
||||
"scroll_container[5.5,0.1;9.5,6.9;scroll_credits;vertical;" ..
|
||||
core.formspec_escape("SussyCraft " .. core.get_version().string) .. "]" ..
|
||||
|
||||
-- original x positions: 1.5 and 2.5
|
||||
"button[1.1,4.1;3.3,0.8;privacy;Privacy Policy]" ..
|
||||
"button[0.6,5.1;4.3,0.8;discord;SussyCraft Discord]" ..
|
||||
|
||||
"scroll_container[5.5,0.1;13.5,6.9;scroll_credits;vertical;" .. -- originally: 5.5,0.1;9.5,6.9
|
||||
tostring(scroll_height / 1000) .. "]" .. credit_fs ..
|
||||
"scroll_container_end[]"..
|
||||
"scrollbar[15,0.1;0.4,6.9;vertical;scroll_credits;0]"
|
||||
"scrollbar[19,0.1;0.4,6.9;vertical;scroll_credits;0]" -- originally: 15,0.1;0.4,6.9
|
||||
|
||||
|
||||
|
||||
-- Render information
|
||||
fs = fs .. "style[label_button2;border=false]" ..
|
||||
"button[0.1,6;5.3,1;label_button2;" ..
|
||||
|
||||
fgettext("Active renderer:") .. "\n" ..
|
||||
core.formspec_escape(core.get_screen_info().render_info) .. "]"
|
||||
|
||||
if PLATFORM == "Android" then
|
||||
|
||||
else
|
||||
|
||||
end
|
||||
|
||||
return fs, "size[15.5,7.1,false]real_coordinates[true]"
|
||||
return fs, "size[19.5,7.1,false]real_coordinates[true]" -- originally: 15.5,7.1
|
||||
end,
|
||||
cbf_button_handler = function(this, fields, name, tabdata)
|
||||
if fields.homepage then
|
||||
if fields.privacy then
|
||||
core.open_url("https://cubesoftware.xyz/sussycraft/privacy.html")
|
||||
end
|
||||
|
||||
if fields.share_debug then
|
||||
local path = core.get_user_path() .. DIR_DELIM .. "debug.txt"
|
||||
core.share_file(path)
|
||||
end
|
||||
|
||||
if fields.userdata then
|
||||
core.open_dir(core.get_user_path())
|
||||
if fields.discord then
|
||||
core.open_url("https://discord.gg/aJmhBN74sh")
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
Submodule games/SussyCraft updated: adefaaf592...8a08384a6c
@@ -14,7 +14,7 @@
|
||||
#else
|
||||
#if defined (__ANDROID__)
|
||||
#define PROJECT_NAME "minetest"
|
||||
#define PROJECT_NAME_C "Minetest"
|
||||
#define PROJECT_NAME_C "SussyCraft"
|
||||
#define STATIC_SHAREDIR ""
|
||||
#define ENABLE_UPDATE_CHECKER 0
|
||||
#define VERSION_STRING STR(VERSION_MAJOR) "." STR(VERSION_MINOR) "." STR(VERSION_PATCH) STR(VERSION_EXTRA)
|
||||
|
||||
@@ -502,15 +502,15 @@ void set_default_settings()
|
||||
|
||||
if (x_inches < 3.7f) {
|
||||
settings->setDefault("hud_scaling", "0.6");
|
||||
settings->setDefault("font_size", "16");
|
||||
settings->setDefault("font_size", "21");
|
||||
settings->setDefault("mono_font_size", "14");
|
||||
} else if (x_inches < 4.5f) {
|
||||
settings->setDefault("hud_scaling", "0.7");
|
||||
settings->setDefault("font_size", "16");
|
||||
settings->setDefault("font_size", "21");
|
||||
settings->setDefault("mono_font_size", "14");
|
||||
} else if (x_inches < 6.0f) {
|
||||
settings->setDefault("hud_scaling", "0.85");
|
||||
settings->setDefault("font_size", "16");
|
||||
settings->setDefault("font_size", "21");
|
||||
settings->setDefault("mono_font_size", "14");
|
||||
}
|
||||
// Tablets >= 6.0 use non-Android defaults for these settings
|
||||
|
||||
Reference in New Issue
Block a user