CRYOGENIC

Reverse Engineering the Classic Dune Game

Modernizing Cryo's iconic 1992 Dune adventure through hybrid ASM/C# technology powered by Spice86

Linux OSX Windows

About the Project

Cryogenic is an ambitious reverse engineering project dedicated to understanding and modernizing Cryo's Dune (CD Version, 1992) - one of the most atmospheric adventure games of the early 90s. Using the powerful Spice86 reverse engineering toolkit, we're gradually rewriting the game from x86 assembly into readable, maintainable C# code.

The game is fully playable right now, complete with sound and music support. As we continue to replace assembly routines with C# implementations, the codebase becomes more accessible to modern developers while preserving the exact behavior of the original DOS executable.

Supported DNCDPRG.EXE SHA256:

5f30aeb84d67cf2e053a83c09c2890f010f2e25ee877ebec58ea15c5b30cfff9

โš ๏ธ Note: The CD release of DUNE (version 3.7) must be obtained separately, as it is copyrighted material.

Game Screenshots

Desert Worm

Encounter with the mighty sandworm

Chani

Meeting with Chani

Spice Management

Managing spice resources

Harkonnen

Harkonnen confrontation

Project Goals

๐Ÿ”

Understand the Game

Deep dive into the inner workings of Dune's game engine, uncovering how Cryo implemented dialogue systems, resource management, and real-time strategy elements in the DOS era.

๐Ÿ”„

Incremental Rewriting

Gradually replace x86 assembly routines with clean, documented C# code while maintaining 100% behavioral compatibility with the original game.

๐Ÿ“š

Document Everything

Create comprehensive documentation of game mechanics, data structures, and algorithms to preserve this knowledge for future developers and gaming historians.

๐ŸŽฎ

Preserve Gaming History

Ensure this classic adventure game remains playable on modern systems and provide a foundation for potential future enhancements and ports.

๐Ÿ› ๏ธ

Educational Resource

Serve as a reference implementation for reverse engineering techniques and demonstrate the power of hybrid emulation approaches.

๐ŸŒ

Cross-Platform Support

Leverage .NET 8's cross-platform capabilities to run the game natively on Windows, macOS, and Linux without emulation layers.

The Spice86 Technology

What is Spice86?

Spice86 is a revolutionary reverse engineering toolkit and PC emulator specifically designed for 16-bit real mode x86 programs. Unlike traditional emulators that simply run old software, Spice86 enables you to gradually modernize legacy DOS applications by replacing assembly code with high-level C# implementations.

Built on .NET 8, Spice86 provides a unique hybrid execution model where the original DOS executable runs alongside your C# overrides, allowing for incremental reverse engineering and testing.

Key Features

๐Ÿ”„ Hybrid Execution

Run original DOS binaries while selectively replacing functions with C# implementations. Test your reverse-engineered code against the real thing in real-time.

๐Ÿ”ฌ Runtime Analysis

Collect memory dumps, execution traces, and runtime data while the program runs. Understand program behavior through dynamic analysis.

๐ŸŽฏ Ghidra Integration

Import runtime data into Ghidra for static analysis. Convert assembly segments into documented C# code with context from actual execution.

๐Ÿ› Advanced Debugging

Built-in debugger with GDB remote protocol support. Set breakpoints, inspect memory, and step through code with modern debugging tools.

๐ŸŽฎ Hardware Emulation

Complete support for VGA/EGA/CGA graphics, PC Speaker, AdLib, SoundBlaster, keyboard, and mouse. Run old games with full audiovisual fidelity.

๐ŸŒ Cross-Platform

Built on .NET 8 for Windows, macOS, and Linux. Modern, maintainable codebase accessible to contemporary developers.

How Cryogenic Uses Spice86

1

Override Registration

Cryogenic registers C# function overrides in DuneCdOverrideSupplier that replace specific assembly routines at runtime.

2

Segment Management

Memory segments (CS1=0x1000 for main code, CS2/3/4 for drivers, CS5=0xF000 for BIOS) are carefully managed to ensure accurate address translation.

3

Hybrid Execution

When DNCDPRG.EXE calls an overridden function, Spice86 redirects execution to the C# implementation. When the C# code returns, execution continues in assembly.

4

State Synchronization

Global game state accessors like globalsOnDs ensure C# code and assembly share the same memory, maintaining perfect compatibility.

Example: The VGA driver functions, originally in pure assembly, have been replaced with C# implementations in Overrides/VgaDriverCode.cs. These functions interact with the same frame buffers and registers as the original code, making the replacement transparent to the rest of the game.

Build & Run

Prerequisites

  • .NET 8 SDK
  • Dune CD Version 3.7 (DNCDPRG.EXE and DUNE.DAT) - must be obtained separately

Quick Start

# Clone the repository
git clone https://github.com/OpenRakis/Cryogenic
cd Cryogenic/src

# Build the project
dotnet build

# Run the game (basic mode)
dotnet run --Exe C:/path/to/dunecd/DNCDPRG.EXE --UseCodeOverride true -p 4096

Running with Audio

For the full experience with AdLib music and PCM sound effects:

cd Cryogenic/src/Cryogenic
dotnet publish
bin/Release/net8.0/publish/Cryogenic --Exe C:/path/to/dunecd/DNCDPRG.EXE --UseCodeOverride true -p 4096 -a "ADL220 SBP2227"

Note: Always use --UseCodeOverride true or your C# code won't execute!

Contributing Guide

We welcome contributions from developers of all skill levels! Whether you're experienced in reverse engineering or just getting started, there's a place for you in this project.

For detailed contribution guidelines, please see our CONTRIBUTING.md file.

Ways to Contribute

๐Ÿ” Reverse Engineering

Analyze assembly code, identify functions, and create C# implementations. Great for those who enjoy low-level programming and detective work.

  • โ€ข Identify and document game functions
  • โ€ข Convert assembly to C# overrides
  • โ€ข Verify behavioral equivalence

๐Ÿ“ Documentation

Help document game mechanics, data structures, and code functionality. Essential for making the project accessible.

  • โ€ข Document override functions
  • โ€ข Explain game mechanics
  • โ€ข Create tutorials and guides

๐Ÿงช Testing

Play the game, find bugs, and verify that C# overrides behave identically to the original assembly code.

  • โ€ข Test game scenarios
  • โ€ข Report behavioral differences
  • โ€ข Validate override implementations

๐Ÿ› ๏ธ Code Quality

Improve existing C# code, refactor for clarity, and add helpful comments. Make the codebase more maintainable.

  • โ€ข Refactor complex functions
  • โ€ข Add code comments
  • โ€ข Improve error handling

Getting Started

1

Fork & Clone

Fork the repository and clone it to your local machine.

git clone https://github.com/YOUR-USERNAME/Cryogenic.git
2

Set Up Development Environment

Install .NET 8 SDK, obtain the Dune CD files, and familiarize yourself with the codebase structure.

3

Pick an Issue

Check the issues page for tasks labeled good first issue or help wanted.

4

Create a Branch

Create a feature branch for your work.

git checkout -b feature/your-feature-name
5

Make Your Changes

Implement your changes, following the coding conventions described in the copilot-instructions.md.

6

Test Thoroughly

Run the game and verify your changes work correctly. Test edge cases and ensure no regressions.

7

Submit a Pull Request

Push your branch and open a pull request with a clear description of your changes.

Code of Conduct

We are committed to providing a welcoming and inclusive environment. Please be respectful, constructive, and professional in all interactions. See our contribution guidelines for more details.

Resources & Links