snes.rsannotatedsnes.rssource51 lines · 1.7 KB · raw
1use jgenesis_common::frontend::TimingMode;
2use jgenesis_proc_macros::deserialize_default_on_error;
3use serde::{Deserialize, Serialize};
4use snes_config::{AudioInterpolationMode, SnesAspectRatio};
5use std::num::NonZeroU64;
6use std::path::PathBuf;
7
8const DEFAULT_GSU_OVERCLOCK: NonZeroU64 = NonZeroU64::new(1).unwrap();
9
10#[deserialize_default_on_error]
11#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12#[serde(default)]
13pub struct SnesAppConfig {
14    pub forced_timing_mode: Option<TimingMode>,
15    pub aspect_ratio: SnesAspectRatio,
16    pub deinterlace: bool,
17    pub audio_interpolation: AudioInterpolationMode,
18    pub audio_60hz_hack: bool,
19    pub gsu_overclock_factor: NonZeroU64,
20    pub allow_opposing_joypad_directions: bool,
21    pub mouse_sensitivity: f64,
22    pub dsp1_rom_path: Option<PathBuf>,
23    pub dsp2_rom_path: Option<PathBuf>,
24    pub dsp3_rom_path: Option<PathBuf>,
25    pub dsp4_rom_path: Option<PathBuf>,
26    pub st010_rom_path: Option<PathBuf>,
27    pub st011_rom_path: Option<PathBuf>,
28    pub st018_rom_path: Option<PathBuf>,
29}
30
31impl Default for SnesAppConfig {
32    fn default() -> Self {
33        Self {
34            forced_timing_mode: None,
35            aspect_ratio: SnesAspectRatio::default(),
36            deinterlace: true,
37            audio_interpolation: AudioInterpolationMode::default(),
38            audio_60hz_hack: false,
39            gsu_overclock_factor: DEFAULT_GSU_OVERCLOCK,
40            allow_opposing_joypad_directions: false,
41            mouse_sensitivity: 1.0,
42            dsp1_rom_path: None,
43            dsp2_rom_path: None,
44            dsp3_rom_path: None,
45            dsp4_rom_path: None,
46            st010_rom_path: None,
47            st011_rom_path: None,
48            st018_rom_path: None,
49        }
50    }
51}