Skip to content

Commit

Permalink
Split LBP PSP user avatars from mainline avatars
Browse files Browse the repository at this point in the history
Closes #184
  • Loading branch information
jvyden committed Oct 2, 2023
1 parent 6a4dad9 commit c4f72b6
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Refresh.GameServer/Database/GameDatabaseProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ protected GameDatabaseProvider(IDateTimeProvider time)
this._time = time;
}

protected override ulong SchemaVersion => 86;
protected override ulong SchemaVersion => 87;

protected override string Filename => "refreshGameServer.realm";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ private void FillInExtraData(GameUser old, TokenGame gameVersion)
_ => throw new ArgumentOutOfRangeException(nameof(gameVersion), gameVersion, null),
};

//Fill out the used slots
// Fill out slot usage information
switch (gameVersion)
{
case TokenGame.LittleBigPlanet3: {
Expand Down Expand Up @@ -140,5 +140,11 @@ private void FillInExtraData(GameUser old, TokenGame gameVersion)
default:
throw new ArgumentOutOfRangeException(nameof(gameVersion), gameVersion, null);
}

// Apply PSP-specific icon hashes
if (gameVersion == TokenGame.LittleBigPlanetPSP)
{
this.IconHash = old.PspIconHash;
}
}
}
3 changes: 3 additions & 0 deletions Refresh.GameServer/Endpoints/Game/UserEndpoints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ public SerializedUserList GetMultipleUsers(RequestContext context, GameDatabaseC
case TokenGame.LittleBigPlanet3:
data.Lbp3PlanetsHash = data.PlanetsHash;
break;
case TokenGame.LittleBigPlanetPSP:
data.PspIconHash = data.IconHash;
break;
}

database.UpdateUserData(user, data);
Expand Down
9 changes: 9 additions & 0 deletions Refresh.GameServer/Types/UserData/GameUser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ public partial class GameUser : IRealmObject, IRateLimitUser
public bool ShouldResetPassword { get; set; }

public string IconHash { get; set; } = "0";

/// <summary>
/// The <see cref="IconHash"/>, except only for PSP clients.
/// </summary>
/// <remarks>
/// PSP doesn't support remote assets, and instead only uses it's own GUID icon hashes, which cant be loaded by other clients.
/// Hopefully this explains why this distinction is necessary.
/// </remarks>
public string PspIconHash { get; set; } = "0";

public string Description { get; set; } = "";
public GameLocation Location { get; set; } = GameLocation.Zero;
Expand Down
1 change: 1 addition & 0 deletions Refresh.GameServer/Types/UserData/SerializedUpdateData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public class SerializedUpdateData
[XmlIgnore] public string? Lbp2PlanetsHash { get; set; }
[XmlIgnore] public string? Lbp3PlanetsHash { get; set; }
[XmlIgnore] public string? VitaPlanetsHash { get; set; }
[XmlIgnore] public string? PspIconHash { get; set; }

[XmlElement("icon")]
public string? IconHash { get; set; }
Expand Down

0 comments on commit c4f72b6

Please sign in to comment.