[KH2] Inconsistent behavior when patching in new files.
Describe the bug For KH2, when you patch in a file with a new name, the file can sometimes not be patched in at all, and the pkg will retain a temporary name with the name of the pkg & the time it was patched. Additionally, when this occurs, a backup PKG will appear in "backups", even when the "Backup PKG" option is ticked off. Unfortunately, when it occurs seems to be inconsistent. I've tried to consistently reproduce this, but it's happened only a handful of times.
To Reproduce Steps to reproduce the behavior:
- Create a patch that adds in a new file, like patching in a new weapon, in kh2_sixth\original\obj "W_EX010_NEWTEST.mdlx" & "W_EX010_NEWTEST.a.us"
- Edit the "00objentry" file to load your newly patched file in over an existing weapon.
- Patch the file in the game.
- Check out the Image/en folder, with all the pkgs inside.
- Confirm if the patched pkg retained its temporary filename.
- Rename the pkg to the expected name
- Load in-game. An infinitely loading black screen will occur, because the file seems to not have been patched in.
Expected behavior The PKG should be properly renamed back to its original name, and backup PKGs should not be present in the backup folder if the option was ticked off.
Screenshots
Photo showing the temporary filenames, as they appeared in the backup folder. (Did not have an on-hand screenshot of them appearing in the EN folder)
Version used (please complete the following information): V1.20 of patcher used.
Affected games (please complete the following information): KH2
Formats involved (please complete the following information): MDLX & a.us
Additional context
Hey! Looks like the patching process stops before the end (which is why the files retain their temporary names and aren't moved/deleted correctly, and infinite loading loop).
Do you get any error message at all? Are you trying this in GUI mode (UI window) or in CLI (black command prompt window)?
Hi, each time it occurred, it gave the successful "Patch applied!" message, and each attempt was done via GUI mode.
Are you consistently applying the patch to clean (non-patched) HED/PKG?
Could you share the custom_hd_assets.txt file generated after this issue occurs?
Might want to get in touch with you on Discord, if that's okay (send me a message please, AntonioDePau@6333).
Of course, actually just had it happen again right now, I'll send the patch & custom_hd_assets file over to you.
After some testing, I think I may know what the issue is. It seems that error messages are no longer displaying, and are simply showing the "Patch Applied!" success message, regardless of whether or not patching was successful. An easy way to replicate this is to launch KH2, and try patching the game while KH2 is running. In prior versions, the patcher would display an error, but in 1.20, the patcher simply says "Patch applied!"
Yeah, I tried installing the JP voices and it instantly said "Patch Applied!", without a progress indicator. Tried in 1.1.5, it's extracts normally and shows an error. https://prnt.sc/hCqzSQRfXKHH
Nvm, I was just being dumb and didn't have a resources folder.
Something new? I had the same problem a few minutes ago (this is image/en)
all the files are suposed to be like this? my game stays in a loading black screen when I try to load a game.
There is any way to put it back to the original files until I can patch the game good? Or there is any way to fix it?
@Ukunn18 you may want to provide more info as your version of the issue could be different:
- what version of the patcher are you using?
- what mod(s) did you try to apply?
- what game were you trying to patch?
- did you try closing the game before patching (do not try to patch while the game is running)?(this solved Zurphing's issue)
- do you have the resource folder with relevant .txt files inside next to the patcher? (this solved Doomwhite's issue)
I'm using version 1.2 of the patcher
I tried this ones (on the description in nexusmods says that I need to use the patcher on his 1.2 version)
I'm patching KH2FM
I did this with the game closed
I have the resource folder in the same folder than the patcher
This is the resource folder

Okay, by reinstaling the game, and saving my save files (png images) I restored the game, now it works, but, how do I install mods now? It seems like the Patcher isn't working properly. I'll waiting till you know something.
From your screenshot, I can see the mods are in zip format. You are extracting them so they display in the required .kh2pcpatch format before trying to apply them?
Are you using the patcher un GUI mode (double-click the exe)? You may want to try dragging a mod onto the patcher (should start the patcher in CLI mode instead) and follow the instructions.
Let me know if that works or if you get any error message with that.
If you look at the other screenshot, I unzipped all the mods and I used the patcher via GUI. I will use the CLI mode When I end it, I will write you
Okay, I did it with the CLI mode, and it says this
What is this?
(It says "access denied")
It means the .hed or .pkg that need to be patched cannot be edited because they're probably opened/used either by the game or another program on your computer.
Can you try restarting your computer and patch kin CLI mode) right away (without starting the game nor any other program)?
Okay, so I cannot use it with a folder with it open? I´ll try to restart and I tell you
Open folder should be fine, although explorer.exe works in mysterious ways and could indeed be blocking the process...
Are you admin on your PC? You may want to start the patcher in admin/elevated mode, maybe that could help too.
I'm admin yes, it seems to be working without the folder of the mod open. I pressed enter and now it says nothing, it appears to be loading
Isn't it?
When you press enter, you need to wait like that? Or it needs to say something?
In theory it should start listing the files being kept/replaced based on the mod you're trying to apply. And it should say "Done" once it's over.
Okay, ill retry
Now says this

If I edit the programm to open with administrator options, it doesn't works
(I'm sorry for being so annoying btw)
No need to apologize :) I'm not sure why you're not getting authorisation to access the path though, this is getting frustrating...
Okay, I'll try and contact you on Discord when I'm not at work. Let me know if you figure something out in the meantime!
@Ukunn18 issue was due to the "backup" folder being read-only. Solved by moving the game install folder to C: (which caused the newly created backup folder to be read-write, but could have been fixed in other ways, possibly)
Heya! Mind if I add to this:
The Re:Fixed Dual Audio patches makes heavy use of introducing new files, but many of my users have experienced corrupt game files that led to infini-loads when trying to patch the game. Here is one such conversation:

It also does not seem to be backing up correctly, as many users have experienced this scenario:

Hey @TopazTK, guessing they must be getting an error (or lack of error due to a mistake of mine in 1.2.0) while patching that causes the process to "finish" before it's supposed to. I need to publish a new version that fixes this (however, it will only show the user the error, they must then try and fix the issue on their own, with your help, or by posting here. As you can see, there are issues outside KHPCPatcherManager that can cause it to work incorrectly).
As for the backups, I may need to change the logic of it. Currently, it will back up the .hed and .PKG being affected by the patch applied. But it does so everytime a new patch is applied (so that, if all goes well with a patch, the user can use the previously backed-up patched version and expand on that without need to re-apply all previous patches). This brings pros and cons:
- user can decide what backup they want to keep (or make copies of)
- users will need to redownload the whole game if they do not make a proper copy of the first backup
Changing the logic to only creating a backup of the original .hed and .pkg will be safer, but it would also mean the user could easily be doing that manually themselves, just in case. I'll think about it anyway. But the "backup" process itself cannot corrupt the backed-up files, or if it does, it's due to the OS copy function have flaws, since that's what I'm using. So I can only imagine the users you've talked to applied multiple patches in a row, causing the backups to be overwritten with a backup of .hed and .pkg that were already corrupted and unplayable.
Oh also the hash generation for new files on KH1 seems to be either incorrect or non-existent as the files I patch in cannot be located by the game. At all.