mirror of
https://gitee.com/anod/open_agb_firm.git
synced 2025-05-06 05:44:11 +08:00
用release发布就出现了异常。目前已解决,解决的核心方案是fread的时候要多读取一点数据
This commit is contained in:
parent
decffac7e1
commit
d06676bbff
@ -63,7 +63,7 @@ struct global_oaf_config
|
|||||||
|
|
||||||
Result oafParseConfigEarly(void);
|
Result oafParseConfigEarly(void);
|
||||||
u16 oafGetBacklightConfig(void);
|
u16 oafGetBacklightConfig(void);
|
||||||
Result oafInitAndRun( char * );
|
Result oafInitAndRun( char * , bool * );
|
||||||
void oafUpdate(void);
|
void oafUpdate(void);
|
||||||
void oafFinish(void);
|
void oafFinish(void);
|
||||||
Result oafPreboot( const char * );
|
Result oafPreboot( const char * );
|
||||||
|
@ -76,13 +76,14 @@ int main()
|
|||||||
strncpy( firm_path, FIRMPATH_INCOME, FIRMPATH_SIZELIMIT );
|
strncpy( firm_path, FIRMPATH_INCOME, FIRMPATH_SIZELIMIT );
|
||||||
|
|
||||||
Result res = fMount(FS_DRIVE_SDMC);
|
Result res = fMount(FS_DRIVE_SDMC);
|
||||||
|
bool direct_off = false;
|
||||||
if(res == RES_OK) res = oafParseConfigEarly();
|
if(res == RES_OK) res = oafParseConfigEarly();
|
||||||
GFX_init(GFX_BGR8, GFX_RGB565);
|
GFX_init(GFX_BGR8, GFX_RGB565);
|
||||||
setBacklight();
|
setBacklight();
|
||||||
consoleInit(SCREEN_BOT, NULL);
|
consoleInit(SCREEN_BOT, NULL);
|
||||||
//CODEC_init();
|
//CODEC_init();
|
||||||
|
|
||||||
if(res == RES_OK && (res = oafInitAndRun(firm_path)) == RES_OK)
|
if(res == RES_OK && (res = oafInitAndRun(firm_path, &direct_off)) == RES_OK)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
@ -95,7 +96,7 @@ int main()
|
|||||||
reboot = oafHaltMode();
|
reboot = oafHaltMode();
|
||||||
oafFinish();
|
oafFinish();
|
||||||
}
|
}
|
||||||
else printErrorWaitInput(res, 0);
|
else if( !direct_off ) printErrorWaitInput(res, 0);
|
||||||
|
|
||||||
if( reboot ) {
|
if( reboot ) {
|
||||||
if( RES_OK == oafPreboot(firm_path) )
|
if( RES_OK == oafPreboot(firm_path) )
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "arm_intrinsic.h"
|
#include "arm_intrinsic.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
#include "drivers/cache.h"
|
||||||
#include "drivers/sha.h"
|
#include "drivers/sha.h"
|
||||||
#include "arm11/drivers/hid.h"
|
#include "arm11/drivers/hid.h"
|
||||||
// @MERGE 231006 START
|
// @MERGE 231006 START
|
||||||
@ -975,9 +976,10 @@ KHandle setupFrameCapture(const u8 scaler)
|
|||||||
}
|
}
|
||||||
// @MERGE 231006 END
|
// @MERGE 231006 END
|
||||||
|
|
||||||
Result oafInitAndRun( char *firm_path )
|
Result oafInitAndRun( char *firm_path, bool *direct_off )
|
||||||
{
|
{
|
||||||
Result res;
|
Result res;
|
||||||
|
flushDCache();
|
||||||
repairBootFirm( firm_path );
|
repairBootFirm( firm_path );
|
||||||
char *const filePath = (char*)calloc(512, 1);
|
char *const filePath = (char*)calloc(512, 1);
|
||||||
if(filePath != NULL)
|
if(filePath != NULL)
|
||||||
@ -988,7 +990,11 @@ Result oafInitAndRun( char *firm_path )
|
|||||||
// If this file doesn't exist show the file browser.
|
// If this file doesn't exist show the file browser.
|
||||||
if((res = fsLoadPathFromFile("autoboot.txt", filePath)) == RES_FR_NO_FILE)
|
if((res = fsLoadPathFromFile("autoboot.txt", filePath)) == RES_FR_NO_FILE)
|
||||||
{
|
{
|
||||||
if((res = showFileBrowser(filePath)) != RES_OK || *filePath == '\0') break;
|
if((res = showFileBrowser(filePath)) != RES_OK || *filePath == '\0')
|
||||||
|
{
|
||||||
|
*direct_off = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
ee_puts("Loading...");
|
ee_puts("Loading...");
|
||||||
}
|
}
|
||||||
else if(res != RES_OK) break;
|
else if(res != RES_OK) break;
|
||||||
@ -1070,6 +1076,7 @@ Result oafInitAndRun( char *firm_path )
|
|||||||
else res = RES_OUT_OF_MEM;
|
else res = RES_OUT_OF_MEM;
|
||||||
|
|
||||||
free(filePath);
|
free(filePath);
|
||||||
|
flushDCache();
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@ -1131,29 +1138,28 @@ static bool checkLumaFirm( const char *file )
|
|||||||
|
|
||||||
static void repairBootFirm( char *firm_path )
|
static void repairBootFirm( char *firm_path )
|
||||||
{
|
{
|
||||||
if( 0 == strcmp(firm_path, autorun) )
|
size_t n = FIRMPATH_SIZELIMIT-1;
|
||||||
|
char tmp[512]; // 为啥不是0x40?因为fsLoadPathFromFile要的是512
|
||||||
|
if( 0 == strncmp(firm_path, autorun, n) )
|
||||||
{
|
{
|
||||||
char firmname[512]; // 为啥不是0x40?因为fsLoadPathFromFile要的是512
|
if( RES_OK == fsLoadPathFromFile("autorun", tmp) )
|
||||||
if( RES_OK == fsLoadPathFromFile("autorun", firmname) )
|
|
||||||
{
|
{
|
||||||
fRename( autorun, firmname );
|
fRename( autorun, tmp );
|
||||||
strncpy( firm_path, firmname, 0x3f );
|
strncpy( firm_path, tmp, n );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const char *default_path = "sdmc:/luma/payloads/open_agb_firm.firm";
|
const char *default_path = "sdmc:/luma/payloads/open_agb_firm.firm";
|
||||||
fRename( autorun, default_path );
|
fRename( autorun, default_path );
|
||||||
strncpy( firm_path, default_path, 0x3f );
|
strncpy( firm_path, default_path, n );
|
||||||
}
|
}
|
||||||
firm_path[0x3f] = '\0';
|
firm_path[n] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
// 把Preboot存档的boot.firm恢复回去
|
// 把Preboot存档的boot.firm恢复回去
|
||||||
char tmp[5];
|
if( RES_OK == fsQuickRead("luma.firm", tmp, 63) )
|
||||||
if( RES_OK == fsQuickRead("luma.firm", tmp, 4) )
|
|
||||||
{
|
{
|
||||||
tmp[4] = '\0';
|
if( strncmp(tmp, "FIRM", 4) == 0 ){
|
||||||
if( strcmp(tmp, "FIRM") == 0 ){
|
|
||||||
fRename("sdmc:/boot.firm", "sdmc:/3ds/open_agb_firm/boot.firm");
|
fRename("sdmc:/boot.firm", "sdmc:/3ds/open_agb_firm/boot.firm");
|
||||||
fRename("sdmc:/3ds/open_agb_firm/luma.firm", "sdmc:/boot.firm");
|
fRename("sdmc:/3ds/open_agb_firm/luma.firm", "sdmc:/boot.firm");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user