mirror of
https://gitee.com/anod/open_agb_firm.git
synced 2025-05-08 06:44:12 +08:00
重构一下page
This commit is contained in:
parent
72fdff8858
commit
f7f2652684
@ -20,10 +20,42 @@
|
||||
|
||||
#include "error_codes.h"
|
||||
|
||||
struct
|
||||
{
|
||||
// [general]
|
||||
u16 backlight; // Both LCDs.
|
||||
bool directBoot;
|
||||
bool useGbaDb;
|
||||
|
||||
// [video]
|
||||
u8 scaler; // 0 = 1:1, 1 = bilinear (GPU) x1.5, 2 = matrix (hardware) x1.5.
|
||||
float gbaGamma;
|
||||
float lcdGamma;
|
||||
float contrast;
|
||||
float brightness;
|
||||
|
||||
// [game]
|
||||
u8 saveSlot;
|
||||
// TODO: Per-game save type override.
|
||||
|
||||
// [advanced]
|
||||
bool saveOverride;
|
||||
u16 defaultSave;
|
||||
|
||||
// [boost]
|
||||
u8 savePolicy;
|
||||
u8 cheatMode;
|
||||
} global_oaf_config;
|
||||
|
||||
#define SAVE_POLICY_GBADB 0
|
||||
#define SAVE_POLICY_FIRM 1
|
||||
#define SAVE_POLICY_SRAM 2
|
||||
#define SAVE_POLICY_POPUP 3
|
||||
#define SAVE_POLICY_SIZE 4
|
||||
|
||||
Result oafParseConfigEarly(void);
|
||||
u8 oafGetBacklightConfig(void);
|
||||
Result oafInitAndRun(void);
|
||||
void oafUpdate(void);
|
||||
void oafFinish(void);
|
||||
int oafCheatMode(void);
|
||||
|
13
include/arm11/pages.h
Normal file
13
include/arm11/pages.h
Normal file
@ -0,0 +1,13 @@
|
||||
#ifndef __OAF_PAGES_H__
|
||||
#define __OAF_PAGES_H__
|
||||
|
||||
#include "arm11/atp.h"
|
||||
#include "arm11/cheat.h"
|
||||
#include "arm11/open_agb_firm.h"
|
||||
|
||||
extern atp_error_t use_config_page( struct global_oaf_config* );
|
||||
extern atp_error_t help_page( atp_text_t *wording, atp_counter_t length );
|
||||
|
||||
#define use_help_page(text) help_page((text), sizeof((text))/sizeof(atp_text_t));
|
||||
|
||||
#endif//__OAF_PAGES_H__
|
@ -222,24 +222,6 @@ DECLARE_ERROR_PAGE( display_pathfull, "游戏或目录过量,最多显示999
|
||||
DECLARE_ERROR_PAGE( display_longname, "文件名总计过长,只显示前面的文件" )
|
||||
DECLARE_ERROR_PAGE( display_conflictkey, "和已有键位产生冲突" )
|
||||
|
||||
static atp_error_t display_help( atp_callerdata_t table, atp_counter_t index, atp_linecfg_t *config )
|
||||
{
|
||||
atp_text_t *list = (atp_text_t*)table;
|
||||
config->text_align = ATP_PLACEMENT_CENTER;
|
||||
config->text_color = index == 0 ? ATP_COLOR_MAGENTA : ATP_COLOR_LIGHT;
|
||||
config->text = list[index];
|
||||
return ATP_SUCCESS;
|
||||
}
|
||||
|
||||
atp_error_t help_page( atp_text_t *wording, atp_counter_t length )
|
||||
{
|
||||
atp_text_t current;
|
||||
atp_tips( "返回:按A/B", ¤t );
|
||||
atp_error_t res = atp_show( length, display_help, (atp_callerdata_t)wording );
|
||||
atp_tips( current, NULL );
|
||||
return res;
|
||||
}
|
||||
|
||||
static atp_error_t disp_str( atp_callerdata_t data, atp_counter_t, atp_linecfg_t *cfg )
|
||||
{
|
||||
cfg->text = (atp_text_t)data;
|
||||
@ -659,7 +641,7 @@ static atp_pageopt_t serve_on_key( atp_callerdata_t data, atp_counter_t index, a
|
||||
{
|
||||
if( start )
|
||||
{
|
||||
return WAIT_ON_ACT( help_page( folder_help, sizeof(folder_help)/sizeof(atp_text_t) ) );
|
||||
return WAIT_ON_ACT( use_help_page( folder_help ) );
|
||||
}
|
||||
else if( select )
|
||||
{
|
||||
@ -667,11 +649,9 @@ static atp_pageopt_t serve_on_key( atp_callerdata_t data, atp_counter_t index, a
|
||||
}
|
||||
else if( x )
|
||||
{
|
||||
extern int get_cheat_mode();
|
||||
if( CHEAT_MODE_DISABLED == get_cheat_mode() )
|
||||
{
|
||||
return WAIT_ON_ACT( help_page( cheat_off_help, sizeof(cheat_off_help)/sizeof(atp_text_t) ) );
|
||||
}
|
||||
if( CHEAT_MODE_DISABLED == oafCheatMode() )
|
||||
return WAIT_ON_ACT( use_help_page(cheat_off_help) );
|
||||
|
||||
void* *dat = (void **)data;
|
||||
DirList const *dList = (DirList*)dat[0];
|
||||
char *path = (char*)dat[1];
|
||||
@ -718,6 +698,8 @@ static atp_pageopt_t serve_on_key( atp_callerdata_t data, atp_counter_t index, a
|
||||
return WAIT_ON_ERRPAGE( display_nocheat );
|
||||
}
|
||||
|
||||
//return WAIT_ON_ACT( oaf_cheat_page() );
|
||||
|
||||
// 显示配置页面
|
||||
atp_error_t res;
|
||||
atp_itemval_t item;
|
||||
|
@ -63,11 +63,7 @@ void keyremix_freeze()
|
||||
for( int i=0; i < KEY_REMIX_LIMIT; ++i )
|
||||
{
|
||||
key_remix_t *p = &g_keyremixConfig[i];
|
||||
if( p->remix_type == REMIX_TYPE_CHEAT )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if( p->remix_type == REMIX_TYPE_REMAP
|
||||
if( p->remix_type == REMIX_TYPE_REMAP
|
||||
&& p->device_keys != 0
|
||||
&& p->game_keys != 0 )
|
||||
{
|
||||
|
@ -40,6 +40,8 @@
|
||||
#include "arm11/atp.h"
|
||||
#include "arm11/cheat.h"
|
||||
#include "arm11/keyremix.h"
|
||||
#include "arm11/pages.h"
|
||||
#include "arm11/open_agb_firm.h"
|
||||
#include "kernel.h"
|
||||
#include "kevent.h"
|
||||
#include "arm11/drivers/codec.h"
|
||||
@ -61,40 +63,9 @@
|
||||
"[advanced]\n" \
|
||||
"saveOverride=false\n" \
|
||||
"defaultSave=14"
|
||||
|
||||
#define SAVE_POLICY_GBADB 0
|
||||
#define SAVE_POLICY_FIRM 1
|
||||
#define SAVE_POLICY_SRAM 2
|
||||
#define SAVE_POLICY_POPUP 3
|
||||
#define SAVE_POLICY_SIZE 4
|
||||
#define CHEAT_INUSE_ADDR (0x3007FE0u) // see GBATek - Default memory usage at 03007FXX
|
||||
|
||||
typedef struct
|
||||
{
|
||||
// [general]
|
||||
u16 backlight; // Both LCDs.
|
||||
bool directBoot;
|
||||
bool useGbaDb;
|
||||
|
||||
// [video]
|
||||
u8 scaler; // 0 = 1:1, 1 = bilinear (GPU) x1.5, 2 = matrix (hardware) x1.5.
|
||||
float gbaGamma;
|
||||
float lcdGamma;
|
||||
float contrast;
|
||||
float brightness;
|
||||
|
||||
// [game]
|
||||
u8 saveSlot;
|
||||
// TODO: Per-game save type override.
|
||||
|
||||
// [advanced]
|
||||
bool saveOverride;
|
||||
u16 defaultSave;
|
||||
|
||||
// [boost]
|
||||
u8 savePolicy;
|
||||
u8 cheatMode;
|
||||
} OafConfig;
|
||||
typedef struct global_oaf_config OafConfig;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -170,161 +141,14 @@ Result dump_rom( u32 size )
|
||||
// --------------------------
|
||||
// code for oaf config page
|
||||
// --------------------------
|
||||
atp_text_t config_help[] =
|
||||
{
|
||||
"全局参数编辑操作指引",
|
||||
"~ ~ ~ ~ ~ ~ ~",
|
||||
"-修改后的全局参数保存在config.ini ",
|
||||
"保存修改时,存档方案的修改不会保存",
|
||||
"-金手指组合键为下方向+L+R+SELECT",
|
||||
" 也可以使用HOME键直接代替组合键 ",
|
||||
"~ ~ ~ ~ ~ ~ ~",
|
||||
"上下方向键 切换参数项目",
|
||||
"左右方向键 翻页",
|
||||
"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\n" \
|
||||
"[boost]\n" \
|
||||
"cheatMode=%d\n";
|
||||
|
||||
extern atp_error_t help_page( atp_text_t *wording, atp_counter_t length );
|
||||
int get_cheat_mode()
|
||||
int oafCheatMode()
|
||||
{
|
||||
return g_oafConfig.cheatMode;
|
||||
}
|
||||
|
||||
#define LIGHT_MIN (MCU_getSystemModel() > 3 ? 50 : 20)
|
||||
#define LIGHT_MAX (MCU_getSystemModel() > 3 ? 800 : 500)
|
||||
#define SCALER_SIZE 4
|
||||
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 *savetype_name[] = {"和卡带序列号一致", "读取ROM的特定标记", "汉化带SRAM补丁", "自行决定"};
|
||||
const char *cheatmode_name[] = {"关闭金手指", "全程激活", "组合键单次激活", "组合键激活/关闭"};
|
||||
static char buf[16];
|
||||
cfg->extra_text_color = ATP_COLOR_GREEN;
|
||||
if( index == 0 )
|
||||
{
|
||||
ee_snprintf(buf, sizeof(buf), "%d", g_oafConfig.backlight);
|
||||
cfg->text = "屏幕亮度";
|
||||
cfg->extra_text = buf;
|
||||
if( g_oafConfig.backlight == LIGHT_MIN || g_oafConfig.backlight == LIGHT_MAX )
|
||||
cfg->extra_text_color = ATP_COLOR_RED;
|
||||
}
|
||||
else if( index == 1 )
|
||||
{
|
||||
cfg->text = "GAME BOY画面";
|
||||
cfg->extra_text = g_oafConfig.directBoot ? "跳过" : "显示";
|
||||
}
|
||||
else if( index == 2 )
|
||||
{
|
||||
cfg->text = "画面输出";
|
||||
cfg->extra_text = scaler_val[g_oafConfig.scaler];
|
||||
}
|
||||
else if( index == 3 )
|
||||
{
|
||||
cfg->text = "存档方案";
|
||||
cfg->extra_text = savetype_name[g_oafConfig.savePolicy];
|
||||
}
|
||||
else if( index == 4 )
|
||||
{
|
||||
cfg->text = "激活金手指";
|
||||
cfg->extra_text = cheatmode_name[g_oafConfig.cheatMode];
|
||||
}
|
||||
cfg->value = index;
|
||||
return ATP_SUCCESS;
|
||||
}
|
||||
|
||||
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( index == 0 )
|
||||
{
|
||||
u16 light = g_oafConfig.backlight;
|
||||
if( l )
|
||||
{
|
||||
light -= 10;
|
||||
if( light % 10 ) light += 10 - light%10;
|
||||
}
|
||||
else if( r )
|
||||
{
|
||||
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( index == 1 ) g_oafConfig.directBoot = !g_oafConfig.directBoot;
|
||||
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( start )
|
||||
{
|
||||
return ATP_POWER_OFF == help_page( config_help, sizeof(config_help)/sizeof(atp_text_t) )
|
||||
? ATP_POWER_OFF : ATP_PAGE_REFRESH;
|
||||
}
|
||||
else if( x )
|
||||
{
|
||||
int len = strlen(CONFIG_OUTPUT) + 20;
|
||||
char *data = malloc( len );
|
||||
if( data == NULL ) return ATP_PAGE_DOSELECT; // only ignore this save
|
||||
|
||||
len = ee_snprintf(
|
||||
data, len, CONFIG_OUTPUT,
|
||||
g_oafConfig.backlight, g_oafConfig.directBoot ? "true":"false", g_oafConfig.scaler, g_oafConfig.cheatMode
|
||||
);
|
||||
fsQuickWrite("config.ini", data, len);
|
||||
free( data );
|
||||
return ATP_PAGE_DOSELECT;
|
||||
}
|
||||
return ATP_PAGE_UPDATE;
|
||||
}
|
||||
|
||||
atp_error_t oaf_config_page()
|
||||
{
|
||||
u8 base[sizeof(g_oafConfig)];
|
||||
static char title[210];
|
||||
memcpy( base, &g_oafConfig, sizeof(g_oafConfig) );
|
||||
OafConfig *prev = (OafConfig*)&base[0];
|
||||
atp_text_t oldtips;
|
||||
atp_tips("保存X/确定A/返回B", &oldtips);
|
||||
|
||||
ee_snprintf(
|
||||
title, sizeof(title),
|
||||
"参数配置 当前电量:%3d%%"
|
||||
"每次开机存档方案重置为“和卡带序列号一致”,这个方案会优先使用游戏最后一次启动时设置的存档类型", MCU_getBatteryLevel());
|
||||
atp_error_t res = atp_select( title, 5, config_item, config_adjust, NULL, 0, 0, NULL );
|
||||
atp_tips( oldtips, NULL );
|
||||
if( res == ATP_NO_ACTION )
|
||||
{
|
||||
memcpy( &g_oafConfig, prev, sizeof(g_oafConfig) );
|
||||
return ATP_SUCCESS;
|
||||
}
|
||||
else if( res == ATP_SUCCESS )
|
||||
{
|
||||
if( prev->backlight != g_oafConfig.backlight )
|
||||
GFX_setBrightness(g_oafConfig.backlight, g_oafConfig.backlight);
|
||||
}
|
||||
|
||||
return res;
|
||||
return use_config_page(&g_oafConfig);
|
||||
}
|
||||
|
||||
// cache the savetype
|
||||
|
189
source/arm11/pages.c
Normal file
189
source/arm11/pages.c
Normal file
@ -0,0 +1,189 @@
|
||||
#include "arm11/pages.h"
|
||||
#include "arm11/drivers/mcu.h"
|
||||
|
||||
/// @brief base process for helping page
|
||||
/// @param table
|
||||
/// @param index
|
||||
/// @param config
|
||||
/// @return
|
||||
static atp_error_t display_help( atp_callerdata_t table, atp_counter_t index, atp_linecfg_t *config )
|
||||
{
|
||||
atp_text_t *list = (atp_text_t*)table;
|
||||
config->text_align = ATP_PLACEMENT_CENTER;
|
||||
config->text_color = index == 0 ? ATP_COLOR_MAGENTA : ATP_COLOR_LIGHT;
|
||||
config->text = list[index];
|
||||
return ATP_SUCCESS;
|
||||
}
|
||||
|
||||
/// @brief display a static page for help
|
||||
/// @param wording static string array
|
||||
/// @param length the size of array
|
||||
/// @return
|
||||
atp_error_t help_page( atp_text_t *wording, atp_counter_t length )
|
||||
{
|
||||
atp_text_t current;
|
||||
atp_tips( "返回:按A/B", ¤t );
|
||||
atp_error_t res = atp_show( length, display_help, (atp_callerdata_t)wording );
|
||||
atp_tips( current, NULL );
|
||||
return res;
|
||||
}
|
||||
|
||||
// --------------------------
|
||||
// code for oaf config page
|
||||
// --------------------------
|
||||
atp_text_t config_help[] =
|
||||
{
|
||||
"全局参数编辑操作指引",
|
||||
"~ ~ ~ ~ ~ ~ ~",
|
||||
"-修改后的全局参数保存在config.ini ",
|
||||
"保存修改时,存档方案的修改不会保存",
|
||||
"-金手指组合键为下方向+L+R+SELECT",
|
||||
" 也可以使用HOME键直接代替组合键 ",
|
||||
"~ ~ ~ ~ ~ ~ ~",
|
||||
"上下方向键 切换参数项目",
|
||||
"左右方向键 翻页",
|
||||
"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\n" \
|
||||
"[boost]\n" \
|
||||
"cheatMode=%d\n";
|
||||
|
||||
typedef struct global_oaf_config OafConfig;
|
||||
|
||||
static char page_strbuf[512];
|
||||
|
||||
#define LIGHT_MIN (MCU_getSystemModel() > 3 ? 50 : 20)
|
||||
#define LIGHT_MAX (MCU_getSystemModel() > 3 ? 800 : 500)
|
||||
#define SCALER_SIZE 4
|
||||
static atp_error_t config_item( atp_callerdata_t gblcfg, atp_counter_t index, atp_itemcfg_t *cfg )
|
||||
{
|
||||
//static char buf[16];
|
||||
OafConfig *g_oafConfig = (OafConfig*)gblcfg;
|
||||
const char *scaler_val[] = {"上屏无缩放", "上屏GPU放大", "上屏DMA放大", "下屏无缩放"};
|
||||
const char *savetype_name[] = {"和卡带序列号一致", "读取ROM的特定标记", "汉化带SRAM补丁", "自行决定"};
|
||||
const char *cheatmode_name[] = {"关闭金手指", "全程激活", "组合键单次激活", "组合键激活/关闭"};
|
||||
cfg->extra_text_color = ATP_COLOR_GREEN;
|
||||
if( index == 0 )
|
||||
{
|
||||
ee_snprintf(page_strbuf, sizeof(page_strbuf), "%d", g_oafConfig->backlight);
|
||||
cfg->text = "屏幕亮度";
|
||||
cfg->extra_text = page_strbuf;
|
||||
if( g_oafConfig->backlight == LIGHT_MIN || g_oafConfig->backlight == LIGHT_MAX )
|
||||
cfg->extra_text_color = ATP_COLOR_RED;
|
||||
}
|
||||
else if( index == 1 )
|
||||
{
|
||||
cfg->text = "GAME BOY画面";
|
||||
cfg->extra_text = g_oafConfig->directBoot ? "跳过" : "显示";
|
||||
}
|
||||
else if( index == 2 )
|
||||
{
|
||||
cfg->text = "画面输出";
|
||||
cfg->extra_text = scaler_val[g_oafConfig->scaler];
|
||||
}
|
||||
else if( index == 3 )
|
||||
{
|
||||
cfg->text = "存档方案";
|
||||
cfg->extra_text = savetype_name[g_oafConfig->savePolicy];
|
||||
}
|
||||
else if( index == 4 )
|
||||
{
|
||||
cfg->text = "激活金手指";
|
||||
cfg->extra_text = cheatmode_name[g_oafConfig->cheatMode];
|
||||
}
|
||||
cfg->value = index;
|
||||
return ATP_SUCCESS;
|
||||
}
|
||||
|
||||
static atp_pageopt_t config_adjust( atp_callerdata_t gblcfg, 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 )
|
||||
{
|
||||
OafConfig *g_oafConfig = (OafConfig*)gblcfg;
|
||||
if( l || r )
|
||||
{
|
||||
if( index == 0 )
|
||||
{
|
||||
u16 light = g_oafConfig->backlight;
|
||||
if( l )
|
||||
{
|
||||
light -= 10;
|
||||
if( light % 10 ) light += 10 - light%10;
|
||||
}
|
||||
else if( r )
|
||||
{
|
||||
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( index == 1 ) g_oafConfig->directBoot = !g_oafConfig->directBoot;
|
||||
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( start )
|
||||
{
|
||||
return ATP_POWER_OFF == help_page( config_help, sizeof(config_help)/sizeof(atp_text_t) )
|
||||
? ATP_POWER_OFF : ATP_PAGE_REFRESH;
|
||||
}
|
||||
else if( x )
|
||||
{
|
||||
int len = strlen(CONFIG_OUTPUT) + 20;
|
||||
char *data = malloc( len );
|
||||
if( data == NULL ) return ATP_PAGE_DOSELECT; // only ignore this save
|
||||
|
||||
len = ee_snprintf(
|
||||
data, len, CONFIG_OUTPUT,
|
||||
g_oafConfig.backlight, g_oafConfig.directBoot ? "true":"false", g_oafConfig.scaler, g_oafConfig.cheatMode
|
||||
);
|
||||
fsQuickWrite("config.ini", data, len);
|
||||
free( data );
|
||||
return ATP_PAGE_DOSELECT;
|
||||
}
|
||||
return ATP_PAGE_UPDATE;
|
||||
}
|
||||
|
||||
atp_error_t use_config_page( OafConfig *g_oafConfig )
|
||||
{
|
||||
u8 base[sizeof(OafConfig)];
|
||||
memcpy( base, g_oafConfig, sizeof(OafConfig) );
|
||||
OafConfig *prev = (OafConfig*)&base[0];
|
||||
|
||||
atp_text_t oldtips;
|
||||
atp_tips("保存X/确定A/返回B", &oldtips);
|
||||
|
||||
ee_snprintf(
|
||||
page_strbuf, sizeof(page_strbuf),
|
||||
"参数配置 当前电量:%3d%%"
|
||||
"每次开机存档方案重置为“和卡带序列号一致”,这个方案会优先使用游戏最后一次启动时设置的存档类型", MCU_getBatteryLevel());
|
||||
atp_error_t res = atp_select( page_strbuf, 5, config_item, config_adjust, g_oafConfig, 0, 0, NULL );
|
||||
atp_tips( oldtips, NULL );
|
||||
if( res == ATP_NO_ACTION )
|
||||
{
|
||||
memcpy( g_oafConfig, prev, sizeof(OafConfig) );
|
||||
return ATP_SUCCESS;
|
||||
}
|
||||
else if( res == ATP_SUCCESS )
|
||||
{
|
||||
if( prev->backlight != g_oafConfig->backlight )
|
||||
GFX_setBrightness(g_oafConfig->backlight, g_oafConfig->backlight);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user