Nenkai / FF16Tools

Tools for Final Fantasy XVI / 16.
MIT License
39 stars 4 forks source link

Pack folder "actual folder" too long folder, clips out game path #8

Closed ThomasAunvik closed 2 months ago

ThomasAunvik commented 2 months ago

This is what happens if i run on the current tool:

Added a console.writeline under FF16PackBuilder#86 https://github.com/Nenkai/FF16Tools/blob/c75c7f2c003c74d43dd18ef7c7f308016270b0f3/FF16Tools.Pack/Packing/FF16PackBuilder.cs#L86

with the extra -name argument, the files packed is missing the root asset folder chara. and the extra text in to the name arguments crops out the name further.

> dotnet run pack -i "F:\Projects\mods2\ModPackage1-xtvtfdh358k718\data\0000"  -o "0000.diff." -n 0000
-----------------------------------------
- FF16Tools.CLI 1.2.1 by Nenkai
-----------------------------------------
- https://github.com/Nenkai
- https://twitter.com/Nenkaai
-----------------------------------------

F:\Projects\mods2\ModPackage1-xtvtfdh358k718\data\0000\0000
[15:24:34] [Info] PACK: Adding '/c1001/model/face/f0101/material/m_c1001f0101_beard.mtl'...
[15:24:34] [Info] PACK: Adding '/c1001/model/face/f0101/material/m_c1001f0101_buzz.mtl'...
[15:24:34] [Info] PACK: Adding '/c1001/model/face/f0101/material/m_c1001f0101_cuff.mtl'...
[15:24:34] [Info] PACK: Adding '/c1001/model/face/f0101/material/m_c1001f0101_eye_red.mtl'...
[15:24:34] [Info] PACK: Adding '/c1001/model/face/f0101/material/m_c1001f0101_eye.mtl'...
[15:24:34] [Info] PACK: Adding '/c1001/model/face/f0101/material/m_c1001f0101_facehair.mtl'...
[15:24:34] [Info] PACK: Adding '/c1001/model/face/f0101/material/m_c1001f0101_innermouth.mtl'...
[15:24:34] [Info] PACK: Adding '/c1001/model/face/f0101/material/m_v3_c1001f0101_face.mtl'...
[15:24:34] [Info] PACK: Adding '/c1001/model/face/f0101/texture/t_c1001f0101_cuff_base.tex'...
[15:24:34] [Info] PACK: Compressing '/c1001/model/face/f0101/material/m_c1001f0101_beard.mtl' into shared chunk..
[15:24:34] [Info] PACK: Compressing '/c1001/model/face/f0101/material/m_c1001f0101_buzz.mtl' into shared chunk..
[15:24:34] [Info] PACK: Compressing '/c1001/model/face/f0101/material/m_c1001f0101_cuff.mtl' into shared chunk..
[15:24:34] [Info] PACK: Compressing '/c1001/model/face/f0101/material/m_c1001f0101_eye_red.mtl' into shared chunk..
[15:24:34] [Info] PACK: Compressing '/c1001/model/face/f0101/material/m_c1001f0101_eye.mtl' into shared chunk..
[15:24:34] [Info] PACK: Compressing '/c1001/model/face/f0101/material/m_c1001f0101_facehair.mtl' into shared chunk..
[15:24:34] [Info] PACK: Compressing '/c1001/model/face/f0101/material/m_c1001f0101_innermouth.mtl' into shared chunk..
[15:24:34] [Info] PACK: Compressing '/c1001/model/face/f0101/material/m_v3_c1001f0101_face.mtl' into shared chunk..
[15:24:34] [Info] PACK: Starting write.
[15:24:34] [Info] PACK: Writing shared chunk 1/1..
[15:24:34] [Info] PACK: Writing raw '/c1001/model/face/f0101/texture/t_c1001f0101_cuff_base.tex'..
[15:24:34] [Info] PACK: Writing header.
[15:24:34] [Info] PACK: Setting internal pack name to '0000'.
[15:24:34] [Info] -> 0000.diff.
[15:24:34] [Info] Done packing.

Remove the input 0000 would work to pack the correct paths, but it would then include the contents directory too.

