-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prepare for upcoming RPCN ticket changes (#659)
- Loading branch information
Showing
2 changed files
with
60 additions
and
34 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
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,31 @@ | ||
using Bunkum.Core; | ||
using NPTicket; | ||
using Refresh.GameServer.Authentication; | ||
|
||
namespace Refresh.GameServer.Extensions; | ||
|
||
public static class TicketExtensions | ||
{ | ||
public static TokenPlatform? DeterminePlatform(this Ticket ticket) | ||
{ | ||
if (ticket.SignatureIdentifier == "RPCN" || ticket.IssuerId == 0x33333333) | ||
return TokenPlatform.RPCS3; | ||
|
||
if (ticket.IssuerId == 0x100) | ||
return TokenPlatform.PS3; | ||
|
||
return null; | ||
} | ||
|
||
public static TokenGame? DetermineGame(this Ticket ticket, RequestContext context) | ||
{ | ||
TokenGame? game = null; | ||
|
||
// check if we're connecting from a beta build | ||
bool parsedBeta = byte.TryParse(context.QueryString.Get("beta"), out byte isBeta); | ||
if (parsedBeta && isBeta == 1) game = TokenGame.BetaBuild; | ||
|
||
game ??= TokenGameUtility.FromTitleId(ticket.TitleId); | ||
return game; | ||
} | ||
} |