GakumasHookMain: Add notes back

This commit is contained in:
WeiguangTWK 2026-03-30 17:34:40 +08:00
parent 3df995e3bc
commit 6fc1873b27
1 changed files with 22 additions and 3 deletions

View File

@ -97,15 +97,25 @@ class GakumasHookMain : XposedModule() {
val motionEvent = chain.getArg(0) as MotionEvent
val action = motionEvent.action
// 左摇杆的X和Y轴
val leftStickX = motionEvent.getAxisValue(MotionEvent.AXIS_X)
val leftStickY = motionEvent.getAxisValue(MotionEvent.AXIS_Y)
// 右摇杆的X和Y轴
val rightStickX = motionEvent.getAxisValue(MotionEvent.AXIS_Z)
val rightStickY = motionEvent.getAxisValue(MotionEvent.AXIS_RZ)
// 左扳机
val leftTrigger = motionEvent.getAxisValue(MotionEvent.AXIS_LTRIGGER)
// 右扳机
val rightTrigger = motionEvent.getAxisValue(MotionEvent.AXIS_RTRIGGER)
// 十字键
val hatX = motionEvent.getAxisValue(MotionEvent.AXIS_HAT_X)
val hatY = motionEvent.getAxisValue(MotionEvent.AXIS_HAT_Y)
// 处理摇杆和扳机事件
joystickEvent(
action,
leftStickX,
@ -243,17 +253,17 @@ class GakumasHookMain : XposedModule() {
while (isActive) {
val timeTaken = measureTimeMillis {
val returnValue = pluginCallbackLooper()
val returnValue = pluginCallbackLooper() // plugin main thread loop
if (returnValue == 9) {
NativeInitProgress.startInit = true
}
if (NativeInitProgress.startInit) {
if (NativeInitProgress.startInit) { // if init, update data
NativeInitProgress.pluginInitProgressLooper(NativeInitProgress)
gameActivity?.let { initProgressUI.updateData(it) }
}
if ((gameActivity != null) && (lastFrameStartInit != NativeInitProgress.startInit)) {
if ((gameActivity != null) && (lastFrameStartInit != NativeInitProgress.startInit)) { // change status
if (NativeInitProgress.startInit) {
initProgressUI.createView(gameActivity!!)
} else {
@ -293,18 +303,22 @@ class GakumasHookMain : XposedModule() {
null
}
// 清理本地文件
if (programConfig?.cleanLocalAssets == true) {
FilesChecker.cleanAssets()
}
// 检查 files 版本和 assets 版本并更新
if (programConfig?.checkBuiltInAssets == true) {
FilesChecker.initAndCheck(activity.filesDir, modulePath)
}
// 强制导出 assets 文件
if (initConfig?.forceExportResource == true) {
FilesChecker.updateFiles()
}
// 使用热更新文件
if ((programConfig?.useRemoteAssets == true) || (programConfig?.useAPIAssets == true)) {
val dataUri = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
intent.getParcelableExtra("resource_file", Uri::class.java)
@ -323,6 +337,7 @@ class GakumasHookMain : XposedModule() {
else if (programConfig.useAPIAssets) {
if (!File(activity.filesDir, localizationFilesDir).exists() &&
(initConfig?.forceExportResource == false)) {
// 使用 API 资源不检查内置API 资源无效,且游戏内没有插件数据时,释放内置数据
FilesChecker.initAndCheck(activity.filesDir, modulePath)
}
}
@ -481,6 +496,7 @@ class GakumasHookMain : XposedModule() {
@JvmStatic
external fun loadConfig(configJsonStr: String)
// Toast快速切换内容
private var toast: Toast? = null
@JvmStatic
@ -498,8 +514,11 @@ class GakumasHookMain : XposedModule() {
if (context != null) {
val handler = Handler(Looper.getMainLooper())
handler.post {
// 取消之前的 Toast
toast?.cancel()
// 创建新的 Toast
toast = Toast.makeText(context, message, Toast.LENGTH_SHORT)
// 展示新的 Toast
toast?.show()
}
}