Skip to content

Explore Command Line Enhancements #14

Closed

Description

@OrionSR

The current objective is to automate the process of updating opcode.txt. Sanny would need to:
Compile using a specific edit mode (working)
Decompile with an updated edit mode
Make opcode.txt from the output file
Use a settings.ini specific to this task

The command line process doesn't work well when Sanny is already running. I usually make a duplicate of the exe (Sanny3) to manage batch processing. Perhaps a compact experimental command line only compiler might be more appropriate for these tasks. A different tool could use a different settings.ini and games.xml and be independent of Sanny's current configuration, but still operate from the same program directory.

Activity

  1. x87 commented on Feb 8, 2020

    @x87
    Collaborator

    Decoupling the disassembler and the compiler from the IDE is one of the primary goals for the next major version (4.0?). I'd been making a few attempts in the past but they are far from completion.

    Would it help in the interim if there is a new CLI option in addition to the existing \decompile one to also produce a new opcode.txt file? Something like:

    sanny.exe -d test.scm --update-opcodes-txt

    (note that I would like also to switch from backward slashes for CLI options to the more conventional dashes)

  2. added
    discussion
    on Feb 8, 2020
  3. OrionSR commented on Feb 8, 2020

    @OrionSR
    Author

    Yes, but... It would also help to document the \decompile option under About Sanny Builder.

    An update option would avoid issues of deleting temp files when all I need is the opcode.txt.
    How about? sanny.exe -u path1\test.txt -oldmode path2\opcodes-txt -newmode

  4. x87 commented on Feb 12, 2020

    @x87
    Collaborator

    Make opcodes.txt itself is a very straightforward tool and it can be extracted into an external CLI application. Then you can write a simple shell script that will decompile a source script with Sanny Builder (another option is needed to specify an edit mode to use during this task) and then invoke Make opcodes.txt on the generated source.

    #!/usr/bin/env sh
    
    sanny.exe -d input.scm -e sa_scr -o output.txt
    make_opcodes.exe output.txt
  5. OrionSR commented on Feb 13, 2020

    @OrionSR
    Author

    Let me re-phase the txt to txt conversion idea as I've complicated my update process by trying to add the proper use of constants in constant specific opcodes. I'm going to lose those constants in the update process.

    Related issues:

    • I'm using a specialized CustomVariable.ini to mantain variable names, and CustomLabels that are highly sensitive to changes in the variables used and number of objects,
    • Efforts to switch to SCR like formats are frustrated because without the $Version directive I can't mix and match my code from previous projects.
    • Custom comments and high-level constructs are lost with a compile/decompile conversion or update process.

    So... Wouldn't it be cool if Sanny could convert or update the commands and argument order in the selected text or whole script without messing with anything else? And given that new feature, it'd be pretty cool to use it from the CLI.

    I suspect there are all kinds of complications with this suggestion but I'm trying to think beyond the particular annoyances of my current project to something that would be useful to everyone.

    BTW, there is no easy setting to disable GXT comments like there is for most of the other options that add comment to the script text. Moving or renaming the file is kind of a brutal work around.

  6. x87 commented on Sep 20, 2020

    @x87
    Collaborator

    Make opcodes.txt itself is a very straightforward tool and it can be extracted into an external CLI application. Then you can write a simple shell script that will decompile a source script with Sanny Builder (another option is needed to specify an edit mode to use during this task) and then invoke Make opcodes.txt on the generated source.

    #!/usr/bin/env sh
    
    sanny.exe -d input.scm -e sa_scr -o output.txt
    make_opcodes.exe output.txt

    also should help with #43 as running an external app would have its own admin rights prompt separate from the rest of the app.

    there is no easy setting to disable GXT comments like there is for most of the other options that add comment to the script text. Moving or renaming the file is kind of a brutal work around.

    should now be possible with <text> entry in modes.xml. Omitting this entry would leave the disassembled file without GXT comments.

  7. OrionSR commented on Sep 20, 2020

    @OrionSR
    Author

    This opcode.txt business needs to be my next priority. When can an external make_opcode tool be available? Batch processing probably won't be a concern right away but I'm optimistic about the new CLI options and would like to test out the whole process.

    should now be possible with entry in modes.xml. Omitting this entry would leave the disassembled file without GXT comments

    Yeah, now that I've got my files arranged the way I want it should be a trivial matter to make a copy of a root edit mode and remove all the GXT entries. I was planning on using special label files to hold jump addresses constant anyway, and maybe special variables and data files too, so a special root mode seems like the ideal solution.

  8. x87 commented on Sep 21, 2020

    @x87
    Collaborator

    When can an external make_opcode tool be available?

    Try this one: https://sannybuilder.com/dev/make_opcodes.zip

    Run as:

    make_opcodes.exe input_file.txt > opcodes.txt
    
  9. x87 commented on Sep 26, 2020

    @x87
    Collaborator

    @OrionSR have you tried that tool yet? Any feedback?

    It does not fully match existing Sanny's behavior, as it completely ignores lines not having opcode prefix, but I figured this better suits that nature of the tool. Sanny is able to recognize keywords and classes and add them into the opcodes.txt, but for opcode search it might not be needed (there is Ctrl+Space for that matter).

  10. OrionSR commented on Sep 26, 2020

    @OrionSR
    Author

    No, sorry. I have not. I wasn't expecting the tool to be ready so quickly, or the GTA3 files to be so messed up. I'm a bit confused and worried about the functionality now though. This isn't a concern for development, I can manage the data manually easily enough.

    I was considering creating an alternate example text for RockStyle commands where no opcodes are necessary due to the complete keyword list. The script can be decompiled with Write Opcodes disabled, and I'm hoping make_opcodes will generate the same number of commands as if it was enabled. I'm a very long ways from working up a class base format with keywords for all other opcodes. Bit it sounds like this isn't going to work as I'd hoped.

  11. wmysterio commented on Oct 23, 2020

    @wmysterio

    Can make command in CLI where used concrete case converting text strings? By default compiler use the setting SB. For example:

    -string_case upper // or lower, as is
    

    It will help avoid the need to edit settings. Useful when need to use formatting text:

    0AD0: show_formatted_text_lowpriority "Text: %d" time 2000 1 // uppercase: INCORRECT FORMAT
    0AD0: show_formatted_text_lowpriority "Text: %d" time 2000 1 // lowercase: good format. But other text is always small
    0AD0: show_formatted_text_lowpriority "Text: %d" time 2000 1 // as is: GOOD
    

    Or is this feature already there?

  12. x87 commented on Oct 23, 2020

    @x87
    Collaborator

    @wmysterio good idea, definitely worth it 👍

  13. x87 commented on Nov 16, 2020

    @x87
    Collaborator

    I'm hoping make_opcodes will generate the same number of commands as if it was enabled

    I have created a separate repo for the make_opcodes rewrite. It now supports keywords and classes, and I'm planning to start using this tool in the next release.

    An external tool also has its own security configuration which in theory should help with UAC on Windows 10 when Sanny is not in admin mode.

  14. added this to the v3.7.0 milestone on Nov 16, 2020
  15. added
    type:feature
    priority:p3
    and removed
    discussion
    on Nov 30, 2020
  16. x87 commented on Nov 30, 2020

    @x87
    Collaborator

    After #74 it's unclear where to save the list of commands extracted from a source with multiple extensions. Each extension owns their own opcodes.txt.

    Short-term: overwrite default''s opcodes.txt
    Long-term: analyze commands and sort them by extensions. Make separate opcodes.txt for each extensions and save into appropriate locations. Requires providing extensions information (currently known as extensions.txt) into make_opcodes

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions