Skip to content

Support for code compiling#45

Merged
myst6re merged 13 commits intomyst6re:masterfrom
barkermn01:master
Mar 29, 2026
Merged

Support for code compiling#45
myst6re merged 13 commits intomyst6re:masterfrom
barkermn01:master

Conversation

@barkermn01
Copy link
Copy Markdown
Contributor

@barkermn01 barkermn01 commented Mar 27, 2026

Add compilable pseudo-code editor and script reference for the Scripts tab

The previously read-only "Pseudo-code" tab (now renamed "Code") is now a fully
editable scripting environment with a compiler that converts the C-style
pseudo-code back into JSM opcodes.

New features:

  • Pseudo-code compiler (JsmPseudoCompiler) supporting if/else/end, while/end, wait while, forever, repeat/until, assignments (=, +=, -=, etc.), function calls, expressions with full operator precedence, variable references (N_ubyte/uword/ulong/sbyte/sword/slong, temp_N, model_N), and named constants (character names, key names, text_N, map_N, etc.)
  • Script reference dialog (JsmHelpDialog) with searchable categorized documentation for all major opcodes, accessible via Help button or F1
  • Compile errors shown as message boxes with the cursor jumping to the error line
  • Unsaved changes warning when switching between Code and Instructions tabs
  • Dark mode aware syntax highlighting that auto-detects light/dark themes (and changes some colors in the text editor for this when in dark mode)
  • Proper cache invalidation so both tabs stay in sync after compiling
  • File modified flag set correctly so saves persist compiled changes

Files added:

  • src/JsmPseudoCompiler.h/.cpp
  • src/JsmHelpDialog.h/.cpp

Files modified:

  • src/widgets/JsmWidget.h/.cpp
  • src/files/JsmFile.h/.cpp
  • src/JsmHighlighter.h/.cpp
  • CMakeLists.txt

- Fix stack argument push order: args now pushed in forward order to match
  the decompiler's inverted stack convention, fixing parameter swapping
  (e.g. set3 args 1 and 3 were swapped)
- Fix tokenizer to treat numbers followed by underscore as variable
  identifiers (e.g. 474_ubyte was split into separate tokens)
- Fix inline parameter handling for all opcodes 0x00-0x38, not just REQ+
- Fix ret(N) to support inline parameter via function call syntax
- Expand help dialog from ~120 to ~170 opcodes across 20 categories
  including previously missing: sound, background, salary, last dungeon,
  tutorial, misc, and many individual opcodes
Comment thread src/JsmPseudoCompiler.cpp Outdated
Comment thread src/JsmPseudoCompiler.cpp Outdated
Comment thread src/widgets/JsmWidget.cpp
Comment thread src/JsmPseudoCompiler.cpp Outdated
Comment thread src/files/JsmFile.cpp
Comment thread src/JsmPseudoCompiler.cpp
Comment thread src/JsmPseudoCompiler.cpp
Comment thread src/JsmHelpDialog.cpp Outdated
Comment thread src/JsmHelpDialog.cpp Outdated
Comment thread src/JsmHelpDialog.cpp Outdated
Comment thread src/JsmHelpDialog.cpp Outdated
Comment thread src/JsmHelpDialog.cpp Outdated
Comment thread src/JsmHelpDialog.cpp
Comment thread src/JsmHelpDialog.cpp Outdated
@myst6re myst6re assigned myst6re and barkermn01 and unassigned myst6re Mar 28, 2026
@barkermn01
Copy link
Copy Markdown
Contributor Author

Added support for font-size on the code editors, (more accessibility friendly) also added support for command line argument --scale 1.0 is default so 1.2 is bigger 0.8 is smaller E.G deling.exe --scale 1.2 {path to file}, also updated the help window help stuff more.

@barkermn01
Copy link
Copy Markdown
Contributor Author

Deling-Release.zip
Latest Version

@myst6re
Copy link
Copy Markdown
Owner

myst6re commented Mar 29, 2026

Do you have another change to push before I merge the pr?

@barkermn01
Copy link
Copy Markdown
Contributor Author

not currently there might be other fixes but i will create a new PR for it

@myst6re myst6re merged commit 093405d into myst6re:master Mar 29, 2026
14 checks passed
@myst6re
Copy link
Copy Markdown
Owner

myst6re commented Mar 29, 2026

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants