Albeoris / Memoria.FFPR

MIT License
68 stars 5 forks source link

KB (FF6): Unable to import textures #23

Open Silvris opened 2 years ago

Silvris commented 2 years ago

Exactly as title states. Renaming the "Assets" folder allows the game to progress, so something must be going wrong in the import process.

Silvris commented 2 years ago

Serial/Res/Chara, willing to bet it's a SpriteAtlas issue.

palladin9479 commented 2 years ago

When I had the unity log redirected it kept complaining about some asset not available, had to disable Memoria to get the game to start up.

faospark commented 2 years ago

i think this is related to this. Exporting is also basically on a loop. it wont change export to false after the export process

fallacies-GitHub commented 2 years ago

Export dies at 2201 / 2347 (93.779%), and the game crashes. A partial excerpt from the log is as follows:

[Info :Memoria IL2CPP] [Export (2201 / 2347)] Loaded 1 assets from [mt_ff6_147_c01] in 0.101207 sec. Exporting... [Info :Memoria IL2CPP] [Export (2201 / 2347)] Export [Thumbnail] Texture2D %StreamingAssets%\Assets/GameAssets/Serial/Res/UI/Common/Library/Thumbnail/MT_FF6_147_C00/Thumbnail [Error :Memoria IL2CPP] [Export] Failed to export assets: System.NotSupportedException: Not supported type [] of texture []. Path: [C:\Program Files (x86)\Steam\steamapps\common\FINAL FANTASY VI PR\FINAL FANTASY VI_Data\StreamingAssets\Assets/GameAssets/Serial/Res/UI/Common/Library/Thumbnail/MT_FF6_147_C00/Thumbnail] at Memoria.FFPR.Core.TextureHelper.WriteTextureToFile (UnityEngine.Texture2D texture, System.String outputPath) [0x0009b] in <14f7d536bd304c5092e4e64af714acab>:0 at Memoria.FFPR.IL2CPP.ResourceExporter.ExportTexture2D (System.String assetName, UnityEngine.Texture2D asset, System.String fullPath) [0x00143] in <14f7d536bd304c5092e4e64af714acab>:0 at Memoria.FFPR.IL2CPP.ResourceExporter.ExportAsset (Il2CppSystem.Object asset, System.String type, System.String assetName, System.String assetPath) [0x00288] in <14f7d536bd304c5092e4e64af714acab>:0 at Memoria.FFPR.IL2CPP.ResourceExporter.Update () [0x00490] in <14f7d536bd304c5092e4e64af714acab>:0 [Info :Memoria IL2CPP] [Export] Export stopped. [Info :Memoria IL2CPP] [ModComponent].OnDestroy()

The full log, if it's helpful: LogOutput.log

Attempting to restart the game after a crash results in another failed attempt to export assets, followed by a crash, After this, if ExportEnabled is manually set to false, the game is able to launch to the start menu.

This is the log from a launch of the game to the start menu subsequent to setting ExportEnabled to false: LogOutput.log

From the looks of it, the import process looks like it works? But a part of the log reads as follows:

[Warning:Memoria IL2CPP] [Import] Cannot import sprite by reference to not loaded atlas [Group: mo_ff6_n050_c00, Name: MO_FF6_N050_C00], referenced by [%StreamingAssets%\Assets/GameAssets/Serial/Res/Chara/Map/MO_FF6_N050_C00/Default_00.png.ini]. [Warning:Memoria IL2CPP] [Import] Cannot import sprite by reference to not loaded atlas [Group: mo_ff6_n050_c00, Name: MO_FF6_N050_C00], referenced by [%StreamingAssets%\Assets/GameAssets/Serial/Res/Chara/Map/MO_FF6_N050_C00/Fall_00.png.ini].

... followed by more of the same, before resuming with successful imports.

After launching the game and reaching the start menu, attempting to load an existing save file results in the game being stuck on Now Loading...

Incidentally, even though the game itself can launch, and you can successfully reach the start menu (even if save files fail to load), if you don't touch anything and simply let the opening play out, the game gets stuck on a black screen after the initial song concludes. It doesn't progress to the portion of the opening animation with the text introduction to the story over pans of backgrounds. The game becomes completely unresponsive, even though prior to this point, clicking the screen will load the start menu normally.

