1. masagrator

    OP masagrator The developper
    Member

    Joined:
    Oct 14, 2018
    Messages:
    3,072
    Country:
    Poland
    Because i couldn't find any tutorial for this, i made my own package. This tutorial doesn't include how to unpack NSP, XCI or NCA. It's for people who already knows that. F.e.
    https://gbatemp.net/threads/how-to-easy-extract-game-files-from-nsp-xci.534724/

    This package doesn't work with encrypted files, but Switch for most games (if not all) has decrypted archives for sake of better performance.
    This tutorial is made purposely for mount point ../../../ which is default for Switch games. More info in tutorial.
    It may look rough, but it's easy to remember after few attempts.
    If something is not working, write post.
    English purists should run away. It will not be a plausible text. :D

    • What you need to download:
      - Package "UnrealPakSwitch.zip" from attachments and unpack it.
      - Notepad++ (or any other text editor with Perl regular expressions)
      - Python 2 or 3
      - Unreal Engine 4.19.2 (for v4 *.pak), Unreal Engine 4.20.3 (for v5 *.pak), Unreal Engine 4.21.2 (for v7 *.pak), Unreal Engine 4.22.3 (for v8 *.pak), Unreal Engine 4.24.1 (for v8.23 *.pak), Unreal Engine 4.25 (for v9 *.pak). For complete pack you need to download six of them.

      My package lacks UnrealPak.exe which is licensed, but free to use. That's why I don't upload them.
      After download each respected Unreal Engine you can find UnrealPak.exe in:
      1. X:\Program Files\Epic Games\UE_4.19\Engine\Binaries\Win64\unrealpak.exe
      2. X:\Program Files\Epic Games\UE_4.20\Engine\Binaries\Win64\unrealpak.exe
      3. X:\Program Files\Epic Games\UE_4.21\Engine\Binaries\Win64\unrealpak.exe
      4. X:\Program Files\Epic Games\UE_4.22\Engine\Binaries\Win64\unrealpak.exe
      5. X:\Program Files\Epic Games\UE_4.24\Engine\Binaries\Win64\unrealpak.exe
      6. X:\Program Files\Epic Games\UE_4.25\Engine\Binaries\Win64\unrealpak.exe


      For third point (UE_4.21) you need to copy with unrealpak.exe also DLLs and other (treat UnrealPak.exe and all files below as one if you will follow Exceptions tab):
      Code:
      UnrealPak-BuildSettings.dll
      UnrealPak-Core.dll
      UnrealPak-Json.dll
      UnrealPak-PakFile.dll
      UnrealPak-PakFileUtilities.dll
      UnrealPak-Projects.dll
      UnrealPak.modules

      For fourth point (UE_4.22) you need additional files:
      Code:
      UnrealPak-BuildSettings.dll
      UnrealPak-Core.dll
      UnrealPak-Json.dll
      UnrealPak-PakFile.dll
      UnrealPak-PakFileUtilities.dll
      UnrealPak-Projects.dll
      UnrealPak.modules
      UnrealPak-RSA.dll

      For fifth point (UE_4.24) and sixth point (UE_4.25) you need additional files:
      Code:
      UnrealPak-BuildSettings.dll
      UnrealPak-Core.dll
      UnrealPak-DerivedDataCache.dll
      UnrealPak-Json.dll
      UnrealPak-PakFile.dll
      UnrealPak-PakFileUtilities.dll
      UnrealPak-Projects.dll
      UnrealPak.modules
      UnrealPak-RSA.dll
      UnrealPak-TraceLog.dll

      For each one version you need to copy UnrealPak.exe to correct folder of my package:
      1. UnrealPakSwitch\v4\2\3\UnrealPak.exe
      2. UnrealPakSwitch\v5\2\3\UnrealPak.exe
      3. UnrealPakSwitch\v7\2\3\UnrealPak.exe (+ other files)
      4. UnrealPakSwitch\v8\2\3\UnrealPak.exe (+ other files)
      5. UnrealPakSwitch\v8.23\2\3\UnrealPak.exe (+ other files)
      6. UnrealPakSwitch\v9\2\3\UnrealPak.exe (+ other files)

      You can now uninstall Unreal Engine(s) - there are no more needed.

      WARNING FOR V9 UNREALPAK!
      UnrealPak v9 shows error about not detecting PlatformCrypto plugin. It's not needed to pack files for Switch, so you will need to ignore it each time you will pack files.
      Copying just PlatformCrypto plugin results in kernel32.dll error that blocks files from packing. So better just ignore it than having gigabytes of files to just not show error.
    • Archives are mostly in romfs/******/Content/Paks as *.pak files
      ****** - project name made by devs. It's devs choice (for example Octopath has "Kingship"), but most games have one folder in romfs

      1. Copy *.pak file you want to check to unpacked UnrealPakSwitch folder.
      2. Drag your file to "1. check.cmd"
      It will show
      Code:
      Version: X
      Where X is a version of your package.
    • If you know what version you have, then drag your *.pak file to
      Code:
      version 4 - "unpack-v4.cmd"
      version 5 - "unpack-v5.cmd"
      version 7 - "unpack-v7.cmd"
      version 8 - "unpack-v8.cmd"
      version 8.23 - "unpack-v8-23.cmd"
      version 9 - "unpack-v9.cmd"
      They create "lista.txt" in UnrealPakSwitch folder which contains info about all files. It will be needed for packing archive.
      Don't press key to continue. First open "lista.txt" and check if there is a line
      Code:
      LogPakFile: Display: Mount point ../../../
      If it's correct, press any key to continue. If it's not (something different after Mount point), close window and go to Exceptions tab (if you will press key, unpacked files will be in other place that this tutorial shows).

      After some time it will unpack all files in most cases to 2 folders:
      - Engine
      - ****** (yes, the same ****** as from previous tab)

      ****** contains assets. Engine should not be modified unless you know what you are doing.
    • First we need to edit lista.txt with Notepad++
      1. Delete those lines (don't worry if one or more lines are missing)
      Code:
      LogPaths: Warning: No paths for game localization data were specifed in the game configuration.
      LogInit: Warning: No paths for engine localization data were specifed in the engine configuration.
      LogPakFile: Display: Using command line for crypto configuration
      LogPakFile: Display: Added 0 entries to add to pak file.
      LogPakFile: Display: Mount point ../../../
      2. Delete last three lines. It will look something like this (quantity of files, size and seconds may differ):
      Code:
      LogPakFile: Display: 103018 files (1944681023 bytes), (1944681023 filtered bytes).
      LogPakFile: Display: Unreal pak executed in 2.605882 seconds
      
      
      Third line is empty (CMS of this forum is deleting it, but you can see it in quote mode), you need to delete those three lines.

      3. Run "Find & Replace" (Ctrl+H), Check "Wrap Around" and "Regular Expression"
      Przechwytywanie.PNG
      4.1. For Find what: paste
      Code:
      LogPakFile: Display: "
      Replace with: should be empty.
      Click Replace All

      4.2. For Find what: paste
      Code:
      " offset: (.*)$
      Replace with:
      Code:
      "
      Click Replace All

      4.3 For Find what: paste
      Code:
      ^
      Replace with:
      Code:
      "../../../
      Yes - our mount point with quotation mark at the beginning.
      Click Replace All

      And save.
      Now we have file ready to use for our packing.

      5. Drag "lista.txt" to the same version that original pack was:
      Code:
      version 4 - "pack-v4.cmd"
      version 5 - "pack-v5.cmd"
      version 7 - "pack-v7.cmd"
      version 8 - "pack-v8.cmd"
      version 8.23 - "pack-v8-23.cmd"
      It will create "newpak.pak" inside UnrealPakSwitch folder. Rename it to name of original *.pak file.
    • You can create *.pak file that will be treated as patch and doesn't need files that are the same as in original *.pak files.
      1. You need to done "Pack files" tab 1-4.3, ignore 5th point.
      2. Now you need to delete from lista.txt every line that contains path to not-edited file and save lista.txt.
      3. Drag "lista.txt" to the same version that original *.pak was:
      Code:
      version 4 - "pack-v4.cmd"
      version 5 - "pack-v5.cmd"
      version 7 - "pack-v7.cmd"
      version 8 - "pack-v8.cmd"
      version 8.23 - "pack-v8-23.cmd"
      version 9 - "pack-v9.cmd"
      It will create "newpak.pak" inside UnrealPakSwitch folder. Rename it to name of original *.pak file, but add at the end of filename
      Code:
      _p
      For example
      Code:
      Kingship-Switch.pak -> Kingship-Switch_p.pak
      And put it to the same folder as was your original *.pak

      Not every game accepts patches in this form. For now i found only Octopath Traveler that crash when you try to put *.pak file without proper name, it needs to be named like this
      Code:
      Kingship-Switch_1_P.pak
      Kingship-Switch_2_P.pak
      etc.
    • Sometimes mount point can be different and my package needs to be slightly modified if you don't want to make mess. It most cases it means that this *.pak archive is additional to other *.pak file(s) and is "inside" one of them, so after unpacking it will look different than Engine and ****** folders. You can check it in "lista.txt"
      Default mount point is ../../../ which is "3 folders before", that's why i put UnrealPak.exe to such weird combination of folders.
      Mount point is saved in archive properties and if it's not preserved, game will show error.

      For example:

      If it will be version 4 package with mount point ../../King/Sample/:
      1. You need to move UnrealPak.exe from v4\2\3 to v4\2\ (only two folders back)
      2. Change in pack-v4.cmd
      Code:
      v4\2\3\UnrealPak.exe ..\..\..\newpak.pak
      to
      Code:
      v4\2\UnrealPak.exe ..\..\newpak.pak
      and in unpack-v4.cmd
      Code:
      v4\2\3\UnrealPak.exe
      to
      Code:
      v4\2\UnrealPak.exe
      Unpacked folders needs to be moved to
      Code:
      UnrealPakSwitch\King\Sample
      For 4.4 in Pack files tab you will need to change Replace with: to
      Code:
      ../../King/Sample/
      Now you can go back to previous tabs and continue with knowledge that some files are now different, but steps are the same if you take informations from here and change in previous tabs.
    • Thanks to panzi for u4pak.py (that i slightly modified for this package)
      https://github.com/panzi/u4pak
    • It will be updated with new informations in time.
      • *.ufont file is ttf font with only changed extension.
        If your file is f.e.
        Code:
        Ariadna.ufont
        change name to
        Code:
        Ariadna.ttf
        You can edit it without worry if you don't change config of this font inside font editor.
      • *.uexp is archive for data - in default it's not compressed nor encrypted, but it can be cofigured by devs if they want to modify the way how files are packed.
        *.uasset has informations about files inside uexp - their filenames and references - and how big is *.uexp file:
        Code:
        *size in bytes*-4 converted to Hex Little Endian
        f.e.
        1966078-4 = FAFF1D
        If you change size of *.uexp file and you don't change value inside *.uasset, game will not load.

        If you want to serialize informations included in them (f.e. stats of equipment), I recommend John Wick Parse. It extracts supported data to json files.
        https://github.com/SirWaddles/JohnWickParse/releases
      • *.locres - localization files. This is default way of saving strings, but it's not often used by devs. They prefer to create their own format and put to *.uexp file (f.e. Octopath Traveler).
      • Some games may use oodle compression for pak files (v8 can generate filelist with info about used compression method, if it's not custom).
        Unrealpak is then not usable without licensed paid Oodle SDK. But for unpacking you can use QuickBMS
        https://aluigi.altervista.org/quickbms.htm
        With this script
        https://gbatemp.net/threads/unpacking-sao-fatal-bullet-pak.545478/#post-8748129
        You don't need oodle for packing, default compression (zlib) will be readable by game, so you can follow this tutorial for packing files.
      • How to swap audio in Unreal Engine 4 games
        https://gbatemp.net/threads/how-to-swap-audio-in-unreal-engine-4-games.535516/

        Tool for extracting and making textures compatible with Switch
        https://gbatemp.net/threads/noesis-mod-tiling-texture-for-ue4.535571/
     

    Attached Files:

    Last edited by masagrator, May 8, 2020
  2. pandavova

    Member

    Joined:
    Oct 27, 2015
    Messages:
    892
    Country:
    Germany
    Hey, thanks for the tutorial!
     
  3. Kirby567fan

    Kirby567fan GBAtemp Fan
    Member

    Joined:
    Jan 6, 2018
    Messages:
    321
    Country:
    Morocco
    Does it mean resolutions and framerate modifications?
     
  4. masagrator

    OP masagrator The developper
    Member

    Joined:
    Oct 14, 2018
    Messages:
    3,072
    Country:
    Poland
    I don't know. I tried to modify FPS for Octopath Traveler, there were 3 files with FPS value, I have changed it and it does nothing. There are many graphic settings, but I don't know if they really work. Maybe it depends on each game.
     
    Last edited by masagrator, Feb 19, 2019
  5. Kirby567fan

    Kirby567fan GBAtemp Fan
    Member

    Joined:
    Jan 6, 2018
    Messages:
    321
    Country:
    Morocco
    Yoshi Crafted World demo could be an interesting case since in portable mode resolution really drops and the agressive depth of field really make those background so blurry. Will try various games tomorrow and I will give you result and also thanks for answering.
     
  6. Nazosan

    Nazosan GBAtemp Advanced Fan
    Member

    Joined:
    May 12, 2009
    Messages:
    504
    Country:
    United States
    So maybe I'm missing something really really obvious, but where can I actually get UnrealPak? I presume it's part of a main SDK or whatever, but I'm not even sure where that is. Is it at all possible to get it without downloading something huge even if so?
     
  7. masagrator

    OP masagrator The developper
    Member

    Joined:
    Oct 14, 2018
    Messages:
    3,072
    Country:
    Poland
    Read Requirements tab carefully. It's all there.
    It's possible, but not legal.
     
    Last edited by masagrator, Feb 20, 2019
  8. Kirby567fan

    Kirby567fan GBAtemp Fan
    Member

    Joined:
    Jan 6, 2018
    Messages:
    321
    Country:
    Morocco
    Actually unpacking v4 games with v5 works for me. Will test packing now.
     
  9. masagrator

    OP masagrator The developper
    Member

    Joined:
    Oct 14, 2018
    Messages:
    3,072
    Country:
    Poland
    I know. But it's because there are many versions that I needed to split it for pack.cmd, so if someone download only one Unreal Engine correct for their *.pak version, they will always have unpack.cmd to use.

    And there is no chance that higher version *.pak will work on lower Unreal Engine 4 game (with one exception). You can try to pack lower version for higher version game, but probably will be the same result.

    For v5 & v4 there are no differences except version in one byte for one file packed. For more files we have more differences.
    v7 has more differences even for one file.

    v4 worked for v5 game with one file as patch. So v5 should work for v4 with one file. v7 for v5 - crash.
    v4 may not work for v5 and vice versa with more than one file.
     
    Last edited by masagrator, Feb 21, 2019
  10. IHOP

    IHOP GBAtemp Regular
    Member

    Joined:
    Jul 11, 2018
    Messages:
    135
    Country:
    United States
    I can't be the only one wanting to see the OOT Unreal Engine remakes on switch. I don't even know if that's possible with this but lmao it'd be freaking awesome
     
  11. masagrator

    OP masagrator The developper
    Member

    Joined:
    Oct 14, 2018
    Messages:
    3,072
    Country:
    Poland
    Not possible.
     
  12. orangpelupa

    orangpelupa GBAtemp Regular
    Member

    Joined:
    Aug 7, 2009
    Messages:
    252
    Country:
    Indonesia
    maybe octopath traveler crash because it expect the extra PAK to be named as something special? when i looked at the files, i think i found a text something like "Kingship-Switch-01.pak"
     
  13. masagrator

    OP masagrator The developper
    Member

    Joined:
    Oct 14, 2018
    Messages:
    3,072
    Country:
    Poland
    I don't think so. I have tried to pack gametext from main pack to second pack with other files that were already there and I've put it as second pak. Result: crash. I think they implented a plugin that checks files inside *.pak archive with assets list inside them.
     
    Last edited by masagrator, Mar 6, 2019
  14. masagrator

    OP masagrator The developper
    Member

    Joined:
    Oct 14, 2018
    Messages:
    3,072
    Country:
    Poland
    Ok, my bad. It turns out that for Octopath patch needs to be named like the smallest file, but with next number and cannot be putted to subfolder.
    So now it works with Kingship-Switch_1_P.pak

    @orangpelupa If you are interested.
     
    Last edited by masagrator, Apr 1, 2019
  15. Kirby567fan

    Kirby567fan GBAtemp Fan
    Member

    Joined:
    Jan 6, 2018
    Messages:
    321
    Country:
    Morocco
    Did the mod you have applied to the game work?
     
  16. masagrator

    OP masagrator The developper
    Member

    Joined:
    Oct 14, 2018
    Messages:
    3,072
    Country:
    Poland
    Yes, first time it crashed system, but from second time it works flawlessly. I'm translating game, I've packed only modified fonts and texts and it works.
     
  17. Kirby567fan

    Kirby567fan GBAtemp Fan
    Member

    Joined:
    Jan 6, 2018
    Messages:
    321
    Country:
    Morocco
    Thats cool. Im also trying to modifie some games's resolution and graphics so they can profite from OCing.
     
  18. masagrator

    OP masagrator The developper
    Member

    Joined:
    Oct 14, 2018
    Messages:
    3,072
    Country:
    Poland
    Updated package with support for version 8 of Unreal Engine 4.22.
    Modified by me u4pak.py will show
    Code:
    Version: 8 or higher
    As there is no version header from this iteration of Unreal Engine, for now we can recognize it only because there is no other version of UnrealPak that it's hiding it.
    And for today newest version is "8", "higher" is only for future use when will be newer iterations of UnrealPak.
     
    Last edited by masagrator, Apr 10, 2019
  19. dnasdw

    dnasdw Newbie
    Newcomer

    Joined:
    Nov 19, 2015
    Messages:
    3
    Country:
    Switzerland
    There is no problem in Ocotopath Traveler's patch paks.
    But different version(between v1.0.0 and v1.0.2) will crash.

    reference url on github: /dnasdw/game_patches/releases/tag/octopath_Switch
     
  20. Shinigati

    Shinigati GBAtemp Fan
    Member

    Joined:
    Oct 31, 2012
    Messages:
    334
    Country:
    There is a problem with PixArk getting the following error:

    LogWindows: Error: === Critical error: ===
    LogWindows: Error:
    LogWindows: Error: Fatal error: [File:D:\Build\++UE4\Sync\Engine\Source\Runtime\Core\Private\GenericPlatform\GenericPlatformMemory.cpp] [Line: 212]
    LogWindows: Error: Ran out of memory allocating 18446744071819873553 bytes with alignment 0

    edit: please ignore my ignorance, i was dragging the file onto "pack" instead of "unpack" batch file.
     
    Last edited by Shinigati, Jun 1, 2019
Draft saved Draft deleted
Loading...

Hide similar threads Similar threads with keywords - unpack, repack, Unreal