mirror of https://github.com/mgba-emu/mgba.git
DS Video: Begin hooking up OAM
This commit is contained in:
parent
e0518fdf30
commit
488decf83a
|
@ -61,6 +61,7 @@ struct DSVideoRenderer {
|
|||
|
||||
uint16_t (*writeVideoRegister)(struct DSVideoRenderer* renderer, uint32_t address, uint16_t value);
|
||||
void (*writePalette)(struct DSVideoRenderer* renderer, uint32_t address, uint16_t value);
|
||||
void (*writeOAM)(struct DSVideoRenderer* renderer, uint32_t oam);
|
||||
void (*drawScanline)(struct DSVideoRenderer* renderer, int y);
|
||||
void (*finishFrame)(struct DSVideoRenderer* renderer);
|
||||
|
||||
|
|
|
@ -955,6 +955,8 @@ void DS9Store32(struct ARMCore* cpu, uint32_t address, int32_t value, int* cycle
|
|||
}
|
||||
case DS9_REGION_OAM:
|
||||
STORE_32(value, address & (DS9_SIZE_OAM - 4), ds->video.oam.raw);
|
||||
ds->video.renderer->writeOAM(ds->video.renderer, (address & (DS9_SIZE_OAM - 4)) >> 1);
|
||||
ds->video.renderer->writeOAM(ds->video.renderer, ((address & (DS9_SIZE_OAM - 4)) >> 1) + 1);
|
||||
break;
|
||||
default:
|
||||
if ((address & ~(DS9_SIZE_DTCM - 1)) == memory->dtcmBase) {
|
||||
|
@ -1022,6 +1024,7 @@ void DS9Store16(struct ARMCore* cpu, uint32_t address, int16_t value, int* cycle
|
|||
}
|
||||
case DS9_REGION_OAM:
|
||||
STORE_16(value, address & (DS9_SIZE_OAM - 2), ds->video.oam.raw);
|
||||
ds->video.renderer->writeOAM(ds->video.renderer, (address & (DS9_SIZE_OAM - 2)) >> 1);
|
||||
break;
|
||||
default:
|
||||
if ((address & ~(DS9_SIZE_DTCM - 1)) == memory->dtcmBase) {
|
||||
|
@ -1245,7 +1248,9 @@ uint32_t DS9StoreMultiple(struct ARMCore* cpu, uint32_t address, int mask, enum
|
|||
});
|
||||
break;
|
||||
case DS9_REGION_OAM:
|
||||
STM_LOOP(STORE_32(value, address & (DS9_SIZE_OAM - 1), ds->video.oam.raw));
|
||||
STM_LOOP(STORE_32(value, address & (DS9_SIZE_OAM - 1), ds->video.oam.raw);
|
||||
ds->video.renderer->writeOAM(ds->video.renderer, (address & (DS9_SIZE_OAM - 4)) >> 1);
|
||||
ds->video.renderer->writeOAM(ds->video.renderer, ((address & (DS9_SIZE_OAM - 4)) >> 1) + 1));
|
||||
break;
|
||||
default:
|
||||
STM_LOOP(if ((address & ~(DS9_SIZE_DTCM - 1)) == memory->dtcmBase) {
|
||||
|
|
|
@ -13,6 +13,7 @@ static void DSVideoSoftwareRendererDeinit(struct DSVideoRenderer* renderer);
|
|||
static void DSVideoSoftwareRendererReset(struct DSVideoRenderer* renderer);
|
||||
static uint16_t DSVideoSoftwareRendererWriteVideoRegister(struct DSVideoRenderer* renderer, uint32_t address, uint16_t value);
|
||||
static void DSVideoSoftwareRendererWritePalette(struct DSVideoRenderer* renderer, uint32_t address, uint16_t value);
|
||||
static void DSVideoSoftwareRendererWriteOAM(struct DSVideoRenderer* renderer, uint32_t oam);
|
||||
static void DSVideoSoftwareRendererDrawScanline(struct DSVideoRenderer* renderer, int y);
|
||||
static void DSVideoSoftwareRendererFinishFrame(struct DSVideoRenderer* renderer);
|
||||
static void DSVideoSoftwareRendererGetPixels(struct DSVideoRenderer* renderer, size_t* stride, const void** pixels);
|
||||
|
@ -24,6 +25,7 @@ void DSVideoSoftwareRendererCreate(struct DSVideoSoftwareRenderer* renderer) {
|
|||
renderer->d.deinit = DSVideoSoftwareRendererDeinit;
|
||||
renderer->d.writeVideoRegister = DSVideoSoftwareRendererWriteVideoRegister;
|
||||
renderer->d.writePalette = DSVideoSoftwareRendererWritePalette;
|
||||
renderer->d.writeOAM = DSVideoSoftwareRendererWriteOAM;
|
||||
renderer->d.drawScanline = DSVideoSoftwareRendererDrawScanline;
|
||||
renderer->d.finishFrame = DSVideoSoftwareRendererFinishFrame;
|
||||
renderer->d.getPixels = DSVideoSoftwareRendererGetPixels;
|
||||
|
@ -98,6 +100,15 @@ static void DSVideoSoftwareRendererWritePalette(struct DSVideoRenderer* renderer
|
|||
}
|
||||
}
|
||||
|
||||
static void DSVideoSoftwareRendererWriteOAM(struct DSVideoRenderer* renderer, uint32_t oam) {
|
||||
struct DSVideoSoftwareRenderer* softwareRenderer = (struct DSVideoSoftwareRenderer*) renderer;
|
||||
if (oam < 0x100) {
|
||||
softwareRenderer->engA.d.writeOAM(&softwareRenderer->engA.d, oam & 0xFF);
|
||||
} else {
|
||||
softwareRenderer->engB.d.writeOAM(&softwareRenderer->engB.d, oam & 0xFF);
|
||||
}
|
||||
}
|
||||
|
||||
static void _drawScanlineA(struct DSVideoSoftwareRenderer* softwareRenderer, int y) {
|
||||
memcpy(softwareRenderer->engA.d.vramBG, softwareRenderer->d.vramABG, sizeof(softwareRenderer->engA.d.vramBG));
|
||||
memcpy(softwareRenderer->engA.d.vramOBJ, softwareRenderer->d.vramAOBJ, sizeof(softwareRenderer->engA.d.vramOBJ));
|
||||
|
|
|
@ -19,6 +19,7 @@ static void DSVideoDummyRendererReset(struct DSVideoRenderer* renderer);
|
|||
static void DSVideoDummyRendererDeinit(struct DSVideoRenderer* renderer);
|
||||
static uint16_t DSVideoDummyRendererWriteVideoRegister(struct DSVideoRenderer* renderer, uint32_t address, uint16_t value);
|
||||
static void DSVideoDummyRendererWritePalette(struct DSVideoRenderer* renderer, uint32_t address, uint16_t value);
|
||||
static void DSVideoDummyRendererWriteOAM(struct DSVideoRenderer* renderer, uint32_t oam);
|
||||
static void DSVideoDummyRendererDrawScanline(struct DSVideoRenderer* renderer, int y);
|
||||
static void DSVideoDummyRendererFinishFrame(struct DSVideoRenderer* renderer);
|
||||
static void DSVideoDummyRendererGetPixels(struct DSVideoRenderer* renderer, size_t* stride, const void** pixels);
|
||||
|
@ -104,6 +105,7 @@ static struct DSVideoRenderer dummyRenderer = {
|
|||
.deinit = DSVideoDummyRendererDeinit,
|
||||
.writeVideoRegister = DSVideoDummyRendererWriteVideoRegister,
|
||||
.writePalette = DSVideoDummyRendererWritePalette,
|
||||
.writeOAM = DSVideoDummyRendererWriteOAM,
|
||||
.drawScanline = DSVideoDummyRendererDrawScanline,
|
||||
.finishFrame = DSVideoDummyRendererFinishFrame,
|
||||
.getPixels = DSVideoDummyRendererGetPixels,
|
||||
|
@ -364,9 +366,16 @@ static uint16_t DSVideoDummyRendererWriteVideoRegister(struct DSVideoRenderer* r
|
|||
}
|
||||
|
||||
static void DSVideoDummyRendererWritePalette(struct DSVideoRenderer* renderer, uint32_t address, uint16_t value) {
|
||||
UNUSED(value);
|
||||
UNUSED(renderer);
|
||||
UNUSED(address);
|
||||
UNUSED(value);
|
||||
// Nothing to do
|
||||
}
|
||||
|
||||
static void DSVideoDummyRendererWriteOAM(struct DSVideoRenderer* renderer, uint32_t oam) {
|
||||
UNUSED(renderer);
|
||||
UNUSED(oam);
|
||||
// Nothing to do
|
||||
}
|
||||
|
||||
static void DSVideoDummyRendererDrawScanline(struct DSVideoRenderer* renderer, int y) {
|
||||
|
|
Loading…
Reference in New Issue