当前位置: 首页>>代码示例>>C++>>正文


C++ slotMapPage函数代码示例

本文整理汇总了C++中slotMapPage函数的典型用法代码示例。如果您正苦于以下问题:C++ slotMapPage函数的具体用法?C++ slotMapPage怎么用?C++ slotMapPage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了slotMapPage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: write

static void write(RomMapperPAC* rm, UInt16 address, UInt8 value) 
{
    int update = 0;

    address &= 0x3fff;

    switch (address) {
    case 0x1ffe:
        rm->sram[0x1ffe] = value;
        rm->sramEnabled = rm->sram[0x1ffe] == 0x4d && rm->sram[0x1fff] == 0x69;
        update = 1;
        break;
    case 0x1fff:
        rm->sram[0x1fff] = value;
        rm->sramEnabled = rm->sram[0x1ffe] == 0x4d && rm->sram[0x1fff] == 0x69;
        update = 1;
        break;
	default:
		if (rm->sramEnabled && address < 0x1ffe) {
            rm->sram[address] = value;
		}
        break;
    }

    if (update) {
        if (rm->sramEnabled) {
            slotMapPage(rm->slot, rm->sslot, rm->startPage, rm->sram, 1, 0);
        }
        else {
            slotMapPage(rm->slot, rm->sslot, rm->startPage, NULL, 0, 0);
        }
    }
}
开发者ID:Chegwin,项目名称:GBA4iOS-2.0-Beta-4,代码行数:33,代码来源:romMapperPAC.c

示例2: romMapperPlayBallCreate

int romMapperPlayBallCreate(char* filename, UInt8* romData, 
                          int size, int slot, int sslot, int startPage) 
{
    DeviceCallbacks callbacks = { (DeviceCallback)destroy, NULL, NULL, NULL };
    RomMapperPlayBall* rm;

    rm = malloc(sizeof(RomMapperPlayBall));

    if (size > 0x8000) {
        size = 0x8000;
    }

    rm->deviceHandle = deviceManagerRegister(ROM_PLAYBALL, &callbacks, rm);
    slotRegister(slot, sslot, startPage, 4, NULL, NULL, NULL, (SlotEject)destroy, rm);

    rm->romData = malloc(0x8000);
    memset(rm->romData + size, 0xff, 0x8000 - size);
    memcpy(rm->romData, romData, size);
    rm->size = size;
    rm->slot  = slot;
    rm->sslot = sslot;
    rm->startPage  = startPage;

    slotMapPage(rm->slot, rm->sslot, rm->startPage,     rm->romData + 0x0000, 1, 0);
    slotMapPage(rm->slot, rm->sslot, rm->startPage + 1, rm->romData + 0x2000, 1, 0);
    slotMapPage(rm->slot, rm->sslot, rm->startPage + 2, rm->romData + 0x4000, 1, 0);
    slotMapPage(rm->slot, rm->sslot, rm->startPage + 3, rm->romData + 0x6000, 0, 0);

    return 1;
}
开发者ID:imclab,项目名称:CocoaMSX,代码行数:30,代码来源:romMapperPlayBall.c

示例3: romMapperBasicCreate

int romMapperBasicCreate(char* filename, UInt8* romData, 
                         int size, int slot, int sslot, int startPage) 
{
    DeviceCallbacks callbacks = { destroy, NULL, NULL, NULL };
    RomMapperBasic* rm;

    if (size > 0x8000) {
        return 0;
    }

    rm = malloc(sizeof(RomMapperBasic));

    rm->romData = malloc(0x8000);
    memset(rm->romData, 0xff, 0x8000);
    memcpy(rm->romData, romData, size);

    rm->size = size;
    rm->slot  = slot;
    rm->sslot = sslot;
    rm->startPage  = startPage;

    rm->deviceHandle = deviceManagerRegister(ROM_BASIC, &callbacks, rm);
    slotRegister(slot, sslot, startPage, 4, NULL, NULL, NULL, destroy, rm);

    slotMapPage(slot, sslot, startPage + 0, rm->romData + 0x0000, 1, 0);
    slotMapPage(slot, sslot, startPage + 1, rm->romData + 0x2000, 1, 0);
    slotMapPage(slot, sslot, startPage + 2, rm->romData + 0x4000, 1, 0);
    slotMapPage(slot, sslot, startPage + 3, rm->romData + 0x6000, 1, 0);

    return 1;
}
开发者ID:imclab,项目名称:CocoaMSX,代码行数:31,代码来源:romMapperBasic.c

