添加了存档策略的代码

This commit is contained in:
anod 2022-10-17 18:18:39 +08:00
parent 7324ad6e3e
commit ab8c6085f0
2 changed files with 10 additions and 3 deletions

View File

@ -316,6 +316,7 @@ atp_error_t atp_select( atp_text_t title, atp_counter_t cnt, atp_itemprovider_t
break;
case ATP_POWER_OFF:
return ATP_POWER_OFF;
break;
default:
;
}

View File

@ -63,7 +63,7 @@
#define SAVE_POLICY_FIRM 1
#define SAVE_POLICY_SRAM 2
#define SAVE_POLICY_POPUP 3
#define SAVE_POLICY_SIZE 3
#define SAVE_POLICY_SIZE 4
typedef struct
{
@ -148,7 +148,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 )
{
const char *scaler_val[] = {"上屏无缩放", "上屏GPU放大", "上屏DMA放大", "下屏无缩放"};
const char *savetype_name[] = {"和卡带序列号一致", "读取ROM的特定标记", "汉化带SRAM补丁"};
const char *savetype_name[] = {"和卡带序列号一致", "读取ROM的特定标记", "汉化带SRAM补丁", "我知道选哪个"};
static char buf[16];
cfg->extra_text_color = ATP_COLOR_GREEN;
if( index == 0 )
@ -305,6 +305,9 @@ static u16 checkSaveOverride(u32 gameCode) // Save type overrides for modern hom
case 'S': return SAVE_TYPE_SRAM_256k; // Homebrew using SRAM (Butano games).
}
if( g_oafConfig.savePolicy != SAVE_POLICY_GBADB ) // skip the mapping
return 0xFF;
Result res;
FHandle f;
GameDbEntry instance;
@ -321,7 +324,6 @@ static u16 checkSaveOverride(u32 gameCode) // Save type overrides for modern hom
code = (u32*)instance.serial;
if( (*code & 0xFFFFFFu) == similarCode ) {
debug_printf("match serial: %08lx\n", *code);
if( *code == gameCode ){
fClose(f);
return instance.attr & 0xFu;
@ -349,6 +351,10 @@ static u16 detectSaveType(u32 romSize)
"saveType: %u\n", saveType);
return saveType;
}
if( g_oafConfig.savePolicy == SAVE_POLICY_SRAM )
{
return SAVE_TYPE_SRAM_256k;
}
// Code based on: https://github.com/Gericom/GBARunner2/blob/master/arm9/source/save/Save.vram.cpp
romPtr += 0xE4 / 4; // Skip headers.