Repository navigation
feat: sltool dte decompile writes a mission as Luau source - #1131
Merged
Merged
Conversation
Mission source starts with reading missions as text: each record a global declaration named after its display name, the script as Luau statements, and the game's values by the names the scripting API gives them, from the same tables the game runs on. docs/formats/mission-source.md specifies the form. The source leaves out what the game works out again and parks what it never reads, such as the operand tables: mission_build_part_tables hands their entry to mission_fill_part, which pops it unread. Every shipped mission decompiles; building the text again comes next. Closes #1130
names.Word holds the words mission source gives itself, its constructors, functions, index forms and the opcodes written as calls, so the writers print them typed and the parser to come reads the same list. One infix table gives each operator's symbol and binding, the writer shares one list helper, and the listing asks the vocabulary for a parameter directly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The second step of the text path in #1126:
sltool dte decompile <mission>writes a mission as Luau source, and docs/formats/mission-source.md specifies the form.source/vocabulary.zig). A value the game doesn't name, such as a mod's, stays a number. A trigger's function names its event's values after the condition catalogue's labels, such ashull_damage.mission_build_part_tableshands their entry tomission_fill_part, which pops it unread. It is documented in dte.md and annotated in Ghidra's names table, withmission_fill_part's third argument.All 44 shipped missions decompile. Building the text again, and the round trip to the same mission, come with
sltool dte build, the next step.It is about 1550 lines, half of them the specification and tests. The records, the script text and the names are only useful together.
Closes #1130