mirror of
https://gitee.com/anod/open_agb_firm.git
synced 2025-05-06 22:04:10 +08:00
增加DOSELECT,一种页面处理方案
尝试把scaler=0的位置居中
This commit is contained in:
parent
0eb576cfc5
commit
5047eb8295
@ -42,6 +42,7 @@ typedef void * atp_callerdata_t;
|
|||||||
#define ATP_PAGE_NOOPTION 0
|
#define ATP_PAGE_NOOPTION 0
|
||||||
#define ATP_PAGE_UPDATE 2 // UPDATE THE CURSOR ROW
|
#define ATP_PAGE_UPDATE 2 // UPDATE THE CURSOR ROW
|
||||||
#define ATP_PAGE_REFRESH 3 // UPDATE THE WHOLE PAGE
|
#define ATP_PAGE_REFRESH 3 // UPDATE THE WHOLE PAGE
|
||||||
|
#define ATP_PAGE_DOSELECT 4 // SAME AS SELECT
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
atp_text_t text;
|
atp_text_t text;
|
||||||
|
@ -243,7 +243,20 @@ static void draw_options( int start_row, int start_idx, int option_cnt, int sele
|
|||||||
} \
|
} \
|
||||||
else draw_options( 0, idx_top - title_len, cnt, item_sel, provider, data ); \
|
else draw_options( 0, idx_top - title_len, cnt, item_sel, provider, data ); \
|
||||||
}
|
}
|
||||||
|
#define HANDLE_DOSELECT { \
|
||||||
|
if( res == NULL ) return ATP_SUCCESS; \
|
||||||
|
atp_error_t result = provider(data, item_sel, &config); \
|
||||||
|
if( ATP_SUCCESS == result ) \
|
||||||
|
{ \
|
||||||
|
*res = config.value; \
|
||||||
|
return ATP_SUCCESS; \
|
||||||
|
} \
|
||||||
|
else \
|
||||||
|
{ \
|
||||||
|
*res = result; \
|
||||||
|
return ATP_INVALID_VALUE; \
|
||||||
|
} \
|
||||||
|
}
|
||||||
atp_error_t atp_select( atp_text_t title, atp_counter_t cnt, atp_itemprovider_t provider, atp_keyhandler_t handler, atp_callerdata_t data, atp_counter_t index, atp_boolean_t action, atp_itemval_t *res )
|
atp_error_t atp_select( atp_text_t title, atp_counter_t cnt, atp_itemprovider_t provider, atp_keyhandler_t handler, atp_callerdata_t data, atp_counter_t index, atp_boolean_t action, atp_itemval_t *res )
|
||||||
{
|
{
|
||||||
uint8_t title_offset[TITLE_MAX];
|
uint8_t title_offset[TITLE_MAX];
|
||||||
@ -282,17 +295,7 @@ atp_error_t atp_select( atp_text_t title, atp_counter_t cnt, atp_itemprovider_t
|
|||||||
{
|
{
|
||||||
if( key & KEY_A )
|
if( key & KEY_A )
|
||||||
{
|
{
|
||||||
atp_error_t result = provider(data, item_sel, &config);
|
HANDLE_DOSELECT;
|
||||||
if( ATP_SUCCESS == result )
|
|
||||||
{
|
|
||||||
if( res != NULL ) *res = config.value;
|
|
||||||
return ATP_SUCCESS;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( res != NULL ) *res = result;
|
|
||||||
return ATP_INVALID_VALUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -317,6 +320,9 @@ atp_error_t atp_select( atp_text_t title, atp_counter_t cnt, atp_itemprovider_t
|
|||||||
case ATP_POWER_OFF:
|
case ATP_POWER_OFF:
|
||||||
return ATP_POWER_OFF;
|
return ATP_POWER_OFF;
|
||||||
break;
|
break;
|
||||||
|
case ATP_PAGE_DOSELECT:
|
||||||
|
HANDLE_DOSELECT;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
@ -259,6 +259,8 @@ Result browseFiles(const char *const basePath, char selected[512])
|
|||||||
|
|
||||||
if( count > 0 )
|
if( count > 0 )
|
||||||
{
|
{
|
||||||
|
GFX_waitForVBlank0();
|
||||||
|
hidScanInput();
|
||||||
atp_tips( NULL, "指引:按START" );
|
atp_tips( NULL, "指引:按START" );
|
||||||
error = atp_select( curDir, count, display_folder, serve_on_key, (atp_callerdata_t)dList, selecting, 0, &value );
|
error = atp_select( curDir, count, display_folder, serve_on_key, (atp_callerdata_t)dList, selecting, 0, &value );
|
||||||
}
|
}
|
||||||
|
@ -132,14 +132,32 @@ static KHandle g_frameReadyEvent = 0;
|
|||||||
// --------------------------
|
// --------------------------
|
||||||
atp_text_t config_help[] =
|
atp_text_t config_help[] =
|
||||||
{
|
{
|
||||||
"参数配置操作指引",
|
"全局参数编辑操作指引",
|
||||||
"---------------",
|
"~ ~ ~ ~ ~ ~ ~",
|
||||||
"上下方向键 切换参数项目",
|
"修改后的全局参数保存在config.ini",
|
||||||
"左右方向键 翻页",
|
"~ ~ ~ ~ ~ ~ ~",
|
||||||
"L键和R键 调整当前参数",
|
"上下方向键 切换参数项目",
|
||||||
"A键 保存修改退出",
|
"左右方向键 翻页",
|
||||||
"B键 不保存修改退出"
|
"L键和R键 调整当前参数",
|
||||||
|
"A键 应用修改退出",
|
||||||
|
"B键 放弃修改退出",
|
||||||
|
"X键 应用修改保存退出", // X做保存,选中后走A键流程
|
||||||
};
|
};
|
||||||
|
atp_text_t CONFIG_OUTPUT = "[general]\n" \
|
||||||
|
"backlight=%d\n" \
|
||||||
|
"directBoot=%s\n" \
|
||||||
|
"useGbaDb=true\n\n" \
|
||||||
|
"[video]\n" \
|
||||||
|
"scaler=%d\n" \
|
||||||
|
"gbaGamma=2.2\n" \
|
||||||
|
"lcdGamma=1.54\n" \
|
||||||
|
"contrast=1.0\n" \
|
||||||
|
"brightness=0.0\n\n" \
|
||||||
|
"[advanced]\n" \
|
||||||
|
"saveOverride=false\n" \
|
||||||
|
"defaultSave=14\n" \
|
||||||
|
"[by-anod]\n" \
|
||||||
|
"savePolicy=%d"
|
||||||
extern atp_error_t help_page( atp_text_t *wording, atp_counter_t length );
|
extern atp_error_t help_page( atp_text_t *wording, atp_counter_t length );
|
||||||
|
|
||||||
#define LIGHT_MIN (MCU_getSystemModel() > 3 ? 16 : 20)
|
#define LIGHT_MIN (MCU_getSystemModel() > 3 ? 16 : 20)
|
||||||
@ -148,7 +166,7 @@ extern atp_error_t help_page( atp_text_t *wording, atp_counter_t length );
|
|||||||
static atp_error_t config_item( atp_callerdata_t, atp_counter_t index, atp_itemcfg_t *cfg )
|
static atp_error_t config_item( atp_callerdata_t, atp_counter_t index, atp_itemcfg_t *cfg )
|
||||||
{
|
{
|
||||||
const char *scaler_val[] = {"上屏无缩放", "上屏GPU放大", "上屏DMA放大", "下屏无缩放"};
|
const char *scaler_val[] = {"上屏无缩放", "上屏GPU放大", "上屏DMA放大", "下屏无缩放"};
|
||||||
const char *savetype_name[] = {"和卡带序列号一致", "读取ROM的特定标记", "汉化带SRAM补丁", "我知道选哪个"};
|
const char *savetype_name[] = {"和卡带序列号一致", "读取ROM的特定标记", "汉化带SRAM补丁", "自行决定"};
|
||||||
static char buf[16];
|
static char buf[16];
|
||||||
cfg->extra_text_color = ATP_COLOR_GREEN;
|
cfg->extra_text_color = ATP_COLOR_GREEN;
|
||||||
if( index == 0 )
|
if( index == 0 )
|
||||||
@ -178,7 +196,7 @@ static atp_error_t config_item( atp_callerdata_t, atp_counter_t index, atp_itemc
|
|||||||
return ATP_SUCCESS;
|
return ATP_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static atp_pageopt_t config_adjust( atp_callerdata_t, atp_counter_t index, atp_boolean_t, atp_boolean_t, atp_boolean_t l, atp_boolean_t r, atp_boolean_t start, atp_boolean_t )
|
static atp_pageopt_t config_adjust( atp_callerdata_t, atp_counter_t index, atp_boolean_t x, atp_boolean_t, atp_boolean_t l, atp_boolean_t r, atp_boolean_t start, atp_boolean_t )
|
||||||
{
|
{
|
||||||
if( l || r )
|
if( l || r )
|
||||||
{
|
{
|
||||||
@ -208,6 +226,11 @@ static atp_pageopt_t config_adjust( atp_callerdata_t, atp_counter_t index, atp_b
|
|||||||
return ATP_POWER_OFF == help_page( config_help, sizeof(config_help)/sizeof(atp_text_t) )
|
return ATP_POWER_OFF == help_page( config_help, sizeof(config_help)/sizeof(atp_text_t) )
|
||||||
? ATP_POWER_OFF : ATP_PAGE_REFRESH;
|
? ATP_POWER_OFF : ATP_PAGE_REFRESH;
|
||||||
}
|
}
|
||||||
|
else if( x )
|
||||||
|
{
|
||||||
|
// TODO : STRING FORMAT AND QUICK SAVE
|
||||||
|
return ATP_PAGE_DOSELECT;
|
||||||
|
}
|
||||||
return ATP_PAGE_UPDATE;
|
return ATP_PAGE_UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,7 +250,6 @@ atp_error_t oaf_config_page()
|
|||||||
{
|
{
|
||||||
if( prev->backlight != g_oafConfig.backlight )
|
if( prev->backlight != g_oafConfig.backlight )
|
||||||
GFX_setBrightness(g_oafConfig.backlight, g_oafConfig.backlight);
|
GFX_setBrightness(g_oafConfig.backlight, g_oafConfig.backlight);
|
||||||
// TODO : STRING FORMAT AND QUICK SAVE
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
@ -649,10 +671,13 @@ static void gbaGfxHandler(void *args)
|
|||||||
}
|
}
|
||||||
GX_processCommandList(listSize, list);
|
GX_processCommandList(listSize, list);
|
||||||
GFX_waitForP3D();
|
GFX_waitForP3D();
|
||||||
// 地址0x18180000保存的是360x240大小的贴图数据rgb888
|
// 地址0x18180000保存的是360x240大小的贴图数据rgb888(序列:↑↘↑)
|
||||||
// 地址0x18200000保存的是512x512大小的GBA的240x160贴图数据
|
// 地址0x18200000保存的是512x512大小的GBA的240x160贴图数据(序列:→↙→)
|
||||||
|
// 所以GPU做的事情就是将18200000的数据逆时针旋转90°
|
||||||
|
int offset = 0;
|
||||||
|
if( g_oafConfig.scaler == 0 ) offset = (240-160) / 2;
|
||||||
GX_displayTransfer((u32*)(0x18180000 + (16 * 240 * 3)), 368u<<16 | 240u,
|
GX_displayTransfer((u32*)(0x18180000 + (16 * 240 * 3)), 368u<<16 | 240u,
|
||||||
GFX_getFramebuffer(SCREEN_TOP) + (16 * 240 * 3), 368u<<16 | 240u, 1u<<12 | 1u<<8);
|
GFX_getFramebuffer(SCREEN_TOP) + (16 * 240 * 3) + offset * 3, 368u<<16 | 240u, 1u<<12 | 1u<<8);
|
||||||
GFX_waitForPPF();
|
GFX_waitForPPF();
|
||||||
GFX_swapFramebufs();
|
GFX_swapFramebufs();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user