diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 67fad3d1..dd932231 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 \ No newline at end of file + buildluna: + uses: ./.github/workflows/buildluna.yml + \ No newline at end of file diff --git a/.github/workflows/buildluna.yml b/.github/workflows/buildluna.yml new file mode 100644 index 00000000..dd064648 --- /dev/null +++ b/.github/workflows/buildluna.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/buildlunahook.yml b/.github/workflows/buildlunahook.yml new file mode 100644 index 00000000..f69f9d57 --- /dev/null +++ b/.github/workflows/buildlunahook.yml @@ -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 }} \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ac1a17df..b37fa2b0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 }} \ No newline at end of file diff --git a/cpp/LunaHook/CMakeLists.txt b/cpp/LunaHook/CMakeLists.txt index 55a6f1e5..6f40ef38 100644 --- a/cpp/LunaHook/CMakeLists.txt +++ b/cpp/LunaHook/CMakeLists.txt @@ -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) diff --git a/cpp/LunaHook/LunaHost/CMakeLists.txt b/cpp/LunaHook/LunaHost/CMakeLists.txt index bb27db80..b71cd399 100644 --- a/cpp/LunaHook/LunaHost/CMakeLists.txt +++ b/cpp/LunaHook/LunaHost/CMakeLists.txt @@ -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() \ No newline at end of file +add_subdirectory(GUI) \ No newline at end of file diff --git a/cpp/LunaHook/LunaHost/GUI/CMakeLists.txt b/cpp/LunaHook/LunaHost/GUI/CMakeLists.txt index 6c9fae4e..473e0fc1 100644 --- a/cpp/LunaHook/LunaHost/GUI/CMakeLists.txt +++ b/cpp/LunaHook/LunaHost/GUI/CMakeLists.txt @@ -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) diff --git a/cpp/LunaHook/build.py b/cpp/LunaHook/build.py index f5d109d2..c12b8a9a 100644 --- a/cpp/LunaHook/build.py +++ b/cpp/LunaHook/build.py @@ -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 """ diff --git a/cpp/LunaHook/scripts/buildplugin32.bat b/cpp/LunaHook/scripts/buildplugin32.bat index 11604b66..1db41c86 100644 --- a/cpp/LunaHook/scripts/buildplugin32.bat +++ b/cpp/LunaHook/scripts/buildplugin32.bat @@ -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 \ No newline at end of file diff --git a/cpp/LunaHook/scripts/buildplugin64.bat b/cpp/LunaHook/scripts/buildplugin64.bat index d3140b2c..98103b3e 100644 --- a/cpp/LunaHook/scripts/buildplugin64.bat +++ b/cpp/LunaHook/scripts/buildplugin64.bat @@ -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 \ No newline at end of file diff --git a/docs/en/playonxp.md b/docs/en/playonxp.md index 2b63c1d4..45a8a01b 100644 --- a/docs/en/playonxp.md +++ b/docs/en/playonxp.md @@ -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) diff --git a/docs/ru/playonxp.md b/docs/ru/playonxp.md index 3e20ddfb..2266fea0 100644 --- a/docs/ru/playonxp.md +++ b/docs/ru/playonxp.md @@ -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) diff --git a/docs/zh/playonxp.md b/docs/zh/playonxp.md index 6600eb6b..8cc25fd9 100644 --- a/docs/zh/playonxp.md +++ b/docs/zh/playonxp.md @@ -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)