@@ -161,6 +161,7 @@ lazy_static! {
161161 Setting :: new( "Screen Layout" , "Press PS + L Trigger or PS + R Trigger to cycle through layouts in game." , ScreenLayout :: settings_value( ) , true ) ,
162162 Setting :: new( "Swap screens" , "Press PS + X to swap screens in game." , SettingValue :: Bool ( false ) , true ) ,
163163 Setting :: new( "Language" , "Some ROMs only come with one language. Make sure yours is multilingual." , Language :: iter( ) . into( ) , false ) ,
164+ Setting :: new( "Joystick as D-Pad" , "" , SettingValue :: Bool ( true ) , true ) ,
164165 Setting :: new( "Framelimit" , "Limits gamespeed to 60fps" , SettingValue :: Bool ( true ) , true ) ,
165166 Setting :: new( "Audio" , "Disabling audio can give a performance boost" , SettingValue :: Bool ( true ) , true ) ,
166167 Setting :: new(
@@ -180,15 +181,16 @@ lazy_static! {
180181}
181182
182183#[ derive( Clone ) ]
183- pub struct Settings ( [ Setting ; 7 ] ) ;
184+ pub struct Settings ( [ Setting ; 8 ] ) ;
184185
185186const SCREEN_LAYOUT_SETTING : usize = 0 ;
186187const SWAP_SCREEN_SETTING : usize = 1 ;
187188const LANGUAGE_SETTING : usize = 2 ;
188- const FRAMELIMIT_SETTING : usize = 3 ;
189- const AUDIO_SETTING : usize = 4 ;
190- const ARM7_EMU_SETTING : usize = 5 ;
191- const ARM7_BLOCK_VALIDATION_SETTING : usize = 6 ;
189+ const JOYSTICK_AS_DPAD_SETTING : usize = 3 ;
190+ const FRAMELIMIT_SETTING : usize = 4 ;
191+ const AUDIO_SETTING : usize = 5 ;
192+ const ARM7_EMU_SETTING : usize = 6 ;
193+ const ARM7_BLOCK_VALIDATION_SETTING : usize = 7 ;
192194
193195impl Settings {
194196 pub fn screen_layout ( & self ) -> ScreenLayout {
@@ -200,6 +202,10 @@ impl Settings {
200202 }
201203 }
202204
205+ pub fn joystick_as_dpad ( & self ) -> bool {
206+ unsafe { self . 0 [ JOYSTICK_AS_DPAD_SETTING ] . value . as_bool ( ) . unwrap_unchecked ( ) }
207+ }
208+
203209 pub fn framelimit ( & self ) -> bool {
204210 unsafe { self . 0 [ FRAMELIMIT_SETTING ] . value . as_bool ( ) . unwrap_unchecked ( ) }
205211 }
@@ -241,7 +247,7 @@ impl Settings {
241247 * self . 0 [ ARM7_BLOCK_VALIDATION_SETTING ] . value . as_bool_mut ( ) . unwrap ( ) = value;
242248 }
243249
244- pub fn get_all_mut ( & mut self ) -> & mut [ Setting ; 7 ] {
250+ pub fn get_all_mut ( & mut self ) -> & mut [ Setting ; 8 ] {
245251 & mut self . 0
246252 }
247253}
0 commit comments