diff --git a/src/BizHawk.Emulation.Cores/Arcades/MAME/MAME.cs b/src/BizHawk.Emulation.Cores/Arcades/MAME/MAME.cs index 9f2a4790532..69828139ffc 100644 --- a/src/BizHawk.Emulation.Cores/Arcades/MAME/MAME.cs +++ b/src/BizHawk.Emulation.Cores/Arcades/MAME/MAME.cs @@ -22,7 +22,9 @@ public partial class MAME : IRomInfo [CoreConstructor(VSystemID.Raw.Arcade)] public MAME(CoreLoadParameters lp) { +#pragma warning disable CS0618 _gameFileName = Path.GetFileName(lp.Roms[0].RomPath.SubstringAfter('|')).ToLowerInvariant(); +#pragma warning restore CS0618 _syncSettings = lp.SyncSettings ?? new(); ServiceProvider = new BasicServiceProvider(this); @@ -174,8 +176,10 @@ static byte[] MakeRomData(IRomAsset rom) // mame expects chd files in a folder of the game name string MakeFileName(IRomAsset rom) => rom.Extension.ToLowerInvariant() is ".chd" +#pragma warning disable CS0618 ? gameName + '/' + Path.GetFileNameWithoutExtension(rom.RomPath.SubstringAfter('|')).ToLowerInvariant() + rom.Extension.ToLowerInvariant() : Path.GetFileNameWithoutExtension(rom.RomPath.SubstringAfter('|')).ToLowerInvariant() + rom.Extension.ToLowerInvariant(); +#pragma warning restore CS0618 foreach (var rom in roms) { diff --git a/src/BizHawk.Emulation.Cores/Computers/Amiga/UAE.cs b/src/BizHawk.Emulation.Cores/Computers/Amiga/UAE.cs index d2d8f4d9710..b2d8d915285 100644 --- a/src/BizHawk.Emulation.Cores/Computers/Amiga/UAE.cs +++ b/src/BizHawk.Emulation.Cores/Computers/Amiga/UAE.cs @@ -55,7 +55,11 @@ public partial class UAE : WaterboxCore private bool _nextDrivePressed; private int _correctedWidth; private string _chipsetCompatible = ""; - private string GetFullName(IRomAsset rom) => Path.GetFileName(rom.RomPath.SubstringAfter('|')); + + private string GetFullName(IRomAsset rom) +#pragma warning disable CS0618 + => Path.GetFileName(rom.RomPath.SubstringAfter('|')); +#pragma warning restore CS0618 public override int VirtualWidth => _correctedWidth; diff --git a/src/BizHawk.Emulation.Cores/Computers/DOS/DOSBox.cs b/src/BizHawk.Emulation.Cores/Computers/DOS/DOSBox.cs index fb4aef0e160..51f40029a6e 100644 --- a/src/BizHawk.Emulation.Cores/Computers/DOS/DOSBox.cs +++ b/src/BizHawk.Emulation.Cores/Computers/DOS/DOSBox.cs @@ -50,7 +50,11 @@ public sealed partial class DOSBox : WaterboxCore private int _currentCDROM = 0; private bool _disposed; - private string GetFullName(IRomAsset rom) => Path.GetFileName(rom.RomPath.SubstringAfter('|')); + private string GetFullName(IRomAsset rom) +#pragma warning disable CS0618 + => Path.GetFileName(rom.RomPath.SubstringAfter('|')); +#pragma warning restore CS0618 + private string GetFullName(IDiscAsset disk) => Path.GetFileName(disk.DiscData.Name.SubstringAfter('|')); // CD Handling logic @@ -81,7 +85,10 @@ public DOSBox(CoreLoadParameters lp) // Parsing rom files foreach (var file in _romAssets) { - switch (Path.GetExtension(file.RomPath)) +#pragma warning disable CS0618 + var filePath = file.RomPath; +#pragma warning restore CS0618 + switch (Path.GetExtension(filePath)) { case ".ima" or ".img" or ".xdf" or ".dmf" or ".fdd" or ".fdi" or ".nfd" or ".d88": _floppyDiskImageFiles.Add(file); @@ -96,7 +103,7 @@ public DOSBox(CoreLoadParameters lp) break; default: - throw new Exception($"Unrecognized input file provided: '{file.RomPath}'"); + throw new Exception($"Provided file was not recognised: \"{filePath}\""); } } @@ -209,7 +216,9 @@ public DOSBox(CoreLoadParameters lp) string floppyMountLine = "imgmount a "; foreach (var file in _floppyDiskImageFiles) { +#pragma warning disable CS0618 string floppyNewName = $"{FileNames.FD}{_floppyDiskCount}{Path.GetExtension(file.RomPath)}"; +#pragma warning restore CS0618 _exe.AddReadonlyFile(file.FileData, floppyNewName); floppyMountLine += floppyNewName + " "; _floppyDiskCount++; diff --git a/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.cs b/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.cs index a8fab896fd0..e2a589ed911 100644 --- a/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.cs +++ b/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.cs @@ -49,7 +49,9 @@ public DSDA(CoreLoadParameters lp) if (foundIWAD) { throw new ArgumentException( +#pragma warning disable CS0618 $"More than one IWAD provided. Trying to load '{wadFile.RomPath}', but IWAD '{_iwadName}' was already provided", +#pragma warning restore CS0618 paramName: nameof(lp)); } @@ -77,7 +79,9 @@ public DSDA(CoreLoadParameters lp) if (!recognized) { throw new ArgumentException( +#pragma warning disable CS0618 $"Unrecognized WAD provided: '{wadFile.RomPath}' has non-standard header.", +#pragma warning restore CS0618 paramName: nameof(lp)); } } @@ -210,7 +214,9 @@ public DSDA(CoreLoadParameters lp) if (_gameMode is LibDSDA.GameMode.Fail) { throw new ArgumentException( +#pragma warning disable CS0618 $"Could not load PWAD file: '{wadFile.RomPath}'", +#pragma warning restore CS0618 paramName: nameof(lp)); } } @@ -332,7 +338,10 @@ private void ConditionalArg(bool condition, string setting) } } - private string GetFullName(IRomAsset rom) => Path.GetFileName(rom.RomPath.SubstringAfter('|')); + private string GetFullName(IRomAsset rom) +#pragma warning disable CS0618 + => Path.GetFileName(rom.RomPath.SubstringAfter('|')); +#pragma warning restore CS0618 private static bool PlayerPresent(DoomSyncSettings syncSettings, int port) => port switch diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/3DS/Encore.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/3DS/Encore.cs index 4ed0e522432..11eb27730ea 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/3DS/Encore.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/3DS/Encore.cs @@ -60,7 +60,9 @@ private static void ResetEncoreResolver() [CoreConstructor(VSystemID.Raw.N3DS)] public Encore(CoreLoadParameters lp) { +#pragma warning disable CS0618 if (lp.Roms.Exists(static r => HawkFile.PathContainsPipe(r.RomPath))) +#pragma warning restore CS0618 { throw new InvalidOperationException("3DS does not support compressed ROMs"); } @@ -134,7 +136,9 @@ public Encore(CoreLoadParameters lp) _serviceProvider.Register(_encoreVideoProvider); +#pragma warning disable CS0618 var romPath = lp.Roms[0].RomPath; +#pragma warning restore CS0618 if (".cia".EqualsIgnoreCase(lp.Roms[0].Extension)) { var message = new byte[1024]; @@ -177,7 +181,9 @@ public Encore(CoreLoadParameters lp) throw new ArgumentException(paramName: nameof(lp), message: "ROMs after the first ROM should be CIAs"); } +#pragma warning disable CS0618 _core.Encore_InstallCIA(_context, lp.Roms[i].RomPath, dummyBuffer, dummyBuffer.Length); +#pragma warning restore CS0618 } var errorMessage = new byte[1024]; diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/BSNES/BsnesCore.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/BSNES/BsnesCore.cs index 7f9e925656d..e4e08ffe260 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/BSNES/BsnesCore.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/BSNES/BsnesCore.cs @@ -25,7 +25,9 @@ public BsnesCore(CoreLoadParameters loadParamete var ser = new BasicServiceProvider(this); ServiceProvider = ser; +#pragma warning disable CS0618 this._romPath = Path.ChangeExtension(loadParameters.Roms[0].RomPath.SubstringBefore('|'), null); +#pragma warning restore CS0618 CoreComm = loadParameters.Comm; _syncSettings = loadParameters.SyncSettings ?? new SnesSyncSettings(); SystemId = loadParameters.Game.System; diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES9X/Snes9x.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES9X/Snes9x.cs index f89539e8c62..3f49574aacd 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES9X/Snes9x.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES9X/Snes9x.cs @@ -30,7 +30,9 @@ public Snes9x(CoreLoadParameters loadParameters) SystemId = VSystemID.Raw.SNES, }) { +#pragma warning disable CS0618 this._romPath = Path.ChangeExtension(loadParameters.Roms[0].RomPath.SubstringBefore('|'), null); +#pragma warning restore CS0618 this._currentMsuTrack = new ProxiedFile(); LibSnes9x.OpenAudio openAudioCb = MsuOpenAudio; diff --git a/src/BizHawk.Emulation.Cores/CoreLoadParameters.cs b/src/BizHawk.Emulation.Cores/CoreLoadParameters.cs index 2165dac711f..d335a7466ff 100644 --- a/src/BizHawk.Emulation.Cores/CoreLoadParameters.cs +++ b/src/BizHawk.Emulation.Cores/CoreLoadParameters.cs @@ -12,6 +12,7 @@ public interface IRomAsset string Extension { get; } + [Obsolete("you should never have to use this property, Game.Name and Extension should be sufficient")] // not deprecated, do not remove string RomPath { get; } /// diff --git a/src/BizHawk.Emulation.Cores/Waterbox/NymaCore.cs b/src/BizHawk.Emulation.Cores/Waterbox/NymaCore.cs index c66b72d929b..01b21733353 100644 --- a/src/BizHawk.Emulation.Cores/Waterbox/NymaCore.cs +++ b/src/BizHawk.Emulation.Cores/Waterbox/NymaCore.cs @@ -57,7 +57,9 @@ protected T DoInit( { return DoInit( lp.Roms.Select(r => (r.RomData, +#pragma warning disable CS0618 Path.GetFileName(r.RomPath.SubstringAfter('|')).ToLowerInvariant())).ToArray(), +#pragma warning restore CS0618 lp.Discs.Select(d => d.DiscData).ToArray(), wbxFilename, lp.Roms.FirstOrDefault()?.Extension,