Skip to content

Commit

Permalink
Implement some missing actions
Browse files Browse the repository at this point in the history
  • Loading branch information
vswarte committed Jun 24, 2024
1 parent 5601420 commit a4adf5c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
23 changes: 20 additions & 3 deletions format/src/bnk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,8 @@ pub enum CAkActionParams {
// #[deku(id="0x0105")] StopALLO,
// #[deku(id="0x0108")] StlopAE,
// #[deku(id="0x0109")] StopAEO,
// #[deku(id="0x0202")] PauseE,
#[deku(id="0x0202")]
PauseE(CAkActionPause),
// #[deku(id="0x0203")] PauseEO,
// #[deku(id="0x0204")] PauseALL,
// #[deku(id="0x0205")] PauseALLO,
Expand Down Expand Up @@ -698,9 +699,11 @@ pub enum CAkActionParams {
// #[deku(id="0x3005")] ResetHPFALLO,
// #[deku(id="0x3008")] ResetHPFAE,
// #[deku(id="0x3009")] ResetHPFAEO,
// #[deku(id="0x0C02")] SetBusVolumeM,
#[deku(id="0x0C02")]
SetBusVolumeM(CAkActionSetAkProp),
// #[deku(id="0x0C03")] SetBusVolumeO,
// #[deku(id="0x0D02")] ResetBusVolumeM,
#[deku(id="0x0D02")]
ResetBusVolumeM(CAkActionSetAkProp),
// #[deku(id="0x0D03")] ResetBusVolumeO,
// #[deku(id="0x0D04")] ResetBusVolumeALL,
// #[deku(id="0x0D08")] ResetBusVolumeAE,
Expand Down Expand Up @@ -1620,6 +1623,20 @@ pub struct CAkActionPlay {
pub bank_id: u32,
}

#[derive(Debug, Serialize, Deserialize)]
#[deku_derive(DekuRead, DekuWrite)]
pub struct CAkActionPause {
pub fade_curve: u8,
pub pause: CAkActionParamsPause,
pub except: CAkActionParamsExcept,
}

#[derive(Debug, Serialize, Deserialize)]
#[deku_derive(DekuRead, DekuWrite)]
pub struct CAkActionParamsPause {
flags: u8,
}

#[derive(Debug, Serialize, Deserialize)]
#[deku_derive(DekuRead, DekuWrite)]
pub struct CAkActionStop {
Expand Down
12 changes: 12 additions & 0 deletions format/src/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ impl PrepareExport for CAkActionParams {
CAkActionParams::SetState(p) => de(p.update()),
CAkActionParams::SetSwitch(p) => de(p.update()),
CAkActionParams::Play(p) => de(p.update()),
CAkActionParams::PauseE(p) => p.prepare_export(),
CAkActionParams::StopE(p) => p.prepare_export(),
CAkActionParams::StopEO(p) => p.prepare_export(),
CAkActionParams::MuteM(p) => p.prepare_export(),
Expand All @@ -317,13 +318,24 @@ impl PrepareExport for CAkActionParams {
CAkActionParams::SetVolumeO(p) => p.prepare_export(),
CAkActionParams::ResetVolumeM(p) => p.prepare_export(),
CAkActionParams::ResetVolumeO(p) => p.prepare_export(),
CAkActionParams::ResetBusVolumeM(p) => p.prepare_export(),
CAkActionParams::SetBusVolumeM(p) => p.prepare_export(),
CAkActionParams::PlayEvent => { Ok(()) },
}?;

Ok(())
}
}

impl PrepareExport for CAkActionPause {
fn prepare_export(&mut self) -> Result<(), PrepareExportError> {
self.pause.update().map_err(PrepareExportError::Deku)?;
self.except.update().map_err(PrepareExportError::Deku)?;
self.update().map_err(PrepareExportError::Deku)?;
Ok(())
}
}

impl PrepareExport for CAkActionStop {
fn prepare_export(&mut self) -> Result<(), PrepareExportError> {
self.stop.update().map_err(PrepareExportError::Deku)?;
Expand Down

0 comments on commit a4adf5c

Please sign in to comment.