7 Commits

Author SHA1 Message Date
bdd458a64f UPDATE: Add wakelock 2025-08-06 18:32:18 +07:00
93d86df411 update for v5 2025-07-25 12:53:42 +07:00
a0cef76ae6 update for v4 2025-07-22 14:22:23 +07:00
b40252d958 fix env 2025-07-15 21:59:45 +07:00
01b311fb24 update for v3 2025-07-15 21:35:35 +07:00
d21a84ee47 update for 3.4.5x 2025-07-08 15:04:02 +07:00
ad357dc8dd update to v4 2025-06-10 12:33:33 +07:00
10 changed files with 7428 additions and 51886 deletions

1
.idea/.name generated Normal file
View File

@@ -0,0 +1 @@
FireflyPsAndorid

1
.idea/misc.xml generated
View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="jbr-21" project-jdk-type="JavaSDK">

View File

@@ -3,13 +3,9 @@
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
tools:ignore="ScopedStorage" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
@@ -25,18 +21,17 @@
<activity
android:name=".MainActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.FireflyPsAndorid">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name=".GolangServerService"
android:foregroundServiceType="dataSync" />
android:foregroundServiceType="dataSync"
android:exported="false" />
</application>
</manifest>

View File

@@ -8,29 +8,39 @@ import android.content.Context
import android.content.Intent
import android.os.Build
import android.os.IBinder
import android.os.PowerManager
import android.util.Log
import androidx.core.app.NotificationCompat
import libandroid.Libandroid
class GolangServerService : Service() {
companion object {
const val CHANNEL_ID = "GolangServerChannel"
const val NOTIFICATION_ID = 1
private const val TAG = "GolangServerService"
}
private var wakeLock: PowerManager.WakeLock? = null
override fun onCreate() {
super.onCreate()
createNotificationChannel()
}
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
Log.d(TAG, "onStartCommand called")
// 1. Tạo intent để mở lại MainActivity khi người dùng click vào thông báo
val notificationIntent = Intent(this, MainActivity::class.java)
val pendingIntent = PendingIntent.getActivity(
this, 0, notificationIntent,
PendingIntent.FLAG_IMMUTABLE
this,
0,
notificationIntent,
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
)
// 2. Tạo notification
val notification = NotificationCompat.Builder(this, CHANNEL_ID)
.setContentTitle("Golang Server")
.setContentText("Server đang chạy")
@@ -38,13 +48,23 @@ class GolangServerService : Service() {
.setContentIntent(pendingIntent)
.build()
// 3. Chạy foreground
startForeground(NOTIFICATION_ID, notification)
// Chạy server trong thread riêng để tránh ANR
// 4. Giữ CPU không sleep (tùy chọn, nhưng hữu ích)
try {
val powerManager = getSystemService(POWER_SERVICE) as PowerManager
wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "GolangServer::WakeLock")
wakeLock?.acquire()
Log.d(TAG, "✅ WakeLock acquired")
} catch (e: Exception) {
Log.e(TAG, "❌ WakeLock failed", e)
}
// 5. Chạy server trong thread riêng
Thread {
try {
val appDataPath = intent?.getStringExtra("appDataPath")
if (appDataPath != null) {
Libandroid.setPathDataLocal(appDataPath)
Log.d(TAG, "✅ Set path data: $appDataPath")
@@ -55,7 +75,7 @@ class GolangServerService : Service() {
Libandroid.setServerRunning(true)
Log.d(TAG, "✅ Server started")
} catch (e: Exception) {
Log.e(TAG, "❌ Error when start server:", e)
Log.e(TAG, "❌ Error starting server", e)
}
}.start()
@@ -64,17 +84,30 @@ class GolangServerService : Service() {
override fun onDestroy() {
super.onDestroy()
Log.d(TAG, "onDestroy called")
// 1. Tắt server
try {
val result = Libandroid.setServerRunning(false)
Log.d(TAG, "Server shutdown result: $result")
} catch (e: Exception) {
Log.e(TAG, "Error shutting down server", e)
}
// 2. Giải phóng WakeLock nếu còn giữ
try {
wakeLock?.let {
if (it.isHeld) {
it.release()
Log.d(TAG, "✅ WakeLock released")
}
}
} catch (e: Exception) {
Log.e(TAG, "❌ Failed to release WakeLock", e)
}
}
override fun onBind(intent: Intent?): IBinder? {
return null
}
override fun onBind(intent: Intent?): IBinder? = null
private fun createNotificationChannel() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
@@ -83,11 +116,12 @@ class GolangServerService : Service() {
"Golang Server Channel",
NotificationManager.IMPORTANCE_LOW
).apply {
description = "Notify Golang backend runing"
description = "Channel for running Golang backend in foreground"
}
val notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
notificationManager.createNotificationChannel(channel)
val manager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
manager.createNotificationChannel(channel)
Log.d(TAG, "✅ Notification channel created")
}
}
}

View File

@@ -1,5 +1,6 @@
package com.example.fireflypsandorid
import android.annotation.SuppressLint
import android.content.Intent
import android.os.Bundle
import android.util.Log
@@ -8,13 +9,11 @@ import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.*
import androidx.compose.runtime.*
import androidx.compose.ui.*
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
@@ -26,7 +25,7 @@ import com.example.fireflypsandorid.ui.theme.FireflyPsAndoridTheme
import java.io.*
class MainActivity : ComponentActivity() {
private val TAG = "AppInit"
private val tag = "AppInit"
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@@ -58,17 +57,18 @@ class MainActivity : ComponentActivity() {
input.copyTo(output)
}
}
Log.i(TAG, "✅ Copied $fileName to ${outFile.absolutePath}")
Log.i(tag, "✅ Copied $fileName to ${outFile.absolutePath}")
} catch (e: Exception) {
Log.e(TAG, "❌ Failed to copy $fileName: ${e.message}")
Log.e(tag, "❌ Failed to copy $fileName: ${e.message}")
}
} else {
Log.i(TAG, " $fileName already exists at ${outFile.absolutePath}")
Log.i(tag, " $fileName already exists at ${outFile.absolutePath}")
}
}
}
@SuppressLint("ImplicitSamInstance")
@Composable
fun ServerControlScreen(appDataPath: String, modifier: Modifier = Modifier) {
val context = LocalContext.current
@@ -128,7 +128,7 @@ fun ServerControlScreen(appDataPath: String, modifier: Modifier = Modifier) {
}
},
colors = ButtonDefaults.buttonColors(
containerColor = if (isServerRunning) Color(0xFFB71C1C) else Color(0xFFFF5722),
containerColor = if (isServerRunning) Color(0xFFB71C1C) else Color(0xFF2196F3),
contentColor = Color.White
),
shape = RoundedCornerShape(12.dp),

