Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
HIllya51 committed Dec 16, 2024
1 parent 0448135 commit dc7eaaf
Show file tree
Hide file tree
Showing 71 changed files with 1,406 additions and 1,302 deletions.
60 changes: 29 additions & 31 deletions .github/scripts/build_lunahook.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,56 +18,55 @@
os.chdir(rootDir)
os.mkdir("../build")
os.mkdir("builds")
language = ["Chinese", "English", "Russian", "TradChinese"]
for lang in language:
shutil.copytree(
f"build/{lang}_64/Release_{lang}",
f"../build/Release_{lang}",
dirs_exist_ok=True,
)
shutil.copytree(
f"build/{lang}_winxp/Release_{lang}_winxp",
f"../build/Release_{lang}",
dirs_exist_ok=True,
)

shutil.copytree(
f"build/64/Release",
f"../build/Release",
dirs_exist_ok=True,
)
shutil.copytree(
f"build/winxp/Release_winxp",
f"../build/Release",
dirs_exist_ok=True,
)

targetdir = f"../build/Release_{lang}"
target = f"builds/Release_{lang}.zip"
os.system(
rf'"C:\Program Files\7-Zip\7z.exe" a -m0=Deflate -mx9 {target} {targetdir}'
)
targetdir = f"../build/Release"
target = f"builds/Release.zip"
os.system(
rf'"C:\Program Files\7-Zip\7z.exe" a -m0=Deflate -mx9 {target} {targetdir}'
)
exit()

print(sys.version)
print(__file__)
print(rootDir)


def build_langx(lang, bit, onlycore):
def build_langx(bit, onlycore):
config = (
f"-DBUILD_PLUGIN=OFF -DWINXP=OFF -DLANGUAGE={lang} -DBUILD_GUI=ON -DBUILD_CLI=ON"
f"-DBUILD_PLUGIN=OFF -DWINXP=OFF -DBUILD_GUI=ON -DBUILD_CLI=ON"
if not onlycore
else ""
)
with open("do.bat", "w") as ff:
if bit == "32":
ff.write(
rf"""
cmake {config} ../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
cmake {config} ../CMakeLists.txt -G "Visual Studio 17 2022" -A win32 -T host=x86 -B ../build/x86
cmake --build ../build/x86 --config Release --target ALL_BUILD -j 14
"""
)
elif bit == "64":
ff.write(
rf"""
cmake {config} ../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
cmake {config} ../CMakeLists.txt -G "Visual Studio 17 2022" -A x64 -T host=x64 -B ../build/x64
cmake --build ../build/x64 --config Release --target ALL_BUILD -j 14
"""
)
os.system(f"cmd /c do.bat")


def build_langx_xp(lang, core):
def build_langx_xp( core):
url = "https://github.com/Chuyu-Team/YY-Thunks/releases/download/v1.0.7/YY-Thunks-1.0.7-Binary.zip"
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../../libs/YY-Thunks")
Expand All @@ -77,8 +76,8 @@ def build_langx_xp(lang, core):
ff.write(
rf"""
cmake -DBUILD_PLUGIN=OFF -DWINXP=ON -DLANGUAGE={lang} {flags} ../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
cmake -DBUILD_PLUGIN=OFF -DWINXP=ON {flags} ../CMakeLists.txt -G "Visual Studio 16 2019" -A win32 -T v141_xp -B ../build/x86_xp
cmake --build ../build/x86_xp --config Release --target ALL_BUILD -j 14
"""
)
os.system(f"cmd /c do.bat")
Expand All @@ -104,12 +103,11 @@ def build_langx_xp(lang, core):
)
os.system(f"cmd /c buildplugin.bat")
elif sys.argv[1] == "build":
lang = sys.argv[2]
bit = sys.argv[3]
bit = sys.argv[2]
if bit == "winxp":
build_langx_xp(lang, False)
build_langx_xp(False)
elif bit == "winxp_core":
build_langx_xp(lang, True)
build_langx_xp(True)
else:
onlycore = int(sys.argv[4]) if len(sys.argv) >= 5 else False
build_langx(lang, bit, onlycore)
build_langx(bit, onlycore)
8 changes: 4 additions & 4 deletions .github/workflows/buildluna.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ jobs:
- uses: GuillaumeFalourd/setup-windows10-sdk-action@v2
with:
sdk-version: 22621
- run: python .github/scripts/build_lunahook.py build English winxp_core
- run: python .github/scripts/build_lunahook.py build winxp_core