Is it meant to be run as the folder containing all pac's? as such?

> dotnet run pack -i "F:\Projects\mods2\ModPackage1-xtvtfdh358k718\data\"  -o "0000.diff." -n 0000
-----------------------------------------
- FF16Tools.CLI 1.2.1 by Nenkai
-----------------------------------------
- https://github.com/Nenkai
- https://twitter.com/Nenkaai
-----------------------------------------

F:\Projects\mods2\ModPackage1-xtvtfdh358k718\data\0000
[15:25:04] [Info] PACK: Adding 'files.txt'...
[15:25:04] [Info] PACK: Adding 'dif.pac'...
[15:25:04] [Info] PACK: Adding 'diff_files.txt'...
[15:25:04] [Info] PACK: Adding 'diff.pac'...
[15:25:04] [Info] PACK: Adding 'pac'...
[15:25:04] [Info] PACK: Adding 'patch.pac'...
[15:25:04] [Info] PACK: Adding 'chara/c1001/model/face/f0101/material/m_c1001f0101_beard.mtl'...
[15:25:04] [Info] PACK: Adding 'chara/c1001/model/face/f0101/material/m_c1001f0101_buzz.mtl'...
[15:25:04] [Info] PACK: Adding 'chara/c1001/model/face/f0101/material/m_c1001f0101_cuff.mtl'...
[15:25:04] [Info] PACK: Adding 'chara/c1001/model/face/f0101/material/m_c1001f0101_eye_red.mtl'...
[15:25:04] [Info] PACK: Adding 'chara/c1001/model/face/f0101/material/m_c1001f0101_eye.mtl'...
[15:25:04] [Info] PACK: Adding 'chara/c1001/model/face/f0101/material/m_c1001f0101_facehair.mtl'...
[15:25:04] [Info] PACK: Adding 'chara/c1001/model/face/f0101/material/m_c1001f0101_innermouth.mtl'...
[15:25:04] [Info] PACK: Adding 'chara/c1001/model/face/f0101/material/m_v3_c1001f0101_face.mtl'...
[15:25:04] [Info] PACK: Adding 'chara/c1001/model/face/f0101/texture/t_c1001f0101_cuff_base.tex'...
[15:25:04] [Info] PACK: Compressing 'files.txt' into shared chunk..
[15:25:04] [Info] PACK: Compressing 'dif.pac' into shared chunk..
[15:25:04] [Info] PACK: Compressing 'diff_files.txt' into shared chunk..
[15:25:04] [Info] PACK: Compressing 'diff.pac' into shared chunk..
[15:25:04] [Info] PACK: Compressing 'pac' into shared chunk..
[15:25:04] [Info] PACK: Compressing 'patch.pac' into shared chunk..
[15:25:04] [Info] PACK: Compressing 'chara/c1001/model/face/f0101/material/m_c1001f0101_beard.mtl' into shared chunk..
[15:25:04] [Info] PACK: Compressing 'chara/c1001/model/face/f0101/material/m_c1001f0101_buzz.mtl' into shared chunk..
[15:25:04] [Info] PACK: Compressing 'chara/c1001/model/face/f0101/material/m_c1001f0101_cuff.mtl' into shared chunk..
[15:25:04] [Info] PACK: Compressing 'chara/c1001/model/face/f0101/material/m_c1001f0101_eye_red.mtl' into shared chunk..
[15:25:04] [Info] PACK: Compressing 'chara/c1001/model/face/f0101/material/m_c1001f0101_eye.mtl' into shared chunk..
[15:25:04] [Info] PACK: Compressing 'chara/c1001/model/face/f0101/material/m_c1001f0101_facehair.mtl' into shared chunk..
[15:25:04] [Info] PACK: Compressing 'chara/c1001/model/face/f0101/material/m_c1001f0101_innermouth.mtl' into shared chunk..
[15:25:04] [Info] PACK: Compressing 'chara/c1001/model/face/f0101/material/m_v3_c1001f0101_face.mtl' into shared chunk..
[15:25:04] [Info] PACK: Starting write.
[15:25:04] [Info] PACK: Writing shared chunk 1/1..
[15:25:04] [Info] PACK: Writing raw 'chara/c1001/model/face/f0101/texture/t_c1001f0101_cuff_base.tex'..
[15:25:04] [Info] PACK: Writing header.
[15:25:04] [Info] PACK: Setting internal pack name to '0000'.
[15:25:04] [Info] -> 0000.diff.
[15:25:04] [Info] Done packing.

