Skip to content

Disassembler can't properly handle classes with variadic arguments #149

Closed

Description

@x87

When the IDE comes across an OPCODE that contains a function like REST / CALLBACK (XXXX=-1,[...]), the opcode class goes crazy. The IDE copies and pastes the last value entered in the opcode, until the 35 spaces it allows are completed.
That is to say that from this:

Memory.CallFunction(0@, 1@, 2@, 3@)

becomes this:

Memory.CallFunction(0@, 1@, 2@, 3@, 3@, 3@, 3@, 3@, 3@, 3@, 3@, 3@, 3@, 3@, 3@, 3@, 3@, 3@, 3@, 3@, 3@, 3@, 3@, 3@, 3@, 3@, 3@, 3@, 3@, 3@, 3@, 3@, 3@, 3@, 3@)

There are times when it does not copy the last value, but 2 values at the same time.
You could include a parameter like % r to represent a REST / CALLBACK and prevent that error

; example
CallFunction, 0AA5,0,0, ("address% i" "numParams% i" "pop% r")

Originally posted by @MatiDragon-YT in #66 (comment)

Activity

  1. added
    priority:p1
    type:bug
    on Jun 10, 2021
  2. added this to the v3.8.0 milestone on Jun 11, 2021
  3. x87 commented on Jun 13, 2021

    @x87
    CollaboratorAuthor
  4. x87 commented on Jun 23, 2021

    @x87
    CollaboratorAuthor

    @MatiDragon-YT Have you tried the new version? Do you still experience this issue?

  5. MatiDragon-YT commented on Jun 23, 2021

    @MatiDragon-YT
    Member

    @x87 you are the coolest magician I have ever seen :)

    I downloaded it yesterday and see the problem no longer exists.

  6. MatiDragon-YT commented on Jun 28, 2021

    @MatiDragon-YT
    Member

    @x87 I ran into some new problems wanting to make some classes decompile like this:

    0@ = Xx.XxxxXxxx(3@v, "%d + %d", 1@, 2@)

    and i got these results with these settings...

    XxxxXxxx,[XXXX,=,2,2,0],(...)   ->   Xx.XxxxXxxx(0@, 3@v, "%d+%d", 1@, 2@)
    XxxxXxxx,[XXXX,=,2,1,0],(...)   ->   0@ = Xx.XxxxXxxx(3@v, "%d+%d", 1@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@)
    XxxxXxxx,[XXXX,=,2,0,0],(...)   ->   0@ = Xx.XxxxXxxx(3@v, "%d+%d", 1@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@)

    I could also notice that the strings were being poorly compiled.
    Here is a fragment of code with which I was doing tests and the files of the SA mode that I have modified.
    sa.zip

    {$CLEO}
    const
    numParams = 0@
    stringVar = 3@v
    charSame = 0x3D { = }
    end
    nop
        repeat
            wait 0
        until Input.IsKeyPressed(VK.O)
        
        string_format stringVar = "%d * %d" 4 10  // 4 * 10
        
        if//                           (stringVar == "\d + \d")                 
            numParams = Text.ScanString(stringVar,   "%d + %d", 1@, 2@)
        then
            Text.PrintHelpString("Performing addition...")
            0A8E: numParams = 1@ + 2@
            wait 2000
            Text.PrintHelpFormatted("%d + %d %c %d", 1@, 2@, charSame, numParams)
        end
        if
            numParams = Text.ScanString(stringVar,  "%d * %d", 1@, 2@)
        then    
            Text.PrintHelpString("Performing multiplication...")
            0A90: numParams = 1@ * 2@
            wait 2000
            Text.PrintHelpFormatted("%d * %d %c %d", 1@, 2@, charSame, numParams)
        end
    terminate_this_custom_script
  7. reopened this on Jun 29, 2021
  8. x87 commented on Jul 1, 2021

    @x87
    CollaboratorAuthor

    @MatiDragon-YT

    I could also notice that the strings were being poorly compiled.

    can you clarify the issue? What is the compiler error?

  9. MatiDragon-YT commented on Jul 2, 2021

    @MatiDragon-YT
    Member

    @MatiDragon-YT

    I could also notice that the strings were being poorly compiled.

    can you clarify the issue? What is the compiler error?

    the values STRING.
    Are delete the White Spaces

  10. x87 commented on Jul 2, 2021

    @x87
    CollaboratorAuthor

    Sorry, I didn't get you. You mean the compiler stripped whitespaces from the string literal?

    What STRING is referred to?

  11. MatiDragon-YT commented on Jul 2, 2021

    @MatiDragon-YT
    Member

    Sorry, I didn't get you. You mean the compiler stripped whitespaces from the string literal?

    YES, YEEESSS..
    For example Text.ScanString & Text.PrintHelpFormatted

    Sorry... my English is getting a bit bad from studying other languages :(

  12. x87 commented on Jul 2, 2021

    @x87
    CollaboratorAuthor

    I think what you describe is this issue: #66

  13. x87 commented on Jul 24, 2021

    @x87
    CollaboratorAuthor

    @x87 I ran into some new problems wanting to make some classes decompile like this:

    0@ = Xx.XxxxXxxx(3@v, "%d + %d", 1@, 2@)

    and i got these results with these settings...

    XxxxXxxx,[XXXX,=,2,2,0],(...)   ->   Xx.XxxxXxxx(0@, 3@v, "%d+%d", 1@, 2@)
    XxxxXxxx,[XXXX,=,2,1,0],(...)   ->   0@ = Xx.XxxxXxxx(3@v, "%d+%d", 1@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@)
    XxxxXxxx,[XXXX,=,2,0,0],(...)   ->   0@ = Xx.XxxxXxxx(3@v, "%d+%d", 1@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@, 2@)

    this issue should be gone with v3.8.0-beta.0, please try

  14. MatiDragon-YT commented on Jul 24, 2021

    @MatiDragon-YT
    Member

    Sure enough, the error disappeared.

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