- uses: actions/upload-artifact@v4
with:
name: hook_xp
path: cpp/LunaHook/builds/Release_English_winxp
path: cpp/LunaHook/builds/Release_winxp

hook:
runs-on: windows-latest
Expand All @@ -53,12 +53,12 @@ jobs:
- uses: GuillaumeFalourd/setup-windows10-sdk-action@v2
with:
sdk-version: 22621
- run: python .github/scripts/build_lunahook.py build English ${{matrix.bits}} 1
- run: python .github/scripts/build_lunahook.py build ${{matrix.bits}} 1

- uses: actions/upload-artifact@v4
with:
name: hook_${{matrix.bits}}
path: cpp/LunaHook/builds/Release_English
path: cpp/LunaHook/builds/Release
pyrt:
runs-on: windows-latest
strategy:
Expand Down
12 changes: 4 additions & 8 deletions .github/workflows/buildlunahook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ on:
jobs:
build_xp:
runs-on: windows-2019
strategy:
matrix:
language: [Chinese,English,Russian,TradChinese]
permissions:
id-token: write
attestations: write
Expand All @@ -19,12 +16,12 @@ jobs:
- uses: GuillaumeFalourd/setup-windows10-sdk-action@v2
with:
sdk-version: 22621
- run: python .github/scripts/build_lunahook.py build ${{ matrix.language }} winxp
- run: python .github/scripts/build_lunahook.py build winxp
- run: python .github/scripts/packlunahook.py

- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.language }}_winxp
name: winxp
path: cpp/LunaHook/builds

build_plugin:
Expand Down Expand Up @@ -71,7 +68,6 @@ jobs:
runs-on: windows-latest
strategy:
matrix:
language: [Chinese,English,Russian,TradChinese]
bits: [64]
permissions:
id-token: write
Expand All @@ -84,11 +80,11 @@ jobs:
- uses: GuillaumeFalourd/setup-windows10-sdk-action@v2
with:
sdk-version: 22621
- run: python .github/scripts/build_lunahook.py build ${{ matrix.language }} ${{matrix.bits}}
- run: python .github/scripts/build_lunahook.py build ${{matrix.bits}}

- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.language }}_${{matrix.bits}}
name: ${{matrix.bits}}
path: cpp/LunaHook/builds

build:
Expand Down
9 changes: 3 additions & 6 deletions cpp/LunaHook/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ else()
set(bitappendix "32")
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)
Expand All @@ -44,10 +41,9 @@ else()
set(WINXPAPP "")
endif()

add_definitions(-DLANGUAGE=${LANGUAGE})

set(CMAKE_FINAL_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/builds/${CMAKE_BUILD_TYPE}_x${bitappendix}_${LANGUAGE}${WINXPAPP})
set(binary_out_putpath ${CMAKE_SOURCE_DIR}/builds/${CMAKE_BUILD_TYPE}_${LANGUAGE}${WINXPAPP})
set(CMAKE_FINAL_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/builds/${CMAKE_BUILD_TYPE}_x${bitappendix})
set(binary_out_putpath ${CMAKE_SOURCE_DIR}/builds/${CMAKE_BUILD_TYPE})
#set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY $<1:${CMAKE_FINAL_OUTPUT_DIRECTORY}>)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY $<1:${binary_out_putpath}>)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY $<1:${binary_out_putpath}>)
Expand All @@ -65,6 +61,7 @@ include_directories(include)
include(${CMAKE_SOURCE_DIR}/../version.cmake)

add_subdirectory(include)
add_subdirectory(Lang)
if(BUILD_CORE)
add_subdirectory(LunaHook)
endif()
Expand Down
4 changes: 4 additions & 0 deletions cpp/LunaHook/Lang/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

