Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux #1

Merged
merged 56 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
8dd962c
linux
fesily Mar 6, 2024
69bac3c
lua51 add one.c
fesily Mar 6, 2024
485470a
update liblua51.so
fesily Mar 6, 2024
87ff625
fix error
fesily Mar 7, 2024
56a2f43
update
fesily Mar 8, 2024
981d61a
fix
fesily Mar 9, 2024
faacc24
signature update
fesily Mar 9, 2024
3add4cf
Merge branch 'linux' of https://github.com/fesily/DontStarveLuaJIT2 i…
fesily Mar 9, 2024
03c653b
update
fesily Mar 11, 2024
6583f67
Merge branch 'linux' of https://github.com/fesily/DontStarveLuaJIT2 i…
fesily Mar 11, 2024
1b35c49
update win32
fesily Mar 12, 2024
220d756
update signature
fesily Mar 12, 2024
e7c1c15
fix error
fesily Mar 12, 2024
27dcd35
fix build error
fesily Mar 12, 2024
2cbf811
add const_offset
fesily Mar 13, 2024
ffd8eb0
lua51 add linux_so
fesily Mar 13, 2024
e736d39
update linux lua51
fesily Mar 13, 2024
b578da4
format
fesily Mar 13, 2024
f842830
fix error
fesily Mar 13, 2024
2711262
format code
fesily Mar 13, 2024
1983483
fix error
fesily Mar 13, 2024
09f4251
rm code
fesily Mar 13, 2024
e107baf
fix error
fesily Mar 14, 2024
6481b98
add codeblock
fesily Mar 15, 2024
1c1766f
update lua51.so
fesily Mar 15, 2024
768412f
update match
fesily Mar 16, 2024
9e3a18f
update match
fesily Mar 18, 2024
7297560
fix bug
fesily Mar 30, 2024
8d933eb
update
fesily Mar 30, 2024
b3d8e8a
guess function size
fesily Apr 16, 2024
816f6b4
reformat code
fesily Apr 17, 2024
b4fca75
update
fesily Apr 18, 2024
94245e1
update
fesily Apr 20, 2024
1a55065
fix error
fesily Apr 28, 2024
5788fcd
add reformat style
fesily Apr 28, 2024
656f6e1
Merge remote-tracking branch 'origin/linux' into linux
fesily Apr 28, 2024
5c81d8d
update windows lua51
fesily Apr 30, 2024
39fc754
add tools unzip script data
fesily May 5, 2024
8398589
update debugger
fesily May 5, 2024
a25462a
fix windows
fesily May 14, 2024
e833b13
fix linux
fesily May 15, 2024
3d3fb5e
deps add keystone
fesily May 15, 2024
357a81f
update linux
fesily May 16, 2024
f13f63c
add server.json
fesily May 16, 2024
804532e
format code
fesily May 17, 2024
fa7419f
fix windows erorr
fesily May 17, 2024
5ad8a2e
fix error
fesily May 17, 2024
39c9ddb
fix command update_signatures
fesily May 17, 2024
73bfcf7
add action
fesily May 17, 2024
32b5ba3
Merge branch 'master' into linux
fesily May 17, 2024
5020471
fix error
fesily May 17, 2024
d268e1b
fix
fesily May 17, 2024
96bb845
fix
fesily May 17, 2024
2990b6d
fix
fesily May 17, 2024
848a754
fix
fesily May 17, 2024
e84e17d
fix
fesily May 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Generated from CLion C/C++ Code Style settings
BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: None
AlignOperands: Align
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Always
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Always
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterReturnType: None
AlwaysBreakTemplateDeclarations: Yes
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: true
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
ColumnLimit: 0
CompactNamespaces: false
ContinuationIndentWidth: 8
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 4
KeepEmptyLinesAtTheStartOfBlocks: true
MaxEmptyLinesToKeep: 2
NamespaceIndentation: All
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PointerAlignment: Right
ReflowComments: false
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 0
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
TabWidth: 4
UseTab: Never
128 changes: 69 additions & 59 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,59 +1,69 @@
name: build

