-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In addition to the Windows interface version, Windows Console Linux Console has now been added.
- Loading branch information
1 parent
5a29b7b
commit 48292b7
Showing
6 changed files
with
191 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,52 @@ | ||
# Download PS4 Game Update | ||
|
||
It is possible to check the PS4 game update pkg directly from the PlayStation servers,<br> | ||
It is possible to check the PS4 game update pkg directly from the PlayStation servers, | ||
Providing the **"Title ID"** and **"PS4 HMAC-SHA256 Patch Pkg URL Key"** | ||
|
||
Download: https://github.com/DanielSvoboda/download_ps4_game_update/releases | ||
Download: [Download PS4 Game Update](https://github.com/DanielSvoboda/download_ps4_game_update/releases) | ||
- Windows Executable | ||
- Windows Console Executable | ||
- Linux Console Executable | ||
|
||
<img width="900" alt="portfolio_view" src="https://raw.githubusercontent.com/DanielSvoboda/download_ps4_game_update/main/Print1.png"> | ||
<img width="900" alt="portfolio_view" src="https://raw.githubusercontent.com/DanielSvoboda/download_ps4_game_update/main/Print2.png"> | ||
![Screenshot 1](https://raw.githubusercontent.com/DanielSvoboda/download_ps4_game_update/main/Print1.png) | ||
![Screenshot 2](https://raw.githubusercontent.com/DanielSvoboda/download_ps4_game_update/main/Print2.png) | ||
|
||
# Usage | ||
|
||
## Windows | ||
|
||
Enter the **"Title ID"** and **"HMAC-SHA256 Patch Pkg URL Key"** into their respective fields. | ||
Click **"Check Updates"** to retrieve information about the game update. | ||
|
||
## Windows Console | ||
|
||
1. Open Command Prompt and navigate to the directory where `download_ps4_game_update_console.exe` is located: | ||
```bash | ||
cd path/to/download_ps4_game_update_console | ||
``` | ||
|
||
2. Run the program with the required arguments: | ||
```bash | ||
download_ps4_game_update_console.exe -key <HMAC_SHA256_Patch_Pkg_URL_Key> -title <Title_ID> | ||
``` | ||
|
||
## Linux Console | ||
|
||
1. Download the `linux-x64.rar` file and extract it to a directory on your Linux machine. | ||
2. Open a terminal and navigate to the directory where `download_ps4_game_update_console` is located: | ||
```bash | ||
cd path/to/linux-x64/download_ps4_game_update | ||
``` | ||
|
||
3. Make the executable file `download_ps4_game_update_console` executable, if necessary: | ||
```bash | ||
chmod +x download_ps4_game_update_console | ||
``` | ||
4. Execute the program with the following command, providing the necessary arguments: | ||
```bash | ||
./download_ps4_game_update_console -key <HMAC_SHA256_Patch_Pkg_URL_Key> -title <Title_ID> | ||
``` | ||
<br><br><br> | ||
Replace `<HMAC_SHA256_Patch_Pkg_URL_Key>` and `<Title_ID>` with actual values. | ||
|
||
Make sure to replace `path/to/download_ps4_game_update_console` and `path/to/linux-x64/download_ps4_game_update` with the actual paths where `download_ps4_game_update_console` executable is located on your Windows and Linux systems respectively. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
using System; | ||
using System.Net; | ||
using System.Security.Cryptography; | ||
using System.Text; | ||
using System.Xml; | ||
|
||
namespace DownloadPS4GameUpdateConsole | ||
{ | ||
class Program | ||
{ | ||
static string urlKey = ""; | ||
static string titleId = ""; | ||
|
||
static void Main(string[] args) | ||
{ | ||
if (args.Length < 4 || args[0] != "-key" || args[2] != "-title") | ||
{ | ||
ShowHelp(); | ||
return; | ||
} | ||
|
||
urlKey = args[1]; | ||
titleId = args[3]; | ||
|
||
try | ||
{ | ||
string xmlUrl = $"http://gs-sec.ww.np.dl.playstation.net/plo/np/{titleId}/{GetHash(titleId)}/{titleId}-ver.xml"; | ||
|
||
XmlDocument xmlDoc = new XmlDocument(); | ||
xmlDoc.Load(xmlUrl); | ||
|
||
XmlNode titleNode = xmlDoc.SelectSingleNode("/titlepatch/tag/package[@version]"); | ||
string title = titleNode.SelectSingleNode("paramsfo/title").InnerText; | ||
string version = titleNode.Attributes["version"].Value; | ||
|
||
double sizeBytes = Convert.ToDouble(titleNode.Attributes["size"].Value); | ||
double sizeMB = sizeBytes / (1024 * 1024); | ||
|
||
XmlNode system_ver = xmlDoc.SelectSingleNode("/titlepatch/tag/package/@system_ver"); | ||
string hexadecimal = int.Parse(system_ver.Value).ToString("X8"); | ||
string system_ver_formatted = $"{hexadecimal.Substring(0, 2)}.{hexadecimal.Substring(2, 2)}"; | ||
|
||
Console.WriteLine($"Title: {title}"); | ||
Console.WriteLine($"Version: {version}"); | ||
Console.WriteLine($"Required Firmware: {system_ver_formatted}"); | ||
Console.WriteLine($"PKG Size: {(sizeMB > 1024 ? $"{sizeMB / 1024:0.##} GB" : $"{sizeMB:0.##} MB")}"); | ||
|
||
XmlNode manifestNode = xmlDoc.SelectSingleNode("/titlepatch/tag/package/@manifest_url"); | ||
if (manifestNode == null) | ||
{ | ||
throw new Exception("Manifest URL not found in XML."); | ||
} | ||
|
||
using (var client = new WebClient()) | ||
{ | ||
string json = client.DownloadString(manifestNode.Value); | ||
|
||
int index = json.IndexOf("\"pieces\":"); | ||
if (index < 0) | ||
{ | ||
throw new Exception("Expected JSON format not found."); | ||
} | ||
json = json.Substring(index + "\"pieces\":".Length); | ||
|
||
int urlStartIndex = json.IndexOf("\"url\":\""); | ||
while (urlStartIndex >= 0) | ||
{ | ||
urlStartIndex += "\"url\":\"".Length; | ||
int urlEndIndex = json.IndexOf("\"", urlStartIndex); | ||
string packageUrl = json.Substring(urlStartIndex, urlEndIndex - urlStartIndex); | ||
|
||
Console.WriteLine(packageUrl); | ||
|
||
urlStartIndex = json.IndexOf("\"url\":\"", urlEndIndex); | ||
} | ||
} | ||
|
||
//Console.WriteLine($"\r\nxmlUrl: {xmlUrl}"); | ||
//Console.WriteLine($"manifestUrl: {manifestNode.Value}"); | ||
} | ||
catch (Exception ex) | ||
{ | ||
Console.WriteLine($"Error loading and parsing XML: {ex.Message}"); | ||
} | ||
} | ||
|
||
private static void ShowHelp() | ||
{ | ||
#if WINDOWS | ||
Console.WriteLine("Usage: download_ps4_game_update_console.exe -key <HMAC_SHA256_Patch_Pkg_URL_Key> -title <TitleId>"); | ||
#else | ||
Console.WriteLine("Usage: ./download_ps4_game_update_console -key <HMAC_SHA256_Patch_Pkg_URL_Key> -title <TitleId>"); | ||
#endif | ||
} | ||
|
||
|
||
private static string GetHash(string gameID) | ||
{ | ||
byte[] byteKey = StringToByteArray(urlKey); | ||
byte[] dataBytes = Encoding.UTF8.GetBytes($"np_{gameID}"); | ||
|
||
using (var hmacsha256 = new HMACSHA256(byteKey)) | ||
{ | ||
byte[] hashBytes = hmacsha256.ComputeHash(dataBytes); | ||
return BitConverter.ToString(hashBytes).Replace("-", "").ToLower(); | ||
} | ||
} | ||
|
||
public static byte[] StringToByteArray(string hex) | ||
{ | ||
int numberChars = hex.Length; | ||
byte[] bytes = new byte[numberChars / 2]; | ||
for (int i = 0; i < numberChars; i += 2) | ||
{ | ||
bytes[i / 2] = Convert.ToByte(hex.Substring(i, 2), 16); | ||
} | ||
return bytes; | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
download ps4 game update console/download ps4 game update console.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<RootNamespace>download_ps4_game_update_console</RootNamespace> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<AssemblyName>download_ps4_game_update_console</AssemblyName> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Condition="'$(OS)' == 'Windows_NT'"> | ||
<DefineConstants>WINDOWS</DefineConstants> | ||
</PropertyGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters