Update Cryogenic to Spice86 v12 NuGet#54
Conversation
Agent-Logs-Url: https://github.com/OpenRakis/Cryogenic/sessions/20c8dc5c-cec2-4de7-8f31-0421e797651f Co-authored-by: maximilien-noal <1087524+maximilien-noal@users.noreply.github.com>
…, PitTimer Agent-Logs-Url: https://github.com/OpenRakis/Cryogenic/sessions/20c8dc5c-cec2-4de7-8f31-0421e797651f Co-authored-by: maximilien-noal <1087524+maximilien-noal@users.noreply.github.com>
Agent-Logs-Url: https://github.com/OpenRakis/Cryogenic/sessions/20c8dc5c-cec2-4de7-8f31-0421e797651f Co-authored-by: maximilien-noal <1087524+maximilien-noal@users.noreply.github.com>
| if (!Directory.Exists(dumpDirectory)) { | ||
| Directory.CreateDirectory(dumpDirectory); | ||
| } | ||
| string path = Path.Combine(dumpDirectory, $"spice86dumpMemoryDump{suffix}.bin"); |
Check notice
Code scanning / CodeQL
Call to 'System.IO.Path.Combine' may silently drop its earlier arguments Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 9 days ago
In general, to avoid Path.Combine silently dropping earlier arguments when a later argument is absolute, use Path.Join when you are forming a path where all components are intended to be relative, or ensure the later components are sanitized so they cannot be absolute. Path.Join performs concatenation with the correct directory separators but does not treat an absolute later component as overriding earlier ones.
The best minimal fix here is to change the construction of path in DumpMemoryWithSuffix from Path.Combine to Path.Join. This keeps the existing behavior for all current relative suffixes and directory values, while removing the risk that a future absolute suffix might cause the directory to be ignored. Since System.IO.Path is in mscorlib/System.Private.CoreLib, no new imports or dependencies are required beyond what is already implied by the use of Path. The only edit needed is on the line where path is assigned.
Specifically:
- In
src/Cryogenic/Overrides/Overrides.cs, insideDumpMemoryWithSuffix, replace:string path = Path.Combine(dumpDirectory, $"spice86dumpMemoryDump{suffix}.bin");
with:string path = Path.Join(dumpDirectory, $"spice86dumpMemoryDump{suffix}.bin");
No other methods, imports, or definitions are needed.
| @@ -177,7 +177,7 @@ | ||
| if (!Directory.Exists(dumpDirectory)) { | ||
| Directory.CreateDirectory(dumpDirectory); | ||
| } | ||
| string path = Path.Combine(dumpDirectory, $"spice86dumpMemoryDump{suffix}.bin"); | ||
| string path = Path.Join(dumpDirectory, $"spice86dumpMemoryDump{suffix}.bin"); | ||
| new MemoryDataExporter(Memory, Machine.CallbackHandler, Configuration, _loggerService).Write(path); | ||
| } | ||
|
|
There was a problem hiding this comment.
Pull request overview
Updates Cryogenic to work with the breaking changes in Spice86 v12 by upgrading the Spice86 NuGet dependency and adapting override code to the new VM/serialization/IO APIs, including a target framework bump required by the new package.
Changes:
- Bump
Spice86from11.1.0to12.0.0and updateTargetFrameworktonet10.0. - Migrate override code to Spice86 v12 API changes (CPU state access, memory dump exporter API, and port I/O APIs).
- Replace PIT counter configuration API usage with direct PIT port I/O writes.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/Cryogenic/Cryogenic.csproj |
Moves project to net10.0 and updates Spice86 package reference to v12. |
src/Cryogenic/Overrides/Overrides.cs |
Updates CPU state access and adapts memory dump export to the new MemoryDataExporter API. |
src/Cryogenic/Overrides/MT32DriverCode.cs |
Uses Machine.IoPortDispatcher for MIDI port word writes (replacing removed Cpu helper). |
src/Cryogenic/Overrides/TimerCode.cs |
Replaces removed PIT counter abstraction with explicit PIT port programming sequence. |
Bumps the Spice86 NuGet dependency from
11.1.0to12.0.0and migrates the codebase to the breaking API changes introduced in v12, which also requires upgrading the target framework fromnet8.0tonet10.0.Changes
Cryogenic.csproj:TargetFramework→net10.0,Spice86→12.0.0Overrides/Overrides.cs:using Spice86.Core.Emulator.Function.Dump→using Spice86.Core.Emulator.StateSerialization(MemoryDataExporterrelocated)machine.Cpu.State.SegmentRegisters→machine.CpuState.SegmentRegisters(Machine.Cpuremoved)DumpMemoryWithSuffix: constructor no longer acceptsRecordedDataDirectory;DumpMemory(suffix)replaced withWrite(path)viaPath.CombineOverrides/MT32DriverCode.cs:Cpu.Out16(0x330, AX)→Machine.IoPortDispatcher.WriteWord(0x330, AX)(Cpuremoved fromCSharpOverrideHelper)Overrides/TimerCode.cs:Pit8254Counter/Timer.GetCounter()/ counter properties removed in v12 (PitChannelis nowinternal). Replaced with direct PIT port I/O:Rationale behind Changes
Spice86 v12 targets
net10.0exclusively and ships several breaking API removals:Machine.Cpuflattened intoMachine.CpuState,Pit8254Counterinternalized asPitChannel,MemoryDataExporterrelocated and its constructor simplified, andCSharpOverrideHelper.Cpuremoved in favour ofMachine.IoPortDispatcher.Suggested Testing Steps
Build with
dotnet buildfromsrc/Cryogenic(must succeed with 0 errors). Runtime validation requires launching the game withdotnet run --Exe <path/to/DNCDPRG.EXE> --UseCodeOverride trueand verifying normal game startup, MT-32 MIDI output, and clean shutdown (the timer override is exercised on quit).Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
av-build-tel-api-v1.avaloniaui.net/usr/share/dotnet/dotnet dotnet exec --runtimeconfig /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.2/tools/netstandard2.0/runtimeconfig.json /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.2/tools/netstandard2.0/Avalonia.BuildServices.Collector.dll(dns block)/usr/share/dotnet/dotnet dotnet exec --runtimeconfig /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.2/tools/netstandard2.0/runtimeconfig.json /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.2/tools/netstandard2.0/Avalonia.BuildServices.Collector.dll "mcp-server-playwright" --viewport-size '1280, 720' --output-dircredential.helper(dns block)/usr/share/dotnet/dotnet dotnet exec --runtimeconfig /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.2/tools/netstandard2.0/runtimeconfig.json /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.2/tools/netstandard2.0/Avalonia.BuildServices.Collector.dll get --global oslyn/bincore/VBCSCompiler credential.helpeiptables(dns block)www.nuget.org/home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js(dns block)If you need me to access, download, or install something from one of these locations, you can either: