Skip to content

Releases: jac3km4/redscript

v0.2.4

26 Jul 20:13
274ab80
Compare
Choose a tag to compare
  • fix a regression that would cause errors when compiling empty modules

v0.2.3

26 Jul 01:05
bc88599
Compare
Choose a tag to compare
  • experimental support for method wrappers (39bac6a)
// you can now wrap existing methods like this
@wrapMethod(SingleplayerMenuGameController)
private func PopulateMenuItemList() {
  wrappedMethod(); // this will call the original PopulateMenuItemList
  this.AddMenuItem("MY FIRST CUSTOM BUTTON", n"OnDebug");
}

// you can chain them too - this function will wrap around the previous one
@wrapMethod(SingleplayerMenuGameController)
private func PopulateMenuItemList() {
  wrappedMethod(); // this will call the previous wrapper
  this.AddMenuItem("MY SECOND CUSTOM BUTTON", n"OnDebug");
}

// you can also modify parameters passed to the wrapped method
// or/and even return a different value from the method
@wrapMethod(CraftingSystem)
private final func ProcessCraftSkill(xpAmount: Int32, craftedItem: StatsObjectID) {
  wrappedMethod(xpAmount * 100, craftedItem);
}
  • support for the native qualifier for fields (16d9d1e)
// this can be used to access fields that are normally not exported in the scripts
@addField(MinimapContainerController)
native let visionRadiusVehicle: Float;
  • support for |= and &= operators (1b0ccf0)
  • permit profiler and debug instructions in the decompiler (4518d2b)
  • use a much more efficient map data structure for modules (6efbbc2)

v0.2.2

16 Jun 14:24
Compare
Choose a tag to compare
  • add support for abstract and final qualifiers on classes (23b5c05) (thanks to @flibX0r)
  • lock the timestamp file to prevent multiple instances of scc.exe from writing to the script cache leaving it corrupted (c45fb73)
  • do not allow the use of static methods from object instances (fb2db2d)

v0.2.1

18 Apr 23:06
Compare
Choose a tag to compare
  • fix several decompiler bugs (e167e39, bcc32e0, 7826864)
  • fix an issue where the compiler would do nothing when passed a path to a single file (5826d0f)
  • propagate fatal errors from the compiler (06a15f1)
  • adjust the error/warning format for easier use in the extension (36f1bc9)
  • if you use the VS code extension you'll need to update it to v0.2.1 for this version of the CLI

v0.2.0

17 Apr 16:06
Compare
Choose a tag to compare

Feature changes

  • added a basic module system (87da71f)
// the module header is optional
// if you don't define one then all the definitions in the file will be added to the global scope
module MyMod
// you can import all (public) definitions from a module
import MySharedModule.*
// or import specific ones
import MyHelpers.StringBuilder
// import MyHelpers.{StringBuilder, HashMap} is also allowed

// public definitions are automatically exported and available in other modules
// you'd access it through import MyMod.DoStuff
public func DoStuff() {}
  • added for-in syntax for loops (5c6c83c)
for photoModeItem in photoModeItmsArr {
  RPGManager.SendPhotoModeItemUnlockRequest(gi, photoModeItem);
}
  • added array literal syntax (5e976a0)
for i in [0, 1, 2, 3] {
  Log(ToString(i));
}
  • added support for custom enum definitions (9d5c2c8)
enum Direction {
  Left = 0,
  Right = 1,
}
  • added support for break statements (in loops and switches) (1d84389)
  • exposed both WeakRefToBool and RefToBool as a new IsDefined operation (supported in the decompiler as well) (22a92ac)
  • added support for a script manifest file laying the groundwork for basic mod management (r6/scripts/redscript.toml) (71e3106)
  • added support for character escapes in strings (f1834a1 thanks to @flibX0r)
  • relaxed the handling of number literals (e.g. 1 can be assigned to Float etc.) (7e768ba)
  • various decompiler improvements (c827850, 113798f, 9be4825, 83ef9a8)

Bugfixes

  • fixed a codegen issue present when multiple switch cases matched the same body (1d84389)
  • fix an issue with some classes that were inaccessible before due to missing type definitions (9ffa48f)
  • many others...

v0.2.0-M5

16 Apr 23:36
Compare
Choose a tag to compare
v0.2.0-M5 Pre-release
Pre-release
  • type checker improvements (ae3d3d1, efb106b, cf7f823)
  • merge assignments with declarations where possible in the decompiler (c827850)
  • emit IntEnum call for code that refers to unnamed enum members in the decompiler (113798f)
  • emit super keyword where applicable in the decompiler (9be4825)
  • insert parenthesis where required in the decompiler (83ef9a8)

v0.2.0-M4

16 Apr 01:01
Compare
Choose a tag to compare
v0.2.0-M4 Pre-release
Pre-release
  • support custom enum definitions (9d5c2c8)
enum Direction {
  Left = 0,
  Right = 1,
}
  • fix an issue with the import parser (3434e45)
  • fix an issue with parse error locations (7fc645a)

v0.2.0-M3

15 Apr 03:45
Compare
Choose a tag to compare
v0.2.0-M3 Pre-release
Pre-release
  • implement a basic module system (87da71f)
// the module header is optional and if you don't have one then all the definitions in the file will be added to the global scope
module MyMod
// you can import all definitions from a module
import MySharedModule.*
// or import specific ones
import MyHelpers.StringBuilder
// import MyHelpers.{StringBuilder, HashMap} is also allowed

// public definitions are automatically exported and available in other modules
// you'd access it through import MyMod.DoStuff
public func DoStuff() {}
  • expose both WeakRefToBool and RefToBool as a new IsDefined operation (supported in the decompiler as well) (22a92ac)
// you can now write
if IsDefined(myRef) {}
  • fix an issue with some classes that were inaccessible before due to missing type definitions (9ffa48f)
  • fix a bug with escaped literals not being transformed correctly (6bee9bd thanks to @flibX0r)
  • fix a regression present when calling base class method overloads (bc303eb)
  • fix compiler panics on certain kinds of intrinsic calls (436c75d)
  • enforce correct function resolution in the desugar stage (a9d24c6)

v0.2.0-M2

09 Apr 14:25
Compare
Choose a tag to compare
v0.2.0-M2 Pre-release
Pre-release
  • add support for break statements (1d84389)
  • load a script manifest before compilation (from r6/scripts/redscript.toml) laying the groundwork for basic mod management, currently the manifest file only allows disabling specific mods as shown below (71e3106)
exclusions = [
  "disableCallRestrictions",
  "policeMotorcycleChases"
]
  • add support for character escapes in strings (f1834a1 thanks to @flibX0r)
  • fix a regression with implicit conversions present in 0.2.0-M1 (aa902d3)
  • fix a codegen issue present when multiple switch cases matched the same body (1d84389)
  • fix and improve compiler errors in some cases (adbc68f, 192bd50)

v0.2.0-M1

22 Mar 20:19
Compare
Choose a tag to compare
v0.2.0-M1 Pre-release
Pre-release

This milestone release features a new refactored compiler pipeline. The work done by the compiler is now split into smaller self-contained stages:

Diagram

This makes the compiler more extensible (through use of a generic AST transformer) and unlocks many potential feature changes like generics and lambdas.
This is primarily not a feature release but it does add some new exciting things (thanks to the new desugar stage):

  • array literal expressions
let ints = [1, 2, 3, 4, 5];
  • for-in loops
for photoModeItem in photoModeItmsArr {
  RPGManager.SendPhotoModeItemUnlockRequest(gi, photoModeItem);
}
  • you can even combine both
for i in [0, 1, 2, 3] {
  Log(ToString(i));
}