permissions:
contents: write

on:
push:
branches:
- master
tags:
- "*"
pull_request:
branches:
- master

jobs:
compile:
strategy:
fail-fast: false
matrix:
include:
- { os: windows-latest, target: windows, platform: win32-x64 }
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true

- uses: lukka/get-cmake@latest

- name: Restore from cache and setup vcpkg executable and data files.
uses: lukka/run-vcpkg@v11
with:
vcpkgJsonGlob: 'vcpkg.json'

- name: Run CMake+vcpkg+Ninja+CTest to build packages and generate/build/test the code.
uses: lukka/run-cmake@v10
with:
configurePreset: 'ninja-multi-vcpkg'
buildPreset: 'ninja-vcpkg-release'

- name: CMake install
run: |
cmake --build ./builds/ninja-multi-vcpkg --config Release --target install

- name: Archive Release
uses: thedoctor0/[email protected]
if: startsWith(github.ref, 'refs/tags/')
with:
path: ${{ github.workspace }}/Mod
filename: Mod.zip

- name: Publish release asserts
uses: ncipollo/[email protected]
if: startsWith(github.ref, 'refs/tags/')
with:
artifacts: 'Mod.zip'
allowUpdates: true
name: build

permissions:
contents: write

on:
push:
branches:
- master
tags:
- "*"
pull_request:
branches:
- master

jobs:
compile:
strategy:
fail-fast: false
matrix:
include:
- { os: windows-latest, target: windows, platform: win32-x64 }
- { os: ubuntu-24.04, target: linux, platform: linux-x64 }
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- uses: lukka/get-cmake@latest

- name: Restore from cache and setup vcpkg executable and data files.
uses: lukka/run-vcpkg@v11
with:
vcpkgJsonGlob: 'vcpkg.json'

- name: Run CMake+vcpkg+Ninja+CTest to build packages and generate/build/test the code.
uses: lukka/run-cmake@v10
with:
configurePreset: 'ninja-multi-vcpkg'
buildPreset: 'ninja-vcpkg-release'

- name: CMake install
run: |
cmake --build ./builds/ninja-multi-vcpkg --config Release --target install

- name: Clean Up
if: ${{ matrix.target == 'linux' }}
run: |
rm -rf ${{ github.workspace }}/Mod/bin64/windows

- name: Clean Up1
if: ${{ matrix.target == 'windows' }}
run: |
rm -r ${{ github.workspace }}/Mod/bin64/linux

- name: Archive Release
uses: thedoctor0/[email protected]
if: startsWith(github.ref, 'refs/tags/')
with:
path: ${{ github.workspace }}/Mod
filename: ${{ matrix.target}}_Mod.zip

