Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot decode UTexture2D #13

Closed
TheNaeem opened this issue Sep 2, 2021 · 13 comments
Closed

Cannot decode UTexture2D #13

TheNaeem opened this issue Sep 2, 2021 · 13 comments

Comments

@TheNaeem
Copy link

TheNaeem commented Sep 2, 2021

Hello, I'm trying to export a texture icon as UTexture2D, and when calling Decode() it throws this exception:
System.ArgumentNullException: Value cannot be null. (Parameter 'source') at System.Linq.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument) at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable 1 source, Func 2 predicate, Boolean& found) at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable 1 source, Func 2 predicate)

The exception is thrown at line 113 of UTexture2D.cs

And this is how I'm loading the texture:

var texture = provider.LoadObject(@"FortniteGame/Content/UI/Foundation/Textures/Icons/Backpacks/T-Icon-Backpacks-773-Carabus-L");

var image = texture.Decode();

Thank you, I hope I was able to be descriptive on my issue, and hopefully it's just me doing something wrong.

@4sval
Copy link
Collaborator

4sval commented Sep 2, 2021

what's the full code

@TheNaeem
Copy link
Author

TheNaeem commented Sep 2, 2021

error is fixed now but thank you anyways :)

@TheNaeem TheNaeem closed this as completed Sep 2, 2021
@TheNaeem
Copy link
Author

TheNaeem commented Sep 3, 2021

The issue is happening again after verifying my game files, here is the full code:

var provider = new DefaultFileProvider(@"C:\Program Files\Epic Games\Fortnite\FortniteGame\Content\Paks", SearchOption.TopDirectoryOnly, true);
                provider.Initialize();

                var guid = new FGuid("00000000000000000000000000000000");
                var aes = new FAesKey("3FE5C589D219E71EE15FEB8FA9BC6B6224BB58AA826A0FA1D997D92E0D8DB23A");
                provider.SubmitKey(guid, aes);
                var texture = provider.LoadObject<UTexture2D>(@"/Game/UI/Foundation/Textures/Icons/Backpacks/T-Icon-Backpacks-773-Carabus-L"); //error throws on this line

@4sval
Copy link
Collaborator

4sval commented Sep 3, 2021

provider.LoadMappings() after submitkey

@TheNaeem
Copy link
Author

TheNaeem commented Sep 3, 2021

the exception still gets thrown

@4sval 4sval reopened this Sep 3, 2021
@4sval
Copy link
Collaborator

4sval commented Sep 4, 2021

I just tested it and there's absolutely no issue if you do everything right
initialize the provider, submit keys, load mappings, load object

@TheNaeem
Copy link
Author

TheNaeem commented Sep 4, 2021

Did I do everything correctly in the code I provided above? I'm really not sure what else there is to do. Is your working code different than mine?

@TheNaeem
Copy link
Author

TheNaeem commented Sep 4, 2021

Also, you can't see it in the code snippet but as I mentioned earlier, the exception isn't thrown when the texture is loaded, it's thrown when I called the Decode method

@4sval
Copy link
Collaborator

4sval commented Sep 4, 2021

because you have no mappings

@TheNaeem
Copy link
Author

TheNaeem commented Sep 5, 2021

idk man, even with loading the mappings the exception still throws:

            var provider = new DefaultFileProvider(@"C:\Program Files\Epic Games\Fortnite\FortniteGame\Content\Paks", SearchOption.TopDirectoryOnly, true);
            provider.Initialize();
            provider.LoadMappings();

            var guid = new FGuid("00000000000000000000000000000000");
            var aes = new FAesKey("0x3FE5C589D219E71EE15FEB8FA9BC6B6224BB58AA826A0FA1D997D92E0D8DB23A");
            provider.SubmitKey(guid, aes);
            var texture = provider.LoadObject<UTexture2D>(@"/Game/UI/Foundation/Textures/Icons/Backpacks/T-Icon-Backpacks-773-Carabus-L");
            texture.Decode();

@4sval
Copy link
Collaborator

4sval commented Sep 5, 2021

provider.LoadMappings() after submitkey

...

@4sval 4sval closed this as completed Sep 5, 2021
@TheNaeem
Copy link
Author

TheNaeem commented Sep 5, 2021

still throws even if i put it after submitkey lol

@4sval
Copy link
Collaborator

4sval commented Sep 5, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants