mirror of
https://gitee.com/anod/open_agb_firm.git
synced 2025-05-07 06:14:12 +08:00
修正代码的bug
This commit is contained in:
parent
817f7a2b1c
commit
2894a7bcea
Binary file not shown.
@ -116,13 +116,18 @@ const format = roms => {
|
||||
const getnametable = list => list.reduce( (r,{serial, cheat}, idx, arr) => {
|
||||
const val = serial.slice(0, -1);
|
||||
if( val != r[4] ){
|
||||
if( r[1].length > 0 && r[2] - r[1].at(-1) > r[3] )
|
||||
r[3] = r[2] - r[1].at(-1);
|
||||
r[0] = concat( r[0], enc.encode(val) )
|
||||
r[1] = concat( r[1], [ r[2] ] );
|
||||
r[4] = val;
|
||||
}
|
||||
if( cheat.length > r[3] ) r[3] = cheat.length;
|
||||
r[2] = r[2] + cheat.length;
|
||||
if( idx+1 == arr.length ) r[1] = concat( r[1], [ r[2] ] );
|
||||
if( idx+1 == arr.length ) {
|
||||
if( r[2] - r[1].at(-1) > r[3] )
|
||||
r[3] = r[2] - r[1].at(-1);
|
||||
r[1] = concat( r[1], [ r[2] ] );
|
||||
}
|
||||
return r;
|
||||
}, [new Uint8Array(), new Uint16Array(), 0, 0, ""] );
|
||||
|
||||
@ -139,7 +144,7 @@ const format = roms => {
|
||||
|
||||
const [sers, offs, chtc, maxl] = getnametable( valid );
|
||||
const [cheats, expanded] = expandcheat( valid, 8+sers.length+offs.length*2+chtc*8 );
|
||||
console.info( `name: ${sers.length} cheats: ${chtc}` );
|
||||
console.info( `name: ${sers.length} cheats: ${chtc} maxl: ${maxl}` );
|
||||
|
||||
const serialbase = 8;
|
||||
const offsetbase = serialbase + sers.length;
|
||||
|
Loading…
x
Reference in New Issue
Block a user