Skip to content

Commit

Permalink
迁移到Zygisk
Browse files Browse the repository at this point in the history
更新Dobby
  • Loading branch information
Perfare committed Feb 22, 2022
1 parent 1b93333 commit 1377730
Show file tree
Hide file tree
Showing 223 changed files with 3,111 additions and 2,642 deletions.
7 changes: 2 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,14 @@
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# Android operating system, and which are packaged with your app"s APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
# https://github.com/google/prefab/issues/122
# Remove this until AGP update prefab version
android.prefabVersion=1.1.3
29 changes: 4 additions & 25 deletions module.gradle
Original file line number Diff line number Diff line change
@@ -1,30 +1,9 @@
ext {
/*
This name will be used in the name of the so file ("lib${moduleLibraryName}.so").
*/
moduleLibraryName = "il2cppdumper"

/* Minimal supported Riru API version, used in the version check of riru.sh */
moduleMinRiruApiVersion = 24

/* The version name of minimal supported Riru, used in the version check of riru.sh */
moduleMinRiruVersionName = "v24.0.0"

/* Maximum supported Riru API version, used in the version check of riru.sh */
moduleRiruApiVersion = 26

/*
Magisk module ID
Since Magisk use it to distinguish different modules, you should never change it.
Note, the older version of the template uses '-' instead of '_', if your are upgrading from
the older version, please pay attention.
*/
magiskModuleId = "riru_il2cppdumper"

magiskModuleId = "zygisk_il2cppdumper"
moduleName = "Il2CppDumper"
moduleAuthor = "Perfare"
moduleDescription = "Il2CppDumper Riru version."
moduleVersion = "v26.0.0"
moduleVersionCode = 26
moduleDescription = "Il2CppDumper Zygisk version."
moduleVersion = "v1.0.0"
moduleVersionCode = 1
}
54 changes: 12 additions & 42 deletions module/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import org.apache.tools.ant.filters.FixCrLfFilter
import org.apache.tools.ant.filters.ReplaceTokens

import java.security.MessageDigest
import java.nio.file.Paths
import java.nio.file.Files

apply plugin: 'com.android.library'
apply from: file(rootProject.file('module.gradle'))
Expand All @@ -13,11 +13,7 @@ android {
targetSdkVersion rootProject.ext.targetSdkVersion
externalNativeBuild {
cmake {
arguments "-DMODULE_NAME:STRING=$moduleLibraryName",
"-DRIRU_MODULE_API_VERSION=$moduleRiruApiVersion",
"-DRIRU_MODULE_VERSION=$moduleVersionCode",
"-DRIRU_MODULE_VERSION_NAME:STRING=$moduleVersion",
"-DRIRU_MODULE_MIN_API_VERSION=$moduleMinRiruApiVersion"
arguments "-DMODULE_NAME:STRING=$moduleLibraryName"
}
}
}
Expand All @@ -27,7 +23,7 @@ android {
externalNativeBuild {
cmake {
path "src/main/cpp/CMakeLists.txt"
version "3.10.2"
version "3.18.1"
}
}
}
Expand All @@ -36,19 +32,6 @@ repositories {
mavenLocal()
}

dependencies {
// This is prefab aar which contains "riru.h"
// If you want to use older versions of AGP,
// you can copy this file from https://github.com/RikkaApps/Riru/blob/master/riru/src/main/cpp/include_riru/riru.h

// The default version of prefab in AGP has problem to process header only package,
// you may have to add "android.prefabVersion" in your gradle.properties.
// See https://github.com/google/prefab/issues/122

implementation 'dev.rikka.ndk:riru:26.0.0'
}