示例4: romMapperKorean126Create

int romMapperKorean126Create(const char* filename, UInt8* romData,
                             int size, int slot, int sslot, int startPage) 
{
    DeviceCallbacks callbacks = { destroy, NULL, saveState, loadState };
    RomMapperKorean126* rm;
    int i;

    if (size < 0x8000) {
        return 0;
    }

    rm = malloc(sizeof(RomMapperKorean126));

    rm->deviceHandle = deviceManagerRegister(ROM_KOREAN126, &callbacks, rm);
    slotRegister(slot, sslot, startPage, 4, NULL, NULL, write, destroy, rm);

    rm->romData = malloc(size);
    memcpy(rm->romData, romData, size);
    rm->size = size;
    rm->slot  = slot;
    rm->sslot = sslot;
    rm->startPage  = startPage;

    rm->romMapper[0] = 0;
    rm->romMapper[2] = 0;

    for (i = 0; i < 4; i += 2) {   
        slotMapPage(rm->slot, rm->sslot, rm->startPage + i,     rm->romData + rm->romMapper[i] * 0x2000, 1, 0);
        slotMapPage(rm->slot, rm->sslot, rm->startPage + i + 1, rm->romData + rm->romMapper[i] * 0x2000 + 0x2000, 1, 0);
    }

    return 1;
}
开发者ID:Chegwin,项目名称:GBA4iOS-2.0-Beta-4,代码行数:33,代码来源:romMapperKorean126.c

示例5: romMapperOpcodeSaveRamCreate

int romMapperOpcodeSaveRamCreate(int slot, int sslot, int startPage) 
{
    DeviceCallbacks callbacks = { destroy, reset, saveState, loadState };
    DebugCallbacks dbgCallbacks = { getDebugInfo, NULL, NULL, NULL };
    
    RomMapperOpcodeSaveRam* rm = malloc(sizeof(RomMapperOpcodeSaveRam));
    
    rm->slot      = slot;
    rm->sslot     = sslot;
    rm->startPage = startPage;
    
    memset(rm->saveRam, 0xff, sizeof(rm->saveRam));
    
    slotRegister(rm->slot, rm->sslot, rm->startPage, 4, NULL, NULL, write, destroy, rm);

    rm->deviceHandle = deviceManagerRegister(ROM_OPCODESAVE, &callbacks, rm);
    rm->debugHandle = debugDeviceRegister(DBGTYPE_RAM, "SAVERAM", &dbgCallbacks, rm);

    slotMapPage(rm->slot, rm->sslot, rm->startPage + 0, rm->saveRam + 0x0000, 1, 1);
    slotMapPage(rm->slot, rm->sslot, rm->startPage + 1, rm->saveRam + 0x2000, 1, 1);
    slotMapPage(rm->slot, rm->sslot, rm->startPage + 2, rm->saveRam + 0x4000, 1, 1);
    slotMapPage(rm->slot, rm->sslot, rm->startPage + 3, rm->saveRam + 0x6000, 1, 1);

    strcpy(rm->saveRamFilename, sramCreateFilename("SaveRam"));

    sramLoad(rm->saveRamFilename, rm->saveRam, sizeof(rm->saveRam), NULL, 0);

    reset(rm);

    return 1;
}
开发者ID:Chegwin,项目名称:GBA4iOS-2.0-Beta-4,代码行数:31,代码来源:romMapperOpcodeSaveRam.c

