Bundle winpthread runtime with build outputs

Signed-off-by: Sean Du <do4suki@gmail.com>
This commit is contained in:
2026-06-27 21:04:38 +08:00
parent cce87868ed
commit 74cb184c03
3 changed files with 18 additions and 3 deletions
+8
View File
@@ -88,3 +88,11 @@ if(CMAKE_BUILD_TYPE STREQUAL "Release")
"-s" "-s"
) )
endif() endif()
if(MINGW)
add_custom_command(TARGET version POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
/usr/x86_64-w64-mingw32/bin/libwinpthread-1.dll
$<TARGET_FILE_DIR:version>/libwinpthread-1.dll
)
endif()
+7 -2
View File
@@ -7,6 +7,7 @@ BUILD ?= release
CC := x86_64-w64-mingw32-gcc CC := x86_64-w64-mingw32-gcc
CXX := x86_64-w64-mingw32-g++ CXX := x86_64-w64-mingw32-g++
WINDRES := x86_64-w64-mingw32-windres WINDRES := x86_64-w64-mingw32-windres
WINPTHREAD_DLL := /usr/x86_64-w64-mingw32/bin/libwinpthread-1.dll
INCLUDES := -Isrc -Ideps/minhook/include -Ideps/minhook/src -Ideps/minhook/src/hde INCLUDES := -Isrc -Ideps/minhook/include -Ideps/minhook/src -Ideps/minhook/src/hde
INCLUDES += -Ideps/rapidjson/include INCLUDES += -Ideps/rapidjson/include
@@ -58,8 +59,8 @@ OBJS := $(C_OBJS) $(CXX_OBJS) $(RC_OBJS)
.PHONY: all release debug clean .PHONY: all release debug clean
all: $(TARGET) $(HELPER_TARGET) all: $(TARGET) $(HELPER_TARGET) $(BUILD_DIR)/libwinpthread-1.dll
release: $(TARGET) $(HELPER_TARGET) release: $(TARGET) $(HELPER_TARGET) $(BUILD_DIR)/libwinpthread-1.dll
debug: debug:
$(MAKE) BUILD=debug $(MAKE) BUILD=debug
@@ -71,6 +72,10 @@ $(HELPER_TARGET): $(HELPER_CXX_OBJS) $(HELPER_RC_OBJS)
@mkdir -p $(dir $@) @mkdir -p $(dir $@)
$(CXX) $(HELPER_LDFLAGS) -o $@ $(HELPER_CXX_OBJS) $(HELPER_RC_OBJS) $(HELPER_LDLIBS) $(CXX) $(HELPER_LDFLAGS) -o $@ $(HELPER_CXX_OBJS) $(HELPER_RC_OBJS) $(HELPER_LDLIBS)
$(BUILD_DIR)/libwinpthread-1.dll:
@mkdir -p $(dir $@)
cp "$(WINPTHREAD_DLL)" "$@"
$(OBJ_DIR)/%.o: %.c $(OBJ_DIR)/%.o: %.c
@mkdir -p $(dir $@) @mkdir -p $(dir $@)
$(CC) $(CFLAGS) -c $< -o $@ $(CC) $(CFLAGS) -c $< -o $@
+3 -1
View File
@@ -38,6 +38,7 @@ make
**输出** **输出**
- `build/version.dll` - `build/version.dll`
- `build/cgss-borderless-helper.exe` - `build/cgss-borderless-helper.exe`
- `build/libwinpthread-1.dll`
**config.json** **config.json**
```json ```json
@@ -56,7 +57,7 @@ make
- `launch_borderless_helper`:是否自动启动 `cgss-borderless-helper.exe`。默认 `true` - `launch_borderless_helper`:是否自动启动 `cgss-borderless-helper.exe`。默认 `true`
**使用方法** **使用方法**
1.`build/version.dll``build/cgss-borderless-helper.exe` 一起复制到 `imascgstage.exe` 同目录 1.`build/version.dll``build/cgss-borderless-helper.exe``build/libwinpthread-1.dll` 一起复制到 `imascgstage.exe` 同目录
2. 如需覆盖地址,在同目录放置 `config.json` 2. 如需覆盖地址,在同目录放置 `config.json`
3. 启动游戏 3. 启动游戏
4. 进入游戏后按 `F11` 切换无边框全屏 4. 进入游戏后按 `F11` 切换无边框全屏
@@ -66,6 +67,7 @@ make
- `cgss-borderless-helper.exe` 现在只负责外部窗口 borderless 行为,不再修改 Unity 内部 `Screen.SetResolution` - `cgss-borderless-helper.exe` 现在只负责外部窗口 borderless 行为,不再修改 Unity 内部 `Screen.SetResolution`
- 这样更接近 Borderless Gaming 的工作方式,也能减少退出时的干扰。 - 这样更接近 Borderless Gaming 的工作方式,也能减少退出时的干扰。
- `version.dll` 只在 `imascgstage.exe` 主进程中继续启动 hook 和 helper;被其他进程间接加载时会跳过。 - `version.dll` 只在 `imascgstage.exe` 主进程中继续启动 hook 和 helper;被其他进程间接加载时会跳过。
- 不要只单独分发 `version.dll`。当前构建依赖 `libwinpthread-1.dll`,如果目标机器缺少它,Windows 会在进入代理代码前直接拒绝加载,此时通常表现为游戏无法启动,且不会生成任何日志。
**致谢** **致谢**
- 本项目的 `version.dll` 代理注入思路与运行时 IL2CPP hook 方向,受 `gkms-localify-dmm` 项目启发。 - 本项目的 `version.dll` 代理注入思路与运行时 IL2CPP hook 方向,受 `gkms-localify-dmm` 项目启发。