Announcement

Collapse
No announcement yet.

How to retrieve the map name/URL from pak files (short: list all maps)

Collapse
This is a sticky topic.
X
X
  • Filter
  • Time
  • Show
Clear All
new posts

    [TUTORIAL] How to retrieve the map name/URL from pak files (short: list all maps)

    tl;dr Need to know the map path? Want to list maps? Check the "Easy approach" (script file) or shell/bash script

    Preamble:
    The engine uses pak files. Most of the pak files consist of important data for the engine (versioning etc.) but also a single map file. This map file is a *.umap similar to the umap from the editor. Exactly this file is required to open a map. Let's take a look on how to retieve these filenames / file paths.

    The trivial approach

    Ask the author for the path


    The lazy approach
    • Install the file and start the game
    • Select any gametype to list that map and start it
    • Close the game
    • Open your log file
      • Windows: %userprofile%\Documents\UnrealTournament\Saved\Logs\UnrealTournament.log
      • Linux: ?
      • Mac: ?

    • Search for the string "LoadMap:" which will forward to a line like this:
      LogLoad: LoadMap: /Game/RestrictedAssets/Maps/DM-Outpost23?Name=Player?VersionCheck=1?Hat=
      The map file is mostly the first parameter until the character "?".



    The technical approach (Editor/Git version required)
    • Browse to the binaries folder of your editor version of UT:
      UnrealTournamentEditor\Engine\Binaries\Win64\
      .
    • Open the command prompt from that path
      (hold shift and then rightclick on an empty place, choose "Open command window here")
      .
    • Enter the following line and replace PAKFILE with your full path of your pak file. This file doesn't need to be installed.
      UnrealPak.exe "PAKFILE" -list
      [ATTACH=CONFIG]19491[/ATTACH]
      .
    • This will output a long list of files included in the pak file. Check for a string like this:
      LogPakFile:Display: "Content/Maps/DM-MalevolenceUT4-V09.umap" 20240422 bytes.
      Click image for larger version

Name:	UnrealPakCommandWindowOutput.png
Views:	1
Size:	25.7 KB
ID:	358059

      This is path can be used by replacing "Content/" with "/Game/"
      /Game/Maps/DM-MalevolenceUT4-V09.umap



    The easy approach (as long as you have python / Windows executable)

    Step by step
    .
    • Setup
    • Place the file into your Paks folder (or anywhere you like)
    • Open the console (in order to start the script) and use the following command
      py ./ListMaps.py <FILE|FOLDER> Windows Exe: ListMaps.exe <FILE|FOLDER>
      Note:
      For Windows, you can just drag and drop any file/folder from within the explorer.
      .
    • An output looks like this:
      Click image for larger version

Name:	ListMapsOutputCmd.png
Views:	1
Size:	42.3 KB
ID:	358060 Click image for larger version

