neser 0.1.1

NESER - NES Emulator in Rust - is a NES emulator written in Rust. It aims to be a high-quality, hardware-accurate emulator that is also easy to use and extend. It supports a wide range of NES games and features, including various mappers, audio processing, and input handling. NESER is designed to be modular and extensible, allowing developers to easily add new features or support for additional hardware. It can be run using one of two frontends: a native desktop application using SDL2, or a web application using WebAssembly. The desktop application provides a high-performance, feature-rich experience with support for various input devices and display options, while the web application allows users to play NES games directly in their browsers without needing to install any software in a BYOR manner (Bring Your Own Roms).
Documentation
export function createSaveStateController({
    nes,
    db,
    key,
    saveStateFn,
    loadStateFn,
    setStatus
}) {
    async function save() {
        try {
            const bytes = nes.save_state_bytes();
            if (!bytes || bytes.length === 0) {
                setStatus("Failed to save state", true);
                return false;
            }
            await saveStateFn(db, key, bytes);
            setStatus("State saved", false);
            return true;
        } catch (error) {
            console.error("Failed to save state", error);
            setStatus("Failed to save state", true);
            return false;
        }
    }

    async function load() {
        try {
            const bytes = await loadStateFn(db, key);
            if (!bytes || bytes.length === 0) {
                setStatus("No save state found", true);
                return false;
            }
            nes.load_state_bytes(bytes);
            setStatus("State loaded", false);
            return true;
        } catch (error) {
            console.error("Failed to load state", error);
            setStatus("Failed to load state", true);
            return false;
        }
    }

    return {
        save,
        load
    };
}