void setup(void) { int i; char *p = (char *)MAIN_SETUP_ENTRY; for (i = 0; i < 8; i++) { read_sect(p, 1+i); p += 512; } void (*main_setup)(void) = (void (*)())MAIN_SETUP_ENTRY; main_setup(); }
static int read_cwdb(char *filename, char *gameid) { int pos=0; char *p; char cw_buf[300]; u32 address,val; t_mem_table t; PspFile pf; if(openfile(filename, &pf)==0) return 1; if(gameid!=NULL){ char codename[11]; mips_memcpy(codename,gameid,10); codename[10]=0; do{ pos=read_sect(pos,&pf); p=strstr(pf.buf,codename); if(p) break; } while(pos); } else{ read_sect(pos,&pf); p=pf.buf; p=read_line(p,cw_buf); } if(p==0) { closefile(&pf); return 1; } #ifdef BIG5_ENCODE_TEXT t_encodepack pack; char *big5buf = malloc(41688); if(big5buf==NULL) return 1; if(big5_init(big5buf,&pack)==0 && encode_init(&pack)==0) { charsets_big5_conv(p,&pack); encode_free(&pack); } free(big5buf); #endif p=read_line(p,cw_buf); mips_memcpy(ui_get_gamename()+12,cw_buf+3,0x40); int repeat=0; int lock =0; char namebuf[80]; char *namep; char nullcode=0; while(1){ //金手指码部分 p=read_line(p,cw_buf); if(cw_buf[0]=='_'){ if(cw_buf[1]=='C'){ if(nullcode==1) { t.addr=0x8800000; t.value=0; t.type=0; t.lock=0; if(mem_table_add(&t)<0) goto READOUT; } repeat=0; namep = namebuf; mips_memcpy(namebuf,cw_buf+4,70); lock = strtoul(cw_buf+2,NULL,16); namep = read_name(namep, t.name, 10); mips_memcpy(t.name,namebuf,30); t.name[30]=0; t.name[31]=0; nullcode=1; } else if(cw_buf[1]=='L'){ nullcode=0; if(repeat<5){ if(repeat==0) { } else{ t.name[0] = '+'; namep = read_name(namep, t.name+1, 9); } repeat++; } else{//strcpy(t.name,"+"); t.name[0]='+'; t.name[1]=0; } char *tempptr; address=strtoul(cw_buf+2,&tempptr,16)+0x08800000; val=strtoul(tempptr,NULL,16); t.addr=address; t.value=val; t.type=0; t.lock=lock; if(mem_table_add(&t)<0) goto READOUT; } else if(cw_buf[1]=='S'){ break; } } if(p==0) break; if(p[0]=='_' && p[1]=='S') break; } READOUT: closefile(&pf); return 0; }