Closed Thesola10 closed 2 years ago
Tried this, ran into a few errors.
When running repack_scrpt.cpk.ps1, powershell couldn't find cpkmakec.exe. After some fiddling with the code, I found out that just removing "$PSScriptRoot\" at the beginning of line 10 solves this issue. However, even then, I kept getting this error:
out-file : Could not find a part of the path "C:\Users\USERNAME\Desktop\YC_English-pwsh\work\Data\StreamingAssets\scrpt.cpk.contents\".
In C:\Users\USERNAME\Desktop\YC_English-pwsh\repack_scrpt.cpk.ps1 At Line:7 char:5
python3 $PSScriptRoot\inucode.py $_.FullName > "$PSScriptRoot\wor ...
CategoryInfo : OpenError: (:) [Out-File], DirectoryNotFoundException
FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.OutFileCommand
In order to run extract_nsp.ps1 I had to add .\ before both hactool commands at line 5 and 6. But then hactool seems to have some problems:
Format-Hex : A parameter cannot be found that matches parameter name "Count".
In C:\Users\USERNAME\Desktop\YC_English-pwsh\extract_nsp.ps1:7 char:29
--titlekey=$(Format-Hex -Count 16 -Offset 0x180 -Path $PSScriptRo ...
CategoryInfo : InvalidArgument: (:) [Format-Hex], ParameterBindingException
FullyQualifiedErrorId : NamedParameterNotFound,Format-Hex
and
Remove-Item : A positional parameter cannot be found that accepts argument "C:\Users\USERNAME\Desktop\YC_English-pwsh\work\*.tik".
In C:\Users\USERNAME\Desktop\YC_English-pwsh\extract_nsp.ps1:10 char:1
Remove-Item $PSScriptRoot\work\*.nca $PSScriptRoot\work\*.tik $PSScri ...
CategoryInfo : InvalidArgument: (:) [Remove-Item], ParameterBindingException
FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand
@ZeGreatKaiser in your particular case, you could try running the tools under WSL, should be much easier. In the mean time, given Windows' dependency management (or lack thereof), there probably won't be an easy way to run the patcher at least until I figure out #2
Got the PowerShell scripts working, monobehaviour_of_borg.py
is blocked by K0lb3/etcpak#3 and requires fiddling with MSys2 to install UnityPy
properly. This will be a lot simpler once #2 is built, since all the dependency resolving will have been done beforehand.
The new scripts seem to run fine, once I changed the python3
to py
in repack_script.cpk.ps1
(line 7). It didn't find my python install otherwise.
Menu translations are working perfectly fine, but I get a blackscreen when hitting New Game.
Did you check for any error messages in cpkmakec.exe
, and that the file at out/contents/0100D12014FC200/romfs/Data/StreamingAssets/scrpt.cpk
isn't empty? It should be around 30MB
I'm running a full test of the script on my Win10 VM right now.
Menu translations are working perfectly fine
Wait, did you manage to install UnityPy? Are you using the Windows Store version of Python 3? I can't for the life of me install it properly under MSys2
I'm probably going to rewrite the PowerShell and shell scripts in this repo into pure Python, to make things easier for #2
Okay, apparently cpkmakec.exe
requires .NET 3.5, but Windows being the trainwreck that it is, won't tell you about it if you run it on the command line. It only bothers if you double-click on it. Neat.
Oh, and that still doesn't allow me to make things easier for Linux users by only requiring Mono, because apparently it's not real .NET but Visual C++, so it is completely different from regular .NET, which itself has nothing to do with .NET Core/5+. Talk about cross-platform.
my out/.../scrpt.cpk
is 60MB for some reason.
cpkmaker.exe
seemed to work fine, cpkmaker.out.csv
also shows noo errors.
I did manage to install UnityPy via pip install UnityPy
, I'm using Python 3.10.1. Got it from their website, not the Windows Store. Also, I have .NET SDK 5.0, if that's the version you're interested in.
Can reproduce, may be an issue with inucode.py
and CRLF handling. On Windows, even newlines come to haunt you apparently.
Dear God, it's even worse. Among the extremely long list of things only Windows does differently, it uses UTF-16 instead of UTF-8 by default, which means individual letters are expected to take up two bytes each, so all encoded files end up as double-sized trash. Will try to work around.
Appears to actually be both, but newlines shouldn't break JSON parsing. Would be ideal for the patcher to be reproducible, but Windows is as usual throwing a spanner in the works.
Huh, so that's why my scrpt.cpk is about double the size of yours? The more you know!
Yep, right on the money, and bonus UTF-16 0xfffe
header.
It was PowerShell doing the whole UTF16 thing even though my output was RAW NON-TEXT DATA, SERIOUSLY WHAT THE FU-, poor old Python didn't do anything wrong after all. Fix is on its way!
Still getting blackscreens. Although scrpt.cpk
is now 30MB, as it should be.
Run git config --global core.autocrlf false
then re-clone the repository. Git for Windows automatically "translates" conventional line breaks into carriage-return+line-break for Windows. That is obsolete behaviour since Notepad and VScode understand normal line breaks nowadays
Powershell still messes with the newlines in raw hexdump data.
PowerShell/PowerShell#1908
this is terrifying. anyone who contributes code to this madness is seriously sick.
I'm gonna modify inucode.py
to write the output file directly from within Python and never touch windows ever again.
This set of changes closes #1