- name: Publish release asserts
uses: ncipollo/[email protected]
if: startsWith(github.ref, 'refs/tags/')
with:
artifacts: '${{ matrix.target}}_Mod.zip'
allowUpdates: true
42 changes: 41 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,47 @@
"args": [],
"stopAtEntry": true,
"cwd": "E:/SteamLibrary/steamapps/common/Don't Starve Together",
"environment": []
"environment": [],
},
{
"name": "(Linux) debug signature_creater",
"type": "cppdbg",
"request": "launch",
"program": "/home/parallels/.steam/debian-installation/steamapps/common/Don't Starve Together/bin64/dontstarve_steam_x64",
"args": [],
"stopAtConnect": true,
"cwd": "/home/parallels/.steam/debian-installation/steamapps/common/Don't Starve Together/bin64",
"environment": [
{"name": "LD_PRELOAD", "value": "/home/parallels/dontstarveluajit2/builds/ninja-multi-vcpkg/tools/Creater/Debug/libsignature_updater.so"}
],
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
},
{
"name": "(Linux) debug file_signature",
"type": "cppdbg",
"request": "launch",
"program": "/home/ubuntu/dontstarveluajit2/Mod/bin64/linux/lua51",
"args": [],
"stopAtConnect": true,
"cwd": "/home/ubuntu/dontstarveluajit2/Mod/bin64/linux",
"environment": [
{"name": "LD_PRELOAD", "value": "/home/ubuntu/dontstarveluajit2/builds/ninja-multi-vcpkg/tools/Creater/Debug/libsignature_updater.so"}
],
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
},
{
"name": "Launch luajit",
Expand Down
88 changes: 51 additions & 37 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,101 +8,115 @@ set(CMAKE_CXX_EXTENSIONS OFF)

set(GAME_NAME "Don't Starve Together")
#set(GAME_DIR ${CMAKE_CURRENT_SOURCE_DIR}/..)
set(GAME_DIR "C:\\Program Files (x86)\\Steam\\steamapps\\common\\Don't Starve Together")
if(WIN32)
if (WIN32)
set(GAME_DIR "E:\\SteamLibrary\\steamapps\\common\\Don't Starve Together")
else(UNIX AND NOT APPLE)
set(GAME_DIR "/home/ubuntu/.steam/steam/steamapps/common/Don't Starve Together")
endif()
else (UNIX AND NOT APPLE)
set(GAME_DIR "/home/parallels/.steam/debian-installation/steamapps/common/Don't Starve Together")
endif ()

file(REAL_PATH ${GAME_DIR} GAME_DIR)

set(PYTHON_EXECUTABLE_NAME "python3")
set(VCPKG_TARGET_TRIPLET "x64-linux-static")
if(WIN32)
set(VCPKG_TARGET_TRIPLET "x64-linux-release")
if (WIN32)
set(PLATFORM_NAME "windows")
set(PYTHON_EXECUTABLE_NAME "python")
set(VCPKG_TARGET_TRIPLET "x64-windows-static-md")
elseif(UNIX AND NOT APPLE)
set(PLATFORM_NAME "Linux")
else()
elseif (UNIX AND NOT APPLE)
set(PLATFORM_NAME "linux")
elseif (UNIX AND APPLE)
set(PLATFORM_NAME "osx")
set(VCPKG_TARGET_TRIPLET "x64-osx-release")
else ()
message(FATAL_ERROR "Not supported platform")
endif()
endif ()

project(DontStarveLuaJIT VERSION 0.3.11)
project(DontStarveLuaJIT VERSION 0.3.10)

set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/Mod)

if(CMAKE_SIZEOF_VOID_P EQUAL 8)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(GAME_INSTALL_PREFIX ${GAME_DIR}/bin64)
set(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/bin64)
else()
else ()
set(GAME_INSTALL_PREFIX ${GAME_DIR}/bin)
set(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/bin)
endif()
endif ()

set(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/${PLATFORM_NAME})

if($ENV{GITHUB_ACTIONS})
if ($ENV{GITHUB_ACTIONS})
set(GAME_DIR OFF)
endif()
endif ()

add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/src/missfunc.h
COMMAND ${PYTHON_EXECUTABLE_NAME} "${CMAKE_CURRENT_SOURCE_DIR}/tools/missfunc.py"
DEPENDS src/missfunc.txt
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/src/missfunc.h
COMMAND ${PYTHON_EXECUTABLE_NAME} "${CMAKE_CURRENT_SOURCE_DIR}/tools/missfunc.py"
DEPENDS src/missfunc.txt
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)

add_custom_target(create_missfuncs DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/src/missfunc.h)

set(lua51_root ${CMAKE_CURRENT_SOURCE_DIR}/src/lua51)
set(Lua51_output_dir ${lua51_root}/$<IF:$<CONFIG:Debug>,debug,release>/)

add_custom_command(OUTPUT ${Lua51_output_dir}/lua51.dll ${Lua51_output_dir}/lua51.lib
COMMAND ${lua51_root}/build_lua51.bat Build $<$<CONFIG:Debug>:debug>
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
COMMAND ${lua51_root}/build_lua51.bat Build $<$<CONFIG:Debug>:debug>
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)

