1
0

Compare commits

..

No commits in common. "f8bbed282ebcf4ed2b9abe6076c2c19c8db2ad39" and "5ee92bc1ee32b53a72d67334f7b714d8aa1f9454" have entirely different histories.

106 changed files with 612 additions and 892 deletions

View File

@ -260,8 +260,8 @@ jobs:
name: VS 2022 ${{ matrix.config.arch }}-${{ matrix.type }}
runs-on: windows-2022
env:
VCPKG_VERSION: a42af01b72c28a8e1d7b48107b33e4f286a55ef6
# 2023.11.20
VCPKG_VERSION: af2287382b1991dbdcb7e5112d236f3323b9dd7a
# 2022.03.10
vcpkg_packages: irrlicht zlib curl[winssl] openal-soft libvorbis libogg sqlite3 freetype luajit gmp jsoncpp
strategy:
fail-fast: false

View File

@ -70,29 +70,9 @@ build:alpine-319:
# Jessie
build:debian-8-64:
build:debian-8:
<<: *build_definition
image: amd64/debian:8
before_script:
- echo "" > /etc/apt/apt.conf.d/50venenuxcustom
- echo "APT::Get::AllowUnauthenticated \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
- echo "Acquire::AllowInsecureRepositories \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
- echo "Acquire::AllowDowngradeToInsecureRepositories \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
- echo "Acquire::AllowReleaseInfoChange::Suite \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
- echo "Acquire::Check-Valid-Until \"false\";" >> /etc/apt/apt.conf.d/50venenuxcustom
- echo "Acquire::Languages \"en\";" >> /etc/apt/apt.conf.d/50venenuxcustom
- echo "Aptitude::CmdLine::Ignore-Trust-Violations \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
- rm -rf /etc/apt/sources.list
- echo "deb http://archive.debian.org/debian/ jessie main contrib" > /etc/apt/sources.list.d/50debianoficial.list
- echo "deb http://archive.debian.org/debian/ jessie-backports main contrib non-free" >> /etc/apt/sources.list.d/50debianoficial.list
- echo "deb http://deb.freexian.com/extended-lts jessie main contrib non-free" >> /etc/apt/sources.list.d/50debianoficial.list
- DEBIAN_FRONTEND=noninteractive apt-get update -y || true
- DEBIAN_FRONTEND=noninteractive apt-get -y --force-yes install build-essential cmake pkg-config cmake-data debhelper lsb-release gettext libbz2-dev libcurl4-gnutls-dev libnl-genl-3-dev libnl-3-dev librtmp-dev libidn11-dev libncurses-dev libfreetype6-dev libglu1-mesa-dev libgmp-dev libirrlicht-dev libjpeg-dev libleveldb-dev libluajit-5.1-dev liblua5.1-dev libogg-dev libopenal-dev libpng-dev libpq-dev libhiredis-dev libspatialindex-dev libsqlite3-dev libvorbis-dev libx11-dev libxxf86vm-dev libpq-dev postgresql-server-dev-all libhiredis-dev zlib1g-dev doxygen libxrandr-dev x11proto-xf86vidmode-dev
- DEBIAN_FRONTEND=noninteractive apt-get -y --force-yes -t jessie-backports install libjsoncpp-dev
build:debian-8-32:
<<: *build_definition
image: i386/debian:8
image: debian:8
before_script:
- echo "" > /etc/apt/apt.conf.d/50venenuxcustom
- echo "APT::Get::AllowUnauthenticated \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
@ -112,9 +92,9 @@ build:debian-8-32:
# Stretch
build:debian-9-32:
build:debian-9:
<<: *build_definition
image: i386/debian:9
image: debian:9
before_script:
- echo "" > /etc/apt/apt.conf.d/50venenuxcustom
- echo "APT::Get::AllowUnauthenticated \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom

View File

