EliotVU / Unreal-Library

UnrealScript decompiler library for Unreal package files (.upk, .u, .uasset; etc), with support for Unreal Engine 1, 2, and 3
MIT License
367 stars 86 forks source link

[Bug] Optional parameter default values are not deserialized properly #37

Closed Eideren closed 2 years ago

Eideren commented 3 years ago

The default value is interpreted as part of the method body instead of as part of the function signature. I.E. it outputs

function F( float fParam )
{
    fParam = 0;

While the source is:

function F( float fParam = 0 )
{

To fix this issue you would have to read the start of that function's bytecode, each optional parameter has a corresponding DefaultParameterToken or NothingToken, decompile those inline to the parameter declaration and, when deserializing the function body, skip past those and you are done. I don't need to fix this issue so I won't do a PR for this one either, sorry.

EliotVU commented 2 years ago

Thanks! I have just pushed a fix for this issue.