Removing the following under to only be that folder: https://github.com/Nenkai/FF16Tools/blob/c75c7f2c003c74d43dd18ef7c7f308016270b0f3/FF16Tools.Pack/Packing/FF16PackBuilder.cs#L86

to:

 string actualDir = dir; 

Makes the paths correct, and doesn't include all the other files.


 dotnet run pack -i "F:\Projects\mods2\ModPackage1-xtvtfdh358k718\data\0000"  -o "0000.diff." -n 0000.diff.pac
-----------------------------------------
- FF16Tools.CLI 1.2.1 by Nenkai
-----------------------------------------
- https://github.com/Nenkai
- https://twitter.com/Nenkaai
-----------------------------------------

F:\Projects\mods2\ModPackage1-xtvtfdh358k718\data\0000
[15:26:22] [Info] PACK: Adding 'chara/c1001/model/face/f0101/material/m_c1001f0101_beard.mtl'...
[15:26:22] [Info] PACK: Adding 'chara/c1001/model/face/f0101/material/m_c1001f0101_buzz.mtl'...
[15:26:22] [Info] PACK: Adding 'chara/c1001/model/face/f0101/material/m_c1001f0101_cuff.mtl'...
[15:26:22] [Info] PACK: Adding 'chara/c1001/model/face/f0101/material/m_c1001f0101_eye_red.mtl'...
[15:26:22] [Info] PACK: Adding 'chara/c1001/model/face/f0101/material/m_c1001f0101_eye.mtl'...
[15:26:22] [Info] PACK: Adding 'chara/c1001/model/face/f0101/material/m_c1001f0101_facehair.mtl'...
[15:26:22] [Info] PACK: Adding 'chara/c1001/model/face/f0101/material/m_c1001f0101_innermouth.mtl'...
[15:26:22] [Info] PACK: Adding 'chara/c1001/model/face/f0101/material/m_v3_c1001f0101_face.mtl'...
[15:26:22] [Info] PACK: Adding 'chara/c1001/model/face/f0101/texture/t_c1001f0101_cuff_base.tex'...
[15:26:22] [Info] PACK: Compressing 'chara/c1001/model/face/f0101/material/m_c1001f0101_beard.mtl' into shared chunk..
[15:26:22] [Info] PACK: Compressing 'chara/c1001/model/face/f0101/material/m_c1001f0101_buzz.mtl' into shared chunk..
[15:26:22] [Info] PACK: Compressing 'chara/c1001/model/face/f0101/material/m_c1001f0101_cuff.mtl' into shared chunk..
[15:26:22] [Info] PACK: Compressing 'chara/c1001/model/face/f0101/material/m_c1001f0101_eye_red.mtl' into shared chunk..
[15:26:22] [Info] PACK: Compressing 'chara/c1001/model/face/f0101/material/m_c1001f0101_eye.mtl' into shared chunk..
[15:26:22] [Info] PACK: Compressing 'chara/c1001/model/face/f0101/material/m_c1001f0101_facehair.mtl' into shared chunk..
[15:26:22] [Info] PACK: Compressing 'chara/c1001/model/face/f0101/material/m_c1001f0101_innermouth.mtl' into shared chunk..
[15:26:22] [Info] PACK: Compressing 'chara/c1001/model/face/f0101/material/m_v3_c1001f0101_face.mtl' into shared chunk..
[15:26:22] [Info] PACK: Starting write.
[15:26:22] [Info] PACK: Writing shared chunk 1/1..
[15:26:22] [Info] PACK: Writing raw 'chara/c1001/model/face/f0101/texture/t_c1001f0101_cuff_base.tex'..
[15:26:22] [Info] PACK: Writing header.
[15:26:22] [Info] PACK: Setting internal pack name to '0000.diff.pac'.
[15:26:22] [Info] -> 0000.diff.
[15:26:22] [Info] Done packing.```
Nenkai commented 2 months ago

The --name argument is supposed to be used when you want to manually assign the internal archive directory. This isn't something you should use normally.

For instance, 0001.pac has nxd as its directory, therefore any file in that pack is a file inside a directory of name nxd.

Otherwise this looks valid, so i'll look into it.

ThomasAunvik commented 2 months ago

The --name argument is supposed to be used when you want to manually assign the internal archive directory. This isn't something you should use normally.

I did attempt to not use --name, but without it i received the following error:


> .\FF16Tools.CLI.exe pack -i "F:\Projects\mods2\ModPackage1-xtvtfdh358k718\data\0000"  -o "F:\Projects\mods2\ModPackage1-xtvtfdh358k718\data\0000.diff.pac"
-----------------------------------------
- FF16Tools.CLI 1.2.1 by Nenkai
-----------------------------------------
- https://github.com/Nenkai
- https://twitter.com/Nenkaai
-----------------------------------------

Unhandled exception. System.ArgumentNullException: Value cannot be null. (Parameter 'path2')
   at System.ArgumentNullException.Throw(String paramName)
   at System.IO.Path.Combine(String path1, String path2)
   at FF16Tools.Pack.Packing.FF16PackBuilder.InitFromDirectory(String dir, CancellationToken ct) in F:\Projects\ffxvi-mod-manager\src-tauri\FF16Pack\FF16Tools.Pack\Packing\FF16PackBuilder.cs:line 86
   at FF16Tools.CLI.Program.PackFiles(PackVerbs verbs) in F:\Projects\ffxvi-mod-manager\src-tauri\FF16Pack\FF16Tools.CLI\Program.cs:line 177
   at CommandLine.ParserResultExtensions.WithParsedAsync[T](ParserResult`1 result, Func`2 action)
   at FF16Tools.CLI.Program.Main(String[] args) in F:\Projects\ffxvi-mod-manager\src-tauri\FF16Pack\FF16Tools.CLI\Program.cs:line 69
   at FF16Tools.CLI.Program.<Main>(String[] args)```
