mirror of
https://github.com/gopher64/gopher64.git
synced 2026-07-11 01:25:20 +02:00
use const for unknown name (#962)
This commit is contained in:
+1
-1
@@ -392,7 +392,7 @@ fn list_controllers_on_jvm(env: &mut Env<'_>) -> jni::errors::Result<Vec<Control
|
||||
{
|
||||
name
|
||||
} else {
|
||||
"Unknown controller".to_string()
|
||||
ui::input::UNKNOWN_CONTROLLER_NAME.to_string()
|
||||
};
|
||||
let descriptor = if let Ok(product_id) = device.get_product_id(env)
|
||||
&& let Ok(vendor_id) = device.get_vendor_id(env)
|
||||
|
||||
+4
-2
@@ -30,6 +30,8 @@ const MAX_AXIS_VALUE: f64 = 85.0;
|
||||
|
||||
pub const DEADZONE_DEFAULT: i32 = 5;
|
||||
|
||||
pub const UNKNOWN_CONTROLLER_NAME: &str = "Unknown controller";
|
||||
|
||||
pub struct Controllers {
|
||||
pub rumble: bool,
|
||||
pub game_controller: *mut sdl3_sys::gamepad::SDL_Gamepad,
|
||||
@@ -354,7 +356,7 @@ pub fn get_controller_names() -> Vec<String> {
|
||||
for joystick in get_joysticks().iter() {
|
||||
let name = unsafe { sdl3_sys::joystick::SDL_GetJoystickNameForID(*joystick) };
|
||||
controllers.push(if name.is_null() {
|
||||
"Unknown controller".to_string()
|
||||
UNKNOWN_CONTROLLER_NAME.to_string()
|
||||
} else {
|
||||
unsafe { std::ffi::CStr::from_ptr(name).to_str().unwrap() }.to_string()
|
||||
});
|
||||
@@ -1184,7 +1186,7 @@ pub fn init(ui: &mut ui::Ui) {
|
||||
{
|
||||
unsafe { std::ffi::CStr::from_ptr(name).to_str().unwrap() }.to_string()
|
||||
} else {
|
||||
"Unknown controller".to_string()
|
||||
UNKNOWN_CONTROLLER_NAME.to_string()
|
||||
};
|
||||
|
||||
let vendor_id =
|
||||
|
||||
Reference in New Issue
Block a user