Cyber Engine Tweaks Documentation
repository·master·Indexed 24 days ago
https://github.com/maximegmd/cyberenginetweaksA Lua-based scripting framework for Cyberpunk 2077 that provides modders with access to internal engine features, a TweakDB editor, and a GUI via Dear ImGui. It includes quality-of-life patches for performance and game behavior, a lightweight JSON library for Lua, and sol2_ImGui_Bindings for managing windows, widgets, and layout within the game's interface.
What's inside Cyber Engine Tweaks
- Cyber Engine Tweaks (CET) is a framework for Cyberpunk 2077 that allows modders to script mods using Lua with access to internal scripting features. It provides a Dear ImGui interface for mod GUIs, a console, and a TweakDB editor. Additionally, it includes various quality-of-life patches and development tools that can be toggled via a settings menu or configuration files (a game restart is required to apply changes).
Set up the ASI Loader for plugin loading
masterTo enable plugin loading via an ASI loader, follow these steps:
- Download
Ultimate-ASI-Loader_x64.zipfrom the ASI Loader releases. - Place
dinput8.dllinto<cyberpunk install path>\bin\x64\. - Rename
dinput8.dlltoversion.dll. - Create a
global.inifile in<cyberpunk install path>\bin\x64\. - Add the following configuration to
global.ini:
[GlobalSets] LoadPlugins=1 LoadFromScriptsOnly=1 DontLoadFromDllMain=0 FindModule=0 UseD3D8to9=0 DisableCrashDumps=0 Direct3D8DisableMaximizedWindowedModeShim=0- Download
Initialize sol2_ImGui_Bindings
masterTo use the ImGui bindings within Cyber Engine Tweaks, you must initialize the bindings by calling
sol_ImGui::InitBindingswith yoursol::stateobject. This enables theImGuiglobal object in Lua.// Call this function! sol_ImGui::InitBindings(lua); // lua being your sol::stateApply general coding practices and formatting
masterWhen writing code for this project, adhere to these generalities:
- Self-Explanatory Names: Avoid single-letter names. Use descriptive names like
incomingPacketCountinstead ofa. - Use of
auto: You may useautofor long, complex names, but do not use it for primitive types to avoid implicit signed/unsigned conversion issues. - Brace Style: Do not use Java-style blocks. The opening brace
{must be placed on a new line.
- Self-Explanatory Names: Avoid single-letter names. Use descriptive names like
Install and use the json.lua library
masterTo use this lightweight JSON library, drop the
json.luafile into your project directory and require it in your Lua scripts.It is implemented in pure Lua and is compatible with Lua 5.1, 5.2, 5.3, and LuaJIT.
json = require "json"Install Cyber Engine Tweaks to Cyberpunk 2077
masterTo install the built plugin, you must first configure the specific plugin directory within your Cyberpunk installation path (do not use the base directory), then run the install command.
Target path format:
<cyberpunk install path>\bin\x64\pluginsxmake f --installpath=<cyberpunk install path>\bin\x64\plugins xmake installGenerate Visual Studio project files
masterIf you prefer using Visual Studio instead of the xmake CLI, you can generate VS project files by running the following command. This will create a
vsxmakefolder containing the.slnfile.xmake project -k vsxmakeBuild Cyber Engine Tweaks from source
masterTo build the plugin, ensure you have the following requirements installed:
Follow these steps:
- Open a command prompt and navigate to the repository.
- Check out the desired branch or tag.
- Initialize dependencies:
git submodule update --init. - Build the project:
xmake -y(usexmake -y -vfor verbose output).
git submodule update --init xmake -yInstall and Setup Cyber Engine Tweaks
masterTo use Cyber Engine Tweaks, you must first install RED4ext.
For detailed installation instructions, including specific guidance for using CET with Proton, refer to the official wiki:
Follow C++20 coding standards for Cyber Engine Tweaks
masterWhen developing for Cyber Engine Tweaks, use C++20 features supported by vs2019.
To maintain performance and binary size, follow these guidelines:
- Use templates responsibly to avoid excessive compilation times and binary bloat.
- Adhere to the Single Responsibility Principle (SRP) by creating small, reusable components instead of large, monolithic classes.
- Avoid using exceptions. Do not use STL code that can throw; instead, use
nothrowversions or unsafe versions where available.
Choose between lsqlite3 and lsqlite3complete
masterLuaSQLite3 provides two modules for manipulating SQLite3 databases directly from Lua 5. Choose based on how you want to link the SQLite3 library:
lsqlite3: Links SQLite3 dynamically. You must have the SQLite3 library installed on your system (available from http://www.sqlite.org/).lsqlite3complete: Links SQLite3 statically. This version includes the SQLite3 amalgamation source code, so no external SQLite3 library is required.
Troubleshoot Visual Studio detection in xmake
masterIf xmake fails to detect your Visual Studio installation correctly, you can manually specify the version using the--vsflag during configuration.