Skip to content

Commit

Permalink
Implemented From trait for JoypadInput in Libretro core (#83)
Browse files Browse the repository at this point in the history
* First version of the libretro core implementation

* Fixed issues the frames' color encoding and now supplying mock audio data to the libretro runtime

I was supplying argb color data instead of rgba. I fixed that.

* Fixed the ARGB encoding (which was all VERY wrong)

* Implemented controller 1 inputs

Controller 2's code is commented because it doesn't seem to work for some reason. I'll need to investigate that at a later time.

* Re-implemented controller 2 as I found it was related to the emulator's back end.

Saving is still not implemented.

* Fixed controller 2. (It has to be written in $4016 like controller 1).

Saving is still not implemented.

* Some reformating before Pull Request.

* Fixed requested changes for Pull Request.

* Cleaned up controller_state in core

* Implemented From trait for JoypadInput

Co-authored-by: zer0x64 <[email protected]>
  • Loading branch information
GoldenKain and zer0x64 authored Jul 14, 2021
1 parent af7aa4b commit 689b018
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions nestadia-libretro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,18 @@ bitflags! {
}
}

impl ControllerState {
fn from(button: JoypadButton) -> ControllerState {
impl From<JoypadButton> for ControllerState {
fn from(button: JoypadButton) -> Self {
match button {
JoypadButton::A => ControllerState::A,
JoypadButton::B => ControllerState::B,
JoypadButton::Start => ControllerState::START,
JoypadButton::Select => ControllerState::SELECT,
JoypadButton::Down => ControllerState::DOWN,
JoypadButton::Left => ControllerState::LEFT,
JoypadButton::Right => ControllerState::RIGHT,
JoypadButton::Up => ControllerState::UP,
_ => ControllerState::NONE,
JoypadButton::A => Self::A,
JoypadButton::B => Self::B,
JoypadButton::Start => Self::START,
JoypadButton::Select => Self::SELECT,
JoypadButton::Down => Self::DOWN,
JoypadButton::Left => Self::LEFT,
JoypadButton::Right => Self::RIGHT,
JoypadButton::Up => Self::UP,
_ => Self::NONE,
}
}
}
Expand Down

0 comments on commit 689b018

Please sign in to comment.