add_custom_target(build_lua51 DEPENDS ${Lua51_output_dir}/lua51${CMAKE_SHARED_LIBRARY_SUFFIX})
add_subdirectory("luajit")
set(LUAJIT_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/luajit/src)
set(LUAJIT_LIBRARIES luajit-5.1)

if(CMAKE_SIZEOF_VOID_P EQUAL 8)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(LUA_LIBRARIES_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src/x64)
else()
else ()
set(LUA_LIBRARIES_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src)
endif()
endif ()

set(LUA_INCLUDE_DIR ${lua51_root}/src)
set(LUA_LIBRARIES_PATH ${CMAKE_INSTALL_PREFIX}/lua51${CMAKE_SHARED_LIBRARY_SUFFIX})
set(LUA_LIBRARIES_PATH ${CMAKE_INSTALL_PREFIX}/${CMAKE_SHARED_LIBRARY_PREFIX}lua51${CMAKE_SHARED_LIBRARY_SUFFIX})
set(LUA_EXECUTABLE_PATH ${CMAKE_INSTALL_PREFIX}/lua51)
set(LUA_CONFIG_LIBRARIES_PATH ${LUA_LIBRARIES_PREFIX_PATH}/$<IF:$<CONFIG:Debug>,debug,release>/lua51.dll)
set(LUA_LIBRARIES lua51)

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
find_package(Steam REQUIRED)
find_package(Frida-gum REQUIRED)
find_package(keystone REQUIRED)

set(DONTSTARVEINJECTOR_ROOT ${PROJECT_SOURCE_DIR}/src/DontStarveInjector)
set(DONTSTARVEINJECTOR_UTIL_DIR ${DONTSTARVEINJECTOR_ROOT}/util)

add_subdirectory("src/FunctionRelocation")
set(FUNCTION_RELOCATION_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/FunctionRelocation)

add_subdirectory("src/DontStarveInjector")
add_subdirectory("tools/Checker")
if (msvc)
add_subdirectory("tools/Checker")
endif ()
add_subdirectory("tools/Creater")

#install(FILES ${LUA_CONFIG_LIBRARIES_PATH} DESTINATION ${CMAKE_INSTALL_PREFIX}
#install(FILES ${LUA_LIBRARIES_PATH} DESTINATION ${CMAKE_INSTALL_PREFIX})
if (GAME_DIR)
install(DIRECTORY ${CMAKE_INSTALL_PREFIX}/ DESTINATION ${GAME_INSTALL_PREFIX})
endif()
endif ()
set(BUILD_CMD ${PYTHON_EXECUTABLE_NAME} "${CMAKE_CURRENT_SOURCE_DIR}/tools/update_version.py")
execute_process(COMMAND ${CMAKE_COMMAND} -E env MOD_VERSION=${CMAKE_PROJECT_VERSION} ${BUILD_CMD}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
execute_process(COMMAND ${CMAKE_COMMAND} -E env MOD_VERSION=${CMAKE_PROJECT_VERSION} ${BUILD_CMD}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)

add_custom_target(make_karta_luamodule
COMMAND ${PYTHON_EXECUTABLE_NAME} "${CMAKE_CURRENT_SOURCE_DIR}/tools/make_karta.py"
DEPENDS ${LUA_LIBRARIES_PATH}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
COMMAND ${PYTHON_EXECUTABLE_NAME} "${CMAKE_CURRENT_SOURCE_DIR}/tools/make_karta.py"
DEPENDS ${LUA_LIBRARIES_PATH}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)

add_custom_target(unzip_script_data
COMMAND ${PYTHON_EXECUTABLE_NAME} "${CMAKE_CURRENT_SOURCE_DIR}/tools/unzip_script_data.py"
DEPENDS ${LUA_LIBRARIES_PATH}
WORKING_DIRECTORY ${GAME_DIR}
)
Binary file modified Mod/bin64/linux/liblua51.so
Binary file not shown.
Binary file added Mod/bin64/linux/lua51
Binary file not shown.
Binary file added Mod/bin64/linux/lua51_signature.msgpack
Binary file not shown.
Loading