添加halt mode的配置

This commit is contained in:
root 2024-04-07 14:26:29 +08:00
parent e97d8006a1
commit 4237fee2c9
3 changed files with 17 additions and 2 deletions

View File

@ -45,6 +45,7 @@ struct global_oaf_config
// [boost]
u8 savePolicy;
u8 cheatMode;
u8 haltMode;
};
#define SAVE_POLICY_GBADB 0
@ -53,6 +54,10 @@ struct global_oaf_config
#define SAVE_POLICY_POPUP 3
#define SAVE_POLICY_SIZE 4
#define HALT_MODE_POWEROFF 0
#define HALT_MODE_REBOOT 1
#define HALT_MODE_SIZE 2
Result oafParseConfigEarly(void);
u16 oafGetBacklightConfig(void);
Result oafInitAndRun(void);

View File

@ -100,6 +100,7 @@ static OafConfig g_oafConfig =
// [boost]
, SAVE_POLICY_GBADB // savePolicy
, CHEAT_MODE_DISABLED// cheatMode
, HALT_MODE_POWEROFF// haltMode
};
static KHandle g_frameReadyEvent = 0;
static u16 detect_cheatKey = 0;

View File

@ -71,7 +71,8 @@ atp_text_t CONFIG_OUTPUT = "[general]\n" \
"saveOverride=false\n" \
"defaultSave=%d\n\n" \
"[boost]\n" \
"cheatMode=%d\n";
"cheatMode=%d\n"\
"haltMode=%d\n";
typedef struct global_oaf_config OafConfig;
@ -87,6 +88,7 @@ static atp_error_t config_item( atp_callerdata_t gblcfg, atp_counter_t index, at
const char *scaler_val[] = {"上屏无缩放", "上屏GPU放大", "上屏DMA放大", "下屏无缩放"};
const char *savetype_name[] = {"和卡带序列号一致", "读取ROM的特定标记", "汉化带SRAM补丁", "自行决定"};
const char *cheatmode_name[] = {"关闭金手指", "全程激活", "组合键单次激活", "组合键激活/关闭"};
const char *haltmode_name[] = {"关闭3DS", "停止游戏"};
cfg->extra_text_color = ATP_COLOR_GREEN;
if( index == 0 )
{
@ -116,6 +118,11 @@ static atp_error_t config_item( atp_callerdata_t gblcfg, atp_counter_t index, at
cfg->text = "激活金手指";
cfg->extra_text = cheatmode_name[g_oafConfig->cheatMode];
}
else if( index == 5 )
{
cfg->text = "游戏中按住电源键";
cfg->extra_text = haltmode_name[g_oafConfig->haltMode];
}
cfg->value = index;
return ATP_SUCCESS;
}
@ -164,6 +171,7 @@ static atp_pageopt_t config_adjust( atp_callerdata_t gblcfg, atp_counter_t index
else if( index == 2 ) g_oafConfig->scaler = ( SCALER_SIZE + ( g_oafConfig->scaler+(l?-1:1) ) ) % SCALER_SIZE;
else if( index == 3 ) g_oafConfig->savePolicy = ( SAVE_POLICY_SIZE + ( g_oafConfig->savePolicy+(l?-1:1) ) ) % SAVE_POLICY_SIZE;
else if( index == 4 ) g_oafConfig->cheatMode = ( CHEAT_MODE_SIZE + (g_oafConfig->cheatMode+(l?-1:1) ) ) % CHEAT_MODE_SIZE;
else if( index == 5 ) g_oafConfig->haltMode = ( HALT_MODE_SIZE + (g_oafConfig->haltMode+(l?-1:1) ) ) % HALT_MODE_SIZE;
}
else if( start )
{
@ -191,7 +199,8 @@ static atp_pageopt_t config_adjust( atp_callerdata_t gblcfg, atp_counter_t index
float2str(g_oafConfig->contrast, contract),
float2str(g_oafConfig->brightness, brightness),
g_oafConfig->defaultSave,
g_oafConfig->cheatMode
g_oafConfig->cheatMode,
g_oafConfig->haltMode
);
fsQuickWrite("config.ini", data, len);
free( data );