afterEvaluate {
android.libraryVariants.forEach { variant ->
def variantCapped = variant.name.capitalize()
Expand All @@ -64,18 +47,7 @@ afterEvaluate {

into magiskDir
from(templatePath) {
exclude 'riru.sh', 'module.prop'
}
from(templatePath) {
include 'riru.sh'
filter(ReplaceTokens.class, tokens: [
"RIRU_MODULE_LIB_NAME" : moduleLibraryName,
"RIRU_MODULE_API_VERSION" : moduleRiruApiVersion.toString(),
"RIRU_MODULE_MIN_API_VERSION" : moduleMinRiruApiVersion.toString(),
"RIRU_MODULE_MIN_RIRU_VERSION_NAME": moduleMinRiruVersionName,
])
filter(FixCrLfFilter.class,
eol: FixCrLfFilter.CrLf.newInstance("lf"))
exclude 'module.prop'
}
from(templatePath) {
include 'module.prop'
Expand All @@ -94,16 +66,14 @@ afterEvaluate {
into 'lib'
}
doLast {
fileTree("$magiskDir").visit { f ->
if (f.directory) return
if (f.file.name == '.gitattributes') return

def md = MessageDigest.getInstance("SHA-256")
f.file.eachByte 4096, { bytes, size ->
md.update(bytes, 0, size)
}
file(f.file.path + ".sha256sum").text = md.digest().encodeHex()
file("$magiskDir/zygisk").mkdir()
fileTree("$magiskDir/lib").visit { f ->
if (!f.directory) return
def srcPath = Paths.get("${f.file.absolutePath}/lib${moduleLibraryName}.so")
def dstPath = Paths.get("$magiskDir/zygisk/${f.path}.so")
Files.move(srcPath, dstPath)
}
new File("$magiskDir/lib").deleteDir()
}
}

Expand Down
2 changes: 1 addition & 1 deletion module/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<manifest package="riru.template" />
<manifest package="zygisk.il2cppdumper" />
17 changes: 5 additions & 12 deletions module/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.4.1)
cmake_minimum_required(VERSION 3.18.1)

if (NOT DEFINED MODULE_NAME)
message(FATAL_ERROR "MODULE_NAME is not set")
Expand All @@ -13,16 +13,13 @@ include_directories(
macro(SET_OPTION option value)
set(${option} ${value} CACHE INTERNAL "" FORCE)
endmacro()
SET_OPTION(DOBBY_DEBUG OFF)
SET_OPTION(DOBBY_GENERATE_SHARED OFF)
add_subdirectory(${DobbyHome} dobby)

add_definitions(-DRIRU_MODULE)

configure_file(template/config.cpp config.cpp)

message("Build type: ${CMAKE_BUILD_TYPE}")

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 20)

set(LINKER_FLAGS "-ffixed-x18 -Wl,--hash-style=both")
set(C_FLAGS "-Werror=format -fdata-sections -ffunction-sections")
Expand All @@ -41,12 +38,8 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${C_FLAGS} ${CXX_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${LINKER_FLAGS}")

find_package(riru REQUIRED CONFIG)

include_directories(include)

add_library(${MODULE_NAME} SHARED main.cpp ${CMAKE_CURRENT_BINARY_DIR}/config.cpp hook.cpp il2cpp_dump.cpp)
target_link_libraries(${MODULE_NAME} log riru::riru dobby)
add_library(${MODULE_NAME} SHARED main.cpp hook.cpp il2cpp_dump.cpp)
target_link_libraries(${MODULE_NAME} log dobby)

if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
add_custom_command(TARGET ${MODULE_NAME} POST_BUILD
Expand Down
8 changes: 5 additions & 3 deletions module/src/main/cpp/Dobby/.clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ TabWidth: 2
UseTab: Never
ColumnLimit: 120

FixNamespaceComments: true

# default is false
AlignConsecutiveMacros: true
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
#AlignConsecutiveMacros: true
#AlignConsecutiveAssignments: true
#AlignConsecutiveDeclarations: true

# default is true
ReflowComments: false
Expand Down
7 changes: 6 additions & 1 deletion module/src/main/cpp/Dobby/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,9 @@ xcuserdata/
# Executables
*.exe
*.out
*.app
*.app

# Prefab
/prefab/**/*.a
/prefab/**/*.h
/AndroidManifest.xml
Loading

0 comments on commit 1377730

Please sign in to comment.