This commit is contained in:
anod 2023-03-11 22:57:03 +08:00
parent d79f7e7e0f
commit 5d337bd0e0

View File

@ -1,5 +1,4 @@
#include "arm11/acl.h"
#include "arm11/fmt.h"
#include "fs.h"
#include <stdlib.h>
@ -187,17 +186,17 @@ acl_error_t acl_select_game( acl_text_t game, acl_boolean_t filter, acl_count_t
if( strlen(game) != ACL_GBA_CODELEN ) return ACHTLIB_NOT_FOUND;
if( RES_OK != fOpen(&fd, inst->aclfile, FA_OPEN_EXISTING | FA_READ) )
return ACHTLIB_INVALID;
ee_printf("\x1b[2Jsearch\n");
int32_t index = bin_search( fd, game );
if( index < 0 )
{
fClose( fd );
return index * -1;
}
log("1");
uint32_t offset = ACL_HEADER_LEN + ACL_SERIAL_LEN(inst->serc);
offset += ACL_INDEX_OFFSET(index);
log("2");
uint32_t readed;
uint16_t groups[2];
if( RES_OK != fLseek(fd, offset) )
@ -205,14 +204,14 @@ ee_printf("\x1b[2Jsearch\n");
fClose( fd );
return ACHTLIB_INVALID;
}
log("3");
if( RES_OK != fRead(fd, groups, sizeof(groups), &readed)
|| readed != sizeof(groups) )
{
fClose( fd );
return ACHTLIB_INVALID;
}
log("4");
offset = ACL_HEADER_LEN + ACL_SERIAL_LEN(inst->serc) + ACL_INDEX_OFFSET(inst->serc+1);
offset += ACL_CONFIG_OFFSET(groups[0]);