示例6: setDram

static void setDram(RomMapperDram* rm, int enable)
{
    if (enable) {
        if (rm->slot == 0 && rm->sslot == 0) {
//            int endPage = MIN(4, rm->startPage + rm->pages);
            int page;
            for (page = rm->startPage; page < 4; page++) {
                slotMapPage(rm->slot, rm->sslot, page, boardGetRamPage(page - 8), 1, 0);
            }
        }
        else if (rm->slot == 3 && rm->sslot == 1) {
//            int endPage = MIN(4, rm->startPage + rm->pages);
            int page;
            for (page = rm->startPage; page < 4; page++) {
                slotMapPage(rm->slot, rm->sslot, page, boardGetRamPage(page - 4), 1, 0);
            }
        }
    }
    else {
//        int endPage = MIN(4, rm->startPage + rm->pages);
        int page;
        for (page = rm->startPage; page < 4; page++) {
            slotMapPage(rm->slot, rm->sslot, page, rm->romData + 0x2000 * (page - rm->startPage), 1, 0);
        }
    }
}
开发者ID:imclab,项目名称:CocoaMSX,代码行数:26,代码来源:romMapperDRAM.c

示例7: loadState

static void loadState(RomMapperKonami5* rm)
{
    SaveState* state = saveStateOpenForRead("mapperKonami5");
    char tag[16];
    int i;

    for (i = 0; i < 4; i++) {
        sprintf(tag, "romMapper%d", i);
        rm->romMapper[i] = saveStateGet(state, tag, 0);
    }
    
    rm->sccEnable = saveStateGet(state, "sccEnable", 0);

    saveStateClose(state);

    sccLoadState(rm->scc);

    for (i = 0; i < 4; i++) {   
        slotMapPage(rm->slot, rm->sslot, rm->startPage + i, rm->romData + rm->romMapper[i] * 0x2000, 1, 0);
    }
    
    if (rm->sccEnable) {
        slotMapPage(rm->slot, rm->sslot, rm->startPage + 2, rm->romData + rm->romMapper[2] * 0x2000, 0, 0);
    }
    else {
        slotMapPage(rm->slot, rm->sslot, rm->startPage + 2, rm->romData + rm->romMapper[2] * 0x2000, 1, 0);
    }
}
开发者ID:Chegwin,项目名称:GBA4iOS-2.0-Beta-4,代码行数:28,代码来源:romMapperKonami5.c

示例8: write

static void write(RomMapperMsxDos2* rm, UInt16 address, UInt8 value) 
{
    int bank;

    address += 0x4000;

    if (address < 0x4000 && address >= 0xC000) {
        return;
    }

    bank = (address & 0x8000) >> 14;

    if (rm->romMapper[bank] != value) {
        UInt8* bankData;

        if (value > rm->size / 0x4000) {
            value %= rm->size / 0x4000;
        }

        bankData = rm->romData + ((int)value << 14);
        
        rm->romMapper[bank] = value;

        slotMapPage(rm->slot, rm->sslot, rm->startPage + bank,     bankData, 1, 0);
        slotMapPage(rm->slot, rm->sslot, rm->startPage + bank + 1, bankData + 0x2000, 1, 0);
    }
}
开发者ID:Chegwin,项目名称:GBA4iOS-2.0-Beta-4,代码行数:27,代码来源:romMapperMsxDos2.c

示例9: romMapperPACCreate

