Emulator code structure - Vita3K/Vita3K GitHub Wiki
Purpose
This page describes the code inside src/emulator
directory tree.
Common themes
It's worth noting that each library generally falls into one of two categories:
- A stateless collection of utility functions
- A stateful module corresponding to a subset of Vita functionality
Stateful modules tend to have a public interface divided into data structures (state.h
) and functions (functions.h
). OOP is generally discouraged at the moment but it's not clear whether the current approach is better or just different. Certainly C++-style OOP tends to inflate compile times because naive C++ OOP lacks adequate implementation-hiding mechanisms.
See recommended viewing.
Structure
app
GUI window and graphics rendering backend initiation and management.
audio
Maintains audio-related state and mixes audio.
codec
Multimedia decodification and video/audio player for games.
compat
Used to display compatibility in the emulator.
config
YAML configuration file management and CLI argument parsing.
cpu
CPU emulation. Uses Unicorn and dynarmic internally but that's largely hidden from the rest of the emulator. While the emulator does create real threads to implement SCE threads, the cpu
library is unaware of threads. Each virtual CPU corresponds to a thread and, like threads, virtual CPUs share the same address space.
ctrl
Defines controller state data structures.
dialog
PS Vita OS dialog handling. This folder contains the code necessary to handle the calls from the game to create native PS Vita OS dialogs.
display
Control state of display.
emuenv
This is the interface between the emulator application and the HLE module exports. It groups together the other modules, and the resulting overall EmuEnvState
structure is passed as a parameter to every HLE export.
features
Host setup check for emulation features and optimizations.
gdbstub
GDB integration.
glutil
OpenGL utilities, to ease management of OpenGL objects.
gui
UI elements management code. In fact, many functions handled by the GUI are implemented by this part.
gxm
Defines GXM module state data structures.
host
Host operating system abstraction layer.
http
Headers used for http are included here.
ime
Header files for ime.
io
Input/Output such as file or TTY access.
kernel
Low-level process management tasks like threading.
lang
Management lang and translation.
mem
Memory management. This library handles both allocation and address space management, somewhat conflating the two. Does not currently follow the state/functions paradigm, but probably should.
module
Utilities required by HLE modules. Bridging deserves some special attention.
modules
An interface library grouping all the HLE modules together into one library so emulator
can depend on them easily.
Within modules
, there is a large collection of HLE module exports. The structure is generated by gen-exports
.
motion
PS Vita motion emulation.
net
Ground code for SceNet
.
ngs
Handles PS Vita ngs
audio API.
nids
Utilities for dealing with NIDs. Contains a header of all NIDs and names, generated by gen-modules
. Should probably be merged with modules
.
np
Handles PS Vita Np
trophy API.
packages
PS Vita software package handling.
regmgr
Registory manager.
renderer
OpenGL and Vulkan implementations.
rtc
Real Time Clock. Time and clock implementation.
script
Update script for Vita3K.
shaders
Hand-written GLSL shaders to which the GXM HLE loads when the game tries to compile a shader. There's a GPU reverse engineering effort underway which could eventually remove the use for hand-written shaders.
shaders-builtin
Built in shaders for Vita3K such as FXAA and FSR.
thereads
Thread management.
touch
PS Vita touchscreen emulation.
util
Generic utilities. This library has a terrible name and should probably be merged into an existing library or split up and each new library named better.
vkutil
Vulkan utilities, to ease management of Vulkan objects.