Name:	ListMapsOutputBash.png
Views:	1
Size:	50.2 KB
ID:	358061


    Drag'n'drop bat / one-liner command
    Here is a better usage of the UnrealPak program.
    • Copy the following line and adjust the path to fit your needs
      cmd /S /K " "C:\Program Files\Epic Games\UnrealTournamentEditor\Engine\Binaries\Win64\UnrealPak" "C:\Program Files\Epic Games\UnrealTournamentDev\UnrealTournament\Content\Paks\UnrealTournament-WindowsNoEditor.pak" -list | find ".umap" "
    • Press Win+R
    • Paste the (modified) line and press Enter
    • A new Windows prompt will open with the listed maps.


    For proper usage in Windows:
    • Create a text file and paste the following content (adjust the install location to your needs) [or download this file]
      Code:
      @echo off
      set InstallLocation=C:\Program Files\Epic Games\UnrealTournamentEditor
      set UnrealPak=Engine\Binaries\Win64\UnrealPak.exe
      
      set file=%*
      set file=%file:/=\%
      set file=%file:\\=\%
      
      set EXE=%InstallLocation%\%UnrealPak%
      set EXE=%EXE:\\=\%
      
      ECHO.%file%| FIND /I ":\">Nul && ( 
      	set file=%file%
      ) || (
      	set file=%cd%\%1
      )
      
      set file=%file:"=%
      set file="%file%"
      
      echo Maps for %~n1%~x1
      echo --------------------------
      "%EXE%" %file% -list | find ".umap"
      echo.
      pause
    • Save as *.bat/*.cmd (such as ListMaps.bat)
    • Use it from a command prompt or drag a pak-file onto it
      Note: The parameters are automatically quoted.



    The last approach

    If any previous approach isn't something for you, let's just face the fact, strings are stored plain text in a pak file.
    • Just open the pak in a Hex editor or any text editor which opens large files
    • Search for ".umap"
    • Copy the text to the left (until a NUL character is there)
    • That path might look like this:
      UnrealTournament/Content/RestrictedAssets/Tutorials/TUT-WeaponTraining.umap
      or for custom maps:
      Content/RestrictedAssets/Tutorials/TUT-WeaponTraining.umap
      .
    • There you have your path / name
      (keep in mind the path needs to be corrected, replace "Content/" or "UnrealTournament/Content/" with "Game/")




    The bash/shell script (Linux/Mac/Cygwin required)
    • Create a file and paste the following content (adjust the install location to your needs) [or download this file]
      (credits to samarties for his initial script)
      Code:
      #!/bin/bash
      
      listmaps()
      {
      	# Specify map path.
      	inpak=$1
      
      	# Retrieve raw map path from file.
      	rawMapPath=$(tac $inpak | grep -m 1 -oUaP "[^\x00]+\x2e\x75\x6d\x61\x70" | grep -m 1 -oUaP ".*[^\x2e\x75\x6d\x61\x70]");
      
      	# Replace portions of map path.
      	mapPath=$(echo $rawMapPath | sed "s/^\(UnrealTournament\/\)\?Content/Game/g");
      
      	# Generate md5 checksum.
      	mapChecksum=$(md5sum $inpak | awk '{ print $1 }');
      
      	echo "$(basename $inpak) $mapPath $mapChecksum";
      }
      
      args=$@
      if [ -d $args ] ; then
      
      	paksDir=$args
      	for pak in $(find $paksDir -name "*.pak" ! -name "UnrealTournament-*.pak");
      	do
      		listmaps $pak
      	done
      
      else
      	if ! [ -f "$args" ] ; then
      		echo "No such file/folder: $args"
      		return 1
      	fi
      
      	listmaps $args
      fi
    • Save as *.sh/*.bash (such as listmaps.sh)
    • Use it from a bash/shell/terminal:
      bash ./listmaps.sh
      You can specify a custom path/file as parameter:
      bash ./listmaps.sh /my/path/myfile
      Note: You can also set the executable flag in order to call the script directly.
      .
    • This will output a long list of files with the path and the MD5 checksum:
      Click image for larger version

Name:	ListMapsShellOutput.png
Views:	1
Size:	6.4 KB
ID:	360058

      The output comes in the format of "Filename Filepath Checksum" with each line being a map.



    Note:
    Signed/compressed packages might look different. I might check how they look and update the steps
    Last edited by RattleSN4K3; 10-30-2015, 02:02 PM. Reason: Added new ways.
    ] Map Scaler Tool | Betrayal for UT4 | No Spawn Protection | No Pickup Timer | BioLauncher (revived) | ForcePickupSpawn | Map cosmetics::P | Safe Spawn::P | Why numbers for Health/Armor suck!::ANALYSIS/CONCEPT
    ] UT3 Addons: NoMoreDemoGuy | PickupRespawnTweak | Mutate Spec | MutePawnSounds | NoPlayerBeacon | Epic FTW | Epic FOCK | TripodSound (... and many more)

    #2
    Props for the python code. Nice!

    Comment


      #3
      Looks like this will be super useful since they want to scan the hard drive for all assets 90million times before the match even starts when you use short name for MapRotation.
      UT4 Mutators: [Server Config] [Monster Announcer]
      UT4 Maps: [Ported UT99 Maps]

      Comment


        #4
        There is an even lazier approach.
        The way I do it sometimes is to launch the map with "START LAN GAME" and then I read the live log, from the console that pops up. That way you don't have to close the game or navigate to your documents.
        > FreezeTag [Blueprint]
        > Reimagining of Greed [BluePrint]
        > Avarice, a DM-variant of Greed [BluePrint]

        Comment


          #5
          I stuck this, helpful information for new server admins trying to get custom content running.

          Thanks RattleSN4K3!

          Comment


            #6
            For some reason with the latest build, when I try to run "UnrealPak.exe" i get an error message saying the files isnt found. I am sure I am in the correct location, I tried both from the Win64 engine folder and the editor folder.
            PayBack

            Comment


              #7
              The path is still the same:
              Code:
              .\Engine\Binaries\Win64\UnrealPak.exe
              One liner:
              "C:\Program Files\Epic Games\UnrealTournamentEditor\Engine\Binaries\Win64\UnrealPak" "C:\Program Files\Epic Games\UnrealTournamentDev\UnrealTournament\Content\Paks\UnrealTournament-WindowsNoEditor.pak" -list | find ".umap"
              ] Map Scaler Tool | Betrayal for UT4 | No Spawn Protection | No Pickup Timer | BioLauncher (revived) | ForcePickupSpawn | Map cosmetics::P | Safe Spawn::P | Why numbers for Health/Armor suck!::ANALYSIS/CONCEPT
              ] UT3 Addons: NoMoreDemoGuy | PickupRespawnTweak | Mutate Spec | MutePawnSounds | NoPlayerBeacon | Epic FTW | Epic FOCK | TripodSound (... and many more)

              Comment


                #8
                In your line, you dont have the .exe after UnrealPak.
                PayBack

                Comment


                  #9
                  It's not important on Windows systems. bat, com and exe don't need an extension. I intentionally left the extension. There may be a time where the UnrealPak.exe could be a GUI program and a UnrealPak.com would be the DOS-program inside the same folder. Com is therefore prioritized.
                  Last edited by RattleSN4K3; 09-10-2015, 10:59 AM.
                  ] Map Scaler Tool | Betrayal for UT4 | No Spawn Protection | No Pickup Timer | BioLauncher (revived) | ForcePickupSpawn | Map cosmetics::P | Safe Spawn::P | Why numbers for Health/Armor suck!::ANALYSIS/CONCEPT
                  ] UT3 Addons: NoMoreDemoGuy | PickupRespawnTweak | Mutate Spec | MutePawnSounds | NoPlayerBeacon | Epic FTW | Epic FOCK | TripodSound (... and many more)

                  Comment


                    #10
                    Here is a better usage of the UnrealPak program.
                    • Press Win+R
                    • Paste the following line and press Enter
                      cmd /S /K " "C:\Program Files\Epic Games\UnrealTournamentEditor\Engine\Binaries\Win64\UnrealPak" "C:\Program Files\Epic Games\UnrealTournamentDev\UnrealTournament\Content\Paks\UnrealTournament-WindowsNoEditor.pak" -list | find ".umap" "


                    For proper usage in Windows:
                    • Create a text file and paste the following content (adjust the install location to your needs) [or download this file]
                      Code:
                      @echo off
                      set InstallLocation=C:\Program Files\Epic Games\UnrealTournamentEditor
                      set UnrealPak=Engine\Binaries\Win64\UnrealPak.exe
                      
                      set file=%*
                      set file=%file:/=\%
                      set file=%file:\\=\%
                      
                      set EXE=%InstallLocation%\%UnrealPak%
                      set EXE=%EXE:\\=\%
                      
                      ECHO.%file%| FIND /I ":\">Nul && ( 
                      	set file=%file%
                      ) || (
                      	set file=%cd%\%1
                      )
                      
                      set file=%file:"=%
                      set file="%file%"
                      
                      echo Maps for %~n1%~x1
                      echo --------------------------
                      "%EXE%" %file% -list | find ".umap"
                      echo.
                      pause
                    • Save as *.bat/*.cmd (such as ListMaps.bat)
                    • Use it from a command prompt or drag a pak-file onto it
                      Note: The parameters are automatically quoted.
                    Last edited by RattleSN4K3; 09-10-2015, 04:54 PM. Reason: Replaced gist (no line breaks).
                    ] Map Scaler Tool | Betrayal for UT4 | No Spawn Protection | No Pickup Timer | BioLauncher (revived) | ForcePickupSpawn | Map cosmetics::P | Safe Spawn::P | Why numbers for Health/Armor suck!::ANALYSIS/CONCEPT
                    ] UT3 Addons: NoMoreDemoGuy | PickupRespawnTweak | Mutate Spec | MutePawnSounds | NoPlayerBeacon | Epic FTW | Epic FOCK | TripodSound (... and many more)

                    Comment


                      #11
                      Hell of a time saver. Thank you!

                      Comment


                        #12
                        You da man. Works very well. I had started writing one of my own, but it was a bruteforce regex unlike yours that understands the pak format and I stopped polishing it once I saw the git commits related to the commandlet. Thanks for this.
                        My UT4 Video channel: https://www.youtube.com/channel/UCmn...0ysqE_3wuv1usQ

                        Comment


                          #13
                          Is UnrealPak.exe recently no longer included? I have the client and server files both installed on a Windows box and I can't find that executable anywhere. Also, I have no map listings in the log files. Are there any log options that need to be set besides -log on the startup?

                          Comment


                            #14
                            UnrealPak only comes with the full UE4 engine, the UT editor or from the Git version of either UT or UE4. No client or server build has it included.

                            Originally posted by EagerLearner View Post
                            Also, I have no map listings in the log files. Are there any log options that need to be set besides -log on the startup?
                            "-Log" is the only requirement so far. However, each single build could have the specific log entries being suppressed. The server would only list the single entry when you open a map (haven't checked the recent builds; *downloading*). Otherwise, I'm not fully sure what you meant by "no map listings in the log files".
                            ] Map Scaler Tool | Betrayal for UT4 | No Spawn Protection | No Pickup Timer | BioLauncher (revived) | ForcePickupSpawn | Map cosmetics::P | Safe Spawn::P | Why numbers for Health/Armor suck!::ANALYSIS/CONCEPT
                            ] UT3 Addons: NoMoreDemoGuy | PickupRespawnTweak | Mutate Spec | MutePawnSounds | NoPlayerBeacon | Epic FTW | Epic FOCK | TripodSound (... and many more)

                            Comment


                              #15
                              Was using a friends account by accident. Posting from my account now.

                              I downloaded the UE4 Engine from the Launcher and still don't have the UnrealPak.exe. Can you:

                              1) post a link to a download that will have this
                              2) PM me a dropbox link to the file itself

                              Comment

                              Working...
                              X