int romMapperPACCreate(const char* filename, UInt8* romData,
                         int size, int slot, int sslot, int startPage) 
{
    DeviceCallbacks callbacks = { destroy, NULL, saveState, loadState };
    RomMapperPAC* rm;

    rm = malloc(sizeof(RomMapperPAC));

    rm->deviceHandle = deviceManagerRegister(ROM_PAC, &callbacks, rm);
    slotRegister(slot, sslot, startPage, 2, read, read, write, destroy, rm);

    memset(rm->sram, 0xff, 0x2000);
    rm->slot  = slot;
    rm->sslot = sslot;
    rm->startPage  = startPage;
    rm->sramEnabled = 0;
    strcpy(rm->sramFilename, sramCreateFilename(filename));

    sramLoad(rm->sramFilename, rm->sram, 0x1ffe, pacHeader, strlen(pacHeader));

    slotMapPage(rm->slot, rm->sslot, rm->startPage,     NULL, 0, 0);
    slotMapPage(rm->slot, rm->sslot, rm->startPage + 1, NULL, 0, 0);

    return 1;
}
开发者ID:Chegwin,项目名称:GBA4iOS-2.0-Beta-4,代码行数:25,代码来源:romMapperPAC.c

示例10: write

static void write(RomMapperSCCplus* rm, UInt16 address, UInt8 value) 
{
    int bank;

    address += 0x4000;

    if (address < 0x4000 && address >= 0xc000) {       
        return;
    }

    if ((address | 1) == 0xbfff) {
        rm->modeRegister = value;
        rm->isRamSegment[0] = (value & 0x10) | (value & 0x01);
        rm->isRamSegment[1] = (value & 0x10) | (value & 0x02);
        rm->isRamSegment[2] = (value & 0x10) | ((value & 0x24) == 0x24);
		rm->isRamSegment[3] = (value & 0x10);
        
        updateEnable(rm);

        return;
    }

    bank = (address - 0x4000) >> 13;

    if (rm->isRamSegment[bank]) {
        if (rm->isMapped[bank]) {
        	rm->romData[0x2000 * (rm->romMapper[bank] & rm->mapperMask) + (address & 0x1fff)] = value;
        }
        return;
    }

    if ((address & 0x1800) == 0x1000) {
        rm->romMapper[bank] = value;
        value &= rm->mapperMask;
        rm->isMapped[bank]  = (value >= 8 && rm->sccType != SCC_SNATCHER) || 
                                (value < 8  && rm->sccType != SCC_SDSNATCHER);

        if (rm->isMapped[bank]) {
            slotMapPage(rm->slot, rm->sslot, rm->startPage + bank, rm->romData + 0x2000 * value, 1, 0);
        }
        else {
            slotMapPage(rm->slot, rm->sslot, rm->startPage + bank, rm->romData + 0x20000, 1, 0);
        }

        updateEnable(rm);

        return;
    }

    if (rm->sccMode == SCC_COMPATIBLE && address >= 0x9800 && address < 0xa000) {
        sccWrite(rm->scc, address & 0xff, value);
    }
    else if (rm->sccMode == SCC_PLUS && address >= 0xb800 && address < 0xc000) {
        sccWrite(rm->scc, address & 0xff, value);
    }
}
开发者ID:Chegwin,项目名称:GBA4iOS-2.0-Beta-4,代码行数:56,代码来源:romMapperSCCplus.c

示例11: writeIo

static void writeIo(RomMapperMegaRAM* rm, UInt16 ioPort, UInt8 value)
{
    if (rm->writeEnabled) {
        int i;
        for (i = 0; i < 4; i++) {
            slotMapPage(rm->slot, rm->sslot, rm->startPage + i, rm->ramData + rm->romMapper[i] * 0x2000, 1, 0);
            slotMapPage(rm->slot, rm->sslot, rm->startPage + i + 4, rm->ramData + rm->romMapper[i] * 0x2000, 1, 0);
        }
    }
    rm->writeEnabled = 0;
}
开发者ID:imclab,项目名称:CocoaMSX,代码行数:11,代码来源:romMapperMegaRAM.c

示例12: loadState

