This commit is contained in:
anod 2023-03-11 23:17:13 +08:00
parent 91618a5858
commit 3463ba398c

View File

@ -146,7 +146,7 @@ static int32_t bin_search( FHandle fd, acl_text_t game )
if( serials == NULL ){
return -ACHTLIB_NOMEM;
}
log("1");
uint32_t readed;
if( RES_OK != fReadSize(fd, serials, size, &readed)
|| readed != size )
@ -154,10 +154,10 @@ static int32_t bin_search( FHandle fd, acl_text_t game )
free( serials );
return -ACHTLIB_INVALID;
}
log("2");
int start = 0, end = gblcht.serc - 1;
size = ACL_SERIAL_LEN(1);
int found = -1;log("3");
int found = -1; log("1");
while( start <= end )
{
int mid = (start+end) >> 1;
@ -172,8 +172,8 @@ log("2");
start = mid + 1;
}
else end = mid - 1;
}
free( serials );log("4");
}log("4");
free( serials );
return found < 0 ? -ACHTLIB_NOT_FOUND : found;
}
@ -181,7 +181,6 @@ log("2");
#define config_type(n) ( (n) & 0xff )
acl_error_t acl_select_game( acl_text_t game, acl_boolean_t filter, acl_count_t *n )
{
extern void log( const char * );
CheatLib *inst = (CheatLib*)&gblcht;
FHandle fd;
if( inst->serc == 0 ) return ACHTLIB_NOT_OPEN;
@ -195,10 +194,10 @@ acl_error_t acl_select_game( acl_text_t game, acl_boolean_t filter, acl_count_t
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) )
@ -206,14 +205,14 @@ log("2");
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]);