Compare commits

...

24 Commits

Author SHA1 Message Date
86e3962260 mo' bullcrap 2023-02-28 22:41:21 -05:00
37125272d9 Updated Android verSSion code 2023-02-28 16:42:23 -05:00
0fdfae6e23 small sussy changes to about tab 2023-02-28 18:56:53 +01:00
2a29c45ce5 unzipservice code cleanup. does not affect code functionality 2023-02-27 14:58:09 +01:00
11ec9c45ce fixed instant crash on new android versions 2023-02-27 14:54:45 +01:00
2e4198eb2b version numbers in about tab are now correct 2023-02-26 21:15:22 +01:00
MCL Software Official
5b329fc179 Update version to 43 2023-02-26 12:49:29 -05:00
b3c1773b67 fixed ''Zip Path Traversal Vulnerability'' 2023-02-26 11:20:01 +01:00
013f0563a8 some sussy file gradle-wrapper.properties changed after gradle update chages. idk if to commit it sus 2023-02-24 14:10:41 +01:00
ee92d30eda changed capitalized project name from ''Minetest'' to ''SussyCraft'' 2023-02-24 14:09:13 +01:00
MCL Software Official
9f0b3bb8e6 Update SDK version to 31 2023-02-24 07:09:52 -05:00
MCL Software Official
cd54bbabcf "Xtreem" improvements by MCL Software 2023-02-23 17:04:02 -05:00
bdd5308e52 updated SussyCraft submodule 2023-02-23 20:58:59 +01:00
b161a2993f about tab window is now wideeeeeeeeeer 2023-02-23 20:39:10 +01:00
3e653ee166 changed size of privacy policy and discord buttons 2023-02-23 19:27:29 +01:00
d074c487bc changed font size to 21 and ''< Back to Settings page'' button size 2023-02-23 19:18:10 +01:00
861076cd49 modified about tab buttons 2023-02-23 18:06:59 +01:00
Kacper Kostka
21c2c6c2a3 d 2023-02-23 17:30:38 +01:00
Kacper Kostka
a5e59139f0 Merge branch 'master' of http://git.cubesoftware.xyz:20524/Looki2000/sussycraft-engine 2023-02-23 17:11:06 +01:00
Kacper Kostka
99121a0a03 fix 2023-02-23 17:10:51 +01:00
55b750c446 revert 274977b267
revert changed default touchscreen_threshold to 10
2023-02-23 16:08:18 +00:00
Kacper Kostka
68e5f9525e fixed conflicts 2023-02-23 17:00:43 +01:00
Kacper Kostka
2eafb395a0 Discord Button Added and changed the size of the buttons 2023-02-23 16:57:59 +01:00
Kacper Kostka
2a86ec6734 Discord Button Added and changed the size of the buttons 2023-02-23 16:57:33 +01:00
16 changed files with 116 additions and 81 deletions

View File

@@ -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)

View File

@@ -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
}

View File

@@ -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");

View File

@@ -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) {

View File

@@ -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)
@@ -156,7 +159,7 @@ public class UnzipService extends IntentService {
int readLen;
byte[] readBuffer = new byte[16384];
try (FileInputStream fileInputStream = new FileInputStream(zipFile);
ZipInputStream zipInputStream = new ZipInputStream(fileInputStream)) {
ZipInputStream zipInputStream = new ZipInputStream(fileInputStream)) {
ZipEntry ze;
while ((ze = zipInputStream.getNextEntry()) != null) {
if (ze.isDirectory()) {
@@ -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) {

View File

@@ -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() &&

View File

@@ -4,10 +4,10 @@
<string name="label">SussyCraft</string>
<string name="loading">Loading&#8230;</string>
<string name="migrating">Migrating save data from old install&#8230; (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&#8230;</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>

View File

@@ -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("developmentBuild", 0) // Whether it is a development build, or a release
project.ext.set("versionExtra", "") // Version Extra
project.ext.set("versionCode", 44) // 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()
}
}

View File

@@ -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

View File

@@ -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(),

View File

@@ -1,2 +1,2 @@
rootProject.name = "Minetest"
rootProject.name = "SussyCraft"
include ':app', ':native'

View File

@@ -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") .. ";"

View File

@@ -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,
}

View File

@@ -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)

View File

@@ -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