Albeoris / Memoria.FFPR

MIT License
69 stars 5 forks source link

Possbile texture replacement #8

Closed faospark closed 2 years ago

faospark commented 3 years ago

Since enemy and map data has been succefully eported and done. I guess this a formal request if there is a possibility for texture replacement for graphical mods. Sorta like the same as TpSheets implementation on FFIX the current workflow for graphical mods now involves some tedious work and requires editing source files.

Albeoris commented 3 years ago

image

First try. Sprites blur.

faospark commented 3 years ago

there is white matte out side the sprite . mostly likely caused by photoshop

Albeoris commented 3 years ago

image

faospark commented 3 years ago

Just for reference this is how modders in VG does it at this time https://steamcommunity.com/sharedfiles/filedetails/?id=2561708531

faospark commented 3 years ago

tha looks great

Albeoris commented 3 years ago

image

:D

faospark commented 3 years ago

hahahah

Albeoris commented 3 years ago

FF1v2021.08.06(Alpha).zip

Alpha.

faospark commented 3 years ago

imma test it now

Albeoris commented 3 years ago

imma test it now

Enable ImportTextures in config. It's disabled by default.

faospark commented 3 years ago

yup i did. it seems i cant find the button and keyboard fiiles

faospark commented 3 years ago

https://prnt.sc/1jn1fle it does export successfully somehow does import does not seem to work on UI

Silvris commented 3 years ago

Chiming in on this since I started looking into UI textures for other reasons. The actual main UI textures (UI_Common_WindowFrame02/UI_Common_WindowFrame03/UI_Common_WindowFrame04) are not actually referenced in the Addressable Assets (AssetsPath.json), thus Memoria in its current state is unable to export or import them.

Silvris commented 3 years ago

Some further information: it seems the approach currently being used to load textures (and assets in general really) is a bit limited, as there are assets that are present in AssetsPath.json that never get called into ResourceManager.completeAssetDic when they are being used (like the cursor, UI_Common_Cursor01). So I figure the best approach would be to take a higher level approach, such as hooking the direct calling of asset bundles or something similar.

Albeoris commented 2 years ago

Some further information: it seems the approach currently being used to load textures (and assets in general really) is a bit limited, as there are assets that are present in AssetsPath.json that never get called into ResourceManager.completeAssetDic when they are being used (like the cursor, UI_Common_Cursor01). So I figure the best approach would be to take a higher level approach, such as hooking the direct calling of asset bundles or something similar.

Do you have any thoughts on which API we can hook? As far as I know, all MonoBehaviour deserialization mechanisms go through a low-level API and don't use C# libraries at all.

Silvris commented 2 years ago

In regards to the assets not being present in ResourceManager.completeAssetDic, a majority of those files are required files for prefabs that are registered into completeAssetDic. I suppose you could look into hooking AddressableAssetWrapper, although hooking generic functions are a pain and a half (couldn't get them working personally). I know some repos like XUnity hook the asset bundle loading directly.

Albeoris commented 2 years ago

image image

faospark commented 2 years ago

nice

Albeoris commented 2 years ago

The problem is that the list of resources lists both atlases and regular sprites.

That is, there is an atlas: Skip MO_FF2_N001_C00 WalkB_00(Clone) WalkB_01(Clone) WalkL_00(Clone) WalkL_01(Clone)

And there are individual sprites: WalkB_00 WalkB_01 WalkL_00 WalkL_01

We need to think about how to combine them so as not to create duplicates when exporting / importing.

Albeoris commented 2 years ago

image

Albeoris commented 2 years ago

FF2: Only 6 sprites without atlases.

Default_00
Default_00
Default_00
TitleLogoImage_ZH-CH
TitleLogoImage_EN
TitleLogoImage
Albeoris commented 2 years ago

Something went wrong while exporting:

Actual: WalkL_00(Clone)
    Rect: (x:0.00, y:0.00, width:16.00, height:16.00)
    textureRect: (x:0.00, y:0.00, width:0.00, height:0.00) <<<
    pivot: (8.0, 0.0)
    border: (0.0, 0.0, 0.0, 0.0)
    bounds: Center: (0.0, 8.0, 0.0), Extents: (8.0, 8.0, 0.1)
    vertices: (-8.0, 16.0)|(8.0, 16.0)|(-8.0, 0.0)|(8.0, 0.0)
    triangles: 0|1|2|2|1|3

Exported: WalkL_00(Clone)
    Rect: (x:0.00, y:0.00, width:0.00, height:0.00)
    textureRect: (x:0.00, y:0.00, width:0.00, height:0.00) <<<
    pivot: (NaN, NaN)
    border: (0.0, 0.0, 0.0, 0.0)
    bounds: Center: (NaN, NaN, 0.0), Extents: (-Infinity, -Infinity, 0.1)
    vertices: (NaN, NaN)|(NaN, NaN)|(NaN, NaN)|(NaN, NaN)
    triangles: 0|1|2|2|1|3

It looks like the sprite is not initialized at all...

Albeoris commented 2 years ago

The problem is that neither the sprites from the atlas, nor the individual sprites nearby have information about the position on the texture. O.o

Other errors are the result of incorrect scaling.

Rect: (x:0.00, y:0.00, width:16.00, height:16.00)
textureRect: (x:0.00, y:0.00, width:0.00, height:0.00)
Albeoris commented 2 years ago

I had the idea that these are separate textures, but no. they all look at the same atlas, but for some reason do not tell about their coordinates. :(

Apparently, we have to look for a fragment on the texture pixel by pixel. х__х

[Info :Memoria IL2CPP] WalkL_00(Clone); Texture: UnityEngine.Texture2D, TextureSize: 128x64

Albeoris commented 2 years ago

Fixed!

sprite.textureRect => (x:0.00, y:0.00, width:0.00, height:0.00)
sprite.GetTextureRect() => (x:20.00, y:0.00, width:16.00, height:16.00)

-_-

Albeoris commented 2 years ago

image

I did it!

Albeoris commented 2 years ago

https://github.com/Albeoris/Memoria.FFPR/commit/b94a6d6e195508e8d14e30ec41b836707ba73f01 https://github.com/Albeoris/Memoria.FFPR/releases/tag/v2022.01.24

faospark commented 2 years ago

some assets require a bilinear filter like the burtons ![Uploading Screenshot_45.png…]()