From 8787840a0bc247811cf4eaabe91cfa9a5861fbba Mon Sep 17 00:00:00 2001 From: Slendy Date: Tue, 10 Sep 2024 09:38:43 -0500 Subject: [PATCH 1/3] Identify platform based on signature identifier instead of issuer id --- ProjectLighthouse/Tickets/NPTicket.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/ProjectLighthouse/Tickets/NPTicket.cs b/ProjectLighthouse/Tickets/NPTicket.cs index 69173d7c4..1890fafa7 100644 --- a/ProjectLighthouse/Tickets/NPTicket.cs +++ b/ProjectLighthouse/Tickets/NPTicket.cs @@ -160,13 +160,17 @@ private static bool ReadTicket(NPTicket npTicket, TicketReader reader) } // Production PSN Issuer ID: 0x100 - // RPCN Issuer ID: 0x33333333 - npTicket.Platform = npTicket.IssuerId switch + // The RPCN signature identifier is always 'RPCN' in ascii + + npTicket.Platform = npTicket.TicketSignatureIdentifier switch { - 0x100 => Platform.PS3, - 0x33333333 => Platform.RPCS3, - 0x74657374 => Platform.UnitTest, - _ => Platform.Unknown, + [0x52, 0x50, 0x43, 0x4E,] => Platform.RPCS3, // 'RPCN' in ascii + [0x54, 0x45, 0x53, 0x54,] => Platform.UnitTest, // 'TEST' in ascii + _ => npTicket.IssuerId switch + { + 0x100 => Platform.PS3, + _ => Platform.Unknown, + } }; if (npTicket.GameVersion == GameVersion.LittleBigPlanetVita) npTicket.Platform = Platform.Vita; From 4d879b1422d2395506e08215fc71c12212115840 Mon Sep 17 00:00:00 2001 From: Slendy Date: Tue, 10 Sep 2024 10:41:07 -0500 Subject: [PATCH 2/3] Use signature identifier to identify PS3 --- ProjectLighthouse/Tickets/NPTicket.cs | 32 +++++++++------------------ 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/ProjectLighthouse/Tickets/NPTicket.cs b/ProjectLighthouse/Tickets/NPTicket.cs index 1890fafa7..23ff8bffb 100644 --- a/ProjectLighthouse/Tickets/NPTicket.cs +++ b/ProjectLighthouse/Tickets/NPTicket.cs @@ -78,19 +78,13 @@ private static bool ReadTicket(NPTicket npTicket, TicketReader reader) if (!ticketParser.ParseTicket()) return false; - // Create a uint in big endian - uint signatureIdentifier = (uint)(npTicket.TicketSignatureIdentifier[0] << 24 | - npTicket.TicketSignatureIdentifier[1] << 16 | - npTicket.TicketSignatureIdentifier[2] << 8 | - npTicket.TicketSignatureIdentifier[3]); - - npTicket.SignatureVerifier = signatureIdentifier switch + npTicket.SignatureVerifier = npTicket.TicketSignatureIdentifier switch { - 0x5250434E => new RpcnSignatureVerifier(npTicket), - 0x719F1D4A => new PsnSignatureVerifier(npTicket), - 0x54455354 => new UnitTestSignatureVerifier(npTicket), + [0x71, 0x9F, 0x1D, 0x4A,] => new PsnSignatureVerifier(npTicket), // PSN LBP Signature Identifier + [0x52, 0x50, 0x43, 0x4E,] => new RpcnSignatureVerifier(npTicket), // 'RPCN' in ascii + [0x54, 0x45, 0x53, 0x54,] => new UnitTestSignatureVerifier(npTicket), // 'TEST' in ascii _ => throw new ArgumentOutOfRangeException(nameof(npTicket), - signatureIdentifier, + npTicket.TicketSignatureIdentifier, @"Invalid signature identifier"), }; @@ -159,18 +153,12 @@ private static bool ReadTicket(NPTicket npTicket, TicketReader reader) return null; } - // Production PSN Issuer ID: 0x100 - // The RPCN signature identifier is always 'RPCN' in ascii - - npTicket.Platform = npTicket.TicketSignatureIdentifier switch + npTicket.Platform = npTicket.SignatureVerifier switch { - [0x52, 0x50, 0x43, 0x4E,] => Platform.RPCS3, // 'RPCN' in ascii - [0x54, 0x45, 0x53, 0x54,] => Platform.UnitTest, // 'TEST' in ascii - _ => npTicket.IssuerId switch - { - 0x100 => Platform.PS3, - _ => Platform.Unknown, - } + PsnSignatureVerifier => Platform.PS3, + RpcnSignatureVerifier => Platform.RPCS3, + UnitTestSignatureVerifier => Platform.UnitTest, + _ => Platform.Unknown, }; if (npTicket.GameVersion == GameVersion.LittleBigPlanetVita) npTicket.Platform = Platform.Vita; From c4a5f7ece939449c7392c6d4037752e747252895 Mon Sep 17 00:00:00 2001 From: Slendy Date: Tue, 10 Sep 2024 10:43:55 -0500 Subject: [PATCH 3/3] Remove extra whitespace --- ProjectLighthouse/Tickets/NPTicket.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ProjectLighthouse/Tickets/NPTicket.cs b/ProjectLighthouse/Tickets/NPTicket.cs index 23ff8bffb..e2fc02834 100644 --- a/ProjectLighthouse/Tickets/NPTicket.cs +++ b/ProjectLighthouse/Tickets/NPTicket.cs @@ -155,7 +155,7 @@ private static bool ReadTicket(NPTicket npTicket, TicketReader reader) npTicket.Platform = npTicket.SignatureVerifier switch { - PsnSignatureVerifier => Platform.PS3, + PsnSignatureVerifier => Platform.PS3, RpcnSignatureVerifier => Platform.RPCS3, UnitTestSignatureVerifier => Platform.UnitTest, _ => Platform.Unknown,