Work-in-progress Nintendo Switch emulator, written in Rust and slightly less focused on gaming

Overview

pegasus

Work-in-progress Nintendo Switch emulator, written in pure Rust and slightly less focused on gaming

Information

  • This project aims to be a different emulator, not one mostly focused on gaming but slightly more inclined on the developer path. However, it is still in a quite early stage, so it's aim may or may not eventually change.

  • This project has a semi-HLE design goal: the only components which will be implemented in the emulator itself are the kernel and sysmodules (those where getting the actual component to work would likely be more complicated than actually implementing them myself)

  • Unlike other emulators which are built around the idea of just launching whatever they get opened with, this project aims to emulate an actual console.

    • This is why the project requires system titles to be placed inside the NAND like an actual console, since it will launch them (HOME menu, etc.) almost like a normal console would, excluding emulated components.

Config and keys

When launched, if not already present, pegasus will create a default config file, default NAND/SD directories, all of them on the current working directory. It will then look for a prod.keys in the same directory, panicking if the keyset is invalid or not present.

Config file

The config file, config.cfg, is a JSON file with the following fields:

Field Type Default value (when created) Description
nand_system_path string {cwd}/nand_system NAND system path, where system titles are located
nand_user_path string {cwd}/nand_user NAND user path (where titles installed on console will be located?)
sd_card_path string {cwd}/sd_card SD card path

Source layout

Since this ain't a small project, here are some guidelines about how this project's source code is structured:

  • Everything emulation-specific goes inside emu module.

  • All emulated processes go inside proc:: module while they have their types at module (since other processes may use them), and use submodules for any IPC interfaces they have.

  • Results for a certain module are placed in ::result and all follow a similar format, using a macro to define them.

  • Due to some questionable design thoughts on the official Unicorn Rust bindings, this project makes use of a custom version (see unicorn-rs)

Credits

  • Unicorn as the CPU engine for this emulator, basically doing the hard job of this kind of project.

  • Ryujinx was mostly the base for this project - most of the kernel was implemented based on Ryujinx's, and several design thoughts for this emulator came from its design.

  • Atmosphere's kernel and sm reimplementations were really helpful for this project's implementations.

  • cntx libraries (guess who coded them) for exploring several formats (NCA, PFS0, etc.)

TODO

  • Make logging slightly more verbose, maybe add a log message to the result error?

  • Memory support in kernel (+ memory SVCs)

  • Buffer support in kernel IPC code (which needs kernel memory support)

  • Keep implementing more processes and services

  • The various todo!s left here and there in the code

You might also like...
A interactive and fun to use memory game written in Rust

memg - Memory Game memg is a interactive and fun to use memory game written in rust Installation Make sure you have rust installed. Use this official

Small game where you play a big spider chasing small spiders, written in Rust and Macroquad.
Small game where you play a big spider chasing small spiders, written in Rust and Macroquad.

Ludum Dare #49 Compo entry - Procedural Spider Small game where you play a big spider chasing small spiders. Each spider you catch makes you bigger! C

A competitive and fun crossword game written in Rust.

Worders Crossword Game Worders is a competitive and fun crossword game where you create words using your given letters in order to score points, when

A small, portable and extensible game framework written in Rust.
A small, portable and extensible game framework written in Rust.

What is This? Crayon is a small, portable and extensible game framework, which loosely inspired by some amazing blogs on bitsquid, molecular and flooo

An adventure survival voxel game written using Bevy and Rust.

An adventure survival voxel game written using Bevy and Rust.

This is a Minecraft Classic server written in Rust powered by tokio and classicl.

classicl_server Introduction This is a Minecraft Classic server written in Rust powered by tokio and classicl. Installation Cargo The project can be i

A Team Fortress 2 SDK written in Rust that I update every now and then

tf-rs A Team Fortress 2 SDK written in Rust that I update every now and then. Most of this has been written in early November. I've published it so th

A safe, fast and cross-platform 2D component-based game framework written in rust

shura shura is a safe, fast and cross-platform 2D component-based game framework written in rust. shura helps you to manage big games with a component

A performant, small and versatile entity component system written in Rust
A performant, small and versatile entity component system written in Rust

A performant, zero-dependency ECS library with a nice API written in Rust. Usage # Cargo.toml [dependecies] kiwi-ecs = "1.3" // lib.rs use kiwi_ecs::

Comments
  • aarch64-switch-rs's nx crate and code duplication

    aarch64-switch-rs's nx crate and code duplication

    A big part of this project's code (mostly userland IPC client/server code) was copy-pasted from the aforementioned crate and slightly modified, and several types are a direct copy too.

    It might be desirable to split the nx crate into several crates, so that one of them just contains plain types in order to avoid code duplication from other projects using them but not wanting/being able to include everything in the full crate, like in this case.

    opened by XorTroll 0
Owner
XorTroll
Nintendo homebrew developer (C++ mainly), videogame enthusiast - switching between my 2DS and my Switch
XorTroll
Morphosis is a work-in-progress set of tools to deal with Minecraft metadata, mainly for use with PolyMC.

Morphosis Morphosis is a work-in-progress set of tools to deal with Minecraft metadata, mainly for use with PolyMC. It consists of a library (metamorp

cozyGalvinism 3 May 3, 2022
Work-in-Progress NES / Famicon Image Editor & Map Creator

NESImg An extremely work-in-progress tool for making NES/Famicom-compatible images. When faced with the challenge of formatting artwork in a way that

Katharos Technology 10 Nov 24, 2022
Work-in-Progress, opinionated game framework built on Bevy.

Bones A work-in-progress, opinionated game meta-engine built on Bevy. Under development for future use in the Jumpy game, and possibly other FishFolk

Fish Folk 9 Jan 3, 2023
Entity Component System focused on usability and speed.

Shipyard βš“ Shipyard is an Entity Component System focused on usability and speed. If you have any question or want to follow the development more clos

Dylan Ancel 524 Jan 1, 2023
A 2D rust game engine focused on portability.

The Cross Platform Engine Emerald is designed to be as lightweight as possible, while remaining a fully-featured and cross-platform game engine. The a

bombfuse 480 Dec 28, 2022
πŸš€ A universe in progress

Verse Download Get the latest release! Controls Action Keyboard Controller Thrust W, ↑ RT Turn left A, ← LS ← Turn right D, β†’ LS β†’ Fire Space A/X Paus

Thom Bruce 4 Oct 28, 2023
A Gameboy Color Emulator written in Rust

A Gameboy Color Emulator written in Rust

Mathijs van de Nes 512 Dec 23, 2022
A chip-8 emulator in Rust, using raylib for graphics.

A chip-8 emulator in Rust, using raylib for graphics.

AndrΓ© Nogueira 2 Apr 16, 2022
A no-frills Tetris implementation written in Rust with the Piston game engine, and Rodio for music.

rustris A no-frills Tetris implementation written in Rust with the Piston game engine, and Rodio for music. (C) 2020 Ben Cantrick. This code is distri

Ben Cantrick 17 Aug 18, 2022
Text Renderer written in Rust using HarfBuzz for shaping, FreeType for rasterization and OpenGL for rendering.

Provok Text Renderer written in Rust using HarfBuzz for shaping, FreeType for rasterization and OpenGL for rendering. Input Provok is fed with a JSON

Ossama Hjaji 67 Dec 10, 2022