Skip to content

Update Cryogenic to Spice86 v12 NuGet#54

Merged
maximilien-noal merged 5 commits intomainfrom
copilot/update-cryogenic-to-spice86-v12
Apr 4, 2026
Merged

Update Cryogenic to Spice86 v12 NuGet#54
maximilien-noal merged 5 commits intomainfrom
copilot/update-cryogenic-to-spice86-v12

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 3, 2026

Bumps the Spice86 NuGet dependency from 11.1.0 to 12.0.0 and migrates the codebase to the breaking API changes introduced in v12, which also requires upgrading the target framework from net8.0 to net10.0.

Changes

  • Cryogenic.csproj: TargetFrameworknet10.0, Spice8612.0.0

  • Overrides/Overrides.cs:

    • using Spice86.Core.Emulator.Function.Dumpusing Spice86.Core.Emulator.StateSerialization (MemoryDataExporter relocated)
    • machine.Cpu.State.SegmentRegistersmachine.CpuState.SegmentRegisters (Machine.Cpu removed)
    • DumpMemoryWithSuffix: constructor no longer accepts RecordedDataDirectory; DumpMemory(suffix) replaced with Write(path) via Path.Combine
  • Overrides/MT32DriverCode.cs: Cpu.Out16(0x330, AX)Machine.IoPortDispatcher.WriteWord(0x330, AX) (Cpu removed from CSharpOverrideHelper)

  • Overrides/TimerCode.cs: Pit8254Counter / Timer.GetCounter() / counter properties removed in v12 (PitChannel is now internal). Replaced with direct PIT port I/O:

    // Before (v11)
    Pit8254Counter counter = timer.GetCounter(0);
    counter.ReadWritePolicy = 0;
    counter.Mode = 3;
    counter.Bcd = false;
    counter.Configure(valueToSet);
    
    // After (v12)
    Machine.Timer.WriteByte(0x43, 0x36); // ch0, both bytes, mode 3, binary
    Machine.Timer.WriteByte(0x40, (byte)(valueToSet & 0xFF));
    Machine.Timer.WriteByte(0x40, (byte)(valueToSet >> 8));

Rationale behind Changes

Spice86 v12 targets net10.0 exclusively and ships several breaking API removals: Machine.Cpu flattened into Machine.CpuState, Pit8254Counter internalized as PitChannel, MemoryDataExporter relocated and its constructor simplified, and CSharpOverrideHelper.Cpu removed in favour of Machine.IoPortDispatcher.

Suggested Testing Steps

Build with dotnet build from src/Cryogenic (must succeed with 0 errors). Runtime validation requires launching the game with dotnet run --Exe <path/to/DNCDPRG.EXE> --UseCodeOverride true and 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
    • Triggering command: /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)
    • Triggering command: /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 &#34;mcp-server-playwright&#34; --viewport-size &#39;1280, 720&#39; --output-dircredential.helper (dns block)
    • Triggering command: /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
    • Triggering command: /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:

Copilot AI and others added 3 commits April 3, 2026 22:23
…, 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>
Copilot AI changed the title [WIP] Update Cryogenic to spice86 v12 and ensure everything compiles Update Cryogenic to Spice86 v12 NuGet Apr 3, 2026
Copilot AI requested a review from maximilien-noal April 3, 2026 22:34
@maximilien-noal maximilien-noal marked this pull request as ready for review April 4, 2026 05:55
Copilot AI review requested due to automatic review settings April 4, 2026 05:55
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

Call to 'System.IO.Path.Combine' may silently drop its earlier arguments.

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, inside DumpMemoryWithSuffix, 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.

Suggested changeset 1
src/Cryogenic/Overrides/Overrides.cs

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/Cryogenic/Overrides/Overrides.cs b/src/Cryogenic/Overrides/Overrides.cs
--- a/src/Cryogenic/Overrides/Overrides.cs
+++ b/src/Cryogenic/Overrides/Overrides.cs
@@ -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);
     }
 
EOF
@@ -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);
}

Copilot is powered by AI and may make mistakes. Always verify output.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Spice86 from 11.1.0 to 12.0.0 and update TargetFramework to net10.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.

@maximilien-noal maximilien-noal merged commit 5807f49 into main Apr 4, 2026
4 checks passed
@maximilien-noal maximilien-noal deleted the copilot/update-cryogenic-to-spice86-v12 branch April 4, 2026 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants