Toolkit for working with scripts used by REDengine in Cyberpunk 2077.

Related tags

Utilities redscript
Overview

redscript

Toolkit for working with scripts used by REDengine in Cyberpunk 2077. Currently includes a compiler, a decompiler and a disassembler.

usage

Usage:
  decompile [opts]
  compile [opts]
Compiler options:
  -s, --src SRC        source file or directory
  -b, --bundle BUNDLE  redscript bundle file to read
  -o, --output OUTPUT  redscript bundle file to write
Decompiler options:
  -i  --input INPUT    input redscripts bundle 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)
  -v, --verbose        verbose output (include implicit conversions)
Lint options:
  -s, --src SRC        source file or directory
  -b, --bundle BUNDLE  redscript bundle file to use, optional

You can build the project and decompile all scripts in one command:

cargo run --bin redscript-cli --release -- decompile -i '/mnt/d/games/Cyberpunk 2077/r6/cache/final.redscript' -o classes.redscript

note: current version requires nightly version of rust (rustup default nightly)

language

The scripts use a Swift-like language. You can find a brief overview of it's features in the wiki.

integrating with the game

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.ini file with the contents below
[Scripts]
EnableCompilation = "true"
  • Place the scc.exe tool 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 to Cyberpunk 2077\r6\scripts\lights.reds as an example:

@replaceMethod(CrossingLight)
protected final func PlayTrafficNotificationSound(status: worldTrafficLightColor) {
  return;
}

this mod will disable the walk don't walk crosswalk audio

You can find more script examples in resources/patches.reds in this repository.

