build hook (#1142)

This commit is contained in:
test123456654321 2024-11-06 23:45:31 +08:00 committed by GitHub
parent fd328156b7
commit bfcc112ddd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 240 additions and 164 deletions

View File

@ -7,82 +7,6 @@ on:
paths: [ '.github/workflows/build.yml','py/**']
jobs:
hook:
runs-on: windows-latest
strategy:
matrix:
bits: [32, 64]
permissions:
id-token: write
attestations: write
contents: write
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: GuillaumeFalourd/setup-windows10-sdk-action@v2
with:
sdk-version: 22621
- run: python cpp/LunaHook/build.py build English ${{matrix.bits}}
- uses: actions/upload-artifact@v4
with:
name: hook_${{matrix.bits}}
path: cpp/LunaHook/builds/Release_English
pyrt:
runs-on: windows-latest
strategy:
matrix:
architecture: [x86, x64]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.7.9'
architecture: ${{ matrix.architecture }}
- run: python py/build.py pyrt ${{ matrix.architecture }} 3.7.9
- uses: actions/upload-artifact@v4
with:
name: pyrt_${{ matrix.architecture }}
path: py/pyrt
build_cpp:
runs-on: windows-latest
strategy:
matrix:
architecture: [x86, x64]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: GuillaumeFalourd/setup-windows10-sdk-action@v2
with:
sdk-version: 22621
- run: python py/build.py cpp ${{ matrix.architecture }}
- uses: actions/upload-artifact@v4
with:
name: cpp_${{ matrix.architecture }}
path: cpp/builds
release:
runs-on: windows-latest
needs: [pyrt,build_cpp,hook]
strategy:
matrix:
include:
- architecture: x86
fname: LunaTranslator_x86
- architecture: x64
fname: LunaTranslator
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: build
- run: python py/build.py merge ${{ matrix.architecture }}
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.fname }}
path: py/build/${{matrix.fname}}.zip
buildluna:
uses: ./.github/workflows/buildluna.yml

83
.github/workflows/buildluna.yml vendored Normal file
View File

@ -0,0 +1,83 @@
name: buildluna
on:
workflow_call:
jobs:
hook:
runs-on: windows-latest
strategy:
matrix:
bits: [32, 64]
permissions:
id-token: write
attestations: write
contents: write
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: GuillaumeFalourd/setup-windows10-sdk-action@v2
with:
sdk-version: 22621
- run: python cpp/LunaHook/build.py build English ${{matrix.bits}}
- uses: actions/upload-artifact@v4
with:
name: hook_${{matrix.bits}}
path: cpp/LunaHook/builds/Release_English
pyrt:
runs-on: windows-latest
strategy:
matrix:
architecture: [x86, x64]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.7.9'
architecture: ${{ matrix.architecture }}
- run: python py/build.py pyrt ${{ matrix.architecture }} 3.7.9
- uses: actions/upload-artifact@v4
with:
name: pyrt_${{ matrix.architecture }}
path: py/pyrt
build_cpp:
runs-on: windows-latest
strategy:
matrix:
architecture: [x86, x64]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: GuillaumeFalourd/setup-windows10-sdk-action@v2
with:
sdk-version: 22621
- run: python py/build.py cpp ${{ matrix.architecture }}
- uses: actions/upload-artifact@v4
with:
name: cpp_${{ matrix.architecture }}
path: cpp/builds
merge:
runs-on: windows-latest
needs: [pyrt,build_cpp,hook]
strategy:
matrix:
include:
- architecture: x86
fname: LunaTranslator_x86
- architecture: x64
fname: LunaTranslator
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: build
- run: python py/build.py merge ${{ matrix.architecture }}
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.fname }}
path: py/build/${{matrix.fname}}.zip

123
.github/workflows/buildlunahook.yml vendored Normal file
View File

