Skip to content

Commit fdcaaee

Browse files
committed
refactor: ImGui EGL renderer + JNI data bridge + IME
Replace custom GLES ImGui with official imgui_impl_opengl3 + imgui_impl_android backends. Add three-layer JNI data bridge (Java -> C -> C#) with string-keyed DataSlot routing. Implement one-shot Android IME via hidden EditText with WantTextInput-driven keyboard control. New: - ImGuiRender.cs: EGL rendering, touch hook, keyboard IME - ImGuiImplAndroid.cs: official Android backend binding - JniHelperNative.cs / JniWrapper.cs: JNI P/Invoke and RAII wrappers - AndroidIME.cs: IME show/hide via JavaClass vtable - DL.cs: dlopen P/Invoke for dynamic linking - MotionInputProvider.cs / MotionEventHook.cs: touch input - jni_helper.c/h: JNI helpers + DataSlot bridge - ModManagerUtils.java: hidden EditText IME + native data bridge - cimgui_backends.patch: add Android/OpenGL backends to cimgui build - README.md Changed: - Rename monodroid-coreclr.c -> mono_droid_coreclr.c - Rename jnihelper.c/h -> jni_helper.c/h - CMakeLists.txt: cimgui patch auto-apply, source renames - UnityResolve.cs: expanded IL2CPP/Mono reflection - Mono.cs: restructured loader entry - .gitignore: add build outputs Removed: - ImGuiGLES.cs: replaced by official backends - ModManagerUI.cs: replaced by ImGuiRender - build-project.sh: no longer needed
1 parent e2fa446 commit fdcaaee

33 files changed

Lines changed: 4409 additions & 530 deletions

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ project.lock.json
4343

4444
# Unity test project (exclude entire dir)
4545
TestAndroidProject/
46+
TestAndroidProject2/
4647

4748
# Runtime data (mods, etc — user-managed)
4849
Runtime/

‎Android/library/build.gradle‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ android {
88
ndkVersion "27.2.12479018"
99

1010
defaultConfig {
11-
minSdk 21
11+
minSdk 26
1212
targetSdk 35
1313

1414
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

‎Android/library/src/main/cpp/CMakeLists.txt‎

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,17 @@ else()
1818
add_compile_options(-O2 -DNDEBUG)
1919
endif()
2020

21+
add_compile_options(-Wno-deprecated-declarations)
22+
2123
# ---- Source files ----
2224
set(MODLOADER_SOURCES
2325
core/dobby_hook.cpp
2426
core/unity_resolve.cpp
27+
core/jni_helper.c
2528
)
2629

2730
set(MONODROID_SOURCES
28-
core/monodroid-coreclr.c
31+
core/mono_droid_coreclr.c
2932
)
3033

3134
# ---- libmodloader.so (Dobby + UnityResolve + log_write) ----
@@ -58,8 +61,29 @@ set_target_properties(clrjit PROPERTIES
5861
# ---- cimgui: build from source as shared library ----
5962
set(IMGUI_STATIC OFF CACHE BOOL "" FORCE)
6063
set(IMGUI_FREETYPE OFF CACHE BOOL "" FORCE)
64+
65+
# Apply cimgui backends patch (--forward skips already-applied hunks)
66+
set(CIMGUI_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libs/cimgui)
67+
set(CIMGUI_PATCH ${CMAKE_CURRENT_SOURCE_DIR}/libs/cimgui_backends.patch)
68+
69+
if(EXISTS ${CIMGUI_PATCH})
70+
execute_process(
71+
COMMAND patch --forward -p1 -i ${CIMGUI_PATCH}
72+
WORKING_DIRECTORY ${CIMGUI_DIR}
73+
RESULT_VARIABLE PATCH_RESULT
74+
)
75+
if(PATCH_RESULT EQUAL 0)
76+
message(STATUS "cimgui backends patch applied")
77+
endif()
78+
endif()
79+
6180
add_subdirectory(libs/cimgui ${CMAKE_CURRENT_BINARY_DIR}/cimgui)
6281

82+
# Clean up stale patch marker (no longer used, dry-run detection replaced it)
83+
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_CLEAN_FILES
84+
"${CIMGUI_DIR}/.backends_patched"
85+
)
86+
6387
# ---- Include directories (modloader) ----
6488
target_include_directories(modloader
6589
PRIVATE
@@ -85,6 +109,7 @@ target_link_libraries(modloader
85109
${log-lib}
86110
dobby
87111
cimgui
112+
android
88113
)
89114

90115
# ---- Post-build: copy libcimgui.so alongside libmodloader.so ----

0 commit comments

Comments
 (0)