static void loadState(RomMapperCvMegaCart* rm)
{
    SaveState* state = saveStateOpenForRead("mapperCvMegaCart");
    UInt8* bankData;

    rm->romMapper = saveStateGet(state, "romMapper", 0);

    saveStateClose(state);

    bankData = rm->romData + (rm->romMapper << 14);
    slotMapPage(rm->slot, rm->sslot, rm->startPage + 2, bankData, 1, 0);
    slotMapPage(rm->slot, rm->sslot, rm->startPage + 3, bankData + 0x2000, 0, 0);
}
开发者ID:imclab,项目名称:CocoaMSX,代码行数:13,代码来源:romMapperCvMegaCart.c

示例13: readIo

static UInt8 readIo(RomMapperMegaRAM* rm, UInt16 ioPort)
{
    if (!rm->writeEnabled) {
        int i;
        for (i = 0; i < 4; i++) {
            slotMapPage(rm->slot, rm->sslot, rm->startPage + i, rm->ramData + rm->romMapper[i] * 0x2000, 1, 1);
            slotMapPage(rm->slot, rm->sslot, rm->startPage + i + 4, rm->ramData + rm->romMapper[i] * 0x2000, 1, 1);
        }
    }
    rm->writeEnabled = 1;

    return 0xff;
}
开发者ID:imclab,项目名称:CocoaMSX,代码行数:13,代码来源:romMapperMegaRAM.c

示例14: reset

static void reset(RomMapperTC8566AF* rm)
{
    int i;

    tc8566afReset(rm->fdc);

    rm->romMapper[0] = 0;
    rm->romMapper[2] = 0;

    for (i = 0; i < 4; i += 2) {   
        slotMapPage(rm->slot, rm->sslot, rm->startPage + i,     rm->romData + rm->romMapper[i] * 0x2000, 0, 0);
        slotMapPage(rm->slot, rm->sslot, rm->startPage + i + 1, rm->romData + rm->romMapper[i] * 0x2000 + 0x2000, 0, 0);
    }
}
开发者ID:imclab,项目名称:CocoaMSX,代码行数:14,代码来源:romMapperTC8566AF.c

示例15: romMapperFmDasCreate

int romMapperFmDasCreate(char* filename, UInt8* romData, 
                          int size, int slot, int sslot, int startPage) 
{
    DeviceCallbacks callbacks = { destroy, NULL, NULL, NULL };
    RomMapperFmDas* rm;

    if (size != 0x8000 || startPage != 0) {
        return 0;
    }

    rm = malloc(sizeof(RomMapperFmDas));

    rm->deviceHandle = deviceManagerRegister(ROM_FMDAS, &callbacks, rm);
    slotRegister(slot, sslot, startPage, 8, NULL, NULL, NULL, destroy, rm);

    rm->romData = malloc(0x8000);
    memcpy(rm->romData, romData, 0x8000);
    memset(rm->romData + 0x2000, 0xff, 0x2000);

    rm->slot  = slot;
    rm->sslot = sslot;
    rm->startPage  = startPage;

    slotMapPage(slot, sslot, 0, rm->romData + 0x0000, 1, 0);
    slotMapPage(slot, sslot, 1, rm->romData + 0x2000, 1, 1);
    slotMapPage(slot, sslot, 2, rm->romData + 0x4000, 1, 0);
    slotMapPage(slot, sslot, 3, rm->romData + 0x6000, 1, 0);
    slotMapPage(slot, sslot, 4, rm->romData + 0x0000, 1, 0);
    slotMapPage(slot, sslot, 5, rm->romData + 0x2000, 1, 1);
    slotMapPage(slot, sslot, 6, rm->romData + 0x4000, 1, 0);
    slotMapPage(slot, sslot, 7, rm->romData + 0x6000, 1, 0);

    return 1;
}
开发者ID:meesokim,项目名称:bluemsx-wii,代码行数:34,代码来源:romMapperFmDas.c


注:本文中的slotMapPage函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。