TheNaeem / UnrealMappingsDumper

A dumper that generates mappings (.usmap) files for datamining Unreal Engine games.
MIT License
137 stars 18 forks source link

UE 5.1 Release support #9

Closed Kein closed 1 year ago

Kein commented 1 year ago

I'm getting a hard crash after injection and I'm unable to get any debug info because it seems to be inside engine code (that, or Visual Studio debugger being shit again).

TheNaeem commented 1 year ago

Compile it in debug mode and attach to your game. Inject the compiled DLL and send where it crashes and the call stack

Kein commented 1 year ago

That is what I did.

TheNaeem commented 1 year ago

Can you send it?

Kein commented 1 year ago

I'm unable to get any debug info because it seems to be inside engine code (that, or Visual Studio debugger being shit again).

TheNaeem commented 1 year ago

You can still get the line it crashes on from the call stack. If you can't, just step through it line by line until it crashes and see where it happens

Kein commented 1 year ago

Nope, it simply does not work, it just segfaults without any break as if no debugger attached. I managed to get a break in Rider, but its output is hard to read. Looks like it fails at DefaultEngine<T>::UObject::GetPathName(std::wstring& Result, UObject* StopOuter) in engine.cpp:41: Result += NamePrivate.AsString(); ComparisonIndex and Number seem valid for FName: 117768197 and 87832 The final crash is inside Engine code: image

Full stack:

[Inlined] FName::ToString(FString &) UnrealNames.cpp:3399
FName::ToString() UnrealNames.cpp:3371
FNameBase::AsString() engine.cpp:9
DefaultEngine<UObjectDependency>::UObject::GetPathName(std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> > &,DefaultEngine<UObjectDependency>::UObject *) engine.cpp:41
DefaultEngine<UObjectDependency>::UObject::GetPath() engine.h:75
DefaultEngine<UObjectDependency>::FindObject<DefaultEngine<UObjectDependency>::UClass>(basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >) engine.h:39
DefaultEngine<UObjectDependency>::UClass::StaticClass() engine.h:393
`Dumper<Engine_UE5>::Run'::`2'::<lambda_2>::operator()(DefaultEngine<UObjectDependency>::UObject *&) dumper.cpp:130
std::invoke<`Dumper<Engine_UE5>::Run'::`2'::<lambda_2> &,DefaultEngine<UObjectDependency>::UObject * &>(<lambda_2> &,DefaultEngine<UObjectDependency>::UObject *&) type_traits:1534
std::_Invoker_ret<void,1>::_Call<`Dumper<Engine_UE5>::Run'::`2'::<lambda_2> &,DefaultEngine<UObjectDependency>::UObject * &>(<lambda_2> &,DefaultEngine<UObjectDependency>::UObject *&) functional:651
std::_Func_impl_no_alloc<`Dumper<Engine_UE5>::Run'::`2'::<lambda_2>,void,DefaultEngine<UObjectDependency>::UObject * &>::_Do_call(DefaultEngine<UObjectDependency>::UObject *&) functional:822
std::_Func_class<void,DefaultEngine<UObjectDependency>::UObject * &>::operator()(DefaultEngine<UObjectDependency>::UObject *&) functional:869
DefaultEngine<UObjectDependency>::ObjObjects::ForEach(function<void __cdecl(DefaultEngine<UObjectDependency>::UObject * &)>) engine.cpp:204
Dumper<Engine_UE5>::Run(ECompressionMethod) dumper.cpp:128
Main(HINSTANCE__ *) dllmain.cpp:40
<unknown> 0x00007ffb6c937034
<unknown> 0x00007ffb6e922651
TheNaeem commented 1 year ago

What game is this for?

Kein commented 1 year ago

No game, 5.1 vanilla build, I've just compiled UnrealGame target

TheNaeem commented 1 year ago

I'm currently on vacation so I can't do much to help but the problem is very likely to be the patterns of GObjects and/or FNameToString

I recommend reversing them yourself if you can, and override the addresses. Unfortunately someone pushed some faulty patterns for them recently and that commit will be reverted soon

Kein commented 1 year ago

If FNameToString is invalid pattern then how come it ended up in UE's FName::ToString in the end? What do you mean by reversing.

TheNaeem commented 1 year ago

There's nothing to indicate that it ended up in UE's fnametostring. If you look at the code of the dumper it calls the function pointer which points to what should be fnametostring, but if it isn't fnametostring it would be invalid

And if you don't know what I mean by reversing then don't worry about it. Like I said I'm not gonna be home for like another week but if you send a link to download the exe of ur game, I can see what I can do

Kein commented 1 year ago

There's nothing to indicate that it ended up in UE's fnametostring.

What do you mean there is nothing? Callstack?

FName::ToString() UnrealNames.cpp:3371
FNameBase::AsString() engine.cpp:9

if this does not indicate FNAME:ToString pattern was correct then what else? Which patterns the tool is looking for? Where they are defined?

TheNaeem commented 1 year ago

🤦‍♂️🤦‍♂️🤦‍♂️ that's the FNameToString wrapper in my code. It just calls UE's FNameToString, but we don't know that it actually did fall UE's FNameToString cause the address could be wrong

There's a big difference between dumper code and engine code. I recommend actually reading that code to see what's happening

Kein commented 1 year ago

that's the FNameToString wrapper in my code. It just calls UE's FNameToString, but we don't know that it actually did fall UE's FNameToString

Literally in my callstack posted above where break is being triggered inside Engine code: [Inlined] FName::ToString(FString &) UnrealNames.cpp:3399

TheNaeem commented 1 year ago

Can you provide a link to download the games exe. The problem is likely GObjects

Kein commented 1 year ago

https://www58.zippyshare.com/v/vL7TE779/file.html

TheNaeem commented 1 year ago

Thanks. I'll have a look at it when I can but no guarantees it will be quick, I'm pretty busy.