add_library(lang_hook Lang.cpp Lang_hook.cpp)
add_library(lang_host Lang.cpp Lang_host.cpp)
add_library(lang_ui Lang.cpp Lang_host.cpp Lang_ui.cpp)
4 changes: 4 additions & 0 deletions cpp/LunaHook/Lang/Lang.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#include "Lang_private.h"

SUPPORT_LANG curr_lang = English;
langhelper TR;
123 changes: 104 additions & 19 deletions cpp/LunaHook/Lang/Lang.h
Original file line number Diff line number Diff line change
@@ -1,22 +1,107 @@
#pragma warning(push)
#pragma warning(disable: 4005)

#define English 0
#define Chinese 1
#define Russian 2
#define TradChinese 3

#include"en.h"
enum LANG_STRINGS_UI
{
WndSelectProcess,
WndLunaHostGui,
TSetting,
TPlugins,
NotifyInvalidHookCode,
BtnDetach,
BtnSaveHook,
BtnAttach,
BtnRefresh,
BtnToClipboard,
BtnReadOnly,
BtnInsertUserHook,
LblFlushDelay,
LblFilterRepeat,
LblCodePage,
LblMaxBuff,
LblMaxHist,
LblLanguage,
LblAutoAttach,
LblAutoAttach_savedonly,
MenuCopyHookCode,
MenuRemoveHook,
MenuDetachProcess,
MenuRemeberSelect,
MenuForgetSelect,
MenuAddPlugin,
MenuRemovePlugin,
MenuPluginRankUp,
MenuPluginRankDown,
MenuPluginEnable,
MenuPluginVisSetting,
DefaultFont,
InvalidPlugin,
InvalidDll,
InvalidDump,
MsgError,
BtnOk,
HS_TEXT,
VersionLatest,
VersionCurrent,
LIST_HOOK,
COPYSELECTION,
FONTSELECT,
};
enum LANG_STRINGS_HOST
{
ALREADY_INJECTED,
NEED_32_BIT,
NEED_64_BIT,
INJECT_FAILED,
INVALID_CODEPAGE,
CONSOLE,
PROC_CONN,
PROC_DISCONN,
ProjectHomePage,
UNMATCHABLEVERSION,
T_WARNING,
};
enum LANG_STRINGS_HOOK
{
PIPE_CONNECTED,
INSERTING_HOOK,
REMOVING_HOOK,
TOO_MANY_HOOKS,
HOOK_SEARCH_STARTING,
HOOK_SEARCH_INITIALIZING,
NOT_ENOUGH_TEXT,
HOOK_SEARCH_INITIALIZED,
MAKE_GAME_PROCESS_TEXT,
HOOK_SEARCH_FINISHED,
OUT_OF_RECORDS_RETRY,
FUNC_MISSING,
MODULE_MISSING,
GARBAGE_MEMORY,
SEND_ERROR,
READ_ERROR,
SearchForHooks_ERROR,
ResultsNum,
HIJACK_ERROR,
COULD_NOT_FIND,
InvalidLength,
InsertHookFailed,
Match_Error,
Attach_Error,
MatchedEngine,
ConfirmStop,
Attach_Stop,
ProcessRange,
WarningDummy,
RYUJINXUNSUPPORT
};
enum SUPPORT_LANG;
SUPPORT_LANG map_to_support_lang(const char *);
const char *map_from_support_lang(SUPPORT_LANG);
struct langhelper
{
const char *operator[](LANG_STRINGS_HOOK);
const wchar_t *operator[](LANG_STRINGS_HOST);
const wchar_t *operator[](LANG_STRINGS_UI);
};

#if (LANGUAGE == Chinese)
#include"zh.h"
#endif
#if (LANGUAGE == Russian)
#include"ru.h"
#endif
#if (LANGUAGE == TradChinese)
#include"cht.h"
#endif


#pragma warning(pop)
extern langhelper TR;
extern SUPPORT_LANG curr_lang;
Loading

0 comments on commit dc7eaaf

Please sign in to comment.