Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
fix release zips

Error message boxes on proxy loading

test script

docs, changelog

fix buildscript

Remove outdated API.txt

add doc link to error message box

UE4SS title on error pane

fix oopsie
  • Loading branch information
Buckminsterfullerene02 committed May 16, 2024
1 parent bd444c3 commit d2fe3fe
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 721 deletions.
4 changes: 4 additions & 0 deletions UE4SS/proxy_generator/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ int _tmain(int argc, TCHAR* argv[])
cpp_file << "#include <Windows.h>" << endl;
cpp_file << "#include <filesystem>" << endl;
cpp_file << endl;
cpp_file << "#pragma comment(lib, \"user32.lib\")" << endl;
cpp_file << endl;

cpp_file << "using namespace RC;" << endl;
cpp_file << "namespace fs = std::filesystem;" << endl;
Expand Down Expand Up @@ -176,6 +178,7 @@ int _tmain(int argc, TCHAR* argv[])
cpp_file << " SOriginalDll = LoadLibrary(dll_path.c_str());" << endl;
cpp_file << " if (!SOriginalDll)" << endl;
cpp_file << " {" << endl;
cpp_file << " MessageBox(nullptr, STR(\"Failed to load proxy DLL\"), STR(\"UE4SS Error\"), MB_OK | MB_ICONERROR);" << endl;
cpp_file << " ExitProcess(0);" << endl;
cpp_file << " }" << endl;
cpp_file << "}" << endl;
Expand Down Expand Up @@ -246,6 +249,7 @@ int _tmain(int argc, TCHAR* argv[])
cpp_file << " }" << endl;
cpp_file << " else" << endl;
cpp_file << " {" << endl;
cpp_file << " MessageBox(nullptr, STR(\"Failed to load UE4SS.dll. Please see the docs on correct installation: https://docs.ue4ss.com/installation-guide\"), STR(\"UE4SS Error\"), MB_OK | MB_ICONERROR);" << endl;
cpp_file << " ExitProcess(0);" << endl;
cpp_file << " }" << endl;
cpp_file << " }" << endl;
Expand Down
18 changes: 3 additions & 15 deletions UE4SS/src/GUI/LiveView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -585,22 +585,10 @@ namespace RC::GUI
auto legacy_root_directory_path = StringType{UE4SSProgram::get_program().get_legacy_root_directory()} + std::format(STR("\\watches\\watches.meta.json"));

StringType json_file_contents;
bool file_opened = false;
bool is_legacy = !std::filesystem::exists(working_directory_path) && std::filesystem::exists(legacy_root_directory_path);
auto json_file = File::open(is_legacy ? legacy_root_directory_path : working_directory_path, File::OpenFor::Reading, File::OverwriteExistingFile::No, File::CreateIfNonExistent::Yes);

if (std::filesystem::exists(working_directory_path))
{
auto json_file = File::open(working_directory_path, File::OpenFor::Reading, File::OverwriteExistingFile::No, File::CreateIfNonExistent::Yes);
json_file_contents = json_file.read_all();
file_opened = true;
}
else if (std::filesystem::exists(legacy_root_directory_path))
{
auto json_file = File::open(legacy_root_directory_path, File::OpenFor::Reading, File::OverwriteExistingFile::No, File::CreateIfNonExistent::Yes);
json_file_contents = json_file.read_all();
file_opened = true;
}

if (!file_opened || json_file_contents.empty())
if (json_file_contents.empty())
{
return;
}
Expand Down
650 changes: 0 additions & 650 deletions assets/API.txt

This file was deleted.

