WIP: add all env queries to HandlesEnvironment trait
This commit is contained in:
		
							parent
							
								
									5b27d27fdf
								
							
						
					
					
						commit
						eaab387216
					
				
					 2 changed files with 187 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -231,6 +231,44 @@ pub enum EnvironmentCmdData {
 | 
			
		|||
pub trait HandlesEnvironment: Send + Sync + 'static {
 | 
			
		||||
    // TODO: wrap cmd+data in enum
 | 
			
		||||
    fn environment(&mut self, cmd: u32, data: *mut c_void) -> bool;
 | 
			
		||||
 | 
			
		||||
    fn SetRotation(&mut self, rotation: EnvRotation) -> bool;
 | 
			
		||||
    fn GetOverscan(&mut self, overscan: &mut bool) -> bool;
 | 
			
		||||
    fn GetCanDupe(&mut self, frame_duping: &mut bool) -> bool;
 | 
			
		||||
    fn SetMessage(&mut self, message: retro_message) -> bool;
 | 
			
		||||
    fn Shutdown(&mut self) -> bool;
 | 
			
		||||
    fn SetPerformanceLevel(&mut self, level: c_uint) -> bool;
 | 
			
		||||
    fn GetSystemDirectory(&mut self, path: &mut PathBuf) -> bool;
 | 
			
		||||
    fn SetPixelFormat(&mut self, format: EnvPixelFormat) -> bool;
 | 
			
		||||
    fn SetInputDescriptors(&mut self, input_descriptors: &[retro_input_descriptor]) -> bool;
 | 
			
		||||
    fn SetKeyboardCallback(&mut self, keyboard_callback: retro_keyboard_callback) -> bool;
 | 
			
		||||
    fn SetDiskControlInterface(&mut self, disk_control_callback: retro_disk_control_callback) -> bool;
 | 
			
		||||
    fn SetHwRender(&mut self, hw_render_callback: retro_hw_render_callback) -> bool;
 | 
			
		||||
    fn GetVariable(&mut self, variable: &mut EnvVariable) -> bool;
 | 
			
		||||
    fn SetVariables(&mut self, variables: &[EnvVariable]) -> bool;
 | 
			
		||||
    fn GetVariableUpdate(&mut self, variables_updated: &mut bool) -> bool;
 | 
			
		||||
    fn SetSupportNoGame(&mut self, supports_no_game: bool) -> bool;
 | 
			
		||||
    fn GetLibretroPath(&mut self, path: &mut PathBuf) -> bool;
 | 
			
		||||
    fn SetFrameTimeCallback(&mut self, frame_time_callback: retro_frame_time_callback) -> bool;
 | 
			
		||||
    fn SetAudioCallback(&mut self, audio_callback: retro_audio_callback) -> bool;
 | 
			
		||||
    fn GetRumbleInterface(&mut self, rumble_interface: &mut retro_rumble_interface) -> bool;
 | 
			
		||||
    fn GetInputDeviceCapabilities(&mut self, input_device_capabilities: &mut u64) -> bool;
 | 
			
		||||
    fn GetSensorInterface(&mut self, sensor_interface: &mut retro_sensor_interface) -> bool;
 | 
			
		||||
    fn GetCameraInterface(&mut self, camera_callback: &mut retro_camera_callback) -> bool;
 | 
			
		||||
    fn GetLogInterface(&mut self, log_callback: &mut retro_log_callback) -> bool;
 | 
			
		||||
    fn GetPerfInterface(&mut self, perf_callback: &mut retro_perf_callback) -> bool;
 | 
			
		||||
    fn GetLocationInterface(&mut self, location_callback: &mut retro_location_callback) -> bool;
 | 
			
		||||
    fn GetCoreAssetsDirectory(&mut self, path: &mut PathBuf) -> bool;
 | 
			
		||||
    fn GetSaveDirectory(&mut self, path: &mut PathBuf) -> bool;
 | 
			
		||||
    fn SetSystemAvInfo(&mut self, system_av_info: retro_system_av_info) -> bool;
 | 
			
		||||
    fn SetProcAddressCallback(&mut self, get_proc_address_interface: retro_get_proc_address_interface) -> bool;
 | 
			
		||||
    fn SetSubsystemInfo(&mut self, subsystem_info: retro_subsystem_info) -> bool;
 | 
			
		||||
    fn SetControllerInfo(&mut self, controller_info: retro_controller_info) -> bool;
 | 
			
		||||
    fn SetMemoryMaps(&mut self, memory_map: retro_memory_map) -> bool;
 | 
			
		||||
    fn SetGeometry(&mut self, game_geometry: retro_game_geometry) -> bool;
 | 
			
		||||
    fn GetUsername(&mut self, username: &mut String) -> bool;
 | 
			
		||||
    fn GetLanguage(&mut self, language: &mut EnvLanguage) -> bool;
 | 
			
		||||
    fn SetSerializationQuirks(&mut self, quirks: &mut u64) -> bool;
 | 
			
		||||
}
 | 
			
		||||
