From a1076164cb49af724508559597694f900f55e09a Mon Sep 17 00:00:00 2001 From: anod <182859762@qq.com> Date: Mon, 26 Sep 2022 14:09:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BAatp=5Fshow=E5=A2=9E=E5=8A=A0=E4=BA=86?= =?UTF-8?q?=E4=B8=8A=E4=B8=8B=E6=BB=9A=E5=8A=A8=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 | 30 +++++++++++++++++++++++------- source/arm11/open_agb_firm.c | 2 +- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/source/arm11/atp.c b/source/arm11/atp.c index 851d55a..1fb2c6b 100644 --- a/source/arm11/atp.c +++ b/source/arm11/atp.c @@ -91,7 +91,7 @@ static void paint_one_line( atp_lineinfo_t provider, acf_callerdata_t data, int static void container_paint( atp_lineinfo_t provider, atp_callerdata_t data, atp_counter_t nlines, int top ) { int end = top + CONTAINER_MAX_LINES; - if( end > nlines ) end = nlines; + if( end > (int)nlines ) end = nlines; for( int n = top; n < end; ++n ){ paint_one_line( provider, data, n, n-top ); } @@ -100,16 +100,32 @@ static void container_paint( atp_lineinfo_t provider, atp_callerdata_t data, atp atp_error_t atp_show( atp_counter_t cnt, atp_lineinfo_t provider, atp_callerdata_t data ) { int idx_top = 0; + screen_clean(); + container_paint( provider, data, cnt, idx_top ); while( 1 ){ - screen_clean(); - container_paint( provider, data, cnt, idx_top ); - + int top = idx_top; u32 kDown = waitKey(); - if( kDown == 0 ) return ATP_POWER_OFF; - if( kDown == KEY_B || kDown == KEY_A ) - return ATP_SUCCESS; + if( kDown == KEY_B || kDown == KEY_A ) return ATP_SUCCESS; + else if( cnt > CONTAINER_MAX_LINES ){ // may scroll + if( kDown == KEY_UP || kDown == KEY_DUP ){ + top = idx_top - 1; + } + else if( kDown == KEY_DOWN || kDown == KEY_DDOWN ){ + top = idx_top + 1; + } + + if( top+CONTAINER_MAX_LINES >= cnt ) top = cnt - 1 - CONTAINER_MAX_LINES; + else if( top < 0 ) top = 0; + } + else if( kDown == 0 ) return ATP_POWER_OFF; + + if( top != idx_top ){ + idx_top = top; + screen_clean(); + container_paint(provider, data, cnt, idx_top); + } } } diff --git a/source/arm11/open_agb_firm.c b/source/arm11/open_agb_firm.c index b9a25b2..687ee7b 100644 --- a/source/arm11/open_agb_firm.c +++ b/source/arm11/open_agb_firm.c @@ -526,7 +526,7 @@ static void gbaGfxHandler(void *args) } GX_processCommandList(listSize, list); GFX_waitForP3D(); - // 地址0x18180000保存的是360x240大小的贴图数据 + // 地址0x18180000保存的是360x240大小的贴图数据rgb888 // 地址0x18200000保存的是512x512大小的GBA的240x160贴图数据 GX_displayTransfer((u32*)(0x18180000 + (16 * 240 * 3)), 368u<<16 | 240u, GFX_getFramebuffer(SCREEN_TOP) + (16 * 240 * 3), 368u<<16 | 240u, 1u<<12 | 1u<<8);