Skip to content

Commit

Permalink
fixes and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ate47 committed Nov 27, 2023
1 parent 9497da3 commit d405a24
Show file tree
Hide file tree
Showing 65 changed files with 5,636 additions and 676 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ scriptparsetree*
cw
output*
/pool/

vm_codes.db2

*.log
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@
branch = master
[submodule ".\\deps\\ps4debug\\"]
url = https://github.com/ate47/ps4debug
[submodule "deps/asmjit"]
path = deps/asmjit
url = https://github.com/asmjit/asmjit
1 change: 1 addition & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ This software depends on libraries with a different License.
- [ANTLR/ANTLR-4](https://github.com/antlr/antlr4) - [BSD-3-Clause license](https://github.com/antlr/antlr4/blob/master/LICENSE.txt).
- [Microsoft/Detours](https://github.com/microsoft/Detours) - [MIT license](https://github.com/microsoft/Detours/blob/main/LICENSE.md).
- [Madler/zlib](https://github.com/madler/zlib) - [Custom license](https://github.com/madler/zlib/blob/master/LICENSE).
- [asmjit](https://github.com/asmjit/asmjit) - [ZLib license](https://github.com/asmjit/asmjit/blob/master/LICENSE.md).

# MIT License

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ This tool is using and providing
- [ANTLR-4](https://github.com/antlr/antlr4) - [BSD-3-Clause license](https://github.com/antlr/antlr4/blob/master/LICENSE.txt).
- [Detours](https://github.com/microsoft/Detours) - [MIT license](https://github.com/microsoft/Detours/blob/main/LICENSE.md).
- [Madler/zlib](https://github.com/madler/zlib) - [Custom license](https://github.com/madler/zlib/blob/master/LICENSE).
- [asmjit](https://github.com/asmjit/asmjit) - [ZLib license](https://github.com/asmjit/asmjit/blob/master/LICENSE.md).

## Downloads

Expand All @@ -27,7 +28,6 @@ You can download the latest release here:
Mods implemented in my tool, run `acts mod` for the list.

- `acts mod t8cee` - enable EEs in Custom mutations, offline or casual (Black Ops 4).
- `acts mod t8dll` - Inject bo4 tool dll (Project BO4 or equivalent)

### Dump tools

Expand Down
1 change: 1 addition & 0 deletions deps/asmjit
Submodule asmjit added at 7e64ea
2 changes: 1 addition & 1 deletion grammar/gsc.g4
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ FLOATVAL: '-'?((([0-9])* '.' ([0-9])+) | (([0-9])+ '.' ([0-9])*));
IDENTIFIER: [a-z_A-Z] ([a-z_A-Z0-9])*;
STRUCT_IDENTIFIER: '#' [a-z_A-Z] ([a-z_A-Z0-9])*;
PATH: [a-z_A-Z0-9\\/]+ ('.gsc' | '.csc')?;
STRING: '"' (~["\\])* '"';
STRING: '"' (~["\\] | ('\\'.))* '"';
HASHSTRING: [#] STRING;
BOOL_VALUE: 'true' | 'false';
UNDEFINED_VALUE: 'undefined';
94 changes: 90 additions & 4 deletions premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ function buildinfo()
file:write(" // Do not write in this file, it is updated by premake\n")
file:write("#ifdef DEBUG\n\n")
file:write(" constexpr const char* VERSION = \"Dev\";\n")
file:write(" constexpr const wchar_t* VERSIONW = L\"Dev\";\n")
file:write(" constexpr unsigned int VERSION_ID = 0xFFFFFFFF;\n")
file:write("\n#else\n\n")
file:write(" // Version used for the release\n")
file:write(" constexpr const char* VERSION = \"" .. version .. "\";\n")
file:write(" constexpr const wchar_t* VERSIONW = L\"" .. version .. "\";\n")
file:write(" constexpr unsigned int VERSION_ID = 0x" .. versionid .. ";\n")
file:write("\n#endif\n")
file:write("}\n")
Expand All @@ -32,8 +34,8 @@ workspace "AtianCodTools"
startproject "AtianCodTools"
location "./build"
configurations {
"Debug",
"Release"
"Debug",
"Release"
}

architecture "x86_64"
Expand Down Expand Up @@ -71,13 +73,16 @@ project "ACTSSharedLibrary"

includedirs {
"src/shared",
"deps/asmjit/src/",
}

vpaths {
["*"] = "*"
}
links { "asmjit" }
dependson "asmjit"

project "ACTS-BO4-DLL"
project "AtianCodToolsBO4DLL"
kind "SharedLib"
language "C++"
cppdialect "C++20"
Expand All @@ -96,7 +101,8 @@ project "ACTS-BO4-DLL"
"src/bo4-dll",
"src/shared",
-- link detours
"deps/Detours/src/"
"deps/Detours/src/",
"deps/asmjit/src/",
}

vpaths {
Expand All @@ -105,8 +111,42 @@ project "ACTS-BO4-DLL"

links { "ACTSSharedLibrary" }
links { "detours" }
links { "asmjit" }
dependson "ACTSSharedLibrary"
dependson "detours"
dependson "asmjit"

project "AtianCodToolsUI"
kind "WindowedApp"
language "C++"
cppdialect "C++20"
targetdir "%{wks.location}/bin/"
objdir "%{wks.location}/obj/"
targetname "acts-ui"

files {
"./src/ui/**.hpp",
"./src/ui/**.cpp",
"./resources/**",
}

includedirs {
"src/ui",
"src/shared",
"deps/ps4debug/libdebug/cpp/include/",
"deps/asmjit/src/",
}

vpaths {
["*"] = "*"
}

links { "ACTSSharedLibrary" }
links { "libps4debug" }
links { "asmjit" }
dependson "ACTSSharedLibrary"
dependson "libps4debug"
dependson "asmjit"

project "AtianCodTools"
kind "ConsoleApp"
Expand Down Expand Up @@ -144,6 +184,7 @@ project "AtianCodTools"
"deps/antlr4/runtime/Cpp/runtime/src/",
"deps/zlib/",
"deps/ps4debug/libdebug/cpp/include/",
"deps/asmjit/src/",
}

vpaths {
Expand All @@ -158,10 +199,35 @@ project "AtianCodTools"
links { "ACTSSharedLibrary" }
links { "zlib" }
links { "libps4debug" }
links { "asmjit" }
dependson "antlr4-runtime"
dependson "ACTSSharedLibrary"
dependson "zlib"
dependson "libps4debug"
dependson "asmjit"

project "TestDll"
kind "SharedLib"
language "C++"
cppdialect "C++20"
targetdir "%{wks.location}/bin/"
objdir "%{wks.location}/obj/"

targetname "test-dll"

files {
"./src/test-dll/**.hpp",
"./src/test-dll/**.h",
"./src/test-dll/**.cpp",
}

includedirs {
"./src/test-dll",
}

vpaths {
["*"] = "*"
}

group "deps"
project "antlr4-runtime"
Expand Down Expand Up @@ -227,6 +293,26 @@ group "deps"
"deps/zlib/*.c",
"deps/zlib/*.h",
}
project "asmjit"
language "C++"
kind "StaticLib"
warnings "Off"

targetname "asmjit"
targetdir "%{wks.location}/bin/"
objdir "%{wks.location}/obj/"

files {
"deps/asmjit/src/**.cpp",
"deps/asmjit/src/**.h",
}
defines {
"ASMJIT_STATIC",
"ASMJIT_NO_AARCH64",
"ASMJIT_BUILD_RELEASE",
"ASMJIT_NO_FOREIGN"
}

project "libps4debug"
language "C++"
kind "StaticLib"
Expand Down
4 changes: 2 additions & 2 deletions release/version
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
1.2.1
10201000
1.3.0
10300000
2 changes: 1 addition & 1 deletion resources/resources.rc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
id ICON "../resources/icon.ico"
acts_logo ICON "../resources/icon.ico"
8 changes: 8 additions & 0 deletions scripts/package.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,23 @@ try {
Copy-Item "build/bin/*.exe" "$base/bin" > $null
Copy-Item "build/bin/*.dll" "$base/bin" > $null

# Clear test dlls
Remove-Item -Force -ErrorAction Ignore "$base/bin/test-*.dll" > $null
# remove UI (not ready for deployment)
Remove-Item -Force -ErrorAction Ignore "$base/bin/acts-ui.exe" > $null

# License
Copy-Item "README.md" "$base/README.md" > $null
Copy-Item "LICENSE.md" "$base/licenses/license_acts.md" > $null
Copy-Item "deps/antlr4/LICENSE.txt" "$base/licenses/license_antlr4.md" > $null
Copy-Item "deps/Detours/LICENSE.md" "$base/licenses/license_detours.md" > $null
Copy-Item "deps/zlib/LICENSE" "$base/licenses/license_zlib.md" > $null
Copy-Item "deps/asmjit/LICENSE.md" "$base/licenses/license_asmjit.md" > $null

# Compress
Compress-Archive -LiteralPath "$base" -DestinationPath "$base.zip" > $null

Write-Host "Packaged to '$base.zip'"
}
finally {
$prevPwd | Set-Location
Expand Down
8 changes: 3 additions & 5 deletions src/bo4-dll/bo4.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#include <dll_includes.hpp>

BYTE* bo4::BasePtr() {
return reinterpret_cast<BYTE*>(GetModuleHandleA(NULL));
}

t8internal::scrVmPub* bo4::scrVmPub = reinterpret_cast<t8internal::scrVmPub*>(Relativise(offset::scrVmPub));
t8internal::scrVarPub* bo4::scrVarPub = reinterpret_cast<t8internal::scrVarPub*>(Relativise(offset::gScrVarPub));
bo4::ObjFileInfoTable* bo4::objFileInfo = reinterpret_cast<bo4::ObjFileInfoTable*>(Relativise(offset::gObjFileInfo));
Expand All @@ -17,7 +13,9 @@ void bo4::ScrVm_Error(scriptinstance::ScriptInstance inst, const char* format, b

auto& msg = errorMessage[inst];

vsnprintf(msg, sizeof(msg), format, va);
vsprintf_s(msg, format, va);

va_end(va);

scrVarPub[inst].error_message = msg;

Expand Down
8 changes: 3 additions & 5 deletions src/bo4-dll/bo4.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
#include <dll_includes.hpp>

namespace bo4 {
BYTE* BasePtr();

inline BYTE* Relativise(uintptr_t location) {
return &BasePtr()[location];
}
inline BYTE* Relativise(uintptr_t location) {
return process::Relativise(location);
}

struct Hash {
UINT64 hash;
Expand Down
103 changes: 0 additions & 103 deletions src/bo4-dll/cli_connect.cpp

This file was deleted.

Loading

0 comments on commit d405a24

Please sign in to comment.