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
371 stars 87 forks source link

Killing Floor .u encrypted #41

Closed AnDumu closed 2 years ago

AnDumu commented 2 years ago

First of all, thank you so much for this tool, is awesome, I just wanna add few things I've seen.

There are a lot of "UnresolvedNativeFunction_" functions, but I have no problem with that, I search Unreal functions and I can realize it, if it is Canvas.UnresolvedNativeFunction_99(Caption, W, H) I realize it is StrLen.

And another is:

                    // End:0xC98
                    if(TotalAmmo > 0)
                    {
                        // End:0xE0F
                        MagCount = NativeFunctionToken(ArgumentOutOfRangeException);
                        // Failed to format nests!:System.ArgumentOutOfRangeException: El índice estaba fuera del intervalo. Debe ser un valor no negativo e inferior al tamaño de la colección.
Nombre del parámetro: index
   en System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
   en UELib.Core.UStruct.UByteCodeDecompiler.DecompileNests(Boolean outputAllRemainingNests)
   en UELib.Core.UStruct.UByteCodeDecompiler.Decompile()
                        // 15 & Type:If Position:3599
                        // Failed to format remaining nests!:System.ArgumentOutOfRangeException: El índice estaba fuera del intervalo. Debe ser un valor no negativo e inferior al tamaño de la colección.
Nombre del parámetro: index
   en System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
   en UELib.Core.UStruct.UByteCodeDecompiler.DecompileNests(Boolean outputAllRemainingNests)
   en UELib.Core.UStruct.UByteCodeDecompiler.Decompile()
                        // 15 & Type:If Position:3599
}

Regards

EliotVU commented 2 years ago

Thanks.

Have you tried changing the NativesTableList? (You can find that option in UE Explorer at the bottom right).

AnDumu commented 2 years ago

Yes, I have tried them all and I updated the DLL from your last project but stills the same, I can share you the .u if you wanna check it for reversing, btw, nice job doing that. (Y)

EliotVU commented 2 years ago

Ah that's unfortunate, I suspect that Killing Floor may perhaps have added new native functions to its classes.

I suggest generating a new NTL file; You can use the built-in NTL generator, in UE Explorer on the top left see Extra -> Extensions -> NTL Generator.

Proceed to add all .u packages using "Scan Packages" (bottom left), and click "Save Natives Table List". Restart the program, and configure UE Explorer to use your new NTL.

If that still fails, feel free to send me the relevant .u files.

AnDumu commented 2 years ago

I tried to do that, and it generates an exception, Core isn't an UnrealPackage!

Logs: https://pastebin.com/D4a5YzcZ

AnDumu commented 2 years ago

Here it is the folder with main .u (core, engine, etc) and the others that I was viewing all the uliunailt files, I was checking the uliunailtperks.u

https://drive.google.com/drive/folders/1QHZMY3oMqwZVbNUbM3kQbKfOUzT0Dj41?usp=sharing

EliotVU commented 2 years ago

Great, I built a NTL for you (I had to modify UE Explorer to make it recognize the KF file signature).

NativesTableList_KillingFloor.zip

Move that file to: %programfiles(x86)%\Eliot\UE Explorer\Native Tables However, this NTL causes some code to be decompiled incorrectly (invisible code), I am not sure what's causing this issue, it might be just a bug in the NTL generator.

EliotVU commented 2 years ago

p.s. I don't think the NTL file is the issue here for your decompilation error, on my end both the KF and UT2004 NTL decompile the code just fine. Perhaps bug only occurs on the latest released UE build.

EliotVU commented 2 years ago

Btw can you verify if this this release solves the issue for you?

(Copy and overwrite the Eliot.UELib.dll to your UE Explorer folder.

AnDumu commented 2 years ago

Hi,

well, I tried using the new dll, but it shows the same exception when I try to generate NTL.

I downloaded the Natives for KillingFloor and I changed it from the options Package Deserialization, but if I close that tab and re-open it, it changes to 'NatviesTableList_UDK_2011-08'.

When I always try to open the uliunailtperks.u or even core.u it shows up this message:

"This package has an unknown signature.

Are you sure you want to try to deserialize this package? Clicking Yes might lead to unexpected results!"

And it still appearing a lot of UnresolvedNativeFunction_## :(

AnDumu commented 2 years ago

A video showing it: https://youtu.be/0RmTxYtIYn0

EliotVU commented 2 years ago

Make sure to hit "Save" at the bottom right after changing the NTL, btw the UT2004 NTL worked just fine for KF.

AnDumu commented 2 years ago

Wow, I hadn't seen it, my fault, now it seems there are not more UnresolvedNativeFunctions :D, but I still cannot generate the NTL, beyond that you saved me! Thank you very much, if you wanna figure out why it is not working, you can give any kind of files or update to test it, I really don't know why I cannot generate it.

EliotVU commented 2 years ago

Glad it worked!

p.s. the changes I had made to make the NTL generator work are not part of the new release ;)

AnDumu commented 2 years ago

Pretty nice, it also fixed the bug I posted first in SRGUIBuyWeaponInfoPanel

MagCount = NativeFunctionToken(ArgumentOutOfRangeException);
                        // Failed to format nests!:System.ArgumentOutOfRangeException:

when checking TotalAmmo