Releases: jac3km4/redscript
Releases · jac3km4/redscript
v0.2.4
v0.2.3
- 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;
v0.2.2
v0.2.1
- 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
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
andRefToBool
as a newIsDefined
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
v0.2.0-M5
- 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
v0.2.0-M3
- 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
andRefToBool
as a newIsDefined
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
- 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"
]
v0.2.0-M1
This milestone release features a new refactored compiler pipeline. The work done by the compiler is now split into smaller self-contained stages:
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));
}