├── GdTool
├── Properties
│ ├── launchSettings.json
│ └── AssemblyInfo.cs
├── FodyWeavers.xml
├── GdToolProject.cs
├── SourceCodeReader.cs
├── DecompileBuffer.cs
├── VersionDetector.cs
├── GdcTokenType.cs
├── Resources
│ └── BytecodeProviders
│ │ ├── bytecode_0b806ee.json
│ │ ├── bytecode_8c1731b.json
│ │ ├── bytecode_31ce3c5.json
│ │ ├── bytecode_703004f.json
│ │ ├── bytecode_8cab401.json
│ │ ├── bytecode_e82dc40.json
│ │ ├── bytecode_2185c01.json
│ │ ├── bytecode_97f34a1.json
│ │ ├── bytecode_65d48d6.json
│ │ ├── bytecode_be46be7.json
│ │ ├── bytecode_48f1d02.json
│ │ ├── bytecode_30c1229.json
│ │ ├── bytecode_7d2d144.json
│ │ ├── bytecode_64872ca.json
│ │ ├── bytecode_6174585.json
│ │ ├── bytecode_23441ec.json
│ │ ├── bytecode_7124599.json
│ │ ├── bytecode_054a2ac.json
│ │ ├── bytecode_1a36141.json
│ │ ├── bytecode_514a3fb.json
│ │ └── bytecode_5565f55.json
├── GdTool.csproj
├── PckFile.cs
├── GdScriptDecompiler.cs
├── FodyWeavers.xsd
├── BytecodeProvider.cs
├── GdcToken.cs
├── Program.cs
├── GdScriptCompiler.cs
├── CompilerToken.cs
└── Structures.cs
├── .github
└── workflows
│ └── dotnet.yml
├── LICENSE
├── GdTool.sln
├── README.md
└── .gitignore
/GdTool/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "profiles": {
3 | "GdTool": {
4 | "commandName": "Project"
5 | }
6 | }
7 | }
--------------------------------------------------------------------------------
/GdTool/FodyWeavers.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/.github/workflows/dotnet.yml:
--------------------------------------------------------------------------------
1 | name: .NET
2 |
3 | on:
4 | push:
5 | branches: [ master ]
6 | pull_request:
7 | branches: [ master ]
8 |
9 | jobs:
10 | build:
11 |
12 | runs-on: ubuntu-latest
13 |
14 | steps:
15 | - uses: actions/checkout@v2
16 | - name: Setup .NET
17 | uses: actions/setup-dotnet@v1
18 | with:
19 | dotnet-version: 5.0.x
20 | - name: Restore dependencies
21 | run: dotnet restore
22 | - name: Build
23 | run: dotnet build --no-restore
24 |
--------------------------------------------------------------------------------
/GdTool/GdToolProject.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using Newtonsoft.Json;
7 |
8 | namespace GdTool {
9 | public class GdToolProject {
10 | [JsonProperty]
11 | public uint PackFormatVersion;
12 | [JsonProperty]
13 | public uint VersionMajor;
14 | [JsonProperty]
15 | public uint VersionMinor;
16 | [JsonProperty]
17 | public uint VersionPatch;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/GdTool/SourceCodeReader.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 |
3 | namespace GdTool {
4 | public class SourceCodeReader {
5 | public string Source;
6 | public int Position;
7 | public bool HasRemaining {
8 | get {
9 | return Position < Source.Length;
10 | }
11 | }
12 | public int CurrentRow {
13 | get {
14 | return Source.Substring(0, Position).Count(ch => ch == '\n') + 1;
15 | }
16 | }
17 |
18 | public SourceCodeReader(string source) {
19 | Source = source;
20 | }
21 |
22 | public string Peek(int characters) {
23 | if (Position + characters > Source.Length) {
24 | return null;
25 | }
26 |
27 | return Source.Substring(Position, characters);
28 | }
29 |
30 | public string Read(int characters) {
31 | string str = Peek(characters);
32 | if (str != null) {
33 | Position += characters;
34 | }
35 | return str;
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Lucas Baizer
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/GdTool.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.31112.23
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GdTool", "GdTool\GdTool.csproj", "{408E3BE7-02D5-4386-8326-EBFF8D04AB62}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {408E3BE7-02D5-4386-8326-EBFF8D04AB62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {408E3BE7-02D5-4386-8326-EBFF8D04AB62}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {408E3BE7-02D5-4386-8326-EBFF8D04AB62}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {408E3BE7-02D5-4386-8326-EBFF8D04AB62}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {43970B55-F4F6-4669-91CF-B8FE16D9C6AE}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/GdTool/DecompileBuffer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace GdTool {
8 | public class DecompileBuffer {
9 | private StringBuilder Text = new StringBuilder();
10 | public int Indentation { get; set; }
11 |
12 | public string Content {
13 | get {
14 | return Text.ToString();
15 | }
16 | }
17 |
18 | public DecompileBuffer Append(string val) {
19 | Text.Append(val);
20 | return this;
21 | }
22 |
23 | public DecompileBuffer AppendOp(string val) {
24 | if (Text.Length >= 1 && Text[Text.Length - 1] != ' ' && Text[Text.Length - 1] != '\n') {
25 | Text.Append(' ');
26 | }
27 | Text.Append(val);
28 | Text.Append(' ');
29 | return this;
30 | }
31 |
32 | public void AppendNewLine() {
33 | Text.Append(Environment.NewLine);
34 | for (int i = 0; i < Indentation; i++) {
35 | Text.Append('\t');
36 | }
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/GdTool/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("GdTool")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("GdTool")]
12 | [assembly: AssemblyCopyright("Copyright 2021 Lucas Baizer")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("408e3be7-02d5-4386-8326-ebff8d04ab62")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/GdTool/VersionDetector.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text;
3 |
4 | namespace GdTool {
5 | public class VersionDetector {
6 | private static bool IsHexadecimal(string str) {
7 | for (int i = 0; i < str.Length; i++) {
8 | if (str[i] >= '0' && str[i] <= '9') {
9 | continue;
10 | }
11 | if (str[i] >= 'a' && str[i] <= 'f') {
12 | continue;
13 | }
14 | return false;
15 | }
16 | return true;
17 | }
18 |
19 | public static BytecodeProvider Detect(byte[] binary) {
20 | int lastZeroByte = 0;
21 | for (int i = 0; i < binary.Length; i++) {
22 | if (binary[i] == 0) {
23 | if (i - lastZeroByte == 41) { // search for a 40 character null terminated string
24 | string hash = Encoding.ASCII.GetString(binary, lastZeroByte + 1, 40);
25 | if (IsHexadecimal(hash)) {
26 | string previousVersion = BytecodeProvider.FindPreviousMajorVersionHash(hash);
27 | if (previousVersion != null) {
28 | return BytecodeProvider.GetByCommitHash(previousVersion);
29 | }
30 | }
31 | }
32 | lastZeroByte = i;
33 | }
34 | }
35 |
36 | return null;
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # GdTool
2 | GdTool is a standalone commannd line tool for reverse engineering games made with the Godot engine.
3 | It has both a compiler and a decompiler for all release GdScript versions (before GdScript 2.0, which is currently unreleased).
4 | GdTool has no dependencies on the Godot engine and works as a lightweight toolset written with .NET 5.0.
5 |
6 | # Installing
7 | Get the newest version of GdTool from the [Releases](https://github.com/lucasbaizer2/GdTool/releases) page.
8 |
9 | # Usage
10 |
11 | Godot games are packaged as an executable file alongside a proprietary "PCK" file.
12 | The executable contains the engine, and the PCK file contains all of the game data. including GdScript code.
13 |
14 | To start reverse engineering a game, first find the GdScript version the game was compiled with:
15 | ```
16 | > GdTool detect -i "path-to-game-executable"
17 | ```
18 |
19 | The output will contain a GdScript bytecode version (below is an example for an arbitrary game):
20 | ```
21 | Bytecode version hash: 5565f55 (5565f5591f1096870327d893f8539eff22d17e68)
22 | 3.2.0 release (5565f55 / 2019-08-26 / Bytecode version: 13) - added `ord` function
23 | ```
24 |
25 | Now that the bytecode version is known, the PCK file can be extracted and the code decompiled with:
26 | ```
27 | > GdTool decode -i "path-to-game-pck-file" -b 5565f55 -d
28 | # ^ hash of bytecode version
29 | ```
30 | The bytecode version flag can be ommitted if there is no interest in decompiling (the raw bytecode will be extracted instead).
31 |
32 | To rebuild a decoded PCK directory:
33 | ```
34 | > GdTool build -i "path-to-decoded-directory" -b 5565f55
35 | ```
36 | If there is no interest in recompiling code for the rebuild PCK (i.e. when it was decoded the bytecode information was ommitted), the bytecode version can similarly be left out when recompiling as well.
37 |
38 | # License
39 | GdTool is licensed under the [MIT License](https://github.com/lucasbaizer2/GdTool/blob/master/LICENSE).
40 |
41 | # Special Thanks
42 | The large majority of information about how the Godot engine works came from [gdsdecomp](https://github.com/bruvzg/gdsdecomp).
43 | The work done for this repository could not be done without the work done from gdsdecomp, and a special thanks goes out to all its contributors.
44 |
--------------------------------------------------------------------------------
/GdTool/GdcTokenType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace GdTool {
8 | public enum GdcTokenType {
9 | Empty,
10 | Identifier,
11 | Constant,
12 | Self,
13 | BuiltInType,
14 | BuiltInFunc,
15 | OpIn,
16 | OpEqual,
17 | OpNotEqual,
18 | OpLess,
19 | OpLessEqual,
20 | OpGreater,
21 | OpGreaterEqual,
22 | OpAnd,
23 | OpOr,
24 | OpNot,
25 | OpAdd,
26 | OpSub,
27 | OpMul,
28 | OpDiv,
29 | OpMod,
30 | OpShiftLeft,
31 | OpShiftRight,
32 | OpAssign,
33 | OpAssignAdd,
34 | OpAssignSub,
35 | OpAssignMul,
36 | OpAssignDiv,
37 | OpAssignMod,
38 | OpAssignShiftLeft,
39 | OpAssignShiftRight,
40 | OpAssignBitAnd,
41 | OpAssignBitOr,
42 | OpAssignBitXor,
43 | OpBitAnd,
44 | OpBitOr,
45 | OpBitXor,
46 | OpBitInvert,
47 | CfIf,
48 | CfElif,
49 | CfElse,
50 | CfFor,
51 | CfWhile,
52 | CfBreak,
53 | CfContinue,
54 | CfPass,
55 | CfReturn,
56 | CfMatch,
57 | PrFunction,
58 | PrClass,
59 | PrClassName,
60 | PrExtends,
61 | PrIs,
62 | PrOnready,
63 | PrTool,
64 | PrStatic,
65 | PrExport,
66 | PrSetget,
67 | PrConst,
68 | PrVar,
69 | PrAs,
70 | PrVoid,
71 | PrEnum,
72 | PrPreload,
73 | PrAssert,
74 | PrYield,
75 | PrSignal,
76 | PrBreakpoint,
77 | PrRemote,
78 | PrSync,
79 | PrMaster,
80 | PrSlave,
81 | PrPuppet,
82 | PrRemotesync,
83 | PrMastersync,
84 | PrPuppetsync,
85 | BracketOpen,
86 | BracketClose,
87 | CurlyBracketOpen,
88 | CurlyBracketClose,
89 | ParenthesisOpen,
90 | ParenthesisClose,
91 | Comma,
92 | Semicolon,
93 | Period,
94 | QuestionMark,
95 | Colon,
96 | Dollar,
97 | ForwardArrow,
98 | Newline,
99 | ConstPi,
100 | ConstTau,
101 | Wildcard,
102 | ConstInf,
103 | ConstNan,
104 | Error,
105 | Eof,
106 | Cursor,
107 | Max
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/GdTool/Resources/BytecodeProviders/bytecode_0b806ee.json:
--------------------------------------------------------------------------------
1 | {
2 | "CommitHash": "0b806ee0fc9097fa7bda7ac0109191c9c5e0a1ac",
3 | "Description": "1.0 dev (0b806ee / 2014-02-09 / Bytecode version: 1) - initial version",
4 | "BytecodeVersion": 1,
5 | "TypeNameVersion": 2,
6 | "FunctionNames": [
7 | "sin",
8 | "cos",
9 | "tan",
10 | "sinh",
11 | "cosh",
12 | "tanh",
13 | "asin",
14 | "acos",
15 | "atan",
16 | "atan2",
17 | "sqrt",
18 | "fmod",
19 | "fposmod",
20 | "floor",
21 | "ceil",
22 | "round",
23 | "abs",
24 | "sign",
25 | "pow",
26 | "log",
27 | "exp",
28 | "is_nan",
29 | "is_inf",
30 | "ease",
31 | "decimals",
32 | "stepify",
33 | "lerp",
34 | "dectime",
35 | "randomize",
36 | "randi",
37 | "randf",
38 | "rand_range",
39 | "rand_seed",
40 | "deg2rad",
41 | "rad2deg",
42 | "linear2db",
43 | "db2linear",
44 | "max",
45 | "min",
46 | "clamp",
47 | "nearest_po2",
48 | "weakref",
49 | "convert",
50 | "typeof",
51 | "str",
52 | "print",
53 | "printt",
54 | "printerr",
55 | "printraw",
56 | "range",
57 | "inst2dict",
58 | "dict2inst",
59 | "print_stack"
60 | ],
61 | "Tokens": [
62 | "Empty",
63 | "Identifier",
64 | "Constant",
65 | "Self",
66 | "BuiltInType",
67 | "BuiltInFunc",
68 | "OpIn",
69 | "OpEqual",
70 | "OpNotEqual",
71 | "OpLess",
72 | "OpLessEqual",
73 | "OpGreater",
74 | "OpGreaterEqual",
75 | "OpAnd",
76 | "OpOr",
77 | "OpNot",
78 | "OpAdd",
79 | "OpSub",
80 | "OpMul",
81 | "OpDiv",
82 | "OpMod",
83 | "OpShiftLeft",
84 | "OpShiftRight",
85 | "OpAssign",
86 | "OpAssignAdd",
87 | "OpAssignSub",
88 | "OpAssignMul",
89 | "OpAssignDiv",
90 | "OpAssignMod",
91 | "OpAssignShiftLeft",
92 | "OpAssignShiftRight",
93 | "OpAssignBitAnd",
94 | "OpAssignBitOr",
95 | "OpAssignBitXor",
96 | "OpBitAnd",
97 | "OpBitOr",
98 | "OpBitXor",
99 | "OpBitInvert",
100 | "CfIf",
101 | "CfElif",
102 | "CfElse",
103 | "CfFor",
104 | "CfDo",
105 | "CfWhile",
106 | "CfSwitch",
107 | "CfCase",
108 | "CfBreak",
109 | "CfContinue",
110 | "CfPass",
111 | "CfReturn",
112 | "PrFunction",
113 | "PrClass",
114 | "PrExtends",
115 | "PrTool",
116 | "PrStatic",
117 | "PrExport",
118 | "PrConst",
119 | "PrVar",
120 | "PrPreload",
121 | "PrAssert",
122 | "BracketOpen",
123 | "BracketClose",
124 | "CurlyBracketOpen",
125 | "CurlyBracketClose",
126 | "ParenthesisOpen",
127 | "ParenthesisClose",
128 | "Comma",
129 | "Semicolon",
130 | "Period",
131 | "QuestionMark",
132 | "Colon",
133 | "Newline",
134 | "Error",
135 | "Eof",
136 | "Max"
137 | ]
138 | }
--------------------------------------------------------------------------------
/GdTool/Resources/BytecodeProviders/bytecode_8c1731b.json:
--------------------------------------------------------------------------------
1 | {
2 | "CommitHash": "8c1731b67995add31361ae526b0e6af76346181e",
3 | "Description": "1.0 dev (8c1731b / 2014-02-15 / Bytecode version: 2) - added `load` function",
4 | "BytecodeVersion": 2,
5 | "TypeNameVersion": 2,
6 | "FunctionNames": [
7 | "sin",
8 | "cos",
9 | "tan",
10 | "sinh",
11 | "cosh",
12 | "tanh",
13 | "asin",
14 | "acos",
15 | "atan",
16 | "atan2",
17 | "sqrt",
18 | "fmod",
19 | "fposmod",
20 | "floor",
21 | "ceil",
22 | "round",
23 | "abs",
24 | "sign",
25 | "pow",
26 | "log",
27 | "exp",
28 | "is_nan",
29 | "is_inf",
30 | "ease",
31 | "decimals",
32 | "stepify",
33 | "lerp",
34 | "dectime",
35 | "randomize",
36 | "randi",
37 | "randf",
38 | "rand_range",
39 | "rand_seed",
40 | "deg2rad",
41 | "rad2deg",
42 | "linear2db",
43 | "db2linear",
44 | "max",
45 | "min",
46 | "clamp",
47 | "nearest_po2",
48 | "weakref",
49 | "convert",
50 | "typeof",
51 | "str",
52 | "print",
53 | "printt",
54 | "printerr",
55 | "printraw",
56 | "range",
57 | "load",
58 | "inst2dict",
59 | "dict2inst",
60 | "print_stack"
61 | ],
62 | "Tokens": [
63 | "Empty",
64 | "Identifier",
65 | "Constant",
66 | "Self",
67 | "BuiltInType",
68 | "BuiltInFunc",
69 | "OpIn",
70 | "OpEqual",
71 | "OpNotEqual",
72 | "OpLess",
73 | "OpLessEqual",
74 | "OpGreater",
75 | "OpGreaterEqual",
76 | "OpAnd",
77 | "OpOr",
78 | "OpNot",
79 | "OpAdd",
80 | "OpSub",
81 | "OpMul",
82 | "OpDiv",
83 | "OpMod",
84 | "OpShiftLeft",
85 | "OpShiftRight",
86 | "OpAssign",
87 | "OpAssignAdd",
88 | "OpAssignSub",
89 | "OpAssignMul",
90 | "OpAssignDiv",
91 | "OpAssignMod",
92 | "OpAssignShiftLeft",
93 | "OpAssignShiftRight",
94 | "OpAssignBitAnd",
95 | "OpAssignBitOr",
96 | "OpAssignBitXor",
97 | "OpBitAnd",
98 | "OpBitOr",
99 | "OpBitXor",
100 | "OpBitInvert",
101 | "CfIf",
102 | "CfElif",
103 | "CfElse",
104 | "CfFor",
105 | "CfDo",
106 | "CfWhile",
107 | "CfSwitch",
108 | "CfCase",
109 | "CfBreak",
110 | "CfContinue",
111 | "CfPass",
112 | "CfReturn",
113 | "PrFunction",
114 | "PrClass",
115 | "PrExtends",
116 | "PrTool",
117 | "PrStatic",
118 | "PrExport",
119 | "PrConst",
120 | "PrVar",
121 | "PrPreload",
122 | "PrAssert",
123 | "BracketOpen",
124 | "BracketClose",
125 | "CurlyBracketOpen",
126 | "CurlyBracketClose",
127 | "ParenthesisOpen",
128 | "ParenthesisClose",
129 | "Comma",
130 | "Semicolon",
131 | "Period",
132 | "QuestionMark",
133 | "Colon",
134 | "Newline",
135 | "Error",
136 | "Eof",
137 | "Max"
138 | ]
139 | }
--------------------------------------------------------------------------------
/GdTool/Resources/BytecodeProviders/bytecode_31ce3c5.json:
--------------------------------------------------------------------------------
1 | {
2 | "CommitHash": "31ce3c5fd0300aac1e86bced1efc5f9ec94bdb6b",
3 | "Description": "1.0 dev (31ce3c5 / 2014-03-13 / Bytecode version: 2) - added `funcref` function",
4 | "BytecodeVersion": 2,
5 | "TypeNameVersion": 2,
6 | "FunctionNames": [
7 | "sin",
8 | "cos",
9 | "tan",
10 | "sinh",
11 | "cosh",
12 | "tanh",
13 | "asin",
14 | "acos",
15 | "atan",
16 | "atan2",
17 | "sqrt",
18 | "fmod",
19 | "fposmod",
20 | "floor",
21 | "ceil",
22 | "round",
23 | "abs",
24 | "sign",
25 | "pow",
26 | "log",
27 | "exp",
28 | "is_nan",
29 | "is_inf",
30 | "ease",
31 | "decimals",
32 | "stepify",
33 | "lerp",
34 | "dectime",
35 | "randomize",
36 | "randi",
37 | "randf",
38 | "rand_range",
39 | "rand_seed",
40 | "deg2rad",
41 | "rad2deg",
42 | "linear2db",
43 | "db2linear",
44 | "max",
45 | "min",
46 | "clamp",
47 | "nearest_po2",
48 | "weakref",
49 | "funcref",
50 | "convert",
51 | "typeof",
52 | "str",
53 | "print",
54 | "printt",
55 | "printerr",
56 | "printraw",
57 | "range",
58 | "load",
59 | "inst2dict",
60 | "dict2inst",
61 | "print_stack"
62 | ],
63 | "Tokens": [
64 | "Empty",
65 | "Identifier",
66 | "Constant",
67 | "Self",
68 | "BuiltInType",
69 | "BuiltInFunc",
70 | "OpIn",
71 | "OpEqual",
72 | "OpNotEqual",
73 | "OpLess",
74 | "OpLessEqual",
75 | "OpGreater",
76 | "OpGreaterEqual",
77 | "OpAnd",
78 | "OpOr",
79 | "OpNot",
80 | "OpAdd",
81 | "OpSub",
82 | "OpMul",
83 | "OpDiv",
84 | "OpMod",
85 | "OpShiftLeft",
86 | "OpShiftRight",
87 | "OpAssign",
88 | "OpAssignAdd",
89 | "OpAssignSub",
90 | "OpAssignMul",
91 | "OpAssignDiv",
92 | "OpAssignMod",
93 | "OpAssignShiftLeft",
94 | "OpAssignShiftRight",
95 | "OpAssignBitAnd",
96 | "OpAssignBitOr",
97 | "OpAssignBitXor",
98 | "OpBitAnd",
99 | "OpBitOr",
100 | "OpBitXor",
101 | "OpBitInvert",
102 | "CfIf",
103 | "CfElif",
104 | "CfElse",
105 | "CfFor",
106 | "CfDo",
107 | "CfWhile",
108 | "CfSwitch",
109 | "CfCase",
110 | "CfBreak",
111 | "CfContinue",
112 | "CfPass",
113 | "CfReturn",
114 | "PrFunction",
115 | "PrClass",
116 | "PrExtends",
117 | "PrTool",
118 | "PrStatic",
119 | "PrExport",
120 | "PrConst",
121 | "PrVar",
122 | "PrPreload",
123 | "PrAssert",
124 | "BracketOpen",
125 | "BracketClose",
126 | "CurlyBracketOpen",
127 | "CurlyBracketClose",
128 | "ParenthesisOpen",
129 | "ParenthesisClose",
130 | "Comma",
131 | "Semicolon",
132 | "Period",
133 | "QuestionMark",
134 | "Colon",
135 | "Newline",
136 | "Error",
137 | "Eof",
138 | "Max"
139 | ]
140 | }
--------------------------------------------------------------------------------
/GdTool/Resources/BytecodeProviders/bytecode_703004f.json:
--------------------------------------------------------------------------------
1 | {
2 | "CommitHash": "703004f830f39adcde9b9565f1aa49d1b10e8d27",
3 | "Description": "1.0 dev (703004f / 2014-06-16 / Bytecode version: 2) - added `hash` function",
4 | "BytecodeVersion": 2,
5 | "TypeNameVersion": 2,
6 | "FunctionNames": [
7 | "sin",
8 | "cos",
9 | "tan",
10 | "sinh",
11 | "cosh",
12 | "tanh",
13 | "asin",
14 | "acos",
15 | "atan",
16 | "atan2",
17 | "sqrt",
18 | "fmod",
19 | "fposmod",
20 | "floor",
21 | "ceil",
22 | "round",
23 | "abs",
24 | "sign",
25 | "pow",
26 | "log",
27 | "exp",
28 | "is_nan",
29 | "is_inf",
30 | "ease",
31 | "decimals",
32 | "stepify",
33 | "lerp",
34 | "dectime",
35 | "randomize",
36 | "randi",
37 | "randf",
38 | "rand_range",
39 | "rand_seed",
40 | "deg2rad",
41 | "rad2deg",
42 | "linear2db",
43 | "db2linear",
44 | "max",
45 | "min",
46 | "clamp",
47 | "nearest_po2",
48 | "weakref",
49 | "funcref",
50 | "convert",
51 | "typeof",
52 | "str",
53 | "print",
54 | "printt",
55 | "printerr",
56 | "printraw",
57 | "range",
58 | "load",
59 | "inst2dict",
60 | "dict2inst",
61 | "hash",
62 | "print_stack"
63 | ],
64 | "Tokens": [
65 | "Empty",
66 | "Identifier",
67 | "Constant",
68 | "Self",
69 | "BuiltInType",
70 | "BuiltInFunc",
71 | "OpIn",
72 | "OpEqual",
73 | "OpNotEqual",
74 | "OpLess",
75 | "OpLessEqual",
76 | "OpGreater",
77 | "OpGreaterEqual",
78 | "OpAnd",
79 | "OpOr",
80 | "OpNot",
81 | "OpAdd",
82 | "OpSub",
83 | "OpMul",
84 | "OpDiv",
85 | "OpMod",
86 | "OpShiftLeft",
87 | "OpShiftRight",
88 | "OpAssign",
89 | "OpAssignAdd",
90 | "OpAssignSub",
91 | "OpAssignMul",
92 | "OpAssignDiv",
93 | "OpAssignMod",
94 | "OpAssignShiftLeft",
95 | "OpAssignShiftRight",
96 | "OpAssignBitAnd",
97 | "OpAssignBitOr",
98 | "OpAssignBitXor",
99 | "OpBitAnd",
100 | "OpBitOr",
101 | "OpBitXor",
102 | "OpBitInvert",
103 | "CfIf",
104 | "CfElif",
105 | "CfElse",
106 | "CfFor",
107 | "CfDo",
108 | "CfWhile",
109 | "CfSwitch",
110 | "CfCase",
111 | "CfBreak",
112 | "CfContinue",
113 | "CfPass",
114 | "CfReturn",
115 | "PrFunction",
116 | "PrClass",
117 | "PrExtends",
118 | "PrTool",
119 | "PrStatic",
120 | "PrExport",
121 | "PrConst",
122 | "PrVar",
123 | "PrPreload",
124 | "PrAssert",
125 | "BracketOpen",
126 | "BracketClose",
127 | "CurlyBracketOpen",
128 | "CurlyBracketClose",
129 | "ParenthesisOpen",
130 | "ParenthesisClose",
131 | "Comma",
132 | "Semicolon",
133 | "Period",
134 | "QuestionMark",
135 | "Colon",
136 | "Newline",
137 | "Error",
138 | "Eof",
139 | "Max"
140 | ]
141 | }
--------------------------------------------------------------------------------
/GdTool/Resources/BytecodeProviders/bytecode_8cab401.json:
--------------------------------------------------------------------------------
1 | {
2 | "CommitHash": "8cab401d08f8e25aa9b2dc710204785858ff3dbb",
3 | "Description": "1.0 dev (8cab401 / 2014-09-15 / Bytecode version: 2) - added `YIELD` token",
4 | "BytecodeVersion": 2,
5 | "TypeNameVersion": 2,
6 | "FunctionNames": [
7 | "sin",
8 | "cos",
9 | "tan",
10 | "sinh",
11 | "cosh",
12 | "tanh",
13 | "asin",
14 | "acos",
15 | "atan",
16 | "atan2",
17 | "sqrt",
18 | "fmod",
19 | "fposmod",
20 | "floor",
21 | "ceil",
22 | "round",
23 | "abs",
24 | "sign",
25 | "pow",
26 | "log",
27 | "exp",
28 | "is_nan",
29 | "is_inf",
30 | "ease",
31 | "decimals",
32 | "stepify",
33 | "lerp",
34 | "dectime",
35 | "randomize",
36 | "randi",
37 | "randf",
38 | "rand_range",
39 | "rand_seed",
40 | "deg2rad",
41 | "rad2deg",
42 | "linear2db",
43 | "db2linear",
44 | "max",
45 | "min",
46 | "clamp",
47 | "nearest_po2",
48 | "weakref",
49 | "funcref",
50 | "convert",
51 | "typeof",
52 | "str",
53 | "print",
54 | "printt",
55 | "printerr",
56 | "printraw",
57 | "range",
58 | "load",
59 | "inst2dict",
60 | "dict2inst",
61 | "hash",
62 | "print_stack"
63 | ],
64 | "Tokens": [
65 | "Empty",
66 | "Identifier",
67 | "Constant",
68 | "Self",
69 | "BuiltInType",
70 | "BuiltInFunc",
71 | "OpIn",
72 | "OpEqual",
73 | "OpNotEqual",
74 | "OpLess",
75 | "OpLessEqual",
76 | "OpGreater",
77 | "OpGreaterEqual",
78 | "OpAnd",
79 | "OpOr",
80 | "OpNot",
81 | "OpAdd",
82 | "OpSub",
83 | "OpMul",
84 | "OpDiv",
85 | "OpMod",
86 | "OpShiftLeft",
87 | "OpShiftRight",
88 | "OpAssign",
89 | "OpAssignAdd",
90 | "OpAssignSub",
91 | "OpAssignMul",
92 | "OpAssignDiv",
93 | "OpAssignMod",
94 | "OpAssignShiftLeft",
95 | "OpAssignShiftRight",
96 | "OpAssignBitAnd",
97 | "OpAssignBitOr",
98 | "OpAssignBitXor",
99 | "OpBitAnd",
100 | "OpBitOr",
101 | "OpBitXor",
102 | "OpBitInvert",
103 | "CfIf",
104 | "CfElif",
105 | "CfElse",
106 | "CfFor",
107 | "CfDo",
108 | "CfWhile",
109 | "CfSwitch",
110 | "CfCase",
111 | "CfBreak",
112 | "CfContinue",
113 | "CfPass",
114 | "CfReturn",
115 | "PrFunction",
116 | "PrClass",
117 | "PrExtends",
118 | "PrTool",
119 | "PrStatic",
120 | "PrExport",
121 | "PrConst",
122 | "PrVar",
123 | "PrPreload",
124 | "PrAssert",
125 | "PrYield",
126 | "BracketOpen",
127 | "BracketClose",
128 | "CurlyBracketOpen",
129 | "CurlyBracketClose",
130 | "ParenthesisOpen",
131 | "ParenthesisClose",
132 | "Comma",
133 | "Semicolon",
134 | "Period",
135 | "QuestionMark",
136 | "Colon",
137 | "Newline",
138 | "Error",
139 | "Eof",
140 | "Max"
141 | ]
142 | }
--------------------------------------------------------------------------------
/GdTool/Resources/BytecodeProviders/bytecode_e82dc40.json:
--------------------------------------------------------------------------------
1 | {
2 | "CommitHash": "e82dc402052a47b44bb3bcf50ee4801257f92778",
3 | "Description": "1.0.0 release (e82dc40 / 2014-10-27 / Bytecode version: 3) - added `SETGET` token",
4 | "BytecodeVersion": 3,
5 | "TypeNameVersion": 2,
6 | "FunctionNames": [
7 | "sin",
8 | "cos",
9 | "tan",
10 | "sinh",
11 | "cosh",
12 | "tanh",
13 | "asin",
14 | "acos",
15 | "atan",
16 | "atan2",
17 | "sqrt",
18 | "fmod",
19 | "fposmod",
20 | "floor",
21 | "ceil",
22 | "round",
23 | "abs",
24 | "sign",
25 | "pow",
26 | "log",
27 | "exp",
28 | "is_nan",
29 | "is_inf",
30 | "ease",
31 | "decimals",
32 | "stepify",
33 | "lerp",
34 | "dectime",
35 | "randomize",
36 | "randi",
37 | "randf",
38 | "rand_range",
39 | "rand_seed",
40 | "deg2rad",
41 | "rad2deg",
42 | "linear2db",
43 | "db2linear",
44 | "max",
45 | "min",
46 | "clamp",
47 | "nearest_po2",
48 | "weakref",
49 | "funcref",
50 | "convert",
51 | "typeof",
52 | "str",
53 | "print",
54 | "printt",
55 | "printerr",
56 | "printraw",
57 | "range",
58 | "load",
59 | "inst2dict",
60 | "dict2inst",
61 | "hash",
62 | "print_stack"
63 | ],
64 | "Tokens": [
65 | "Empty",
66 | "Identifier",
67 | "Constant",
68 | "Self",
69 | "BuiltInType",
70 | "BuiltInFunc",
71 | "OpIn",
72 | "OpEqual",
73 | "OpNotEqual",
74 | "OpLess",
75 | "OpLessEqual",
76 | "OpGreater",
77 | "OpGreaterEqual",
78 | "OpAnd",
79 | "OpOr",
80 | "OpNot",
81 | "OpAdd",
82 | "OpSub",
83 | "OpMul",
84 | "OpDiv",
85 | "OpMod",
86 | "OpShiftLeft",
87 | "OpShiftRight",
88 | "OpAssign",
89 | "OpAssignAdd",
90 | "OpAssignSub",
91 | "OpAssignMul",
92 | "OpAssignDiv",
93 | "OpAssignMod",
94 | "OpAssignShiftLeft",
95 | "OpAssignShiftRight",
96 | "OpAssignBitAnd",
97 | "OpAssignBitOr",
98 | "OpAssignBitXor",
99 | "OpBitAnd",
100 | "OpBitOr",
101 | "OpBitXor",
102 | "OpBitInvert",
103 | "CfIf",
104 | "CfElif",
105 | "CfElse",
106 | "CfFor",
107 | "CfDo",
108 | "CfWhile",
109 | "CfSwitch",
110 | "CfCase",
111 | "CfBreak",
112 | "CfContinue",
113 | "CfPass",
114 | "CfReturn",
115 | "PrFunction",
116 | "PrClass",
117 | "PrExtends",
118 | "PrTool",
119 | "PrStatic",
120 | "PrExport",
121 | "PrSetget",
122 | "PrConst",
123 | "PrVar",
124 | "PrPreload",
125 | "PrAssert",
126 | "PrYield",
127 | "BracketOpen",
128 | "BracketClose",
129 | "CurlyBracketOpen",
130 | "CurlyBracketClose",
131 | "ParenthesisOpen",
132 | "ParenthesisClose",
133 | "Comma",
134 | "Semicolon",
135 | "Period",
136 | "QuestionMark",
137 | "Colon",
138 | "Newline",
139 | "Error",
140 | "Eof",
141 | "Max"
142 | ]
143 | }
--------------------------------------------------------------------------------
/GdTool/Resources/BytecodeProviders/bytecode_2185c01.json:
--------------------------------------------------------------------------------
1 | {
2 | "CommitHash": "2185c018f6593e6d64b2beb62202d2291e2e008e",
3 | "Description": "1.1 dev (2185c01 / 2015-02-15 / Bytecode version: 3) - added `var2str`, `str2var` functions",
4 | "BytecodeVersion": 3,
5 | "TypeNameVersion": 2,
6 | "FunctionNames": [
7 | "sin",
8 | "cos",
9 | "tan",
10 | "sinh",
11 | "cosh",
12 | "tanh",
13 | "asin",
14 | "acos",
15 | "atan",
16 | "atan2",
17 | "sqrt",
18 | "fmod",
19 | "fposmod",
20 | "floor",
21 | "ceil",
22 | "round",
23 | "abs",
24 | "sign",
25 | "pow",
26 | "log",
27 | "exp",
28 | "is_nan",
29 | "is_inf",
30 | "ease",
31 | "decimals",
32 | "stepify",
33 | "lerp",
34 | "dectime",
35 | "randomize",
36 | "randi",
37 | "randf",
38 | "rand_range",
39 | "rand_seed",
40 | "deg2rad",
41 | "rad2deg",
42 | "linear2db",
43 | "db2linear",
44 | "max",
45 | "min",
46 | "clamp",
47 | "nearest_po2",
48 | "weakref",
49 | "funcref",
50 | "convert",
51 | "typeof",
52 | "str",
53 | "print",
54 | "printt",
55 | "printerr",
56 | "printraw",
57 | "var2str",
58 | "str2var",
59 | "range",
60 | "load",
61 | "inst2dict",
62 | "dict2inst",
63 | "hash",
64 | "print_stack"
65 | ],
66 | "Tokens": [
67 | "Empty",
68 | "Identifier",
69 | "Constant",
70 | "Self",
71 | "BuiltInType",
72 | "BuiltInFunc",
73 | "OpIn",
74 | "OpEqual",
75 | "OpNotEqual",
76 | "OpLess",
77 | "OpLessEqual",
78 | "OpGreater",
79 | "OpGreaterEqual",
80 | "OpAnd",
81 | "OpOr",
82 | "OpNot",
83 | "OpAdd",
84 | "OpSub",
85 | "OpMul",
86 | "OpDiv",
87 | "OpMod",
88 | "OpShiftLeft",
89 | "OpShiftRight",
90 | "OpAssign",
91 | "OpAssignAdd",
92 | "OpAssignSub",
93 | "OpAssignMul",
94 | "OpAssignDiv",
95 | "OpAssignMod",
96 | "OpAssignShiftLeft",
97 | "OpAssignShiftRight",
98 | "OpAssignBitAnd",
99 | "OpAssignBitOr",
100 | "OpAssignBitXor",
101 | "OpBitAnd",
102 | "OpBitOr",
103 | "OpBitXor",
104 | "OpBitInvert",
105 | "CfIf",
106 | "CfElif",
107 | "CfElse",
108 | "CfFor",
109 | "CfDo",
110 | "CfWhile",
111 | "CfSwitch",
112 | "CfCase",
113 | "CfBreak",
114 | "CfContinue",
115 | "CfPass",
116 | "CfReturn",
117 | "PrFunction",
118 | "PrClass",
119 | "PrExtends",
120 | "PrTool",
121 | "PrStatic",
122 | "PrExport",
123 | "PrSetget",
124 | "PrConst",
125 | "PrVar",
126 | "PrPreload",
127 | "PrAssert",
128 | "PrYield",
129 | "BracketOpen",
130 | "BracketClose",
131 | "CurlyBracketOpen",
132 | "CurlyBracketClose",
133 | "ParenthesisOpen",
134 | "ParenthesisClose",
135 | "Comma",
136 | "Semicolon",
137 | "Period",
138 | "QuestionMark",
139 | "Colon",
140 | "Newline",
141 | "Error",
142 | "Eof",
143 | "Max"
144 | ]
145 | }
--------------------------------------------------------------------------------
/GdTool/Resources/BytecodeProviders/bytecode_97f34a1.json:
--------------------------------------------------------------------------------
1 | {
2 | "CommitHash": "97f34a1dd6b472318df80d801f80f8d5eecd9e99",
3 | "Description": "1.1 dev (97f34a1 / 2015-03-25 / Bytecode version: 3) - added `seed`, `get_inst` function",
4 | "BytecodeVersion": 3,
5 | "TypeNameVersion": 2,
6 | "FunctionNames": [
7 | "sin",
8 | "cos",
9 | "tan",
10 | "sinh",
11 | "cosh",
12 | "tanh",
13 | "asin",
14 | "acos",
15 | "atan",
16 | "atan2",
17 | "sqrt",
18 | "fmod",
19 | "fposmod",
20 | "floor",
21 | "ceil",
22 | "round",
23 | "abs",
24 | "sign",
25 | "pow",
26 | "log",
27 | "exp",
28 | "is_nan",
29 | "is_inf",
30 | "ease",
31 | "decimals",
32 | "stepify",
33 | "lerp",
34 | "dectime",
35 | "randomize",
36 | "randi",
37 | "randf",
38 | "rand_range",
39 | "seed",
40 | "rand_seed",
41 | "deg2rad",
42 | "rad2deg",
43 | "linear2db",
44 | "db2linear",
45 | "max",
46 | "min",
47 | "clamp",
48 | "nearest_po2",
49 | "weakref",
50 | "funcref",
51 | "convert",
52 | "typeof",
53 | "str",
54 | "print",
55 | "printt",
56 | "printerr",
57 | "printraw",
58 | "var2str",
59 | "str2var",
60 | "range",
61 | "load",
62 | "inst2dict",
63 | "dict2inst",
64 | "hash",
65 | "print_stack",
66 | "get_inst"
67 | ],
68 | "Tokens": [
69 | "Empty",
70 | "Identifier",
71 | "Constant",
72 | "Self",
73 | "BuiltInType",
74 | "BuiltInFunc",
75 | "OpIn",
76 | "OpEqual",
77 | "OpNotEqual",
78 | "OpLess",
79 | "OpLessEqual",
80 | "OpGreater",
81 | "OpGreaterEqual",
82 | "OpAnd",
83 | "OpOr",
84 | "OpNot",
85 | "OpAdd",
86 | "OpSub",
87 | "OpMul",
88 | "OpDiv",
89 | "OpMod",
90 | "OpShiftLeft",
91 | "OpShiftRight",
92 | "OpAssign",
93 | "OpAssignAdd",
94 | "OpAssignSub",
95 | "OpAssignMul",
96 | "OpAssignDiv",
97 | "OpAssignMod",
98 | "OpAssignShiftLeft",
99 | "OpAssignShiftRight",
100 | "OpAssignBitAnd",
101 | "OpAssignBitOr",
102 | "OpAssignBitXor",
103 | "OpBitAnd",
104 | "OpBitOr",
105 | "OpBitXor",
106 | "OpBitInvert",
107 | "CfIf",
108 | "CfElif",
109 | "CfElse",
110 | "CfFor",
111 | "CfDo",
112 | "CfWhile",
113 | "CfSwitch",
114 | "CfCase",
115 | "CfBreak",
116 | "CfContinue",
117 | "CfPass",
118 | "CfReturn",
119 | "PrFunction",
120 | "PrClass",
121 | "PrExtends",
122 | "PrTool",
123 | "PrStatic",
124 | "PrExport",
125 | "PrSetget",
126 | "PrConst",
127 | "PrVar",
128 | "PrPreload",
129 | "PrAssert",
130 | "PrYield",
131 | "BracketOpen",
132 | "BracketClose",
133 | "CurlyBracketOpen",
134 | "CurlyBracketClose",
135 | "ParenthesisOpen",
136 | "ParenthesisClose",
137 | "Comma",
138 | "Semicolon",
139 | "Period",
140 | "QuestionMark",
141 | "Colon",
142 | "Newline",
143 | "Error",
144 | "Eof",
145 | "Max"
146 | ]
147 | }
--------------------------------------------------------------------------------
/GdTool/Resources/BytecodeProviders/bytecode_65d48d6.json:
--------------------------------------------------------------------------------
1 | {
2 | "CommitHash": "65d48d6d39452e003381de7e2b0758f6580be197",
3 | "Description": "1.1.0 release (65d48d6 / 2015-05-09 / Bytecode version: 4) - added `prints` function",
4 | "BytecodeVersion": 4,
5 | "TypeNameVersion": 2,
6 | "FunctionNames": [
7 | "sin",
8 | "cos",
9 | "tan",
10 | "sinh",
11 | "cosh",
12 | "tanh",
13 | "asin",
14 | "acos",
15 | "atan",
16 | "atan2",
17 | "sqrt",
18 | "fmod",
19 | "fposmod",
20 | "floor",
21 | "ceil",
22 | "round",
23 | "abs",
24 | "sign",
25 | "pow",
26 | "log",
27 | "exp",
28 | "is_nan",
29 | "is_inf",
30 | "ease",
31 | "decimals",
32 | "stepify",
33 | "lerp",
34 | "dectime",
35 | "randomize",
36 | "randi",
37 | "randf",
38 | "rand_range",
39 | "seed",
40 | "rand_seed",
41 | "deg2rad",
42 | "rad2deg",
43 | "linear2db",
44 | "db2linear",
45 | "max",
46 | "min",
47 | "clamp",
48 | "nearest_po2",
49 | "weakref",
50 | "funcref",
51 | "convert",
52 | "typeof",
53 | "str",
54 | "print",
55 | "printt",
56 | "prints",
57 | "printerr",
58 | "printraw",
59 | "var2str",
60 | "str2var",
61 | "range",
62 | "load",
63 | "inst2dict",
64 | "dict2inst",
65 | "hash",
66 | "print_stack",
67 | "instance_from_id"
68 | ],
69 | "Tokens": [
70 | "Empty",
71 | "Identifier",
72 | "Constant",
73 | "Self",
74 | "BuiltInType",
75 | "BuiltInFunc",
76 | "OpIn",
77 | "OpEqual",
78 | "OpNotEqual",
79 | "OpLess",
80 | "OpLessEqual",
81 | "OpGreater",
82 | "OpGreaterEqual",
83 | "OpAnd",
84 | "OpOr",
85 | "OpNot",
86 | "OpAdd",
87 | "OpSub",
88 | "OpMul",
89 | "OpDiv",
90 | "OpMod",
91 | "OpShiftLeft",
92 | "OpShiftRight",
93 | "OpAssign",
94 | "OpAssignAdd",
95 | "OpAssignSub",
96 | "OpAssignMul",
97 | "OpAssignDiv",
98 | "OpAssignMod",
99 | "OpAssignShiftLeft",
100 | "OpAssignShiftRight",
101 | "OpAssignBitAnd",
102 | "OpAssignBitOr",
103 | "OpAssignBitXor",
104 | "OpBitAnd",
105 | "OpBitOr",
106 | "OpBitXor",
107 | "OpBitInvert",
108 | "CfIf",
109 | "CfElif",
110 | "CfElse",
111 | "CfFor",
112 | "CfDo",
113 | "CfWhile",
114 | "CfSwitch",
115 | "CfCase",
116 | "CfBreak",
117 | "CfContinue",
118 | "CfPass",
119 | "CfReturn",
120 | "PrFunction",
121 | "PrClass",
122 | "PrExtends",
123 | "PrTool",
124 | "PrStatic",
125 | "PrExport",
126 | "PrSetget",
127 | "PrConst",
128 | "PrVar",
129 | "PrPreload",
130 | "PrAssert",
131 | "PrYield",
132 | "BracketOpen",
133 | "BracketClose",
134 | "CurlyBracketOpen",
135 | "CurlyBracketClose",
136 | "ParenthesisOpen",
137 | "ParenthesisClose",
138 | "Comma",
139 | "Semicolon",
140 | "Period",
141 | "QuestionMark",
142 | "Colon",
143 | "Newline",
144 | "Error",
145 | "Eof",
146 | "Max"
147 | ]
148 | }
--------------------------------------------------------------------------------
/GdTool/Resources/BytecodeProviders/bytecode_be46be7.json:
--------------------------------------------------------------------------------
1 | {
2 | "CommitHash": "be46be78012e98d68b960437bf3d33e577948548",
3 | "Description": "1.1 dev (be46be7 / 2015-04-18 / Bytecode version: 3) - function `get_inst` renamed to `instance_from_id`",
4 | "BytecodeVersion": 3,
5 | "TypeNameVersion": 2,
6 | "FunctionNames": [
7 | "sin",
8 | "cos",
9 | "tan",
10 | "sinh",
11 | "cosh",
12 | "tanh",
13 | "asin",
14 | "acos",
15 | "atan",
16 | "atan2",
17 | "sqrt",
18 | "fmod",
19 | "fposmod",
20 | "floor",
21 | "ceil",
22 | "round",
23 | "abs",
24 | "sign",
25 | "pow",
26 | "log",
27 | "exp",
28 | "is_nan",
29 | "is_inf",
30 | "ease",
31 | "decimals",
32 | "stepify",
33 | "lerp",
34 | "dectime",
35 | "randomize",
36 | "randi",
37 | "randf",
38 | "rand_range",
39 | "seed",
40 | "rand_seed",
41 | "deg2rad",
42 | "rad2deg",
43 | "linear2db",
44 | "db2linear",
45 | "max",
46 | "min",
47 | "clamp",
48 | "nearest_po2",
49 | "weakref",
50 | "funcref",
51 | "convert",
52 | "typeof",
53 | "str",
54 | "print",
55 | "printt",
56 | "printerr",
57 | "printraw",
58 | "var2str",
59 | "str2var",
60 | "range",
61 | "load",
62 | "inst2dict",
63 | "dict2inst",
64 | "hash",
65 | "print_stack",
66 | "instance_from_id"
67 | ],
68 | "Tokens": [
69 | "Empty",
70 | "Identifier",
71 | "Constant",
72 | "Self",
73 | "BuiltInType",
74 | "BuiltInFunc",
75 | "OpIn",
76 | "OpEqual",
77 | "OpNotEqual",
78 | "OpLess",
79 | "OpLessEqual",
80 | "OpGreater",
81 | "OpGreaterEqual",
82 | "OpAnd",
83 | "OpOr",
84 | "OpNot",
85 | "OpAdd",
86 | "OpSub",
87 | "OpMul",
88 | "OpDiv",
89 | "OpMod",
90 | "OpShiftLeft",
91 | "OpShiftRight",
92 | "OpAssign",
93 | "OpAssignAdd",
94 | "OpAssignSub",
95 | "OpAssignMul",
96 | "OpAssignDiv",
97 | "OpAssignMod",
98 | "OpAssignShiftLeft",
99 | "OpAssignShiftRight",
100 | "OpAssignBitAnd",
101 | "OpAssignBitOr",
102 | "OpAssignBitXor",
103 | "OpBitAnd",
104 | "OpBitOr",
105 | "OpBitXor",
106 | "OpBitInvert",
107 | "CfIf",
108 | "CfElif",
109 | "CfElse",
110 | "CfFor",
111 | "CfDo",
112 | "CfWhile",
113 | "CfSwitch",
114 | "CfCase",
115 | "CfBreak",
116 | "CfContinue",
117 | "CfPass",
118 | "CfReturn",
119 | "PrFunction",
120 | "PrClass",
121 | "PrExtends",
122 | "PrTool",
123 | "PrStatic",
124 | "PrExport",
125 | "PrSetget",
126 | "PrConst",
127 | "PrVar",
128 | "PrPreload",
129 | "PrAssert",
130 | "PrYield",
131 | "BracketOpen",
132 | "BracketClose",
133 | "CurlyBracketOpen",
134 | "CurlyBracketClose",
135 | "ParenthesisOpen",
136 | "ParenthesisClose",
137 | "Comma",
138 | "Semicolon",
139 | "Period",
140 | "QuestionMark",
141 | "Colon",
142 | "Newline",
143 | "Error",
144 | "Eof",
145 | "Max"
146 | ]
147 | }
--------------------------------------------------------------------------------
/GdTool/Resources/BytecodeProviders/bytecode_48f1d02.json:
--------------------------------------------------------------------------------
1 | {
2 | "CommitHash": "48f1d02da4795ba9d485fe5fe2bea907be2fc467",
3 | "Description": "2.0 dev (48f1d02 / 2015-06-24 / Bytecode version: 5) - added `SIGNAL` token",
4 | "BytecodeVersion": 5,
5 | "TypeNameVersion": 2,
6 | "FunctionNames": [
7 | "sin",
8 | "cos",
9 | "tan",
10 | "sinh",
11 | "cosh",
12 | "tanh",
13 | "asin",
14 | "acos",
15 | "atan",
16 | "atan2",
17 | "sqrt",
18 | "fmod",
19 | "fposmod",
20 | "floor",
21 | "ceil",
22 | "round",
23 | "abs",
24 | "sign",
25 | "pow",
26 | "log",
27 | "exp",
28 | "is_nan",
29 | "is_inf",
30 | "ease",
31 | "decimals",
32 | "stepify",
33 | "lerp",
34 | "dectime",
35 | "randomize",
36 | "randi",
37 | "randf",
38 | "rand_range",
39 | "seed",
40 | "rand_seed",
41 | "deg2rad",
42 | "rad2deg",
43 | "linear2db",
44 | "db2linear",
45 | "max",
46 | "min",
47 | "clamp",
48 | "nearest_po2",
49 | "weakref",
50 | "funcref",
51 | "convert",
52 | "typeof",
53 | "str",
54 | "print",
55 | "printt",
56 | "prints",
57 | "printerr",
58 | "printraw",
59 | "var2str",
60 | "str2var",
61 | "range",
62 | "load",
63 | "inst2dict",
64 | "dict2inst",
65 | "hash",
66 | "print_stack",
67 | "instance_from_id"
68 | ],
69 | "Tokens": [
70 | "Empty",
71 | "Identifier",
72 | "Constant",
73 | "Self",
74 | "BuiltInType",
75 | "BuiltInFunc",
76 | "OpIn",
77 | "OpEqual",
78 | "OpNotEqual",
79 | "OpLess",
80 | "OpLessEqual",
81 | "OpGreater",
82 | "OpGreaterEqual",
83 | "OpAnd",
84 | "OpOr",
85 | "OpNot",
86 | "OpAdd",
87 | "OpSub",
88 | "OpMul",
89 | "OpDiv",
90 | "OpMod",
91 | "OpShiftLeft",
92 | "OpShiftRight",
93 | "OpAssign",
94 | "OpAssignAdd",
95 | "OpAssignSub",
96 | "OpAssignMul",
97 | "OpAssignDiv",
98 | "OpAssignMod",
99 | "OpAssignShiftLeft",
100 | "OpAssignShiftRight",
101 | "OpAssignBitAnd",
102 | "OpAssignBitOr",
103 | "OpAssignBitXor",
104 | "OpBitAnd",
105 | "OpBitOr",
106 | "OpBitXor",
107 | "OpBitInvert",
108 | "CfIf",
109 | "CfElif",
110 | "CfElse",
111 | "CfFor",
112 | "CfDo",
113 | "CfWhile",
114 | "CfSwitch",
115 | "CfCase",
116 | "CfBreak",
117 | "CfContinue",
118 | "CfPass",
119 | "CfReturn",
120 | "PrFunction",
121 | "PrClass",
122 | "PrExtends",
123 | "PrTool",
124 | "PrStatic",
125 | "PrExport",
126 | "PrSetget",
127 | "PrConst",
128 | "PrVar",
129 | "PrPreload",
130 | "PrAssert",
131 | "PrYield",
132 | "PrSignal",
133 | "BracketOpen",
134 | "BracketClose",
135 | "CurlyBracketOpen",
136 | "CurlyBracketClose",
137 | "ParenthesisOpen",
138 | "ParenthesisClose",
139 | "Comma",
140 | "Semicolon",
141 | "Period",
142 | "QuestionMark",
143 | "Colon",
144 | "Newline",
145 | "Error",
146 | "Eof",
147 | "Max"
148 | ]
149 | }
--------------------------------------------------------------------------------
/GdTool/Resources/BytecodeProviders/bytecode_30c1229.json:
--------------------------------------------------------------------------------
1 | {
2 | "CommitHash": "30c12297dc6df7d35df140475c0cec7308aea77a",
3 | "Description": "2.0 dev (30c1229 / 2015-12-28 / Bytecode version: 6) - added `ONREADY` token",
4 | "BytecodeVersion": 6,
5 | "TypeNameVersion": 2,
6 | "FunctionNames": [
7 | "sin",
8 | "cos",
9 | "tan",
10 | "sinh",
11 | "cosh",
12 | "tanh",
13 | "asin",
14 | "acos",
15 | "atan",
16 | "atan2",
17 | "sqrt",
18 | "fmod",
19 | "fposmod",
20 | "floor",
21 | "ceil",
22 | "round",
23 | "abs",
24 | "sign",
25 | "pow",
26 | "log",
27 | "exp",
28 | "is_nan",
29 | "is_inf",
30 | "ease",
31 | "decimals",
32 | "stepify",
33 | "lerp",
34 | "dectime",
35 | "randomize",
36 | "randi",
37 | "randf",
38 | "rand_range",
39 | "seed",
40 | "rand_seed",
41 | "deg2rad",
42 | "rad2deg",
43 | "linear2db",
44 | "db2linear",
45 | "max",
46 | "min",
47 | "clamp",
48 | "nearest_po2",
49 | "weakref",
50 | "funcref",
51 | "convert",
52 | "typeof",
53 | "str",
54 | "print",
55 | "printt",
56 | "prints",
57 | "printerr",
58 | "printraw",
59 | "var2str",
60 | "str2var",
61 | "range",
62 | "load",
63 | "inst2dict",
64 | "dict2inst",
65 | "hash",
66 | "print_stack",
67 | "instance_from_id"
68 | ],
69 | "Tokens": [
70 | "Empty",
71 | "Identifier",
72 | "Constant",
73 | "Self",
74 | "BuiltInType",
75 | "BuiltInFunc",
76 | "OpIn",
77 | "OpEqual",
78 | "OpNotEqual",
79 | "OpLess",
80 | "OpLessEqual",
81 | "OpGreater",
82 | "OpGreaterEqual",
83 | "OpAnd",
84 | "OpOr",
85 | "OpNot",
86 | "OpAdd",
87 | "OpSub",
88 | "OpMul",
89 | "OpDiv",
90 | "OpMod",
91 | "OpShiftLeft",
92 | "OpShiftRight",
93 | "OpAssign",
94 | "OpAssignAdd",
95 | "OpAssignSub",
96 | "OpAssignMul",
97 | "OpAssignDiv",
98 | "OpAssignMod",
99 | "OpAssignShiftLeft",
100 | "OpAssignShiftRight",
101 | "OpAssignBitAnd",
102 | "OpAssignBitOr",
103 | "OpAssignBitXor",
104 | "OpBitAnd",
105 | "OpBitOr",
106 | "OpBitXor",
107 | "OpBitInvert",
108 | "CfIf",
109 | "CfElif",
110 | "CfElse",
111 | "CfFor",
112 | "CfDo",
113 | "CfWhile",
114 | "CfSwitch",
115 | "CfCase",
116 | "CfBreak",
117 | "CfContinue",
118 | "CfPass",
119 | "CfReturn",
120 | "PrFunction",
121 | "PrClass",
122 | "PrExtends",
123 | "PrOnready",
124 | "PrTool",
125 | "PrStatic",
126 | "PrExport",
127 | "PrSetget",
128 | "PrConst",
129 | "PrVar",
130 | "PrPreload",
131 | "PrAssert",
132 | "PrYield",
133 | "PrSignal",
134 | "BracketOpen",
135 | "BracketClose",
136 | "CurlyBracketOpen",
137 | "CurlyBracketClose",
138 | "ParenthesisOpen",
139 | "ParenthesisClose",
140 | "Comma",
141 | "Semicolon",
142 | "Period",
143 | "QuestionMark",
144 | "Colon",
145 | "Newline",
146 | "Error",
147 | "Eof",
148 | "Max"
149 | ]
150 | }
--------------------------------------------------------------------------------
/GdTool/Resources/BytecodeProviders/bytecode_7d2d144.json:
--------------------------------------------------------------------------------
1 | {
2 | "CommitHash": "7d2d1442f83e6a7a57a1823a6cf5af53e5419d5f",
3 | "Description": "2.0 dev (7d2d144 / 2015-12-29 / Bytecode version: 7) - added `BREAKPOINT` token",
4 | "BytecodeVersion": 7,
5 | "TypeNameVersion": 2,
6 | "FunctionNames": [
7 | "sin",
8 | "cos",
9 | "tan",
10 | "sinh",
11 | "cosh",
12 | "tanh",
13 | "asin",
14 | "acos",
15 | "atan",
16 | "atan2",
17 | "sqrt",
18 | "fmod",
19 | "fposmod",
20 | "floor",
21 | "ceil",
22 | "round",
23 | "abs",
24 | "sign",
25 | "pow",
26 | "log",
27 | "exp",
28 | "is_nan",
29 | "is_inf",
30 | "ease",
31 | "decimals",
32 | "stepify",
33 | "lerp",
34 | "dectime",
35 | "randomize",
36 | "randi",
37 | "randf",
38 | "rand_range",
39 | "seed",
40 | "rand_seed",
41 | "deg2rad",
42 | "rad2deg",
43 | "linear2db",
44 | "db2linear",
45 | "max",
46 | "min",
47 | "clamp",
48 | "nearest_po2",
49 | "weakref",
50 | "funcref",
51 | "convert",
52 | "typeof",
53 | "str",
54 | "print",
55 | "printt",
56 | "prints",
57 | "printerr",
58 | "printraw",
59 | "var2str",
60 | "str2var",
61 | "range",
62 | "load",
63 | "inst2dict",
64 | "dict2inst",
65 | "hash",
66 | "print_stack",
67 | "instance_from_id"
68 | ],
69 | "Tokens": [
70 | "Empty",
71 | "Identifier",
72 | "Constant",
73 | "Self",
74 | "BuiltInType",
75 | "BuiltInFunc",
76 | "OpIn",
77 | "OpEqual",
78 | "OpNotEqual",
79 | "OpLess",
80 | "OpLessEqual",
81 | "OpGreater",
82 | "OpGreaterEqual",
83 | "OpAnd",
84 | "OpOr",
85 | "OpNot",
86 | "OpAdd",
87 | "OpSub",
88 | "OpMul",
89 | "OpDiv",
90 | "OpMod",
91 | "OpShiftLeft",
92 | "OpShiftRight",
93 | "OpAssign",
94 | "OpAssignAdd",
95 | "OpAssignSub",
96 | "OpAssignMul",
97 | "OpAssignDiv",
98 | "OpAssignMod",
99 | "OpAssignShiftLeft",
100 | "OpAssignShiftRight",
101 | "OpAssignBitAnd",
102 | "OpAssignBitOr",
103 | "OpAssignBitXor",
104 | "OpBitAnd",
105 | "OpBitOr",
106 | "OpBitXor",
107 | "OpBitInvert",
108 | "CfIf",
109 | "CfElif",
110 | "CfElse",
111 | "CfFor",
112 | "CfDo",
113 | "CfWhile",
114 | "CfSwitch",
115 | "CfCase",
116 | "CfBreak",
117 | "CfContinue",
118 | "CfPass",
119 | "CfReturn",
120 | "PrFunction",
121 | "PrClass",
122 | "PrExtends",
123 | "PrOnready",
124 | "PrTool",
125 | "PrStatic",
126 | "PrExport",
127 | "PrSetget",
128 | "PrConst",
129 | "PrVar",
130 | "PrPreload",
131 | "PrAssert",
132 | "PrYield",
133 | "PrSignal",
134 | "PrBreakpoint",
135 | "BracketOpen",
136 | "BracketClose",
137 | "CurlyBracketOpen",
138 | "CurlyBracketClose",
139 | "ParenthesisOpen",
140 | "ParenthesisClose",
141 | "Comma",
142 | "Semicolon",
143 | "Period",
144 | "QuestionMark",
145 | "Colon",
146 | "Newline",
147 | "Error",
148 | "Eof",
149 | "Max"
150 | ]
151 | }
--------------------------------------------------------------------------------
/GdTool/Resources/BytecodeProviders/bytecode_64872ca.json:
--------------------------------------------------------------------------------
1 | {
2 | "CommitHash": "64872ca8112f5b9c726914c51922e2c4e5c8f667",
3 | "Description": "2.0 dev (64872ca / 2015-12-31 / Bytecode version: 8) - added `Color8` function",
4 | "BytecodeVersion": 8,
5 | "TypeNameVersion": 2,
6 | "FunctionNames": [
7 | "sin",
8 | "cos",
9 | "tan",
10 | "sinh",
11 | "cosh",
12 | "tanh",
13 | "asin",
14 | "acos",
15 | "atan",
16 | "atan2",
17 | "sqrt",
18 | "fmod",
19 | "fposmod",
20 | "floor",
21 | "ceil",
22 | "round",
23 | "abs",
24 | "sign",
25 | "pow",
26 | "log",
27 | "exp",
28 | "is_nan",
29 | "is_inf",
30 | "ease",
31 | "decimals",
32 | "stepify",
33 | "lerp",
34 | "dectime",
35 | "randomize",
36 | "randi",
37 | "randf",
38 | "rand_range",
39 | "seed",
40 | "rand_seed",
41 | "deg2rad",
42 | "rad2deg",
43 | "linear2db",
44 | "db2linear",
45 | "max",
46 | "min",
47 | "clamp",
48 | "nearest_po2",
49 | "weakref",
50 | "funcref",
51 | "convert",
52 | "typeof",
53 | "str",
54 | "print",
55 | "printt",
56 | "prints",
57 | "printerr",
58 | "printraw",
59 | "var2str",
60 | "str2var",
61 | "range",
62 | "load",
63 | "inst2dict",
64 | "dict2inst",
65 | "hash",
66 | "Color8",
67 | "print_stack",
68 | "instance_from_id"
69 | ],
70 | "Tokens": [
71 | "Empty",
72 | "Identifier",
73 | "Constant",
74 | "Self",
75 | "BuiltInType",
76 | "BuiltInFunc",
77 | "OpIn",
78 | "OpEqual",
79 | "OpNotEqual",
80 | "OpLess",
81 | "OpLessEqual",
82 | "OpGreater",
83 | "OpGreaterEqual",
84 | "OpAnd",
85 | "OpOr",
86 | "OpNot",
87 | "OpAdd",
88 | "OpSub",
89 | "OpMul",
90 | "OpDiv",
91 | "OpMod",
92 | "OpShiftLeft",
93 | "OpShiftRight",
94 | "OpAssign",
95 | "OpAssignAdd",
96 | "OpAssignSub",
97 | "OpAssignMul",
98 | "OpAssignDiv",
99 | "OpAssignMod",
100 | "OpAssignShiftLeft",
101 | "OpAssignShiftRight",
102 | "OpAssignBitAnd",
103 | "OpAssignBitOr",
104 | "OpAssignBitXor",
105 | "OpBitAnd",
106 | "OpBitOr",
107 | "OpBitXor",
108 | "OpBitInvert",
109 | "CfIf",
110 | "CfElif",
111 | "CfElse",
112 | "CfFor",
113 | "CfDo",
114 | "CfWhile",
115 | "CfSwitch",
116 | "CfCase",
117 | "CfBreak",
118 | "CfContinue",
119 | "CfPass",
120 | "CfReturn",
121 | "PrFunction",
122 | "PrClass",
123 | "PrExtends",
124 | "PrOnready",
125 | "PrTool",
126 | "PrStatic",
127 | "PrExport",
128 | "PrSetget",
129 | "PrConst",
130 | "PrVar",
131 | "PrPreload",
132 | "PrAssert",
133 | "PrYield",
134 | "PrSignal",
135 | "PrBreakpoint",
136 | "BracketOpen",
137 | "BracketClose",
138 | "CurlyBracketOpen",
139 | "CurlyBracketClose",
140 | "ParenthesisOpen",
141 | "ParenthesisClose",
142 | "Comma",
143 | "Semicolon",
144 | "Period",
145 | "QuestionMark",
146 | "Colon",
147 | "Newline",
148 | "Error",
149 | "Eof",
150 | "Max"
151 | ]
152 | }
--------------------------------------------------------------------------------
/GdTool/Resources/BytecodeProviders/bytecode_6174585.json:
--------------------------------------------------------------------------------
1 | {
2 | "CommitHash": "61745855d0bb309cb0ebcd2d92fc15f7f6fb1840",
3 | "Description": "2.0 dev (6174585 / 2016-01-02 / Bytecode version: 9) - added `CONST_PI` token",
4 | "BytecodeVersion": 9,
5 | "TypeNameVersion": 2,
6 | "FunctionNames": [
7 | "sin",
8 | "cos",
9 | "tan",
10 | "sinh",
11 | "cosh",
12 | "tanh",
13 | "asin",
14 | "acos",
15 | "atan",
16 | "atan2",
17 | "sqrt",
18 | "fmod",
19 | "fposmod",
20 | "floor",
21 | "ceil",
22 | "round",
23 | "abs",
24 | "sign",
25 | "pow",
26 | "log",
27 | "exp",
28 | "is_nan",
29 | "is_inf",
30 | "ease",
31 | "decimals",
32 | "stepify",
33 | "lerp",
34 | "dectime",
35 | "randomize",
36 | "randi",
37 | "randf",
38 | "rand_range",
39 | "seed",
40 | "rand_seed",
41 | "deg2rad",
42 | "rad2deg",
43 | "linear2db",
44 | "db2linear",
45 | "max",
46 | "min",
47 | "clamp",
48 | "nearest_po2",
49 | "weakref",
50 | "funcref",
51 | "convert",
52 | "typeof",
53 | "str",
54 | "print",
55 | "printt",
56 | "prints",
57 | "printerr",
58 | "printraw",
59 | "var2str",
60 | "str2var",
61 | "range",
62 | "load",
63 | "inst2dict",
64 | "dict2inst",
65 | "hash",
66 | "Color8",
67 | "print_stack",
68 | "instance_from_id"
69 | ],
70 | "Tokens": [
71 | "Empty",
72 | "Identifier",
73 | "Constant",
74 | "Self",
75 | "BuiltInType",
76 | "BuiltInFunc",
77 | "OpIn",
78 | "OpEqual",
79 | "OpNotEqual",
80 | "OpLess",
81 | "OpLessEqual",
82 | "OpGreater",
83 | "OpGreaterEqual",
84 | "OpAnd",
85 | "OpOr",
86 | "OpNot",
87 | "OpAdd",
88 | "OpSub",
89 | "OpMul",
90 | "OpDiv",
91 | "OpMod",
92 | "OpShiftLeft",
93 | "OpShiftRight",
94 | "OpAssign",
95 | "OpAssignAdd",
96 | "OpAssignSub",
97 | "OpAssignMul",
98 | "OpAssignDiv",
99 | "OpAssignMod",
100 | "OpAssignShiftLeft",
101 | "OpAssignShiftRight",
102 | "OpAssignBitAnd",
103 | "OpAssignBitOr",
104 | "OpAssignBitXor",
105 | "OpBitAnd",
106 | "OpBitOr",
107 | "OpBitXor",
108 | "OpBitInvert",
109 | "CfIf",
110 | "CfElif",
111 | "CfElse",
112 | "CfFor",
113 | "CfDo",
114 | "CfWhile",
115 | "CfSwitch",
116 | "CfCase",
117 | "CfBreak",
118 | "CfContinue",
119 | "CfPass",
120 | "CfReturn",
121 | "PrFunction",
122 | "PrClass",
123 | "PrExtends",
124 | "PrOnready",
125 | "PrTool",
126 | "PrStatic",
127 | "PrExport",
128 | "PrSetget",
129 | "PrConst",
130 | "PrVar",
131 | "PrPreload",
132 | "PrAssert",
133 | "PrYield",
134 | "PrSignal",
135 | "PrBreakpoint",
136 | "BracketOpen",
137 | "BracketClose",
138 | "CurlyBracketOpen",
139 | "CurlyBracketClose",
140 | "ParenthesisOpen",
141 | "ParenthesisClose",
142 | "Comma",
143 | "Semicolon",
144 | "Period",
145 | "QuestionMark",
146 | "Colon",
147 | "Newline",
148 | "ConstPi",
149 | "Error",
150 | "Eof",
151 | "Max"
152 | ]
153 | }
--------------------------------------------------------------------------------
/GdTool/Resources/BytecodeProviders/bytecode_23441ec.json:
--------------------------------------------------------------------------------
1 | {
2 | "CommitHash": "23441ec8676f6d804692fe1e49e7fea2bec55341",
3 | "Description": "2.0.0 - 2.0.4-1 release (23441ec / 2016-01-02 / Bytecode version: 10) - added `var2bytes`, `bytes2var` functions",
4 | "BytecodeVersion": 10,
5 | "TypeNameVersion": 2,
6 | "FunctionNames": [
7 | "sin",
8 | "cos",
9 | "tan",
10 | "sinh",
11 | "cosh",
12 | "tanh",
13 | "asin",
14 | "acos",
15 | "atan",
16 | "atan2",
17 | "sqrt",
18 | "fmod",
19 | "fposmod",
20 | "floor",
21 | "ceil",
22 | "round",
23 | "abs",
24 | "sign",
25 | "pow",
26 | "log",
27 | "exp",
28 | "is_nan",
29 | "is_inf",
30 | "ease",
31 | "decimals",
32 | "stepify",
33 | "lerp",
34 | "dectime",
35 | "randomize",
36 | "randi",
37 | "randf",
38 | "rand_range",
39 | "seed",
40 | "rand_seed",
41 | "deg2rad",
42 | "rad2deg",
43 | "linear2db",
44 | "db2linear",
45 | "max",
46 | "min",
47 | "clamp",
48 | "nearest_po2",
49 | "weakref",
50 | "funcref",
51 | "convert",
52 | "typeof",
53 | "str",
54 | "print",
55 | "printt",
56 | "prints",
57 | "printerr",
58 | "printraw",
59 | "var2str",
60 | "str2var",
61 | "var2bytes",
62 | "str2var",
63 | "range",
64 | "load",
65 | "inst2dict",
66 | "dict2inst",
67 | "hash",
68 | "Color8",
69 | "print_stack",
70 | "instance_from_id"
71 | ],
72 | "Tokens": [
73 | "Empty",
74 | "Identifier",
75 | "Constant",
76 | "Self",
77 | "BuiltInType",
78 | "BuiltInFunc",
79 | "OpIn",
80 | "OpEqual",
81 | "OpNotEqual",
82 | "OpLess",
83 | "OpLessEqual",
84 | "OpGreater",
85 | "OpGreaterEqual",
86 | "OpAnd",
87 | "OpOr",
88 | "OpNot",
89 | "OpAdd",
90 | "OpSub",
91 | "OpMul",
92 | "OpDiv",
93 | "OpMod",
94 | "OpShiftLeft",
95 | "OpShiftRight",
96 | "OpAssign",
97 | "OpAssignAdd",
98 | "OpAssignSub",
99 | "OpAssignMul",
100 | "OpAssignDiv",
101 | "OpAssignMod",
102 | "OpAssignShiftLeft",
103 | "OpAssignShiftRight",
104 | "OpAssignBitAnd",
105 | "OpAssignBitOr",
106 | "OpAssignBitXor",
107 | "OpBitAnd",
108 | "OpBitOr",
109 | "OpBitXor",
110 | "OpBitInvert",
111 | "CfIf",
112 | "CfElif",
113 | "CfElse",
114 | "CfFor",
115 | "CfDo",
116 | "CfWhile",
117 | "CfSwitch",
118 | "CfCase",
119 | "CfBreak",
120 | "CfContinue",
121 | "CfPass",
122 | "CfReturn",
123 | "PrFunction",
124 | "PrClass",
125 | "PrExtends",
126 | "PrOnready",
127 | "PrTool",
128 | "PrStatic",
129 | "PrExport",
130 | "PrSetget",
131 | "PrConst",
132 | "PrVar",
133 | "PrPreload",
134 | "PrAssert",
135 | "PrYield",
136 | "PrSignal",
137 | "PrBreakpoint",
138 | "BracketOpen",
139 | "BracketClose",
140 | "CurlyBracketOpen",
141 | "CurlyBracketClose",
142 | "ParenthesisOpen",
143 | "ParenthesisClose",
144 | "Comma",
145 | "Semicolon",
146 | "Period",
147 | "QuestionMark",
148 | "Colon",
149 | "Newline",
150 | "ConstPi",
151 | "Error",
152 | "Eof",
153 | "Max"
154 | ]
155 | }
--------------------------------------------------------------------------------
/GdTool/Resources/BytecodeProviders/bytecode_7124599.json:
--------------------------------------------------------------------------------
1 | {
2 | "CommitHash": "71245995a4813d49449ac055f77cf60c896b483d",
3 | "Description": "2.1.0 - 2.1.1 release (7124599 / 2016-06-18 / Bytecode version: 10) - added `type_exists` function",
4 | "BytecodeVersion": 10,
5 | "TypeNameVersion": 2,
6 | "FunctionNames": [
7 | "sin",
8 | "cos",
9 | "tan",
10 | "sinh",
11 | "cosh",
12 | "tanh",
13 | "asin",
14 | "acos",
15 | "atan",
16 | "atan2",
17 | "sqrt",
18 | "fmod",
19 | "fposmod",
20 | "floor",
21 | "ceil",
22 | "round",
23 | "abs",
24 | "sign",
25 | "pow",
26 | "log",
27 | "exp",
28 | "is_nan",
29 | "is_inf",
30 | "ease",
31 | "decimals",
32 | "stepify",
33 | "lerp",
34 | "dectime",
35 | "randomize",
36 | "randi",
37 | "randf",
38 | "rand_range",
39 | "seed",
40 | "rand_seed",
41 | "deg2rad",
42 | "rad2deg",
43 | "linear2db",
44 | "db2linear",
45 | "max",
46 | "min",
47 | "clamp",
48 | "nearest_po2",
49 | "weakref",
50 | "funcref",
51 | "convert",
52 | "typeof",
53 | "type_exists",
54 | "str",
55 | "print",
56 | "printt",
57 | "prints",
58 | "printerr",
59 | "printraw",
60 | "var2str",
61 | "str2var",
62 | "var2bytes",
63 | "str2var",
64 | "range",
65 | "load",
66 | "inst2dict",
67 | "dict2inst",
68 | "hash",
69 | "Color8",
70 | "print_stack",
71 | "instance_from_id"
72 | ],
73 | "Tokens": [
74 | "Empty",
75 | "Identifier",
76 | "Constant",
77 | "Self",
78 | "BuiltInType",
79 | "BuiltInFunc",
80 | "OpIn",
81 | "OpEqual",
82 | "OpNotEqual",
83 | "OpLess",
84 | "OpLessEqual",
85 | "OpGreater",
86 | "OpGreaterEqual",
87 | "OpAnd",
88 | "OpOr",
89 | "OpNot",
90 | "OpAdd",
91 | "OpSub",
92 | "OpMul",
93 | "OpDiv",
94 | "OpMod",
95 | "OpShiftLeft",
96 | "OpShiftRight",
97 | "OpAssign",
98 | "OpAssignAdd",
99 | "OpAssignSub",
100 | "OpAssignMul",
101 | "OpAssignDiv",
102 | "OpAssignMod",
103 | "OpAssignShiftLeft",
104 | "OpAssignShiftRight",
105 | "OpAssignBitAnd",
106 | "OpAssignBitOr",
107 | "OpAssignBitXor",
108 | "OpBitAnd",
109 | "OpBitOr",
110 | "OpBitXor",
111 | "OpBitInvert",
112 | "CfIf",
113 | "CfElif",
114 | "CfElse",
115 | "CfFor",
116 | "CfDo",
117 | "CfWhile",
118 | "CfSwitch",
119 | "CfCase",
120 | "CfBreak",
121 | "CfContinue",
122 | "CfPass",
123 | "CfReturn",
124 | "PrFunction",
125 | "PrClass",
126 | "PrExtends",
127 | "PrOnready",
128 | "PrTool",
129 | "PrStatic",
130 | "PrExport",
131 | "PrSetget",
132 | "PrConst",
133 | "PrVar",
134 | "PrPreload",
135 | "PrAssert",
136 | "PrYield",
137 | "PrSignal",
138 | "PrBreakpoint",
139 | "BracketOpen",
140 | "BracketClose",
141 | "CurlyBracketOpen",
142 | "CurlyBracketClose",
143 | "ParenthesisOpen",
144 | "ParenthesisClose",
145 | "Comma",
146 | "Semicolon",
147 | "Period",
148 | "QuestionMark",
149 | "Colon",
150 | "Newline",
151 | "ConstPi",
152 | "Error",
153 | "Eof",
154 | "Max"
155 | ]
156 | }
--------------------------------------------------------------------------------
/GdTool/Resources/BytecodeProviders/bytecode_054a2ac.json:
--------------------------------------------------------------------------------
1 | {
2 | "CommitHash": "054a2ac579c4893f46b680b1cb0d2460aa3d9140",
3 | "Description": "3.0.0 - 3.0.6 release (054a2ac / 2017-11-20 / Bytecode version: 12) - added `polar2cartesian`, `cartesian2polar` functions",
4 | "BytecodeVersion": 12,
5 | "TypeNameVersion": 3,
6 | "FunctionNames": [
7 | "sin",
8 | "cos",
9 | "tan",
10 | "sinh",
11 | "cosh",
12 | "tanh",
13 | "asin",
14 | "acos",
15 | "atan",
16 | "atan2",
17 | "sqrt",
18 | "fmod",
19 | "fposmod",
20 | "floor",
21 | "ceil",
22 | "round",
23 | "abs",
24 | "sign",
25 | "pow",
26 | "log",
27 | "exp",
28 | "is_nan",
29 | "is_inf",
30 | "ease",
31 | "decimals",
32 | "stepify",
33 | "lerp",
34 | "inverse_lerp",
35 | "range_lerp",
36 | "dectime",
37 | "randomize",
38 | "randi",
39 | "randf",
40 | "rand_range",
41 | "seed",
42 | "rand_seed",
43 | "deg2rad",
44 | "rad2deg",
45 | "linear2db",
46 | "db2linear",
47 | "polar2cartesian",
48 | "cartesian2polar",
49 | "wrapi",
50 | "wrapf",
51 | "max",
52 | "min",
53 | "clamp",
54 | "nearest_po2",
55 | "weakref",
56 | "funcref",
57 | "convert",
58 | "typeof",
59 | "type_exists",
60 | "char",
61 | "str",
62 | "print",
63 | "printt",
64 | "prints",
65 | "printerr",
66 | "printraw",
67 | "var2str",
68 | "str2var",
69 | "var2bytes",
70 | "bytes2var",
71 | "range",
72 | "load",
73 | "inst2dict",
74 | "dict2inst",
75 | "validate_json",
76 | "parse_json",
77 | "to_json",
78 | "hash",
79 | "Color8",
80 | "ColorN",
81 | "print_stack",
82 | "instance_from_id",
83 | "len"
84 | ],
85 | "Tokens": [
86 | "Empty",
87 | "Identifier",
88 | "Constant",
89 | "Self",
90 | "BuiltInType",
91 | "BuiltInFunc",
92 | "OpIn",
93 | "OpEqual",
94 | "OpNotEqual",
95 | "OpLess",
96 | "OpLessEqual",
97 | "OpGreater",
98 | "OpGreaterEqual",
99 | "OpAnd",
100 | "OpOr",
101 | "OpNot",
102 | "OpAdd",
103 | "OpSub",
104 | "OpMul",
105 | "OpDiv",
106 | "OpMod",
107 | "OpShiftLeft",
108 | "OpShiftRight",
109 | "OpAssign",
110 | "OpAssignAdd",
111 | "OpAssignSub",
112 | "OpAssignMul",
113 | "OpAssignDiv",
114 | "OpAssignMod",
115 | "OpAssignShiftLeft",
116 | "OpAssignShiftRight",
117 | "OpAssignBitAnd",
118 | "OpAssignBitOr",
119 | "OpAssignBitXor",
120 | "OpBitAnd",
121 | "OpBitOr",
122 | "OpBitXor",
123 | "OpBitInvert",
124 | "CfIf",
125 | "CfElif",
126 | "CfElse",
127 | "CfFor",
128 | "CfDo",
129 | "CfWhile",
130 | "CfSwitch",
131 | "CfCase",
132 | "CfBreak",
133 | "CfContinue",
134 | "CfPass",
135 | "CfReturn",
136 | "CfMatch",
137 | "PrFunction",
138 | "PrClass",
139 | "PrExtends",
140 | "PrIs",
141 | "PrOnready",
142 | "PrTool",
143 | "PrStatic",
144 | "PrExport",
145 | "PrSetget",
146 | "PrConst",
147 | "PrVar",
148 | "PrEnum",
149 | "PrPreload",
150 | "PrAssert",
151 | "PrYield",
152 | "PrSignal",
153 | "PrBreakpoint",
154 | "PrRemote",
155 | "PrSync",
156 | "PrMaster",
157 | "PrSlave",
158 | "BracketOpen",
159 | "BracketClose",
160 | "CurlyBracketOpen",
161 | "CurlyBracketClose",
162 | "ParenthesisOpen",
163 | "ParenthesisClose",
164 | "Comma",
165 | "Semicolon",
166 | "Period",
167 | "QuestionMark",
168 | "Colon",
169 | "Dollar",
170 | "Newline",
171 | "ConstPi",
172 | "ConstTau",
173 | "Wildcard",
174 | "ConstInf",
175 | "ConstNan",
176 | "Error",
177 | "Eof",
178 | "Cursor",
179 | "Max"
180 | ]
181 | }
--------------------------------------------------------------------------------
/GdTool/Resources/BytecodeProviders/bytecode_1a36141.json:
--------------------------------------------------------------------------------
1 | {
2 | "CommitHash": "1a36141481a919178de26777a0065d4aeabc8404",
3 | "Description": "3.1.0 release (1a36141 / 2019-02-20 / Bytecode version: 13) - removed `DO`, `CASE`, `SWITCH` tokens",
4 | "BytecodeVersion": 13,
5 | "TypeNameVersion": 3,
6 | "FunctionNames": [
7 | "sin",
8 | "cos",
9 | "tan",
10 | "sinh",
11 | "cosh",
12 | "tanh",
13 | "asin",
14 | "acos",
15 | "atan",
16 | "atan2",
17 | "sqrt",
18 | "fmod",
19 | "fposmod",
20 | "floor",
21 | "ceil",
22 | "round",
23 | "abs",
24 | "sign",
25 | "pow",
26 | "log",
27 | "exp",
28 | "is_nan",
29 | "is_inf",
30 | "ease",
31 | "decimals",
32 | "stepify",
33 | "lerp",
34 | "inverse_lerp",
35 | "range_lerp",
36 | "dectime",
37 | "randomize",
38 | "randi",
39 | "randf",
40 | "rand_range",
41 | "seed",
42 | "rand_seed",
43 | "deg2rad",
44 | "rad2deg",
45 | "linear2db",
46 | "db2linear",
47 | "polar2cartesian",
48 | "cartesian2polar",
49 | "wrapi",
50 | "wrapf",
51 | "max",
52 | "min",
53 | "clamp",
54 | "nearest_po2",
55 | "weakref",
56 | "funcref",
57 | "convert",
58 | "typeof",
59 | "type_exists",
60 | "char",
61 | "str",
62 | "print",
63 | "printt",
64 | "prints",
65 | "printerr",
66 | "printraw",
67 | "print_debug",
68 | "push_error",
69 | "push_warning",
70 | "var2str",
71 | "str2var",
72 | "var2bytes",
73 | "bytes2var",
74 | "range",
75 | "load",
76 | "inst2dict",
77 | "dict2inst",
78 | "validate_json",
79 | "parse_json",
80 | "to_json",
81 | "hash",
82 | "Color8",
83 | "ColorN",
84 | "print_stack",
85 | "get_stack",
86 | "instance_from_id",
87 | "len",
88 | "is_instance_valid"
89 | ],
90 | "Tokens": [
91 | "Empty",
92 | "Identifier",
93 | "Constant",
94 | "Self",
95 | "BuiltInType",
96 | "BuiltInFunc",
97 | "OpIn",
98 | "OpEqual",
99 | "OpNotEqual",
100 | "OpLess",
101 | "OpLessEqual",
102 | "OpGreater",
103 | "OpGreaterEqual",
104 | "OpAnd",
105 | "OpOr",
106 | "OpNot",
107 | "OpAdd",
108 | "OpSub",
109 | "OpMul",
110 | "OpDiv",
111 | "OpMod",
112 | "OpShiftLeft",
113 | "OpShiftRight",
114 | "OpAssign",
115 | "OpAssignAdd",
116 | "OpAssignSub",
117 | "OpAssignMul",
118 | "OpAssignDiv",
119 | "OpAssignMod",
120 | "OpAssignShiftLeft",
121 | "OpAssignShiftRight",
122 | "OpAssignBitAnd",
123 | "OpAssignBitOr",
124 | "OpAssignBitXor",
125 | "OpBitAnd",
126 | "OpBitOr",
127 | "OpBitXor",
128 | "OpBitInvert",
129 | "CfIf",
130 | "CfElif",
131 | "CfElse",
132 | "CfFor",
133 | "CfWhile",
134 | "CfBreak",
135 | "CfContinue",
136 | "CfPass",
137 | "CfReturn",
138 | "CfMatch",
139 | "PrFunction",
140 | "PrClass",
141 | "PrClassName",
142 | "PrExtends",
143 | "PrIs",
144 | "PrOnready",
145 | "PrTool",
146 | "PrStatic",
147 | "PrExport",
148 | "PrSetget",
149 | "PrConst",
150 | "PrVar",
151 | "PrAs",
152 | "PrVoid",
153 | "PrEnum",
154 | "PrPreload",
155 | "PrAssert",
156 | "PrYield",
157 | "PrSignal",
158 | "PrBreakpoint",
159 | "PrRemote",
160 | "PrSync",
161 | "PrMaster",
162 | "PrSlave",
163 | "PrPuppet",
164 | "PrRemotesync",
165 | "PrMastersync",
166 | "PrPuppetsync",
167 | "BracketOpen",
168 | "BracketClose",
169 | "CurlyBracketOpen",
170 | "CurlyBracketClose",
171 | "ParenthesisOpen",
172 | "ParenthesisClose",
173 | "Comma",
174 | "Semicolon",
175 | "Period",
176 | "QuestionMark",
177 | "Colon",
178 | "Dollar",
179 | "ForwardArrow",
180 | "Newline",
181 | "ConstPi",
182 | "ConstTau",
183 | "Wildcard",
184 | "ConstInf",
185 | "ConstNan",
186 | "Error",
187 | "Eof",
188 | "Cursor",
189 | "Max"
190 | ]
191 | }
--------------------------------------------------------------------------------
/GdTool/Resources/BytecodeProviders/bytecode_514a3fb.json:
--------------------------------------------------------------------------------
1 | {
2 | "CommitHash": "514a3fb96a6ad97eb9488cacba7143566cb17d27",
3 | "Description": "3.1.1 release (514a3fb / 2019-03-19 / Bytecode version: 13) - added `smoothstep` function",
4 | "BytecodeVersion": 13,
5 | "TypeNameVersion": 3,
6 | "FunctionNames": [
7 | "sin",
8 | "cos",
9 | "tan",
10 | "sinh",
11 | "cosh",
12 | "tanh",
13 | "asin",
14 | "acos",
15 | "atan",
16 | "atan2",
17 | "sqrt",
18 | "fmod",
19 | "fposmod",
20 | "floor",
21 | "ceil",
22 | "round",
23 | "abs",
24 | "sign",
25 | "pow",
26 | "log",
27 | "exp",
28 | "is_nan",
29 | "is_inf",
30 | "ease",
31 | "decimals",
32 | "stepify",
33 | "lerp",
34 | "inverse_lerp",
35 | "range_lerp",
36 | "smoothstep",
37 | "dectime",
38 | "randomize",
39 | "randi",
40 | "randf",
41 | "rand_range",
42 | "seed",
43 | "rand_seed",
44 | "deg2rad",
45 | "rad2deg",
46 | "linear2db",
47 | "db2linear",
48 | "polar2cartesian",
49 | "cartesian2polar",
50 | "wrapi",
51 | "wrapf",
52 | "max",
53 | "min",
54 | "clamp",
55 | "nearest_po2",
56 | "weakref",
57 | "funcref",
58 | "convert",
59 | "typeof",
60 | "type_exists",
61 | "char",
62 | "str",
63 | "print",
64 | "printt",
65 | "prints",
66 | "printerr",
67 | "printraw",
68 | "print_debug",
69 | "push_error",
70 | "push_warning",
71 | "var2str",
72 | "str2var",
73 | "var2bytes",
74 | "bytes2var",
75 | "range",
76 | "load",
77 | "inst2dict",
78 | "dict2inst",
79 | "validate_json",
80 | "parse_json",
81 | "to_json",
82 | "hash",
83 | "Color8",
84 | "ColorN",
85 | "print_stack",
86 | "get_stack",
87 | "instance_from_id",
88 | "len",
89 | "is_instance_valid"
90 | ],
91 | "Tokens": [
92 | "Empty",
93 | "Identifier",
94 | "Constant",
95 | "Self",
96 | "BuiltInType",
97 | "BuiltInFunc",
98 | "OpIn",
99 | "OpEqual",
100 | "OpNotEqual",
101 | "OpLess",
102 | "OpLessEqual",
103 | "OpGreater",
104 | "OpGreaterEqual",
105 | "OpAnd",
106 | "OpOr",
107 | "OpNot",
108 | "OpAdd",
109 | "OpSub",
110 | "OpMul",
111 | "OpDiv",
112 | "OpMod",
113 | "OpShiftLeft",
114 | "OpShiftRight",
115 | "OpAssign",
116 | "OpAssignAdd",
117 | "OpAssignSub",
118 | "OpAssignMul",
119 | "OpAssignDiv",
120 | "OpAssignMod",
121 | "OpAssignShiftLeft",
122 | "OpAssignShiftRight",
123 | "OpAssignBitAnd",
124 | "OpAssignBitOr",
125 | "OpAssignBitXor",
126 | "OpBitAnd",
127 | "OpBitOr",
128 | "OpBitXor",
129 | "OpBitInvert",
130 | "CfIf",
131 | "CfElif",
132 | "CfElse",
133 | "CfFor",
134 | "CfWhile",
135 | "CfBreak",
136 | "CfContinue",
137 | "CfPass",
138 | "CfReturn",
139 | "CfMatch",
140 | "PrFunction",
141 | "PrClass",
142 | "PrClassName",
143 | "PrExtends",
144 | "PrIs",
145 | "PrOnready",
146 | "PrTool",
147 | "PrStatic",
148 | "PrExport",
149 | "PrSetget",
150 | "PrConst",
151 | "PrVar",
152 | "PrAs",
153 | "PrVoid",
154 | "PrEnum",
155 | "PrPreload",
156 | "PrAssert",
157 | "PrYield",
158 | "PrSignal",
159 | "PrBreakpoint",
160 | "PrRemote",
161 | "PrSync",
162 | "PrMaster",
163 | "PrSlave",
164 | "PrPuppet",
165 | "PrRemotesync",
166 | "PrMastersync",
167 | "PrPuppetsync",
168 | "BracketOpen",
169 | "BracketClose",
170 | "CurlyBracketOpen",
171 | "CurlyBracketClose",
172 | "ParenthesisOpen",
173 | "ParenthesisClose",
174 | "Comma",
175 | "Semicolon",
176 | "Period",
177 | "QuestionMark",
178 | "Colon",
179 | "Dollar",
180 | "ForwardArrow",
181 | "Newline",
182 | "ConstPi",
183 | "ConstTau",
184 | "Wildcard",
185 | "ConstInf",
186 | "ConstNan",
187 | "Error",
188 | "Eof",
189 | "Cursor",
190 | "Max"
191 | ]
192 | }
--------------------------------------------------------------------------------
/GdTool/Resources/BytecodeProviders/bytecode_5565f55.json:
--------------------------------------------------------------------------------
1 | {
2 | "CommitHash": "5565f5591f1096870327d893f8539eff22d17e68",
3 | "Description": "3.2.0 release (5565f55 / 2019-08-26 / Bytecode version: 13) - added `ord` function",
4 | "BytecodeVersion": 13,
5 | "TypeNameVersion": 3,
6 | "FunctionNames": [
7 | "sin",
8 | "cos",
9 | "tan",
10 | "sinh",
11 | "cosh",
12 | "tanh",
13 | "asin",
14 | "acos",
15 | "atan",
16 | "atan2",
17 | "sqrt",
18 | "fmod",
19 | "fposmod",
20 | "posmod",
21 | "floor",
22 | "ceil",
23 | "round",
24 | "abs",
25 | "sign",
26 | "pow",
27 | "log",
28 | "exp",
29 | "is_nan",
30 | "is_inf",
31 | "is_equal_approx",
32 | "is_zero_approx",
33 | "ease",
34 | "decimals",
35 | "step_decimals",
36 | "stepify",
37 | "lerp",
38 | "lerp_angle",
39 | "inverse_lerp",
40 | "range_lerp",
41 | "smoothstep",
42 | "move_toward",
43 | "dectime",
44 | "randomize",
45 | "randi",
46 | "randf",
47 | "rand_range",
48 | "seed",
49 | "rand_seed",
50 | "deg2rad",
51 | "rad2deg",
52 | "linear2db",
53 | "db2linear",
54 | "polar2cartesian",
55 | "cartesian2polar",
56 | "wrapi",
57 | "wrapf",
58 | "max",
59 | "min",
60 | "clamp",
61 | "nearest_po2",
62 | "weakref",
63 | "funcref",
64 | "convert",
65 | "typeof",
66 | "type_exists",
67 | "char",
68 | "ord",
69 | "str",
70 | "print",
71 | "printt",
72 | "prints",
73 | "printerr",
74 | "printraw",
75 | "print_debug",
76 | "push_error",
77 | "push_warning",
78 | "var2str",
79 | "str2var",
80 | "var2bytes",
81 | "bytes2var",
82 | "range",
83 | "load",
84 | "inst2dict",
85 | "dict2inst",
86 | "validate_json",
87 | "parse_json",
88 | "to_json",
89 | "hash",
90 | "Color8",
91 | "ColorN",
92 | "print_stack",
93 | "get_stack",
94 | "instance_from_id",
95 | "len",
96 | "is_instance_valid"
97 | ],
98 | "Tokens": [
99 | "Empty",
100 | "Identifier",
101 | "Constant",
102 | "Self",
103 | "BuiltInType",
104 | "BuiltInFunc",
105 | "OpIn",
106 | "OpEqual",
107 | "OpNotEqual",
108 | "OpLess",
109 | "OpLessEqual",
110 | "OpGreater",
111 | "OpGreaterEqual",
112 | "OpAnd",
113 | "OpOr",
114 | "OpNot",
115 | "OpAdd",
116 | "OpSub",
117 | "OpMul",
118 | "OpDiv",
119 | "OpMod",
120 | "OpShiftLeft",
121 | "OpShiftRight",
122 | "OpAssign",
123 | "OpAssignAdd",
124 | "OpAssignSub",
125 | "OpAssignMul",
126 | "OpAssignDiv",
127 | "OpAssignMod",
128 | "OpAssignShiftLeft",
129 | "OpAssignShiftRight",
130 | "OpAssignBitAnd",
131 | "OpAssignBitOr",
132 | "OpAssignBitXor",
133 | "OpBitAnd",
134 | "OpBitOr",
135 | "OpBitXor",
136 | "OpBitInvert",
137 | "CfIf",
138 | "CfElif",
139 | "CfElse",
140 | "CfFor",
141 | "CfWhile",
142 | "CfBreak",
143 | "CfContinue",
144 | "CfPass",
145 | "CfReturn",
146 | "CfMatch",
147 | "PrFunction",
148 | "PrClass",
149 | "PrClassName",
150 | "PrExtends",
151 | "PrIs",
152 | "PrOnready",
153 | "PrTool",
154 | "PrStatic",
155 | "PrExport",
156 | "PrSetget",
157 | "PrConst",
158 | "PrVar",
159 | "PrAs",
160 | "PrVoid",
161 | "PrEnum",
162 | "PrPreload",
163 | "PrAssert",
164 | "PrYield",
165 | "PrSignal",
166 | "PrBreakpoint",
167 | "PrRemote",
168 | "PrSync",
169 | "PrMaster",
170 | "PrSlave",
171 | "PrPuppet",
172 | "PrRemotesync",
173 | "PrMastersync",
174 | "PrPuppetsync",
175 | "BracketOpen",
176 | "BracketClose",
177 | "CurlyBracketOpen",
178 | "CurlyBracketClose",
179 | "ParenthesisOpen",
180 | "ParenthesisClose",
181 | "Comma",
182 | "Semicolon",
183 | "Period",
184 | "QuestionMark",
185 | "Colon",
186 | "Dollar",
187 | "ForwardArrow",
188 | "Newline",
189 | "ConstPi",
190 | "ConstTau",
191 | "Wildcard",
192 | "ConstInf",
193 | "ConstNan",
194 | "Error",
195 | "Eof",
196 | "Cursor",
197 | "Max"
198 | ]
199 | }
--------------------------------------------------------------------------------
/GdTool/GdTool.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net5.0
5 | Exe
6 | false
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 | all
73 |
74 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/GdTool/PckFile.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text;
3 | using System.IO;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Security.Cryptography;
7 |
8 | namespace GdTool {
9 | public class PckFileEntry {
10 | public string Path;
11 | public byte[] Data;
12 | }
13 |
14 | public class PckFile {
15 | public uint PackFormatVersion;
16 | public uint VersionMajor;
17 | public uint VersionMinor;
18 | public uint VersionPatch;
19 | public List Entries;
20 |
21 | public PckFile(uint packFormatVersion, uint versionMajor, uint versionMinor, uint versionPatch) {
22 | PackFormatVersion = packFormatVersion;
23 | VersionMajor = versionMajor;
24 | VersionMinor = versionMinor;
25 | VersionPatch = versionPatch;
26 | Entries = new List();
27 | }
28 |
29 | public PckFile(byte[] arr) {
30 | using (MemoryStream ms = new MemoryStream(arr)) {
31 | using (BinaryReader buf = new BinaryReader(ms)) {
32 | string magicHeader = Encoding.ASCII.GetString(buf.ReadBytes(4));
33 | if (magicHeader != "GDPC") {
34 | throw new Exception("Invalid PCK file: missing magic header");
35 | }
36 |
37 | PackFormatVersion = buf.ReadUInt32();
38 | VersionMajor = buf.ReadUInt32();
39 | VersionMinor = buf.ReadUInt32();
40 | VersionPatch = buf.ReadUInt32();
41 |
42 | buf.BaseStream.Position += 4 * 16;
43 |
44 | uint filesCount = buf.ReadUInt32();
45 |
46 | Entries = new List((int)filesCount);
47 | for (int i = 0; i < filesCount; i++) {
48 | string path = Encoding.UTF8.GetString(buf.ReadBytes((int)buf.ReadUInt32())).Replace("\0", "");
49 | ulong fileOffset = buf.ReadUInt64();
50 | ulong fileLength = buf.ReadUInt64();
51 | byte[] md5 = buf.ReadBytes(16);
52 |
53 | long pos = buf.BaseStream.Position;
54 | buf.BaseStream.Position = (long)fileOffset;
55 |
56 | byte[] fileData = buf.ReadBytes((int)fileLength);
57 | Entries.Add(new PckFileEntry {
58 | Path = path,
59 | Data = fileData
60 | });
61 |
62 | buf.BaseStream.Position = pos;
63 | }
64 | }
65 | }
66 | }
67 |
68 | public byte[] ToBytes() {
69 | int totalSize =
70 | 4 + // magic header
71 | 4 * 4 + // version info
72 | 4 * 16 + // padding
73 | 4 + // files count
74 | Entries.Select(entry =>
75 | 4 + // path length prefix
76 | Encoding.UTF8.GetBytes(entry.Path).Length + // size of path
77 | 8 * 2 + // offset and size
78 | 16 + // md5 hash
79 | entry.Data.Length // file bytes
80 | ).Sum();
81 | byte[] arr = new byte[totalSize];
82 | using (MemoryStream ms = new MemoryStream(arr)) {
83 | using (BinaryWriter buf = new BinaryWriter(ms)) {
84 | MD5 md5 = MD5.Create();
85 |
86 | buf.Write(Encoding.ASCII.GetBytes("GDPC"));
87 | buf.Write(PackFormatVersion);
88 | buf.Write(VersionMajor);
89 | buf.Write(VersionMinor);
90 | buf.Write(VersionPatch);
91 | buf.Write(new byte[4 * 16]);
92 | buf.Write((uint)Entries.Count);
93 |
94 | long[] fileOffsets = new long[Entries.Count];
95 |
96 | for (int i = 0; i < Entries.Count; i++) {
97 | PckFileEntry entry = Entries[i];
98 | byte[] pathBytes = Encoding.UTF8.GetBytes(entry.Path);
99 | buf.Write((uint)pathBytes.Length);
100 | buf.Write(pathBytes);
101 | fileOffsets[i] = buf.BaseStream.Position;
102 | buf.Write(0UL);
103 | buf.Write((ulong)entry.Data.Length);
104 | buf.Write(md5.ComputeHash(entry.Data));
105 | }
106 |
107 | for (int i = 0; i < Entries.Count; i++) {
108 | long curPos = buf.BaseStream.Position;
109 | buf.BaseStream.Position = fileOffsets[i];
110 | buf.Write((ulong)curPos);
111 | buf.BaseStream.Position = curPos;
112 |
113 | PckFileEntry entry = Entries[i];
114 | buf.Write(entry.Data);
115 | }
116 | }
117 | }
118 |
119 | return arr;
120 | }
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/GdTool/GdScriptDecompiler.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Text;
5 |
6 | namespace GdTool {
7 | public class GdScriptDecompiler {
8 | public static string Decompile(byte[] arr, BytecodeProvider provider, bool debug = false) {
9 | using (MemoryStream ms = new MemoryStream(arr)) {
10 | using (BinaryReader buf = new BinaryReader(ms)) {
11 | string magicHeader = Encoding.ASCII.GetString(buf.ReadBytes(4));
12 | if (magicHeader != "GDSC") {
13 | throw new Exception("Invalid GDC file: missing magic header");
14 | }
15 |
16 | uint version = buf.ReadUInt32();
17 | if (version != provider.ProviderData.BytecodeVersion) {
18 | throw new Exception("Invalid GDC file: expected bytecode version " + provider.ProviderData.BytecodeVersion + ", found " + version);
19 | }
20 | uint identifierCount = buf.ReadUInt32();
21 | uint constantCount = buf.ReadUInt32();
22 | uint lineCount = buf.ReadUInt32();
23 | uint tokenCount = buf.ReadUInt32();
24 |
25 | string[] identifiers = new string[identifierCount];
26 | for (int i = 0; i < identifierCount; i++) {
27 | uint len = buf.ReadUInt32();
28 | byte[] strBytes = new byte[len];
29 | for (int j = 0; j < len; j++) {
30 | strBytes[j] = (byte)(buf.ReadByte() ^ 0xB6);
31 | }
32 | string ident = Encoding.UTF8.GetString(strBytes).Replace("\0", "");
33 | identifiers[i] = ident;
34 | }
35 |
36 | IGdStructure[] constants = new IGdStructure[constantCount];
37 | for (int i = 0; i < constantCount; i++) {
38 | constants[i] = DecodeConstant(buf, provider);
39 | }
40 |
41 | Dictionary tokenLineMap = new Dictionary((int)lineCount);
42 | for (int i = 0; i < lineCount; i++) {
43 | tokenLineMap.Add(buf.ReadUInt32(), buf.ReadUInt32());
44 | }
45 |
46 | DecompileBuffer decompile = new DecompileBuffer();
47 | List tokens = new List((int)tokenCount);
48 | for (int i = 0; i < tokenCount; i++) {
49 | byte cur = arr[buf.BaseStream.Position];
50 |
51 | uint tokenType;
52 | if ((cur & 0x80) != 0) {
53 | tokenType = buf.ReadUInt32() ^ 0x80;
54 | } else {
55 | tokenType = cur;
56 | buf.BaseStream.Position += 1;
57 | }
58 |
59 | GdcToken token = new GdcToken {
60 | Type = provider.TokenTypeProvider.GetTokenType(tokenType & 0xFF),
61 | Data = tokenType >> 8
62 | };
63 | tokens.Add(token);
64 | ReadToken(token, identifiers, constants);
65 | }
66 |
67 | GdcTokenType previous = GdcTokenType.Newline;
68 | foreach (GdcToken token in tokens) {
69 | token.Decompile(decompile, previous, provider);
70 | if (debug) {
71 | decompile.Append("{" + token.Type + "}");
72 | }
73 | previous = token.Type;
74 | }
75 |
76 | return decompile.Content;
77 | }
78 | }
79 | }
80 |
81 | private static void ReadToken(GdcToken token, string[] identifiers, IGdStructure[] constants) {
82 | switch (token.Type) {
83 | case GdcTokenType.Identifier:
84 | token.Operand = new GdcIdentifier(identifiers[token.Data]);
85 | return;
86 | case GdcTokenType.Constant:
87 | token.Operand = constants[token.Data];
88 | return;
89 | default:
90 | return;
91 | }
92 | }
93 |
94 | private static IGdStructure DecodeConstant(BinaryReader buf, BytecodeProvider provider) {
95 | uint type = buf.ReadUInt32();
96 | string typeName = provider.TypeNameProvider.GetTypeName(type & 0xFF);
97 |
98 | switch (typeName) {
99 | case "Nil":
100 | return new GdcNull().Deserialize(buf);
101 | case "bool":
102 | return new GdcBool().Deserialize(buf);
103 | case "int":
104 | if ((type & (1 << 16)) != 0) {
105 | return new GdcUInt64().Deserialize(buf);
106 | } else {
107 | return new GdcUInt32().Deserialize(buf);
108 | }
109 | case "float":
110 | if ((type & (1 << 16)) != 0) {
111 | return new GdcDouble().Deserialize(buf);
112 | } else {
113 | return new GdcSingle().Deserialize(buf);
114 | }
115 | case "String":
116 | return new GdcString().Deserialize(buf);
117 | case "Vector2":
118 | return new Vector2().Deserialize(buf);
119 | case "Rect2":
120 | return new Rect2().Deserialize(buf);
121 | case "Vector3":
122 | return new Vector3().Deserialize(buf);
123 | case "Transform2D":
124 | return new Transform2d().Deserialize(buf);
125 | case "Plane":
126 | return new Plane().Deserialize(buf);
127 | case "Quat":
128 | return new Quat().Deserialize(buf);
129 | case "AABB":
130 | return new Aabb().Deserialize(buf);
131 | case "Basis":
132 | return new Basis().Deserialize(buf);
133 | case "Transform":
134 | return new Transform().Deserialize(buf);
135 | case "Color":
136 | return new Color().Deserialize(buf);
137 | case "NodePath":
138 | throw new NotImplementedException("NodePath");
139 | case "RID":
140 | throw new NotImplementedException("RID");
141 | default:
142 | throw new NotImplementedException(type.ToString());
143 | }
144 | }
145 | }
146 | }
147 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.rsuser
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Mono auto generated files
17 | mono_crash.*
18 |
19 | # Build results
20 | [Dd]ebug/
21 | [Dd]ebugPublic/
22 | [Rr]elease/
23 | [Rr]eleases/
24 | x64/
25 | x86/
26 | [Aa][Rr][Mm]/
27 | [Aa][Rr][Mm]64/
28 | bld/
29 | [Bb]in/
30 | [Oo]bj/
31 | [Ll]og/
32 | [Ll]ogs/
33 |
34 | # Visual Studio 2015/2017 cache/options directory
35 | .vs/
36 | # Uncomment if you have tasks that create the project's static files in wwwroot
37 | #wwwroot/
38 |
39 | # Visual Studio 2017 auto generated files
40 | Generated\ Files/
41 |
42 | # MSTest test Results
43 | [Tt]est[Rr]esult*/
44 | [Bb]uild[Ll]og.*
45 |
46 | # NUnit
47 | *.VisualState.xml
48 | TestResult.xml
49 | nunit-*.xml
50 |
51 | # Build Results of an ATL Project
52 | [Dd]ebugPS/
53 | [Rr]eleasePS/
54 | dlldata.c
55 |
56 | # Benchmark Results
57 | BenchmarkDotNet.Artifacts/
58 |
59 | # .NET Core
60 | project.lock.json
61 | project.fragment.lock.json
62 | artifacts/
63 |
64 | # StyleCop
65 | StyleCopReport.xml
66 |
67 | # Files built by Visual Studio
68 | *_i.c
69 | *_p.c
70 | *_h.h
71 | *.ilk
72 | *.meta
73 | *.obj
74 | *.iobj
75 | *.pch
76 | *.pdb
77 | *.ipdb
78 | *.pgc
79 | *.pgd
80 | *.rsp
81 | *.sbr
82 | *.tlb
83 | *.tli
84 | *.tlh
85 | *.tmp
86 | *.tmp_proj
87 | *_wpftmp.csproj
88 | *.log
89 | *.vspscc
90 | *.vssscc
91 | .builds
92 | *.pidb
93 | *.svclog
94 | *.scc
95 |
96 | # Chutzpah Test files
97 | _Chutzpah*
98 |
99 | # Visual C++ cache files
100 | ipch/
101 | *.aps
102 | *.ncb
103 | *.opendb
104 | *.opensdf
105 | *.sdf
106 | *.cachefile
107 | *.VC.db
108 | *.VC.VC.opendb
109 |
110 | # Visual Studio profiler
111 | *.psess
112 | *.vsp
113 | *.vspx
114 | *.sap
115 |
116 | # Visual Studio Trace Files
117 | *.e2e
118 |
119 | # TFS 2012 Local Workspace
120 | $tf/
121 |
122 | # Guidance Automation Toolkit
123 | *.gpState
124 |
125 | # ReSharper is a .NET coding add-in
126 | _ReSharper*/
127 | *.[Rr]e[Ss]harper
128 | *.DotSettings.user
129 |
130 | # TeamCity is a build add-in
131 | _TeamCity*
132 |
133 | # DotCover is a Code Coverage Tool
134 | *.dotCover
135 |
136 | # AxoCover is a Code Coverage Tool
137 | .axoCover/*
138 | !.axoCover/settings.json
139 |
140 | # Visual Studio code coverage results
141 | *.coverage
142 | *.coveragexml
143 |
144 | # NCrunch
145 | _NCrunch_*
146 | .*crunch*.local.xml
147 | nCrunchTemp_*
148 |
149 | # MightyMoose
150 | *.mm.*
151 | AutoTest.Net/
152 |
153 | # Web workbench (sass)
154 | .sass-cache/
155 |
156 | # Installshield output folder
157 | [Ee]xpress/
158 |
159 | # DocProject is a documentation generator add-in
160 | DocProject/buildhelp/
161 | DocProject/Help/*.HxT
162 | DocProject/Help/*.HxC
163 | DocProject/Help/*.hhc
164 | DocProject/Help/*.hhk
165 | DocProject/Help/*.hhp
166 | DocProject/Help/Html2
167 | DocProject/Help/html
168 |
169 | # Click-Once directory
170 | publish/
171 |
172 | # Publish Web Output
173 | *.[Pp]ublish.xml
174 | *.azurePubxml
175 | # Note: Comment the next line if you want to checkin your web deploy settings,
176 | # but database connection strings (with potential passwords) will be unencrypted
177 | *.pubxml
178 | *.publishproj
179 |
180 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
181 | # checkin your Azure Web App publish settings, but sensitive information contained
182 | # in these scripts will be unencrypted
183 | PublishScripts/
184 |
185 | # NuGet Packages
186 | *.nupkg
187 | # NuGet Symbol Packages
188 | *.snupkg
189 | # The packages folder can be ignored because of Package Restore
190 | **/[Pp]ackages/*
191 | # except build/, which is used as an MSBuild target.
192 | !**/[Pp]ackages/build/
193 | # Uncomment if necessary however generally it will be regenerated when needed
194 | #!**/[Pp]ackages/repositories.config
195 | # NuGet v3's project.json files produces more ignorable files
196 | *.nuget.props
197 | *.nuget.targets
198 |
199 | # Microsoft Azure Build Output
200 | csx/
201 | *.build.csdef
202 |
203 | # Microsoft Azure Emulator
204 | ecf/
205 | rcf/
206 |
207 | # Windows Store app package directories and files
208 | AppPackages/
209 | BundleArtifacts/
210 | Package.StoreAssociation.xml
211 | _pkginfo.txt
212 | *.appx
213 | *.appxbundle
214 | *.appxupload
215 |
216 | # Visual Studio cache files
217 | # files ending in .cache can be ignored
218 | *.[Cc]ache
219 | # but keep track of directories ending in .cache
220 | !?*.[Cc]ache/
221 |
222 | # Others
223 | ClientBin/
224 | ~$*
225 | *~
226 | *.dbmdl
227 | *.dbproj.schemaview
228 | *.jfm
229 | *.pfx
230 | *.publishsettings
231 | orleans.codegen.cs
232 |
233 | # Including strong name files can present a security risk
234 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
235 | #*.snk
236 |
237 | # Since there are multiple workflows, uncomment next line to ignore bower_components
238 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
239 | #bower_components/
240 |
241 | # RIA/Silverlight projects
242 | Generated_Code/
243 |
244 | # Backup & report files from converting an old project file
245 | # to a newer Visual Studio version. Backup files are not needed,
246 | # because we have git ;-)
247 | _UpgradeReport_Files/
248 | Backup*/
249 | UpgradeLog*.XML
250 | UpgradeLog*.htm
251 | ServiceFabricBackup/
252 | *.rptproj.bak
253 |
254 | # SQL Server files
255 | *.mdf
256 | *.ldf
257 | *.ndf
258 |
259 | # Business Intelligence projects
260 | *.rdl.data
261 | *.bim.layout
262 | *.bim_*.settings
263 | *.rptproj.rsuser
264 | *- [Bb]ackup.rdl
265 | *- [Bb]ackup ([0-9]).rdl
266 | *- [Bb]ackup ([0-9][0-9]).rdl
267 |
268 | # Microsoft Fakes
269 | FakesAssemblies/
270 |
271 | # GhostDoc plugin setting file
272 | *.GhostDoc.xml
273 |
274 | # Node.js Tools for Visual Studio
275 | .ntvs_analysis.dat
276 | node_modules/
277 |
278 | # Visual Studio 6 build log
279 | *.plg
280 |
281 | # Visual Studio 6 workspace options file
282 | *.opt
283 |
284 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
285 | *.vbw
286 |
287 | # Visual Studio LightSwitch build output
288 | **/*.HTMLClient/GeneratedArtifacts
289 | **/*.DesktopClient/GeneratedArtifacts
290 | **/*.DesktopClient/ModelManifest.xml
291 | **/*.Server/GeneratedArtifacts
292 | **/*.Server/ModelManifest.xml
293 | _Pvt_Extensions
294 |
295 | # Paket dependency manager
296 | .paket/paket.exe
297 | paket-files/
298 |
299 | # FAKE - F# Make
300 | .fake/
301 |
302 | # CodeRush personal settings
303 | .cr/personal
304 |
305 | # Python Tools for Visual Studio (PTVS)
306 | __pycache__/
307 | *.pyc
308 |
309 | # Cake - Uncomment if you are using it
310 | # tools/**
311 | # !tools/packages.config
312 |
313 | # Tabs Studio
314 | *.tss
315 |
316 | # Telerik's JustMock configuration file
317 | *.jmconfig
318 |
319 | # BizTalk build output
320 | *.btp.cs
321 | *.btm.cs
322 | *.odx.cs
323 | *.xsd.cs
324 |
325 | # OpenCover UI analysis results
326 | OpenCover/
327 |
328 | # Azure Stream Analytics local run output
329 | ASALocalRun/
330 |
331 | # MSBuild Binary and Structured Log
332 | *.binlog
333 |
334 | # NVidia Nsight GPU debugger configuration file
335 | *.nvuser
336 |
337 | # MFractors (Xamarin productivity tool) working folder
338 | .mfractor/
339 |
340 | # Local History for Visual Studio
341 | .localhistory/
342 |
343 | # BeatPulse healthcheck temp database
344 | healthchecksdb
345 |
346 | # Backup folder for Package Reference Convert tool in Visual Studio 2017
347 | MigrationBackup/
348 |
349 | # Ionide (cross platform F# VS Code tools) working folder
350 | .ionide/
--------------------------------------------------------------------------------
/GdTool/FodyWeavers.xsd:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks
13 |
14 |
15 |
16 |
17 | A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.
18 |
19 |
20 |
21 |
22 | A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks
23 |
24 |
25 |
26 |
27 | A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.
28 |
29 |
30 |
31 |
32 | A list of unmanaged 32 bit assembly names to include, delimited with line breaks.
33 |
34 |
35 |
36 |
37 | A list of unmanaged 64 bit assembly names to include, delimited with line breaks.
38 |
39 |
40 |
41 |
42 | The order of preloaded assemblies, delimited with line breaks.
43 |
44 |
45 |
46 |
47 |
48 | This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file.
49 |
50 |
51 |
52 |
53 | Controls if .pdbs for reference assemblies are also embedded.
54 |
55 |
56 |
57 |
58 | Controls if runtime assemblies are also embedded.
59 |
60 |
61 |
62 |
63 | Controls whether the runtime assemblies are embedded with their full path or only with their assembly name.
64 |
65 |
66 |
67 |
68 | Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option.
69 |
70 |
71 |
72 |
73 | As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off.
74 |
75 |
76 |
77 |
78 | Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code.
79 |
80 |
81 |
82 |
83 | Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior.
84 |
85 |
86 |
87 |
88 | A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with |
89 |
90 |
91 |
92 |
93 | A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |.
94 |
95 |
96 |
97 |
98 | A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with |
99 |
100 |
101 |
102 |
103 | A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with |.
104 |
105 |
106 |
107 |
108 | A list of unmanaged 32 bit assembly names to include, delimited with |.
109 |
110 |
111 |
112 |
113 | A list of unmanaged 64 bit assembly names to include, delimited with |.
114 |
115 |
116 |
117 |
118 | The order of preloaded assemblies, delimited with |.
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 | 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.
127 |
128 |
129 |
130 |
131 | A comma-separated list of error codes that can be safely ignored in assembly verification.
132 |
133 |
134 |
135 |
136 | 'false' to turn off automatic generation of the XML Schema file.
137 |
138 |
139 |
140 |
141 |
--------------------------------------------------------------------------------
/GdTool/BytecodeProvider.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using System;
3 | using System.IO;
4 | using System.Reflection;
5 | using System.Text;
6 | using System.Collections.Generic;
7 | using System.Linq;
8 |
9 | namespace GdTool {
10 | public interface ITypeNameProvider {
11 | string GetTypeName(uint typeId);
12 |
13 | uint GetTypeId(string name);
14 |
15 | string[] GetAllTypeNames();
16 | }
17 |
18 | internal class ArrayTypeNameProvider : ITypeNameProvider {
19 | private string[] TypeNames;
20 |
21 | public ArrayTypeNameProvider(string[] typeNames) {
22 | TypeNames = typeNames;
23 | }
24 |
25 | public string GetTypeName(uint typeId) {
26 | if (typeId >= TypeNames.Length) {
27 | throw new InvalidOperationException("invalid type: " + typeId);
28 | }
29 | return TypeNames[typeId];
30 | }
31 |
32 | public uint GetTypeId(string name) {
33 | int id = Array.IndexOf(TypeNames, name);
34 | if (id == -1) {
35 | throw new InvalidOperationException("invalid type: " + name);
36 | }
37 | return (uint)id;
38 | }
39 |
40 | public string[] GetAllTypeNames() {
41 | return TypeNames;
42 | }
43 | }
44 |
45 | public class TypeNameProviders {
46 | public static readonly ITypeNameProvider ProviderV3 = new ArrayTypeNameProvider(new string[] {
47 | "Nil", "bool", "int", "float", "String", "Vector2", "Rect2", "Vector3", "Transform2D",
48 | "Plane", "Quat", "AABB", "Basis", "Transform", "Color", "NodePath", "RID", "Object",
49 | "Dictionary", "Array", "PoolByteArray", "PoolIntArray", "PoolRealArray", "PoolStringArray",
50 | "PoolVector2Array", "PoolVector3Array", "PoolColorArray" });
51 |
52 | public static readonly ITypeNameProvider ProviderV2 = new ArrayTypeNameProvider(new string[] {
53 | "Nil", "bool", "int", "float", "String", "Vector2", "Rect2", "Vector3", "Matrix32", "Plane",
54 | "Quat", "AABB", "Matrix3", "Transform", "Color", "Image", "NodePath", "RID", "Object",
55 | "InputEvent", "Dictionary", "Array", "RawArray", "IntArray", "FloatArray", "StringArray",
56 | "Vector2Array", "Vector3Array", "ColorArray" });
57 | }
58 |
59 | public class BytecodeProviderData {
60 | [JsonProperty]
61 | public string CommitHash;
62 | [JsonProperty]
63 | public int TypeNameVersion;
64 | [JsonProperty]
65 | public string Description;
66 | [JsonProperty]
67 | public string[] FunctionNames;
68 | [JsonProperty]
69 | public string[] Tokens;
70 | [JsonProperty]
71 | public uint BytecodeVersion;
72 | }
73 |
74 | public class CommitHistory {
75 | [JsonProperty]
76 | public string Branch;
77 | [JsonProperty]
78 | public string[] History;
79 | }
80 |
81 | public interface ITokenTypeProvider {
82 | GdcTokenType GetTokenType(uint token);
83 |
84 | int GetTokenId(GdcTokenType type);
85 | }
86 |
87 | internal class DefaultTokenTypeProvider : ITokenTypeProvider {
88 | public BytecodeProviderData File;
89 |
90 | public DefaultTokenTypeProvider(BytecodeProviderData file) {
91 | File = file;
92 | }
93 |
94 | public GdcTokenType GetTokenType(uint token) {
95 | if (token < 0 || token >= File.Tokens.Length) {
96 | throw new InvalidOperationException("token id not defined in current bytecode version: " + token);
97 | }
98 | if (Enum.TryParse(File.Tokens[token], out GdcTokenType result)) {
99 | return result;
100 | }
101 | throw new InvalidOperationException("token not defined in current bytecode version: " + File.Tokens[token]);
102 | }
103 |
104 | public int GetTokenId(GdcTokenType type) {
105 | string name = type.ToString();
106 | int id = Array.IndexOf(File.Tokens, name);
107 | if (id == -1) {
108 | throw new InvalidOperationException("token type not defined in current bytecode version: " + type);
109 | }
110 | return id;
111 | }
112 | }
113 |
114 | public class BytecodeProvider {
115 | private static readonly Dictionary ProviderShortFormLookup = new Dictionary();
116 | private static readonly Dictionary Providers = new Dictionary();
117 | private static readonly List CommitHistories = new List();
118 |
119 | private static byte[] ReadEmbeddedResource(string name) {
120 | Assembly assembly = Assembly.GetExecutingAssembly();
121 | using (Stream stream = assembly.GetManifestResourceStream(name)) {
122 | using (MemoryStream mem = new MemoryStream()) {
123 | stream.CopyTo(mem);
124 | return mem.ToArray();
125 | }
126 | }
127 | }
128 |
129 | private static T ReadEmbeddedJson(string name) {
130 | byte[] raw = ReadEmbeddedResource(name);
131 | string jsonString = Encoding.UTF8.GetString(raw);
132 | jsonString = jsonString.Substring(jsonString.IndexOf('{'));
133 | return JsonConvert.DeserializeObject(jsonString);
134 | }
135 |
136 | static BytecodeProvider() {
137 | Assembly assembly = Assembly.GetExecutingAssembly();
138 | string[] names = assembly.GetManifestResourceNames();
139 | foreach (string name in names) {
140 | if (name.EndsWith(".json")) {
141 | if (name.StartsWith("GdTool.Resources.BytecodeProviders")) {
142 | BytecodeProviderData file = ReadEmbeddedJson(name);
143 |
144 | Providers[file.CommitHash] = new BytecodeProvider(file);
145 | ProviderShortFormLookup[file.CommitHash.Substring(0, 7)] = file.CommitHash;
146 | } else if (name.StartsWith("GdTool.Resources.CommitHistories")) {
147 | CommitHistory history = ReadEmbeddedJson(name);
148 | CommitHistories.Add(history);
149 | }
150 | }
151 | }
152 | }
153 |
154 | public ITypeNameProvider TypeNameProvider { get; private set; }
155 | public ITokenTypeProvider TokenTypeProvider { get; private set; }
156 | public BytecodeProviderData ProviderData { get; private set; }
157 |
158 | public BytecodeProvider(BytecodeProviderData file) {
159 | switch (file.TypeNameVersion) {
160 | case 3:
161 | TypeNameProvider = TypeNameProviders.ProviderV3;
162 | break;
163 | case 2:
164 | TypeNameProvider = TypeNameProviders.ProviderV2;
165 | break;
166 | default:
167 | throw new InvalidOperationException("Invalid type name version");
168 | }
169 |
170 | ProviderData = file;
171 | TokenTypeProvider = new DefaultTokenTypeProvider(file);
172 | }
173 |
174 | public static bool HasProviderForHash(string hash) {
175 | if (hash.Length == 7) {
176 | return ProviderShortFormLookup.ContainsKey(hash);
177 | } else if (hash.Length == 40) {
178 | return Providers.ContainsKey(hash);
179 | }
180 | throw new InvalidOperationException("commit hash must be either 7 (shortened form) or 40 (full form) hex characters");
181 | }
182 |
183 | public static BytecodeProvider GetByCommitHash(string hash) {
184 | if (hash.Length != 7 && hash.Length != 40) {
185 | throw new InvalidOperationException("commit hash must be either 7 (shortened form) or 40 (full form) hex characters");
186 | }
187 | if (hash.Length == 7) {
188 | string shortHash = hash;
189 | if (!ProviderShortFormLookup.TryGetValue(shortHash, out hash)) {
190 | throw new InvalidOperationException("there is no bytecode version associated with the given commit hash: " + shortHash);
191 | }
192 | }
193 | if (!Providers.TryGetValue(hash, out BytecodeProvider provider)) {
194 | throw new InvalidOperationException("there is no bytecode version associated with the given commit hash: " + hash);
195 | }
196 | return provider;
197 | }
198 |
199 | public static string FindPreviousMajorVersionHash(string hash) {
200 | if (hash.Length < 7) {
201 | throw new InvalidOperationException("commit hash must be 7 or more hex characters");
202 | }
203 |
204 | foreach (CommitHistory history in CommitHistories) {
205 | bool seenRequestedHash = false;
206 | foreach (string version in history.History) {
207 | if (version.StartsWith(hash)) {
208 | seenRequestedHash = true;
209 | }
210 | if (seenRequestedHash && Providers.ContainsKey(version)) {
211 | return version;
212 | }
213 | }
214 | }
215 |
216 | return null;
217 | }
218 | }
219 | }
220 |
--------------------------------------------------------------------------------
/GdTool/GdcToken.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace GdTool {
4 | public class GdcToken {
5 | public uint LineCol;
6 | public IGdStructure Operand;
7 | public GdcTokenType Type;
8 | public uint Data;
9 |
10 | public DecompileBuffer Decompile(DecompileBuffer buf, GdcTokenType previous, BytecodeProvider provider) {
11 | switch (Type) {
12 | case GdcTokenType.Empty:
13 | return buf;
14 | case GdcTokenType.Identifier:
15 | return buf.Append(Operand.ToString());
16 | case GdcTokenType.Constant:
17 | return buf.Append(Operand.ToString());
18 | case GdcTokenType.Self:
19 | return buf.Append("self");
20 | case GdcTokenType.BuiltInType:
21 | return buf.Append(provider.TypeNameProvider.GetTypeName(Data));
22 | case GdcTokenType.BuiltInFunc:
23 | return buf.Append(provider.ProviderData.FunctionNames[Data]);
24 | case GdcTokenType.OpIn:
25 | return buf.AppendOp("in");
26 | case GdcTokenType.OpEqual:
27 | return buf.AppendOp("==");
28 | case GdcTokenType.OpNotEqual:
29 | return buf.AppendOp("!=");
30 | case GdcTokenType.OpLess:
31 | return buf.AppendOp("<");
32 | case GdcTokenType.OpLessEqual:
33 | return buf.AppendOp("<=");
34 | case GdcTokenType.OpGreater:
35 | return buf.AppendOp(">");
36 | case GdcTokenType.OpGreaterEqual:
37 | return buf.AppendOp(">=");
38 | case GdcTokenType.OpAnd:
39 | return buf.AppendOp("and");
40 | case GdcTokenType.OpOr:
41 | return buf.AppendOp("or");
42 | case GdcTokenType.OpNot:
43 | return buf.AppendOp("not");
44 | case GdcTokenType.OpAdd:
45 | return buf.AppendOp("+");
46 | case GdcTokenType.OpSub:
47 | return buf.AppendOp("-");
48 | case GdcTokenType.OpMul:
49 | return buf.AppendOp("*");
50 | case GdcTokenType.OpDiv:
51 | return buf.AppendOp("/");
52 | case GdcTokenType.OpMod:
53 | return buf.AppendOp("%");
54 | case GdcTokenType.OpShiftLeft:
55 | return buf.AppendOp("<<");
56 | case GdcTokenType.OpShiftRight:
57 | return buf.AppendOp(">>");
58 | case GdcTokenType.OpAssign:
59 | return buf.AppendOp("=");
60 | case GdcTokenType.OpAssignAdd:
61 | return buf.AppendOp("+=");
62 | case GdcTokenType.OpAssignSub:
63 | return buf.AppendOp("-=");
64 | case GdcTokenType.OpAssignMul:
65 | return buf.AppendOp("*=");
66 | case GdcTokenType.OpAssignDiv:
67 | return buf.AppendOp("/=");
68 | case GdcTokenType.OpAssignMod:
69 | return buf.AppendOp("%=");
70 | case GdcTokenType.OpAssignShiftLeft:
71 | return buf.AppendOp("<<=");
72 | case GdcTokenType.OpAssignShiftRight:
73 | return buf.AppendOp(">>=");
74 | case GdcTokenType.OpAssignBitAnd:
75 | return buf.AppendOp("&=");
76 | case GdcTokenType.OpAssignBitOr:
77 | return buf.AppendOp("|=");
78 | case GdcTokenType.OpAssignBitXor:
79 | return buf.AppendOp("^=");
80 | case GdcTokenType.OpBitAnd:
81 | return buf.AppendOp("&");
82 | case GdcTokenType.OpBitOr:
83 | return buf.AppendOp("|");
84 | case GdcTokenType.OpBitXor:
85 | return buf.AppendOp("^");
86 | case GdcTokenType.OpBitInvert:
87 | return buf.AppendOp("!");
88 | case GdcTokenType.CfIf:
89 | if (previous != GdcTokenType.Newline) {
90 | return buf.AppendOp("if");
91 | } else {
92 | return buf.Append("if ");
93 | }
94 | case GdcTokenType.CfElif:
95 | if (previous != GdcTokenType.Newline) {
96 | return buf.AppendOp("elif");
97 | } else {
98 | return buf.Append("elif ");
99 | }
100 | case GdcTokenType.CfElse:
101 | if (previous != GdcTokenType.Newline) {
102 | return buf.Append(" else");
103 | } else {
104 | return buf.Append("else");
105 | }
106 | case GdcTokenType.CfFor:
107 | return buf.Append("for ");
108 | case GdcTokenType.CfWhile:
109 | return buf.Append("while ");
110 | case GdcTokenType.CfBreak:
111 | return buf.Append("break");
112 | case GdcTokenType.CfContinue:
113 | return buf.Append("continue");
114 | case GdcTokenType.CfPass:
115 | return buf.Append("pass");
116 | case GdcTokenType.CfReturn:
117 | return buf.Append("return ");
118 | case GdcTokenType.CfMatch:
119 | return buf.Append("match ");
120 | case GdcTokenType.PrFunction:
121 | return buf.Append("func ");
122 | case GdcTokenType.PrClass:
123 | return buf.Append("class ");
124 | case GdcTokenType.PrClassName:
125 | return buf.Append("class_name ");
126 | case GdcTokenType.PrExtends:
127 | return buf.AppendOp("extends");
128 | case GdcTokenType.PrIs:
129 | return buf.AppendOp("is");
130 | case GdcTokenType.PrOnready:
131 | return buf.Append("onready ");
132 | case GdcTokenType.PrTool:
133 | return buf.Append("tool ");
134 | case GdcTokenType.PrStatic:
135 | return buf.Append("static ");
136 | case GdcTokenType.PrExport:
137 | return buf.Append("export ");
138 | case GdcTokenType.PrSetget:
139 | return buf.AppendOp("setget");
140 | case GdcTokenType.PrConst:
141 | return buf.Append("const ");
142 | case GdcTokenType.PrVar:
143 | return buf.Append("var ");
144 | case GdcTokenType.PrAs:
145 | return buf.AppendOp("as");
146 | case GdcTokenType.PrVoid:
147 | return buf.Append("void ");
148 | case GdcTokenType.PrEnum:
149 | return buf.Append("enum ");
150 | case GdcTokenType.PrPreload:
151 | return buf.Append("preload");
152 | case GdcTokenType.PrAssert:
153 | return buf.Append("assert ");
154 | case GdcTokenType.PrYield:
155 | return buf.Append("yield ");
156 | case GdcTokenType.PrSignal:
157 | return buf.Append("signal ");
158 | case GdcTokenType.PrBreakpoint:
159 | return buf.Append("breakpoint ");
160 | case GdcTokenType.PrRemote:
161 | return buf.Append("remote ");
162 | case GdcTokenType.PrSync:
163 | return buf.Append("sync ");
164 | case GdcTokenType.PrMaster:
165 | return buf.Append("master ");
166 | case GdcTokenType.PrSlave:
167 | return buf.Append("slave ");
168 | case GdcTokenType.PrPuppet:
169 | return buf.Append("puppet ");
170 | case GdcTokenType.PrRemotesync:
171 | return buf.Append("remotesync ");
172 | case GdcTokenType.PrMastersync:
173 | return buf.Append("mastersync ");
174 | case GdcTokenType.PrPuppetsync:
175 | return buf.Append("puppetsync ");
176 | case GdcTokenType.BracketOpen:
177 | return buf.Append("[");
178 | case GdcTokenType.BracketClose:
179 | return buf.Append("]");
180 | case GdcTokenType.CurlyBracketOpen:
181 | return buf.AppendOp("{");
182 | case GdcTokenType.CurlyBracketClose:
183 | return buf.Append("}");
184 | case GdcTokenType.ParenthesisOpen:
185 | return buf.Append("(");
186 | case GdcTokenType.ParenthesisClose:
187 | return buf.Append(")");
188 | case GdcTokenType.Comma:
189 | return buf.Append(", ");
190 | case GdcTokenType.Semicolon:
191 | return buf.Append(";");
192 | case GdcTokenType.Period:
193 | return buf.Append(".");
194 | case GdcTokenType.QuestionMark:
195 | return buf.Append("?");
196 | case GdcTokenType.Colon:
197 | return buf.Append(": ");
198 | case GdcTokenType.Dollar:
199 | return buf.Append("$");
200 | case GdcTokenType.ForwardArrow:
201 | return buf.AppendOp("->");
202 | case GdcTokenType.Newline:
203 | buf.Indentation = (int)Data;
204 | buf.AppendNewLine();
205 | return buf;
206 | case GdcTokenType.ConstPi:
207 | return buf.Append("PI");
208 | case GdcTokenType.ConstTau:
209 | return buf.Append("TAU");
210 | case GdcTokenType.Wildcard:
211 | return buf.Append("_");
212 | case GdcTokenType.ConstInf:
213 | return buf.Append("INF");
214 | case GdcTokenType.ConstNan:
215 | return buf.Append("NAN");
216 | case GdcTokenType.Error:
217 | case GdcTokenType.Eof:
218 | case GdcTokenType.Cursor:
219 | case GdcTokenType.Max:
220 | return buf;
221 | default:
222 | throw new NotImplementedException(Type.ToString());
223 | }
224 | }
225 | }
226 | }
227 |
--------------------------------------------------------------------------------
/GdTool/Program.cs:
--------------------------------------------------------------------------------
1 | using CommandLine;
2 | using System;
3 | using System.IO;
4 | using System.Text;
5 | using Newtonsoft.Json;
6 |
7 | namespace GdTool {
8 | public class Program {
9 | [Verb("decode", HelpText = "Decodes and extracts a PCK file.")]
10 | public class DecodeOptions {
11 | [Option('i', "in", Required = true, HelpText = "The PCK file to extract.")]
12 | public string InputPath { get; set; }
13 |
14 | [Option('b', "bytecode-version", HelpText = "The commit hash of the bytecode version to use.")]
15 | public string BytecodeVersion { get; set; }
16 |
17 | [Option('d', "decompile", Required = false, HelpText = "Decompiles GDC files when in decode mode.")]
18 | public bool Decompile { get; set; }
19 |
20 | [Option('o', "out", Required = false, HelpText = "Output directory to extract files to.")]
21 | public string OutputDirectory { get; set; }
22 | }
23 |
24 | [Verb("build", HelpText = "Packs a directory into a PCK file.")]
25 | public class BuildOptions {
26 | [Option('i', "in", Required = true, HelpText = "The directory to pack.")]
27 | public string InputPath { get; set; }
28 |
29 | [Option('b', "bytecode-version", HelpText = "The commit hash of the bytecode version to use.")]
30 | public string BytecodeVersion { get; set; }
31 |
32 | [Option('o', "out", Required = false, HelpText = "Output file to place the PCK.")]
33 | public string OutputFile { get; set; }
34 | }
35 |
36 | [Verb("detect", HelpText = "Detects information for a game executable without executing it.")]
37 | public class DetectVersionOptions {
38 | [Option('i', "in", Required = true, HelpText = "The game executable to probe information from.")]
39 | public string InputPath { get; set; }
40 | }
41 |
42 | static void Main(string[] args) {
43 | Parser.Default.ParseArguments(args)
44 | .WithParsed(Decode)
45 | .WithParsed(Build)
46 | .WithParsed(DetectVersion);
47 | }
48 |
49 | private static void Decode(DecodeOptions options) {
50 | if (!File.Exists(options.InputPath)) {
51 | Console.WriteLine("Invalid PCK file (does not exist): " + options.InputPath);
52 | return;
53 | }
54 |
55 | string fileName = Path.GetFileName(options.InputPath);
56 | if (fileName.Contains(".")) {
57 | fileName = fileName.Substring(0, fileName.LastIndexOf('.'));
58 | }
59 | string outputDirectory;
60 | if (options.OutputDirectory != null) {
61 | outputDirectory = options.OutputDirectory;
62 | } else {
63 | outputDirectory = Path.Combine(Path.GetDirectoryName(options.InputPath), fileName);
64 | if (Directory.Exists(outputDirectory)) {
65 | Console.Write("Output directory \"" + outputDirectory + "\" already exists. Do you want to overwrite? (y/n): ");
66 | if (Console.ReadLine().ToLower() != "y") {
67 | return;
68 | }
69 | }
70 | }
71 |
72 | if (!Directory.Exists(outputDirectory)) {
73 | Directory.CreateDirectory(outputDirectory);
74 | }
75 |
76 | byte[] pckBytes = File.ReadAllBytes(options.InputPath);
77 | PckFile pck;
78 | try {
79 | Console.Write("Reading PCK file... ");
80 | pck = new PckFile(pckBytes);
81 | } catch (Exception e) {
82 | Console.WriteLine("invalid (could not parse).");
83 | Console.WriteLine(e);
84 | return;
85 | }
86 |
87 | Console.WriteLine("success.");
88 |
89 | GdToolProject project = new GdToolProject {
90 | PackFormatVersion = pck.PackFormatVersion,
91 | VersionMajor = pck.VersionMajor,
92 | VersionMinor = pck.VersionMinor,
93 | VersionPatch = pck.VersionPatch
94 | };
95 | byte[] serializedProject = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(project));
96 | File.WriteAllBytes(Path.Combine(outputDirectory, "gdtool-project.json"), serializedProject);
97 |
98 | BytecodeProvider provider = null;
99 | if (options.Decompile) {
100 | if (options.BytecodeVersion == null) {
101 | Console.WriteLine("Bytecode version must be supplied to decompile.");
102 | return;
103 | }
104 | provider = BytecodeProvider.GetByCommitHash(options.BytecodeVersion);
105 | }
106 | for (int i = 0; i < pck.Entries.Count; i++) {
107 | PckFileEntry entry = pck.Entries[i];
108 | string path = entry.Path.Substring(6); // remove res://
109 | try {
110 | string full = Path.Combine(outputDirectory, path);
111 | string parent = Path.GetDirectoryName(full);
112 | if (!Directory.Exists(parent)) {
113 | Directory.CreateDirectory(parent);
114 | }
115 |
116 | if (options.Decompile && path.EndsWith(".gdc")) {
117 | string decompiled = GdScriptDecompiler.Decompile(entry.Data, provider);
118 | full = full.Substring(0, full.Length - 1); // convert exception from .gdc to .gd
119 | File.WriteAllText(full, decompiled);
120 | } else {
121 | File.WriteAllBytes(full, entry.Data);
122 | }
123 |
124 | int percentage = (int)Math.Floor((i + 1) / (double)pck.Entries.Count * 100.0);
125 | Console.Write("\rUnpacking: " + (i + 1) + "/" + pck.Entries.Count + " (" + percentage + "%)");
126 | } catch (Exception e) {
127 | Console.WriteLine("\nError while decoding file: " + path);
128 | Console.WriteLine(e);
129 | Environment.Exit(1);
130 | }
131 | }
132 | Console.WriteLine();
133 | }
134 |
135 | private static void Build(BuildOptions options) {
136 | if (!Directory.Exists(options.InputPath)) {
137 | Console.WriteLine("Invalid directory (does not exist): " + options.InputPath);
138 | return;
139 | }
140 |
141 | if (!File.Exists(Path.Combine(options.InputPath, "project.binary"))) {
142 | Console.WriteLine("Invalid project (project.binary file not present in directory): " + options.InputPath);
143 | return;
144 | }
145 |
146 | if (!File.Exists(Path.Combine(options.InputPath, "gdtool-project.json"))) {
147 | Console.WriteLine("Invalid project (gdtool-project.json file not present in directory): " + options.InputPath);
148 | return;
149 | }
150 |
151 | string serializedProject = Encoding.UTF8.GetString(File.ReadAllBytes(Path.Combine(options.InputPath, "gdtool-project.json")));
152 | GdToolProject project = JsonConvert.DeserializeObject(serializedProject);
153 |
154 | PckFile pck = new PckFile(project.PackFormatVersion, project.VersionMajor, project.VersionMinor, project.VersionPatch);
155 | BytecodeProvider provider = null;
156 | if (options.BytecodeVersion != null) {
157 | provider = BytecodeProvider.GetByCommitHash(options.BytecodeVersion);
158 | }
159 | string[] files = Directory.GetFiles(options.InputPath, "*", SearchOption.AllDirectories);
160 | pck.Entries.Capacity = files.Length;
161 | for (int i = 0; i < files.Length; i++) {
162 | string file = files[i];
163 | string relative = Path.GetRelativePath(options.InputPath, file);
164 | if (relative.Equals("gdtool-project.json")) { // don't pack the project fuke
165 | continue;
166 | }
167 | try {
168 | string withPrefix = "res://" + relative.Replace('\\', '/');
169 | byte[] contents = File.ReadAllBytes(file);
170 | if (relative.EndsWith(".gd")) {
171 | if (provider == null) {
172 | Console.WriteLine("Bytecode version must be supplied to compile GdScript file: " + relative);
173 | return;
174 | }
175 | contents = GdScriptCompiler.Compile(Encoding.UTF8.GetString(contents), provider);
176 | withPrefix += "c"; // convert ".gd" to ".gdc"
177 | }
178 | pck.Entries.Add(new PckFileEntry {
179 | Path = withPrefix,
180 | Data = contents
181 | });
182 |
183 | int percentage = (int)Math.Floor((i + 1) / (double)files.Length * 100.0);
184 | Console.Write("\rPacking: " + (i + 1) + "/" + files.Length + " (" + percentage + "%)");
185 | } catch (Exception e) {
186 | Console.WriteLine("\nError while building file: " + relative);
187 | Console.WriteLine(e);
188 | Environment.Exit(1);
189 | }
190 | }
191 |
192 | Console.WriteLine();
193 |
194 | byte[] serialized = pck.ToBytes();
195 | string outputFile = options.InputPath + ".pck";
196 | if (options.OutputFile != null) {
197 | outputFile = options.OutputFile;
198 | }
199 | Console.WriteLine("Writing PCK file to disk... ");
200 | File.WriteAllBytes(outputFile, serialized);
201 | }
202 |
203 | private static void DetectVersion(DetectVersionOptions options) {
204 | if (!File.Exists(options.InputPath)) {
205 | Console.WriteLine("Invalid game executable file (does not exist): " + options.InputPath);
206 | return;
207 | }
208 |
209 | byte[] binary = File.ReadAllBytes(options.InputPath);
210 | BytecodeProvider provider = VersionDetector.Detect(binary);
211 | if (provider == null) {
212 | Console.WriteLine("A known commit hash could not be found within the binary. Are you sure you supplied a Godot game executable?");
213 | Console.WriteLine("If you definitely passed a valid executable, it might be compiled with a version newer than this build of GdTool.");
214 | Console.WriteLine("If this is the case, try compiling with the newest bytecode version GdTool supports if it's still compatible.");
215 | return;
216 | }
217 |
218 | Console.WriteLine("Bytecode version hash: " + provider.ProviderData.CommitHash.Substring(0, 7) + " (" + provider.ProviderData.CommitHash + ")");
219 | Console.WriteLine(provider.ProviderData.Description);
220 | }
221 | }
222 | }
223 |
--------------------------------------------------------------------------------
/GdTool/GdScriptCompiler.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Text;
5 | using System.Linq;
6 |
7 | namespace GdTool {
8 | public class GdScriptCompiler {
9 | private static readonly List CompilerMetatokens = new List() {
10 | new BasicCompilerToken(null, " "), // Space
11 | new BasicCompilerToken(null, "\t"), // Tab
12 | new CommentCompilerToken()
13 | };
14 |
15 | private static readonly List CompilerTokens = new List() {
16 | new NewlineCompilerToken(),
17 | new KeywordCompilerToken(GdcTokenType.CfIf, "if"),
18 | new KeywordCompilerToken(GdcTokenType.CfElif, "elif"),
19 | new KeywordCompilerToken(GdcTokenType.CfElse, "else"),
20 | new KeywordCompilerToken(GdcTokenType.CfFor, "for"),
21 | new KeywordCompilerToken(GdcTokenType.CfWhile, "while"),
22 | new KeywordCompilerToken(GdcTokenType.CfBreak, "break"),
23 | new KeywordCompilerToken(GdcTokenType.CfContinue, "continue"),
24 | new KeywordCompilerToken(GdcTokenType.CfPass, "pass"),
25 | new KeywordCompilerToken(GdcTokenType.CfReturn, "return"),
26 | new KeywordCompilerToken(GdcTokenType.CfMatch, "match"),
27 | new KeywordCompilerToken(GdcTokenType.PrFunction, "func"),
28 | new KeywordCompilerToken(GdcTokenType.PrClassName, "class_name"),
29 | new KeywordCompilerToken(GdcTokenType.PrClass, "class"),
30 | new KeywordCompilerToken(GdcTokenType.PrExtends, "extends"),
31 | new KeywordCompilerToken(GdcTokenType.PrOnready, "onready"),
32 | new KeywordCompilerToken(GdcTokenType.PrTool, "tool"),
33 | new KeywordCompilerToken(GdcTokenType.PrStatic, "static"),
34 | new KeywordCompilerToken(GdcTokenType.PrExport, "export"),
35 | new KeywordCompilerToken(GdcTokenType.PrSetget, "setget"),
36 | new KeywordCompilerToken(GdcTokenType.PrConst, "const"),
37 | new KeywordCompilerToken(GdcTokenType.PrVar, "var"),
38 | new KeywordCompilerToken(GdcTokenType.PrVoid, "void"),
39 | new KeywordCompilerToken(GdcTokenType.PrEnum, "enum"),
40 | new KeywordCompilerToken(GdcTokenType.PrPreload, "preload"),
41 | new KeywordCompilerToken(GdcTokenType.PrAssert, "assert"),
42 | new KeywordCompilerToken(GdcTokenType.PrYield, "yield"),
43 | new KeywordCompilerToken(GdcTokenType.PrSignal, "signal"),
44 | new KeywordCompilerToken(GdcTokenType.PrBreakpoint, "breakpoint"),
45 | new KeywordCompilerToken(GdcTokenType.PrRemotesync, "remotesync"),
46 | new KeywordCompilerToken(GdcTokenType.PrMastersync, "mastersync"),
47 | new KeywordCompilerToken(GdcTokenType.PrPuppetsync, "puppetsync"),
48 | new KeywordCompilerToken(GdcTokenType.PrRemote, "remote"),
49 | new KeywordCompilerToken(GdcTokenType.PrSync, "sync"),
50 | new KeywordCompilerToken(GdcTokenType.PrMaster, "master"),
51 | new KeywordCompilerToken(GdcTokenType.PrSlave, "slave"),
52 | new KeywordCompilerToken(GdcTokenType.PrPuppet, "puppet"),
53 | new KeywordCompilerToken(GdcTokenType.PrAs, "as"),
54 | new KeywordCompilerToken(GdcTokenType.PrIs, "is"),
55 | new KeywordCompilerToken(GdcTokenType.Self, "self"),
56 | new KeywordCompilerToken(GdcTokenType.OpIn, "in"),
57 | new WildcardCompilerToken(),
58 | new BasicCompilerToken(GdcTokenType.Comma, ","),
59 | new BasicCompilerToken(GdcTokenType.Semicolon, ";"),
60 | new BasicCompilerToken(GdcTokenType.Period, "."),
61 | new BasicCompilerToken(GdcTokenType.QuestionMark, "?"),
62 | new BasicCompilerToken(GdcTokenType.Colon, ":"),
63 | new BasicCompilerToken(GdcTokenType.Dollar, "$"),
64 | new BasicCompilerToken(GdcTokenType.ForwardArrow, "->"),
65 | new BasicCompilerToken(GdcTokenType.OpAssignAdd, "+="),
66 | new BasicCompilerToken(GdcTokenType.OpAssignSub, "-="),
67 | new BasicCompilerToken(GdcTokenType.OpAssignMul, "*="),
68 | new BasicCompilerToken(GdcTokenType.OpAssignDiv, "/="),
69 | new BasicCompilerToken(GdcTokenType.OpAssignMod, "+="),
70 | new BasicCompilerToken(GdcTokenType.OpAssignShiftLeft, "<<="),
71 | new BasicCompilerToken(GdcTokenType.OpAssignShiftRight, ">>="),
72 | new BasicCompilerToken(GdcTokenType.OpShiftLeft, "<<"),
73 | new BasicCompilerToken(GdcTokenType.OpShiftRight, ">>"),
74 | new BasicCompilerToken(GdcTokenType.OpAssignBitAnd, "&="),
75 | new BasicCompilerToken(GdcTokenType.OpAssignBitOr, "|="),
76 | new BasicCompilerToken(GdcTokenType.OpAssignBitXor, "^="),
77 | new BasicCompilerToken(GdcTokenType.OpEqual, "=="),
78 | new BasicCompilerToken(GdcTokenType.OpNotEqual, "!="),
79 | new BasicCompilerToken(GdcTokenType.OpLessEqual, "<="),
80 | new BasicCompilerToken(GdcTokenType.OpLess, "<"),
81 | new BasicCompilerToken(GdcTokenType.OpGreaterEqual, ">="),
82 | new BasicCompilerToken(GdcTokenType.OpGreater, ">"),
83 | new KeywordCompilerToken(GdcTokenType.OpAnd, "and"),
84 | new KeywordCompilerToken(GdcTokenType.OpOr, "or"),
85 | new KeywordCompilerToken(GdcTokenType.OpNot, "not"),
86 | new BasicCompilerToken(GdcTokenType.OpAdd, "+"),
87 | new BasicCompilerToken(GdcTokenType.OpSub, "-"),
88 | new BasicCompilerToken(GdcTokenType.OpMul, "*"),
89 | new BasicCompilerToken(GdcTokenType.OpDiv, "/"),
90 | new BasicCompilerToken(GdcTokenType.OpMod, "%"),
91 | new BasicCompilerToken(GdcTokenType.OpBitAnd, "&"),
92 | new BasicCompilerToken(GdcTokenType.OpBitOr, "|"),
93 | new BasicCompilerToken(GdcTokenType.OpBitXor, "^"),
94 | new BasicCompilerToken(GdcTokenType.OpBitInvert, "!"),
95 | new BasicCompilerToken(GdcTokenType.OpAssign, "="),
96 | new BasicCompilerToken(GdcTokenType.BracketOpen, "["),
97 | new BasicCompilerToken(GdcTokenType.BracketClose, "]"),
98 | new BasicCompilerToken(GdcTokenType.CurlyBracketOpen, "{"),
99 | new BasicCompilerToken(GdcTokenType.CurlyBracketClose, "}"),
100 | new BasicCompilerToken(GdcTokenType.ParenthesisOpen, "("),
101 | new BasicCompilerToken(GdcTokenType.ParenthesisClose, ")"),
102 | new KeywordCompilerToken(GdcTokenType.ConstPi, "PI"),
103 | new KeywordCompilerToken(GdcTokenType.ConstTau, "TAU"),
104 | new KeywordCompilerToken(GdcTokenType.ConstInf, "INF"),
105 | new KeywordCompilerToken(GdcTokenType.ConstNan, "NAN"),
106 | new ConstantCompilerToken(),
107 | new BuiltInTypeCompilerToken(),
108 | new BuiltInFuncCompilerToken(),
109 | new IdentifierCompilerToken(),
110 | };
111 |
112 | static GdScriptCompiler() {
113 | for (int i = CompilerMetatokens.Count - 1; i >= 0; i--) {
114 | CompilerTokens.Insert(0, CompilerMetatokens[i]);
115 | }
116 | }
117 |
118 | public static byte[] Compile(string source, BytecodeProvider provider) {
119 | SourceCodeReader reader = new SourceCodeReader(source.Trim());
120 | List tokens = new List();
121 | while (reader.HasRemaining) {
122 | bool foundToken = false;
123 | foreach (ICompilerParsable token in CompilerTokens) {
124 | try {
125 | CompilerTokenData data = token.Parse(reader, provider);
126 | if (data != null) {
127 | tokens.Add(data);
128 | foundToken = true;
129 | break;
130 | }
131 | } catch (Exception e) {
132 | throw new Exception("Error on line " + reader.CurrentRow, e);
133 | }
134 | }
135 | if (!foundToken) {
136 | throw new InvalidOperationException("Unexpected token on line " + reader.CurrentRow);
137 | }
138 | }
139 |
140 | tokens = tokens.Where(token => !CompilerMetatokens.Contains(token.Creator)).ToList();
141 | tokens.Add(new CompilerTokenData(new NewlineCompilerToken()));
142 | tokens.Add(new CompilerTokenData(new BasicCompilerToken(GdcTokenType.Eof, null)));
143 | tokens.Add(new CompilerTokenData(new BasicCompilerToken(GdcTokenType.Empty, null)));
144 |
145 | List identifiers = new List();
146 | List constants = new List();
147 | List linesList = new List {
148 | 0
149 | };
150 | for (uint i = 0; i < tokens.Count; i++) {
151 | CompilerTokenData data = tokens[(int)i];
152 | if (data.Creator is IdentifierCompilerToken) {
153 | GdcIdentifier ident = (GdcIdentifier)data.Operand;
154 | int index = identifiers.IndexOf(ident.Identifier);
155 | if (index == -1) {
156 | data.Data = (uint)identifiers.Count;
157 | identifiers.Add(ident.Identifier);
158 | } else {
159 | data.Data = (uint)index;
160 | }
161 | } else if (data.Creator is ConstantCompilerToken) {
162 | int index = constants.IndexOf(data.Operand);
163 | if (index == -1) {
164 | data.Data = (uint)constants.Count;
165 | constants.Add(data.Operand);
166 | } else {
167 | data.Data = (uint)index;
168 | }
169 | } else if (data.Creator is NewlineCompilerToken) {
170 | linesList.Add(i);
171 | }
172 | }
173 |
174 | using (MemoryStream ms = new MemoryStream()) {
175 | using (BinaryWriter buf = new BinaryWriter(ms)) {
176 | buf.Write(Encoding.ASCII.GetBytes("GDSC")); // magic header
177 | buf.Write(provider.ProviderData.BytecodeVersion); // version
178 | buf.Write((uint)identifiers.Count); // identifiers count
179 | buf.Write((uint)constants.Count); // constants count
180 | buf.Write((uint)linesList.Count); // line count
181 | buf.Write((uint)tokens.Count); // tokens count
182 |
183 | // write identifiers
184 | foreach (string ident in identifiers) {
185 | byte[] encoded = Encoding.UTF8.GetBytes(ident);
186 |
187 | long lengthPos = ms.Position;
188 | buf.Write(0U);
189 | foreach (byte val in encoded) {
190 | buf.Write((byte)(val ^ 0xB6));
191 | }
192 |
193 | uint padding = 0;
194 | if (ms.Position % 4 == 0) { // add four bytes of null termination
195 | for (int i = 0; i < 4; i++) {
196 | buf.Write((byte)(0x00 ^ 0xB6)); // padding null bytes
197 | padding++;
198 | }
199 | }
200 | while (ms.Position % 4 != 0) {
201 | buf.Write((byte)(0x00 ^ 0xB6)); // padding null bytes
202 | padding++;
203 | }
204 | long currentPos = ms.Position;
205 | ms.Position = lengthPos;
206 | buf.Write((uint)(encoded.Length + padding));
207 | ms.Position = currentPos;
208 | }
209 |
210 | // write constants
211 | foreach (IGdStructure structure in constants) {
212 | structure.Serialize(buf, provider);
213 | }
214 |
215 | // write lines
216 | for (uint i = 0; i < linesList.Count; i++) {
217 | buf.Write(linesList[(int)i]);
218 | buf.Write(i + 1);
219 | }
220 |
221 | // write tokens
222 | foreach (CompilerTokenData token in tokens) {
223 | ICompilerToken creator = (ICompilerToken)token.Creator;
224 | creator.Write(buf, provider, token);
225 | }
226 |
227 | return ms.ToArray();
228 | }
229 | }
230 | }
231 | }
232 | }
233 |
--------------------------------------------------------------------------------
/GdTool/CompilerToken.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Text;
4 |
5 | namespace GdTool {
6 | public class CompilerTokenData {
7 | public ICompilerParsable Creator;
8 | public uint Data;
9 | public IGdStructure Operand;
10 |
11 | private CompilerTokenData() { }
12 |
13 | public CompilerTokenData(ICompilerParsable creator) {
14 | Creator = creator;
15 | }
16 | }
17 |
18 | public interface ICompilerParsable {
19 | CompilerTokenData Parse(SourceCodeReader reader, BytecodeProvider provider);
20 | }
21 |
22 | public interface ICompilerToken : ICompilerParsable {
23 | void Write(BinaryWriter writer, BytecodeProvider provider, CompilerTokenData data);
24 | }
25 |
26 | public class CommentCompilerToken : ICompilerParsable {
27 | public CompilerTokenData Parse(SourceCodeReader reader, BytecodeProvider provider) {
28 | string commentStart = reader.Peek(1);
29 | if (commentStart == "#") {
30 | reader.Position++;
31 | while (true) {
32 | string next = reader.Peek(1);
33 | if (next == null) {
34 | reader.Position++;
35 | return new CompilerTokenData(this);
36 | } else if (next == "\r" || next == "\n") {
37 | return new CompilerTokenData(this);
38 | }
39 | reader.Position++;
40 | }
41 | }
42 | return null;
43 | }
44 | }
45 |
46 | public class BasicCompilerToken : ICompilerToken {
47 | public GdcTokenType? Type;
48 | public string Value;
49 |
50 | public BasicCompilerToken(GdcTokenType? type, string value) {
51 | Type = type;
52 | Value = value;
53 | }
54 |
55 | public virtual CompilerTokenData Parse(SourceCodeReader reader, BytecodeProvider provider) {
56 | string peek = reader.Peek(Value.Length);
57 | if (peek != null && peek == Value) {
58 | reader.Position += Value.Length;
59 | return new CompilerTokenData(this);
60 | }
61 | return null;
62 | }
63 |
64 | public void Write(BinaryWriter writer, BytecodeProvider provider, CompilerTokenData data) {
65 | if (Type != null) {
66 | int id = provider.TokenTypeProvider.GetTokenId(Type.Value);
67 | if (id == -1) {
68 | throw new Exception($"token type {Type.Value} not implemented for supplied bytecode version");
69 | }
70 | writer.Write((byte)id);
71 | }
72 | }
73 | }
74 |
75 | public class WildcardCompilerToken : ICompilerToken {
76 | public virtual CompilerTokenData Parse(SourceCodeReader reader, BytecodeProvider provider) {
77 | string peek = reader.Peek(2);
78 | if (peek != null && peek == "_:") {
79 | reader.Position += 2;
80 | return new CompilerTokenData(this);
81 | }
82 | return null;
83 | }
84 |
85 | public void Write(BinaryWriter writer, BytecodeProvider provider, CompilerTokenData data) {
86 | writer.Write((byte)provider.TokenTypeProvider.GetTokenId(GdcTokenType.Wildcard));
87 | writer.Write((byte)provider.TokenTypeProvider.GetTokenId(GdcTokenType.Colon));
88 | }
89 | }
90 |
91 | public class NewlineCompilerToken : ICompilerToken {
92 | public virtual CompilerTokenData Parse(SourceCodeReader reader, BytecodeProvider provider) {
93 | string newlineCharacter = null;
94 |
95 | string peek = reader.Peek(1);
96 | if (peek != null && peek == "\n") {
97 | newlineCharacter = "\n";
98 | }
99 | if (newlineCharacter == null) {
100 | peek = reader.Peek(2);
101 | if (peek != null && peek == "\r\n") {
102 | newlineCharacter = "\r\n";
103 | }
104 | }
105 |
106 | if (newlineCharacter == null) {
107 | return null;
108 | }
109 |
110 | reader.Position += newlineCharacter.Length;
111 |
112 | uint indentation = 0;
113 | while (true) {
114 | string indentChar = reader.Peek(1);
115 | if (indentChar == " ") {
116 | throw new Exception("gdtool compiler requires tabs instead of spaces");
117 | } else if (indentChar == "\t") {
118 | indentation++;
119 | reader.Position += 1;
120 | } else {
121 | break;
122 | }
123 | }
124 |
125 | return new CompilerTokenData(this) {
126 | Data = indentation
127 | };
128 | }
129 |
130 | public void Write(BinaryWriter writer, BytecodeProvider provider, CompilerTokenData data) {
131 | writer.Write((uint)provider.TokenTypeProvider.GetTokenId(GdcTokenType.Newline) | (data.Data << 8) | 0x80);
132 | }
133 | }
134 |
135 | public class KeywordCompilerToken : BasicCompilerToken {
136 | public KeywordCompilerToken(GdcTokenType? type, string value) : base(type, value) { }
137 |
138 | public override CompilerTokenData Parse(SourceCodeReader reader, BytecodeProvider provider) {
139 | string peek = reader.Peek(Value.Length);
140 | if (peek != null && peek == Value) {
141 | reader.Position += Value.Length;
142 | string nextChar = reader.Peek(1);
143 | if (nextChar == null || (!char.IsLetterOrDigit(nextChar[0]) && nextChar[0] != '_')) {
144 | return new CompilerTokenData(this);
145 | } else {
146 | reader.Position -= Value.Length;
147 | }
148 | }
149 | return null;
150 | }
151 | }
152 |
153 | public class BuiltInFuncCompilerToken : ICompilerToken {
154 | public CompilerTokenData Parse(SourceCodeReader reader, BytecodeProvider provider) {
155 | for (uint i = 0; i < provider.ProviderData.FunctionNames.Length; i++) {
156 | string func = provider.ProviderData.FunctionNames[i];
157 | string peek = reader.Peek(func.Length);
158 | if (peek != null && peek == func) {
159 | reader.Position += func.Length;
160 | string nextChar = reader.Peek(1);
161 | if (nextChar == null || (!char.IsLetterOrDigit(nextChar[0]) && nextChar[0] != '_')) {
162 | return new CompilerTokenData(this) {
163 | Data = i
164 | };
165 | } else {
166 | reader.Position -= func.Length;
167 | }
168 | }
169 | }
170 | return null;
171 | }
172 |
173 | public void Write(BinaryWriter writer, BytecodeProvider provider, CompilerTokenData data) {
174 | writer.Write((uint)provider.TokenTypeProvider.GetTokenId(GdcTokenType.BuiltInFunc) | (data.Data << 8) | 0x80);
175 | }
176 | }
177 |
178 | public class BuiltInTypeCompilerToken : ICompilerToken {
179 | public CompilerTokenData Parse(SourceCodeReader reader, BytecodeProvider provider) {
180 | string[] typeNames = provider.TypeNameProvider.GetAllTypeNames();
181 | for (uint i = 0; i < typeNames.Length; i++) {
182 | string type = typeNames[i];
183 | string peek = reader.Peek(type.Length);
184 | if (peek != null && peek == type) {
185 | reader.Position += type.Length;
186 | string nextChar = reader.Peek(1);
187 | if (nextChar == null || (!char.IsLetterOrDigit(nextChar[0]) && nextChar[0] != '_')) {
188 | return new CompilerTokenData(this) {
189 | Data = i
190 | };
191 | } else {
192 | reader.Position -= type.Length;
193 | }
194 | }
195 | }
196 | return null;
197 | }
198 |
199 | public void Write(BinaryWriter writer, BytecodeProvider provider, CompilerTokenData data) {
200 | writer.Write((uint)provider.TokenTypeProvider.GetTokenId(GdcTokenType.BuiltInType) | (data.Data << 8) | 0x80);
201 | }
202 | }
203 |
204 | public class IdentifierCompilerToken : ICompilerToken {
205 | public CompilerTokenData Parse(SourceCodeReader reader, BytecodeProvider provider) {
206 | char first = reader.Read(1)[0];
207 | if (!char.IsLetter(first) && first != '_') {
208 | return null;
209 | }
210 |
211 | StringBuilder builder = new StringBuilder();
212 | builder.Append(first);
213 | while (true) {
214 | string ch = reader.Peek(1);
215 | if (ch == null || (!char.IsLetterOrDigit(ch[0]) && ch[0] != '_')) {
216 | return new CompilerTokenData(this) {
217 | Operand = new GdcIdentifier(builder.ToString())
218 | };
219 | }
220 |
221 | builder.Append(ch);
222 | reader.Position++;
223 | }
224 | }
225 |
226 | public void Write(BinaryWriter writer, BytecodeProvider provider, CompilerTokenData data) {
227 | writer.Write((uint)provider.TokenTypeProvider.GetTokenId(GdcTokenType.Identifier) | (data.Data << 8) | 0x80);
228 | }
229 | }
230 |
231 | public class ConstantCompilerToken : ICompilerToken {
232 | public CompilerTokenData Parse(SourceCodeReader reader, BytecodeProvider provider) {
233 | char first = reader.Peek(1)[0];
234 | if (first == '"') { // read a string
235 | // TODO multiline strings
236 | reader.Position++;
237 |
238 | StringBuilder str = new StringBuilder();
239 | char lastChar = '\0';
240 | while (true) {
241 | string next = reader.Read(1);
242 | if (next == null) {
243 | return null;
244 | }
245 | char ch = next[0];
246 | if (ch == '"') {
247 | if (lastChar == '\\') {
248 | str.Append(ch);
249 | lastChar = ch;
250 | continue;
251 | }
252 |
253 | return new CompilerTokenData(this) {
254 | Operand = new GdcString {
255 | Value = str.ToString()
256 | }
257 | };
258 | }
259 |
260 | str.Append(ch);
261 | lastChar = ch;
262 | }
263 | } else if (char.IsDigit(first)) { // read a numeric value
264 | StringBuilder numberBuffer = new StringBuilder();
265 | int numberBase = 10;
266 | if (first == '0') {
267 | string prefix = reader.Peek(2);
268 | if (prefix != null) {
269 | if (prefix == "0b") {
270 | numberBase = 2;
271 | } else if (prefix == "0x") {
272 | numberBase = 16;
273 | }
274 | }
275 | }
276 |
277 | while (true) {
278 | string next = reader.Peek(1);
279 | if (next == null || (!char.IsDigit(next[0]) && next[0] != '.' && next[0] != '_')) {
280 | string num = numberBuffer.ToString();
281 | if (num.Contains(".")) {
282 | if (!double.TryParse(num, out double val)) {
283 | return null;
284 | }
285 | float valFloat = (float)val;
286 | if (valFloat != val) { // if there is loss of precision by casting to float
287 | return new CompilerTokenData(this) {
288 | Operand = new GdcDouble {
289 | Value = val
290 | }
291 | };
292 | } else {
293 | return new CompilerTokenData(this) {
294 | Operand = new GdcSingle {
295 | Value = valFloat
296 | }
297 | };
298 | }
299 | } else {
300 | long val;
301 | try {
302 | val = Convert.ToInt64(num, numberBase);
303 | } catch (Exception) {
304 | return null;
305 | }
306 | if (val > int.MaxValue) {
307 | return new CompilerTokenData(this) {
308 | Operand = new GdcUInt64 {
309 | Value = (ulong)val
310 | }
311 | };
312 | } else {
313 | return new CompilerTokenData(this) {
314 | Operand = new GdcUInt32 {
315 | Value = (uint)val
316 | }
317 | };
318 | }
319 | }
320 | }
321 |
322 | if (next[0] == '_') {
323 | continue;
324 | }
325 |
326 | numberBuffer.Append(next[0]);
327 | reader.Position++;
328 | }
329 | } else if (reader.Peek(4) != null && reader.Peek(4) == "null") {
330 | reader.Position += 4;
331 | return new CompilerTokenData(this) {
332 | Operand = new GdcNull()
333 | };
334 | } else if (reader.Peek(4) != null && reader.Peek(4) == "true") {
335 | reader.Position += 4;
336 | return new CompilerTokenData(this) {
337 | Operand = new GdcBool {
338 | Value = true
339 | }
340 | };
341 | } else if (reader.Peek(5) != null && reader.Peek(5) == "false") {
342 | reader.Position += 5;
343 | return new CompilerTokenData(this) {
344 | Operand = new GdcBool {
345 | Value = false
346 | }
347 | };
348 | }
349 |
350 | return null;
351 | }
352 |
353 | public void Write(BinaryWriter writer, BytecodeProvider provider, CompilerTokenData data) {
354 | writer.Write((uint)provider.TokenTypeProvider.GetTokenId(GdcTokenType.Constant) | (data.Data << 8) | 0x80);
355 | }
356 | }
357 | }
358 |
--------------------------------------------------------------------------------
/GdTool/Structures.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Text;
4 |
5 | namespace GdTool {
6 | public interface IGdStructure {
7 | void Serialize(BinaryWriter buf, BytecodeProvider provider);
8 |
9 | IGdStructure Deserialize(BinaryReader reader);
10 | }
11 |
12 | public class GdcIdentifier : IGdStructure {
13 | public string Identifier;
14 |
15 | public GdcIdentifier(string identifier) {
16 | Identifier = identifier;
17 | }
18 |
19 | public IGdStructure Deserialize(BinaryReader reader) {
20 | throw new InvalidOperationException();
21 | }
22 |
23 | public void Serialize(BinaryWriter buf, BytecodeProvider provider) {
24 | throw new InvalidOperationException();
25 | }
26 |
27 | public override string ToString() {
28 | return Identifier;
29 | }
30 |
31 | public override bool Equals(object obj) {
32 | if (obj is GdcIdentifier o) {
33 | return o.Identifier == Identifier;
34 | }
35 | return false;
36 | }
37 |
38 | public override int GetHashCode() {
39 | return Identifier.GetHashCode();
40 | }
41 | }
42 |
43 | public class GdcNull : IGdStructure {
44 | public void Serialize(BinaryWriter buf, BytecodeProvider provider) {
45 | buf.Write(provider.TypeNameProvider.GetTypeId("Nil"));
46 | // buf.Write(0U);
47 | }
48 |
49 | public IGdStructure Deserialize(BinaryReader reader) {
50 | // reader.BaseStream.Position += 4;
51 | return this;
52 | }
53 |
54 | public override string ToString() {
55 | return "null";
56 | }
57 |
58 | public override bool Equals(object obj) {
59 | return obj is GdcNull;
60 | }
61 |
62 | public override int GetHashCode() {
63 | return 0;
64 | }
65 | }
66 |
67 | public class GdcBool : IGdStructure {
68 | public bool Value;
69 |
70 | public void Serialize(BinaryWriter buf, BytecodeProvider provider) {
71 | buf.Write(provider.TypeNameProvider.GetTypeId("bool"));
72 | buf.Write(Value ? 1U : 0U);
73 | }
74 |
75 | public IGdStructure Deserialize(BinaryReader reader) {
76 | Value = reader.ReadUInt32() != 0;
77 | return this;
78 | }
79 |
80 | public override string ToString() {
81 | return Value.ToString().ToLower();
82 | }
83 |
84 | public override bool Equals(object obj) {
85 | if (obj is GdcBool o) {
86 | return o.Value == Value;
87 | }
88 | return false;
89 | }
90 |
91 | public override int GetHashCode() {
92 | return Value.GetHashCode();
93 | }
94 | }
95 |
96 | public class GdcUInt32 : IGdStructure {
97 | public uint Value;
98 |
99 | public void Serialize(BinaryWriter buf, BytecodeProvider provider) {
100 | buf.Write(provider.TypeNameProvider.GetTypeId("int"));
101 | buf.Write(Value);
102 | }
103 |
104 | public IGdStructure Deserialize(BinaryReader reader) {
105 | Value = reader.ReadUInt32();
106 | return this;
107 | }
108 |
109 | public override string ToString() {
110 | return Value.ToString();
111 | }
112 |
113 | public override bool Equals(object obj) {
114 | if (obj is GdcUInt32 o) {
115 | return o.Value == Value;
116 | }
117 | return false;
118 | }
119 |
120 | public override int GetHashCode() {
121 | return Value.GetHashCode();
122 | }
123 | }
124 |
125 | public class GdcUInt64 : IGdStructure {
126 | public ulong Value;
127 |
128 | public void Serialize(BinaryWriter buf, BytecodeProvider provider) {
129 | buf.Write(provider.TypeNameProvider.GetTypeId("int") | (1 << 16));
130 | buf.Write(Value);
131 | }
132 |
133 | public IGdStructure Deserialize(BinaryReader reader) {
134 | Value = reader.ReadUInt64();
135 | return this;
136 | }
137 |
138 | public override string ToString() {
139 | return Value.ToString();
140 | }
141 |
142 | public override bool Equals(object obj) {
143 | if (obj is GdcUInt64 o) {
144 | return o.Value == Value;
145 | }
146 | return false;
147 | }
148 |
149 | public override int GetHashCode() {
150 | return Value.GetHashCode();
151 | }
152 | }
153 |
154 | public class GdcSingle : IGdStructure {
155 | public float Value;
156 |
157 | public void Serialize(BinaryWriter buf, BytecodeProvider provider) {
158 | buf.Write(provider.TypeNameProvider.GetTypeId("float"));
159 | buf.Write(Value);
160 | }
161 |
162 | public IGdStructure Deserialize(BinaryReader reader) {
163 | Value = reader.ReadSingle();
164 | return this;
165 | }
166 |
167 | public override string ToString() {
168 | string str = Value.ToString();
169 | if (!str.Contains(".")) {
170 | return str + ".0";
171 | }
172 | return str;
173 | }
174 |
175 | public override bool Equals(object obj) {
176 | if (obj is GdcSingle o) {
177 | return o.Value == Value;
178 | }
179 | return false;
180 | }
181 |
182 | public override int GetHashCode() {
183 | return Value.GetHashCode();
184 | }
185 | }
186 |
187 | public class GdcDouble : IGdStructure {
188 | public double Value;
189 |
190 | public void Serialize(BinaryWriter buf, BytecodeProvider provider) {
191 | buf.Write(provider.TypeNameProvider.GetTypeId("float") | (1 << 16));
192 | buf.Write(Value);
193 | }
194 |
195 | public IGdStructure Deserialize(BinaryReader reader) {
196 | Value = reader.ReadDouble();
197 | return this;
198 | }
199 |
200 | public override string ToString() {
201 | string str = Value.ToString();
202 | if (!str.Contains(".")) {
203 | return str + ".0";
204 | }
205 | return str;
206 | }
207 |
208 | public override bool Equals(object obj) {
209 | if (obj is GdcDouble o) {
210 | return o.Value == Value;
211 | }
212 | return false;
213 | }
214 |
215 | public override int GetHashCode() {
216 | return Value.GetHashCode();
217 | }
218 | }
219 |
220 | public class GdcString : IGdStructure {
221 | public string Value;
222 |
223 | public void Serialize(BinaryWriter buf, BytecodeProvider provider) {
224 | buf.Write(provider.TypeNameProvider.GetTypeId("String"));
225 | byte[] strBytes = Encoding.UTF8.GetBytes(Value);
226 | buf.Write((uint)strBytes.Length);
227 | buf.Write(strBytes);
228 | if (strBytes.Length % 4 != 0) {
229 | buf.Write(new byte[4 - (strBytes.Length % 4)]);
230 | }
231 | }
232 |
233 | public IGdStructure Deserialize(BinaryReader buf) {
234 | uint len = buf.ReadUInt32();
235 | uint padding = 0;
236 | if (len % 4 != 0) {
237 | padding = 4 - (len % 4);
238 | }
239 |
240 | byte[] strBytes = buf.ReadBytes((int)len);
241 | Value = Encoding.UTF8.GetString(strBytes);
242 |
243 | buf.ReadBytes((int)padding);
244 |
245 | return this;
246 | }
247 |
248 | public override string ToString() {
249 | return "\"" +
250 | Value
251 | .Replace("\\", "\\\\")
252 | .Replace("\n", "\\n")
253 | .Replace("\r", "\\r")
254 | .Replace("\t", "\\t")
255 | .Replace("\f", "\\f")
256 | .Replace("\v", "\\v")
257 | .Replace("\a", "\\a")
258 | .Replace("\b", "\\b")
259 | .Replace("\"", "\\\"")
260 | + "\"";
261 | }
262 |
263 | public override bool Equals(object obj) {
264 | if (obj is GdcString o) {
265 | return o.Value == Value;
266 | }
267 | return false;
268 | }
269 |
270 | public override int GetHashCode() {
271 | return Value.GetHashCode();
272 | }
273 | }
274 |
275 | public class Vector2 : IGdStructure {
276 | public float X;
277 | public float Y;
278 |
279 | public IGdStructure Deserialize(BinaryReader reader) {
280 | X = reader.ReadSingle();
281 | Y = reader.ReadSingle();
282 | return this;
283 | }
284 |
285 | public void Serialize(BinaryWriter buf, BytecodeProvider provider) {
286 | buf.Write(provider.TypeNameProvider.GetTypeId("Vector2"));
287 | SerializeRaw(buf);
288 | }
289 |
290 | internal void SerializeRaw(BinaryWriter buf) {
291 | buf.Write(X);
292 | buf.Write(Y);
293 | }
294 |
295 | public override string ToString() {
296 | return "Vector2(" + X + ", " + Y + ")";
297 | }
298 |
299 | public override bool Equals(object obj) {
300 | if (obj is Vector2 o) {
301 | return o.X == X && o.Y == Y;
302 | }
303 | return false;
304 | }
305 |
306 | public override int GetHashCode() {
307 | return HashCode.Combine(X, Y);
308 | }
309 | }
310 |
311 | public class Rect2 : IGdStructure {
312 | public Vector2 Position;
313 | public Vector2 Size;
314 |
315 | public IGdStructure Deserialize(BinaryReader reader) {
316 | Position = (Vector2)new Vector2().Deserialize(reader);
317 | Size = (Vector2)new Vector2().Deserialize(reader);
318 | return this;
319 | }
320 |
321 | public void Serialize(BinaryWriter buf, BytecodeProvider provider) {
322 | buf.Write(provider.TypeNameProvider.GetTypeId("Rect2"));
323 | Position.SerializeRaw(buf);
324 | Size.SerializeRaw(buf);
325 | }
326 |
327 | public override string ToString() {
328 | return "Rect2(" + Position.X + ", " + Position.Y + ", " + Size.X + ", " + Size.Y + ")";
329 | }
330 |
331 | public override bool Equals(object obj) {
332 | if (obj is Rect2 o) {
333 | return o.Position.Equals(Position) && o.Size.Equals(Size);
334 | }
335 | return false;
336 | }
337 |
338 | public override int GetHashCode() {
339 | return HashCode.Combine(Position, Size);
340 | }
341 | }
342 |
343 | public class Vector3 : IGdStructure {
344 | public float X;
345 | public float Y;
346 | public float Z;
347 |
348 | public IGdStructure Deserialize(BinaryReader reader) {
349 | X = reader.ReadSingle();
350 | Y = reader.ReadSingle();
351 | Z = reader.ReadSingle();
352 | return this;
353 | }
354 |
355 | public void Serialize(BinaryWriter buf, BytecodeProvider provider) {
356 | buf.Write(provider.TypeNameProvider.GetTypeId("Vector3"));
357 | SerializeRaw(buf);
358 | }
359 |
360 | internal void SerializeRaw(BinaryWriter buf) {
361 | buf.Write(X);
362 | buf.Write(Y);
363 | buf.Write(Z);
364 | }
365 |
366 | public override string ToString() {
367 | return "Vector3(" + X + ", " + Y + ", " + Z + ")";
368 | }
369 |
370 | public override bool Equals(object obj) {
371 | if (obj is Vector3 o) {
372 | return o.X == X && o.Y == Y && o.Z == Z;
373 | }
374 | return false;
375 | }
376 |
377 | public override int GetHashCode() {
378 | return HashCode.Combine(X, Y, Z);
379 | }
380 | }
381 |
382 | public class Transform2d : IGdStructure {
383 | public Vector2 Origin;
384 | public Vector2 X;
385 | public Vector2 Y;
386 |
387 | public IGdStructure Deserialize(BinaryReader reader) {
388 | Origin = (Vector2)new Vector2().Deserialize(reader);
389 | X = (Vector2)new Vector2().Deserialize(reader);
390 | Y = (Vector2)new Vector2().Deserialize(reader);
391 | return this;
392 | }
393 |
394 | public void Serialize(BinaryWriter buf, BytecodeProvider provider) {
395 | buf.Write(provider.TypeNameProvider.GetTypeId("Transform2D"));
396 | Origin.SerializeRaw(buf);
397 | X.SerializeRaw(buf);
398 | Y.SerializeRaw(buf);
399 | }
400 |
401 | public override string ToString() {
402 | return "Transform2D(" + X + ", " + Y + ", " + Origin + ")";
403 | }
404 |
405 | public override bool Equals(object obj) {
406 | if (obj is Transform2d o) {
407 | return o.Origin.Equals(Origin) && o.X.Equals(X) && o.Y.Equals(Y);
408 | }
409 | return false;
410 | }
411 |
412 | public override int GetHashCode() {
413 | return HashCode.Combine(Origin, X, Y);
414 | }
415 | }
416 |
417 | public class Plane : IGdStructure {
418 | public Vector3 Normal;
419 | public float D;
420 |
421 | public IGdStructure Deserialize(BinaryReader reader) {
422 | Normal = (Vector3)new Vector3().Deserialize(reader);
423 | D = reader.ReadSingle();
424 | return this;
425 | }
426 |
427 | public void Serialize(BinaryWriter buf, BytecodeProvider provider) {
428 | buf.Write(provider.TypeNameProvider.GetTypeId("Plane"));
429 | Normal.SerializeRaw(buf);
430 | buf.Write(D);
431 | }
432 |
433 | public override string ToString() {
434 | return "Plane(" + Normal + ", " + D + ")";
435 | }
436 |
437 | public override bool Equals(object obj) {
438 | if (obj is Plane o) {
439 | return o.Normal.Equals(Normal) && o.D == D;
440 | }
441 | return false;
442 | }
443 |
444 | public override int GetHashCode() {
445 | return HashCode.Combine(Normal, D);
446 | }
447 | }
448 |
449 | public class Quat : IGdStructure {
450 | public float X;
451 | public float Y;
452 | public float Z;
453 | public float W;
454 |
455 | public IGdStructure Deserialize(BinaryReader reader) {
456 | X = reader.ReadSingle();
457 | Y = reader.ReadSingle();
458 | Z = reader.ReadSingle();
459 | W = reader.ReadSingle();
460 | return this;
461 | }
462 |
463 | public void Serialize(BinaryWriter buf, BytecodeProvider provider) {
464 | buf.Write(provider.TypeNameProvider.GetTypeId("Quat"));
465 | buf.Write(X);
466 | buf.Write(Y);
467 | buf.Write(Z);
468 | buf.Write(W);
469 | }
470 |
471 | public override string ToString() {
472 | return "Quat(" + X + ", " + Y + ", " + Z + ", " + W + ")";
473 | }
474 |
475 | public override bool Equals(object obj) {
476 | if (obj is Quat o) {
477 | return o.X == X && o.Y == Y && o.Z == Z && o.W == W;
478 | }
479 | return false;
480 | }
481 |
482 | public override int GetHashCode() {
483 | return HashCode.Combine(X, Y, Z, W);
484 | }
485 | }
486 |
487 | public class Aabb : IGdStructure {
488 | public Vector3 Position;
489 | public Vector3 Size;
490 |
491 | public IGdStructure Deserialize(BinaryReader reader) {
492 | Position = (Vector3)new Vector3().Deserialize(reader);
493 | Size = (Vector3)new Vector3().Deserialize(reader);
494 | return this;
495 | }
496 |
497 | public void Serialize(BinaryWriter buf, BytecodeProvider provider) {
498 | buf.Write(provider.TypeNameProvider.GetTypeId("AABB"));
499 | Position.SerializeRaw(buf);
500 | Size.SerializeRaw(buf);
501 | }
502 |
503 | public override string ToString() {
504 | return "AABB(" + Position + ", " + Size + ")";
505 | }
506 |
507 | public override bool Equals(object obj) {
508 | if (obj is Aabb o) {
509 | return o.Position.Equals(Position) && o.Size.Equals(Size);
510 | }
511 | return false;
512 | }
513 |
514 | public override int GetHashCode() {
515 | return HashCode.Combine(Position, Size);
516 | }
517 | }
518 |
519 | public class Basis : IGdStructure {
520 | public Vector3 X;
521 | public Vector3 Y;
522 | public Vector3 Z;
523 |
524 | public IGdStructure Deserialize(BinaryReader reader) {
525 | X = (Vector3)new Vector3().Deserialize(reader);
526 | Y = (Vector3)new Vector3().Deserialize(reader);
527 | Z = (Vector3)new Vector3().Deserialize(reader);
528 | return this;
529 | }
530 |
531 | public void Serialize(BinaryWriter buf, BytecodeProvider provider) {
532 | buf.Write(provider.TypeNameProvider.GetTypeId("Basis"));
533 | SerializeRaw(buf);
534 | }
535 |
536 | internal void SerializeRaw(BinaryWriter buf) {
537 | X.SerializeRaw(buf);
538 | Y.SerializeRaw(buf);
539 | Z.SerializeRaw(buf);
540 | }
541 |
542 | public override string ToString() {
543 | return "Basis(" + X + ", " + Y + ", " + Z + ")";
544 | }
545 |
546 | public override bool Equals(object obj) {
547 | if (obj is Basis o) {
548 | return o.X.Equals(X) && o.Y.Equals(Y) && o.Z.Equals(Z);
549 | }
550 | return false;
551 | }
552 |
553 | public override int GetHashCode() {
554 | return HashCode.Combine(X, Y, Z);
555 | }
556 | }
557 |
558 | public class Transform : IGdStructure {
559 | public Basis Basis;
560 | public Vector3 Origin;
561 |
562 | public IGdStructure Deserialize(BinaryReader reader) {
563 | Basis = (Basis)new Basis().Deserialize(reader);
564 | Origin = (Vector3)new Vector3().Deserialize(reader);
565 | return this;
566 | }
567 |
568 | public void Serialize(BinaryWriter buf, BytecodeProvider provider) {
569 | buf.Write(provider.TypeNameProvider.GetTypeId("Transform"));
570 | Basis.SerializeRaw(buf);
571 | Origin.SerializeRaw(buf);
572 | }
573 |
574 | public override string ToString() {
575 | return "Transform(" + Basis + ", " + Origin + ")";
576 | }
577 |
578 | public override bool Equals(object obj) {
579 | if (obj is Transform o) {
580 | return o.Basis.Equals(Basis) && o.Origin.Equals(Origin);
581 | }
582 | return false;
583 | }
584 |
585 | public override int GetHashCode() {
586 | return HashCode.Combine(Basis, Origin);
587 | }
588 | }
589 |
590 | public class Color : IGdStructure {
591 | public float R;
592 | public float G;
593 | public float B;
594 | public float A;
595 |
596 | public IGdStructure Deserialize(BinaryReader reader) {
597 | R = reader.ReadSingle();
598 | G = reader.ReadSingle();
599 | B = reader.ReadSingle();
600 | A = reader.ReadSingle();
601 | return this;
602 | }
603 |
604 | public void Serialize(BinaryWriter buf, BytecodeProvider provider) {
605 | buf.Write(provider.TypeNameProvider.GetTypeId("Color"));
606 | buf.Write(R);
607 | buf.Write(G);
608 | buf.Write(B);
609 | buf.Write(A);
610 | }
611 |
612 | public override string ToString() {
613 | return "Color(" + R + ", " + G + ", " + B + ", " + A + ")";
614 | }
615 |
616 | public override bool Equals(object obj) {
617 | if (obj is Color o) {
618 | return o.R == R && o.G == G && o.B == B && o.A == A;
619 | }
620 | return false;
621 | }
622 |
623 | public override int GetHashCode() {
624 | return HashCode.Combine(R, G, B, A);
625 | }
626 | }
627 | }
628 |
--------------------------------------------------------------------------------