3 changes: 3 additions & 0 deletions assets/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ TBD
### General
UE Platform support, which allows for much easier internal implementation of new Unreal classes ([UEPseudo #80](https://github.com/Re-UE4SS/UEPseudo/pull/80)) - narknon, localcc

Added new installation method by allowing overriding of the location of the `UE4SS.dll`, [documentation](https://docs.ue4ss.com/installation-guide.html#overriding-install-location). - ([UE4SS #506](https://github.com/UE4SS-RE/RE-UE4SS/pull/506)) - Buckminsterfullerene

### Live View
Added search filter: `IncludeClassNames`. ([UE4SS #472](https://github.com/UE4SS-RE/RE-UE4SS/pull/472)) - Buckminsterfullerene

Expand All @@ -33,6 +35,7 @@ BREAKING: Changed `FTransform` constructor to be identical to unreal.
## Changes

### General
Changed the default location of the UE4SS release assets to be in `game executable directory/ue4ss/`. ([UE4SS #506](https://github.com/UE4SS-RE/RE-UE4SS/pull/506)) - Buckminsterfullerene

### Live View
Added support for watching ArrayProperty and StructProperty ([UE4SS #419](https://github.com/UE4SS-RE/RE-UE4SS/pull/419))
Expand Down
40 changes: 26 additions & 14 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
# Unreal Engine 4/5 Scripting System

[Home](./README.md)
- [FeatureOverview]()
- [Blueprint Modloading](./feature-overview/blueprint-modloader.md)
- [Live Property Viewer and Editor](./feature-overview/live-view.md)
- [Dumpers](./feature-overview/dumpers.md)
- [Installation](./installation-guide.md)
- [Custom Game Configs](./custom-game-configs.md)
[Installation](./installation-guide.md)
[Contributing](./contributing.md)

---

## Feature Overview
- [Blueprint Modloading](./feature-overview/blueprint-modloader.md)
- [Live Property Viewer and Editor](./feature-overview/live-view.md)
- [Dumpers](./feature-overview/dumpers.md)

## APIs

- [Lua API](./lua-api.md)
- [Table Definitions]()
- [Key](./lua-api/table-definitions/key.md)
Expand Down Expand Up @@ -91,13 +97,19 @@
- [Creating a C++ Mod](./guides/creating-a-c++-mod.md)
- [Installing a C++ Mod](./guides/installing-a-c++-mod.md)
- [GUI tabs with a C++ Mod](./guides/creating-gui-tabs-with-c++-mod.md)
- [Guides]()
- [Fixing missing AOBs](./guides/fixing-compatibility-problems.md)
- [Generating UHT headers](./guides/generating-uht-compatible-headers.md)
- [Creating a C++ Mod](./guides/creating-a-c++-mod.md)
- [Installing a C++ Mod](./guides/installing-a-c++-mod.md)
- [GUI tabs with a C++ Mod](./guides/creating-gui-tabs-with-c++-mod.md)
- [Creating a Lua Mod](./guides/creating-a-lua-mod.md)
- [Using Custom Lua Bindings](./guides/using-custom-lua-bindings.md)

## Guides

- [Fixing missing AOBs](./guides/fixing-compatibility-problems.md)
- [Generating UHT headers](./guides/generating-uht-compatible-headers.md)
- [Creating a C++ Mod](./guides/creating-a-c++-mod.md)
- [Installing a C++ Mod](./guides/installing-a-c++-mod.md)
- [GUI tabs with a C++ Mod](./guides/creating-gui-tabs-with-c++-mod.md)
- [Creating a Lua Mod](./guides/creating-a-lua-mod.md)
- [Using Custom Lua Bindings](./guides/using-custom-lua-bindings.md)

## Misc

- [Custom Game Configs](./custom-game-configs.md)
- [Devlogs](./devlogs.md)
- [DataTables in UE4SS](./devlogs/datatables-in-ue4ss.md)
1 change: 1 addition & 0 deletions docs/contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Contributing
17 changes: 13 additions & 4 deletions docs/installation-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ The preferred and most straightforward way to install UE4SS is to choose the `zD

Now all you need to do is start your game and UE4SS will automatically be injected.

## Expirimental Install
## Experimental Install

If you want the latest and greatest features and don't mind the potential for more bugs than the main release, you can visit the [experimental part of releases](https://github.com/UE4SS-RE/RE-UE4SS/releases/tag/experimental) which is automatically updated for each commit to the main branch.

Expand All @@ -54,14 +54,23 @@ There are two main packages you need to look for: basic, and dev. They are in a

> **Note:** If you are using the experimental version for development, you should be using the dev version of the docs, which you can get to by appending docs.ue4ss.com with `/dev` (e.g. this page would be `https://docs.ue4ss.com/dev/installation-guide`).
## Overriding Install Location

This method allows you to override the location of the `root directory` while proxy injection still works.

In your `game executable directory` alongside the `dwmapi.dll`, create a file called `override.txt` and inside it you can write either an absolute path or a relative path to your new `UE4SS.dll`.

For an example, possible paths could be:
- `C:\ue4ss\UE4SS.dll`
- `..\..\..\..\..\..\UE4SS.dll`

## Manual Injection

> Using manual injection will mean that the `root directory` and `working directory` are treated as one single directory that happens to also be the same directory as your `game executable directory`,
but any directory may be used.
> Using manual injection will mean that the `root directory` and `working directory` are treated as one single directory that happens to also be the same directory as your `game executable directory`, but any directory may be used.
Following the download of basic or dev methods (stable or experimental) and delete `dwmapi.dll`. Afterwards, launch the game and manually inject `UE4SS.dll` using your injector of choice.

## Central Install Location
### Central Install Location via Manual Injection

This method is a way to install UE4SS in one place for all your games. Simply extract the zip file of your choice (basic or dev) in any directory _outside_ the `game directory`, this is what's known as the `root directory`.

Expand Down
80 changes: 42 additions & 38 deletions tools/buildscripts/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
import argparse
from datetime import datetime

# change dir to repo root
# Change dir to repo root
os.chdir(os.path.join(os.path.dirname(__file__), '..', '..'))

# outputs to github env if present
# Outputs to GitHub env if present
def github_output(name, value):
if 'GITHUB_OUTPUT' in os.environ:
with open(os.environ['GITHUB_OUTPUT'], 'a') as env:
env.write(f'{name}={value}')
env.write(f'{name}={value}\n')

changelog_path = 'assets/Changelog.md'

Expand Down Expand Up @@ -67,7 +67,7 @@ def package(args):
staging_release = os.path.join(release_output, 'StagingRelease')

def make_staging_dirs():
# builds a release version of /assets by copying the directory and then
# Builds a release version of /assets by copying the directory and then
# removing and disabling dev-only settings and files
exclude_files = [
'API.txt',
Expand All @@ -92,23 +92,23 @@ def make_staging_dirs():
'LineTraceMod': 0,
}

# copy whole directory
# Copy whole directory
shutil.copytree('assets', staging_dev)
shutil.copytree('assets', staging_release)

# include repo README
# Include repo README
shutil.copy('README.md', os.path.join(staging_dev, 'README.md'))
shutil.copy('README.md', os.path.join(staging_release, 'README.md'))

# remove files
# Remove files
for file in exclude_files:
path = os.path.join(staging_release, file)
try:
os.remove(path)
except:
shutil.rmtree(path)

# change UE4SS-settings.ini
# Change UE4SS-settings.ini
config_path = os.path.join(staging_release, 'UE4SS-settings.ini')

with open(config_path, mode='r', encoding='utf-8-sig') as file:
Expand All @@ -121,7 +121,7 @@ def make_staging_dirs():
with open(config_path, mode='w', encoding='utf-8-sig') as file:
file.write(content)

# change Mods/mods.txt
# Change Mods/mods.txt
mods_path = os.path.join(staging_release, 'Mods/mods.txt')

with open(mods_path, mode='r', encoding='utf-8-sig') as file:
Expand Down Expand Up @@ -165,39 +165,37 @@ def package_release(is_dev_release: bool):
os.makedirs(ue4ss_dir, exist_ok=True)

# Move all files from assets folder to the ue4ss folder except dwmapi.dll
for root, dirs, files in os.walk('assets'):
for root, _, files in os.walk('assets'):
for file in files:
if file.lower() != 'dwmapi.dll':
src_path = os.path.join(root, file)
dst_path = os.path.join(ue4ss_dir, os.path.relpath(src_path, 'assets'))
os.makedirs(os.path.dirname(dst_path), exist_ok=True)
shutil.copy(src_path, dst_path)

# main dll and pdb
# Main dll and pdb
shutil.copy(ue4ss_dll_path, ue4ss_dir)

# proxy
# Proxy
shutil.copy(dwmapi_dll_path, staging_dir)

if is_dev_release:
shutil.copy(ue4ss_pdb_path, ue4ss_dir)
if os.path.exists(os.path.join(staging_dir, 'docs')):
shutil.copytree('docs', os.path.join(staging_dir, 'docs'))
if os.path.exists(os.path.join(scan_start_dir, 'docs')):
shutil.copytree('docs', os.path.join(ue4ss_dir, 'Docs'))

# Move remaining files to the ue4ss dir
dont_move = ['dwmapi.dll', 'docs', 'ue4ss']
for file in os.listdir(staging_dir):
if file.lower() not in dont_move:
shutil.move(os.path.join(staging_dir, file), os.path.join(ue4ss_dir, file))

output = os.path.join(release_output, main_zip_name)
shutil.make_archive(output, 'zip', staging_dir)
print(f'created package {output}.zip')

# clean up
try:
os.remove(os.path.join(ue4ss_dir, 'ue4ss.dll'))
os.remove(os.path.join(ue4ss_dir, 'ue4ss.pdb'))
os.remove(os.path.join(staging_dir, 'dwmapi.dll'))
except:
pass
print(f'Created package {output}.zip')

shutil.rmtree(os.path.join(staging_dir, 'docs'), ignore_errors=True)
shutil.rmtree(ue4ss_dir, ignore_errors=True)
# Clean up staging dir
shutil.rmtree(staging_dir)

make_staging_dirs()

Expand All @@ -206,30 +204,36 @@ def package_release(is_dev_release: bool):
package_release(is_dev_release=True)

# CustomGameConfigs
shutil.make_archive(os.path.join(release_output, 'zCustomGameConfigs'), 'zip', 'assets/CustomGameConfigs', 'ue4ss/')
shutil.make_archive(os.path.join(release_output, 'zCustomGameConfigs'), 'zip', 'assets/CustomGameConfigs')

# MapGenBP
shutil.make_archive(os.path.join(release_output, 'zMapGenBP'), 'zip', 'assets/MapGenBP', 'ue4ss/')
shutil.make_archive(os.path.join(release_output, 'zMapGenBP'), 'zip', 'assets/MapGenBP')

changelog = parse_changelog()
with open(os.path.join(release_output, 'release_notes.md'), 'w') as file:
file.write(changelog[0]['notes'])

print('done')
print('Done')

commands = {f.__name__: f for f in [
get_release_notes,
package,
release_commit,
]}

parser = argparse.ArgumentParser()
subparsers = parser.add_subparsers(dest='command', required=True)
package_parser = subparsers.add_parser('package')
package_parser.add_argument('-e', action='store_true')
package_parser.add_argument('-d', action='store')
release_commit_parser = subparsers.add_parser('release_commit')
release_commit_parser.add_argument('username', nargs='?')
args = parser.parse_args()

commands[args.command](args)
def main():
parser = argparse.ArgumentParser()
subparsers = parser.add_subparsers(dest='command', required=True)

package_parser = subparsers.add_parser('package')
package_parser.add_argument('-e', action='store_true')
package_parser.add_argument('-d', action='store')

release_commit_parser = subparsers.add_parser('release_commit')
release_commit_parser.add_argument('username', nargs='?')

args = parser.parse_args()
commands[args.command](args)

if __name__ == "__main__":
main()

0 comments on commit d2fe3fe

Please sign in to comment.