As suggested above, renaming the Assets folder results in a successful game launch, and a successful loading of the save file.

The log subsequent to renaming the folder is as follows: LogOutput.log

Albeoris commented 2 years ago

Something wrong with ImportTextures. Disable it to avoid the problem.

Albeoris commented 2 years ago

I think the problem is related to importing any character atlas, but there is an example with this one: \FINAL FANTASY VI_Data\StreamingAssets\Assets\GameAssets\Serial\Res\Chara\Map\MO_FF6_N050_C00\MO_FF6_N050_C00.spriteatlas

fallacies-GitHub commented 2 years ago

Loaded a fresh install of the game and Memoria, with ExportTextures and ImportTextures both set to false. The game closed on completion of export, and ExportAutoDisable worked as intended, setting ExportEnabled to false.

This is the log of the export: LogOutput_export.log

Not really familiar enough with modding to know what "Unhollower" means, but there's a block of warnings at the start:

[Info : BepInEx] Loading [Memoria FF PR 1.0.0] [Message:Memoria FF PR] Initializing... [Info :Memoria FF PR] Registering assembly types... [Warning:Unhollower] Method Memoria.FFPR.Configuration.Scopes.ModConfiguration get_Config() on type Memoria.FFPR.IL2CPP.ModComponent has unsupported return type Memoria.FFPR.Configuration.Scopes.ModConfiguration [Warning:Unhollower] Method Void set_Config(Memoria.FFPR.Configuration.Scopes.ModConfiguration) on type Memoria.FFPR.IL2CPP.ModComponent has unsupported parameter Memoria.FFPR.Configuration.Scopes.ModConfiguration value of type Memoria.FFPR.Configuration.Scopes.ModConfiguration

This continues on for awhile before the import initiates. Later on in the log, there's a series of errors:

[Info :Memoria IL2CPP] [Export (2217 / 2347)] Loaded 3 assets from [sandbox] in 0.0808728 sec. Exporting... [Info :Memoria IL2CPP] [Export (2218 / 2347)] Loaded 3 assets from [scene_extragallery] in 0.0490873 sec. Exporting...

This likewise continues on for awhile before exports resume as normal. However, as stated above, the export appears to conclude normally.

Subsequently, ImportEnabled worked as intended on relaunch, and the game launched successfully, behaving as usual.

This is the log of the import: LogOutput_import.log

So, yeah, disabling export and import of textures appears to have resolved the issue for now. Thank you. I'll comment if something else comes up.

Albeoris commented 2 years ago

Something wrong with recreated sprite:

            ModComponent.Log.LogInfo($"Cur: {cur}");
            ModComponent.Log.LogInfo($"Cur: {cur.name}");
[Info   :Memoria IL2CPP] Cur: UnityEngine.Sprite
[Error  :    Detour] UnhollowerBaseLib.Il2CppException: System.NullReferenceException: Object reference not set to an instance of an object.

  at UnhollowerBaseLib.Il2CppException.RaiseExceptionIfNecessary (System.IntPtr returnedException) [0x00014] in <38fa7eb6c12441c8a8621750ed4c48b6>:0 
  at UnityEngine.Object.get_name () [0x0002c] in <18039698c44747fab11ff8d36c5e84c8>:0 
Albeoris commented 2 years ago

Any property will throw NullReferenceException

Albeoris commented 2 years ago

Create: [Info :Memoria IL2CPP] Sprite:2852259593440 (Sprite:Fall_00(Clone))

Find: [Info :Memoria IL2CPP] Sprite:2852259593440 (NullReferenceException)

Albeoris commented 2 years ago
[Info   :Memoria IL2CPP] Pointer: 2305467620832
[Info   :Memoria IL2CPP] Name: Fall_00(Clone)

[Info :Memoria IL2CPP] Title Scene Unload

[Info   :Memoria IL2CPP] Pointer: 2305467620832
[Error  :Memoria IL2CPP] [ModComponent].Update(): UnhollowerBaseLib.Il2CppException: System.NullReferenceException: Object reference not set to an instance of an object.
Albeoris commented 2 years ago

I have disabled the import textures until we deal with this issue. https://github.com/Albeoris/Memoria.FFPR/commit/8e5a8e861bb09406c803d24c7bcb31702f54ec18