use thiserror::Error;

#[derive(Debug, Error)]
pub enum XeniaError {
    #[error("Invalid XEX2 file: {0}")]
    InvalidXex(String),

    #[error("Invalid XISO file: {0}")]
    InvalidXiso(String),

    #[error("Memory error: {0}")]
    Memory(String),

    #[error("Unimplemented opcode: {0}")]
    UnimplementedOpcode(String),

    #[error("Unimplemented kernel export: module={module} ordinal={ordinal:#x}")]
    UnimplementedExport { module: String, ordinal: u32 },

    #[error("Invalid guest address: {0:#010x}")]
    InvalidAddress(u32),

    #[error("I/O error: {0}")]
    Io(#[from] std::io::Error),
}

pub type XeniaResult<T> = Result<T, XeniaError>;
