From 2447941e6cd76c78f5679f0c15428699a62bc263 Mon Sep 17 00:00:00 2001 From: anod <182859762@qq.com> Date: Mon, 17 Oct 2022 14:37:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E4=BA=86L/R=E5=87=BA?= =?UTF-8?q?=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=BA=86=E5=85=B6=E4=BB=96=E5=87=A0=E4=B8=AA=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E7=9A=84=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/arm11/atp.c | 3 ++- source/arm11/open_agb_firm.c | 35 ++++++++++++++++++++--------------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/source/arm11/atp.c b/source/arm11/atp.c index 416d123..bb830e0 100644 --- a/source/arm11/atp.c +++ b/source/arm11/atp.c @@ -231,6 +231,7 @@ static void draw_options( int start_row, int start_idx, int option_cnt, int sele } } +#define HIT( hit ) ( (hit & key) != 0 ) #define SELECTED_ROW(top, len, sel) (((top) < (len)) ? ((len)-(top)+(sel)) : ((sel)+(len)-(top))) #define REFRESH_PAGE { \ set_paging( idx_top, title_len+cnt ); \ @@ -302,7 +303,7 @@ atp_error_t atp_select( atp_text_t title, atp_counter_t cnt, atp_itemprovider_t { if( handler == NULL ) continue; - atp_pageopt_t opt = handler( data, item_sel, key&KEY_X, key&KEY_Y, key&KEY_L, key&KEY_R, key&KEY_START, key&KEY_SELECT ); + atp_pageopt_t opt = handler( data, item_sel, HIT(KEY_X), HIT(KEY_Y), HIT(KEY_L), HIT(KEY_R), HIT(KEY_START), HIT(KEY_SELECT) ); switch( opt ) { case ATP_PAGE_REFRESH: diff --git a/source/arm11/open_agb_firm.c b/source/arm11/open_agb_firm.c index cb612aa..ce52c98 100644 --- a/source/arm11/open_agb_firm.c +++ b/source/arm11/open_agb_firm.c @@ -155,25 +155,30 @@ static atp_error_t config_item( atp_callerdata_t data, atp_counter_t index, atp_ static atp_pageopt_t config_adjust( atp_callerdata_t data, atp_counter_t index, atp_boolean_t x, atp_boolean_t y, atp_boolean_t l, atp_boolean_t r, atp_boolean_t start, atp_boolean_t select ) { - if( index == 0 ) + if( l || r ) { - u8 light = g_oafConfig.backlight; - if( l || x ) + + if( index == 0 ) { - light -= 10; - if( light % 10 ) light += 10 - light%10; + u8 light = g_oafConfig.backlight; + if( l || x ) + { + light -= 10; + if( light % 10 ) light += 10 - light%10; + } + else if( r || y ) + { + light += 10; + if( light % 10 ) light -= light % 10; + } + if( light > LIGHT_MAX ) light = LIGHT_MAX; + else if( light < LIGHT_MIN ) light = LIGHT_MIN; + g_oafConfig.backlight = light; } - else if( r || y ) - { - light += 10; - if( light % 10 ) light -= light % 10; - } - else light -= 1; - if( light > LIGHT_MAX ) light = LIGHT_MAX; - else if( light < LIGHT_MIN ) light = LIGHT_MIN; - g_oafConfig.backlight = light; + else if( index == 1 ) g_oafConfig.directBoot = !g_oafConfig.directBoot; + else if( index == 2 ) g_oafConfig.scaler = ( 4 + ( g_oafConfig.scaler+(l?1:-1) ) ) % 4; + else if( index == 3 ) g_oafConfig.saveOverride = !g_oafConfig.saveOverride; } - g_oafConfig.saveOverride = !g_oafConfig.saveOverride; return ATP_PAGE_UPDATE; }