int BTR_Init(CartInfo *info) { SetupCartPRGMapping(0x10,WRAM,8192,1); SetWriteHandler(0x8000,0xbfff,Mapper69_write); SetWriteHandler(0xc000,0xdfff,Mapper69_SWL); SetWriteHandler(0xe000,0xffff,Mapper69_SWH); SetWriteHandler(0x6000,0x7fff,SUN5BWRAM); SetReadHandler(0x6000,0x7fff,SUN5AWRAM); SetReadHandler(0x8000, 0xFFFF, CartBR); info->Power = Power; info->Reset = Reset; info->StateAction = StateAction; if(info->battery) { info->SaveGame[0] = WRAM; info->SaveGameLen[0] = 8192; } Mapper69_ESI(&info->CartExpSound); MapIRQHook = SunIRQHook; return(1); }
void UNLSB2000_Init(CartInfo *info) { info->Reset = UNLSB2000Reset; info->Power = UNLSB2000Power; info->Close = UNLSB2000Close; // GameHBIRQHook = UNLSB2000IRQHook; GameStateRestore = StateRestore; /* CHRRAMSIZE = 8192; CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE); SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1); AddExState(CHRRAM, CHRRAMSIZE, 0, "CRAM"); */ // SetupCartCHRMapping(0, PRGptr[0], PRGsize[0], 0); WRAMSIZE = 512 * 1024; WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); if (info->battery) { info->SaveGame[0] = WRAM; info->SaveGameLen[0] = WRAMSIZE; } AddExState(&StateRegs, ~0, 0, 0); }
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 LoadPRG(FCEUFILE *fp) { int z,t; z=uchead.ID[3]-'0'; if(z<0 || z>15) return(0); FCEU_printf(" PRG ROM %d size: %d",z,(int) uchead.info); if(malloced[z]) free(malloced[z]); t=FixRomSize(uchead.info,2048); if(!(malloced[z]=(uint8 *)FCEU_malloc(t))) return(0); mallocedsizes[z]=t; memset(malloced[z]+uchead.info,0xFF,t-uchead.info); if(FCEU_fread(malloced[z],1,uchead.info,fp)!=uchead.info) { FCEU_printf("Read Error!\n"); return(0); } else FCEU_printf("\n"); SetupCartPRGMapping(z,malloced[z],t,0); return(1); }
static void Latch_Init(CartInfo *info, void (*proc)(void), readfunc func, uint16 linit, uint16 adr0, uint16 adr1, uint8 wram) { latcheinit = linit; addrreg0 = adr0; addrreg1 = adr1; WSync = proc; if (func != NULL) defread = func; else defread = CartBROB; info->Power = LatchPower; info->Reset = LatchReset; info->Close = LatchClose; if (wram) { WRAMSIZE = 8192; WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); if (info->battery) { info->SaveGame[0] = WRAM; info->SaveGameLen[0] = WRAMSIZE; } AddExState(WRAM, WRAMSIZE, 0, "WRAM"); } GameStateRestore = StateRestore; AddExState(&latche, 2, 0, "LATC"); }
static void LoadPRG(Stream *fp) { uint32 t; unsigned z; z = uchead.ID[3] - '0'; // FIXME hex if(z > 15) throw MDFN_Error(0, "Invalid PRG ROM index '%c'.\n", uchead.ID[3]); MDFN_printf(_("PRG ROM %u size: %u\n"), z, uchead.info); if(malloced[z]) free(malloced[z]); t = FixRomSize(uchead.info, 2048); malloced[z] = (uint8 *)MDFN_malloc_T(t, _("PRG ROM")); mallocedsizes[z] = t; memset(malloced[z] + uchead.info, 0xFF, t - uchead.info); fp->read(malloced[z], uchead.info); SetupCartPRGMapping(z,malloced[z],t,0); }
int MALEE_Init(CartInfo *info) { SetupCartPRGMapping(0x10, WRAM, 2048, 1); info->Power=MALEEReset; info->StateAction = StateAction; return(1); }
void Mapper112_Init(CartInfo *info) { info->Power=M112Power; info->Close=M112Close; GameStateRestore=StateRestore; WRAM=(uint8*)malloc(8192); SetupCartPRGMapping(0x10,WRAM,8192,1); AddExState(WRAM, 8192, 0, "WRAM"); AddExState(&StateRegs, ~0, 0, 0); }
void UNLSC127_Init(CartInfo *info) { info->Reset = UNLSC127Reset; info->Power = UNLSC127Power; info->Close = UNLSC127Close; GameHBIRQHook = UNLSC127IRQ; GameStateRestore = StateRestore; WRAMSIZE = 8192; WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); AddExState(&StateRegs, ~0, 0, 0); }
void LH32_Init(CartInfo *info) { info->Power = LH32Power; info->Close = LH32Close; WRAMSIZE = 8192; WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); GameStateRestore = StateRestore; AddExState(&StateRegs, ~0, 0, 0); }
void Mapper73_Init(CartInfo *info) { info->Power = M73Power; info->Close = M73Close; MapIRQHook = M73IRQHook; WRAMSIZE = 8192; WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); AddExState(&StateRegs, ~0, 0, 0); GameStateRestore = StateRestore; }
void NROM_Init(CartInfo *info) { info->Power = NROMPower; info->Close = LatchClose; WRAMSIZE = 8192; WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); if (info->battery) { info->SaveGame[0] = WRAM; info->SaveGameLen[0] = WRAMSIZE; } AddExState(WRAM, WRAMSIZE, 0, "WRAM"); }
void Mapper34_Init(CartInfo *info) { info->Power = M34Power; info->Close = M34Close; GameStateRestore = StateRestore; WRAMSIZE = 8192; WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); AddExState(&StateRegs, ~0, 0, 0); }
void SSSNROM_Init(CartInfo *info) { info->Reset = SSSNROMReset; info->Power = SSSNROMPower; info->Close = SSSNROMClose; GameHBIRQHook = SSSNROMIRQHook; GameStateRestore = StateRestore; WRAMSIZE = 16384; WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); AddExState(&StateRegs, ~0, 0, 0); }
void UNLKS7037_Init(CartInfo *info) { info->Power = UNLKS7037Power; info->Close = Close; WSync = SyncKS7037; WRAMSIZE = 8192; WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); GameStateRestore = StateRestore; AddExState(&StateRegs, ~0, 0, 0); }
void Mapper69_init(void) { sunindex=0; SetupCartPRGMapping(0x10,WRAM,8192,1); SetWriteHandler(0x8000,0xbfff,Mapper69_write); SetWriteHandler(0xc000,0xdfff,Mapper69_SWL); SetWriteHandler(0xe000,0xffff,Mapper69_SWH); SetWriteHandler(0x6000,0x7fff,SUN5BWRAM); SetReadHandler(0x6000,0x7fff,SUN5AWRAM); Mapper69_ESI(); MapIRQHook=SunIRQHook; MapStateRestore=Mapper69_StateRestore; }
void Mapper82_Init(CartInfo *info) { info->Power = M82Power; info->Close = M82Close; WRAMSIZE = 8192; WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); if (info->battery) { info->SaveGame[0] = WRAM; info->SaveGameLen[0] = WRAMSIZE; } GameStateRestore = StateRestore; AddExState(&StateRegs, ~0, 0, 0); }
void UNLEDU2000_Init(CartInfo *info) { info->Power=UNLEDU2000Power; info->Close=UNLEDU2000Close; GameStateRestore=UNLEDU2000Restore; WRAM=(uint8*)FCEU_gmalloc(32768); SetupCartPRGMapping(0x10,WRAM,32768,1); if(info->battery) { info->SaveGame[0]=WRAM; info->SaveGameLen[0]=32768; } AddExState(WRAM, 32768, 0, "WRAM"); AddExState(StateRegs, ~0, 0, 0); }
int Mapper34_Init(CartInfo *info) { info->Power = Power; info->StateAction = StateAction; SetupCartPRGMapping(0x10, WRAM, 8192, 1); if(info->battery) { memset(WRAM, 0xFF, 8192); info->SaveGame[0] = WRAM; info->SaveGameLen[0] = 8192; } SetWriteHandler(0x6000, 0x7FFF, CartBW); SetWriteHandler(0x7ffd,0xffff,Mapper34_write); SetReadHandler(0x6000, 0xFFFF, CartBR); return(1); }
int MMC4_Init(CartInfo *info) { info->StateAction = MMC4_StateAction; info->Power = MMC4_Power; SetWriteHandler(0xA000, 0xAFFF, MMC4_PRG_Write); SetWriteHandler(0xB000, 0xFFFF, CommonWrite); SetReadHandler(0x6000, 0xFFFF, CartBR); SetWriteHandler(0x6000, 0x7FFF, CartBW); SetupCartPRGMapping(0x10, MMC4_WRAM, 8192, 1); info->SaveGame[0] = MMC4_WRAM; info->SaveGameLen[0] = 8192; PPU_hook = latchcheck; return(1); }
void UNLDSOUNDV1_Init(CartInfo *info) { info->Power = UNLDSOUNDV1Power; info->Close = UNLDSOUNDV1Close; GameStateRestore = StateRestore; MapIRQHook = UNLDSOUNDV1SndClk; jedi_table_init(); WRAMSIZE = 32768; WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); if (info->battery) { info->SaveGame[0] = WRAM; info->SaveGameLen[0] = WRAMSIZE; } AddExState(&StateRegs, ~0, 0, 0); }
int Mapper246_Init(CartInfo *info) { SetupCartPRGMapping(0x10, WRAM, 0x800, 1); SetWriteHandler(0x4020,0x67ff,Mapper246_write); SetWriteHandler(0x8000,0xffff,Mapper246_write); SetReadHandler(0x8000, 0xFFFF, CartBR); SetReadHandler(0x6800, 0x6FFF, CartBR); SetWriteHandler(0x6800, 0x6FFF, CartBW); info->Reset = info->Power = Reset; info->StateAction = StateAction; if(info->battery) { memset(WRAM, 0xFF, 0x800); info->SaveGame[0] = WRAM; info->SaveGameLen[0] = 2048; } return(1); }
void GenMMC3_Init(CartInfo *info, int prg, int chr, int wram, int battery) { pwrap=GENPWRAP; cwrap=GENCWRAP; mwrap=GENMWRAP; wrams=wram<<10; PRGmask8[0]&=(prg>>13)-1; CHRmask1[0]&=(chr>>10)-1; CHRmask2[0]&=(chr>>11)-1; if(wram) { mmc3opts|=1; WRAM=(uint8*)FCEU_gmalloc(wrams); SetupCartPRGMapping(0x10,WRAM,wrams,1); AddExState(WRAM, wrams, 0, "MRAM"); } if(battery) { mmc3opts|=2; info->SaveGame[0]=WRAM; info->SaveGameLen[0]=wrams; } AddExState(MMC3_StateRegs, ~0, 0, 0); info->Power=GenMMC3Power; info->Reset=MMC3RegReset; info->Close=GenMMC3Close; if(info->CRC32 == 0x5104833e) // Kick Master GameHBIRQHook = MMC3_hb_KickMasterHack; else if(info->CRC32 == 0x5a6860f1 || info->CRC32 == 0xae280e20) // Shougi Meikan '92/'93 GameHBIRQHook = MMC3_hb_KickMasterHack; else if(info->CRC32 == 0xfcd772eb) // PAL Star Wars, similar problem as Kick Master. GameHBIRQHook = MMC3_hb_PALStarWarsHack; else GameHBIRQHook=MMC3_hb; GameStateRestore=GenMMC3Restore; }
void GenMMC3_Init(CartInfo *info, int prg, int chr, int wram, int battery) { pwrap = GENPWRAP; cwrap = GENCWRAP; mwrap = GENMWRAP; WRAMSIZE = wram << 10; PRGmask8[0] &= (prg >> 13) - 1; CHRmask1[0] &= (chr >> 10) - 1; CHRmask2[0] &= (chr >> 11) - 1; if (wram) { mmc3opts |= 1; WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); } if (battery) { mmc3opts |= 2; info->SaveGame[0] = WRAM; info->SaveGameLen[0] = WRAMSIZE; } // KT-008 boards hack 2-in-1, TODO assign to new ines mapper, most dump of KT-boards on the net are mapper 4, so need database or goodnes fix support AddExState(&kt_extra, 1, 0, "KTEX"); AddExState(MMC3_StateRegs, ~0, 0, 0); info->Power = GenMMC3Power; info->Reset = MMC3RegReset; info->Close = GenMMC3Close; if (info->CRC32 == 0x5104833e) // Kick Master GameHBIRQHook = MMC3_hb_KickMasterHack; else if (info->CRC32 == 0x5a6860f1 || info->CRC32 == 0xae280e20)// Shougi Meikan '92/'93 GameHBIRQHook = MMC3_hb_KickMasterHack; else if (info->CRC32 == 0xfcd772eb) // PAL Star Wars, similar problem as Kick Master. GameHBIRQHook = MMC3_hb_PALStarWarsHack; else GameHBIRQHook = MMC3_hb; GameStateRestore = GenMMC3Restore; }
int Mapper112_Init(CartInfo *info) { SetWriteHandler(0x8000,0xffff,Mapper112_write); SetReadHandler(0x6000, 0xFFFF, CartBR); SetWriteHandler(0x6000, 0x7FFF, CartBW); info->Power = Power; info->Close = Close; info->StateAction = StateAction; if(!(WRAM = (uint8 *)MDFN_malloc(8192,"WRAM"))) return(0); SetupCartPRGMapping(0x10, WRAM, 8192, 1); if(info->battery) { info->SaveGame[0] = WRAM; info->SaveGameLen[0] = 8192; } return(1); }
void Mapper153_Init(CartInfo *info) { is153=1; info->Power=M153Power; info->Close=M153Close; MapIRQHook=BandaiIRQHook; WRAMSIZE=8192; WRAM=(uint8*)malloc(WRAMSIZE); SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); if(info->battery) { info->SaveGame[0]=WRAM; info->SaveGameLen[0]=WRAMSIZE; } GameStateRestore=StateRestore; AddExState(&StateRegs, ~0, 0, 0); }
static void Latch_Init(CartInfo *info, void (*proc)(void), uint8 init, uint16 adr0, uint16 adr1, uint8 wram, uint8 busc) { bus_conflict = busc; latcheinit = init; addrreg0 = adr0; addrreg1 = adr1; WSync = proc; info->Power = LatchPower; info->Close = LatchClose; GameStateRestore = StateRestore; if (wram) { WRAMSIZE = 8192; WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); if (info->battery) { info->SaveGame[0] = WRAM; info->SaveGameLen[0] = WRAMSIZE; } AddExState(WRAM, WRAMSIZE, 0, "WRAM"); } AddExState(&latche, 1, 0, "LATC"); AddExState(&bus_conflict, 1, 0, "BUSC"); }
void MALEE_Init(CartInfo *info) { info->Power=MALEEReset; SetupCartPRGMapping(0x10, WRAM, 2048, 1); AddExState(WRAM, 2048, 0,"RAM"); }
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); }
void MDFN_VSUniCheck(uint64 md5partial, int *MapperNo, int *Mirroring) { VSUNIENTRY *vs = VSUniGames; while(vs->name) { if(md5partial == vs->md5partial) { if(vs->ppu < RCP2C03B) MDFN_SetPPUPalette(vs->ppu); //puts(vs->name); *MapperNo = vs->mapper; *Mirroring = vs->mirroring; NESIsVSUni = TRUE; MDFNGameInfo->GameType = GMT_ARCADE; curppu = vs->ppu; curmd5 = md5partial; secptr = 0; { static uint64 tko=0x6e1ee06171d8ce3aULL, rbi=0x6a02d345812938afULL; if(md5partial == tko) secptr=secdata[0]; if(md5partial == rbi) secptr = secdata[1]; } vsdip = 0x0; if(vs->ioption & IOPTION_PREDIP) { vsdip= vs->predip; } if(vs->ioption & IOPTION_GUN) { MDFNGameInfo->DesiredInput.push_back("zapper"); MDFNGameInfo->DesiredInput.push_back("none"); MDFNGameInfo->DesiredInput.push_back("none"); MDFNGameInfo->DesiredInput.push_back("none"); MDFNGameInfo->DesiredInput.push_back("none"); } else { MDFNGameInfo->DesiredInput.push_back("gamepad"); MDFNGameInfo->DesiredInput.push_back("gamepad"); MDFNGameInfo->DesiredInput.push_back("gamepad"); MDFNGameInfo->DesiredInput.push_back("gamepad"); MDFNGameInfo->DesiredInput.push_back("none"); } curvs = vs; SetupCartPRGMapping(0x10, WRAM, 8192, 1); SetReadHandler(0x6000, 0x7FFF, CartBR); SetWriteHandler(0x6000, 0x7FFF, CartBW); return; } vs++; } }