Using the script - chocmake/MGSV-Custom-Texture-Path-Hex-Replacer GitHub Wiki
It's pretty straightforward overall but for the sake of documentation each section below goes into extra detail.
Contents:
Launching
The script can opened a few different ways:
- Opening the script by double-clicking it.
- Dropping an FMDL/FV2 file on its icon.
- Launching it from an FMDL/FV2 file via a custom Send To context menu shortcut.
You might only use the script rarely so it may be easiest to just double-click the script when needed.
(Optional) Adding a shortcut to the Send To menu
Personally I like having mod tools in the Send To menu (seen when right-clicking any file in Windows) so I've outlined below the steps to add it:
- To open the directory where all the Send To shortcuts are contained launch the Run prompt (
Win+R
) and enter%userprofile%\AppData\Roaming\Microsoft\Windows\SendTo
- Copy
MGSV-Custom-Texture-Path-Hex-Replacer.bat
from its location then right-click on an empty space in the SendTo directory and select 'Paste shortcut'. - (Optional) Rename the newly created shortcut to something more readable such as
MGSV - Custom Texture Path Hex Replacer
.
Now the script can be launched from any location by right-clicking a target file and sending it to the batch script from the 'Send to' context menu drop-down.
Script usage
The script prompts for three things:
- The target file (
.fmdl
or.fv2
) - The original texture path (
.ftex
) - The modded texture path (
.ftex
)
Drag and drop the files onto the script window as prompted, pressing Enter after each prompt. At the end the script will then silently launch the hex editor and replace the original texture path with the custom texture path.
Tip: occasionally texture paths used by the game will be stored in Form Variation (FV2) files instead of FMDL files. The script supports replacing textures for both.
Tip: dragging and dropping the original/modded FTEX texture file onto the window isn't strictly necessary. You can alternatively copy the FTEX path as text instead, then paste it into the batch script window.
Required path structure
The target file needs to be an actual FMDL file located on the drive so it can be modified by the hex editor, however the texture paths can either be simply pasted into the prompt in text form if you already know what they are/will be, or drag and dropped as actual files into the script window when prompted.
Original FTEX path
It's important to keep the original FTEX texture path in its original directory structure since the script uses the path beginning from the last Assets
directory to create the appropriate value for modifying the target file.
Below are two different example of original FTEX texture paths that would be correct to use, seen as Windows full paths. Such full Windows paths are then converted by the script into a usable format automatically.
C:\Users\choc\Desktop\example\Original\Assets\tpp\chara\sna\Pictures\sna_bdn0_def_bsm.ftex
C:\Users\choc\Desktop\example\Original\1d9ba59dddb27.ftex
For the first example path notice how it doesn't matter where the directories outside of Assets
is located, so long as within it the path matches the original structure.
It also doesn't matter if the inner Assets
directory where the FTEX is located is nested within other Assets
higher than it (which frequently occurs when unpacking files within other files), since the script will remove all but the last Assets
directory for the value it converts.
For the second example path it's a hashed filename and located outside of Assets
.
Custom FTEX Path
This prompt is where you add the custom path. Custom paths must be to be contained anywhere within Assets
directories only and are the location of your modded FTEX file. This is true even if the original texture had a hashed filename and was located outside of Assets
in the root directory.
The custom path can be either something completely unique or more simple like appending a suffix such as _mod
to the end of the original filename.
Below are some different examples of custom paths that would be correct, seen as full Windows paths:
C:\Users\choc\Desktop\example\Modded\Assets\Mods\choc\BandanaVariants\Retexture.ftex
C:\Users\choc\Desktop\example\Modded\Assets\tpp\chara\sna\Pictures\sna_bdn0_def_bsm_mod.ftex
C:\Users\choc\Desktop\example\Modded\Assets\1d9ba59dddb27_mod.ftex
For the last example path notice how it's contained within Assets
, even though the original was located outside of Assets
. This is required for all custom paths, even hashed filenames.
Only a couple rules are necessary for a custom texture path:
- The modded file must be contained inside
Assets
. Anywhere is fine, just needs to be within it. - The path/filename must only contain alphanumeric characters (A-Z, 0-9) with no spaces, only underscores.