Skip to content

Commit e141b80

Browse files
author
StArray
committed
重构: cimgui 不再是子模块,移到共享 StArray.ModManager.CImGui/
- cimgui 解除子模块,源码纳入仓库管理 - imgui 子模块锁定 v1.91.6-docking,cimgui 锁定 1.91.6dock - Win/Android 用 mklink 软链接共享 cimgui 目录 - 平台自动选择后端: Win(dx9/11/12+ogl) Android(android+ogl+vk) 其他(ogl+vk) - 全局启用 FreeType (FetchContent git clone 静态编译) - native main.cpp 精简为仅 P/Invoke 导出 - dx11hook 对照 HookedImgui 参考实现 - 嵌入式字体移至 IImGuiRenderer.InitImGui() - 清理 kiero2 子模块 - 测试程序支持动态窗口大小
1 parent dc8a697 commit e141b80

345 files changed

Lines changed: 244119 additions & 9382 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/build.yml‎

Lines changed: 131 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -1,131 +1,131 @@
1-
name: Build
2-
3-
on:
4-
push:
5-
branches: [main, master]
6-
pull_request:
7-
branches: [main, master]
8-
workflow_dispatch:
9-
10-
jobs:
11-
# ──── Android AAR ────
12-
android:
13-
name: Android AAR
14-
runs-on: ubuntu-latest
15-
steps:
16-
- uses: actions/checkout@v4
17-
with:
18-
submodules: recursive
19-
20-
- name: Set up JDK 17
21-
uses: actions/setup-java@v4
22-
with:
23-
distribution: temurin
24-
java-version: 17
25-
26-
- name: Set up Android SDK
27-
uses: android-actions/setup-android@v3
28-
with:
29-
packages: 'platforms;android-35 ndk;27.2.12479018 build-tools;35.0.0'
30-
31-
- name: Setup Gradle
32-
uses: gradle/actions/setup-gradle@v3
33-
34-
- name: Build AAR
35-
working-directory: Android
36-
run: |
37-
chmod +x gradlew
38-
./gradlew :library:assembleRelease
39-
40-
- name: Upload AAR
41-
uses: actions/upload-artifact@v4
42-
with:
43-
name: library-release.aar
44-
path: Android/library/build/outputs/aar/library-release.aar
45-
46-
# ──── Windows Native + .NET DLL ────
47-
windows:
48-
name: Windows
49-
runs-on: windows-latest
50-
defaults:
51-
run:
52-
shell: bash
53-
steps:
54-
- uses: actions/checkout@v4
55-
with:
56-
submodules: recursive
57-
58-
- name: Set up MSYS2 (MinGW)
59-
uses: msys2/setup-msys2@v2
60-
with:
61-
msystem: mingw64
62-
update: true
63-
install: >-
64-
mingw-w64-x86_64-gcc
65-
mingw-w64-x86_64-cmake
66-
mingw-w64-x86_64-toolchain
67-
68-
- name: Set up .NET 10
69-
uses: actions/setup-dotnet@v4
70-
with:
71-
dotnet-version: '10.0.x'
72-
73-
- name: Build Native (CMake + MinGW)
74-
shell: msys2 {0}
75-
run: |
76-
cd StArray.ModManager.Windows/Native
77-
# Generate cimgui import lib from DLL
78-
gendef - ../dlls/cimgui.dll > cimgui.def
79-
dlltool -d cimgui.def -l libcimgui.a -D ../dlls/cimgui.dll
80-
cmake -B build -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release
81-
cmake --build build
82-
83-
- name: Build C#
84-
run: dotnet build StArray.ModManager.Windows/StArray.ModManager.Windows.csproj -c Release -p:BuildNativeDll=false
85-
86-
- name: Package
87-
run: |
88-
src="StArray.ModManager.Windows/bin/Release/net10.0"
89-
dst="artifacts"
90-
mkdir -p "$dst"
91-
cp -r "$src"/* "$dst/"
92-
rm -rf "$dst/runtimes"
93-
tar -czf windows-dll.tar.gz -C "$dst" .
94-
95-
- name: Upload
96-
uses: actions/upload-artifact@v4
97-
with:
98-
name: windows-dll
99-
path: windows-dll.tar.gz
100-
101-
# ──── Android .NET DLL ────
102-
android-dll:
103-
name: Android DLL
104-
runs-on: ubuntu-latest
105-
steps:
106-
- uses: actions/checkout@v4
107-
with:
108-
submodules: recursive
109-
110-
- name: Set up .NET 10
111-
uses: actions/setup-dotnet@v4
112-
with:
113-
dotnet-version: '10.0.x'
114-
115-
- name: Build Android
116-
run: dotnet build StArray.ModManager.Android/StArray.ModManager.Android.csproj -c Release
117-
118-
- name: Package output (exclude runtimes)
119-
run: |
120-
src="StArray.ModManager.Android/bin/Release/net10.0"
121-
dst="artifacts"
122-
mkdir -p "$dst"
123-
cp -r "$src"/* "$dst/"
124-
rm -rf "$dst/runtimes"
125-
cd "$dst" && zip -r ../android-dll.zip . && cd ..
126-
127-
- name: Upload Android DLL
128-
uses: actions/upload-artifact@v4
129-
with:
130-
name: android-dll.zip
131-
path: android-dll.zip
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
branches: [main, master]
8+
workflow_dispatch:
9+
10+
jobs:
11+
# ──── Android AAR ────
12+
android:
13+
name: Android AAR
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
submodules: recursive
19+
20+
- name: Set up JDK 17
21+
uses: actions/setup-java@v4
22+
with:
23+
distribution: temurin
24+
java-version: 17
25+
26+
- name: Set up Android SDK
27+
uses: android-actions/setup-android@v3
28+
with:
29+
packages: 'platforms;android-35 ndk;27.2.12479018 build-tools;35.0.0'
30+
31+
- name: Setup Gradle
32+
uses: gradle/actions/setup-gradle@v3
33+
34+
- name: Build AAR
35+
working-directory: Android
36+
run: |
37+
chmod +x gradlew
38+
./gradlew :library:assembleRelease
39+
40+
- name: Upload AAR
41+
uses: actions/upload-artifact@v4
42+
with:
43+
name: library-release.aar
44+
path: Android/library/build/outputs/aar/library-release.aar
45+
46+
# ──── Windows Native + .NET DLL ────
47+
windows:
48+
name: Windows
49+
runs-on: windows-latest
50+
defaults:
51+
run:
52+
shell: bash
53+
steps:
54+
- uses: actions/checkout@v4
55+
with:
56+
submodules: recursive
57+
58+
- name: Set up MSYS2 (MinGW)
59+
uses: msys2/setup-msys2@v2
60+
with:
61+
msystem: mingw64
62+
update: true
63+
install: >-
64+
mingw-w64-x86_64-gcc
65+
mingw-w64-x86_64-cmake
66+
mingw-w64-x86_64-toolchain
67+
68+
- name: Set up .NET 10
69+
uses: actions/setup-dotnet@v4
70+
with:
71+
dotnet-version: '10.0.x'
72+
73+
- name: Build Native (CMake + MinGW)
74+
shell: msys2 {0}
75+
run: |
76+
cd StArray.ModManager.Windows/Native
77+
# Generate cimgui import lib from DLL
78+
gendef - ../dlls/cimgui.dll > cimgui.def
79+
dlltool -d cimgui.def -l libcimgui.a -D ../dlls/cimgui.dll
80+
cmake -B build -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release
81+
cmake --build build
82+
83+
- name: Build C#
84+
run: dotnet build StArray.ModManager.Windows/StArray.ModManager.Windows.csproj -c Release -p:BuildNativeDll=false
85+
86+
- name: Package
87+
run: |
88+
src="StArray.ModManager.Windows/bin/Release/net10.0"
89+
dst="artifacts"
90+
mkdir -p "$dst"
91+
cp -r "$src"/* "$dst/"
92+
rm -rf "$dst/runtimes"
93+
tar -czf windows-dll.tar.gz -C "$dst" .
94+
95+
- name: Upload
96+
uses: actions/upload-artifact@v4
97+
with:
98+
name: windows-dll
99+
path: windows-dll.tar.gz
100+
101+
# ──── Android .NET DLL ────
102+
android-dll:
103+
name: Android DLL
104+
runs-on: ubuntu-latest
105+
steps:
106+
- uses: actions/checkout@v4
107+
with:
108+
submodules: recursive
109+
110+
- name: Set up .NET 10
111+
uses: actions/setup-dotnet@v4
112+
with:
113+
dotnet-version: '10.0.x'
114+
115+
- name: Build Android
116+
run: dotnet build StArray.ModManager.Android/StArray.ModManager.Android.csproj -c Release
117+
118+
- name: Package output (exclude runtimes)
119+
run: |
120+
src="StArray.ModManager.Android/bin/Release/net10.0"
121+
dst="artifacts"
122+
mkdir -p "$dst"
123+
cp -r "$src"/* "$dst/"
124+
rm -rf "$dst/runtimes"
125+
cd "$dst" && zip -r ../android-dll.zip . && cd ..
126+
127+
- name: Upload Android DLL
128+
uses: actions/upload-artifact@v4
129+
with:
130+
name: android-dll.zip
131+
path: android-dll.zip

‎.gitignore‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,5 @@ tests
6464

6565
# Logs
6666
*.log
67-
!*.slnx
67+
!*.slnx.backup/
68+
Android/library/src/main/cpp/CMakeFiles/

‎.gitmodules‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
[submodule "Android/library/src/main/cpp/libs/cimgui"]
2-
path = Android/library/src/main/cpp/libs/cimgui
3-
url = https://github.com/cimgui/cimgui.git
4-
[submodule "StArray.ModManager.Windows/Native/kiero2"]
5-
path = StArray.ModManager.Windows/Native/kiero2
6-
url = https://github.com/kirchesz/kiero2.git
71
[submodule "StArray.ModManager.Windows/Native/minhook"]
82
path = StArray.ModManager.Windows/Native/minhook
93
url = https://github.com/TsudaKageyu/minhook

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

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -62,34 +62,16 @@ set_target_properties(clrjit PROPERTIES
6262
set(IMGUI_STATIC OFF CACHE BOOL "" FORCE)
6363
set(IMGUI_FREETYPE OFF CACHE BOOL "" FORCE)
6464

65-
# Apply cimgui backends patch (--forward skips already-applied hunks)
6665
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-
80-
add_subdirectory(libs/cimgui ${CMAKE_CURRENT_BINARY_DIR}/cimgui)
81-
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-
)
66+
add_subdirectory(${CIMGUI_DIR} ${CMAKE_CURRENT_BINARY_DIR}/cimgui)
8667

8768
# ---- Include directories (modmanager) ----
8869
target_include_directories(modmanager
8970
PRIVATE
9071
${CMAKE_CURRENT_SOURCE_DIR}
9172
${CMAKE_CURRENT_SOURCE_DIR}/core
92-
${CMAKE_CURRENT_SOURCE_DIR}/libs/cimgui
73+
${CIMGUI_DIR}
74+
${CIMGUI_DIR}/imgui
9375
${CMAKE_CURRENT_SOURCE_DIR}/libs/dobby/include
9476
${CMAKE_CURRENT_SOURCE_DIR}/libs/unityresolve
9577
)

0 commit comments

Comments
 (0)