Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Init of Discord Rich Presence for Slippi #17

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from
Draft
162 changes: 159 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ debug = true
panic = "abort"

[workspace.dependencies]
thiserror = "1.0.44"
time = { version = "0.3.20", default-features = false, features = ["std", "local-offset"] }
serde = { version = "1", features = ["derive"] }
serde_json = { version = "1" }
Expand Down
23 changes: 23 additions & 0 deletions discord-rpc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[package]
name = "slippi-discord-rpc"
description = "A library for interfacing with Discord Rich Presence, providing real-time game state updates from Dolphin emulator."
version = "0.1.0"
authors = [
"Slippi Team",
"Anders Madsen <[email protected]>"
]
edition = "2021"
publish = false

[features]
default = []
ishiiruka = []
mainline = []

[dependencies]
dolphin-integrations = { path = "../dolphin" }
hps_decode = "0.1.1"
process-memory = "0.5.0"
rodio = "0.17.1"
thiserror = "1.0.44"
tracing = { workspace = true }
37 changes: 37 additions & 0 deletions discord-rpc/src/errors.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
use thiserror::Error;

#[derive(Error, Debug)]
pub enum DiscordRPCError {
#[error("{0}")]
GenericIO(#[from] std::io::Error),

#[error("Failed to spawn thread: {0}")]
ThreadSpawn(std::io::Error),

#[error("Unexpected null pointer or unaligned read from Dolphin's memory: {0}")]
DolphinMemoryRead(std::io::Error),

#[error("Failed to decode music file: {0}")]
MusicFileDecoding(#[from] hps_decode::hps::HpsParseError),

#[error("Unable to get an audio device handle: {0}")]
AudioDevice(#[from] rodio::StreamError),

#[error("Unable to play sound with rodio: {0}")]
AudioPlayback(#[from] rodio::PlayError),

#[error("Failed to parse ISO's Filesystem Table: {0}")]
FstParse(String),

#[error("Failed to seek the ISO: {0}")]
IsoSeek(std::io::Error),

#[error("Failed to read the ISO: {0}")]
IsoRead(std::io::Error),

#[error("The provided game file is not supported")]
UnsupportedIso,

#[error("Unknown Jukebox Error")]
Unknown,
}
Loading