Overview
Oboromi implements High-Level Emulation (HLE) for Nintendo Switch 2 firmware services. Rather than running original firmware code, the emulator reimplements 160+ services in Rust that games call through system APIs.HLE trades accuracy for performance and simplicity. Services are reimplemented based on reverse-engineered behavior rather than executing original firmware binaries.
Service Architecture
Service Organization
Services are organized into two main modules:core/src/nn/: Service implementationscore/src/sys/: System state and service container
Service Definition
Macro-Based Generation
Services are defined using thedefine_service! macro to reduce boilerplate:
- State structure
- Constructor
- ServiceTrait implementation
- Registration logic
Service Catalog
Complete Service List
Oboromi defines 160 services covering all system functionality:Service Categories
Input Services
hid- Human Interface Deviceshidbus- HID bus managementirs- IR sensorahid- Auxiliary HID
Audio Services
aud- Audio coreaudren- Audio rendereraudin- Audio inputaudout- Audio outputaudrec- Audio recordinghwopus- Hardware Opus codec
Graphics Services
vi- Visual interfacevi2- Visual interface v2nvdrv- NVIDIA driverdisp- Display management
Filesystem Services
fs- Filesystemfsp_srv- Filesystem servicefsp_ldr- Filesystem loaderfsp_pr- Filesystem PR
Network Services
nifm- Network interfacebsd- BSD socketsdns- DNS resolutionssl- SSL/TLSwlan- Wireless LAN
System Services
pm- Process managerldr- Loadersm- Service managerfatal- Fatal error handler
Service Container
Services Structure
All active services are stored in theServices struct:
Option<T>, allowing lazy initialization:
None= Service not yet initializedSome(state)= Service active and ready
System State
The global system state combines services with GPU state:Service Initialization
Startup Sequence
Services are registered at emulator startup:- Creates a table of (name, init function) pairs
- Calls each service’s
run()method - Services register themselves in
state.services
Service Registration
Each service registers itself whenrun() is called:
Service Trait
TheServiceTrait defines the interface all services implement:
Service Implementation Pattern
Typical Service Structure
A fully implemented service would look like:Service Communication
Services communicate with games through system calls:Call Flow
IPC Structure
Inter-Process Communication (IPC) messages contain:- Command ID: Which function to call
- Input Buffer: Request data
- Output Buffer: Response data
- Handles: File descriptors, memory handles, etc.
Key Services
Filesystem Service (fs)
Handles all file I/O:
- Open files from ROM, save data, SD card
- Read/write operations
- Directory enumeration
- File metadata
HID Service (hid)
Manages input devices:
- Controller input (buttons, analog sticks)
- Touch screen
- Accelerometer/gyroscope
- Vibration/rumble
Audio Renderer (audren)
Processes game audio:
- Mix audio streams
- Apply effects (reverb, filters)
- Output to speakers/headphones
- Microphone input
NVIDIA Driver (nvdrv)
GPU interface:
- Submit GPU commands
- Allocate GPU memory
- Create graphics contexts
- Manage command buffers
Network Interface (nifm)
Network connectivity:
- WiFi connection management
- IP configuration
- Network status monitoring
- Internet connectivity checks
Development Status
Service Implementation Progress
Currently, all 160 services are registered but most contain only stub implementations. The macro-generated structure is in place, but actual functionality is being added incrementally.
| Status | Count | Description |
|---|---|---|
| Registered | 160 | Service structure exists |
| Stubbed | 160 | Empty implementation with todo!() |
| Partially Implemented | 0 | Some commands work |
| Fully Implemented | 0 | All commands functional |
Service Priorities
Implementation order based on importance:-
High Priority
fs- Required for loading gameshid- Essential for inputnvdrv- GPU functionalityvi- Display output
-
Medium Priority
audren- Audio playbacknifm- Network (for online games)pm- Process managementapplet_ae- System applets
-
Low Priority
- Debug services (
dmnt,nvdbg) - Manufacturing services (
manu) - Specialized hardware (
i2c,gpio)
- Debug services (
Testing Services
Service Test Pattern
Adding a New Service
Step-by-Step Guide
- Add to macro invocation:
- Add to Services struct:
- Add to initialization table:
- Implement service logic (override macro-generated stub):
Best Practices
When implementing services:
- Start with stubs: Return success for all commands initially
- Log calls: Add logging to understand what games call
- Implement incrementally: Add one command at a time
- Match Nintendo behavior: Reverse-engineer exact return values
- Handle errors gracefully: Don’t crash on unknown commands
Future Enhancements
- IPC Layer: Proper message parsing and serialization
- Service Manager: Dynamic service lookup and handles
- Async Services: Non-blocking service calls
- Service Versioning: Support multiple firmware versions
- Plugin System: Allow external service implementations
Related Documentation
- Architecture Overview - System architecture
- CPU Architecture - How services are called from CPU
