Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c3acbb5453 |
Generated
-1
@@ -1,4 +1,3 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="jbr-21" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="jbr-21" project-jdk-type="JavaSDK">
|
||||||
|
|||||||
@@ -6,6 +6,13 @@
|
|||||||
"lua_url": "https://autopatchos.starrails.com/lua/BetaLive/output_15242148_d40f856defc0_599b68a0adf7bd",
|
"lua_url": "https://autopatchos.starrails.com/lua/BetaLive/output_15242148_d40f856defc0_599b68a0adf7bd",
|
||||||
"ifix_url": "https://autopatchos.starrails.com/ifix/BetaLive/output_15265964_799df4f0ecef_5a94550ba64cff"
|
"ifix_url": "https://autopatchos.starrails.com/ifix/BetaLive/output_15265964_799df4f0ecef_5a94550ba64cff"
|
||||||
},
|
},
|
||||||
|
"CNBETAAndroid4.3.52": {
|
||||||
|
"asset_bundle_url": "https://autopatchos.starrails.com/asb/BetaLive/output_15305566_fea016d35145_54bbf8ab4009f5",
|
||||||
|
"asset_bundle_url_b": "https://autopatchos.starrails.com/asb/BetaLive/output_15305566_fea016d35145_54bbf8ab4009f5",
|
||||||
|
"ex_resource_url": "https://autopatchos.starrails.com/design_data/BetaLive/output_15318724_a7af31327e74_b3328eb95329b2",
|
||||||
|
"lua_url": "https://autopatchos.starrails.com/lua/BetaLive/output_15305751_09783637ccc4_d16f9c81138ab3",
|
||||||
|
"ifix_url": "https://autopatchos.starrails.com/ifix/BetaLive/output_15265964_799df4f0ecef_5a94550ba64cff"
|
||||||
|
},
|
||||||
"CNBETAWin4.3.51": {
|
"CNBETAWin4.3.51": {
|
||||||
"asset_bundle_url": "https://autopatchos.starrails.com/asb/BetaLive/output_15261247_f6e6db2125cf_369da465b36faf",
|
"asset_bundle_url": "https://autopatchos.starrails.com/asb/BetaLive/output_15261247_f6e6db2125cf_369da465b36faf",
|
||||||
"asset_bundle_url_b": "https://autopatchos.starrails.com/asb/BetaLive/output_15235885_6091fd15561a_83828f542dc1f3",
|
"asset_bundle_url_b": "https://autopatchos.starrails.com/asb/BetaLive/output_15235885_6091fd15561a_83828f542dc1f3",
|
||||||
@@ -13,6 +20,13 @@
|
|||||||
"lua_url": "https://autopatchos.starrails.com/lua/BetaLive/output_15242148_d40f856defc0_599b68a0adf7bd",
|
"lua_url": "https://autopatchos.starrails.com/lua/BetaLive/output_15242148_d40f856defc0_599b68a0adf7bd",
|
||||||
"ifix_url": "https://autopatchos.starrails.com/ifix/BetaLive/output_15265964_799df4f0ecef_5a94550ba64cff"
|
"ifix_url": "https://autopatchos.starrails.com/ifix/BetaLive/output_15265964_799df4f0ecef_5a94550ba64cff"
|
||||||
},
|
},
|
||||||
|
"CNBETAWin4.3.52": {
|
||||||
|
"asset_bundle_url": "https://autopatchos.starrails.com/asb/BetaLive/output_15305566_fea016d35145_54bbf8ab4009f5",
|
||||||
|
"asset_bundle_url_b": "https://autopatchos.starrails.com/asb/BetaLive/output_15305566_fea016d35145_54bbf8ab4009f5",
|
||||||
|
"ex_resource_url": "https://autopatchos.starrails.com/design_data/BetaLive/output_15318724_a7af31327e74_b3328eb95329b2",
|
||||||
|
"lua_url": "https://autopatchos.starrails.com/lua/BetaLive/output_15305751_09783637ccc4_d16f9c81138ab3",
|
||||||
|
"ifix_url": "https://autopatchos.starrails.com/ifix/BetaLive/output_15265964_799df4f0ecef_5a94550ba64cff"
|
||||||
|
},
|
||||||
"CNBETAiOS4.3.51": {
|
"CNBETAiOS4.3.51": {
|
||||||
"asset_bundle_url": "https://autopatchos.starrails.com/asb/BetaLive/output_15261247_f6e6db2125cf_369da465b36faf",
|
"asset_bundle_url": "https://autopatchos.starrails.com/asb/BetaLive/output_15261247_f6e6db2125cf_369da465b36faf",
|
||||||
"asset_bundle_url_b": "https://autopatchos.starrails.com/asb/BetaLive/output_15235885_6091fd15561a_83828f542dc1f3",
|
"asset_bundle_url_b": "https://autopatchos.starrails.com/asb/BetaLive/output_15235885_6091fd15561a_83828f542dc1f3",
|
||||||
@@ -20,6 +34,13 @@
|
|||||||
"lua_url": "https://autopatchos.starrails.com/lua/BetaLive/output_15242148_d40f856defc0_599b68a0adf7bd",
|
"lua_url": "https://autopatchos.starrails.com/lua/BetaLive/output_15242148_d40f856defc0_599b68a0adf7bd",
|
||||||
"ifix_url": "https://autopatchos.starrails.com/ifix/BetaLive/output_15265964_799df4f0ecef_5a94550ba64cff"
|
"ifix_url": "https://autopatchos.starrails.com/ifix/BetaLive/output_15265964_799df4f0ecef_5a94550ba64cff"
|
||||||
},
|
},
|
||||||
|
"CNBETAiOS4.3.52": {
|
||||||
|
"asset_bundle_url": "https://autopatchos.starrails.com/asb/BetaLive/output_15305566_fea016d35145_54bbf8ab4009f5",
|
||||||
|
"asset_bundle_url_b": "https://autopatchos.starrails.com/asb/BetaLive/output_15305566_fea016d35145_54bbf8ab4009f5",
|
||||||
|
"ex_resource_url": "https://autopatchos.starrails.com/design_data/BetaLive/output_15318724_a7af31327e74_b3328eb95329b2",
|
||||||
|
"lua_url": "https://autopatchos.starrails.com/lua/BetaLive/output_15305751_09783637ccc4_d16f9c81138ab3",
|
||||||
|
"ifix_url": "https://autopatchos.starrails.com/ifix/BetaLive/output_15265964_799df4f0ecef_5a94550ba64cff"
|
||||||
|
},
|
||||||
"OSBETAAndroid4.3.51": {
|
"OSBETAAndroid4.3.51": {
|
||||||
"asset_bundle_url": "https://autopatchos.starrails.com/asb/BetaLive/output_15261247_f6e6db2125cf_369da465b36faf",
|
"asset_bundle_url": "https://autopatchos.starrails.com/asb/BetaLive/output_15261247_f6e6db2125cf_369da465b36faf",
|
||||||
"asset_bundle_url_b": "https://autopatchos.starrails.com/asb/BetaLive/output_15235885_6091fd15561a_83828f542dc1f3",
|
"asset_bundle_url_b": "https://autopatchos.starrails.com/asb/BetaLive/output_15235885_6091fd15561a_83828f542dc1f3",
|
||||||
@@ -27,6 +48,13 @@
|
|||||||
"lua_url": "https://autopatchos.starrails.com/lua/BetaLive/output_15242148_d40f856defc0_599b68a0adf7bd",
|
"lua_url": "https://autopatchos.starrails.com/lua/BetaLive/output_15242148_d40f856defc0_599b68a0adf7bd",
|
||||||
"ifix_url": "https://autopatchos.starrails.com/ifix/BetaLive/output_15265964_799df4f0ecef_5a94550ba64cff"
|
"ifix_url": "https://autopatchos.starrails.com/ifix/BetaLive/output_15265964_799df4f0ecef_5a94550ba64cff"
|
||||||
},
|
},
|
||||||
|
"OSBETAAndroid4.3.52": {
|
||||||
|
"asset_bundle_url": "https://autopatchos.starrails.com/asb/BetaLive/output_15305566_fea016d35145_54bbf8ab4009f5",
|
||||||
|
"asset_bundle_url_b": "https://autopatchos.starrails.com/asb/BetaLive/output_15305566_fea016d35145_54bbf8ab4009f5",
|
||||||
|
"ex_resource_url": "https://autopatchos.starrails.com/design_data/BetaLive/output_15318724_a7af31327e74_b3328eb95329b2",
|
||||||
|
"lua_url": "https://autopatchos.starrails.com/lua/BetaLive/output_15305751_09783637ccc4_d16f9c81138ab3",
|
||||||
|
"ifix_url": "https://autopatchos.starrails.com/ifix/BetaLive/output_15265964_799df4f0ecef_5a94550ba64cff"
|
||||||
|
},
|
||||||
"OSBETAWin4.3.51": {
|
"OSBETAWin4.3.51": {
|
||||||
"asset_bundle_url": "https://autopatchos.starrails.com/asb/BetaLive/output_15261247_f6e6db2125cf_369da465b36faf",
|
"asset_bundle_url": "https://autopatchos.starrails.com/asb/BetaLive/output_15261247_f6e6db2125cf_369da465b36faf",
|
||||||
"asset_bundle_url_b": "https://autopatchos.starrails.com/asb/BetaLive/output_15235885_6091fd15561a_83828f542dc1f3",
|
"asset_bundle_url_b": "https://autopatchos.starrails.com/asb/BetaLive/output_15235885_6091fd15561a_83828f542dc1f3",
|
||||||
@@ -34,11 +62,25 @@
|
|||||||
"lua_url": "https://autopatchos.starrails.com/lua/BetaLive/output_15242148_d40f856defc0_599b68a0adf7bd",
|
"lua_url": "https://autopatchos.starrails.com/lua/BetaLive/output_15242148_d40f856defc0_599b68a0adf7bd",
|
||||||
"ifix_url": "https://autopatchos.starrails.com/ifix/BetaLive/output_15265964_799df4f0ecef_5a94550ba64cff"
|
"ifix_url": "https://autopatchos.starrails.com/ifix/BetaLive/output_15265964_799df4f0ecef_5a94550ba64cff"
|
||||||
},
|
},
|
||||||
|
"OSBETAWin4.3.52": {
|
||||||
|
"asset_bundle_url": "https://autopatchos.starrails.com/asb/BetaLive/output_15305566_fea016d35145_54bbf8ab4009f5",
|
||||||
|
"asset_bundle_url_b": "https://autopatchos.starrails.com/asb/BetaLive/output_15305566_fea016d35145_54bbf8ab4009f5",
|
||||||
|
"ex_resource_url": "https://autopatchos.starrails.com/design_data/BetaLive/output_15318724_a7af31327e74_b3328eb95329b2",
|
||||||
|
"lua_url": "https://autopatchos.starrails.com/lua/BetaLive/output_15305751_09783637ccc4_d16f9c81138ab3",
|
||||||
|
"ifix_url": "https://autopatchos.starrails.com/ifix/BetaLive/output_15265964_799df4f0ecef_5a94550ba64cff"
|
||||||
|
},
|
||||||
"OSBETAiOS4.3.51": {
|
"OSBETAiOS4.3.51": {
|
||||||
"asset_bundle_url": "https://autopatchos.starrails.com/asb/BetaLive/output_15261247_f6e6db2125cf_369da465b36faf",
|
"asset_bundle_url": "https://autopatchos.starrails.com/asb/BetaLive/output_15261247_f6e6db2125cf_369da465b36faf",
|
||||||
"asset_bundle_url_b": "https://autopatchos.starrails.com/asb/BetaLive/output_15235885_6091fd15561a_83828f542dc1f3",
|
"asset_bundle_url_b": "https://autopatchos.starrails.com/asb/BetaLive/output_15235885_6091fd15561a_83828f542dc1f3",
|
||||||
"ex_resource_url": "https://autopatchos.starrails.com/design_data/BetaLive/output_15265964_c2fbb1eb05fc_f2238199ee2b6e",
|
"ex_resource_url": "https://autopatchos.starrails.com/design_data/BetaLive/output_15265964_c2fbb1eb05fc_f2238199ee2b6e",
|
||||||
"lua_url": "https://autopatchos.starrails.com/lua/BetaLive/output_15242148_d40f856defc0_599b68a0adf7bd",
|
"lua_url": "https://autopatchos.starrails.com/lua/BetaLive/output_15242148_d40f856defc0_599b68a0adf7bd",
|
||||||
"ifix_url": "https://autopatchos.starrails.com/ifix/BetaLive/output_15265964_799df4f0ecef_5a94550ba64cff"
|
"ifix_url": "https://autopatchos.starrails.com/ifix/BetaLive/output_15265964_799df4f0ecef_5a94550ba64cff"
|
||||||
|
},
|
||||||
|
"OSBETAiOS4.3.52": {
|
||||||
|
"asset_bundle_url": "https://autopatchos.starrails.com/asb/BetaLive/output_15305566_fea016d35145_54bbf8ab4009f5",
|
||||||
|
"asset_bundle_url_b": "https://autopatchos.starrails.com/asb/BetaLive/output_15305566_fea016d35145_54bbf8ab4009f5",
|
||||||
|
"ex_resource_url": "https://autopatchos.starrails.com/design_data/BetaLive/output_15318724_a7af31327e74_b3328eb95329b2",
|
||||||
|
"lua_url": "https://autopatchos.starrails.com/lua/BetaLive/output_15305751_09783637ccc4_d16f9c81138ab3",
|
||||||
|
"ifix_url": "https://autopatchos.starrails.com/ifix/BetaLive/output_15265964_799df4f0ecef_5a94550ba64cff"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,6 @@ package com.example.firefly_go_android
|
|||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.os.Build
|
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import libandroid.Libandroid
|
import libandroid.Libandroid
|
||||||
import java.io.File
|
import java.io.File
|
||||||
@@ -20,29 +19,35 @@ object FireflyModMenu {
|
|||||||
if (!dataDir.exists()) dataDir.mkdirs()
|
if (!dataDir.exists()) dataDir.mkdirs()
|
||||||
|
|
||||||
val sharedPrefs = activity.getSharedPreferences("FireflyModPrefs", Context.MODE_PRIVATE)
|
val sharedPrefs = activity.getSharedPreferences("FireflyModPrefs", Context.MODE_PRIVATE)
|
||||||
val currentVersion = try {
|
val modPackageName = "com.kain344.firefly_go_android"
|
||||||
val packageInfo = activity.packageManager.getPackageInfo("com.kain344.firefly_go_android", 0)
|
|
||||||
if (Build.VERSION.SDK_INT >= 33) {
|
val currentUpdateTime = try {
|
||||||
packageInfo.longVersionCode
|
val packageInfo = activity.packageManager.getPackageInfo(modPackageName, 0)
|
||||||
} else {
|
packageInfo.lastUpdateTime
|
||||||
@Suppress("DEPRECATION")
|
|
||||||
packageInfo.versionCode.toLong()
|
|
||||||
}
|
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
1L
|
0L
|
||||||
}
|
}
|
||||||
val lastVersion = sharedPrefs.getLong("last_version_code", 0L)
|
|
||||||
val shouldOverride = currentVersion > lastVersion
|
val lastUpdateTime = sharedPrefs.getLong("last_update_time", 0L)
|
||||||
|
val shouldOverride = currentUpdateTime != 0L && currentUpdateTime != lastUpdateTime
|
||||||
|
|
||||||
if (!isServerStarted) {
|
if (!isServerStarted) {
|
||||||
Log.d("FireflyMod", "Start Server")
|
Log.d("FireflyMod", "Start Server")
|
||||||
isServerStarted = true
|
isServerStarted = true
|
||||||
Thread {
|
Thread {
|
||||||
try {
|
try {
|
||||||
val isCopyDone = copyRawFiles(dataDir, shouldOverride)
|
// Lấy context của module để truy cập assets đúng cách trong môi trường Xposed
|
||||||
|
val modContext = try {
|
||||||
|
activity.createPackageContext(modPackageName, Context.CONTEXT_IGNORE_SECURITY)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Log.e("FireflyMod", "Không thể tạo mod context: ${e.message}")
|
||||||
|
activity
|
||||||
|
}
|
||||||
|
|
||||||
|
val isCopyDone = copyRawFiles(modContext, dataDir, shouldOverride)
|
||||||
if (isCopyDone) {
|
if (isCopyDone) {
|
||||||
if (shouldOverride) {
|
if (shouldOverride) {
|
||||||
sharedPrefs.edit().putLong("last_version_code", currentVersion).apply()
|
sharedPrefs.edit().putLong("last_update_time", currentUpdateTime).apply()
|
||||||
}
|
}
|
||||||
Libandroid.setPathDataLocal(appDataPath)
|
Libandroid.setPathDataLocal(appDataPath)
|
||||||
Libandroid.setServerRunning(true)
|
Libandroid.setServerRunning(true)
|
||||||
@@ -57,27 +62,24 @@ object FireflyModMenu {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun copyRawFiles(targetDir: File, override: Boolean = false): Boolean {
|
private fun copyRawFiles(context: Context, targetDir: File, override: Boolean = false): Boolean {
|
||||||
val files = listOf(
|
val files = listOf(
|
||||||
"assets/data-in-game.json" to "data-in-game.json",
|
"data-in-game.json" to "data-in-game.json",
|
||||||
"assets/freesr-data.json" to "freesr-data.json",
|
"freesr-data.json" to "freesr-data.json",
|
||||||
"assets/version.json" to "version.json"
|
"version.json" to "version.json"
|
||||||
)
|
)
|
||||||
return try {
|
return try {
|
||||||
for ((assetPath, name) in files) {
|
for ((assetFile, outName) in files) {
|
||||||
val outFile = File(targetDir, name)
|
val outFile = File(targetDir, outName)
|
||||||
if (outFile.exists() && !override) continue
|
if (outFile.exists() && !override) continue
|
||||||
|
|
||||||
val inputStream =
|
context.assets.open(assetFile).use { input ->
|
||||||
FireflyModMenu::class.java.classLoader?.getResourceAsStream(assetPath)
|
|
||||||
?: return false
|
|
||||||
|
|
||||||
inputStream.use { input ->
|
|
||||||
FileOutputStream(outFile).use { output ->
|
FileOutputStream(outFile).use { output ->
|
||||||
input.copyTo(output)
|
input.copyTo(output)
|
||||||
output.fd.sync()
|
output.fd.sync()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Log.d("FireflyMod", "Copied $assetFile to ${outFile.absolutePath} (override=$override)")
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
|||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"tag": "4.3.2-01",
|
"tag": "4.3.2-02",
|
||||||
"title": "PreBuild Version 4.3.52 - 01"
|
"title": "PreBuild Version 4.3.52 - 02"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user