@ -2,13 +2,13 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 34
buildToolsVersion '34.0.0'
compileSdkVersion 33
buildToolsVersion '33.0.2'
ndkVersion '25.2.9519653'
defaultConfig {
applicationId 'com.multicraft.game'
minSdkVersion 21
targetSdkVersion 34
targetSdkVersion 33
versionName "${versionMajor}.${versionMinor}.${versionPatch}"
versionCode project.versionCode
}
@ -100,7 +100,7 @@ tasks.register('prepareAssetsFiles') {
tasks.register('zipAssetsFiles', Zip) {
dependsOn prepareAssetsFiles
archiveFileName = 'assets.zip'
destinationDirectory = file('src/main/assets')
destinationDirectory = file('src/main/assets/data')
from('build/assets/Files')
}
@ -125,8 +125,7 @@ dependencies {
/* Third-party libraries */
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.appcompat:appcompat-resources:1.6.1'
implementation("androidx.browser:browser:1.6.0")
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.2'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.1'
implementation 'androidx.work:work-runtime-ktx:2.8.1'
implementation 'com.google.android.material:material:1.10.0'
implementation 'com.google.android.material:material:1.9.0'
}

View File

@ -28,6 +28,7 @@
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:enableOnBackInvokedCallback="false"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
@ -41,8 +42,8 @@
android:value="3.0" />
<activity
android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|navigation|screenSize|screenLayout"
android:name="com.multicraft.game.MainActivity"
android:configChanges="orientation|keyboardHidden|navigation|screenSize"
android:exported="true"
android:maxAspectRatio="3.0"
android:screenOrientation="sensorLandscape"
@ -54,8 +55,8 @@
</activity>
<activity
android:name=".GameActivity"
android:configChanges="orientation|keyboard|keyboardHidden|navigation|screenSize|smallestScreenSize|screenLayout|uiMode"
android:name="com.multicraft.game.GameActivity"
android:configChanges="orientation|keyboard|keyboardHidden|navigation|screenSize|smallestScreenSize"
android:exported="true"
android:hardwareAccelerated="true"
android:launchMode="singleTask"
@ -71,19 +72,6 @@
</intent-filter>
</activity>
<activity
android:name=".dialogs.ConnectionDialog"
android:configChanges="orientation|keyboardHidden|navigation|screenSize"
android:exported="false"
android:screenOrientation="sensorLandscape"
android:theme="@style/CustomDialog" />
<activity
android:name=".dialogs.RestartDialog"
android:configChanges="orientation|keyboardHidden|navigation|screenSize"
android:exported="false"
android:screenOrientation="sensorLandscape"
android:theme="@style/CustomDialog" />
</application>
</manifest>

View File

@ -1,7 +1,7 @@
/*
MultiCraft
Copyright (C) 2014-2023 MoNTE48, Maksim Gamarnik <Maksym48@pm.me>
Copyright (C) 2014-2023 ubulem, Bektur Mambetov <berkut87@gmail.com>
Copyright (C) 2014-2022 MoNTE48, Maksim Gamarnik <Maksym48@pm.me>
Copyright (C) 2014-2022 ubulem, Bektur Mambetov <berkut87@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by

View File

@ -1,7 +1,7 @@
/*
MultiCraft
Copyright (C) 2014-2023 MoNTE48, Maksim Gamarnik <Maksym48@pm.me>
Copyright (C) 2014-2023 ubulem, Bektur Mambetov <berkut87@gmail.com>
Copyright (C) 2014-2022 MoNTE48, Maksim Gamarnik <Maksym48@pm.me>
Copyright (C) 2014-2022 ubulem, Bektur Mambetov <berkut87@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
@ -20,9 +20,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
package com.multicraft.game
import android.content.Intent
import android.content.res.Configuration
import android.content.res.Configuration.HARDKEYBOARDHIDDEN_NO
import android.net.Uri
import android.os.*
import android.os.Bundle
import android.text.InputType
import android.view.*
import android.view.WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN
@ -31,15 +33,12 @@ import android.view.inputmethod.EditorInfo
import android.view.inputmethod.InputMethodManager
import android.widget.TextView
import androidx.appcompat.app.AlertDialog
import androidx.browser.customtabs.CustomTabsIntent
import androidx.browser.customtabs.CustomTabsIntent.SHARE_STATE_OFF
import com.multicraft.game.MainActivity.Companion.radius
import com.multicraft.game.databinding.*
import com.multicraft.game.databinding.InputTextBinding
import com.multicraft.game.databinding.MultilineInputBinding
import com.multicraft.game.helpers.*
import com.multicraft.game.helpers.ApiLevelHelper.isOreo
import org.libsdl.app.SDLActivity
import java.util.*
import kotlin.system.exitProcess
class GameActivity : SDLActivity() {
companion object {
@ -55,21 +54,21 @@ class GameActivity : SDLActivity() {
private var messageReturnValue = ""
private var hasKeyboard = false
override fun getLibraries() = arrayOf("MultiCraft")
override fun getMainSharedObject() =
"${getContext().applicationInfo.nativeLibraryDir}/libMultiCraft.so"
override fun getLibraries(): Array<String> {
return arrayOf(
"MultiCraft"
)
}
override fun getMainSharedObject(): String {
return getContext().applicationInfo.nativeLibraryDir + "/libMultiCraft.so"
}
override fun onCreate(savedInstanceState: Bundle?) {
try {
super.onCreate(savedInstanceState)
} catch (e: Error) {
exitProcess(0)
} catch (e: Exception) {
exitProcess(0)
}
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
hasKeyboard = hasHardKeyboard()
hasKeyboard = resources.configuration.hardKeyboardHidden == HARDKEYBOARDHIDDEN_NO
}
override fun onWindowFocusChanged(hasFocus: Boolean) {
@ -89,13 +88,15 @@ class GameActivity : SDLActivity() {
override fun onResume() {
super.onResume()
if (hasKeyboard) keyboardEvent(true)
if (hasKeyboard)
keyboardEvent(hasKeyboard)
window.makeFullScreen()
}
override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)
val statusKeyboard = hasHardKeyboard()
val statusKeyboard =
resources.configuration.hardKeyboardHidden == HARDKEYBOARDHIDDEN_NO
if (hasKeyboard != statusKeyboard) {
hasKeyboard = statusKeyboard
keyboardEvent(hasKeyboard)
@ -136,8 +137,8 @@ class GameActivity : SDLActivity() {
editText.inputType = inputType
editText.setSelection(editText.text?.length ?: 0)
// for Android OS
editText.setOnEditorActionListener { _: TextView?, keyCode: Int, _: KeyEvent? ->
if (keyCode == KeyEvent.KEYCODE_ENTER || keyCode == KeyEvent.KEYCODE_ENDCALL) {
editText.setOnEditorActionListener { _: TextView?, KeyCode: Int, _: KeyEvent? ->
if (KeyCode == KeyEvent.KEYCODE_ENTER || KeyCode == KeyEvent.KEYCODE_ENDCALL) {
imm.hideSoftInputFromWindow(editText.windowToken, 0)
messageReturnValue = editText.text.toString()
alertDialog.dismiss()
@ -146,9 +147,9 @@ class GameActivity : SDLActivity() {
}
return@setOnEditorActionListener false
}
if (isChromebook()) {
editText.setOnKeyListener { _: View?, keyCode: Int, _: KeyEvent? ->
if (keyCode == KeyEvent.KEYCODE_ENTER || keyCode == KeyEvent.KEYCODE_ENDCALL) {
// for Chrome OS
editText.setOnKeyListener { _: View?, KeyCode: Int, _: KeyEvent? ->
if (KeyCode == KeyEvent.KEYCODE_ENTER || KeyCode == KeyEvent.KEYCODE_ENDCALL) {
imm.hideSoftInputFromWindow(editText.windowToken, 0)
messageReturnValue = editText.text.toString()
alertDialog.dismiss()
@ -157,7 +158,6 @@ class GameActivity : SDLActivity() {
}
return@setOnKeyListener false
}
}
binding.input.setEndIconOnClickListener {
imm.hideSoftInputFromWindow(editText.windowToken, 0)
messageReturnValue = editText.text.toString()
@ -174,7 +174,7 @@ class GameActivity : SDLActivity() {
// should be above `show()`
alertWindow.setSoftInputMode(SOFT_INPUT_STATE_VISIBLE)
alertDialog.show()
if (!isTablet())
if (!resources.getBoolean(R.bool.isTablet))
alertWindow.makeFullScreenAlert()
alertDialog.setOnCancelListener {
window.setSoftInputMode(SOFT_INPUT_STATE_ALWAYS_HIDDEN)
@ -200,8 +200,8 @@ class GameActivity : SDLActivity() {
editText.setSelection(editText.text?.length ?: 0)
val imm = getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager
// for Android OS
editText.setOnEditorActionListener { _: TextView?, keyCode: Int, _: KeyEvent? ->
if (keyCode == KeyEvent.KEYCODE_ENTER || keyCode == KeyEvent.KEYCODE_ENDCALL) {
editText.setOnEditorActionListener { _: TextView?, KeyCode: Int, _: KeyEvent? ->
if (KeyCode == KeyEvent.KEYCODE_ENTER || KeyCode == KeyEvent.KEYCODE_ENDCALL) {
imm.hideSoftInputFromWindow(editText.windowToken, 0)
messageReturnValue = editText.text.toString()
alertDialog.dismiss()
@ -210,9 +210,9 @@ class GameActivity : SDLActivity() {
}
return@setOnEditorActionListener false
}
if (isChromebook()) {
editText.setOnKeyListener { _: View?, keyCode: Int, _: KeyEvent? ->
if (keyCode == KeyEvent.KEYCODE_ENTER || keyCode == KeyEvent.KEYCODE_ENDCALL) {
// for Chrome OS
editText.setOnKeyListener { _: View?, KeyCode: Int, _: KeyEvent? ->
if (KeyCode == KeyEvent.KEYCODE_ENTER || KeyCode == KeyEvent.KEYCODE_ENDCALL) {
imm.hideSoftInputFromWindow(editText.windowToken, 0)
messageReturnValue = editText.text.toString()
alertDialog.dismiss()
@ -221,7 +221,6 @@ class GameActivity : SDLActivity() {
}
return@setOnKeyListener false
}
}
binding.multiInput.setEndIconOnClickListener {
imm.hideSoftInputFromWindow(editText.windowToken, 0)
messageReturnValue = editText.text.toString()
@ -238,7 +237,7 @@ class GameActivity : SDLActivity() {
val alertWindow = alertDialog.window!!
alertWindow.setSoftInputMode(SOFT_INPUT_STATE_VISIBLE)
alertDialog.show()
if (!isTablet())
if (!resources.getBoolean(R.bool.isTablet))
alertWindow.makeFullScreenAlert()
alertDialog.setOnCancelListener {
window.setSoftInputMode(SOFT_INPUT_STATE_ALWAYS_HIDDEN)
@ -271,13 +270,9 @@ class GameActivity : SDLActivity() {
@Suppress("unused")
fun openURI(uri: String?) {
val builder = CustomTabsIntent.Builder()
builder.setShareState(SHARE_STATE_OFF)
.setStartAnimations(this, R.anim.slide_in_bottom, R.anim.slide_out_top)
.setExitAnimations(this, R.anim.slide_in_top, R.anim.slide_out_bottom)
val customTabsIntent = builder.build()
try {
customTabsIntent.launchUrl(this, Uri.parse(uri))
val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse(uri))
startActivity(browserIntent)
} catch (ignored: Exception) {
}
}
@ -297,7 +292,7 @@ class GameActivity : SDLActivity() {
@Suppress("unused")
fun getSecretKey(key: String): String {
return key
return "Stub"
}
@Suppress("unused")

View File

@ -1,7 +1,7 @@
/*
MultiCraft
Copyright (C) 2014-2023 MoNTE48, Maksim Gamarnik <Maksym48@pm.me>
Copyright (C) 2014-2023 ubulem, Bektur Mambetov <berkut87@gmail.com>
Copyright (C) 2014-2022 MoNTE48, Maksim Gamarnik <Maksym48@pm.me>
Copyright (C) 2014-2022 ubulem, Bektur Mambetov <berkut87@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
@ -22,25 +22,18 @@ package com.multicraft.game
import android.content.Intent
import android.content.SharedPreferences
import android.graphics.drawable.AnimationDrawable
import android.graphics.Color
import android.graphics.drawable.LayerDrawable
import android.os.Bundle
import android.provider.Settings.ACTION_WIFI_SETTINGS
import android.provider.Settings.ACTION_WIRELESS_SETTINGS
import android.view.RoundedCorner
import android.view.WindowManager
import androidx.activity.OnBackPressedCallback
import androidx.activity.result.ActivityResultLauncher
import androidx.activity.result.contract.ActivityResultContracts
import android.view.*
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.lifecycleScope
import androidx.core.graphics.BlendModeColorFilterCompat
import androidx.core.graphics.BlendModeCompat
import androidx.lifecycle.*
import androidx.work.WorkInfo
import com.multicraft.game.databinding.ActivityMainBinding
import com.multicraft.game.dialogs.ConnectionDialog
import com.multicraft.game.helpers.*
import com.multicraft.game.helpers.ApiLevelHelper.isAndroid12
import com.multicraft.game.helpers.ApiLevelHelper.isPie
import com.multicraft.game.helpers.PreferenceHelper.TAG_BUILD_VER
import com.multicraft.game.helpers.PreferenceHelper.getStringValue
import com.multicraft.game.helpers.PreferenceHelper.set
@ -56,14 +49,11 @@ class MainActivity : AppCompatActivity() {
private var externalStorage: File? = null
private val sep = File.separator
private lateinit var prefs: SharedPreferences
private lateinit var restartStartForResult: ActivityResultLauncher<Intent>
private lateinit var connStartForResult: ActivityResultLauncher<Intent>
private val versionCode = BuildConfig.VERSION_CODE
private val versionName = "${BuildConfig.VERSION_NAME}+$versionCode"
companion object {
var radius = 0
const val NO_SPACE_LEFT = "ENOSPC"
}
override fun onCreate(savedInstanceState: Bundle?) {
@ -71,34 +61,30 @@ class MainActivity : AppCompatActivity() {
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)
onBackPressedDispatcher.addCallback(object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
}
})
connStartForResult = registerForActivityResult(
ActivityResultContracts.StartActivityForResult()
) {
checkAppVersion()
}
restartStartForResult = registerForActivityResult(
ActivityResultContracts.StartActivityForResult()
) {
if (it.resultCode == RESULT_OK)
finishApp(true)
else
finishApp(false)
}
try {
prefs = PreferenceHelper.init(this)
externalStorage = getExternalFilesDir(null)
listOf(filesDir, cacheDir, externalStorage).requireNoNulls()
if (filesDir == null || cacheDir == null || externalStorage == null)
throw IOException("Bad disk space state")
checkConnection()
} catch (e: Exception) {
val isRestart = e.message?.contains(NO_SPACE_LEFT) != true
showRestartDialog(restartStartForResult, isRestart)
} catch (e: Exception) { // Storage -> IOException, Prefs -> GeneralSecurityException
showRestartDialog(!e.message!!.contains("ENOPSC"))
}
}
@Deprecated("Deprecated in Java")
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
@Suppress("DEPRECATION")
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == 104)
checkAppVersion()
}
@Deprecated("Deprecated in Java")
override fun onBackPressed() {
// Prevent abrupt interruption when copy game files from assets
}
override fun onResume() {
super.onResume()
window.makeFullScreen()
@ -111,66 +97,81 @@ class MainActivity : AppCompatActivity() {
override fun onAttachedToWindow() {
super.onAttachedToWindow()
if (isPie()) {
val cutout = window.decorView.rootWindowInsets.displayCutout
if (cutout != null) {
radius = 40
}
if (isAndroid12()) {
val insets = window.decorView.rootWindowInsets
if (insets != null) {
val tl = insets.getRoundedCorner(RoundedCorner.POSITION_TOP_LEFT)
radius = tl?.radius ?: if (cutout != null) 40 else 0
radius = tl?.radius ?: 0
}
}
}
val animation = binding.loadingAnim.drawable as AnimationDrawable
animation.start()
// interface
private fun showProgress(textMessage: Int, progress: Int) {
if (binding.progressBar.visibility == View.GONE) {
binding.tvProgress.setText(textMessage)
binding.progressCircle.visibility = View.GONE
binding.progressBar.visibility = View.VISIBLE
binding.progressBar.progress = 0
} else if (progress > 0) {
val progressMessage = "${getString(textMessage)} $progress%"
binding.tvProgress.text = progressMessage
binding.progressBar.progress = progress
// colorize the progress bar
val progressBarDrawable =
(binding.progressBar.progressDrawable as LayerDrawable).getDrawable(0)
val progressDrawable = (progressBarDrawable as LayerDrawable).getDrawable(1)
val color = Color.rgb(255 - progress * 2, progress * 2, 25)
progressDrawable.colorFilter =
BlendModeColorFilterCompat.createBlendModeColorFilterCompat(
color, BlendModeCompat.SRC_IN
)
}
}
private fun startNative() {
val initLua = File(filesDir, "builtin${sep}mainmenu${sep}init.lua")
if (initLua.exists() && initLua.canRead()) {
val intent = Intent(this, GameActivity::class.java)
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
startActivity(intent)
} else {
prefs[TAG_BUILD_VER] = "0"
showRestartDialog(restartStartForResult)
showRestartDialog()
}
}
private fun prepareToRun() {
val filesList = mutableListOf<File>().apply {
addAll(listOf(
"builtin",
"client${sep}shaders",
"fonts",
"games${sep}default",
"textures${sep}base"
).map { File(filesDir, it) })
}
val zips = mutableListOf("assets.zip")
binding.tvProgress.setText(R.string.preparing)
binding.progressCircle.visibility = View.VISIBLE
binding.progressBar.visibility = View.GONE
val filesList = listOf(
File(externalStorage, "debug.txt"),
File(filesDir, "builtin"),
File(filesDir, "client"),
File(filesDir, "fonts"),
File(filesDir, "textures")
)
val zips = assets.list("data")!!.toList()
lifecycleScope.launch {
filesList.forEach { it.deleteRecursively() }
zips.forEach {
try {
assets.open(it).use { input ->
assets.open("data$sep$it").use { input ->
File(cacheDir, it).copyInputStreamToFile(input)
}
} catch (e: IOException) {
val isNotEnoughSpace = e.message!!.contains(NO_SPACE_LEFT)
runOnUiThread { showRestartDialog(restartStartForResult, !isNotEnoughSpace) }
runOnUiThread { showRestartDialog(!e.message!!.contains("ENOSPC")) }
return@forEach
}
}
try {
startUnzipWorker(zips.toTypedArray())
startUnzipWorker(zips)
} catch (e: Exception) {
runOnUiThread { showRestartDialog(restartStartForResult) }
runOnUiThread { showRestartDialog() }
}
}
}
@ -183,47 +184,31 @@ class MainActivity : AppCompatActivity() {
prepareToRun()
}
private fun showConnectionDialog() {
val intent = Intent(this, ConnectionDialog::class.java)
val startForResult = registerForActivityResult(
ActivityResultContracts.StartActivityForResult()
) {
when (it.resultCode) {
RESULT_OK -> connStartForResult.launch(Intent(ACTION_WIFI_SETTINGS))
RESULT_FIRST_USER -> connStartForResult.launch(Intent(ACTION_WIRELESS_SETTINGS))
else -> checkAppVersion()
}
}
startForResult.launch(intent)
}
// check connection available
private fun checkConnection() = lifecycleScope.launch {
if (isConnected()) checkAppVersion()
val result = isConnected()
if (result) checkAppVersion()
else try {
showConnectionDialog()
showConnectionDialog { checkAppVersion() }
} catch (e: Exception) {
checkAppVersion()
}
}
private fun startUnzipWorker(file: Array<String>) {
val viewModelFactory = WorkerViewModelFactory(application, file)
private fun startUnzipWorker(file: List<String>) {
val viewModelFactory = WorkerViewModelFactory(application, file.toTypedArray())
val viewModel = ViewModelProvider(this, viewModelFactory)[WorkerViewModel::class.java]
viewModel.unzippingWorkObserver
.observe(this, Observer { workInfo ->
if (workInfo == null)
return@Observer
val progress = workInfo.progress.getInt(PROGRESS, 0)
if (progress > 0) {
val progressMessage = "${getString(R.string.loading)} $progress%"
binding.tvProgress.text = progressMessage
}
showProgress(R.string.loading, progress)
if (workInfo.state.isFinished) {
if (workInfo.state == WorkInfo.State.FAILED) {
val isRestart = workInfo.outputData.getBoolean("restart", true)
showRestartDialog(restartStartForResult, isRestart)
showRestartDialog(isRestart)
} else if (workInfo.state == WorkInfo.State.SUCCEEDED) {
prefs[TAG_BUILD_VER] = versionName
startNative()

View File

@ -1,96 +0,0 @@
/*
MultiCraft
Copyright (C) 2014-2023 MoNTE48, Maksim Gamarnik <Maksym48@pm.me>
Copyright (C) 2014-2023 ubulem, Bektur Mambetov <berkut87@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3.0 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package com.multicraft.game.dialogs
import android.app.Activity
import android.content.Context
import android.content.res.Configuration
import android.os.Bundle
import android.telephony.TelephonyManager
import android.telephony.TelephonyManager.SIM_STATE_READY
import android.view.View
import android.widget.LinearLayout
import androidx.activity.OnBackPressedCallback
import androidx.appcompat.app.AppCompatActivity
import com.multicraft.game.databinding.ConnectionDialogBinding
import com.multicraft.game.helpers.ApiLevelHelper.isOreo
import com.multicraft.game.helpers.makeFullScreen
import org.libsdl.app.SDLActivity
class ConnectionDialog : AppCompatActivity() {
private fun isSimCardPresent(): Boolean {
val telephonyManager = getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager
if (!isOreo())
return telephonyManager.simState == SIM_STATE_READY
val isFirstSimPresent = telephonyManager.getSimState(0) == SIM_STATE_READY
val isSecondSimPresent = telephonyManager.getSimState(1) == SIM_STATE_READY
return isFirstSimPresent || isSecondSimPresent
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val binding = ConnectionDialogBinding.inflate(layoutInflater)
if (SDLActivity.isTablet()) {
val param = LinearLayout.LayoutParams(
0,
LinearLayout.LayoutParams.WRAP_CONTENT,
0.5f
)
binding.connRoot.layoutParams = param
}
if (isSimCardPresent())
binding.mobile.visibility = View.VISIBLE
setContentView(binding.root)
onBackPressedDispatcher.addCallback(object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
}
})
binding.wifi.setOnClickListener {
setResult(Activity.RESULT_OK)
finish()
}
binding.mobile.setOnClickListener {
setResult(Activity.RESULT_FIRST_USER)
finish()
}
binding.ignore.setOnClickListener {
setResult(Activity.RESULT_CANCELED)
finish()
}
}
override fun onResume() {
super.onResume()
window.makeFullScreen()
}
override fun attachBaseContext(base: Context?) {
val configuration = Configuration(base?.resources?.configuration)
configuration.fontScale = 1.0f
applyOverrideConfiguration(configuration)
super.attachBaseContext(base)
}
}

View File

@ -1,76 +0,0 @@
/*
MultiCraft
Copyright (C) 2014-2023 MoNTE48, Maksim Gamarnik <Maksym48@pm.me>
Copyright (C) 2014-2023 ubulem, Bektur Mambetov <berkut87@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3.0 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package com.multicraft.game.dialogs
import android.app.Activity
import android.content.Context
import android.content.res.Configuration
import android.os.Bundle
import android.widget.LinearLayout
import androidx.activity.OnBackPressedCallback
import androidx.appcompat.app.AppCompatActivity
import com.multicraft.game.databinding.RestartDialogBinding
import com.multicraft.game.helpers.makeFullScreen
import org.libsdl.app.SDLActivity
class RestartDialog : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val binding = RestartDialogBinding.inflate(layoutInflater)
if (SDLActivity.isTablet()) {
val param = LinearLayout.LayoutParams(
0,
LinearLayout.LayoutParams.WRAP_CONTENT,
0.5f
)
binding.restartRoot.layoutParams = param
}
setContentView(binding.root)
onBackPressedDispatcher.addCallback(object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
}
})
val message = intent.getStringExtra("message")!!
binding.errorDesc.text = message
binding.restart.setOnClickListener {
setResult(Activity.RESULT_OK)
finish()
}
binding.close.setOnClickListener {
setResult(Activity.RESULT_CANCELED)
finish()
}
}
override fun onResume() {
super.onResume()
window.makeFullScreen()
}
override fun attachBaseContext(base: Context?) {
val configuration = Configuration(base?.resources?.configuration)
configuration.fontScale = 1.0f
applyOverrideConfiguration(configuration)
super.attachBaseContext(base)
}
}

View File

@ -1,7 +1,7 @@
/*
MultiCraft
Copyright (C) 2014-2023 MoNTE48, Maksim Gamarnik <Maksym48@pm.me>
Copyright (C) 2014-2023 ubulem, Bektur Mambetov <berkut87@gmail.com>
Copyright (C) 2014-2022 MoNTE48, Maksim Gamarnik <Maksym48@pm.me>
Copyright (C) 2014-2022 ubulem, Bektur Mambetov <berkut87@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
@ -30,7 +30,5 @@ object ApiLevelHelper {
fun isOreo() = isGreaterOrEqual(O)
fun isPie() = isGreaterOrEqual(P)
fun isAndroid12() = isGreaterOrEqual(S)
}

View File

@ -1,7 +1,7 @@
/*
MultiCraft
Copyright (C) 2014-2023 MoNTE48, Maksim Gamarnik <Maksym48@pm.me>
Copyright (C) 2014-2023 ubulem, Bektur Mambetov <berkut87@gmail.com>
Copyright (C) 2014-2022 MoNTE48, Maksim Gamarnik <Maksym48@pm.me>
Copyright (C) 2014-2022 ubulem, Bektur Mambetov <berkut87@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by

View File

@ -1,7 +1,7 @@
/*
MultiCraft
Copyright (C) 2014-2023 MoNTE48, Maksim Gamarnik <Maksym48@pm.me>
Copyright (C) 2014-2023 ubulem, Bektur Mambetov <berkut87@gmail.com>
Copyright (C) 2014-2022 MoNTE48, Maksim Gamarnik <Maksym48@pm.me>
Copyright (C) 2014-2022 ubulem, Bektur Mambetov <berkut87@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
@ -23,22 +23,31 @@ package com.multicraft.game.helpers
import android.app.*
import android.content.Context
import android.content.Intent
import android.content.res.Configuration
import android.net.*
import android.os.*
import android.content.pm.PackageManager
import android.net.ConnectivityManager
import android.net.NetworkCapabilities
import android.provider.Settings
import android.view.View
import android.view.Window
import androidx.activity.result.ActivityResultLauncher
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.core.view.*
import com.multicraft.game.*
import com.multicraft.game.databinding.*
import com.multicraft.game.dialogs.RestartDialog
import com.multicraft.game.R
import com.multicraft.game.databinding.ConnDialogBinding
import com.multicraft.game.databinding.RestartDialogBinding
import com.multicraft.game.helpers.ApiLevelHelper.isAndroid12
import com.multicraft.game.helpers.ApiLevelHelper.isMarshmallow
import java.io.*
import java.util.*
import java.io.File
import java.io.InputStream
import kotlin.system.exitProcess
// Activity extensions
fun AppCompatActivity.getIcon() = try {
packageManager.getApplicationIcon(packageName)
} catch (e: PackageManager.NameNotFoundException) {
ContextCompat.getDrawable(this, R.mipmap.ic_launcher)
}
fun Activity.finishApp(restart: Boolean) {
if (restart) {
val intent = Intent(this, this::class.java)
@ -52,12 +61,72 @@ fun Activity.finishApp(restart: Boolean) {
)
)
}
finish()
exitProcess(0)
}
fun Activity.isConnected(): Boolean {
fun AppCompatActivity.defaultDialog(title: Int, view: View, style: Int = R.style.CustomDialog): AlertDialog {
val builder = AlertDialog.Builder(this, style)
.setIcon(getIcon())
.setTitle(title)
.setCancelable(false)
.setView(view)
return builder.create()
}
fun AppCompatActivity.headlessDialog(
view: View,
style: Int = R.style.LightTheme,
isCancelable: Boolean = false
): AlertDialog {
val builder = AlertDialog.Builder(this, style)
.setCancelable(isCancelable)
.setView(view)
return builder.create()
}
fun AppCompatActivity.show(dialog: AlertDialog) {
window?.makeFullScreen()
if (!isFinishing) dialog.show()
}
fun AppCompatActivity.showConnectionDialog(listener: (() -> Unit)? = null) {
val binding = ConnDialogBinding.inflate(layoutInflater)
val dialog = defaultDialog(R.string.conn_title, binding.root)
binding.wifi.setOnClickListener {
dialog.dismiss()
startActivityForResult(
Intent(Settings.ACTION_WIFI_SETTINGS),
104
)
}
binding.mobile.setOnClickListener {
dialog.dismiss()
startActivityForResult(
Intent(Settings.ACTION_WIRELESS_SETTINGS),
104
)
}
binding.ignore.setOnClickListener {
dialog.dismiss()
listener?.invoke()
}
show(dialog)
}
fun AppCompatActivity.showRestartDialog(isRestart: Boolean = true) {
val message =
if (isRestart) getString(R.string.restart) else getString(R.string.no_space)
val binding = RestartDialogBinding.inflate(layoutInflater)
val dialog = headlessDialog(binding.root, R.style.CustomDialog)
binding.errorDesc.text = message
binding.close.setOnClickListener { finishApp(false) }
binding.restart.setOnClickListener { finishApp(true) }
show(dialog)
}
fun AppCompatActivity.isConnected(): Boolean {
val cm = getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
if (isMarshmallow()) {
if (ApiLevelHelper.isMarshmallow()) {
val activeNetwork = cm.activeNetwork ?: return false
val capabilities = cm.getNetworkCapabilities(activeNetwork) ?: return false
return capabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_VALIDATED)
@ -67,20 +136,6 @@ fun Activity.isConnected(): Boolean {
}
}
fun AppCompatActivity.showRestartDialog(
startForResult: ActivityResultLauncher<Intent>,
isRestart: Boolean = true
) {
val message =
if (isRestart) getString(R.string.restart) else getString(R.string.no_space)
val intent = Intent(this, RestartDialog::class.java)
intent.putExtra("message", message)
startForResult.launch(intent)
}
fun Activity.hasHardKeyboard() =
resources.configuration.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO
// Other extensions
fun File.copyInputStreamToFile(inputStream: InputStream) =
outputStream().use { fileOut -> inputStream.copyTo(fileOut, 8192) }

View File

@ -1,7 +1,7 @@
/*
MultiCraft
Copyright (C) 2014-2023 MoNTE48, Maksim Gamarnik <Maksym48@pm.me>
Copyright (C) 2014-2023 ubulem, Bektur Mambetov <berkut87@gmail.com>
Copyright (C) 2014-2022 MoNTE48, Maksim Gamarnik <Maksym48@pm.me>
Copyright (C) 2014-2022 ubulem, Bektur Mambetov <berkut87@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
@ -26,7 +26,6 @@ import android.content.Context
import android.content.Context.NOTIFICATION_SERVICE
import androidx.core.app.NotificationCompat
import androidx.work.*
import com.multicraft.game.MainActivity.Companion.NO_SPACE_LEFT
import com.multicraft.game.R
import com.multicraft.game.helpers.ApiLevelHelper.isOreo
import com.multicraft.game.helpers.copyInputStreamToFile
@ -84,7 +83,7 @@ class UnzipWorker(private val appContext: Context, workerParams: WorkerParameter
}
Result.success()
} catch (e: IOException) {
val isNotEnoughSpace = e.localizedMessage!!.contains(NO_SPACE_LEFT)
val isNotEnoughSpace = e.localizedMessage!!.contains("ENOSPC")
val out = Data.Builder()
.putBoolean("restart", !isNotEnoughSpace)
.build()

View File

@ -1,7 +1,7 @@
/*
MultiCraft
Copyright (C) 2014-2023 MoNTE48, Maksim Gamarnik <Maksym48@pm.me>
Copyright (C) 2014-2023 ubulem, Bektur Mambetov <berkut87@gmail.com>
Copyright (C) 2014-2022 MoNTE48, Maksim Gamarnik <Maksym48@pm.me>
Copyright (C) 2014-2022 ubulem, Bektur Mambetov <berkut87@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by

View File

@ -1,7 +1,7 @@
/*
MultiCraft
Copyright (C) 2014-2023 MoNTE48, Maksim Gamarnik <Maksym48@pm.me>
Copyright (C) 2014-2023 ubulem, Bektur Mambetov <berkut87@gmail.com>
Copyright (C) 2014-2022 MoNTE48, Maksim Gamarnik <Maksym48@pm.me>
Copyright (C) 2014-2022 ubulem, Bektur Mambetov <berkut87@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by

View File

@ -61,7 +61,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
private static final String TAG = "SDL";
private static final int SDL_MAJOR_VERSION = 2;
private static final int SDL_MINOR_VERSION = 28;
private static final int SDL_MICRO_VERSION = 4;
private static final int SDL_MICRO_VERSION = 2;
/*
// Display InputType.SOURCE/CLASS of events and devices
//

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="@android:integer/config_mediumAnimTime"
android:fromYDelta="100%p"
android:toYDelta="0%p" />

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="@android:integer/config_mediumAnimTime"
android:fromYDelta="-100%p"
android:toYDelta="0%p" />

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="@android:integer/config_mediumAnimTime"
android:fromYDelta="0%p"
android:toYDelta="100%p" />

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="@android:integer/config_mediumAnimTime"
android:fromYDelta="0%p"
android:toYDelta="-100%p" />

View File

@ -2,7 +2,4 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/dark" />
<corners
android:topLeftRadius="5dp"
android:topRightRadius="5dp" />
</shape>

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/green_pressed" android:state_pressed="true" />
<item android:drawable="@drawable/green" />
</selector>

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/red_pressed" android:state_pressed="true" />
<item android:drawable="@drawable/red" />
</selector>

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/yellow_pressed" android:state_pressed="true" />
<item android:drawable="@drawable/yellow" />
</selector>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@android:id/background"
android:drawable="@drawable/progress_bar_bg" />
<item
android:id="@android:id/progress"
android:drawable="@drawable/progress_bar_fg" />
</layer-list>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 383 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 383 B

View File

@ -6,6 +6,6 @@
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@color/green_mc"
android:pathData="M3.4,20.4l17.45,-7.48c0.81,-0.35 0.81,-1.49 0,-1.84L3.4,3.6c-0.66,-0.29 -1.39,0.2 -1.39,0.91L2,9.12c0,0.5 0.37,0.93 0.87,0.99L17,12 2.87,13.88c-0.5,0.07 -0.87,0.5 -0.87,1l0.01,4.61c0,0.71 0.73,1.2 1.39,0.91z" />
android:fillColor="#008C80"
android:pathData="M2.01,21L23,12 2.01,3 2,10l15,2 -15,2z" />
</vector>

View File

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false">
<item
android:drawable="@drawable/loading_anim1"
android:duration="125" />
<item
android:drawable="@drawable/loading_anim2"
android:duration="125" />
<item
android:drawable="@drawable/loading_anim3"
android:duration="125" />
<item
android:drawable="@drawable/loading_anim4"
android:duration="125" />
<item
android:drawable="@drawable/loading_anim5"
android:duration="125" />
<item
android:drawable="@drawable/loading_anim6"
android:duration="125" />
<item
android:drawable="@drawable/loading_anim7"
android:duration="125" />
<item
android:drawable="@drawable/loading_anim8"
android:duration="125" />
</animation-list>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1021 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1023 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1015 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1016 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1021 B

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/custom_progress_bar" />
<item android:drawable="@drawable/progress_bar" />
</layer-list>

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 374 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 375 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 375 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 375 B

View File

@ -1,22 +1,34 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
android:layout_height="match_parent">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/loading_anim"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@drawable/loading" />
<ProgressBar
android:id="@+id/progress_bar"
style="@style/Widget.MaterialComponents.LinearProgressIndicator"
android:layout_width="512dp"
android:layout_height="64dp"
android:layout_centerInParent="true"
android:indeterminate="false"
android:max="100"
android:progressDrawable="@drawable/progress"
android:visibility="gone" />
<ProgressBar
android:id="@+id/progress_circle"
style="@style/Widget.AppCompat.ProgressBar"
android:layout_width="75dp"
android:layout_height="75dp"
android:layout_centerInParent="true"
android:indeterminate="true" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/preparing"
android:layout_below="@id/progress_circle"
android:layout_centerInParent="true"
android:text="@string/loading"
android:textColor="@color/light"
android:textSize="16sp" />
</LinearLayout>
android:textSize="14sp" />
</RelativeLayout>

View File

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingLeft="16dp"
android:paddingTop="24dp"
android:paddingRight="16dp"
android:text="@string/conn_message"
android:textColor="@color/grey_900" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp">
<com.google.android.material.button.MaterialButton
android:id="@+id/ignore"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:layout_weight="0.3"
android:text="@string/ignore"
android:textAllCaps="false"
android:textColor="@android:color/white"
app:backgroundTint="@color/red" />
<com.google.android.material.button.MaterialButton
android:id="@+id/mobile"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:layout_weight="0.4"
android:text="@string/conn_mobile"
android:textAllCaps="false"
android:textColor="@android:color/white"
app:backgroundTint="@color/green_mc" />
<com.google.android.material.button.MaterialButton
android:id="@+id/wifi"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:layout_weight="0.4"
android:text="@string/conn_wifi"
android:textAllCaps="false"
android:textColor="@android:color/white"
app:backgroundTint="@color/green_mc" />
</LinearLayout>
</LinearLayout>
</ScrollView>

View File

@ -1,78 +0,0 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="false"
android:gravity="center"
android:weightSum="1">
<LinearLayout
android:id="@+id/conn_root"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.7"
android:background="@drawable/bg_common"
android:orientation="vertical"
android:padding="16dp"
tools:ignore="UselessParent">
<androidx.appcompat.widget.AppCompatTextView
style="?android:attr/textAppearanceLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawableStart="@mipmap/ic_dialog"
android:drawablePadding="8dp"
android:gravity="center"
android:text="@string/conn_title"
android:textColor="@color/grey_900" />
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="8dp"
android:text="@string/conn_message"
android:textColor="@color/grey_900"
android:textSize="16sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/ignore"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_margin="8dp"
android:layout_weight="0.33"
android:background="@drawable/btn_yellow"
android:text="@string/ignore"
android:textAllCaps="false"
android:textColor="@android:color/white" />
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/mobile"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_margin="8dp"
android:layout_weight="0.33"
android:background="@drawable/btn_green"
android:text="@string/conn_mobile"
android:textAllCaps="false"
android:textColor="@android:color/white"
android:visibility="gone" />
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/wifi"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_margin="8dp"
android:layout_weight="0.33"
android:background="@drawable/btn_green"
android:text="@string/conn_wifi"
android:textAllCaps="false"
android:textColor="@android:color/white" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

View File

@ -6,17 +6,16 @@
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/input"
style="@style/TextInputLayoutStyle"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@drawable/bg_input"
android:hint="@string/input_text"
android:padding="4dp"
android:padding="5dp"
app:endIconDrawable="@drawable/ic_baseline_send"
app:endIconMode="custom"
app:endIconTint="@null"
app:hintTextColor="@color/green_mc">
app:endIconTint="@null">
<com.multicraft.game.CustomEditText
android:id="@+id/editText"

View File

@ -6,17 +6,16 @@
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/multiInput"
style="@style/TextInputLayoutStyle"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@drawable/bg_input"
android:hint="@string/input_text"
android:padding="4dp"
android:padding="5dp"
app:endIconDrawable="@drawable/ic_baseline_send"
app:endIconMode="custom"
app:endIconTint="@null"
app:hintTextColor="@color/green_mc">
app:endIconTint="@null">
<com.multicraft.game.CustomEditText
android:id="@+id/multiEditText"

View File

@ -1,39 +1,34 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="false"
android:gravity="center"
android:weightSum="1">
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/restart_root"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.7"
android:background="@drawable/bg_common"
android:orientation="vertical"
android:padding="16dp"
tools:ignore="UselessParent">
<androidx.appcompat.widget.AppCompatTextView
style="?android:attr/textAppearanceLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawableStart="@mipmap/ic_dialog"
android:drawablePadding="8dp"
android:orientation="vertical"
android:paddingHorizontal="10dp"
android:paddingTop="10dp">
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:gravity="center"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:text="@string/sorry"
android:textColor="@color/grey_900" />
android:textSize="22sp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="8dp">
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatImageView
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/restart"
@ -47,40 +42,46 @@
android:id="@+id/error_desc"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:minHeight="128dp"
android:padding="4dp"
android:paddingStart="4dp"
android:paddingTop="4dp"
android:paddingEnd="4dp"
android:paddingBottom="4dp"
android:text="@string/restart"
android:textColor="@color/grey_900"
android:textSize="16sp" />
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp">
android:layout_height="match_parent"
android:layout_marginTop="8dp"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatButton
<com.google.android.material.button.MaterialButton
android:id="@+id/close"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_margin="8dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="8dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="4dp"
android:layout_marginBottom="4dp"
android:layout_weight="0.5"
android:background="@drawable/btn_red"
android:text="@string/close_game"
android:textAllCaps="false"
android:textColor="@android:color/white" />
android:textStyle="bold" />
<androidx.appcompat.widget.AppCompatButton
<com.google.android.material.button.MaterialButton
android:id="@+id/restart"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_margin="8dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="4dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="4dp"
android:layout_weight="0.5"
android:background="@drawable/btn_green"
android:text="@string/restart_game"
android:textAllCaps="false"
android:textColor="@android:color/white" />
</LinearLayout>
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
</ScrollView>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- подготовка к запуску -->
<string name="preparing">Подготовка к запуску&#8230;</string>
<string name="loading">Загрузка&#8230;</string>
<string name="notification_title">Загрузка MultiCraft</string>
@ -10,8 +9,9 @@
<!-- диалог отсутствия подключения -->
<string name="conn_title">Нет Интернет Подключения!</string>
<string name="conn_message">Для полноценной игры, MultiCraft требует подключение к Интернету.\nВ противном случае Обновление игры и режим Мультиплеера будут недоступны!</string>
<string name="ignore">Пропустить</string>
<string name="conn_message">Для полноценной игры, MultiCraft требует подключение к Интернету.\nВ противном случае вам будет недоступно Обновление игры и режим Мультиплеера!</string>
<string name="conn_mobile">3G/4G</string>
<string name="ignore">Игнорировать</string>
<!-- Crash -->
<string name="sorry">Нам очень жаль!</string>

View File

@ -0,0 +1,3 @@
<resources>
<bool name="isTablet">true</bool>
</resources>

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="CustomDialog" parent="Theme.MaterialComponents.Light.NoActionBar">
<item name="windowActionBar">false</item>
<item name="android:windowBackground">@drawable/bg</item>
<item name="android:windowFullscreen">true</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:windowLayoutInDisplayCutoutMode" tools:targetApi="p">shortEdges</item>
<item name="fontFamily">@font/multicraftfont</item>
</style>
</resources>

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="CustomDialog" parent="Theme.MaterialComponents.Light.NoActionBar">
<item name="windowActionBar">false</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowFullscreen">true</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:windowLayoutInDisplayCutoutMode" tools:targetApi="p">shortEdges</item>
<item name="fontFamily">@font/multicraftfont</item>
</style>
</resources>

View File

@ -0,0 +1,3 @@
<resources>
<bool name="isTablet">false</bool>
</resources>

View File

@ -1,6 +1,8 @@
<resources>
<color name="green">#008C80</color>
<color name="light">#FAFAFA</color>
<color name="dark">#121212</color>
<color name="red">#FF1744</color>
<color name="green_mc">#32783C</color>
<color name="grey_900">#212121</color>
</resources>

View File

@ -1,12 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name" translatable="false">MultiCraft</string>
<!-- preparation for start -->
<string name="preparing">Preparing to launch&#8230;</string>
<string name="loading">Loading&#8230;</string>
<string name="notification_title">Loading MultiCraft</string>
<string name="notification_description">Less than 1 minute&#8230;</string>
<string name="input_text">Enter text</string>
<string name="input_password">Enter password</string>
@ -14,7 +13,7 @@
<string name="conn_title">No Internet Connection!</string>
<string name="conn_message">MultiCraft requires an Internet connection to use all game features.\nOtherwise, you will not get Updates and Multiplayer mode will be not available!</string>
<string name="conn_wifi" translatable="false">Wi-Fi</string>
<string name="conn_mobile" translatable="false">LTE</string>
<string name="conn_mobile">Mobile Data</string>
<string name="ignore">Ignore</string>
<!-- Crash -->

View File

@ -1,25 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<item name="windowActionBar">false</item>
<item name="android:windowBackground">@drawable/bg</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowLayoutInDisplayCutoutMode" tools:targetApi="p">shortEdges</item>
<item name="fontFamily">@font/multicraftfont</item>
<item name="colorPrimary">@color/green</item>
</style>
<style name="CustomDialog" parent="Theme.MaterialComponents.Light.NoActionBar">
<item name="windowActionBar">false</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowFullscreen">true</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:windowLayoutInDisplayCutoutMode" tools:targetApi="p">shortEdges</item>
<item name="fontFamily">@font/multicraftfont</item>
<style name="LightTheme" parent="Theme.MaterialComponents.Light.Dialog">
<item name="android:windowBackground">@drawable/bg_common</item>
<item name="background">@android:color/transparent</item>
<item name="windowMinWidthMajor">0%</item>
<item name="windowMinWidthMinor">0%</item>
</style>
<style name="FullScreenDialogStyle" parent="Theme.MaterialComponents.Light.Dialog">
<style name="CustomDialog" parent="Theme.MaterialComponents.Light.Dialog.Alert">
<item name="android:windowBackground">@drawable/bg_common</item>
<item name="background">@android:color/transparent</item>
</style>
<style name="FullScreenDialogStyle" parent="Theme.MaterialComponents.DayNight.Dialog">
<item name="android:windowFullscreen">true</item>
<item name="android:windowIsFloating">false</item>
<item name="android:backgroundDimEnabled">false</item>
@ -27,7 +29,4 @@
<item name="android:windowEnterAnimation">@null</item>
</style>
<style name="TextInputLayoutStyle" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox">
<item name="boxStrokeColor">@color/green_mc</item>
</style>
</resources>

View File

@ -16,10 +16,10 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.2.1'
classpath 'com.android.tools.build:gradle:8.1.0'
//noinspection GradleDependency
classpath 'de.undercouch:gradle-download-task:4.1.2'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.10'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.20'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}

View File

@ -1,6 +1,6 @@
#Thu Oct 05 18:46:10 EEST 2023
#Mon Aug 21 21:17:06 EEST 2023
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@ -2,12 +2,12 @@ apply plugin: 'com.android.library'
apply plugin: 'de.undercouch.download'
android {
compileSdkVersion 34
buildToolsVersion '34.0.0'
compileSdkVersion 33
buildToolsVersion '33.0.2'
ndkVersion '25.2.9519653'
defaultConfig {
minSdkVersion 21
targetSdkVersion 34
targetSdkVersion 33
externalNativeBuild {
ndkBuild {
arguments '-j' + Runtime.getRuntime().availableProcessors(),
@ -50,19 +50,17 @@ android {
}
// get precompiled deps
def buildDirectory = layout.buildDirectory.get().asFile
tasks.register('downloadDeps', Download) {
def VERSION = "05102023"
src "https://github.com/MultiCraft/deps_android/releases/download/$VERSION/deps_android.zip"
dest new File(buildDirectory, 'deps.zip')
def VERSION = "11082023"
src "https://gitlab.com/minetest-stuffs/multicraft-deps_androit/-/archive/11082023/multicraft-deps_androit-11082023.zip"
dest new File(buildDir, 'deps.zip')
overwrite false
}
tasks.register('getDeps', Copy) {
dependsOn downloadDeps
def deps = file('deps')
def f = file("$buildDirectory/deps_android")
def f = file("$buildDir/deps_android")
if (!f.exists()) {
from zipTree(downloadDeps.dest)

View File

@ -122,10 +122,7 @@ LOCAL_C_INCLUDES := \
LOCAL_SRC_FILES := \
$(wildcard ../../src/client/*.cpp) \
../../src/client/meshgen/collector.cpp \
../../src/client/render/core.cpp \
../../src/client/render/factory.cpp \
../../src/client/render/plain.cpp \
$(wildcard ../../src/client/*/*.cpp) \
$(wildcard ../../src/content/*.cpp) \
../../src/database/database.cpp \
../../src/database/database-dummy.cpp \

View File

@ -230,9 +230,14 @@
84F20E8D25D52868009562A9 /* base64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84F20E7A25D52868009562A9 /* base64.cpp */; };
84F20E8E25D52868009562A9 /* pointedthing.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84F20E7B25D52868009562A9 /* pointedthing.cpp */; };
84F20E8F25D52868009562A9 /* directiontables.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84F20E7D25D52868009562A9 /* directiontables.cpp */; };
84F20EA025D528C5009562A9 /* stereo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84F20E9025D528C4009562A9 /* stereo.cpp */; };
84F20EA125D528C5009562A9 /* core.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84F20E9425D528C5009562A9 /* core.cpp */; };
84F20EA225D528C5009562A9 /* anaglyph.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84F20E9625D528C5009562A9 /* anaglyph.cpp */; };
84F20EA325D528C5009562A9 /* plain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84F20E9725D528C5009562A9 /* plain.cpp */; };
84F20EA425D528C5009562A9 /* pageflip.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84F20E9A25D528C5009562A9 /* pageflip.cpp */; };
84F20EA525D528C5009562A9 /* factory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84F20E9B25D528C5009562A9 /* factory.cpp */; };
84F20EA625D528C5009562A9 /* sidebyside.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84F20E9C25D528C5009562A9 /* sidebyside.cpp */; };
84F20EA725D528C5009562A9 /* interlaced.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84F20E9E25D528C5009562A9 /* interlaced.cpp */; };
84F20EB025D528D7009562A9 /* subgames.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84F20EA825D528D6009562A9 /* subgames.cpp */; };
84F20EB125D528D7009562A9 /* packages.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84F20EAD25D528D7009562A9 /* packages.cpp */; };
84F20EB225D528D7009562A9 /* mods.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84F20EAE25D528D7009562A9 /* mods.cpp */; };
@ -375,7 +380,7 @@
84135B2225D5263A00CA4DCF /* texture_override.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = texture_override.h; path = ../../../src/texture_override.h; sourceTree = "<group>"; };
84135B2325D5263A00CA4DCF /* gettext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = gettext.cpp; path = ../../../src/gettext.cpp; sourceTree = "<group>"; };
84135B2425D5263A00CA4DCF /* metadata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = metadata.h; path = ../../../src/metadata.h; sourceTree = "<group>"; };
84135B2525D5263B00CA4DCF /* defaultsettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = defaultsettings.cpp; path = ../../../src/defaultsettings.cpp; sourceTree = "<group>"; };
84135B2525D5263B00CA4DCF /* defaultsettings.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = defaultsettings.cpp; path = ../../../src/defaultsettings.cpp; sourceTree = "<group>"; };
84135B2625D5263B00CA4DCF /* mapnode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mapnode.h; path = ../../../src/mapnode.h; sourceTree = "<group>"; };
84135B2725D5263B00CA4DCF /* irr_aabb3d.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = irr_aabb3d.h; path = ../../../src/irr_aabb3d.h; sourceTree = "<group>"; };
84135B2825D5263C00CA4DCF /* craftdef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = craftdef.h; path = ../../../src/craftdef.h; sourceTree = "<group>"; };
@ -772,12 +777,22 @@
84F20E7D25D52868009562A9 /* directiontables.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = directiontables.cpp; path = ../../../src/util/directiontables.cpp; sourceTree = "<group>"; };
84F20E7E25D52868009562A9 /* pointer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pointer.h; path = ../../../src/util/pointer.h; sourceTree = "<group>"; };
84F20E7F25D52868009562A9 /* quicktune.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = quicktune.h; path = ../../../src/util/quicktune.h; sourceTree = "<group>"; };
84F20E9025D528C4009562A9 /* stereo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = stereo.cpp; path = ../../../src/client/render/stereo.cpp; sourceTree = "<group>"; };
84F20E9125D528C4009562A9 /* sidebyside.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sidebyside.h; path = ../../../src/client/render/sidebyside.h; sourceTree = "<group>"; };
84F20E9225D528C5009562A9 /* factory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = factory.h; path = ../../../src/client/render/factory.h; sourceTree = "<group>"; };
84F20E9325D528C5009562A9 /* plain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = plain.h; path = ../../../src/client/render/plain.h; sourceTree = "<group>"; };
84F20E9425D528C5009562A9 /* core.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = core.cpp; path = ../../../src/client/render/core.cpp; sourceTree = "<group>"; };
84F20E9525D528C5009562A9 /* stereo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = stereo.h; path = ../../../src/client/render/stereo.h; sourceTree = "<group>"; };
84F20E9625D528C5009562A9 /* anaglyph.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = anaglyph.cpp; path = ../../../src/client/render/anaglyph.cpp; sourceTree = "<group>"; };
84F20E9725D528C5009562A9 /* plain.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = plain.cpp; path = ../../../src/client/render/plain.cpp; sourceTree = "<group>"; };
84F20E9825D528C5009562A9 /* core.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = core.h; path = ../../../src/client/render/core.h; sourceTree = "<group>"; };
84F20E9925D528C5009562A9 /* anaglyph.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = anaglyph.h; path = ../../../src/client/render/anaglyph.h; sourceTree = "<group>"; };
84F20E9A25D528C5009562A9 /* pageflip.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = pageflip.cpp; path = ../../../src/client/render/pageflip.cpp; sourceTree = "<group>"; };
84F20E9B25D528C5009562A9 /* factory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = factory.cpp; path = ../../../src/client/render/factory.cpp; sourceTree = "<group>"; };
84F20E9C25D528C5009562A9 /* sidebyside.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = sidebyside.cpp; path = ../../../src/client/render/sidebyside.cpp; sourceTree = "<group>"; };
84F20E9D25D528C5009562A9 /* pageflip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pageflip.h; path = ../../../src/client/render/pageflip.h; sourceTree = "<group>"; };
84F20E9E25D528C5009562A9 /* interlaced.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = interlaced.cpp; path = ../../../src/client/render/interlaced.cpp; sourceTree = "<group>"; };
84F20E9F25D528C5009562A9 /* interlaced.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = interlaced.h; path = ../../../src/client/render/interlaced.h; sourceTree = "<group>"; };
84F20EA825D528D6009562A9 /* subgames.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = subgames.cpp; path = ../../../src/content/subgames.cpp; sourceTree = "<group>"; };
84F20EA925D528D6009562A9 /* subgames.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = subgames.h; path = ../../../src/content/subgames.h; sourceTree = "<group>"; };
84F20EAA25D528D6009562A9 /* mods.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mods.h; path = ../../../src/content/mods.h; sourceTree = "<group>"; };
@ -953,12 +968,22 @@
84135BA425D5269800CA4DCF /* render */ = {
isa = PBXGroup;
children = (
84F20E9625D528C5009562A9 /* anaglyph.cpp */,
84F20E9925D528C5009562A9 /* anaglyph.h */,
84F20E9425D528C5009562A9 /* core.cpp */,
84F20E9825D528C5009562A9 /* core.h */,
84F20E9B25D528C5009562A9 /* factory.cpp */,
84F20E9225D528C5009562A9 /* factory.h */,
84F20E9E25D528C5009562A9 /* interlaced.cpp */,
84F20E9F25D528C5009562A9 /* interlaced.h */,
84F20E9A25D528C5009562A9 /* pageflip.cpp */,
84F20E9D25D528C5009562A9 /* pageflip.h */,
84F20E9725D528C5009562A9 /* plain.cpp */,
84F20E9325D528C5009562A9 /* plain.h */,
84F20E9C25D528C5009562A9 /* sidebyside.cpp */,
84F20E9125D528C4009562A9 /* sidebyside.h */,
84F20E9025D528C4009562A9 /* stereo.cpp */,
84F20E9525D528C5009562A9 /* stereo.h */,
);
name = render;
sourceTree = "<group>";
@ -1820,6 +1845,7 @@
84135B9E25D5264C00CA4DCF /* remoteplayer.cpp in Sources */,
84135C2025D526D700CA4DCF /* fontengine.cpp in Sources */,
84135B8425D5264C00CA4DCF /* chat.cpp in Sources */,
84F20EA425D528C5009562A9 /* pageflip.cpp in Sources */,
84F20E8125D52868009562A9 /* string.cpp in Sources */,
84135C1E25D526D700CA4DCF /* clientobject.cpp in Sources */,
84135B6B25D5264B00CA4DCF /* mapblock.cpp in Sources */,
@ -1844,6 +1870,7 @@
84F20DA325D527C5009562A9 /* socket.cpp in Sources */,
84135C1B25D526D700CA4DCF /* hud.cpp in Sources */,
84F20DDD25D52812009562A9 /* s_inventory.cpp in Sources */,
84F20EA225D528C5009562A9 /* anaglyph.cpp in Sources */,
84F20DB925D527D8009562A9 /* c_internal.cpp in Sources */,
84135B6E25D5264B00CA4DCF /* object_properties.cpp in Sources */,
84F20DAA25D527C5009562A9 /* networkpacket.cpp in Sources */,
@ -1901,6 +1928,7 @@
84135C2525D526D700CA4DCF /* imagefilters.cpp in Sources */,
84135C1325D526D700CA4DCF /* clientlauncher.cpp in Sources */,
849D0848278AC1B200471354 /* chacha.c in Sources */,
84F20EA025D528C5009562A9 /* stereo.cpp in Sources */,
84F20EB025D528D7009562A9 /* subgames.cpp in Sources */,
84135B7825D5264B00CA4DCF /* clientiface.cpp in Sources */,
84135C1725D526D700CA4DCF /* mesh.cpp in Sources */,
@ -1986,6 +2014,7 @@
84F20F0E25D52958009562A9 /* modalMenu.cpp in Sources */,
84F20E2E25D5282A009562A9 /* l_inventory.cpp in Sources */,
84135BA725D526A900CA4DCF /* collector.cpp in Sources */,
84F20EA725D528C5009562A9 /* interlaced.cpp in Sources */,
8458610724B13BDF0040BA4F /* mini-gmp.c in Sources */,
84F20F0A25D52958009562A9 /* guiBackgroundImage.cpp in Sources */,
84F20DE325D52812009562A9 /* s_client.cpp in Sources */,
@ -2009,6 +2038,7 @@
84135B8225D5264C00CA4DCF /* server.cpp in Sources */,
84F20DDB25D52812009562A9 /* s_security.cpp in Sources */,
84135B8825D5264C00CA4DCF /* gettext.cpp in Sources */,
84F20EA625D528C5009562A9 /* sidebyside.cpp in Sources */,
84F20E8325D52868009562A9 /* metricsbackend.cpp in Sources */,
84135C2425D526D700CA4DCF /* content_mapblock.cpp in Sources */,
84E33D882A7BBEE900609F77 /* wrapper.m in Sources */,
@ -2185,6 +2215,7 @@
ENABLE_HARDENED_RUNTIME = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION,
"RUN_IN_PLACE=0",
"USE_GETTEXT=1",
"USE_CURL=1",
@ -2200,7 +2231,6 @@
"VERSION_EXTRA=\"\"",
"DEVELOPMENT_BUILD=1",
);
GENERATE_INFOPLIST_FILE = YES;
HEADER_SEARCH_PATHS = (
"$(inherited)",
"${SRCROOT}/../../src",
@ -2220,9 +2250,6 @@
"${SRCROOT}/../deps/libvorbis/include",
);
INFOPLIST_FILE = MultiCraft/Info.plist;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.adventure-games";
INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2023 Minetest.org. All rights reserved.";
INFOPLIST_KEY_NSPrincipalClass = NSApplication;
MACOSX_DEPLOYMENT_TARGET = 10.11;
MARKETING_VERSION = 2.0.5;
OTHER_LDFLAGS = (
@ -2258,6 +2285,7 @@
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
"NDEBUG=1",
_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION,
"RUN_IN_PLACE=0",
"USE_GETTEXT=1",
"USE_CURL=1",
@ -2273,7 +2301,6 @@
"VERSION_EXTRA=\"\"",
"DEVELOPMENT_BUILD=0",
);
GENERATE_INFOPLIST_FILE = YES;
HEADER_SEARCH_PATHS = (
"$(inherited)",
"${SRCROOT}/../../src",
@ -2293,9 +2320,6 @@
"${SRCROOT}/../deps/libvorbis/include",
);
INFOPLIST_FILE = MultiCraft/Info.plist;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.adventure-games";
INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2023 MultiCraft Studio OÜ. All rights reserved.";
INFOPLIST_KEY_NSPrincipalClass = NSApplication;
MACOSX_DEPLOYMENT_TARGET = 10.11;
MARKETING_VERSION = 2.0.5;
OTHER_LDFLAGS = (

Binary file not shown.

Before

Width:  |  Height:  |  Size: 653 KiB

After

Width:  |  Height:  |  Size: 399 KiB

View File

@ -22,10 +22,18 @@
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationCategoryType</key>
<string>public.app-category.adventure-games</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2023 MultiCraft Studio OÜ. All rights reserved.</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSSupportsAutomaticTermination</key>
<true/>
<key>NSSupportsSuddenTermination</key>
<true/>
</dict>

View File

@ -6,8 +6,6 @@ extern "C" {
const char *get_secret_key(const char *key);
float get_screen_scale();
#ifdef __cplusplus
}
#endif

View File

@ -1,4 +1,3 @@
@import AppKit;
@import Foundation;
#import "wrapper.h"
@ -7,8 +6,3 @@ const char *get_secret_key(const char *key)
{
return "dummy";
}
float get_screen_scale()
{
return [NSScreen mainScreen].backingScaleFactor;
}

View File

@ -1,6 +1,6 @@
#!/bin/bash -e
SDL2_VERSION=release-2.28.4
SDL2_VERSION=release-2.28.3
. scripts/sdk.sh
mkdir -p deps; cd deps

View File

@ -1,6 +1,6 @@
#!/bin/bash -e
GETTEXT_VERSION=0.22.3
GETTEXT_VERSION=0.22
. scripts/sdk.sh
mkdir -p deps; cd deps

View File

@ -1,13 +1,15 @@
#!/bin/bash -e
JPEG_VERSION=3.0.1
JPEG_VERSION=3.0.0
. scripts/sdk.sh
mkdir -p deps; cd deps
if [ ! -d libjpeg-src ]; then
git clone -b $JPEG_VERSION --depth 1 https://github.com/libjpeg-turbo/libjpeg-turbo libjpeg-src
mkdir libjpeg-src/build
wget https://download.sourceforge.net/libjpeg-turbo/libjpeg-turbo-$JPEG_VERSION.tar.gz
tar -xzf libjpeg-turbo-$JPEG_VERSION.tar.gz
mv libjpeg-turbo-$JPEG_VERSION libjpeg-src
rm libjpeg-turbo-$JPEG_VERSION.tar.gz
fi
rm -rf libjpeg

View File

@ -6,15 +6,10 @@ if [ ! -d MultiCraft/MultiCraft.xcodeproj ]; then
fi
DEST=$(pwd)/assets/locale
broken_langs=(fil gd gl dv eo he hi jbo kn ko kk ky ms_Arab nn pt_BR sr_Cyrl sr_Latn zh_CN zh_TW)
pushd ../po
for lang in *; do
[ ${#lang} -ne 2 ] && continue
# Skip broken languages
if [[ " ${broken_langs[@]} " =~ " ${lang} " ]]; then
continue
fi
mopath=$DEST/$lang/LC_MESSAGES
mkdir -p $mopath
pushd $lang
@ -26,5 +21,9 @@ for lang in *; do
done
popd
# Remove hidden files and directories
find $DEST -type d,f -name '.*' -print0 | xargs -0 -- rm -rf
# remove broken languages
for broken_lang in dv eo he hi kn ko ms_Arab nn pt_BR sr_* zh_*; do
rm -rf $DEST/$broken_lang
done

View File

@ -562,7 +562,8 @@ function store.load()
end
end
local response = http.fetch_sync({ url = url })
local timeout = tonumber(core.settings:get("curl_file_download_timeout"))
local response = http.fetch_sync({ url = url, timeout = timeout })
if not response.succeeded then
return
end

View File

@ -104,19 +104,14 @@ function menudata.init_tabs()
tab_name_selected = "content",
is_open_cdb = true,
on_click = function(this)
-- Show the content tab if no hidden games are installed
for _, game in ipairs(pkgmgr.games) do
if not game.hidden then
if #pkgmgr.games > 1 or (pkgmgr.games[1] and pkgmgr.games[1].id ~= "default") then
this:set_tab("content")
return
end
end
-- Otherwise open the store dialog
local dialog = create_store_dlg("game")
else
local dialog = create_store_dlg()
dialog:set_parent(this)
this:hide()
dialog:show()
end
end,
})

View File

@ -908,7 +908,6 @@ function pkgmgr.update_gamelist()
-- Update default_game_idx
for i, game in ipairs(pkgmgr.games) do
if game.id == "default" then
-- Used by tab_local
pkgmgr.default_game_idx = i
break
end

View File

@ -32,7 +32,7 @@ local function get_formspec(tabview, name, tabdata)
packages_raw = {}
local i = 0
for _, game in ipairs(pkgmgr.games) do
if not game.hidden then
if game.id ~= "default" then
i = i + 1
packages_raw[i] = game
end

View File

@ -741,7 +741,7 @@ crosshair_alpha (Crosshair alpha) int 255 0 255
recent_chat_messages (Recent Chat Messages) int 6 2 20
# Whether node texture animations should be desynchronized per mapblock.
desynchronize_mapblock_texture_animation (Desynchronize block animation) bool false
desynchronize_mapblock_texture_animation (Desynchronize block animation) bool true
# Maximum proportion of current window to be used for hotbar.
# Useful if there's something to be displayed right or left of hotbar.
@ -1352,7 +1352,6 @@ server_side_occlusion_culling (Server side occlusion culling) bool true
# LOOKUP_NODES_LIMIT: 16 (limits get_node call client-side to
# csm_restriction_noderange)
# READ_PLAYERINFO: 32 (disable get_player_names call client-side)
# THIRD_PARTY_MODS: 256 (disable loading third-party CSMs)
csm_restriction_flags (Client side modding restrictions) int 62
# If the CSM restriction for node range is enabled, get_node calls are limited

View File

@ -861,7 +861,7 @@
# Whether node texture animations should be desynchronized per mapblock.
# type: bool
# desynchronize_mapblock_texture_animation = false
# desynchronize_mapblock_texture_animation = true
# Maximum proportion of current window to be used for hotbar.
# Useful if there's something to be displayed right or left of hotbar.
@ -1611,7 +1611,6 @@
# LOOKUP_NODES_LIMIT: 16 (limits get_node call client-side to
# csm_restriction_noderange)
# READ_PLAYERINFO: 32 (disable get_player_names call client-side)
# THIRD_PARTY_MODS: 256 (disable loading third-party client-provided mods)
# type: int
# csm_restriction_flags = 60

View File

@ -164,7 +164,6 @@ void Client::loadMods()
scanModIntoMemory(BUILTIN_MOD_NAME, getBuiltinLuaPath());
m_script->loadModFromMemory(BUILTIN_MOD_NAME);
if (!checkCSMRestrictionFlag(CSMRestrictionFlags::CSM_RF_THIRD_PARTY_MODS)) {
ClientModConfiguration modconf(getClientModsLuaPath());
m_mods = modconf.getMods();
// complain about mods with unsatisfied dependencies
@ -192,7 +191,6 @@ void Client::loadMods()
// Run them
for (const ModSpec &mod : m_mods)
m_script->loadModFromMemory(mod.name);
}
// Mods are done loading. Unlock callbacks
m_mods_loaded = true;

View File

@ -1420,14 +1420,9 @@ void MapblockMeshGenerator::drawMeshNode()
// Convert wallmounted to 6dfacedir.
// When cache enabled, it is already converted.
facedir = n.getWallMounted(nodedef);
if (!enable_mesh_cache) {
facedir = wallmountedToFacedir(facedir);
if (!enable_mesh_cache)
facedir = wallmounted_to_facedir[facedir];
}
}
// f->mesh_ptr has 24 elements
if (facedir > 23)
facedir = 0;
if (!data->m_smooth_lighting && f->mesh_ptr[facedir]) {
// use cached meshes

View File

@ -1530,8 +1530,6 @@ bool Game::connectToServer(const GameStartData &start_data,
Wait for server to accept connection
*/
bool result = true;
try {
input->clear();
@ -1541,7 +1539,7 @@ bool Game::connectToServer(const GameStartData &start_data,
fps_control.last_time = RenderingEngine::get_timer_time();
while ((result = RenderingEngine::run())) {
while (RenderingEngine::run()) {
limitFps(&fps_control, &dtime);
@ -1605,7 +1603,7 @@ bool Game::connectToServer(const GameStartData &start_data,
return false;
}
return result;
return true;
}
bool Game::getServerContent(bool *aborted)
@ -1617,8 +1615,7 @@ bool Game::getServerContent(bool *aborted)
fps_control.last_time = RenderingEngine::get_timer_time();
bool result = true;
while ((result = RenderingEngine::run())) {
while (RenderingEngine::run()) {
limitFps(&fps_control, &dtime);
@ -1694,7 +1691,7 @@ bool Game::getServerContent(bool *aborted)
}
}
return result;
return true;
}

View File

@ -74,14 +74,14 @@ void GameUI::init(Client *client)
// At the middle of the screen
// Object infos are shown in this
u32 chat_font_height = m_guitext_chat->getActiveFont()->getDimension(L"Ay").Height;
v2u32 screensize = RenderingEngine::get_instance()->getWindowSize();
s32 text_height = g_fontengine->getTextHeight() * 6;
s32 top_y = (screensize.Y - text_height) / 2;
s32 horiz_offset = 100 + client->getRoundScreen();
float scale = 1.0f;
#if defined(__ANDROID__) || defined(__APPLE__)
scale = RenderingEngine::getDisplayDensity() * client->getHudScaling() * 0.5f;
#endif
m_guitext_info = gui::StaticText::add(guienv, L"",
core::rect<s32>(horiz_offset, top_y,
horiz_offset + 400, top_y + text_height),
core::rect<s32>(0, 0, 400, g_fontengine->getTextHeight() * 6) +
v2s32(100 + client->getRoundScreen(),
chat_font_height * (g_settings->getU16("recent_chat_messages") + 3) * scale),
false, true, guiroot);
// Status text (displays info when showing and hiding GUI stuff, etc.)

View File

@ -194,6 +194,7 @@ bool MyEventReceiver::OnEvent(const SEvent &event)
#ifdef __IOS__
} else if (event.EventType == irr::EET_APPLICATION_EVENT) {
int AppEvent = event.ApplicationEvent.EventType;
ioswrap_events(AppEvent);
if (AppEvent == irr::EAET_WILL_PAUSE)
external_pause_game();
return true;

View File

@ -20,8 +20,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "anaglyph.h"
#include <irrlicht.h>
void RenderingCoreAnaglyph::drawAll()
{
renderBothImages();

View File

@ -31,7 +31,6 @@ RenderingCore *createRenderingCore(const std::string &stereo_mode, IrrlichtDevic
{
if (stereo_mode == "none")
return new RenderingCorePlain(device, client, hud);
#if !defined(__ANDROID__) && !defined(__APPLE__)
if (stereo_mode == "anaglyph")
return new RenderingCoreAnaglyph(device, client, hud);
if (stereo_mode == "interlaced")
@ -46,7 +45,6 @@ RenderingCore *createRenderingCore(const std::string &stereo_mode, IrrlichtDevic
return new RenderingCoreSideBySide(device, client, hud, true);
if (stereo_mode == "crossview")
return new RenderingCoreSideBySide(device, client, hud, false, true);
#endif
// fallback to plain renderer
errorstream << "Invalid rendering mode: " << stereo_mode << std::endl;

View File

@ -781,7 +781,7 @@ v2u32 RenderingEngine::getDisplaySize()
#else // __ANDROID__/__IOS__
float RenderingEngine::getDisplayDensity()
{
static const float density = porting::getScreenScale();
static const float density = porting::getDisplayDensity();
return density;
}

View File

@ -31,7 +31,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "config.h"
#include "metadata.h"
#define MODNAME_ALLOWED_CHARS "abcdefghijklmnopqrstuvwxyz0123456789-_"
#define MODNAME_ALLOWED_CHARS "abcdefghijklmnopqrstuvwxyz0123456789_"
struct ModSpec
{

View File

@ -144,17 +144,13 @@ SubgameSpec findSubgame(const std::string &id)
if (conf.exists("moddable"))
moddable = conf.getBool("moddable");
bool hide_game = false;
if (conf.exists("hide_game"))
hide_game = conf.getBool("hide_game");
std::string menuicon_path;
#ifndef SERVER
menuicon_path = getImagePath(
game_path + DIR_DELIM + "menu" + DIR_DELIM + "icon.png");
#endif
return SubgameSpec(id, game_path, gamemod_path, mods_paths, game_name,
menuicon_path, game_author, game_release, moddable, hide_game);
menuicon_path, game_author, game_release, moddable);
}
SubgameSpec findWorldSubgame(const std::string &world_path)

View File

@ -36,7 +36,6 @@ struct SubgameSpec
std::set<std::string> addon_mods_paths;
std::string menuicon_path;
bool moddable;
bool hidden;
SubgameSpec(const std::string &id = "", const std::string &path = "",
const std::string &gamemods_path = "",
@ -45,11 +44,11 @@ struct SubgameSpec
const std::string &name = "",
const std::string &menuicon_path = "",
const std::string &author = "", int release = 0,
const bool moddable = true, const bool hidden = false) :
const bool moddable = true) :
id(id),
name(name), author(author), release(release), path(path),
gamemods_path(gamemods_path), addon_mods_paths(addon_mods_paths),
menuicon_path(menuicon_path), moddable(moddable), hidden(hidden)
menuicon_path(menuicon_path), moddable(moddable)
{
}

View File

@ -30,8 +30,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "client/renderingengine.h"
#endif
#ifdef __APPLE__
#ifdef __IOS__
#import "wrapper.h"
#import "SDVersion.h"
#else
#import <AppKit/AppKit.h>
#endif
#endif
void set_default_settings()
@ -236,7 +240,7 @@ void set_default_settings()
settings->setDefault("gui_scaling", "1.0");
settings->setDefault("gui_scaling_filter", "false");
settings->setDefault("gui_scaling_filter_txr2img", "true");
settings->setDefault("desynchronize_mapblock_texture_animation", "false");
settings->setDefault("desynchronize_mapblock_texture_animation", "true");
settings->setDefault("hud_hotbar_max_width", "1.0");
settings->setDefault("hud_move_upwards", "0");
settings->setDefault("round_screen", "0");
@ -503,7 +507,7 @@ void set_default_settings()
settings->setDefault("keymap_camera_mode", "KEY_KEY_C");
settings->setDefault("vsync", "true");
int ScaleFactor = porting::getScreenScale();
int ScaleFactor = (int) [NSScreen mainScreen].backingScaleFactor;
settings->setDefault("screen_dpi", std::to_string(ScaleFactor * 72));
if (ScaleFactor >= 2) {
settings->setDefault("hud_scaling", "1.5");
@ -612,7 +616,7 @@ void set_default_settings()
} else {
// high settings
settings->setDefault("client_mapblock_limit", "500");
settings->setDefault("viewing_range", "120");
settings->setDefault("viewing_range", "125");
settings->setDefault("active_object_send_range_blocks", "4");
settings->setDefault("max_block_generate_distance", "5");

View File

@ -215,26 +215,26 @@ public:
private:
CurlHandlePool *pool;
CURL *curl = nullptr;
CURLM *multi = nullptr;
CURL *curl;
CURLM *multi;
HTTPFetchRequest request;
HTTPFetchResult result;
std::ostringstream oss;
struct curl_slist *http_header = nullptr;
#if LIBCURL_VERSION_NUM >= 0x075500
curl_mime *multipart_mime = nullptr;
#elif LIBCURL_VERSION_NUM >= 0x071304
curl_httppost *post = nullptr;
#endif
struct curl_slist *http_header;
curl_httppost *post;
};
HTTPFetchOngoing::HTTPFetchOngoing(const HTTPFetchRequest &request_,
CurlHandlePool *pool_):
pool(pool_),
curl(NULL),
multi(NULL),
request(request_),
result(request_),
oss(std::ios::binary)
oss(std::ios::binary),
http_header(NULL),
post(NULL)
{
curl = pool->alloc();
if (curl == NULL) {
@ -257,16 +257,15 @@ HTTPFetchOngoing::HTTPFetchOngoing(const HTTPFetchRequest &request_,
curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
}
#if LIBCURL_VERSION_NUM >= 0x071304
// Restrict protocols so that curl vulnerabilities in
// other protocols don't affect us.
#if LIBCURL_VERSION_NUM >= 0x075500
// These settings were introduced in curl 7.85.0.
const char *protocols = "HTTP,HTTPS,FTP,FTPS";
curl_easy_setopt(curl, CURLOPT_PROTOCOLS_STR, protocols);
curl_easy_setopt(curl, CURLOPT_REDIR_PROTOCOLS_STR, protocols);
#elif LIBCURL_VERSION_NUM >= 0x071304
// These settings were introduced in curl 7.19.4, and later deprecated.
long protocols = CURLPROTO_HTTP | CURLPROTO_HTTPS | CURLPROTO_FTP | CURLPROTO_FTPS;
// These settings were introduced in curl 7.19.4.
long protocols =
CURLPROTO_HTTP |
CURLPROTO_HTTPS |
CURLPROTO_FTP |
CURLPROTO_FTPS;
curl_easy_setopt(curl, CURLOPT_PROTOCOLS, protocols);
curl_easy_setopt(curl, CURLOPT_REDIR_PROTOCOLS, protocols);
#endif
@ -297,15 +296,6 @@ HTTPFetchOngoing::HTTPFetchOngoing(const HTTPFetchRequest &request_,
// Set data from fields or raw_data
if (request.multipart) {
#if LIBCURL_VERSION_NUM >= 0x075500
multipart_mime = curl_mime_init(curl);
for (auto &it : request.fields) {
curl_mimepart *part = curl_mime_addpart(multipart_mime);
curl_mime_name(part, it.first.c_str());
curl_mime_data(part, it.second.c_str(), it.second.size());
}
curl_easy_setopt(curl, CURLOPT_MIMEPOST, multipart_mime);
#elif LIBCURL_VERSION_NUM >= 0x071304
curl_httppost *last = NULL;
for (StringMap::iterator it = request.fields.begin();
it != request.fields.end(); ++it) {
@ -317,8 +307,8 @@ HTTPFetchOngoing::HTTPFetchOngoing(const HTTPFetchRequest &request_,
CURLFORM_END);
}
curl_easy_setopt(curl, CURLOPT_HTTPPOST, post);
// request.post_fields must now *never* be modified until CURLOPT_HTTPPOST is cleared
#endif
// request.post_fields must now *never* be
// modified until CURLOPT_HTTPPOST is cleared
} else {
switch (request.method) {
case HTTP_GET:
@ -433,17 +423,11 @@ HTTPFetchOngoing::~HTTPFetchOngoing()
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, NULL);
curl_slist_free_all(http_header);
}
#if LIBCURL_VERSION_NUM >= 0x075500
if (multipart_mime) {
curl_easy_setopt(curl, CURLOPT_MIMEPOST, nullptr);
curl_mime_free(multipart_mime);
}
#elif LIBCURL_VERSION_NUM >= 0x071304
if (post) {
curl_easy_setopt(curl, CURLOPT_HTTPPOST, NULL);
curl_formfree(post);
}
#endif
// Store the cURL handle for reuse
pool->free(curl);
}

View File

@ -3857,5 +3857,38 @@ inline std::wostream& operator<<(std::wostream& out, const ustring16<TAlloc>& in
}
#endif
#ifndef USTRING_NO_STL
namespace unicode
{
//! Hashing algorithm for hashing a ustring. Used for things like unordered_maps.
//! Algorithm taken from std::hash<std::string>.
class hash : public std::unary_function<core::ustring, size_t>
{
public:
size_t operator()(const core::ustring& s) const
{
size_t ret = 2166136261U;
size_t index = 0;
size_t stride = 1 + s.size_raw() / 10;
core::ustring::const_iterator i = s.begin();
while (i != s.end())
{
// TODO: Don't force u32 on an x64 OS. Make it agnostic.
ret = 16777619U * ret ^ (size_t)s[(u32)index];
index += stride;
i += stride;
}
return (ret);
}
};
} // end namespace unicode
#endif
} // end namespace core
} // end namespace irr

View File

@ -53,20 +53,6 @@ MapgenV7P::MapgenV7P(MapgenV7PParams *params, EmergeParams *emerge)
{
spflags = params->spflags;
// Initialise some values to hardcoded defaults
cave_width = 0.09;
large_cave_depth = -33;
small_cave_num_min = 0;
small_cave_num_max = 0;
large_cave_num_min = 0;
large_cave_num_max = 2;
large_cave_flooded = 0.5;
cavern_limit = -256;
cavern_taper = 256;
cavern_threshold = 0.7;
dungeon_ymin = -31000;
dungeon_ymax = 31000;
// Average of mgv6 small caves count
small_caves_count = 6 * csize.X * csize.Z * MAP_BLOCKSIZE / 50000;
@ -90,13 +76,6 @@ MapgenV7P::MapgenV7P(MapgenV7PParams *params, EmergeParams *emerge)
noise_ridge = new Noise(&params->np_ridge, seed, csize.X, csize.Z);
}
// 3D noise, 1 down overgeneration
MapgenBasic::np_cave1 = NoiseParams(0.0, 12.0, v3f(61.0, 61.0, 61.0), 52534, 3, 0.5, 2.0);
MapgenBasic::np_cave2 = NoiseParams(0.0, 12.0, v3f(67.0, 67.0, 67.0), 10325, 3, 0.5, 2.0);
MapgenBasic::np_cavern = NoiseParams(0.0, 1.0, v3f(384.0, 128.0, 384.0), 723, 5, 0.63, 2.0);
// 3D noise
MapgenBasic::np_dungeons = NoiseParams(0.9, 0.5, v3f(500.0, 500.0, 500.0), 0, 2, 0.8, 2.0);
// Resolve additional nodes
c_bedrock = ndef->getId("mapgen_bedrock");
}

View File

@ -151,7 +151,7 @@ u8 MapNode::getFaceDir(const NodeDefManager *nodemgr,
return (getParam2() & 0x1F) % 24;
if (allow_wallmounted && (f.param_type_2 == CPT2_WALLMOUNTED ||
f.param_type_2 == CPT2_COLORED_WALLMOUNTED))
return wallmountedToFacedir(getParam2() & 0x07);
return wallmounted_to_facedir[getParam2() & 0x07];
return 0;
}

View File

@ -1051,7 +1051,6 @@ enum CSMRestrictionFlags : u64 {
CSM_RF_READ_NODEDEFS = 0x00000008, // Disable nodedef lookups
CSM_RF_LOOKUP_NODES = 0x00000010, // Limit node lookups
CSM_RF_READ_PLAYERINFO = 0x00000020, // Disable player info lookups
CSM_RF_THIRD_PARTY_MODS = 0x00000100, // Don't load third-party CSMs
CSM_RF_ALL = 0xFFFFFFFF,
};

View File

@ -751,12 +751,6 @@ std::string getSecretKey(const std::string &key)
{
return std::string(get_secret_key(key.c_str()));
}
float getScreenScale()
{
static const float retval = get_screen_scale();
return retval;
}
#endif
float getTotalSystemMemory()

View File

@ -360,8 +360,6 @@ bool open_url(const std::string &url);
#if defined(__APPLE__)
std::string getSecretKey(const std::string &key);
float getScreenScale();
#endif
/**

View File

@ -328,7 +328,8 @@ void notifyExitGame()
jnienv->ExceptionClear();
}
float getScreenScale()
#ifndef SERVER
float getDisplayDensity()
{
static bool firstRun = true;
static float value = 0;
@ -346,6 +347,7 @@ float getScreenScale()
return value;
}
#endif // ndef SERVER
void finishGame(const std::string &exc)
{

View File

@ -82,10 +82,9 @@ void notifyServerConnect(bool is_multiplayer);
*/
void notifyExitGame();
/**
* get screen density
*/
float getScreenScale();
#ifndef SERVER
float getDisplayDensity();
#endif
/**
* call Android function to finish

Some files were not shown because too many files have changed in this diff Show More