int romMapperNoWindCreate(int driveId, const char* filename, UInt8* romData, int size, int slot, int sslot, int startPage) { NoWindProperties* prop = &propGetGlobalProperties()->nowind; DeviceCallbacks callbacks = { destroy, reset, saveState, loadState }; RomMapperNoWind* rm; int i; rm = (RomMapperNoWind*)malloc(sizeof(RomMapperNoWind)); rm->deviceHandle = deviceManagerRegister(ROM_NOWIND, &callbacks, rm); slotRegister(slot, sslot, startPage, 6, (SlotRead)read, (SlotRead)peek, (SlotWrite)write, destroy, rm); if (filename == NULL) { filename = "nowind.rom"; } rm->amdFlash = amdFlashCreate(AMD_TYPE_1, 0x80000, 0x10000, 0, romData, size, sramCreateFilenameWithSuffix(filename, "", ".rom"), 0); rm->slot = slot; rm->sslot = sslot; rm->startPage = startPage; #ifdef USE_NOWIND_DLL if (++nowindLoaded == 1) { nowindLoadDll(); if (nowindusb_startup) nowindusb_startup(); } if (nowindusb_attribute) { nowindusb_attribute(ATTR_ENABLE_DOS2, prop->enableDos2 != 0); nowindusb_attribute(ATTR_ENABLE_OTHER_DISKROMS, prop->enableOtherDiskRoms != 0); nowindusb_attribute(ATTR_ENABLE_PHANTOM_DRIVES, prop->enablePhantomDrives != 0); } if (nowindusb_set_debug_callback) { nowindusb_set_debug_callback(debugCb); } for (i = 0; i < 4; i++) { diskInsert(rm, driveId, i); } #endif reset(rm); return 1; }
int romMapperMatraINKCreate(char* filename, UInt8* romData, int size, int slot, int sslot, int startPage) { DeviceCallbacks callbacks = { destroy, NULL, saveState, loadState }; RomMapperMatraINK* rm; int i; rm = calloc(1, sizeof(RomMapperMatraINK)); rm->deviceHandle = deviceManagerRegister(ROM_MEGAFLSHSCC, &callbacks, rm); slotRegister(slot, sslot, startPage, 8, read, peek, write, destroy, rm); rm->slot = slot; rm->sslot = sslot; rm->startPage = startPage; rm->flash = amdFlashCreate(AMD_TYPE_2, 0x10000, 0x10000, 0xff, romData, size, NULL, 0); for (i = 0; i < 8; i++) { slotMapPage(slot, sslot, startPage + i, NULL, 0, 0); } return 1; }
int romMapperMegaFlashRomSccCreate(const char* filename, UInt8* romData, int size, int slot, int sslot, int startPage, UInt32 writeProtectMask) { DeviceCallbacks callbacks = { destroy, reset, saveState, loadState }; RomMapperMegaFlashRomScc* rm; int i; rm = calloc(1, sizeof(RomMapperMegaFlashRomScc)); rm->deviceHandle = deviceManagerRegister(ROM_MEGAFLSHSCC, &callbacks, rm); slotRegister(slot, sslot, startPage, 4, read, peek, write, destroy, rm); if (size >= 0x80000) { size = 0x80000; } rm->romData = malloc(0x80000); memset(rm->romData, 0xff, 0x80000); memcpy(rm->romData, romData, size); rm->size = 0x80000; rm->slot = slot; rm->sslot = sslot; rm->romMask = rm->size / 0x2000 - 1; rm->startPage = startPage; rm->scc = sccCreate(boardGetMixer()); sccSetMode(rm->scc, SCC_REAL); rm->sccEnable = 0; rm->flash = amdFlashCreate(AMD_TYPE_2, 0x80000, 0x10000, writeProtectMask, romData, size, sramCreateFilenameWithSuffix(filename, "", ".sram"), 1); for (i = 0; i < 4; i++) { mapPage(rm, i, i); } return 1; }