void Mapper111_Init(CartInfo *info) { info->Power = M111Power; info->Close = M111Close; CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE); SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1); GameStateRestore = StateRestore; AddExState(&StateRegs, ~0, 0, 0); AddExState(CHRRAM, CHRRAMSIZE, 0, "CRAM"); flash = (info->battery != 0); if (flash) { FLASHROM = (uint8*)FCEU_gmalloc(FLASHROMSIZE); info->SaveGame[0] = FLASHROM; info->SaveGameLen[0] = FLASHROMSIZE; AddExState(FLASHROM, FLASHROMSIZE, 0, "FROM"); AddExState(&FlashRegs, ~0, 0, 0); // copy PRG ROM into FLASHROM, use it instead of PRG ROM const uint32 PRGSIZE = ROM_size * 16 * 1024; for (uint32 w=0, r=0; w<FLASHROMSIZE; ++w) { FLASHROM[w] = ROM[r]; ++r; if (r >= PRGSIZE) r = 0; } SetupCartPRGMapping(0x10, FLASHROM, FLASHROMSIZE, 0); } }
static int LoadCHR(FCEUFILE *fp) { int z,t; z=uchead.ID[3]-'0'; if(z<0 || z>15) return(0); FCEU_printf(" CHR ROM %d size: %d",z,(int) uchead.info); if(malloced[16+z]) free(malloced[16+z]); t=FixRomSize(uchead.info,8192); if(!(malloced[16+z]=(uint8 *)FCEU_malloc(t))) return(0); mallocedsizes[16+z]=t; memset(malloced[16+z]+uchead.info,0xFF,t-uchead.info); if(FCEU_fread(malloced[16+z],1,uchead.info,fp)!=uchead.info) { FCEU_printf("Read Error!\n"); return(0); } else FCEU_printf("\n"); SetupCartCHRMapping(z,malloced[16+z],t,0); return(1); }
static void InitializeBoard(void) { if(!sboardname) throw MDFN_Error(0, _("Missing UNIF board name.")); for(auto const& bm : bmap) { if(!strcmp((char *)sboardname, (char *)bm.name)) { for(unsigned i = 0; i < 16; i++) { if((bm.prg_rm & (1U << i)) && !malloced[i]) throw MDFN_Error(0, _("Missing PRG ROM %u."), i); } if(!malloced[16]) { if(bm.flags & BMCFLAG_32KCHRR) CHRRAMSize = 32768; else CHRRAMSize = 8192; UNIFchrrama = (uint8 *)MDFN_malloc_T(CHRRAMSize, _("CHR RAM")); SetupCartCHRMapping(0,UNIFchrrama,CHRRAMSize,1); } if(bm.flags & BMCFLAG_FORCE4) mirrortodo=4; InitBoardMirroring(); bm.init(&UNIFCart); return; } } throw MDFN_Error(0, _("Board type not supported.")); }
static int InitializeBoard(void) { int x=0; if(!sboardname) return(0); while(bmap[x].name) { if(!strcmp(sboardname,(char *)bmap[x].name)) { if(!malloced[16]) { if(bmap[x].flags & BMCFLAG_16KCHRR) CHRRAMSize = 16384; else CHRRAMSize = 8192; if((UNIFchrrama=(uint8 *)FCEU_malloc(CHRRAMSize))) { SetupCartCHRMapping(0,UNIFchrrama,CHRRAMSize,1); AddExState(UNIFchrrama, CHRRAMSize, 0,"CHRR"); } else return(-1); } if(bmap[x].flags&BMCFLAG_FORCE4) mirrortodo=4; MooMirroring(); bmap[x].init(&UNIFCart); return(1); } x++; } FCEU_PrintError("Board type not supported."); return(0); }
int Mapper77_Init(CartInfo *info) { info->Power = Power; info->StateAction = StateAction; SetupCartCHRMapping(0x10, CHRRAM, 8192, 1); SetWriteHandler(0x6000,0xffff,Mapper77_write); SetReadHandler(0x8000, 0xFFFF, CartBR); return(1); }
void UNLSHeroes_Init(CartInfo *info) { GenMMC3_Init(info, 256, 512, 0, 0); cwrap = MSHCW; info->Power = MSHPower; info->Reset = MSHReset; info->Close = MSHClose; CHRRAM = (uint8*)FCEU_gmalloc(8192); SetupCartCHRMapping(0x10, CHRRAM, 8192, 1); AddExState(EXPREGS, 4, 0, "EXPR"); AddExState(&tekker, 1, 0, "DIPSW"); }
void Mapper168_Init(CartInfo *info) { info->Power = M168Power; info->Close = MNNNClose; GameStateRestore = StateRestore; AddExState(&StateRegs, ~0, 0, 0); CHRRAMSIZE = 8192 * 8; CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE); SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1); AddExState(CHRRAM, CHRRAMSIZE, 0, "CRAM"); }
void Mapper181_Init(CartInfo *info) { Sync = Sync181; info->Power = MPower; info->Close = MClose; GameStateRestore = MRestore; DummyCHR = (uint8*)FCEU_gmalloc(8192); int x; for (x = 0; x < 8192; x++) DummyCHR[x] = 0xff; SetupCartCHRMapping(0x10, DummyCHR, 8192, 0); AddExState(StateRegs, ~0, 0, 0); }
void Mapper96_init(void) { SetWriteHandler(0x8000,0xffff,Mapper96_write); PPU_hook=M96Hook; AddExState(&latche, 1, 0, "LATC"); AddExState(&M96LA, 1, 0, "LAVA"); SetupCartCHRMapping(0x10, MapperExRAM, 32768, 1); latche=M96LA=0; M96Sync(0); setmirror(MI_0); GameStateRestore=M96Sync; }
void Mapper199_Init(CartInfo *info) { int CHRRAMSize=1024*8; GenMMC3_Init(info, 512, 256, 8, info->battery); cwrap=M199CW; pwrap=M199PW; mwrap=M199MW; info->Power=M199Power; CHRRAM=(uint8*)FCEU_gmalloc(CHRRAMSize); SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSize, 1); AddExState(CHRRAM, CHRRAMSize, 0, "CHRR"); AddExState(EXPREGS, 4, 0, "EXPR"); }
void Super24_Init(CartInfo *info) { GenMMC3_Init(info, 128, 256, 0, 0); info->Power=Super24Power; info->Reset=Super24Reset; info->Close=Super24Close; cwrap=Super24CW; pwrap=Super24PW; CHRRAM=(uint8*)FCEU_gmalloc(8192); SetupCartCHRMapping(0x10, CHRRAM, 8192, 1); AddExState(CHRRAM, 8192, 0, "CHRR"); AddExState(EXPREGS, 3, 0, "BIG2"); }
int Super24_Init(CartInfo *info) { info->Power=Super24Reset; info->StateAction = StateAction; info->Close = Super24Close; SetupCartCHRMapping(0x10, CHRRAM, 8192, 1); SetWriteHandler(0x8000,0xBFFF,Super24hiwrite); SetWriteHandler(0x5000,0x7FFF,Super24Write); SetWriteHandler(0xC000,0xFFFF,Sup24IRQWrite); SetReadHandler(0x8000,0xFFFF,CartBR); return(1); }
void Super24_Init(CartInfo *info) { info->Power=Super24Reset; SetupCartCHRMapping(0x10, GameMemBlock, 8192, 1); GameStateRestore=MrRestore; AddExState(GameMemBlock, 8192, 0, "CHRR"); AddExState(DRegBuf, 8, 0, "DREG"); AddExState(&IRQCount, 4, 1, "IRQC"); AddExState(&IRQLatch, 4, 1, "IQL1"); AddExState(&IRQa, 1, 0, "IRQA"); AddExState(&sizer, 1, 0, "SIZA"); AddExState(&bigbank, 1, 0, "BIG1"); AddExState(&bigbank2, 1, 0, "BIG2"); }
void Mapper199_Init(CartInfo *info) { GenMMC3_Init(info, 512, 256, 8, info->battery); cwrap = M199CW; pwrap = M199PW; mwrap = M199MW; info->Power = M199Power; info->Close = M199Close; CHRRAMSIZE = 8192; CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE); SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1); AddExState(CHRRAM, CHRRAMSIZE, 0, "CHRR"); AddExState(EXPREGS, 4, 0, "EXPR"); }
int Mapper96_Init(CartInfo *info) { if(!(M96_CHR = (uint8 *)malloc(32768))) return(0); SetWriteHandler(0x8000, 0xffff, Mapper96_write); SetReadHandler(0x8000, 0xFFFF, CartBR); PPU_hook = M96Hook; info->StateAction = M96_StateAction; info->Close = Mapper96_Close; info->Power = Mapper96_Reset; SetupCartCHRMapping(0x10, M96_CHR, 32768, 1); latche=M96LA=0; setmirror(MI_0); return(1); }
void BMCFK23CA_Init(CartInfo *info) { GenMMC3_Init(info, 512, 256, 128, 0); cwrap=BMCFK23CCW; pwrap=BMCFK23CPW; info->Power=BMCFK23CAPower; info->Reset=BMCFK23CReset; info->Close=BMCFK23CAClose; CHRRAMSize=8192; CHRRAM=(uint8*)FCEU_gmalloc(CHRRAMSize); SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSize, 1); AddExState(CHRRAM, CHRRAMSize, 0, "CHRRAM"); AddExState(EXPREGS, 8, 0, "EXPR"); AddExState(&unromchr, 1, 0, "UNCHR"); AddExState(&dipswitch, 1, 0, "DIPSW"); }
static void LoadCHR(Stream *fp) { uint32 t; unsigned z; z = uchead.ID[3] - '0'; if(z > 15) throw MDFN_Error(0, "Invalid CHR ROM index '%c'.\n", uchead.ID[3]); MDFN_printf(_("CHR ROM %u size: %u\n"), z, uchead.info); if(malloced[16 + z]) free(malloced[16 + z]); t = FixRomSize(uchead.info, 8192); malloced[16 + z] = (uint8 *)MDFN_malloc_T(t, _("CHR ROM")); mallocedsizes[16 + z]=t; memset(malloced[16 + z] + uchead.info, 0xFF, t - uchead.info); fp->read(malloced[16 + z], uchead.info); SetupCartCHRMapping(z, malloced[16 + z], t, 0); }
static int GenMMC1Init(CartInfo *info, int prg, int chr, int wram, int battery) { is155=0; info->StateAction = StateAction; info->Close=GenMMC1Close; MMC1PRGHook16=MMC1CHRHook4=0; mmc1opts=0; PRGmask16[0]&=(prg>>14)-1; CHRmask4[0]&=(chr>>12)-1; CHRmask8[0]&=(chr>>13)-1; WRAM_Size = wram * 1024; if(wram) { if(!(WRAM=(uint8*)malloc(WRAM_Size))) { GenMMC1Close(); return(0); } memset(WRAM, 0, WRAM_Size); mmc1opts|=1; if(wram>8) mmc1opts|=4; SetupCartPRGMapping(0x10,WRAM,WRAM_Size,1); if(battery) { mmc1opts|=2; info->SaveGame[0]=WRAM+((mmc1opts&4)?8192:0); info->SaveGameLen[0]=8192; } } if(!chr) { if(!(CHRRAM=(uint8*)malloc(8192))) { GenMMC1Close(); return(0); } SetupCartCHRMapping(0, CHRRAM, 8192, 1); } info->Power=GenMMC1Power; #ifdef WANT_DEBUGGER MDFNDBG_AddRegGroup(&DBGMMC1RegsGroup); #endif SetWriteHandler(0x8000,0xFFFF,MMC1_write); SetReadHandler(0x8000,0xFFFF,CartBR); if(mmc1opts&1) { MDFNMP_AddRAM(WRAM_Size, 0x6000, WRAM); SetReadHandler(0x6000,0x7FFF,MAWRAM); SetWriteHandler(0x6000,0x7FFF,MBWRAM); } return(1); }