Nenkai commented 2 months ago

Assuming you are compiling from source you might want to try again with 76581e0f

ThomasAunvik commented 2 months ago

Tested it now,

Three diff commands:

 dotnet run pack -i "F:\Projects\mods2\ModPackage1-xtvtfdh358k718\data\0000" -o "0000.diff.pac"
-----------------------------------------
- FF16Tools.CLI 1.2.1 by Nenkai
-----------------------------------------
- https://github.com/Nenkai
- https://twitter.com/Nenkaai
-----------------------------------------

Unhandled exception. System.ArgumentNullException: Value cannot be null. (Parameter 'path2')
   at System.ArgumentNullException.Throw(String paramName)
   at System.IO.Path.Combine(String path1, String path2)
   at FF16Tools.Pack.Packing.FF16PackBuilder.InitFromDirectory(String dir, CancellationToken ct) in F:\Projects\FF16Tools\FF16Tools.Pack\Packing\FF16PackBuilder.cs:line 92
   at FF16Tools.CLI.Program.PackFiles(PackVerbs verbs) in F:\Projects\FF16Tools\FF16Tools.CLI\Program.cs:line 185
   at CommandLine.ParserResultExtensions.WithParsedAsync[T](ParserResult`1 result, Func`2 action)
   at FF16Tools.CLI.Program.Main(String[] args) in F:\Projects\FF16Tools\FF16Too``s.CLI\Program.cs:line 69
   at FF16Tools.CLI.Program.<Main>(String[] args)
dotnet run pack -i "F:\Projects\mods2\ModPackage1-xtvtfdh358k718\data\0000" -o "0000.diff.pac" --name 0000.diff.pac
-----------------------------------------
- FF16Tools.CLI 1.2.1 by Nenkai
-----------------------------------------
- https://github.com/Nenkai
- https://twitter.com/Nenkaai
-----------------------------------------

