1313using System . IO ;
1414using System . Reflection ;
1515using System . Linq ;
16- using System . Threading ;
1716using Newtonsoft . Json . Linq ;
1817using RomM . Settings ;
1918using Playnite . SDK . Events ;
2019using RomM . Games ;
21- using System . Security ;
2220
2321
2422namespace RomM
@@ -211,8 +209,9 @@ public override IEnumerable<GameMetadata> GetGames(LibraryGetGamesArgs args)
211209
212210 JArray apiPlatforms = FetchPlatforms ( ) ;
213211 List < GameMetadata > games = new List < GameMetadata > ( ) ;
212+ IEnumerable < EmulatorMapping > enabledMappings = SettingsViewModel . Instance . Mappings ? . Where ( m => m . Enabled ) ;
214213
215- foreach ( var mapping in SettingsViewModel . Instance . Mappings ? . Where ( m => m . Enabled ) )
214+ foreach ( var mapping in enabledMappings )
216215 {
217216 if ( args . CancelToken . IsCancellationRequested )
218217 break ;
@@ -246,7 +245,7 @@ public override IEnumerable<GameMetadata> GetGames(LibraryGetGamesArgs args)
246245
247246 NameValueCollection queryParams = new NameValueCollection
248247 {
249- { "size " , "10000" } ,
248+ { "limit " , "10000" } ,
250249 { "platform_id" , apiPlatform [ "id" ] . ToString ( ) }
251250 } ;
252251
@@ -259,8 +258,8 @@ public override IEnumerable<GameMetadata> GetGames(LibraryGetGamesArgs args)
259258
260259 // Assuming the response is in JSON format
261260 string body = response . Content . ReadAsStringAsync ( ) . GetAwaiter ( ) . GetResult ( ) ;
262- JObject jsonObject = JObject . Parse ( body ) ;
263- var items = jsonObject [ "items" ] . Children ( ) ;
261+ JArray jsonObject = JArray . Parse ( body ) ;
262+ var items = jsonObject . Children ( ) ;
264263 var installDir = PlayniteApi . Paths . IsPortable ? mapping . DestinationPathResolved . Replace ( PlayniteApi . Paths . ApplicationPath , ExpandableVariables . PlayniteDirectory ) : mapping . DestinationPathResolved ;
265264
266265 // Return a GameMetadata for each item in the response
0 commit comments