View File

@@ -1,20 +1,21 @@
{
"leader": 1,
"lineups": {
"0": 1408,
"1": 1101,
"2": 1313,
"3": 1309
"0": 1310,
"1": 1410,
"2": 1409,
"3": 1407
},
"position": {
"x": -37317,
"z": 11924,
"y": -12212,
"rot_y": 81000
"x": -4030,
"z": -13006,
"y": 0,
"rot_y": 270000
},
"scene": {
"plane_id": 10441,
"floor_id": 10441001,
"entry_id": 1044101
"plane_id": 10000,
"floor_id": 10000000,
"entry_id": 100000104
},
"char_path": {
"main": 8008,
@@ -51,6 +52,21 @@
"cur_phone_theme_id": 221011,
"cur_phone_case_id": 254001,
"cur_pam_skin_id": 252000,
"cur_pet_id": 1002
"cur_pet_id": 1002,
"cur_avatar_player_icon": 202034,
"cur_player_personal_card": 253001,
"cur_signature": "Firefly GO By Kain",
"cur_display_avatar": [
1310,
1309,
1407,
1412,
1001
],
"cur_is_display_avatar": true
},
"skin_data": {
"1001": 1100101,
"1310": 1131001
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,74 +1,38 @@
{
"CNBETAAndroid3.3.51": {
"asset_bundle_url": "https://autopatchcn.bhsr.com/asb/BetaLive/output_10451237_a3aa836fce75_f560b891c0d21e",
"ex_resource_url": "https://autopatchcn.bhsr.com/design_data/BetaLive/output_10459782_ced8509d61c9_cdbde1049f2207",
"lua_url": "https://autopatchcn.bhsr.com/lua/BetaLive/output_10434495_6bff50432edd_1641e3e19f1244",
"ifix_url": "https://autopatchcn.bhsr.com/ifix/BetaLive/output_10429797_be4a832b1c47_f58faff155c2c4"
"CNBETAAndroid3.4.55": {
"asset_bundle_url": "https://autopatchcn.bhsr.com/asb/BetaLive/output_11217430_23c5cfd2cafc_071126dd600bae",
"ex_resource_url": "https://autopatchcn.bhsr.com/design_data/BetaLive/output_11218061_68ee992558e3_fe33df3598d887",
"lua_url": "https://autopatchcn.bhsr.com/lua/BetaLive/output_11218130_15360461a27a_91a0fd1d2b4db3",
"ifix_url": "https://autopatchcn.bhsr.com/ifix/BetaLive/output_0_40d2ce0253_c61ba99f70b885"
},
"CNBETAAndroid3.3.52": {
"asset_bundle_url": "https://autopatchcn.bhsr.com/asb/BetaLive/output_10478982_243ce40577bf_000895ae562404",
"ex_resource_url": "https://autopatchcn.bhsr.com/design_data/BetaLive/output_10494861_2ed49bac2846_b7f8d02fced269",
"lua_url": "https://autopatchcn.bhsr.com/lua/BetaLive/output_10479565_234d9d8dfe49_b0890465b5ae4f",
"ifix_url": "https://autopatchcn.bhsr.com/ifix/BetaLive/output_10489293_ba258955cec6_d8347bc2994eab"
"CNBETAWin3.4.55": {
"asset_bundle_url": "https://autopatchcn.bhsr.com/asb/BetaLive/output_11217430_23c5cfd2cafc_071126dd600bae",
"ex_resource_url": "https://autopatchcn.bhsr.com/design_data/BetaLive/output_11218061_68ee992558e3_fe33df3598d887",
"lua_url": "https://autopatchcn.bhsr.com/lua/BetaLive/output_11218130_15360461a27a_91a0fd1d2b4db3",
"ifix_url": "https://autopatchcn.bhsr.com/ifix/BetaLive/output_0_40d2ce0253_c61ba99f70b885"
},
"CNBETAWin3.3.51": {
"asset_bundle_url": "https://autopatchcn.bhsr.com/asb/BetaLive/output_10451237_a3aa836fce75_f560b891c0d21e",
"ex_resource_url": "https://autopatchcn.bhsr.com/design_data/BetaLive/output_10459782_ced8509d61c9_cdbde1049f2207",
"lua_url": "https://autopatchcn.bhsr.com/lua/BetaLive/output_10434495_6bff50432edd_1641e3e19f1244",
"ifix_url": "https://autopatchcn.bhsr.com/ifix/BetaLive/output_10429797_be4a832b1c47_f58faff155c2c4"
"CNBETAiOS3.4.55": {
"asset_bundle_url": "https://autopatchcn.bhsr.com/asb/BetaLive/output_11217430_23c5cfd2cafc_071126dd600bae",
"ex_resource_url": "https://autopatchcn.bhsr.com/design_data/BetaLive/output_11218061_68ee992558e3_fe33df3598d887",
"lua_url": "https://autopatchcn.bhsr.com/lua/BetaLive/output_11218130_15360461a27a_91a0fd1d2b4db3",
"ifix_url": "https://autopatchcn.bhsr.com/ifix/BetaLive/output_0_40d2ce0253_c61ba99f70b885"
},
"CNBETAWin3.3.52": {
"asset_bundle_url": "https://autopatchcn.bhsr.com/asb/BetaLive/output_10478982_243ce40577bf_000895ae562404",
"ex_resource_url": "https://autopatchcn.bhsr.com/design_data/BetaLive/output_10494861_2ed49bac2846_b7f8d02fced269",
"lua_url": "https://autopatchcn.bhsr.com/lua/BetaLive/output_10479565_234d9d8dfe49_b0890465b5ae4f",
"ifix_url": "https://autopatchcn.bhsr.com/ifix/BetaLive/output_10489293_ba258955cec6_d8347bc2994eab"
"OSBETAAndroid3.4.55": {
"asset_bundle_url": "https://autopatchcn.bhsr.com/asb/BetaLive/output_11217430_23c5cfd2cafc_071126dd600bae",
"ex_resource_url": "https://autopatchcn.bhsr.com/design_data/BetaLive/output_11218061_68ee992558e3_fe33df3598d887",
"lua_url": "https://autopatchcn.bhsr.com/lua/BetaLive/output_11218130_15360461a27a_91a0fd1d2b4db3",
"ifix_url": "https://autopatchcn.bhsr.com/ifix/BetaLive/output_0_40d2ce0253_c61ba99f70b885"
},
"CNBETAiOS3.3.51": {
"asset_bundle_url": "https://autopatchcn.bhsr.com/asb/BetaLive/output_10451237_a3aa836fce75_f560b891c0d21e",
"ex_resource_url": "https://autopatchcn.bhsr.com/design_data/BetaLive/output_10459782_ced8509d61c9_cdbde1049f2207",
"lua_url": "https://autopatchcn.bhsr.com/lua/BetaLive/output_10434495_6bff50432edd_1641e3e19f1244",
"ifix_url": "https://autopatchcn.bhsr.com/ifix/BetaLive/output_10429797_be4a832b1c47_f58faff155c2c4"
"OSBETAWin3.4.55": {
"asset_bundle_url": "https://autopatchcn.bhsr.com/asb/BetaLive/output_11217430_23c5cfd2cafc_071126dd600bae",
"ex_resource_url": "https://autopatchcn.bhsr.com/design_data/BetaLive/output_11218061_68ee992558e3_fe33df3598d887",
"lua_url": "https://autopatchcn.bhsr.com/lua/BetaLive/output_11218130_15360461a27a_91a0fd1d2b4db3",
"ifix_url": "https://autopatchcn.bhsr.com/ifix/BetaLive/output_0_40d2ce0253_c61ba99f70b885"
},
"CNBETAiOS3.3.52": {
"asset_bundle_url": "https://autopatchcn.bhsr.com/asb/BetaLive/output_10478982_243ce40577bf_000895ae562404",
"ex_resource_url": "https://autopatchcn.bhsr.com/design_data/BetaLive/output_10494861_2ed49bac2846_b7f8d02fced269",
"lua_url": "https://autopatchcn.bhsr.com/lua/BetaLive/output_10479565_234d9d8dfe49_b0890465b5ae4f",
"ifix_url": "https://autopatchcn.bhsr.com/ifix/BetaLive/output_10489293_ba258955cec6_d8347bc2994eab"
},
"OSBETAAndroid3.3.51": {
"asset_bundle_url": "https://autopatchcn.bhsr.com/asb/BetaLive/output_10451237_a3aa836fce75_f560b891c0d21e",
"ex_resource_url": "https://autopatchcn.bhsr.com/design_data/BetaLive/output_10459782_ced8509d61c9_cdbde1049f2207",
"lua_url": "https://autopatchcn.bhsr.com/lua/BetaLive/output_10434495_6bff50432edd_1641e3e19f1244",
"ifix_url": "https://autopatchcn.bhsr.com/ifix/BetaLive/output_10429797_be4a832b1c47_f58faff155c2c4"
},
"OSBETAAndroid3.3.52": {
"asset_bundle_url": "https://autopatchcn.bhsr.com/asb/BetaLive/output_10478982_243ce40577bf_000895ae562404",
"ex_resource_url": "https://autopatchcn.bhsr.com/design_data/BetaLive/output_10494861_2ed49bac2846_b7f8d02fced269",
"lua_url": "https://autopatchcn.bhsr.com/lua/BetaLive/output_10479565_234d9d8dfe49_b0890465b5ae4f",
"ifix_url": "https://autopatchcn.bhsr.com/ifix/BetaLive/output_10489293_ba258955cec6_d8347bc2994eab"
},
"OSBETAWin3.3.51": {
"asset_bundle_url": "https://autopatchcn.bhsr.com/asb/BetaLive/output_10451237_a3aa836fce75_f560b891c0d21e",
"ex_resource_url": "https://autopatchcn.bhsr.com/design_data/BetaLive/output_10459782_ced8509d61c9_cdbde1049f2207",
"lua_url": "https://autopatchcn.bhsr.com/lua/BetaLive/output_10434495_6bff50432edd_1641e3e19f1244",
"ifix_url": "https://autopatchcn.bhsr.com/ifix/BetaLive/output_10429797_be4a832b1c47_f58faff155c2c4"
},
"OSBETAWin3.3.52": {
"asset_bundle_url": "https://autopatchcn.bhsr.com/asb/BetaLive/output_10478982_243ce40577bf_000895ae562404",
"ex_resource_url": "https://autopatchcn.bhsr.com/design_data/BetaLive/output_10494861_2ed49bac2846_b7f8d02fced269",
"lua_url": "https://autopatchcn.bhsr.com/lua/BetaLive/output_10479565_234d9d8dfe49_b0890465b5ae4f",
"ifix_url": "https://autopatchcn.bhsr.com/ifix/BetaLive/output_10489293_ba258955cec6_d8347bc2994eab"
},
"OSBETAiOS3.3.51": {
"asset_bundle_url": "https://autopatchcn.bhsr.com/asb/BetaLive/output_10451237_a3aa836fce75_f560b891c0d21e",
"ex_resource_url": "https://autopatchcn.bhsr.com/design_data/BetaLive/output_10459782_ced8509d61c9_cdbde1049f2207",
"lua_url": "https://autopatchcn.bhsr.com/lua/BetaLive/output_10434495_6bff50432edd_1641e3e19f1244",
"ifix_url": "https://autopatchcn.bhsr.com/ifix/BetaLive/output_10429797_be4a832b1c47_f58faff155c2c4"
},
"OSBETAiOS3.3.52": {
"asset_bundle_url": "https://autopatchcn.bhsr.com/asb/BetaLive/output_10478982_243ce40577bf_000895ae562404",
"ex_resource_url": "https://autopatchcn.bhsr.com/design_data/BetaLive/output_10494861_2ed49bac2846_b7f8d02fced269",
"lua_url": "https://autopatchcn.bhsr.com/lua/BetaLive/output_10479565_234d9d8dfe49_b0890465b5ae4f",
"ifix_url": "https://autopatchcn.bhsr.com/ifix/BetaLive/output_10489293_ba258955cec6_d8347bc2994eab"
"OSBETAiOS3.4.55": {
"asset_bundle_url": "https://autopatchcn.bhsr.com/asb/BetaLive/output_11217430_23c5cfd2cafc_071126dd600bae",
"ex_resource_url": "https://autopatchcn.bhsr.com/design_data/BetaLive/output_11218061_68ee992558e3_fe33df3598d887",
"lua_url": "https://autopatchcn.bhsr.com/lua/BetaLive/output_11218130_15360461a27a_91a0fd1d2b4db3",
"ifix_url": "https://autopatchcn.bhsr.com/ifix/BetaLive/output_0_40d2ce0253_c61ba99f70b885"
}
}

View File

@@ -1,3 +1,3 @@
<resources>
<string name="app_name">FireflyPsAndroid-3.3.5X</string>
<string name="app_name">FireflyGo-3.4.5X</string>
</resources>

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7ba64ec9f762e6d5edd00d7b87ff743d9aabaadd1b88b4fb77436d9fdfbc3c90
size 70766987
oid sha256:ab23bd9a708e04ce0817aa7e3d05e81e3bd64e8846d0df54af9647b550d30859
size 72329407