@@ -101,35 +101,44 @@ public Response SubmitScore(RequestContext context, GameUser user, GameServerCon
101
101
GameDatabaseContext database , string slotType , int id , SerializedScore body , Token token ,
102
102
DataContext dataContext )
103
103
{
104
+ // Try to not return any non-OK responses for LBP PSP here, since that apparently bugs the game
105
+
104
106
if ( user . IsWriteBlocked ( config ) )
105
- return Unauthorized ;
107
+ return context . IsPSP ( ) ? OK : Unauthorized ;
106
108
107
109
GameLevel ? level = database . GetLevelByIdAndType ( slotType , id ) ;
108
- if ( level == null ) return NotFound ;
110
+ if ( level == null ) return context . IsPSP ( ) ? OK : NotFound ;
109
111
110
- // A user has to play a level in order to submit a score
112
+ // A user has to play a level in order to submit a score (unless the game is LBP PSP)
111
113
if ( ! database . HasUserPlayedLevel ( level , user ) && ! context . IsPSP ( ) )
112
114
{
113
115
return Unauthorized ;
114
116
}
115
117
116
- // Validate the score is a non-negative amount and not above the in-game limit
117
- if ( body . Score is < 0 or > 16_000_000 )
118
+ // LBP PSP doesn't have any score limits, and checking the score type isn't really useful
119
+ // since there is no multiplayer in that game
120
+ if ( ! context . IsPSP ( ) )
118
121
{
119
- return BadRequest ;
122
+ // Validate the score is a non-negative amount and not above the in-game limit
123
+ if ( body . Score is < 0 or > 16_000_000 )
124
+ {
125
+ return BadRequest ;
126
+ }
127
+
128
+ // Ensure score type is valid
129
+ // Only valid values are 1-4 players and 7 for versus
130
+ if ( body . ScoreType is ( > 4 or < 1 ) and not 7 )
131
+ {
132
+ return BadRequest ;
133
+ }
120
134
}
121
-
122
- // Ensure score type is valid
123
- // Only valid values are 1-4 players and 7 for versus
124
- if ( body . ScoreType is ( > 4 or < 1 ) and not 7 )
135
+ else
125
136
{
126
- return BadRequest ;
137
+ body . ScoreType = 1 ;
127
138
}
128
139
129
140
GameScore score = database . SubmitScore ( body , token , level ) ;
130
-
131
- DatabaseList < ScoreWithRank > ? scores = database . GetRankedScoresAroundScore ( score , 5 ) ;
132
- Debug . Assert ( scores != null ) ;
141
+ DatabaseList < ScoreWithRank > scores = database . GetRankedScoresAroundScore ( score , 5 ) ;
133
142
134
143
this . AwardScoreboardPins ( scores , dataContext , user , level ) ;
135
144
0 commit comments