don't click here

IDA question - "Sorry, cannot change argument type. Please edit the function prototype instead."

Discussion in 'Technical Discussion' started by Travelsonic, Dec 19, 2024.

  1. Travelsonic

    Travelsonic

    Member
    833
    22
    18
    So I decided to pick up reverse engineering Dance Dance Revolution games again, and continue work on a disassembly of 7thMIX C/S (DDRMAX2 -DanceDanceRevolution 7thMIX-).

    I am looking in the pseudocode view at a function whose call involves a value for one of the parameters that is in hexadecimal, representing a 64-bit integer, but whose hexadecimal pattern matches the representation of a double.

    I want to check to be sure that changing it to a double is valid (converting the value from a 64-bit integer to a double yields a value that makes sense).

    Problem is, when I try to change the type of the parameter in the function being called from a 64-bit int to a double, I keep getting the error "Sorry, cannot change argument type. Please edit the function prototype instead."

    It has been a long while, so my brain is probably derping, but how do you go about doing this properly? I'd swear I used to know how to do this, but it's probably been long enough where I can safely say I'd be buggered if I can remember.
     
  2. Clownacy

    Clownacy

    Tech Member
    1,127
    769
    93
    It's been a long time since I used IDA, but I recall needing to click on the function's name and then press 'y'. I could then change the types of the function parameters in the pop-up menu.
     
  3. BenoitRen

    BenoitRen

    Tech Member
    885
    528
    93
    Are you disassembling the PS2 version? If so, Ghidra with the PS2 plug-in is better suited for this job.
     
  4. Travelsonic

    Travelsonic

    Member
    833
    22
    18
    That did it. Damn, I feel slow, that did it.

    Now, is there any way to properly display doubles as function arguments - instead of as hex strings?
    For example, instead of:
    Code (Text):
    1.     v14 = sub_120868(0x4032800000000000LL, v12);
    ... which it still displays as even after changing parameter type from __int64 to double, have it display as:
    Code (Text):
    1.     v14 = sub_120868(18.5, v12);
    ?

    NGL I am doing disassembly stuff in both IDA AND Ghidra (odd as it seems).

    I like pretty much everything about Ghidra (minus that neither Ghidra nor IDA seem, IIRC, to support Dwarf 1.0 format debugging data ... I Think?) - the way decompiler outputs are handled in Ghidra, though, piss me off. By that, I mean the tendency for very, VERY liberal use of the comma operator which interestingly? Oddly?) makes the output harder to read. Seems like IDA, while not COMPLETELY free of this tendency, is a HELL of a lot better in that regard.
     
    Last edited by a moderator: Dec 20, 2024
  5. Clownacy

    Clownacy

    Tech Member
    1,127
    769
    93
    Does re-decompiling the function with F5 help? I think IDA caches the old incorrect version until you explicitly tell it to refresh.
     
  6. BenoitRen

    BenoitRen

    Tech Member
    885
    528
    93
    Yes, Ghidra's decompiler really loves the comma operator. It also loves to flip if else blocks. While that's annoying, the decompiler's output should only be used to support your reading of the assembly.
     
  7. Travelsonic

    Travelsonic

    Member
    833
    22
    18
    Which makes these things even more annoying - since that makes it harder to do that - just read and interpret it, I mean.

    Luckily my suggestion of changing the comma operator thing to be optional is in the "in tirage" stage, hopefully that will mean eventually it will happen.

    __________________________________________________________________

    Damn it, I wish both Ghidra, and IDA, supported Dwarf 1.0 format debugging data out of the box, though - since the PS2 DDR games before the retail release of DDR EXTREME 2 have it... mostly. DDRMAX -DanceDanceRevolution 6thMIX- is the lone exception, with it only having CodeWarrior GCC wrapper function debugging data in there.

    I say "retail release of DDR EXTREME 2" because the 2005-06-22 prototype that is out there has lots of debugging data - as opposed to later demo disc previews I've found, where it had been stripped out.
     
    Last edited: Dec 20, 2024
  8. Devon

    Devon

    La mer va embrassé moi et délivré moi lakay. Tech Member
    1,515
    1,863
    93
    your mom
    Funny enough, the Gems Collection version of Sonic CD (which is based on the 90s PC port) suffers from the same sort of issue. The retail version still has all the debugging data, but a good chunk of it would not be detected by IDA or Ghidra, so I had to track down the CodeWarrior linker to actually extract all the data.
     
    • Like Like x 2
    • Informative Informative x 1
    • List
  9. Brainulator

    Brainulator

    Regular garden-variety member Member