Skip to content

Commit 1bb6834

Browse files
committed
split launcher-fix into separate files
1 parent a677cab commit 1bb6834

5 files changed

Lines changed: 355 additions & 339 deletions

File tree

app/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ android {
7878
}
7979
externalNativeBuild {
8080
cmake {
81-
version = "3.25.0+"
81+
version = "4.0.0+"
8282
path = file("src/main/cpp/CMakeLists.txt")
8383
}
8484
}

app/src/main/cpp/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
cmake_minimum_required(VERSION 3.18.1)
1+
cmake_minimum_required(VERSION 4.1.2)
22

33
project(launcherfix)
44

5-
add_library(launcherfix SHARED launcher-fix.cpp)
5+
add_library(launcherfix SHARED launcher-fix.cpp patcher.cpp)
66

77
target_compile_features(launcherfix PUBLIC cxx_std_20)
88
set_target_properties(launcherfix PROPERTIES CXX_EXTENSIONS OFF)
99

1010
set_target_properties(launcherfix PROPERTIES
1111
INTERPROCEDURAL_OPTIMIZATION ON
12+
UNITY_BUILD ON
1213
C_VISIBILITY_PRESET hidden
1314
CXX_VISIBILITY_PRESET hidden
1415
)

app/src/main/cpp/base.h

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#pragma once
2+
3+
#include <string>
4+
#include <array>
5+
6+
#include <link.h>
7+
8+
class DataPaths {
9+
public:
10+
std::string original_data_path{};
11+
std::string data_path{};
12+
std::string load_symbols_from{};
13+
14+
bool patch_exceptions{};
15+
16+
static DataPaths& get_instance();
17+
18+
private:
19+
DataPaths() {}
20+
};
21+
22+
// this is every function that i thought would be relevant
23+
constexpr std::array remove_symbols{
24+
"__gxx_personality_v0",
25+
"__cxa_throw",
26+
"__cxa_rethrow",
27+
"__cxa_allocate_exception",
28+
"__cxa_end_catch",
29+
"__cxa_begin_catch",
30+
"__cxa_guard_abort",
31+
"__cxa_guard_acquire",
32+
"__cxa_guard_release",
33+
"__cxa_free_exception"
34+
35+
// android 10's libc doesn't have these symbols
36+
// and the ndk is forbidden from exporting them!! so keep it for old mods...
37+
// "_Unwind_RaiseException",
38+
// "_Unwind_Resume"
39+
};
40+
41+
FILE* fopen_hook(const char* pathname, const char* mode);
42+
int rename_hook(const char* old_path, const char* new_path);
43+
44+
int on_dl_iterate(dl_phdr_info* info, size_t size, void* data);

0 commit comments

Comments
 (0)