Compare commits

..

13 Commits

Author SHA1 Message Date
Kain344 15b84e0bc7 UPDATE: bump version to 4.3.2-01 and update firefly-go.aar
Build / build (push) Successful in 3m41s
2026-06-09 19:32:36 +07:00
Kain344 b0caa7facb feat: optimaze
Build / build (push) Successful in 3m48s
2026-06-07 15:25:41 +07:00
Kain344 77f21b4380 feat: update data
Build / build (push) Successful in 9m5s
2026-06-04 08:33:09 +07:00
Kain344 b27ec44279 UPDATE: 4.2.0
Build / build (push) Successful in 4m8s
2026-04-22 08:33:29 +07:00
Kain344 c0de0a94fb UPDATE: Support custome lineup
Build / build (push) Successful in 4m41s
2026-04-12 17:17:29 +07:00
Kain344 0f3bd04cc2 FIX: fix stuck when replace lineup
Build / build (push) Successful in 4m0s
2026-04-07 20:49:45 +07:00
Kain344 2410cf9c82 UPDATE: v4
Build / build (push) Successful in 4m44s
2026-04-07 16:25:11 +07:00
Kain344 916effa20c UPDATE: Real map fix
Build / build (push) Successful in 4m18s
2026-04-04 00:10:47 +07:00
Kain344 5de6d0ac34 UPDATE: Fix bug
Build / build (push) Successful in 8m56s
2026-04-03 17:59:30 +07:00
Kain344 173d224978 UPDATE: Fix load map
Build / build (push) Successful in 3m49s
2026-04-02 01:10:56 +07:00
Kain344 fa5c630c2b UPDATE: New data
Build / build (push) Successful in 4m39s
2026-03-31 12:46:26 +07:00
Kain344 8b9b373229 init
Build / build (push) Successful in 4m13s
2026-03-23 21:33:21 +07:00
Kain344 a72b8ecec3 Initial commit 2026-03-23 14:21:46 +00:00
49 changed files with 1082 additions and 1453 deletions
+1
View File
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="jbr-21" project-jdk-type="JavaSDK">
Binary file not shown.
-168
View File
@@ -6,34 +6,6 @@
"lua_url": "https://autopatchos.starrails.com/lua/BetaLive/output_15242148_d40f856defc0_599b68a0adf7bd",
"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"
},
"CNBETAAndroid4.3.53": {
"asset_bundle_url": "https://autopatchos.starrails.com/asb/BetaLive/output_15378434_99bffafdeff7_5d97713dcef07f",
"asset_bundle_url_b": "https://autopatchos.starrails.com/asb/BetaLive/output_15378434_99bffafdeff7_5d97713dcef07f",
"ex_resource_url": "https://autopatchos.starrails.com/design_data/BetaLive/output_15385668_07011a79dadf_1111728953724e",
"lua_url": "https://autopatchos.starrails.com/lua/BetaLive/output_15378559_7514340ac82f_70dad6c56b8bc7",
"ifix_url": "https://autopatchos.starrails.com/ifix/BetaLive/output_15384138_4e4be8cf97ac_1e3fcfa0a93bef"
},
"CNBETAAndroid4.3.54": {
"asset_bundle_url": "https://autopatchos.starrails.com/asb/BetaLive/output_15440751_fb99372e1e48_fd11e486274779",
"asset_bundle_url_b": "https://autopatchos.starrails.com/asb/BetaLive/output_15440751_fb99372e1e48_fd11e486274779",
"ex_resource_url": "https://autopatchos.starrails.com/design_data/BetaLive/output_15497648_6ef97acf9b45_ea8ed0ff303308",
"lua_url": "https://autopatchos.starrails.com/lua/BetaLive/output_15440843_4201511c48d0_34717e44c82e30",
"ifix_url": "https://autopatchos.starrails.com/ifix/BetaLive/output_0_40d2ce0253_6d871f8bca6eb4"
},
"CNBETAAndroid4.3.55": {
"asset_bundle_url": "https://autopatchos.starrails.com/asb/BetaLive/output_15507822_f63959b7920b_2231084d979019",
"asset_bundle_url_b": "https://autopatchos.starrails.com/asb/BetaLive/output_15507822_f63959b7920b_2231084d979019",
"ex_resource_url": "https://autopatchos.starrails.com/design_data/BetaLive/output_15537653_09630bf7c4f3_a1967fb1d8635c",
"lua_url": "https://autopatchos.starrails.com/lua/BetaLive/output_15507972_05909e009ba9_54e5377976705e",
"ifix_url": "https://autopatchos.starrails.com/ifix/BetaLive/output_0_40d2ce0253_6d871f8bca6eb4"
},
"CNBETAWin4.3.51": {
"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",
@@ -41,34 +13,6 @@
"lua_url": "https://autopatchos.starrails.com/lua/BetaLive/output_15242148_d40f856defc0_599b68a0adf7bd",
"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"
},
"CNBETAWin4.3.53": {
"asset_bundle_url": "https://autopatchos.starrails.com/asb/BetaLive/output_15378434_99bffafdeff7_5d97713dcef07f",
"asset_bundle_url_b": "https://autopatchos.starrails.com/asb/BetaLive/output_15378434_99bffafdeff7_5d97713dcef07f",
"ex_resource_url": "https://autopatchos.starrails.com/design_data/BetaLive/output_15385668_07011a79dadf_1111728953724e",
"lua_url": "https://autopatchos.starrails.com/lua/BetaLive/output_15378559_7514340ac82f_70dad6c56b8bc7",
"ifix_url": "https://autopatchos.starrails.com/ifix/BetaLive/output_15384138_4e4be8cf97ac_1e3fcfa0a93bef"
},
"CNBETAWin4.3.54": {
"asset_bundle_url": "https://autopatchos.starrails.com/asb/BetaLive/output_15440751_fb99372e1e48_fd11e486274779",
"asset_bundle_url_b": "https://autopatchos.starrails.com/asb/BetaLive/output_15440751_fb99372e1e48_fd11e486274779",
"ex_resource_url": "https://autopatchos.starrails.com/design_data/BetaLive/output_15497648_6ef97acf9b45_ea8ed0ff303308",
"lua_url": "https://autopatchos.starrails.com/lua/BetaLive/output_15440843_4201511c48d0_34717e44c82e30",
"ifix_url": "https://autopatchos.starrails.com/ifix/BetaLive/output_0_40d2ce0253_6d871f8bca6eb4"
},
"CNBETAWin4.3.55": {
"asset_bundle_url": "https://autopatchos.starrails.com/asb/BetaLive/output_15507822_f63959b7920b_2231084d979019",
"asset_bundle_url_b": "https://autopatchos.starrails.com/asb/BetaLive/output_15507822_f63959b7920b_2231084d979019",
"ex_resource_url": "https://autopatchos.starrails.com/design_data/BetaLive/output_15537653_09630bf7c4f3_a1967fb1d8635c",
"lua_url": "https://autopatchos.starrails.com/lua/BetaLive/output_15507972_05909e009ba9_54e5377976705e",
"ifix_url": "https://autopatchos.starrails.com/ifix/BetaLive/output_0_40d2ce0253_6d871f8bca6eb4"
},
"CNBETAiOS4.3.51": {
"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",
@@ -76,34 +20,6 @@
"lua_url": "https://autopatchos.starrails.com/lua/BetaLive/output_15242148_d40f856defc0_599b68a0adf7bd",
"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"
},
"CNBETAiOS4.3.53": {
"asset_bundle_url": "https://autopatchos.starrails.com/asb/BetaLive/output_15378434_99bffafdeff7_5d97713dcef07f",
"asset_bundle_url_b": "https://autopatchos.starrails.com/asb/BetaLive/output_15378434_99bffafdeff7_5d97713dcef07f",
"ex_resource_url": "https://autopatchos.starrails.com/design_data/BetaLive/output_15385668_07011a79dadf_1111728953724e",
"lua_url": "https://autopatchos.starrails.com/lua/BetaLive/output_15378559_7514340ac82f_70dad6c56b8bc7",
"ifix_url": "https://autopatchos.starrails.com/ifix/BetaLive/output_15384138_4e4be8cf97ac_1e3fcfa0a93bef"
},
"CNBETAiOS4.3.54": {
"asset_bundle_url": "https://autopatchos.starrails.com/asb/BetaLive/output_15440751_fb99372e1e48_fd11e486274779",
"asset_bundle_url_b": "https://autopatchos.starrails.com/asb/BetaLive/output_15440751_fb99372e1e48_fd11e486274779",
"ex_resource_url": "https://autopatchos.starrails.com/design_data/BetaLive/output_15497648_6ef97acf9b45_ea8ed0ff303308",
"lua_url": "https://autopatchos.starrails.com/lua/BetaLive/output_15440843_4201511c48d0_34717e44c82e30",
"ifix_url": "https://autopatchos.starrails.com/ifix/BetaLive/output_0_40d2ce0253_6d871f8bca6eb4"
},
"CNBETAiOS4.3.55": {
"asset_bundle_url": "https://autopatchos.starrails.com/asb/BetaLive/output_15507822_f63959b7920b_2231084d979019",
"asset_bundle_url_b": "https://autopatchos.starrails.com/asb/BetaLive/output_15507822_f63959b7920b_2231084d979019",
"ex_resource_url": "https://autopatchos.starrails.com/design_data/BetaLive/output_15537653_09630bf7c4f3_a1967fb1d8635c",
"lua_url": "https://autopatchos.starrails.com/lua/BetaLive/output_15507972_05909e009ba9_54e5377976705e",
"ifix_url": "https://autopatchos.starrails.com/ifix/BetaLive/output_0_40d2ce0253_6d871f8bca6eb4"
},
"OSBETAAndroid4.3.51": {
"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",
@@ -111,34 +27,6 @@
"lua_url": "https://autopatchos.starrails.com/lua/BetaLive/output_15242148_d40f856defc0_599b68a0adf7bd",
"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"
},
"OSBETAAndroid4.3.53": {
"asset_bundle_url": "https://autopatchos.starrails.com/asb/BetaLive/output_15378434_99bffafdeff7_5d97713dcef07f",
"asset_bundle_url_b": "https://autopatchos.starrails.com/asb/BetaLive/output_15378434_99bffafdeff7_5d97713dcef07f",
"ex_resource_url": "https://autopatchos.starrails.com/design_data/BetaLive/output_15385668_07011a79dadf_1111728953724e",
"lua_url": "https://autopatchos.starrails.com/lua/BetaLive/output_15378559_7514340ac82f_70dad6c56b8bc7",
"ifix_url": "https://autopatchos.starrails.com/ifix/BetaLive/output_15384138_4e4be8cf97ac_1e3fcfa0a93bef"
},
"OSBETAAndroid4.3.54": {
"asset_bundle_url": "https://autopatchos.starrails.com/asb/BetaLive/output_15440751_fb99372e1e48_fd11e486274779",
"asset_bundle_url_b": "https://autopatchos.starrails.com/asb/BetaLive/output_15440751_fb99372e1e48_fd11e486274779",
"ex_resource_url": "https://autopatchos.starrails.com/design_data/BetaLive/output_15497648_6ef97acf9b45_ea8ed0ff303308",
"lua_url": "https://autopatchos.starrails.com/lua/BetaLive/output_15440843_4201511c48d0_34717e44c82e30",
"ifix_url": "https://autopatchos.starrails.com/ifix/BetaLive/output_0_40d2ce0253_6d871f8bca6eb4"
},
"OSBETAAndroid4.3.55": {
"asset_bundle_url": "https://autopatchos.starrails.com/asb/BetaLive/output_15507822_f63959b7920b_2231084d979019",
"asset_bundle_url_b": "https://autopatchos.starrails.com/asb/BetaLive/output_15507822_f63959b7920b_2231084d979019",
"ex_resource_url": "https://autopatchos.starrails.com/design_data/BetaLive/output_15537653_09630bf7c4f3_a1967fb1d8635c",
"lua_url": "https://autopatchos.starrails.com/lua/BetaLive/output_15507972_05909e009ba9_54e5377976705e",
"ifix_url": "https://autopatchos.starrails.com/ifix/BetaLive/output_0_40d2ce0253_6d871f8bca6eb4"
},
"OSBETAWin4.3.51": {
"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",
@@ -146,67 +34,11 @@
"lua_url": "https://autopatchos.starrails.com/lua/BetaLive/output_15242148_d40f856defc0_599b68a0adf7bd",
"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"
},
"OSBETAWin4.3.53": {
"asset_bundle_url": "https://autopatchos.starrails.com/asb/BetaLive/output_15378434_99bffafdeff7_5d97713dcef07f",
"asset_bundle_url_b": "https://autopatchos.starrails.com/asb/BetaLive/output_15378434_99bffafdeff7_5d97713dcef07f",
"ex_resource_url": "https://autopatchos.starrails.com/design_data/BetaLive/output_15385668_07011a79dadf_1111728953724e",
"lua_url": "https://autopatchos.starrails.com/lua/BetaLive/output_15378559_7514340ac82f_70dad6c56b8bc7",
"ifix_url": "https://autopatchos.starrails.com/ifix/BetaLive/output_15384138_4e4be8cf97ac_1e3fcfa0a93bef"
},
"OSBETAWin4.3.54": {
"asset_bundle_url": "https://autopatchos.starrails.com/asb/BetaLive/output_15440751_fb99372e1e48_fd11e486274779",
"asset_bundle_url_b": "https://autopatchos.starrails.com/asb/BetaLive/output_15440751_fb99372e1e48_fd11e486274779",
"ex_resource_url": "https://autopatchos.starrails.com/design_data/BetaLive/output_15497648_6ef97acf9b45_ea8ed0ff303308",
"lua_url": "https://autopatchos.starrails.com/lua/BetaLive/output_15440843_4201511c48d0_34717e44c82e30",
"ifix_url": "https://autopatchos.starrails.com/ifix/BetaLive/output_0_40d2ce0253_6d871f8bca6eb4"
},
"OSBETAWin4.3.55": {
"asset_bundle_url": "https://autopatchos.starrails.com/asb/BetaLive/output_15507822_f63959b7920b_2231084d979019",
"asset_bundle_url_b": "https://autopatchos.starrails.com/asb/BetaLive/output_15507822_f63959b7920b_2231084d979019",
"ex_resource_url": "https://autopatchos.starrails.com/design_data/BetaLive/output_15537653_09630bf7c4f3_a1967fb1d8635c",
"lua_url": "https://autopatchos.starrails.com/lua/BetaLive/output_15507972_05909e009ba9_54e5377976705e",
"ifix_url": "https://autopatchos.starrails.com/ifix/BetaLive/output_0_40d2ce0253_6d871f8bca6eb4"
},
"OSBETAiOS4.3.51": {
"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",
"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",
"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"
},
"OSBETAiOS4.3.53": {
"asset_bundle_url": "https://autopatchos.starrails.com/asb/BetaLive/output_15378434_99bffafdeff7_5d97713dcef07f",
"asset_bundle_url_b": "https://autopatchos.starrails.com/asb/BetaLive/output_15378434_99bffafdeff7_5d97713dcef07f",
"ex_resource_url": "https://autopatchos.starrails.com/design_data/BetaLive/output_15385668_07011a79dadf_1111728953724e",
"lua_url": "https://autopatchos.starrails.com/lua/BetaLive/output_15378559_7514340ac82f_70dad6c56b8bc7",
"ifix_url": "https://autopatchos.starrails.com/ifix/BetaLive/output_15384138_4e4be8cf97ac_1e3fcfa0a93bef"
},
"OSBETAiOS4.3.54": {
"asset_bundle_url": "https://autopatchos.starrails.com/asb/BetaLive/output_15440751_fb99372e1e48_fd11e486274779",
"asset_bundle_url_b": "https://autopatchos.starrails.com/asb/BetaLive/output_15440751_fb99372e1e48_fd11e486274779",
"ex_resource_url": "https://autopatchos.starrails.com/design_data/BetaLive/output_15497648_6ef97acf9b45_ea8ed0ff303308",
"lua_url": "https://autopatchos.starrails.com/lua/BetaLive/output_15440843_4201511c48d0_34717e44c82e30",
"ifix_url": "https://autopatchos.starrails.com/ifix/BetaLive/output_0_40d2ce0253_6d871f8bca6eb4"
},
"OSBETAiOS4.3.55": {
"asset_bundle_url": "https://autopatchos.starrails.com/asb/BetaLive/output_15507822_f63959b7920b_2231084d979019",
"asset_bundle_url_b": "https://autopatchos.starrails.com/asb/BetaLive/output_15507822_f63959b7920b_2231084d979019",
"ex_resource_url": "https://autopatchos.starrails.com/design_data/BetaLive/output_15537653_09630bf7c4f3_a1967fb1d8635c",
"lua_url": "https://autopatchos.starrails.com/lua/BetaLive/output_15507972_05909e009ba9_54e5377976705e",
"ifix_url": "https://autopatchos.starrails.com/ifix/BetaLive/output_0_40d2ce0253_6d871f8bca6eb4"
}
}
@@ -2,11 +2,11 @@ package com.example.firefly_go_android
import android.app.Activity
import android.content.Context
import android.os.Build
import android.util.Log
import libandroid.Libandroid
import java.io.File
import java.io.FileOutputStream
import java.util.zip.ZipFile
object FireflyModMenu {
@@ -15,277 +15,73 @@ object FireflyModMenu {
@JvmStatic
fun init(activity: Activity) {
val modPackageName = "com.kain344.firefly_go_android"
Log.d("FireflyMod", "Initializing FireflyModMenu for module: $modPackageName")
val appDataPath = File(activity.getExternalFilesDir(null), "FireflyGo").absolutePath
val dataDir = File("$appDataPath/data")
if (!dataDir.exists()) dataDir.mkdirs()
val sharedPrefs = activity.getSharedPreferences("FireflyModPrefs", Context.MODE_PRIVATE)
val apkPath = getModuleApkPath(FireflyModMenu::class.java.classLoader)
val currentUpdateTime = if (apkPath != null) {
try {
val lastModified = File(apkPath).lastModified()
Log.d("FireflyMod", "Module APK path: $apkPath, Last modified: $lastModified")
lastModified
} catch (e: Exception) {
Log.e("FireflyMod", "Lỗi khi lấy last modified của APK: ${e.message}")
0L
}
} else {
// Fallback to PackageManager if APK path could not be resolved
try {
val packageInfo = activity.packageManager.getPackageInfo(modPackageName, 0)
Log.d("FireflyMod", "Module package found. Last update: ${packageInfo.lastUpdateTime}")
packageInfo.lastUpdateTime
} catch (e: Exception) {
Log.e("FireflyMod", "Module package $modPackageName not found: ${e.message}")
0L
val currentVersion = try {
val packageInfo = activity.packageManager.getPackageInfo("com.kain344.firefly_go_android", 0)
if (Build.VERSION.SDK_INT >= 33) {
packageInfo.longVersionCode
} else {
@Suppress("DEPRECATION")
packageInfo.versionCode.toLong()
}
} catch (e: Exception) {
1L
}
val lastUpdateTime = sharedPrefs.getLong("last_update_time", 0L)
val shouldOverride = currentUpdateTime != 0L && currentUpdateTime != lastUpdateTime
if (shouldOverride) {
Log.d("FireflyMod", "Module version changed (old: $lastUpdateTime, new: $currentUpdateTime). Forcing asset override.")
}
val lastVersion = sharedPrefs.getLong("last_version_code", 0L)
val shouldOverride = currentVersion > lastVersion
if (!isServerStarted) {
Log.d("FireflyMod", "Starting Server thread...")
Log.d("FireflyMod", "Start Server")
isServerStarted = true
Thread {
try {
val isCopyDone = if (apkPath != null) {
copyRawFilesFromApk(apkPath, dataDir, shouldOverride)
} else {
// Fallback to createPackageContext
val modContext = try {
activity.createPackageContext(modPackageName, Context.CONTEXT_INCLUDE_CODE or Context.CONTEXT_IGNORE_SECURITY)
} catch (e: Exception) {
Log.e("FireflyMod", "Không thể tạo mod context cho $modPackageName: ${e.message}")
null
}
if (modContext != null) {
copyRawFiles(modContext, dataDir, shouldOverride)
} else {
false
}
}
val isCopyDone = copyRawFiles(dataDir, shouldOverride)
if (isCopyDone) {
if (shouldOverride) {
sharedPrefs.edit().putLong("last_update_time", currentUpdateTime).apply()
sharedPrefs.edit().putLong("last_version_code", currentVersion).apply()
}
Libandroid.setPathDataLocal(appDataPath)
Libandroid.setServerRunning(true)
Log.d("FireflyMod", "Server started successfully.")
} else {
Log.e("FireflyMod", "Lỗi khi copy assets, server không được khởi chạy.")
isServerStarted = false
}
} catch (e: Exception) {
Log.e("FireflyMod", "Error in server thread: ${e.message}", e)
Log.e("FireflyMod", "Error starting server: ${e.message}", e)
isServerStarted = false
}
}.start()
}
}
private fun getModuleApkPath(classLoader: ClassLoader?): String? {
var cl = classLoader
while (cl != null) {
Log.d("FireflyMod", "Checking ClassLoader: ${cl.javaClass.name}")
// 1. Try parsing toString() first (reflection-free, safe from hidden API checks)
val pathFromToString = getModuleApkPathFromToString(cl)
if (pathFromToString != null) {
Log.d("FireflyMod", "Found APK path via ClassLoader toString(): $pathFromToString")
return pathFromToString
}
// 2. Try reflection on this class loader
val pathFromReflection = getModuleApkPathViaReflection(cl)
if (pathFromReflection != null) {
Log.d("FireflyMod", "Found APK path via reflection: $pathFromReflection")
return pathFromReflection
}
cl = cl.parent
}
Log.w("FireflyMod", "Could not find module APK path in ClassLoader hierarchy.")
return null
}
private fun getModuleApkPathFromToString(classLoader: ClassLoader): String? {
val clString = classLoader.toString()
val regexes = listOf(
Regex("""zip file "([^"]+)""""),
Regex("""zip file '([^']+)'"""),
Regex("""\[([^\]]+\.(apk|zip))\]"""),
Regex("""file:([^:\s]+\.(apk|zip))""")
)
var fallbackPath: String? = null
for (regex in regexes) {
val matches = regex.findAll(clString)
for (match in matches) {
if (match.groupValues.size > 1) {
val path = match.groupValues[1]
val file = File(path)
if (file.exists() && file.isFile) {
if (path.contains("com.kain344.firefly_go_android") && path.endsWith(".apk")) {
return path
}
if (path.endsWith(".apk") && fallbackPath == null) {
fallbackPath = path
}
}
}
}
}
// General path match for any absolute path ending with .apk or .zip
val pathRegex = Regex("""(/[^:\s"']+\.(apk|zip))""")
val pathMatches = pathRegex.findAll(clString)
for (match in pathMatches) {
val path = match.groupValues[1]
val file = File(path)
if (file.exists() && file.isFile) {
if (path.contains("com.kain344.firefly_go_android") && path.endsWith(".apk")) {
return path
}
if (path.endsWith(".apk") && fallbackPath == null) {
fallbackPath = path
}
}
}
return fallbackPath
}
private fun getModuleApkPathViaReflection(classLoader: ClassLoader): String? {
try {
val baseDexClassLoaderClass = Class.forName("dalvik.system.BaseDexClassLoader")
if (!baseDexClassLoaderClass.isInstance(classLoader)) return null
val pathListField = baseDexClassLoaderClass.getDeclaredField("pathList")
pathListField.isAccessible = true
val pathList = pathListField.get(classLoader) ?: return null
val dexElementsField = pathList.javaClass.getDeclaredField("dexElements")
dexElementsField.isAccessible = true
val dexElements = dexElementsField.get(pathList) as? Array<*> ?: return null
var fallbackApkPath: String? = null
for (element in dexElements) {
if (element == null) continue
val elementClass = element.javaClass
val fileField = try {
elementClass.getDeclaredField("file")
} catch (e: NoSuchFieldException) {
try {
elementClass.getDeclaredField("path")
} catch (ex: NoSuchFieldException) {
null
}
}
if (fileField != null) {
fileField.isAccessible = true
val file = fileField.get(element) as? File
if (file != null && file.exists() && file.isFile) {
val path = file.absolutePath
if (path.contains("com.kain344.firefly_go_android") && path.endsWith(".apk")) {
return path
}
if (path.endsWith(".apk") && fallbackApkPath == null) {
fallbackApkPath = path
}
}
}
}
return fallbackApkPath
} catch (e: Exception) {
Log.d("FireflyMod", "Reflection failed on ClassLoader ${classLoader.javaClass.name}: ${e.message}")
}
return null
}
private fun copyRawFilesFromApk(apkPath: String, targetDir: File, override: Boolean = false): Boolean {
private fun copyRawFiles(targetDir: File, override: Boolean = false): Boolean {
val files = listOf(
"data-in-game.json" to "data-in-game.json",
"freesr-data.json" to "freesr-data.json",
"version.json" to "version.json"
"assets/data-in-game.json" to "data-in-game.json",
"assets/freesr-data.json" to "freesr-data.json",
"assets/version.json" to "version.json"
)
return try {
ZipFile(apkPath).use { zip ->
for ((assetFile, outName) in files) {
val outFile = File(targetDir, outName)
if (outFile.exists() && !override) {
Log.d("FireflyMod", "Bỏ qua $outName (đã tồn tại)")
continue
}
for ((assetPath, name) in files) {
val outFile = File(targetDir, name)
if (outFile.exists() && !override) continue
val entryName = "assets/$assetFile"
val entry = zip.getEntry(entryName)
if (entry == null) {
Log.e("FireflyMod", "Không tìm thấy entry $entryName trong APK")
return false
}
val inputStream =
FireflyModMenu::class.java.classLoader?.getResourceAsStream(assetPath)
?: return false
zip.getInputStream(entry).use { input ->
FileOutputStream(outFile).use { output ->
input.copyTo(output)
output.fd.sync()
}
}
Log.d("FireflyMod", "Đã copy $assetFile từ APK thành công (override=$override)")
}
}
true
} catch (e: Exception) {
Log.e("FireflyMod", "Lỗi khi copy file từ APK: ${e.message}", e)
false
}
}
private fun copyRawFiles(context: Context, targetDir: File, override: Boolean = false): Boolean {
val files = listOf(
"data-in-game.json" to "data-in-game.json",
"freesr-data.json" to "freesr-data.json",
"version.json" to "version.json"
)
return try {
// Kiểm tra danh sách assets có sẵn để debug
val availableAssets = context.assets.list("")?.toList() ?: emptyList()
Log.d("FireflyMod", "Assets có sẵn trong module: $availableAssets")
for ((assetFile, outName) in files) {
val outFile = File(targetDir, outName)
if (outFile.exists() && !override) {
Log.d("FireflyMod", "Bỏ qua $outName (đã tồn tại)")
continue
}
if (!availableAssets.contains(assetFile)) {
Log.w("FireflyMod", "Cảnh báo: Không tìm thấy $assetFile trong danh sách assets của module!")
}
context.assets.open(assetFile).use { input ->
inputStream.use { input ->
FileOutputStream(outFile).use { output ->
input.copyTo(output)
output.fd.sync()
}
}
Log.d("FireflyMod", "Đã copy $assetFile thành công (override=$override)")
}
true
} catch (e: Exception) {
Log.e("FireflyMod", "Lỗi khi copy file từ assets của ${context.packageName}: ${e.message}", e)
Log.e("FireflyMod", "Error copying file: ${e.message}", e)
false
}
}
+2 -2
View File
@@ -1,4 +1,4 @@
{
"tag": "4.3.5-01",
"title": "PreBuild Version 4.3.5-01"
"tag": "4.3.2-01",
"title": "PreBuild Version 4.3.52 - 01"
}