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
356 stars 85 forks source link

Buggy defaultproperties for stripped Killing Floor 1 packages #40

Open Shtoyan opened 3 years ago

Shtoyan commented 3 years ago

I know this is a bit difficult to fix, but it takes too much time to manually do batchexport stripped pckages just for defaultproperties blocks, then compare and copy-paste them to UE Lib exported classes. Most of the time defaultproperties are fine, but in some cases your decompiler fails to show array contents / prints wrong subobject name.

Example 1, weapon class:

 // Stripped
// Decompiled with UE Explorer.
defaultproperties
{
  FireModeClass=class'W_AK47Fire'
  PickupClass=class'W_AK47Pickup'
}

This will compile fine and run, until you crash when try to shoot, since FireModeClass is a static array and code should be.

FireModeClass(0)=class'W_AK47Fire'

Or, example 2, GUIBuyMenu / UT2k4MainPage classes :

 // Stripped
// Decompiled with UE Explorer.
defaultproperties
{
  PanelClass=/* Array type was not detected. */
}

should be:

PanelClass(0)="CsHDMut.GUI_BuyMenuTab"

And a subobject ,example 3:

 // Stripped
// Decompiled with UE Explorer.
defaultproperties
{
  begin object name=InventoryBox class=GUI_BuyMenuInvListBox
    OnCreateComponent=InternalOnCreateComponent
    WinTop=0.0708410
    WinLeft=0.0001080
    WinWidth=0.3282040
    WinHeight=0.5218560
  object end
  // Reference: GUI_BuyMenuInvListBox'GUI_BuyMenuTab.InventoryBox'
  InvSelect=InventoryBox
  begin object name=SaleBox class=GUI_BuyMenuSaleListBox
    OnCreateComponent=InternalOnCreateComponent
    WinTop=0.0643120
    WinLeft=0.6726320
    WinWidth=0.3258570
    WinHeight=0.6740390
  object end
  // Reference: GUI_BuyMenuSaleListBox'GUI_BuyMenuTab.SaleBox'
  SaleSelect=SaleBox
}

Where OnCreateComponent, SaleSelect should have names from commented section.

EliotVU commented 3 years ago

Thanks for reporting this issue. Unfortunately both those issues are blocked by the lack of linking packages that are listed as "imports" within the particular package.

i.e. whether FireModeClass is an array or not cannot be determined without looking up the property in the importable packages, unless more than one element is being assigned. Although it should be possible to address this issue in certain circumstances

PanelClass Same issue, but this can be resolved manually by configuring predefined property types. Check options in UE Explorer.

OnCreateComponent Can you clarify this issue? I'm not sure what you mean by the "commented section"

Shtoyan commented 3 years ago

Thanks for reporting this issue. Unfortunately both those issues are blocked by the lack of linking packages that are listed as "imports" within the particular package.

Ehh, gotcha. It adds 1-2 steps of class checking, but not a big deal.

OnCreateComponent Can you clarify this issue? I'm not sure what you mean by the "commented section"

Your decompiler prints this.

  begin object name=SaleBox class=GUI_BuyMenuSaleListBox
    OnCreateComponent=InternalOnCreateComponent
    ....
  object end
  // Reference: GUI_BuyMenuSaleListBox'GUI_BuyMenuTab.SaleBox'
  SaleSelect=SaleBox

Real code is:

Begin Object Class=GUI_BuyMenuSaleListBox Name=SaleBox
    OnCreateComponent=SaleBox.InternalOnCreateComponent
    ....
  End Object
  SaleSelect=GUI_BuyMenuSaleListBox'CsHDMut.GUI_BuyMenuTab.SaleBox'

I guess it's the same issue, so nvm.