Browse Source

Simplify string output logic

pull/157/head
Fenrir 10 months ago
parent
commit
2fcdd110d2
  1. 12
      ctru-rs/src/applets/swkbd.rs

12
ctru-rs/src/applets/swkbd.rs

@ -803,18 +803,16 @@ impl SoftwareKeyboard {
_ => SWKBD_BUTTON_NONE, _ => SWKBD_BUTTON_NONE,
}; };
let text16 = if swkbd.text_length > 0 { if swkbd.text_length > 0 {
unsafe { let text16 = unsafe {
widestring::Utf16Str::from_slice_unchecked(std::slice::from_raw_parts( widestring::Utf16Str::from_slice_unchecked(std::slice::from_raw_parts(
SWKBD_SHARED_MEM.add(swkbd.text_offset as _).cast::<u16>(), SWKBD_SHARED_MEM.add(swkbd.text_offset as _).cast(),
swkbd.text_length as usize, swkbd.text_length as _,
)) ))
}
} else {
widestring::utf16str!("")
}; };
*output = text16.to_string(); *output = text16.to_string();
}
if swkbd.save_state_flags & (1 << 0) != 0 { if swkbd.save_state_flags & (1 << 0) != 0 {
unsafe { unsafe {

Loading…
Cancel
Save