@ -0,0 +1,123 @@
name: buildlunahook
on:
push:
paths: [ '.github/workflows/buildlunahook.yml','cpp/LunaHook/**']
pull_request:
paths: [ '.github/workflows/buildlunahook.yml','cpp/LunaHook/**']
jobs:
build_xp:
runs-on: windows-2019
strategy:
matrix:
language: [Chinese,English,Russian,TradChinese]
permissions:
id-token: write
attestations: write
contents: write
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: GuillaumeFalourd/setup-windows10-sdk-action@v2
with:
sdk-version: 22621
- run: python cpp/LunaHook/build.py build ${{ matrix.language }} winxp
- run: python cpp/LunaHook/scripts/pack.py
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.language }}_winxp
path: cpp/LunaHook/builds/Release_${{ matrix.language }}_winxp.zip
- uses: softprops/action-gh-release@v2
with:
tag_name: LunaHook
files: cpp/LunaHook/builds/Release_${{ matrix.language }}_winxp.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build_plugin:
runs-on: windows-latest
strategy:
matrix:
include:
- cmd: plg32
qtarch: win32_msvc2019
target: plugin32
- cmd: plg64
qtarch: win64_msvc2019_64
target: plugin64
permissions:
id-token: write
attestations: write
contents: write
steps:
- uses: actions/checkout@v4
- uses: GuillaumeFalourd/setup-windows10-sdk-action@v2
with:
sdk-version: 22621
- uses: jurplel/install-qt-action@v3.3.0
with:
version: 5.15.2
host: windows
target: desktop
arch: ${{ matrix.qtarch }}
dir: ${{ runner.temp }}
setup-python: true
- run: python cpp/LunaHook/build.py ${{ matrix.cmd }}
- run: python cpp/LunaHook/scripts/pack.py
# - name: Generate attestation for artifact
# uses: actions/attest-build-provenance@v1
# with:
# subject-path: builds/${{ matrix.target }}.zip
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: cpp/LunaHook/builds/${{ matrix.target }}.zip
- uses: softprops/action-gh-release@v2
with:
tag_name: LunaHook
files: cpp/LunaHook/builds/${{ matrix.target }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build_x:
runs-on: windows-latest
strategy:
matrix:
language: [Chinese,English,Russian,TradChinese]
bits: [32, 64]
permissions:
id-token: write
attestations: write
contents: write
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: GuillaumeFalourd/setup-windows10-sdk-action@v2
with:
sdk-version: 22621
- run: python cpp/LunaHook/build.py build ${{ matrix.language }} ${{matrix.bits}}
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.language }}_${{matrix.bits}}
path: cpp/LunaHook/builds
build:
runs-on: windows-latest
needs: [build_x]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: cpp/LunaHook/build
- run: python cpp/LunaHook/build.py merge
- uses: softprops/action-gh-release@v2
with:
tag_name: LunaHook
files: cpp/LunaHook/builds/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -4,6 +4,8 @@ on:
workflow_dispatch:
jobs:
buildluna:
uses: ./.github/workflows/buildluna.yml
loadversion:
runs-on: windows-latest
outputs:
@ -12,89 +14,19 @@ jobs:
- uses: actions/checkout@v4
- id: loadversion
run: python py/build.py loadversion | Out-File -FilePath $Env:GITHUB_OUTPUT -Encoding utf8 -Append
hook:
runs-on: windows-latest
strategy:
matrix:
bits: [32, 64]
permissions:
id-token: write
attestations: write
contents: write
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: GuillaumeFalourd/setup-windows10-sdk-action@v2
with:
sdk-version: 22621
- run: python cpp/LunaHook/build.py build English ${{matrix.bits}}
- uses: actions/upload-artifact@v4
with:
name: hook_${{matrix.bits}}
path: cpp/LunaHook/builds/Release_English
pyrt:
runs-on: windows-latest
strategy:
matrix:
architecture: [x86, x64]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.7.9'
architecture: ${{ matrix.architecture }}
- run: python py/build.py pyrt ${{ matrix.architecture }} 3.7.9
- uses: actions/upload-artifact@v4
with:
name: pyrt_${{ matrix.architecture }}
path: py/pyrt
build_cpp:
runs-on: windows-latest
strategy:
matrix:
architecture: [x86, x64]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: GuillaumeFalourd/setup-windows10-sdk-action@v2
with:
sdk-version: 22621
- run: python py/build.py cpp ${{ matrix.architecture }}
- uses: actions/upload-artifact@v4
with:
name: cpp_${{ matrix.architecture }}
path: cpp/builds
release:
runs-on: windows-latest
needs: [pyrt,build_cpp,loadversion,hook]
strategy:
matrix:
include:
- architecture: x86
fname: LunaTranslator_x86
- architecture: x64
fname: LunaTranslator
needs: [buildluna,loadversion]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: build
- run: python py/build.py merge ${{ matrix.architecture }}
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.fname }}
path: py/build/${{matrix.fname}}.zip
- uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.loadversion.outputs.version }}
files: |
py/build/${{matrix.fname}}.zip
build/LunaTranslator_x86/LunaTranslator_x86.zip
build/LunaTranslator/LunaTranslator.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -32,6 +32,7 @@ endif()
if(NOT DEFINED LANGUAGE)
set(LANGUAGE English)
endif()
option(BUILD_CORE "BUILD_CORE" ON)
option(BUILD_PLUGIN "BUILD_PLUGIN" OFF)
option(BUILD_GUI "BUILD_GUI" OFF)
option(BUILD_CLI "BUILD_CLI" OFF)
@ -39,8 +40,10 @@ option(WINXP "WINXP" OFF)
if(WINXP)
set(WINXPAPP "_winxp")
set(YY_Thunks_for_WinXP ${CMAKE_CURRENT_LIST_DIR}/YY-Thunks/objs/X86/YY_Thunks_for_WinXP.obj)
else()
set(WINXPAPP "")
set(YY_Thunks_for_WinXP)
endif()
add_definitions(-DLANGUAGE=${LANGUAGE})
@ -54,12 +57,17 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY $<1:${binary_out_putpath}>)
include_directories(.)
option(USE_VCLTL "USE_VCLTL" OFF)
option(IS_LUNAHOOK "IS_LUNAHOOK" ON)
if(BUILD_CORE)
include(${CMAKE_SOURCE_DIR}/../libs/libs.cmake)
endif()
include_directories(include)
include(${CMAKE_SOURCE_DIR}/../version.cmake)
add_subdirectory(include)
if(BUILD_CORE)
add_subdirectory(LunaHook)
endif()
add_subdirectory(LunaHost)