Unhandled exception. System.IO.DirectoryNotFoundException: Directory '0000.diff.pac' does not exist inside input directory.
   at FF16Tools.Pack.Packing.FF16PackBuilder.InitFromDirectory(String dir, CancellationToken ct) in F:\Projects\FF16Tools\FF16Tools.Pack\Packing\FF16PackBuilder.cs:line 82
   at FF16Tools.CLI.Program.PackFiles(PackVerbs verbs) in F:\Projects\FF16Tools\FF16Tools.CLI\Program.cs:line 185
   at CommandLine.ParserResultExtensions.WithParsedAsync[T](ParserResult`1 result, Func`2 action)
   at FF16Tools.CLI.Program.Main(String[] args) in F:\Projects\FF16Tools\FF16Tools.CLI\Program.cs:line 69
   at FF16Tools.CLI.Program.<Main>(String[] args)

This last one packages the files correctly, but input path is data path and not the 0000 path. (if that is meant to be)? And noting that the internal pack name is also set to 0000, or it is meant that the folder name should be called 0000.diff instead to be? Not sure what the game wants it to be.

 dotnet run pack -i "F:\Projects\mods2\ModPackage1-xtvtfdh358k718\data" -o "0000.diff.pac" --name 0000
-----------------------------------------
- FF16Tools.CLI 1.2.1 by Nenkai
-----------------------------------------
- https://github.com/Nenkai
- https://twitter.com/Nenkaai
-----------------------------------------

[17:21:18] [Info] PACK: Adding 'chara/c1001/model/face/f0101/material/m_c1001f0101_beard.mtl'...
[17:21:18] [Info] PACK: Adding 'chara/c1001/model/face/f0101/material/m_c1001f0101_buzz.mtl'...
[17:21:18] [Info] PACK: Adding 'chara/c1001/model/face/f0101/material/m_c1001f0101_cuff.mtl'...
[17:21:18] [Info] PACK: Adding 'chara/c1001/model/face/f0101/material/m_c1001f0101_eye_red.mtl'...
[17:21:18] [Info] PACK: Adding 'chara/c1001/model/face/f0101/material/m_c1001f0101_eye.mtl'...
[17:21:18] [Info] PACK: Adding 'chara/c1001/model/face/f0101/material/m_c1001f0101_facehair.mtl'...
[17:21:18] [Info] PACK: Adding 'chara/c1001/model/face/f0101/material/m_c1001f0101_innermouth.mtl'...
[17:21:18] [Info] PACK: Adding 'chara/c1001/model/face/f0101/material/m_v3_c1001f0101_face.mtl'...
[17:21:18] [Info] PACK: Adding 'chara/c1001/model/face/f0101/texture/t_c1001f0101_cuff_base.tex'...
[17:21:18] [Info] PACK: Compressing 'chara/c1001/model/face/f0101/material/m_c1001f0101_beard.mtl' into shared chunk..
[17:21:18] [Info] PACK: Compressing 'chara/c1001/model/face/f0101/material/m_c1001f0101_buzz.mtl' into shared chunk..
[17:21:18] [Info] PACK: Compressing 'chara/c1001/model/face/f0101/material/m_c1001f0101_cuff.mtl' into shared chunk..
[17:21:18] [Info] PACK: Compressing 'chara/c1001/model/face/f0101/material/m_c1001f0101_eye_red.mtl' into shared chunk..
[17:21:18] [Info] PACK: Compressing 'chara/c1001/model/face/f0101/material/m_c1001f0101_eye.mtl' into shared chunk..
[17:21:18] [Info] PACK: Compressing 'chara/c1001/model/face/f0101/material/m_c1001f0101_facehair.mtl' into shared chunk..
[17:21:18] [Info] PACK: Compressing 'chara/c1001/model/face/f0101/material/m_c1001f0101_innermouth.mtl' into shared chunk..
[17:21:18] [Info] PACK: Compressing 'chara/c1001/model/face/f0101/material/m_v3_c1001f0101_face.mtl' into shared chunk..
[17:21:18] [Info] PACK: Starting write.
[17:21:18] [Info] PACK: Writing shared chunk 1/1..
[17:21:18] [Info] PACK: Writing raw 'chara/c1001/model/face/f0101/texture/t_c1001f0101_cuff_base.tex'..
[17:21:18] [Info] PACK: Writing header.
[17:21:18] [Info] PACK: Setting internal pack name to '0000'.
[17:21:18] [Info] -> 0000.diff.pac
[17:21:18] [Info] Done packing.
Nenkai commented 2 months ago

