From afeb36ef4051ff29c7be680c193b1acf373a1c2b Mon Sep 17 00:00:00 2001 From: anod <182859762@qq.com> Date: Thu, 19 Jan 2023 00:03:51 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=A7=E7=BB=AD=E5=A2=9E=E5=8A=A0=E8=B0=83?= =?UTF-8?q?=E8=AF=95=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/arm11/acl.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/source/arm11/acl.c b/source/arm11/acl.c index 7e529cd..c50f8fb 100644 --- a/source/arm11/acl.c +++ b/source/arm11/acl.c @@ -4,7 +4,7 @@ #include #include -static void log( const char *path, const void *buf, uint32_t size ) +static void memo( const char *path, const void *buf, uint32_t size ) { Result res; FHandle f; @@ -183,39 +183,40 @@ static int32_t bin_search( acl_text_t game ) #define config_type(n) ( (n) & 0xff ) acl_error_t acl_select_game( acl_text_t game, acl_boolean_t filter, acl_count_t *n ) { +memo("sel.log", "0", 1); CheatLib *inst = (CheatLib*)&gblcht; if( inst->serc == 0 ) return ACHTLIB_NOT_OPEN; if( strlen(game) != ACL_GBA_CODELEN ) return ACHTLIB_NOT_FOUND; -log("sel.log", "1", 1); +memo("sel.log", "1", 1); int32_t index = bin_search( game ); if( index < 0 ) return index * -1; -log("sel.log", "2", 1); +memo("sel.log", "2", 1); uint32_t offset = ACL_HEADER_LEN + ACL_SERIAL_LEN(inst->serc); offset += ACL_INDEX_OFFSET(index); -log("sel.log", "3", 1); +memo("sel.log", "3", 1); uint32_t readed; uint16_t groups[2]; if( RES_OK != fLseek(inst->fd, offset) ) return ACHTLIB_INVALID; -log("sel.log", "4", 1); +memo("sel.log", "4", 1); if( RES_OK != fRead(inst->fd, groups, sizeof(groups), &readed) || readed != sizeof(groups) ) return ACHTLIB_INVALID; -log("sel.log", "5", 1); +memo("sel.log", "5", 1); offset = ACL_HEADER_LEN + ACL_SERIAL_LEN(inst->serc) + ACL_INDEX_OFFSET(inst->serc+1); offset += ACL_CONFIG_OFFSET(groups[0]); -log("sel.log", "6", 1); +memo("sel.log", "6", 1); int32_t gcount = groups[1] - groups[0]; if( RES_OK != fLseek(inst->fd, offset) ) return ACHTLIB_INVALID; -log("sel.log", "7", 1); +memo("sel.log", "7", 1); CheatCfg *cfg = inst->list; if( RES_OK != fRead(inst->fd, cfg, gcount * sizeof(CheatCfg), &readed) // 可能需要多次fread || readed != gcount * sizeof(CheatCfg) ) { return ACHTLIB_INVALID; } -log("sel.log", "8", 1); +memo("sel.log", "8", 1); if( filter ) { char reg = game[3]; @@ -234,7 +235,7 @@ log("sel.log", "8", 1); } } } -log("sel.log", "9", 1); +memo("sel.log", "9", 1); inst->listc = gcount; inst->setid = 0; *n = gcount;