@@ -50,14 +50,14 @@ static mut NEWS_DATA: LazyLock<RwLock<HashMap<String, String>>> = LazyLock::new(
5050#[ macro_export]
5151macro_rules! reg_x {
5252 ( $ctx: ident, $no: expr) => {
53- unsafe { * $ctx. registers[ $no] . x. as_ref ( ) }
53+ $ctx. registers[ $no] . x( )
5454 } ;
5555}
5656
5757#[ macro_export]
5858macro_rules! reg_w {
5959 ( $ctx: ident, $no: expr) => {
60- unsafe { * $ctx. registers[ $no] . w. as_ref ( ) }
60+ $ctx. registers[ $no] . w( )
6161 } ;
6262}
6363
@@ -342,13 +342,13 @@ unsafe fn msbt_text(ctx: &mut InlineCtx) {
342342 text. push ( '\0' ) ;
343343
344344 let text_vec: Vec < u16 > = text. encode_utf16 ( ) . collect ( ) ;
345- * ctx. registers [ 0 ] . x . as_mut ( ) = text_vec. as_ptr ( ) as u64 ;
345+ ctx. registers [ 0 ] . set_x ( text_vec. as_ptr ( ) as u64 ) ;
346346 }
347347}
348348
349349#[ skyline:: hook( offset = offsets:: packet_send( ) , inline) ]
350350unsafe fn online_slot_spoof ( ctx : & InlineCtx ) {
351- let data = * ctx. registers [ 3 ] . x . as_ref ( ) as * mut u8 ;
351+ let data = ctx. registers [ 3 ] . x ( ) as * mut u8 ;
352352
353353 if data. is_null ( ) {
354354 return ;
@@ -371,9 +371,9 @@ pub fn is_online() -> bool {
371371unsafe fn change_fighter_color_r ( ctx : & mut skyline:: hooks:: InlineCtx ) {
372372 if is_online ( ) {
373373 unsafe {
374- if * ctx. registers [ 8 ] . w . as_ref ( ) >= 8 {
375- * ctx. registers [ 8 ] . w . as_mut ( ) = 0 ; // Actual color
376- * ctx. registers [ 3 ] . w . as_mut ( ) = 0 ; // UI
374+ if ctx. registers [ 8 ] . w ( ) >= 8 {
375+ ctx. registers [ 8 ] . set_w ( 0 ) ; // Actual color
376+ ctx. registers [ 3 ] . set_w ( 0 ) ; // UI
377377 }
378378 }
379379 }
@@ -383,33 +383,30 @@ unsafe fn change_fighter_color_r(ctx: &mut skyline::hooks::InlineCtx) {
383383unsafe fn change_fighter_color_l ( ctx : & mut skyline:: hooks:: InlineCtx ) {
384384 if is_online ( ) {
385385 unsafe {
386- if * ctx. registers [ 8 ] . w . as_ref ( ) >= 8 {
386+ if ctx. registers [ 8 ] . w ( ) >= 8 {
387387 // Assuming that if they can change a character's color then that means a character has at least a set of 8 colors
388- * ctx. registers [ 8 ] . w . as_mut ( ) = 7 ; // Actual color
389- * ctx. registers [ 3 ] . w . as_mut ( ) = 7 ; // UI
388+ ctx. registers [ 8 ] . set_w ( 7 ) ; // Actual color
389+ ctx. registers [ 3 ] . set_w ( 7 ) ; // UI
390390 }
391391 }
392392 }
393393}
394394
395395#[ skyline:: hook( offset = offsets:: skip_opening( ) , inline) ]
396396unsafe fn skip_opening_cutscene ( ctx : & mut InlineCtx ) {
397- let data = ctx. registers [ 8 ] . x . as_mut ( ) ;
398- * data = 0 ;
397+ ctx. registers [ 8 ] . set_x ( 0 ) ;
399398}
400399
401400// Change the next callback for the TitleSceneInfo::callbacks::Enter from "DisplayOpeningCutscene" to "HowToPlay"
402401#[ skyline:: hook( offset = offsets:: title_scene_play_opening( ) , inline) ]
403402unsafe fn title_scene_play_opening ( ctx : & mut InlineCtx ) {
404- let data = ctx. registers [ 9 ] . x . as_mut ( ) ;
405- * data = 1 ;
403+ ctx. registers [ 9 ] . set_x ( 1 ) ;
406404}
407405
408406// Pretend the state for another state handler (OpeningCutsceneLayout?) is set to 5
409407#[ skyline:: hook( offset = offsets:: title_scene_how_to_play( ) , inline) ]
410408unsafe fn title_scene_show_how_to_play_fake_state_index ( ctx : & mut InlineCtx ) {
411- let data = ctx. registers [ 8 ] . x . as_mut ( ) ;
412- * data = 5 ;
409+ ctx. registers [ 8 ] . set_x ( 5 ) ;
413410}
414411
415412#[ skyline:: main( name = "arcropolis" ) ]
0 commit comments