View File

@ -30,6 +30,4 @@ set_target_properties(LunaHostCLI PROPERTIES OUTPUT_NAME "LunaHostCLI${bitappend
target_link_libraries(LunaHostCLI pch host ${YY_Thunks_for_WinXP})
endif()
if(BUILD_GUI)
add_subdirectory(GUI)
endif()
add_subdirectory(GUI)

View File

@ -1,9 +1,10 @@
if(BUILD_GUI)
add_executable(LunaHost WIN32 confighelper.cpp controls.cpp main.cpp processlistwindow.cpp LunaHost.cpp window.cpp luna.rc pluginmanager.cpp Plugin/extensionimpl.cpp Plugin/copyclipboard.cpp QtLoader_inline.cpp app.manifest ${versioninfohost})
target_precompile_headers(LunaHost REUSE_FROM pch)
set_target_properties(LunaHost PROPERTIES OUTPUT_NAME "LunaHost${bitappendix}")
target_link_libraries(LunaHost comctl32 winhttp version pch host ${YY_Thunks_for_WinXP} nlohmann)
endif()
if(BUILD_PLUGIN)
add_subdirectory(Plugin)

View File

@ -14,6 +14,7 @@ if len(sys.argv) and sys.argv[1] == "loadversion":
print("version=" + versionstring)
exit()
if len(sys.argv) and sys.argv[1] == "merge":
os.chdir(rootDir)
os.mkdir("../build")
os.mkdir("builds")
language = ["Chinese", "English", "Russian", "TradChinese"]
@ -56,14 +57,14 @@ def build_langx(lang, bit):
if bit == "32":
ff.write(
rf"""
cmake -DLANGUAGE={lang} ../CMakeLists.txt -G "Visual Studio 17 2022" -A win32 -T host=x86 -B ../build/x86_{lang}
cmake -DBUILD_PLUGIN=OFF -DWINXP=OFF -DLANGUAGE={lang} -DBUILD_GUI=ON -DBUILD_CLI=ON ../CMakeLists.txt -G "Visual Studio 17 2022" -A win32 -T host=x86 -B ../build/x86_{lang}
cmake --build ../build/x86_{lang} --config Release --target ALL_BUILD -j 14
"""
)
elif bit == "64":
ff.write(
rf"""
cmake -DLANGUAGE={lang} ../CMakeLists.txt -G "Visual Studio 17 2022" -A x64 -T host=x64 -B ../build/x64_{lang}
cmake -DBUILD_PLUGIN=OFF -DWINXP=OFF -DLANGUAGE={lang} -DBUILD_GUI=ON -DBUILD_CLI=ON ../CMakeLists.txt -G "Visual Studio 17 2022" -A x64 -T host=x64 -B ../build/x64_{lang}
cmake --build ../build/x64_{lang} --config Release --target ALL_BUILD -j 14
"""
)
@ -71,11 +72,17 @@ cmake --build ../build/x64_{lang} --config Release --target ALL_BUILD -j 14
def build_langx_xp(lang):
url = "https://github.com/Chuyu-Team/YY-Thunks/releases/download/v1.0.7/YY-Thunks-1.0.7-Binary.zip"
target = "YY-Thunks/objs/X86/YY_Thunks_for_WinXP.obj"
if os.path.exists(target) == False:
os.system(rf"curl -SLo YY-Thunks-1.0.7-Binary.zip " + url)
os.system(rf'7z x -y YY-Thunks-1.0.7-Binary.zip -o../YY-Thunks')
os.system('dir')
with open("do.bat", "w") as ff:
ff.write(
rf"""
cmake -DBUILD_PLUGIN=OFF -DWINXP=1 -DLANGUAGE={lang} ../CMakeLists.txt -G "Visual Studio 16 2019" -A win32 -T v141_xp -B ../build/x86_{lang}_xp
cmake -DBUILD_PLUGIN=OFF -DWINXP=ON -DLANGUAGE={lang} -DBUILD_GUI=ON -DBUILD_CLI=ON ../CMakeLists.txt -G "Visual Studio 16 2019" -A win32 -T v141_xp -B ../build/x86_{lang}_xp
cmake --build ../build/x86_{lang}_xp --config Release --target ALL_BUILD -j 14
call dobuildxp.bat
"""

View File

@ -1,2 +1,2 @@
cmake -DBUILD_CORE=OFF -DUSESYSQTPATH=1 -DPLUGIN=1 ../CMakeLists.txt -G "Visual Studio 17 2022" -A win32 -T host=x86 -B ../build/plugin32
cmake -DBUILD_CORE=OFF -DUSESYSQTPATH=1 -DBUILD_PLUGIN=ON ../CMakeLists.txt -G "Visual Studio 17 2022" -A win32 -T host=x86 -B ../build/plugin32
cmake --build ../build/plugin32 --config Release --target ALL_BUILD -j 14

View File

@ -1,2 +1,2 @@
cmake -DBUILD_CORE=OFF -DPLUGIN=1 ../CMakeLists.txt -G "Visual Studio 17 2022" -A x64 -T host=x64 -B ../build/plugin64
cmake -DBUILD_CORE=OFF -DUSESYSQTPATH=1 -DBUILD_PLUGIN=ON ../CMakeLists.txt -G "Visual Studio 17 2022" -A x64 -T host=x64 -B ../build/plugin64
cmake --build ../build/plugin64 --config Release --target ALL_BUILD -j 14

View File

@ -2,7 +2,7 @@
**1. Extracting Text Using LunaHook Windows XP Special Edition in the VM**
Download `[LunaHook](https://github.com/HIllya51/LunaHook/releases)`'s `Release_Chinese_winxp.zip`, copy it into the VM, and run it. Select the game's process, choose the game text, and then in the settings, activate `Copy to Clipboard`.
Download `[LunaHook](https://github.com/HIllya51/LunaTranslator/releases/tag/LunaHook)`'s `Release_English_winxp.zip`, copy it into the VM, and run it. Select the game's process, choose the game text, and then in the settings, activate `Copy to Clipboard`.
![img](https://image.lunatranslator.org/zh/playonxp/image.png)

View File

@ -2,7 +2,7 @@
**1. Использование LunaHook специальной версии для Windows XP в виртуальной машине для извлечения текста**
Скачайте `Release_Chinese_winxp.zip` из [LunaHook](https://github.com/HIllya51/LunaHook/releases), скопируйте его в виртуальную машину и запустите. Выберите процесс игры, выберите текст игры. Затем, в настройках, активируйте опцию `Копировать в буфер обмена`.
Скачайте `Release_Russian_winxp.zip` из [LunaHook](https://github.com/HIllya51/LunaTranslator/releases/tag/LunaHook), скопируйте его в виртуальную машину и запустите. Выберите процесс игры, выберите текст игры. Затем, в настройках, активируйте опцию `Копировать в буфер обмена`.
![img](https://image.lunatranslator.org/zh/playonxp/image.png)

View File

@ -2,7 +2,7 @@
**1、在虚拟机中使用LunaHook windows xp专用版提取文本**
下载[LunaHook](https://github.com/HIllya51/LunaHook/releases)中的`Release_Chinese_winxp.zip`,复制到虚拟机中运行。选择游戏的进程,选择游戏文本。然后,在设置中,激活`复制到剪贴板`。
下载[LunaHook](https://github.com/HIllya51/LunaTranslator/releases/tag/LunaHook)中的`Release_Chinese_winxp.zip`,复制到虚拟机中运行。选择游戏的进程,选择游戏文本。然后,在设置中,激活`复制到剪贴板`。
![img](https://image.lunatranslator.org/zh/playonxp/image.png)