pub trait HandlesVideoRefresh: Send + Sync + 'static {
 | 
			
		||||
    fn video_refresh(&mut self, data: &[u8], width: c_uint, height: c_uint, pitch: c_uint);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										149
									
								
								src/main.rs
									
										
									
									
									
								
							
							
						
						
									
										149
									
								
								src/main.rs
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -20,6 +20,155 @@ impl HandlesEnvironment for Foo {
 | 
			
		|||
        println!("environment cmd: {}", cmd);
 | 
			
		||||
        false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn SetRotation(&mut self, rotation: EnvRotation) -> bool {
 | 
			
		||||
        false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn GetOverscan(&mut self, overscan: &mut bool) -> bool {
 | 
			
		||||
        false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn GetCanDupe(&mut self, frame_duping: &mut bool) -> bool {
 | 
			
		||||
        false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn SetMessage(&mut self, message: retro_message) -> bool {
 | 
			
		||||
        false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn Shutdown(&mut self) -> bool {
 | 
			
		||||
        false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn SetPerformanceLevel(&mut self, level: c_uint) -> bool {
 | 
			
		||||
        false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn GetSystemDirectory(&mut self, path: &mut PathBuf) -> bool {
 | 
			
		||||
        false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn SetPixelFormat(&mut self, format: EnvPixelFormat) -> bool {
 | 
			
		||||
        false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn SetInputDescriptors(&mut self, input_descriptors: &[retro_input_descriptor]) -> bool {
 | 
			
		||||
        false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn SetKeyboardCallback(&mut self, keyboard_callback: retro_keyboard_callback) -> bool {
 | 
			
		||||
        false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn SetDiskControlInterface(&mut self, disk_control_callback: retro_disk_control_callback) -> bool {
 | 
			
		||||
        false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn SetHwRender(&mut self, hw_render_callback: retro_hw_render_callback) -> bool {
 | 
			
		||||
        false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn GetVariable(&mut self, variable: &mut EnvVariable) -> bool {
 | 
			
		||||
        false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn SetVariables(&mut self, variables: &[EnvVariable]) -> bool {
 | 
			
		||||
        false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn GetVariableUpdate(&mut self, variables_updated: &mut bool) -> bool {
 | 
			
		||||
        false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn SetSupportNoGame(&mut self, supports_no_game: bool) -> bool {
 | 
			
		||||
        false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn GetLibretroPath(&mut self, path: &mut PathBuf) -> bool {
 | 
			
		||||
        false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn SetFrameTimeCallback(&mut self, frame_time_callback: retro_frame_time_callback) -> bool {
 | 
			
		||||
        false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn SetAudioCallback(&mut self, audio_callback: retro_audio_callback) -> bool {
 | 
			
		||||
        false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn GetRumbleInterface(&mut self, rumble_interface: &mut retro_rumble_interface) -> bool {
 | 
			
		||||
        false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn GetInputDeviceCapabilities(&mut self, input_device_capabilities: &mut u64) -> bool {
 | 
			
		||||
        false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn GetSensorInterface(&mut self, sensor_interface: &mut retro_sensor_interface) -> bool {
 | 
			
		||||
        false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn GetCameraInterface(&mut self, camera_callback: &mut retro_camera_callback) -> bool {
 | 
			
		||||
        false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn GetLogInterface(&mut self, log_callback: &mut retro_log_callback) -> bool {
 | 
			
		||||
        false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn GetPerfInterface(&mut self, perf_callback: &mut retro_perf_callback) -> bool {
 | 
			
		||||
        false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn GetLocationInterface(&mut self, location_callback: &mut retro_location_callback) -> bool {
 | 
			
		||||
        false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn GetCoreAssetsDirectory(&mut self, path: &mut PathBuf) -> bool {
 | 
			
		||||
        false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn GetSaveDirectory(&mut self, path: &mut PathBuf) -> bool {
 | 
			
		||||
        false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn SetSystemAvInfo(&mut self, system_av_info: retro_system_av_info) -> bool {
 | 
			
		||||
        false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn SetProcAddressCallback(&mut self, get_proc_address_interface: retro_get_proc_address_interface) -> bool {
 | 
			
		||||
        false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn SetSubsystemInfo(&mut self, subsystem_info: retro_subsystem_info) -> bool {
 | 
			
		||||
        false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn SetControllerInfo(&mut self, controller_info: retro_controller_info) -> bool {
 | 
			
		||||
        false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn SetMemoryMaps(&mut self, memory_map: retro_memory_map) -> bool {
 | 
			
		||||
        false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn SetGeometry(&mut self, game_geometry: retro_game_geometry) -> bool {
 | 
			
		||||
        false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn GetUsername(&mut self, username: &mut String) -> bool {
 | 
			
		||||
        false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn GetLanguage(&mut self, language: &mut EnvLanguage) -> bool {
 | 
			
		||||
        false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn SetSerializationQuirks(&mut self, quirks: &mut u64) -> bool {
 | 
			
		||||
        false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl HandlesVideoRefresh for Foo {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue