From f4a73b2901d9e2d9cc52e63d12707001d0e68014 Mon Sep 17 00:00:00 2001 From: anod <182859762@qq.com> Date: Tue, 21 Mar 2023 10:06:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E4=BA=8E=E6=89=A9=E5=AE=B9=E7=9A=84ro?= =?UTF-8?q?m=EF=BC=8C=E4=BF=AE=E6=94=B9=E6=89=A9=E5=AE=B9=E6=96=B9?= =?UTF-8?q?=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/arm11/cheat.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/arm11/cheat.c b/source/arm11/cheat.c index eedf2a6..404f94e 100644 --- a/source/arm11/cheat.c +++ b/source/arm11/cheat.c @@ -401,7 +401,13 @@ static CodeLocation rom_fit_newsize( CodeLocation rom, int realend, int totalsiz // grow cart volumn else if( szrom < size || nextPow2(size) != nextPow2(szrom) ) - *newsize = size; + { + u32 sznrom = nextPow2(size); + u32 start = realend - INSTR_SIZE; + memset( &rom[INSTR_LEN(start)], 0, sznrom-start ); + *newsize = sznrom; + return rom + sznrom - ( (totalsize+0x1f) & (~0xf) ); + } return rom + INSTR_LEN( realend ); }