Skip to content

Commit

Permalink
18:17 fix menu bug, add getRangesList
Browse files Browse the repository at this point in the history
  • Loading branch information
HdShare committed Mar 26, 2024
1 parent 7b23f86 commit c76a650
Show file tree
Hide file tree
Showing 12 changed files with 193 additions and 40 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ android {
applicationId "me.hd.hookgg"
minSdk 26
targetSdk 34
versionCode 20240325
versionName "1.6.000"
versionCode 20240326
versionName "1.6.001"
buildConfigField 'String', 'TAG', '"HookGG"'
}

Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/me/hd/hookgg/MyApp.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package me.hd.hookgg

import com.google.android.material.color.DynamicColors
import com.highcapable.yukihookapi.hook.xposed.application.ModuleApplication

class MyApp : ModuleApplication() {
Expand All @@ -11,5 +12,6 @@ class MyApp : ModuleApplication() {
override fun onCreate() {
super.onCreate()
instance = this
DynamicColors.applyToActivitiesIfAvailable(this)
}
}
1 change: 1 addition & 0 deletions app/src/main/java/me/hd/hookgg/data/AppData.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ object AppData {
GG.prompt,
GG.clearResults,
GG.setRanges,
GG.getRangesList,
GG.searchNumber,
GG.getResultsCount,
GG.getResults,
Expand Down
71 changes: 62 additions & 9 deletions app/src/main/java/me/hd/hookgg/data/GG.kt
Original file line number Diff line number Diff line change
@@ -1,19 +1,72 @@
package me.hd.hookgg.data

object GG {
const val toast = "toast"
const val addListItems = "addListItems"
const val alert = "alert"
const val allocatePage = "allocatePage"
const val bytes = "bytes"
const val choice = "choice"
const val multiChoice = "multiChoice"
const val prompt = "prompt"
const val clearList = "clearList"
const val clearResults = "clearResults"
const val setRanges = "setRanges"
const val searchNumber = "searchNumber"
const val getResultsCount = "getResultsCount"
const val getResults = "getResults"
const val copyMemory = "copyMemory"
const val copyText = "copyText"
const val disasm = "disasm"
const val dumpMemory = "dumpMemory"
const val editAll = "editAll"
const val getActiveTab = "getActiveTab"
const val getFile = "getFile"
const val getLine = "getLine"
const val getListItems = "getListItems"
const val getLocale = "getLocale"
const val getRanges = "getRanges"
const val getRangesList = "getRangesList"
const val getResults = "getResults"
const val getResultsCount = "getResultsCount"
const val getSelectedElements = "getSelectedElements"
const val getSelectedListItems = "getSelectedListItems"
const val getSelectedResults = "getSelectedResults"
const val getSpeed = "getSpeed"
const val getTargetInfo = "getTargetInfo"
const val getTargetPackage = "getTargetPackage"
const val getValues = "getValues"
const val setValues = "setValues"
const val addListItems = "addListItems"
const val getValuesRange = "getValuesRange"
const val gotoAddress = "gotoAddress"
const val hideUiButton = "hideUiButton"
const val isClickedUiButton = "isClickedUiButton"
const val isPackageInstalled = "isPackageInstalled"
const val isProcessPaused = "isProcessPaused"
const val isVisible = "isVisible"
const val loadList = "loadList"
const val loadResults = "loadResults"
const val makeRequest = "makeRequest"
const val multiChoice = "multiChoice"
const val numberFromLocale = "numberFromLocale"
const val numberToLocale = "numberToLocale"
const val processKill = "processKill"
const val processPause = "processPause"
const val processResume = "processResume"
const val processToggle = "processToggle"
const val prompt = "prompt"
const val refineAddress = "refineAddress"
const val refineNumber = "refineNumber"
const val removeListItems = "removeListItems"
const val removeResults = "removeResults"
const val require = "require"
const val saveList = "saveList"
const val saveVariable = "saveVariable"
const val searchAddress = "searchAddress"
const val searchFuzzy = "searchFuzzy"
const val searchNumber = "searchNumber"
const val searchPointer = "searchPointer"
const val setRanges = "setRanges"
const val setSpeed = "setSpeed"
const val setValues = "setValues"
const val setVisible = "setVisible"
const val showUiButton = "showUiButton"
const val skipRestoreState = "skipRestoreState"
const val sleep = "sleep"
const val startFuzzy = "startFuzzy"
const val timeJump = "timeJump"
const val toast = "toast"
const val unrandomizer = "unrandomizer"
}
2 changes: 2 additions & 0 deletions app/src/main/java/me/hd/hookgg/hook/base/BaseGGHooker.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ abstract class BaseGGHooker : YukiBaseHooker() {
if (GG.prompt in setFuncList) prompt()
if (GG.clearResults in setFuncList) clearResults()
if (GG.setRanges in setFuncList) setRanges()
if (GG.getRangesList in setFuncList) getRangesList()
if (GG.searchNumber in setFuncList) searchNumber()
if (GG.getResultsCount in setFuncList) getResultsCount()
if (GG.getResults in setFuncList) getResults()
Expand All @@ -31,6 +32,7 @@ abstract class BaseGGHooker : YukiBaseHooker() {
abstract fun prompt()
abstract fun clearResults()
abstract fun setRanges()
abstract fun getRangesList()
abstract fun searchNumber()
abstract fun getResultsCount()
abstract fun getResults()
Expand Down
18 changes: 18 additions & 0 deletions app/src/main/java/me/hd/hookgg/hook/hooker/agg333/AGG333Hooker.kt
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,24 @@ object AGG333Hooker : BaseGGHooker() {
}
}

override fun getRangesList() {
"android.ext.function.getRangesList".toClassOrNull()?.apply {
method {
name = "invoke2"
paramCount = 1
}.ignored().hook {
before {
val varArgs = args(0).any()
val filter = varArgs.optjstring(1, "")
appContext?.dataChannel(BuildConfig.APPLICATION_ID)?.put(
"log",
"gg.getRangesList($filter)"
)
}
}.ignoredAllFailure()
}
}

override fun searchNumber() {
"android.ext.function.searchNumber".toClassOrNull()?.apply {
method {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,24 @@ object ELGG114Hooker : BaseGGHooker() {
}
}

override fun getRangesList() {
"android.ext.ۧۧۡۦ".toClassOrNull()?.apply {
method {
name = "b"
paramCount = 1
}.ignored().hook {
before {
val varArgs = args(0).any()
val filter = varArgs.optjstring(1, "")
appContext?.dataChannel(BuildConfig.APPLICATION_ID)?.put(
"log",
"gg.getRangesList($filter)"
)
}
}.ignoredAllFailure()
}
}

override fun searchNumber() {
"android.ext.ۣۣۧۧ".toClassOrNull()?.apply {
method {
Expand Down
18 changes: 18 additions & 0 deletions app/src/main/java/me/hd/hookgg/hook/hooker/gg1011/GG1011Hooker.kt
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,24 @@ object GG1011Hooker : BaseGGHooker() {
}
}

override fun getRangesList() {
"android.ext.Script\$getRangesList".toClassOrNull()?.apply {
method {
name = "b"
paramCount = 1
}.ignored().hook {
before {
val varArgs = args(0).any()
val filter = varArgs.optjstring(1, "")
appContext?.dataChannel(BuildConfig.APPLICATION_ID)?.put(
"log",
"gg.getRangesList($filter)"
)
}
}.ignoredAllFailure()
}
}

override fun searchNumber() {
"android.ext.Script\$searchNumber".toClassOrNull()?.apply {
method {
Expand Down
22 changes: 20 additions & 2 deletions app/src/main/java/me/hd/hookgg/hook/hooker/gg960/GG960Hooker.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import me.hd.hookgg.BuildConfig
import me.hd.hookgg.hook.base.BaseGGHooker
import me.hd.hookgg.hook.hooker.gg960.GG960VarArgs.arg
import me.hd.hookgg.hook.hooker.gg960.GG960VarArgs.checkint
import me.hd.hookgg.hook.hooker.gg960.GG960VarArgs.optboolean
import me.hd.hookgg.hook.hooker.gg960.GG960VarArgs.optjstring
import me.hd.hookgg.hook.hooker.gg960.GG960VarArgs.checkjstring
import me.hd.hookgg.hook.hooker.gg960.GG960VarArgs.checktable
import me.hd.hookgg.hook.hooker.gg960.GG960VarArgs.optboolean
import me.hd.hookgg.hook.hooker.gg960.GG960VarArgs.optint
import me.hd.hookgg.hook.hooker.gg960.GG960VarArgs.optjstring
import me.hd.hookgg.hook.hooker.gg960.GG960VarArgs.optlong
import me.hd.hookgg.hook.hooker.gg960.GG960VarArgs.optstring
import me.hd.hookgg.hook.hooker.gg960.GG960VarArgs.opttable
Expand Down Expand Up @@ -150,6 +150,24 @@ object GG960Hooker : BaseGGHooker() {
}
}

override fun getRangesList() {
"android.ext.Script\$getRangesList".toClassOrNull()?.apply {
method {
name = "invoke2"
paramCount = 1
}.ignored().hook {
before {
val varArgs = args(0).any()
val filter = varArgs.optjstring(1, "")
appContext?.dataChannel(BuildConfig.APPLICATION_ID)?.put(
"log",
"gg.getRangesList($filter)"
)
}
}.ignoredAllFailure()
}
}

override fun searchNumber() {
"android.ext.Script\$searchNumber".toClassOrNull()?.apply {
method {
Expand Down
18 changes: 18 additions & 0 deletions app/src/main/java/me/hd/hookgg/hook/hooker/gg961/GG961Hooker.kt
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,24 @@ object GG961Hooker : BaseGGHooker() {
}
}

override fun getRangesList() {
"android.ext.Script\$getRangesList".toClassOrNull()?.apply {
method {
name = "b"
paramCount = 1
}.ignored().hook {
before {
val varArgs = args(0).any()
val filter = varArgs.optjstring(1, "")
appContext?.dataChannel(BuildConfig.APPLICATION_ID)?.put(
"log",
"gg.getRangesList($filter)"
)
}
}.ignoredAllFailure()
}
}

override fun searchNumber() {
"android.ext.Script\$searchNumber".toClassOrNull()?.apply {
method {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,24 @@ object RLGG2092Hooker : BaseGGHooker() {
}
}

override fun getRangesList() {
"android.ext.͒".toClassOrNull()?.apply {
method {
name = "̢"
paramCount = 1
}.ignored().hook {
before {
val varArgs = args(0).any()
val filter = varArgs.optjstring(1, "")
appContext?.dataChannel(BuildConfig.APPLICATION_ID)?.put(
"log",
"gg.getRangesList($filter)"
)
}
}.ignoredAllFailure()
}
}

override fun searchNumber() {
"android.ext.ԯ".toClassOrNull()?.apply {
method {
Expand Down
41 changes: 14 additions & 27 deletions app/src/main/java/me/hd/hookgg/ui/fragment/nav/LogPageFragment.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
package me.hd.hookgg.ui.fragment.nav

import android.net.Uri
import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem
import androidx.activity.result.contract.ActivityResultContracts
import androidx.core.view.MenuHost
import androidx.core.view.MenuProvider
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.ViewModel
import androidx.recyclerview.widget.LinearLayoutManager
import com.highcapable.yukihookapi.YukiHookAPI
Expand Down Expand Up @@ -47,33 +41,26 @@ class LogPageFragment : BaseFragment<FragmentLogPageBinding, ViewModel>(
if (YukiHookAPI.Status.isModuleActive) {
binding.logPageToolbar.subtitle = getString(R.string.module_active)
}
initMenu()
initMenu(binding)
initAdapter(binding)
}

private fun initMenu() {
val menuHost: MenuHost = requireActivity()
menuHost.addMenuProvider(object : MenuProvider {
override fun onCreateMenu(menu: Menu, menuInflater: MenuInflater) {
menuInflater.inflate(R.menu.log_tab_menu, menu)
}

override fun onMenuItemSelected(menuItem: MenuItem): Boolean {
return when (menuItem.itemId) {
R.id.tab_save -> {
saveLogsLauncher.launch("${BuildConfig.TAG}_${LocalDateTime.now()}.lua")
true
}

R.id.tab_clear -> {
logAdapter.clearLog()
true
}
private fun initMenu(binding: FragmentLogPageBinding) {
binding.logPageToolbar.setOnMenuItemClickListener {
when (it.itemId) {
R.id.tab_save -> {
saveLogsLauncher.launch("${BuildConfig.TAG}_${LocalDateTime.now()}.lua")
true
}

else -> false
R.id.tab_clear -> {
logAdapter.clearLog()
true
}

else -> false
}
}, viewLifecycleOwner, Lifecycle.State.RESUMED)
}
}

private fun initAdapter(binding: FragmentLogPageBinding) {
Expand Down

0 comments on commit c76a650

Please sign in to comment.