Comments
  • Immutability/strange behavior in user-defined classes

    Immutability/strange behavior in user-defined classes

    I'm noticing some odd behavior when I attempt to use my own custom classes in Redscript. It seems like either the class is not being initialized/instantiated properly or that the variables are immutable somehow.

    Example:

    class MyTestClass123 {
        public let myTestVar: String;
    }
    
    let testClass: ref<MyTestClass123>;
    testClass = new MyTestClass123();
    testClass.myTestVar = "Hello World!";
    Log("My Test Var: " + testClass.myTestVar);
    

    There are no compilation errors here, but I would expect to log My Test Var: Hello World! to the console. The above Log statement always returns comes back with a blank value for my the field in my class: My Test Var:

    If I use a pre-existing class it returns as expected:

    public class GameAttachedEvent extends Event {
      public let isGameplayRelevant: Bool;
      public let displayName: String;
      public let contentScale: TweakDBID;
    }
    
    let evt: ref<GameAttachedEvent>;
    evt = new GameAttachedEvent();
    evt.displayName = "Hello World!";
    Log("Display Name: " + evt.displayName);
    

    Output: Display Name: Hello World!

    opened by deadlymustard 7
  • Please Setup NexusMods page for RedScript

    Please Setup NexusMods page for RedScript

    As the title says, please set up a Mod page for RedScript on NexusMods. It would only need to contain the release files and the scripts.ini within the appropriate folder structure.

    The main purpose of this is for ModManager integration so that the user does not have to search for & apply changes manually.

    If you do not want to then with your permission I would like to set it up, with full credit going to you & your team obviously.

    opened by SpudmanWP 7
  • Struct inheritance

    Struct inheritance

    Changes:

    • Struct can be abstract
    • Struct can be inherited from another struct
    • New error causes
      • class C can't inherit struct S
      • struct S can't inherit class C

    The main purpose is to get access to more native structs:

    public abstract native struct ISerializable {}
    
    public abstract native struct CResource extends ISerializable {}
    
    public native struct inkHudEntriesResource extends CResource {
    	public native let entries: array<inkHudWidgetSpawnEntry>;
    }
    
    opened by psiberx 5
  • Allow importing native structs/defining new structs

    Allow importing native structs/defining new structs

    Currently we are unable to define custom/native structs, making a select few functions in the game's codebase unusable.

    One example is the inkText widget which should allow the definition of a word-wrap policy: myInkTextWidget.SetWrappingInfo(new textWrappingInfo(true, 1000000.0, textWrappingPolicy.Default));

    Since the native struct textWrappingInfo is not exposed by default (and not able to be imported into Redscript currently) and we cannot define a custom struct we cannot actually pass in the required parameters. This makes defining custom widgets created in Redscript that also rely on text wrapping difficulty.

    There may be other similar examples in the codebase as well.

    enhancement 
    opened by deadlymustard 3
  • Corrupted scripts if parent class is declared after child

    Corrupted scripts if parent class is declared after child

    The compiler produces a corrupted scripts file if the parent class is declared after the child class.

    Test:

    public class Child extends Base {}
    public class Base {}
    
    opened by psiberx 3
  • Compiler source map fails if file doesn't end with newline

    Compiler source map fails if file doesn't end with newline

    Ran across this edge case while I was digging through a monolithic classes.redscript and documenting things as comments in the new script file I was creating. I was using single line comments and hadn't put a newline at the end, it was commenting out the function annotation in the next file in the folder alphabetically.

    Looks like it's because Files.add(...) in compiler/src/source_map.rs only splits on the newline character and just concatenates the source files together.

    Easily avoided, but a possible issue. Perhaps fix with just forcing a newline at the end of every source file?

    bug 
    opened by flibX0r 3
  • Error: CompileError(

    Error: CompileError("Function Size not found")

    During startup the compilation error popup displays Error: CompileError("Function Size not found")

    Script causing the error, copied and modified from decompiled final.redscripts:

    @insert(FullscreenVendorGameController)
    private final array<wref<gameItemData>> GetSellableJunk() {
        Int32 i;
        array<wref<gameItemData>> result;
        array<ref<gameItemData>> sellableItems;
        sellableItems = this.m_VendorDataManager.GetItemsPlayerCanSell();
        i = 0;
        while(i < Size(sellableItems)) {
            if(
                WeakRefToRef(
                    RPGManager.GetItemRecord(sellableItems[i].GetID()).ItemType()
                ).Type() == gamedataItemType.Gen_Junk
                || WeakRefToRef(
                    RPGManager.GetItemRecord(sellableItems[i].GetID()).ItemType()
                ).Type() == gamedataItemType.Con_Edible
            ) {
                Push(result, RefToWeakRef(sellableItems[i]));
            };
            i += 1;
        };
        return result;
    }
    
    opened by fre-sch 3
  • wrapMethod causes issues with callbacks

    wrapMethod causes issues with callbacks

    • @wrapMethod creates one method for every wrapper, but it looks like the game invokes every cb method on a class, so all of the wrappers get invoked
    • cb methods should take exactly one argument and it's type should extend Event, this could be enforced by the compiler
    opened by jac3km4 2
  • UTF8 String Decoding

    UTF8 String Decoding

    Updated the string decode method to support multibyte characters.

    Added a test case for string literals too, but had to comment out the ResRef test as it's not defined in predef.redscripts

    opened by flibX0r 2
  • How to make old version scripts compatible for v0.3.0-RC1

    How to make old version scripts compatible for v0.3.0-RC1

    Thanks for your great work! I'm trying to use some older-version scripts with redscript v0.3.0-RC1 but encountered errors such as: Member HasStatFlag not found on DefaultTransition Is there any easy hack for older-version scripts being compatible with v0.3.0-RC1? Many thanks

    question 
    opened by DUTANGx 2
  • Cannot extend classes defined in modules

    Cannot extend classes defined in modules

    Presumably due to the name mangling that makes modules work. Fixable with a pass over all the classes in the pool and update their base class name?

    Example: If I define a module:

    module BaseModule
    
    public class BaseClass {
      public func Foo() -> Void { Log("Base!"); }
    }
    

    and then in another script attempt to extend it:

    import BaseModule.BaseClass
    
    public class DerivedClass extends BaseClass {
      public func Foo() -> Void { Log("Derived!");  }
    }
    

    redscript is happy to compile it but Cyberpunk throws an error: Cyberpunk2077_Error

    bug 
    opened by flibX0r 2
  • 0.5.9 - CLI does not run without optional arguments

    0.5.9 - CLI does not run without optional arguments

    There are no required arguments listed. Everything under compiler options is optional. My view is, without any arguments, it should run the same as if it was invoked during game launch.

    d:\GAMES\Cyberpunk\r6\scripts>redscript-cli.exe compile
    [INFO] missing required option `--src`
    Usage:
      decompile  [opts]
      compile    [opts]
      lint       [opts]
    Compiler options:
    Optional arguments:
      -s, --src SRC        source file or directory
      -b, --bundle BUNDLE  redscript bundle file to use
      -o, --output OUTPUT  redscript bundle file to write
    Decompiler options:
    Optional arguments:
      -i, --input INPUT    input redscripts bundle file
      -o, --output OUTPUT  output file or directory
      -m, --mode MODE      dump mode (one of: 'ast', 'bytecode' or 'code')
      -f, --dump-files     split output into individual files
      -v, --verbose        verbose output (include implicit conversions)
    Lint options
    Optional arguments:
      -s, --src SRC        source file or directory
      -b, --bundle BUNDLE  redscript bundle file to use, optional
    

    Thanks for checking!

    opened by Csimbi 2
  • Optimize cache access and generation

    Optimize cache access and generation

    • Deserialize cache using a zero alloc parser.
    • Analyse effects of pooling file contents using bumpalo.
    • Analyse effects of decoupled producer-consumer-pattern using crossbeam.
    • You tell me
    opened by ProphetLamb 0
  • Error recovery using lexer parser separation

    Error recovery using lexer parser separation

    Currently, the compilation is unable to produce more than one error, even if this is a recoverable error. This PR implements a diagnostic pipeline that allows definition of arbitrary diagnostics and logging during paring.

    Error recovery using a single stage parser is not really feasible. So we split between parser and lexer. The lexer allocates memory when unescaping string literals, otherwise only a stream of slices is produced. I am currently looking into if error recovery is possible in PEG without producing a bad grammar. For now, all solution I could find are ugly, because PEG doesn't allow us to access the underlying stream. So I am probably going to port the Backus Naur like PEG syntax to a parser combinator (nom).

    How to report diagnostics

    the diag_report! macro accepts either a Span or a Range<Span> to report an error. Diagnostic messages must be predefined, as constants.

    fn str_char_invalid(is: Span) -> IResult<Option<char>> {
        let (i, c) = preceded(char('\\'), anychar)(is.clone())?;
        diag_report!((&is..&i), ERR_INVALID_ESCAPE, c);
        Ok((i, None))
    }
    

    diag produces error messages similar to rust.

    error[ELN0001]: Invalid integer `02439853427592345284395923845320459823457324953247640359104519845834634538`, number too large to fit in target type
    --> test.reds:1:0 to l1:74
    | 02439853427592345284395923845320459823457324953247640359104519845834634538
    

    TODO

    • [x] Is PEG Error Recovery possible ? implement : port to nom
    • [ ] Actually integrate the ported AST into the compiler pipeline
    • [ ] Dont use a boxed AST, instead use a pooled AST via context references. (needed for syntax receivers for additional diagnostics and quick fixes)
    opened by ProphetLamb 11
  • Ability to add new members for enums

    Ability to add new members for enums

    Is there any chance for a way we can extend enums with Redscript in the future?

    I'm talking about syntax very similar to addField annotation for enums? It should not break any existing enum dependent code blocks if im not mistaking, right?

    One of the requests on Discord:

    They're used a lot in handling events. Basically my use-case is wanting to potentially add another state to one of the existing enums so that the components listening to it can respond accordingly.

    My use-case is actually same: For example, I cannot add new sorting options to the game because to achieve this I have to update every place where ItemSortMode is used. Event handlers like OnDropdownItemClickedEvent use enums like this.

    It's a shame we can't add new members to enums. But I'm not sure about feasibility of this.

    opened by b8kkyn 0
  • Lint hangs when @wrapMethod is used with an incorrect header

    Lint hangs when @wrapMethod is used with an incorrect header

    This is similar to the block I had in my code, which caused lint to hang and grow in size until memory limits were reached:

    @wrapMethod(hudCarController)
    protected cb func OnRpmValueChanged()  -> Void {
      wrappedMethod();
    }
    

    Just for reference, this is the correct header that returns as normal;

    @wrapMethod(hudCarController)
    protected cb func OnRpmValueChanged(rpmValue: Float)  -> Void {
      wrappedMethod(rpmValue);
    }
    

    Thanks for all your work on this!

    bug 
    opened by jackhumbert 1
Releases(v0.5.10)
  • v0.5.10(Dec 23, 2022)

  • v0.6.0-M4(Dec 17, 2022)

  • v0.6.0-M2(Dec 7, 2022)

  • v0.6.0-M1(Nov 28, 2022)

    [0.6.0-M1] - 2022-11-28

    This is a preview milestone release, not intended for regular users. The notable missing feature are annotations.

    Bug Fixes

    • Make is_same_shape work for primitives (7cb3ec77c50a1dc71e128c0767b2cfda5dedb41f)

    Features

    • Error reporting for unimplemented methods (b4f65e7d97de2f90b04551f50417afa0d6519528)
    • Re-add switch-case (b8ea485d5ee8ac6ba50663aee8d7e8cbe32d5dff)
    • Re-add for-in loops, string interpolation and array literals (3b2b5b8ed411a59d7ebe0991e82533cd6ccfa37d)

    Contributors

    • jekky
    Source code(tar.gz)
    Source code(zip)
    redscript-cli.exe(1.97 MB)
    redscript-v0.6.0-M1.zip(706.01 KB)
  • v0.6.0-M0(Nov 20, 2022)

    [0.6.0-M0] - 2022-11-20

    This is a preview release, which is expected to be buggy and incomplete. The details about features coming in 0.6 can be found here. Notable missing features that are yet to be added are:

    • most annotations except replaceMethod
    • syntax sugar for arrays and for-in loops
    • switch case

    Features

    • Revamped type system (b9b70eca69614a4caa800f660f2d8a14f58f3729)
    • Struct&enum boxing and missing boxed types (b6b52ef8d44a396d8f1ba9c1c86dc62ab849f073)
    • Re-add struct&enum support (17e109afcd99d570130e104c0a399431b2fd0053)
    • Proper handling of overriden generics (76866f5e6a1f5fd744bd4b7447f21e52a52ec110)
    • Slightly better errors (0417085af6e14c9e61cf96ae31a0e721ccc4d4f1)
    • Re-add replaceMethod annotation (607e59e3dda0ebb3157c6bcb1905af9ac8d9b113)

    Contributors

    • jekky
    Source code(tar.gz)
    Source code(zip)
    redscript-cli.exe(1.88 MB)
    redscript-v0.6.0-M0.zip(684.03 KB)
  • v0.5.9(Nov 5, 2022)

  • v0.5.8(Sep 17, 2022)

  • v0.5.7(Sep 14, 2022)

  • v0.5.7-RC1(Sep 14, 2022)

  • v0.5.6(Sep 13, 2022)

    • added support for running redscript along with redmod scripts (6a9258fdcd8269b9b38bea84ee1d432939b902c6)
      • in order to use redmods with redscript you need to install a new tool cybercmd, the redscript release zip contains configuration which will get picked up by cybercmd automatically once installed
    • moved logs to r6/logs and added a new flag for splitting logs files by date (cf1bbc22b41120acb2fcf34da98e66036779c876) (by @ForserX)
    • fixed some edge cases around class sorting (b623a189d75d44c65ce2aa9f961edf73c3ac73c7)
    • changed scc to return an error status code on failures (91ca225a8af5cc9a3c906a7b788962917069a1fa)
    Source code(tar.gz)
    Source code(zip)
    redscript-cli.exe(1.78 MB)
    redscript-mod-v0.5.6.zip(654.55 KB)
  • v0.5.6-RC1(Sep 11, 2022)

    • added support for running redscript along with redmod scripts via cybercmd (6a9258fdcd8269b9b38bea84ee1d432939b902c6)
    • moved logs to r6/logs and added a new flag for splitting logs files by date (cf1bbc22b41120acb2fcf34da98e66036779c876) (by @ForserX)
    • fixed some edge cases around class sorting (b623a189d75d44c65ce2aa9f961edf73c3ac73c7)
    • changed scc to return an error status code on failures (91ca225a8af5cc9a3c906a7b788962917069a1fa)
    Source code(tar.gz)
    Source code(zip)
    redscript-cli.exe(1.78 MB)
    redscript-mod-v0.5.6-RC1.zip(654.73 KB)
  • v0.5.5(Jun 30, 2022)

    • support field defaults (2a15c1eb12a9523ba065accc1224bd1f477b4358)
    // you can define defaults for fields in classes and structs
    // the defaults can only be constants, they cannot contain any complex expressions
    class Class {
        let int: Int32 = 1000;
        let enum: EPriority = EPriority.Medium;
        let float: Float = 1.0;
        let string: String = "string";
        let name: CName = n"name";
    }
    
    • improve number literal parsing (d06f14c715c18705adfba421619f7a2421be2986)
      • unsigned long literals are now allowed (e.g. 18446744073709551615ul)
      • this also fixes an issue with enums that use negative integers
    • better handling of conflicting field additions (da4af0573a6e84a707c49d459783190371dae09d)
      • multiple @addField with the same name will now result in only one field being added to the class (to prevent game crashes)
      • a warning will now be emitted for each conflict
    • disable optional diagnostics in scc (to minimize game startup overhead) (3886dd082d466379f62a2b56d374eccb62fa370a)
    • support runtime properties (caf8c442de0887b9d544a6e237be02a01e0598ff)
    class Class {
        @runtimeProperty("myText", "Lorem ipsum dolor sit amet, consectetur adipiscing elit")
        let int: Int32;
    }
    
    Source code(tar.gz)
    Source code(zip)
    redscript-cli.exe(1.77 MB)
    redscript-mod-v0.5.5.zip(642.78 KB)
  • v0.5.4(Apr 29, 2022)

  • v0.5.3(Apr 24, 2022)

    Notable Changes:

    • local initializers - fixes surprising behavior with some types, particularly arrays (4870193b2493d158106e6f241f760fef89024bfa, 766b6aa6c0fa042a22d955e8d29ad96df260c8cb)
    • various improvements for diagnostics (3fb78638c137fabc7da04cf436b45756a63a2b9f)
    • various compiler optimizations (5a97c0d39a0cdfaf02ef711a70ca175faf01d012, e487792e820fdf4eee085b78a9d1b374a7531c4e)

    Contributors:

    git shortlog -sn --no-merges v0.5.2..v0.5.3
        23  jekky
    
    Source code(tar.gz)
    Source code(zip)
    redscript-cli.exe(1.71 MB)
    redscript-mod-v0.5.3.zip(625.55 KB)
  • v0.5.2(Mar 9, 2022)

    Notable Changes:

    • fix an operator precedence issue (f0edc543396ebb10d9748ea100cb533965d0dc4c)
    • fix a multi-byte character issue (b9b1adb78c6f03e582614400380b1ffd2740f1d3)
    • add experimental support for structs (a9f44b5763131075525c062504eec4d6fdfbafac)
    • add basic diagnostics for unused variables and missing return statements (c1573ecba707da64aba71c78ea87e4c69bbaf130)

    Contributors:

    git shortlog -sn --no-merges v0.5.1..v0.5.2
        9  jekky
    
    Source code(tar.gz)
    Source code(zip)
    redscript-cli.exe(1.69 MB)
    redscript-mod-v0.5.2.zip(617.79 KB)
  • v0.5.1(Feb 23, 2022)

    Notable Changes:

    • fix an encoding issue which would cause the game to hang for 10 seconds before starting (af8857e6c22c5204c6b643b1193a39302b578686)
    • handle empty CNames correctly (e980cc5cb553db4b1da542a216f38ec072b765a0)
      • this enables use of methods like TDBID.None and enum members which were previously shown as Unknown
    • only show fatal errors in the scc popup (the previous behaviour would misleadingly show mods with compilation warnings as broken) (fc02231bcdd52d6d3621f306246c77a4ca77dd93)
    • log a nice warning when running against an incompatible game version (5f038bbf8d470d8875f4bfc7e096dfa01c46742f)
    • fix an issue which would lead to confusing pool errors (53e55a02b05f07c6bd4f2551b883a31daf68c6d9)
    • be more permissive for some uses of null (like in IsDefined) (ad5d21bd32aabf87b1575d493f7102f0a37fa54b)

    Contributors:

    git shortlog -sn --no-merges v0.5.0..v0.5.1
        14  jekky
    
    Source code(tar.gz)
    Source code(zip)
    redscript-cli.exe(1.63 MB)
    redscript-mod-v0.5.1.zip(603.87 KB)
  • v0.5.0(Feb 16, 2022)

  • v0.5.0-RC1(Feb 15, 2022)

  • v0.4.2(Feb 7, 2022)

  • v0.4.1(Jan 2, 2022)

  • v0.4.0(Jan 1, 2022)

    Notable Changes:

    • add string interpolation (493b983)
    // create interpolated strings using the 's' prefix
    // expressions inside the \() blocks will be converted to strings
    Log(s"My name is \(name) and I am \(year - birthYear) years old");
    
    • add conditional compilation (currently restricted to classes, functions and imports) (1fc9d2c)
    module My.Mod
    // conditional import
    // it'll be available only when the module is present
    @if(ModuleExists("Other.Mod"))
    import Other.Mod.*
    
    // you can write two different versions of a function based on existence of another module
    // imports from Other.Mod will be available only in the first version, since the import was conditional
    @if(ModuleExists("Other.Mod"))
    func Testing() -> Int32 {
        return 1;
    }
    @if(!ModuleExists("Other.Mod"))
    func Testing() -> Int32 {
        return 2;
    }
    
    • enforce basic correctness rules for native and abstract classes/functions (da8dd33)
    • allow native and importonly classes (d2070bb)
    • allow semicolon after all function declarations (f91bb35)
    • fix an issue affecting locals with conflicting names (50c6955)
    • extended support for Variant native type (c9850e6)
      • added implicit ToVariant() conversion when the expected TypeId is Variant
      • added the remaining Variant intrinsic operations (VariantIsRef, VariantIsArray and VariantTypeName)
      • extended ToString() and IsDefined() intrinsics to support their Variant counterparts
    // Implicit conversion
    let v: Variant = new SomeClass();
    // ToString support
    let s: String = ToString(v);
    // Get the type stored in a variant
    let n: CName = VariantTypeName(v);
    // IsDefined support and variant intrinsics
    if IsDefined(v) && VariantIsRef(v) && !VariantIsArray(v) {
      // ...
    }
    
    • new function resolution algorithm (8d604af)
      • the new algorithm is a bit more strict, but it makes operator overloads and casts work more predictably
      • it no longer allows using expressions that can resolve to different types inside 'overloaded' contexts - this means that you can no longer use Cast(x), FromVariant(x) and IntEnum(x) inside calls to operators, overloaded methods and casts
      • a new syntax has been introduced to solve this - you can now write Cast<Float>(x), FromVariant<ItemID> and IntEnum<gamedataItemType> to explicitly specify the desired type
      • most of your code will probably still work - this change rarely affects anything except for Castss inside operators
      • the decompiler was updated to generate code that conforms to the new algorithm
    func Testing() {
      // the line below will no longer compile!
      // let a = 0.1 + Cast(1);
      // you can write it like this:
      let a = 0.1 + Cast<Float>(1);
      // IMPORTANT
      // you can make your code forwards-compatible though!
      // you can support both versions of the redscript compiler by extracting the Cast to a local:
      let tmp: Float = Cast(1);
      let a = 0.1 + tmp;
    }
    
    • improved type inference for conditionals and array literals (79d2dc8)
    func Testing() {
        // we infer the most general type to use for the array (array<ref<a>>)
        let a = [ new C(), new B(), new D() ];
        // the type of 'b' is ref<B>
        let b = true ? new C() : new B();
    }
    
    class A {}
    class B extends A {}
    class C extends B {}
    class D extends A {}
    

    Contributors:

    git shortlog -sn --no-merges v0.3.4..v0.4.0        
        44  jekky
         1  Reece Sheppard
    
    Source code(tar.gz)
    Source code(zip)
    redscript-cli.exe(1.62 MB)
    redscript-mod-v0.4.0.zip(586.80 KB)
  • v0.4.0-RC2(Dec 11, 2021)

    Notable Changes:

    • extended support for Variant native type (c9850e6)
      • added implicit ToVariant() conversion when the expected TypeId is Variant
      • added the remaining Variant intrinsic operations (VariantIsRef, VariantIsArray and VariantTypeName)
      • extended ToString() and IsDefined() intrinsics to support their Variant counterparts
    // Implicit conversion
    let v: Variant = new SomeClass();
    // ToString support
    let s: String = ToString(v);
    // Get the type stored in a variant
    let n: CName = VariantTypeName(v);
    // IsDefined support and variant intrinsics
    if IsDefined(v) && VariantIsRef(v) && !VariantIsArray(v) {
      // ...
    }
    
    • new function resolution algorithm (8d604af)
      • the new algorithm is a bit more strict, but it makes operator overloads and casts work more predictably
      • it no longer allows using expressions that can resolve to different types inside 'overloaded' contexts - this means that you can no longer use Cast(x), FromVariant(x) and IntEnum(x) inside calls to operators, overloaded methods and casts
      • a new syntax has been introduced to solve this - you can now write Cast<Float>(x), FromVariant<ItemID> and IntEnum<gamedataItemType> to explicitly specify the desired type
      • most of your code will probably still work - this change rarely affects anything except for Castss inside operators
      • the decompiler was updated to generate code that conforms to the new algorithm
    func Testing() {
      // the line below will no longer compile!
      // let a = 0.1 + Cast(1);
      // you can write it like this:
      let a = 0.1 + Cast<Float>(1);
      // IMPORTANT
      // you can make your code forwards-compatible though!
      // you can support both versions of the redscript compiler by extracting the Cast to a local:
      let tmp: Float = Cast(1);
      let a = 0.1 + tmp;
    }
    
    • improved type inference for conditionals and array literals (79d2dc8)
    func Testing() {
        // we infer the most general type to use for the array (array<ref<a>>)
        let a = [ new C(), new B(), new D() ];
        // the type of 'b' is ref<B>
        let b = true ? new C() : new B();
    }
    
    class A {}
    class B extends A {}
    class C extends B {}
    class D extends A {}
    

    Contributors:

    git shortlog -sn --no-merges v0.4.0-RC1..v0.4.0-RC2
    
         14  jekky
         1  Reece Sheppard
    
    Source code(tar.gz)
    Source code(zip)
    redscript-cli.exe(1.64 MB)
    redscript-mod-v0.4.0-RC2.zip(595.45 KB)
  • v0.4.0-RC1(Nov 4, 2021)

    This is a pre-release mainly targeted at developers, not end users! If you're just looking for the latest version, check the 0.3.x release series.

    Notable Changes:

    • add string interpolation (493b983)
    // create interpolated strings using the 's' prefix
    // expressions inside the \() blocks will be converted to strings
    Log(s"My name is \(name) and I am \(year - birthYear) years old");
    
    • add conditional compilation (currently restricted to classes, functions and imports) (1fc9d2c)
    module My.Mod
    // conditional import
    // it'll be available only when the module is present
    @if(ModuleExists("Other.Mod"))
    import Other.Mod.*
    
    // you can write two different versions of a function based on existence of another module
    // imports from Other.Mod will be available only in the first version, since the import was conditional
    @if(ModuleExists("Other.Mod"))
    func Testing() -> Int32 {
        return 1;
    }
    @if(!ModuleExists("Other.Mod"))
    func Testing() -> Int32 {
        return 2;
    }
    
    • enforce basic correctness rules for native and abstract classes/functions (da8dd33)
    • allow native and importonly classes (d2070bb)
    • allow semicolon after all function declarations (f91bb35)
    • fix an issue affecting locals with conflicting names (50c6955)

    Contributors:

    git shortlog -sn --no-merges v0.3.3..v0.3.4
    
        24  jekky
    
    Source code(tar.gz)
    Source code(zip)
    redscript-cli.exe(1.60 MB)
    redscript-mod-v0.4.0-RC1.zip(575.33 KB)
  • v0.3.4(Oct 11, 2021)

  • v0.3.3(Sep 24, 2021)

    Notable Changes:

    • use mmap for reading script bundles - this dramatically reduces startup time of the compiler (especially on HDDs) (8fa3ee1f8190c1201f2e190f74a3a954063b066b)
    • add implicit conversions on member access (048852757a705dabe1140971037b1b8bf6e002b9)
    • fix a switch-case fallthrough bug in the decompiler (9145e0d1eab4ad33ea6bd733f60ef54aa8d1a3a6)

    Contributors:

    git shortlog -sn --no-merges v0.3.2..v0.3.3
    
         7  jekky
    
    Source code(tar.gz)
    Source code(zip)
    redscript-cli.exe(1.51 MB)
    redscript-mod-v0.3.3.zip(546.59 KB)
  • v0.3.2(Sep 14, 2021)

    Notable Changes:

    • no longer stop at the first error when compiling functions (9c284208a25a2d3db90a701ff60a879de13ca506)
      • the compiler will output all errors in the stdout
      • the error popup in scc.exe will list all broken scripts on startup (not just the first one)
      • it's limited to errors inside function bodies for now
    • do not allow class redefinitions (06336d81d0208a326aca79c3e36fcff8bb91b1c3)
    • fix duplication of classes in the decompiler output (0dcce57e22743af7ef327cfe2255d6e53c083f75)

    Contributors:

    git shortlog -sn --no-merges v0.3.1..v0.3.2
    
         7  jekky
    
    Source code(tar.gz)
    Source code(zip)
    redscript-cli.exe(1.49 MB)
    redscript-mod-v0.3.2.zip(538.40 KB)
  • v0.3.1(Aug 24, 2021)

  • v0.3.0(Aug 23, 2021)

    Notable Changes:

    • support for the 1.3 patch - this is the first version of the compiler that drops compatibility with older versions of the game due to many breaking changes in the binary format of the scripts introduced in the patch (6e7030e)
    • fix an issue with mixed wrap/replace annotations (d75382f)
    • fix an issue with return instructions being encoded incorrectly in void functions (147e512)
    • improvements to method resolution compilation errors (5b11ebf)
    • sort classes after compilation to prevent game crashes (364d3d4)

    Contributors:

    git shortlog -sn --no-merges v0.2.4..v0.3.0
    
        22  jekky
         1  Reece Sheppard
    
    Source code(tar.gz)
    Source code(zip)
    redscript-cli.exe(1.50 MB)
    redscript-mod-v0.3.0.zip(525.47 KB)
  • v0.3.0-RC3(Aug 21, 2021)

  • v0.3.0-RC2(Aug 21, 2021)

Owner
jac3km4
jac3km4
A working example of multi targets compilation for Rust using Github Actions.

A working example of multi targets compilation for Rust using Github Actions. Supports Windows, MacOSX, x86_64, ARM and Raspberry PI Linux.

Nicolas Vanhoren 41 Dec 17, 2022
IDX is a Rust crate for working with RuneScape .idx-format caches.

This image proudly made in GIMP License Licensed under GNU GPL, Version 3.0, (LICENSE-GPL3 or https://choosealicense.com/licenses/gpl-3.0/) Contributi

Ceikry 5 May 27, 2022
Rust libraries for working with GPT (GUID Partition Table) disk data

gpt-disk-rs no_std libraries related to GPT (GUID Partition Table) disk data. There are three Rust packages in this repository: uguid The uguid packag

Google 25 Dec 24, 2022
A Rust utility library, making easier by taking the hassle out of working. :octocat:

reddish A Rust utility library, making easier by taking the hassle out of working. Usage Add this to your Cargo.toml: [dependencies] reddish = "0.2.0"

Rogério Araújo 12 Jan 21, 2023
Cargo wrapper for working with Webassembly wasi(x).

cargo-wasix A cargo subcommand that wraps regular cargo commands for compiling Rust code to wasix, a superset of Websassembly wasi with additional fun

WASIX 19 Jun 12, 2023
Fusion is a cross-platform App Dev ToolKit build on Rust . Fusion lets you create Beautiful and Fast apps for mobile and desktop platform.

Fusion is a cross-platform App Dev ToolKit build on Rust . Fusion lets you create Beautiful and Fast apps for mobile and desktop platform.

Fusion 1 Oct 19, 2021
The Roguelike Toolkit (RLTK), implemented for Rust.

The Roguelike Toolkit (RLTK), implemented for Rust.

Amethyst Foundation 1.1k Jan 6, 2023
Rust crate for reading SER files used in astrophotography

Rust crate for reading SER files used in astrophotography.

Andy Grove 2 Oct 4, 2021
Used to generate and compare bounded timestamps.

ClockBound Summary: ClockBound allows you to generate and compare bounded timestamps that include accumulated error as reported from the local chronyd

Amazon Web Services 149 Nov 28, 2022
A VtubeStudio plugin that allows iFacialMocap to stream data to the app, enabling full apple ARkit facial tracking to be used for 2D Vtuber models.

facelink_rs A VtubeStudio plugin that allows iFacialMocap to stream data to the app, enabling full apple ARkit facial tracking to be used for 2D Vtube

Slashscreen 2 May 6, 2022
A set of bison skeleton files that can be used to generate a Bison grammar that is written in Rust.

rust-bison-skeleton A set of bison skeleton files that can be used to generate a Bison grammar that is written in Rust. Technically it's more like a B

Ilya Bylich 12 Dec 14, 2022
Common utilities code used across Fulcrum Genomics Rust projects

fgoxide Common utilities code used across Fulcrum Genomics Rust projects. Why? There are many helper functions that are used repeatedly across project

Fulcrum Genomics 2 Nov 2, 2022
An implementation of the SMP protocol as used in zephyr, mcuboot, mcumgr, and more.

SMP An implementation of the SMP protocol in pure Rust. This repository contains: ./mcumgr-smp: A SMP library implementation to be used in your own pr

Gessler GmbH 3 Dec 10, 2023
🤖CyberAI is designed to bridge the world of Cyberpunk 2077 and the power of OpenAI's AI technology.

CyberAI ?? Welcome to the CyberAI project! This plugin for Cyberpunk 2077 enables integration between the videogame and OpenAI API, opening a world of

Kirill Kuzin 19 Jul 28, 2023
Easy c̵̰͠r̵̛̠ö̴̪s̶̩̒s̵̭̀-t̶̲͝h̶̯̚r̵̺͐e̷̖̽ḁ̴̍d̶̖̔ ȓ̵͙ė̶͎ḟ̴͙e̸̖͛r̶̖͗ë̶̱́ṉ̵̒ĉ̷̥e̷͚̍ s̷̹͌h̷̲̉a̵̭͋r̷̫̊ḭ̵̊n̷̬͂g̵̦̃ f̶̻̊ơ̵̜ṟ̸̈́ R̵̞̋ù̵̺s̷̖̅ţ̸͗!̸̼͋

Rust S̵̓i̸̓n̵̉ I̴n̴f̶e̸r̵n̷a̴l mutability! Howdy, friendly Rust developer! Ever had a value get m̵̯̅ð̶͊v̴̮̾ê̴̼͘d away right under your nose just when

null 294 Dec 23, 2022
A simple menu to keep all your most used one-liners and scripts in one place

Dama Desktop Agnostic Menu Aggregate This program aims to be a hackable, easy to use menu that can be paired to lightweight window managers in order t

null 47 Jul 23, 2022
A language-agnostic "shebang interpreter" that enables you to write scripts in compiled languages.

Scriptisto It is tool to enable writing one file scripts in languages that require compilation, dependencies fetching or preprocessing. It works as a

Igor Petruk 238 Dec 30, 2022
FlatBuffers compiler (flatc) as API (with focus on transparent `.fbs` to `.rs` code-generation via Cargo build scripts integration)

FlatBuffers flatc API for Rust This crate provides a programmatical way to invoke flatc command (e.g. from build.rs) to generate Rust (or, in fact, an

Vlad Frolov 87 Dec 22, 2022
Jyoti - A simple IRC bot for use with shell scripts

Jyoti - A simple IRC bot for use with shell scripts Zero dependencies. Simple usage. Hackable. Usage The idea is that Jyoti can be repurposed easily w

Lee 15 Aug 13, 2022
Some bunch of test scripts to generate a SQLite DB with 1B rows in fastest possible way

To find out the fastest way to create an SQLite DB with 1B random rows.

null 309 Dec 20, 2022