Toolkit for working with scripts used by REDengine in Cyberpunk 2077. Currently includes a compiler, a decompiler and a disassembler.
Usage:
decompile [opts]
compile [opts]
Compiler options:
-i, --input INPUT input source file
-b, --bundle BUNDLE redscript bundle file to read
-o, --output OUTPUT redscript bundle file to write
Decompiler options:
-i, --input INPUT input file
-o, --output OUTPUT output file or directory
-m, --mode MODE dump mode (one of: 'ast', 'bytecode' or 'code')
-f, --dump-files split into individual files (doesn't work for everything yet)
You can build the project and decompile all scripts in one command:
cargo run --release -- decompile -i '/mnt/d/games/Cyberpunk 2077/r6/cache/final.redscript' -o classes.redscriptnote: current version requires nightly version of rust (rustup default nightly)
The scripts use a Java-like language:
public final const ref<GameObject> GetReprimandPerformer(EntityID target?) {
Agent agent;
ref<GameObject> performer;
ref<DeviceComponentPS> ps;
if(!EntityID.IsDefined(target)) {
target = GetPlayer(this.GetGameInstance()).GetEntityID();
};
if(this.m_agentsRegistry.GetReprimandPerformer(target, agent)) {
ps = this.GetPS(agent.link);
return cast<GameObject>(WeakRefToRef(ps.GetOwnerEntityWeak()));
};
return null;
}You can integrate this compiler with the game and make it compile your scripts on startup. To set that up, you need to follow these steps:
- Create
Cyberpunk 2077\engine\config\base\scripts.inifile with the contents below
[Scripts]
EnableCompilation = "true"-
Place the
scc.exetool in the following location:
Cyberpunk 2077\engine\tools\scc.exe
(The scc executable can be found in Releases) -
Now you need to add some scripts. The compiler will look for scripts in
Cyberpunk 2077\r6\scripts\
You can copy the script below toCyberpunk 2077\r6\scripts\lights.redsas an example:
@insert(CrossingLight)
protected final void PlayTrafficNotificationSound(worldTrafficLightColor status) {
return;
}this mod will disable the walk don't walk crosswalk audio