@@ -101,35 +101,44 @@ public Response SubmitScore(RequestContext context, GameUser user, GameServerCon
101101 GameDatabaseContext database , string slotType , int id , SerializedScore body , Token token ,
102102 DataContext dataContext )
103103 {
104+ // Try to not return any non-OK responses for LBP PSP here, since that apparently bugs the game
105+
104106 if ( user . IsWriteBlocked ( config ) )
105- return Unauthorized ;
107+ return context . IsPSP ( ) ? OK : Unauthorized ;
106108
107109 GameLevel ? level = database . GetLevelByIdAndType ( slotType , id ) ;
108- if ( level == null ) return NotFound ;
110+ if ( level == null ) return context . IsPSP ( ) ? OK : NotFound ;
109111
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)
111113 if ( ! database . HasUserPlayedLevel ( level , user ) && ! context . IsPSP ( ) )
112114 {
113115 return Unauthorized ;
114116 }
115117
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 ( ) )
118121 {
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+ }
120134 }
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
125136 {
126- return BadRequest ;
137+ body . ScoreType = 1 ;
127138 }
128139
129140 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 ) ;
133142
134143 this . AwardScoreboardPins ( scores , dataContext , user , level ) ;
135144
0 commit comments