diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f32a1c..78bdf11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,16 @@ ### 1.0.5 +- add [TypeScript support](https://re.cleo.li/docs/en/typescript.html) - add support for commands using global SCM variables (e.g. counters or timers). - delete previously deprecated variable `GAME`. Use `HOST` instead - update script watcher: changing `.mjs` files in a script directory or any nested directories triggers script reload - `FxtStore` can be forced to mutate global FXT keys by setting the last argument in `FxtStore.insert` and `FxtStore.delete` to true +- `is_variadic` attribute is no longer used in JIT compilation of commands with the `arguments` type **SDK AND PLUGINS** -- update IdeLoader to 1.2: fixed a parser bug that prevented `.ide` files with a `2dfx` section to be loaded -- update Frontend to 1.1: reduce timeout during a check for updates to 10 seconds +- IdeLoader 1.2: fixed a parser bug that prevented `.ide` files with a `2dfx` section to be loaded +- Frontend 1.1: reduce timeout during a check for updates to 10 seconds +- ImGuiRedux: two new commands `IMGUI_SET_IMAGE_BG_COLOR` and `IMGUI_SET_IMAGE_TINT_COLOR` **BREAKING CHANGES** diff --git a/README.md b/README.md index f144915..bf9098b 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![Discord](https://img.shields.io/discord/911487285990674473?style=for-the-badge)](https://discord.gg/d5dZSfgBZr) [![YouTube Channel](https://img.shields.io/badge/YouTube-Channel-FF0000?style=for-the-badge)](https://www.youtube.com/playlist?list=PLNxQuEFtVkeizoLEQiok7qzr1f0mcwfFb) -CLEO Redux is an experimental JavaScript runtime for GTA 3D era games and, with limited functionality, [other games or applications](https://re.cleo.li/docs/en/embedding.html). +CLEO Redux is an experimental runtime for GTA 3D era games and, with limited functionality, [other games or applications](https://re.cleo.li/docs/en/embedding.html). It supports [JavaScript](https://re.cleo.li/docs/en/javascript.html) and [TypeScript](https://re.cleo.li/docs/en/typescript.html) languages. Its flexible, extensible and secure environment provides rich scripting capabilities and allows easily add and remove countless mini-scripts. diff --git a/docs/en/SUMMARY.md b/docs/en/SUMMARY.md index cc55690..3e1a32d 100644 --- a/docs/en/SUMMARY.md +++ b/docs/en/SUMMARY.md @@ -32,6 +32,7 @@ - [Memory Object](./using-memory.md) - [Memory Object (x64)](./using-memory-64.md) - [Deprecated](./deprecated-bindings.md) + - [TypeScript](./typescript.md) - [Troubleshooting](./troubleshooting.md) diff --git a/docs/en/custom-commands.md b/docs/en/custom-commands.md index d5b8f0f..dd8f081 100644 --- a/docs/en/custom-commands.md +++ b/docs/en/custom-commands.md @@ -18,5 +18,5 @@ CLEO Redux supports all original opcodes available in the given game. On top of - 0AA8 [CALL_METHOD_RETURN](https://library.sannybuilder.com/#/gta3/CLEO/0AA8) (**UNSAFE** - requires `mem` permission) - 0AB0 [IS_KEY_PRESSED](https://library.sannybuilder.com/#/gta3/CLEO/0AB0) -This list might not be complete as there are custom plugins with extra commands (see [Using SDK](./using-sdk.md)). Refer to [Sanny Builder Library](https://library.sannybuilder.com) for the complete list of available commands for each game. +This list might not be complete as there are [custom plugins with extra commands](./using-sdk.md). Refer to [Sanny Builder Library](https://library.sannybuilder.com) for the complete list of available commands for each game. diff --git a/docs/en/definitions.md b/docs/en/definitions.md index 64e2861..61df2d7 100644 --- a/docs/en/definitions.md +++ b/docs/en/definitions.md @@ -6,15 +6,15 @@ At start CLEO validates that a definition file is present and correct and if not | Game | File | Minimum Required Version | | ----------------------------------- | ---------------------------------------------------------------------------------------------------- | ------------------------ | -| GTA III, re3 | [gta3.json](https://github.com/sannybuilder/library/blob/master/gta3/gta3.json) | `0.243` | -| GTA VC, reVC | [vc.json](https://github.com/sannybuilder/library/blob/master/vc/vc.json) | `0.249` | -| GTA San Andreas (Classic) 1.0 | [sa.json](https://github.com/sannybuilder/library/blob/master/sa/sa.json) | `0.288` | +| GTA III, re3 | [gta3.json](https://github.com/sannybuilder/library/blob/master/gta3/gta3.json) | `0.246` | +| GTA VC, reVC | [vc.json](https://github.com/sannybuilder/library/blob/master/vc/vc.json) | `0.252` | +| GTA San Andreas (Classic) 1.0 | [sa.json](https://github.com/sannybuilder/library/blob/master/sa/sa.json) | `0.291` | | GTA IV | [gta_iv.json](https://github.com/sannybuilder/library/blob/master/gta_iv/gta_iv.json) | `0.46` | | GTA III: The Definitive Edition | [gta3_unreal.json](https://github.com/sannybuilder/library/blob/master/gta3_unreal/gta3_unreal.json) | `0.222` | | Vice City: The Definitive Edition | [vc_unreal.json](https://github.com/sannybuilder/library/blob/master/vc_unreal/vc_unreal.json) | `0.228` | | San Andreas: The Definitive Edition | [sa_unreal.json](https://github.com/sannybuilder/library/blob/master/sa_unreal/sa_unreal.json) | `0.250` | -| Bully: Scholarship Edition | [bully.json](https://github.com/sannybuilder/library/blob/master/bully/bully.json) | `0.29` | -| Unknown (32-bit) | [unknown_x86.json](https://github.com/sannybuilder/library/blob/master/unknown_x86/unknown_x86.json) | `0.216` | -| Unknown (64-bit) | [unknown_x64.json](https://github.com/sannybuilder/library/blob/master/unknown_x64/unknown_x64.json) | `0.220` | +| Bully: Scholarship Edition | [bully.json](https://github.com/sannybuilder/library/blob/master/bully/bully.json) | `0.32` | +| Unknown (32-bit) | [unknown_x86.json](https://github.com/sannybuilder/library/blob/master/unknown_x86/unknown_x86.json) | `0.217` | +| Unknown (64-bit) | [unknown_x64.json](https://github.com/sannybuilder/library/blob/master/unknown_x64/unknown_x64.json) | `0.221` | Starting from v1.0.0 CLEO Redux uses compound definitions (a combination of the primary JSON file for the current game and a JSON file for the Unknown host). It lets SDK commands to work in JS scripts regardless of them being defined or not in the primary JSON file. You should notice that during updates CLEO downloads both `.json` and `unknown.json` as well as the accompanying `enums.js` files. It should not affect any existing scripts. diff --git a/docs/en/first-steps.md b/docs/en/first-steps.md index 0baaaa3..d1f8dc3 100644 --- a/docs/en/first-steps.md +++ b/docs/en/first-steps.md @@ -11,7 +11,7 @@ Go to the [CLEO directory](./cleo-directory.md) and create a new file named `int log("Hello world"); ``` -Lines starting with `//` are comments and ignored by the game. The only meaningful line is the second that instructs JavaScript runtime to print a message in the log file. +Lines starting with `//` are comments and ignored by the game. The only meaningful line is the second that instructs the JavaScript runtime to print a message in the log file. Now save the file and run the game. Start a new game or load a save file, play a few seconds and then go to `cleo_redux.log` (do not exit the game yet). You should now see a new line like: @@ -25,7 +25,7 @@ If you see the message, open `intro.js` again and change "Hello world" to anothe ## Concurrency -There is so little fun in a single script, so let's explore another important aspect. CLEO Redux can load and run many scripts concurrently. But they do not run in parallel, or at the same time. Instead there is a queue of scripts to execute them sequentually on each game iteration. This happens to minimize number of issues caused by accessing shared resources from multiple parallel scripts. The game's main loop is also locked while scripts get processed. +There is so little fun in a single script, so let's explore another important aspect. CLEO Redux can load and run many scripts concurrently. But they do not run in parallel, or at the same time. Instead there is a queue of scripts to execute them sequentually on each game loop iteration. It reduces a number of possible issues caused due to the use of shared resources from multiple parallel scripts. The game's main loop is also locked while CLEO scripts get processed. When the script is ready to return control to the main script or another script in the queue, it must call the `wait(n)` command where `n` is a number greater than or equal to zero. This command pauses the current script for at least `n` milliseconds: diff --git a/docs/en/imports.md b/docs/en/imports.md index d9cdaa1..546f8f6 100644 --- a/docs/en/imports.md +++ b/docs/en/imports.md @@ -5,7 +5,7 @@ You can import other scripts and some custom file formats in your code to make t ## Importing scripts -- Extensions: `.js`, `.mjs` +- Extensions: `.js`, `.mjs`, `.ts` The runtime supports the `import` statement as described in [this article](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import). diff --git a/docs/en/introduction.md b/docs/en/introduction.md index 71bcd35..6e5561e 100644 --- a/docs/en/introduction.md +++ b/docs/en/introduction.md @@ -1,6 +1,6 @@ # Introduction -CLEO Redux is an [embeddable](./embedding.md) and [extensible](./using-sdk.md) JavaScript runtime capable of running user-made scripts in games and desktop applications. It is inspired by [CLEO Library](https://cleo.li/) and is [partially compatible](./relation-to-cleo-library.md) with its scripts and plugins. CLEO Redux, however, aims to provide a better experience for developers and users and support games beyond just GTA 3D series. +CLEO Redux is an [embeddable](./embedding.md) and [extensible](./using-sdk.md) runtime capable of running user-made scripts in games and desktop applications. It supports [JavaScript](./javascript.md) and TypeScript languages. Inspired by [CLEO Library](https://cleo.li/) and [partially compatible](./relation-to-cleo-library.md) with its scripts and plugins CLEO Redux, however, aims to provide a better experience for developers and users and support games beyond just GTA 3D series. Follow the [first steps tutorial](./first-steps.md) to learn how to write and run your first script. Also check our [YouTube playlist](https://www.youtube.com/playlist?list=PLNxQuEFtVkeizoLEQiok7qzr1f0mcwfFb) for video guides. @@ -20,8 +20,7 @@ Grand Theft Auto: The Trilogy - The Definitive Edition: Other games and applications: - Bully: Scholarship Edition 1.200 -- re3 (see [details](./troubleshooting.md#cleo-does-not-work-with-re3-or-revc)) -- reVC (see [details](./troubleshooting.md#cleo-does-not-work-with-re3-or-revc)) +- re3 & reVC (see [details](./troubleshooting.md#cleo-does-not-work-with-re3-or-revc)) - unknown host (see [details](./embedding.md)) For the complete reference on supported features [refer to this page](https://github.com/cleolibrary/CLEO-Redux/wiki/Feature-Support-Matrix). Also there are known limitations [listed here](unsupported.md). diff --git a/docs/en/other-features.md b/docs/en/other-features.md index d69bc3d..40e2e8d 100644 --- a/docs/en/other-features.md +++ b/docs/en/other-features.md @@ -34,6 +34,8 @@ For `Unknown` host This line instructs VS Code where to look for the commands definitions for the autocomplete feature. The `path` can be relative to the script file or be absolute. Examples above assume JS files are located in the CLEO directory. [Find out more information](https://www.typescriptlang.org/docs/handbook/triple-slash-directives.html#-reference-path-) on the official TypeScript portal. +> This line is not needed for TS scripts as VS Code automatically imports `*.d.ts` files with the help of [`tsconfig.json`](./typescript.md#ts-config) file in the CLEO directory. + ## SCM Log CLEO Redux has built-in support for basic tracing of SCM instructions. To trace opcodes in all running CS scripts open up [`cleo.ini`](./config.md) and change `LogOpcodes` to 1. Note that it can greatly impact game performance due to frequent microdelays during writes to the log file. Use this option only for debugging purposes. diff --git a/docs/en/typescript.md b/docs/en/typescript.md new file mode 100644 index 0000000..f6f2ba2 --- /dev/null +++ b/docs/en/typescript.md @@ -0,0 +1,11 @@ +# TypeScript + +Since v1.0.5 CLEO Redux adds first-class support for TypeScript. TypeScript is a superset of JavaScript with static types and other features. It is compiled to JavaScript and can be efficiently used in large-scale projects. TypeScript has excellent IDE support so you get autocompletion, type checking and other features in your editor for free. + +TypeScript website: [https://www.typescriptlang.org/](https://www.typescriptlang.org/). + +TS scripts have `.ts` extension and can be used anywhere [where JS scripts are supported](./script-lifecycle.md). They can be imported directly in both JS and TS scripts using [`import`](./imports.md) statements. + +## TS Config + +CLEO Redux creates `tsconfig.json` file in the [CLEO directory](./cleo-directory.md) when you run it for the first time. It contains necessary information for VS Code and other IDEs on where to look for typing files, so you don't have to include `/// ` lines in your scripts. You can edit it to change the default settings. diff --git a/installer/cleo_redux.iss b/installer/cleo_redux.iss index 4d61c48..94aa0d2 100644 --- a/installer/cleo_redux.iss +++ b/installer/cleo_redux.iss @@ -1,5 +1,5 @@ #define AppName "CLEO Redux" -#define AppVersion "1.0.5-dev.20221208" +#define AppVersion "1.0.5-dev.20221212" #define AppPublisher "Seemann" #define AppURL "https://re.cleo.li" #define SourceDir "..\"