Skip to content

Commit

Permalink
Fix regression in population of Emulator dropdown in mappings in sett…
Browse files Browse the repository at this point in the history
…ings
  • Loading branch information
psychonic committed Jul 4, 2023
1 parent af1b71b commit 52eefba
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 22 deletions.
34 changes: 13 additions & 21 deletions EmuLibrary/Settings/EmuLibrarySettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,6 @@ public class EmuLibrarySettings : ObservableObject, ISettings

public static EmuLibrarySettings Instance { get; private set; }

[JsonIgnore]
public IEnumerable<Emulator> Emulators {
get
{
return _plugin.PlayniteApi.Database.Emulators.OrderBy(x => x.Name);
}
}

[JsonIgnore]
public IEnumerable<EmulatedPlatform> Platforms
{
get
{
return _plugin.PlayniteApi.Emulation.Platforms.OrderBy(x => x.Name);
}
}

public class ROMInstallerEmulatorMapping : ObservableObject
{
public ROMInstallerEmulatorMapping() { }
Expand All @@ -56,7 +39,7 @@ public Emulator Emulator
{
get
{
return Instance?.Emulators.FirstOrDefault(e => e.Id == EmulatorId);
return AvailableEmulators.FirstOrDefault(e => e.Id == EmulatorId);
}
set
{
Expand Down Expand Up @@ -85,7 +68,7 @@ public EmulatedPlatform Platform
{
get
{
return Instance?.Platforms.FirstOrDefault(p => p.Id == PlatformId);
return AvailablePlatforms.FirstOrDefault(p => p.Id == PlatformId);
}
set
{
Expand Down Expand Up @@ -120,12 +103,21 @@ public IEnumerable<string> ImageExtensionsLower
public string DestinationPath { get; set; }
public RomType RomType { get; set; }

[JsonIgnore]
public IEnumerable<Emulator> AvailableEmulators
{
get
{
return Instance.PlayniteAPI.Database.Emulators.OrderBy(x => x.Name);
}
}

[JsonIgnore]
public IEnumerable<EmulatorProfile> AvailableProfiles
{
get
{
var emulator = Instance?.Emulators.FirstOrDefault(e => e.Id == EmulatorId);
var emulator = AvailableEmulators.FirstOrDefault(e => e.Id == EmulatorId);
return emulator?.SelectableProfiles;
}
}
Expand All @@ -152,7 +144,7 @@ public IEnumerable<EmulatedPlatform> AvailablePlatforms
validPlatforms = new List<string>();
}

return Instance.Platforms.Where(p => validPlatforms.Contains(p.Id));
return Instance.PlayniteAPI.Emulation.Platforms.Where(p => validPlatforms.Contains(p.Id));
}
}

Expand Down
2 changes: 1 addition & 1 deletion EmuLibrary/Settings/EmuLibrarySettingsView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<ComboBox Name="ComboEmulators" DockPanel.Dock="Left"
ItemsSource="{Binding Emulators}"
ItemsSource="{Binding AvailableEmulators}"
DisplayMemberPath="Name"
SelectedItem="{Binding Emulator, Mode=TwoWay}"
>
Expand Down

0 comments on commit 52eefba

Please sign in to comment.