Alright I see it now for the first one. Second/third is intended. This is not how you use the --name argument - refer to the README

Should be solved now.

ThomasAunvik commented 2 months ago

Still

dotnet run pack -i "F:\Projects\mods2\ModPackage1-xtvtfdh358k718\data\0000\" -o "0000.diff.pac"
-----------------------------------------
- FF16Tools.CLI 1.2.1 by Nenkai
-----------------------------------------
- https://github.com/Nenkai
- https://twitter.com/Nenkaai
-----------------------------------------

[20:34:50] [Info] PACK: Adding 'hara/c1001/model/face/f0101/material/m_c1001f0101_beard.mtl'...
[20:34:50] [Info] PACK: Adding 'hara/c1001/model/face/f0101/material/m_c1001f0101_buzz.mtl'...
[20:34:50] [Info] PACK: Adding 'hara/c1001/model/face/f0101/material/m_c1001f0101_cuff.mtl'...
[20:34:50] [Info] PACK: Adding 'hara/c1001/model/face/f0101/material/m_c1001f0101_eye_red.mtl'...
[20:34:50] [Info] PACK: Adding 'hara/c1001/model/face/f0101/material/m_c1001f0101_eye.mtl'...
[20:34:50] [Info] PACK: Adding 'hara/c1001/model/face/f0101/material/m_c1001f0101_facehair.mtl'...
[20:34:50] [Info] PACK: Adding 'hara/c1001/model/face/f0101/material/m_c1001f0101_innermouth.mtl'...
[20:34:50] [Info] PACK: Adding 'hara/c1001/model/face/f0101/material/m_v3_c1001f0101_face.mtl'...
[20:34:50] [Info] PACK: Adding 'hara/c1001/model/face/f0101/texture/t_c1001f0101_cuff_base.tex'...
[20:34:50] [Info] PACK: Compressing 'hara/c1001/model/face/f0101/material/m_c1001f0101_beard.mtl' into shared chunk..
[20:34:50] [Info] PACK: Compressing 'hara/c1001/model/face/f0101/material/m_c1001f0101_buzz.mtl' into shared chunk..
[20:34:50] [Info] PACK: Compressing 'hara/c1001/model/face/f0101/material/m_c1001f0101_cuff.mtl' into shared chunk..
[20:34:50] [Info] PACK: Compressing 'hara/c1001/model/face/f0101/material/m_c1001f0101_eye_red.mtl' into shared chunk..
[20:34:50] [Info] PACK: Compressing 'hara/c1001/model/face/f0101/material/m_c1001f0101_eye.mtl' into shared chunk..
[20:34:50] [Info] PACK: Compressing 'hara/c1001/model/face/f0101/material/m_c1001f0101_facehair.mtl' into shared chunk..
[20:34:50] [Info] PACK: Compressing 'hara/c1001/model/face/f0101/material/m_c1001f0101_innermouth.mtl' into shared chunk..
[20:34:50] [Info] PACK: Compressing 'hara/c1001/model/face/f0101/material/m_v3_c1001f0101_face.mtl' into shared chunk..
[20:34:50] [Info] PACK: Starting write.
[20:34:50] [Info] PACK: Writing shared chunk 1/1..
[20:34:50] [Info] PACK: Writing raw 'hara/c1001/model/face/f0101/texture/t_c1001f0101_cuff_base.tex'..
[20:34:50] [Info] PACK: Writing header.
[20:34:50] [Info] -> 0000.diff.pac
[20:34:50] [Info] Done packing.
ThomasAunvik commented 2 months ago

Nvm i can just remove the end / and it works. Looks perfect now

Nenkai commented 2 months ago

Should be assumed fixed as of 1.2.2 anyway.