all repos — mgba @ 4fd170ac38a9c312f3dd1d0dd912d2c761f60fdb

mGBA Game Boy Advance Emulator

DS Video: Fix size of VRAM zeroes buffer and const correctness
Vicki Pfau vi@endrift.com
Sun, 26 Jul 2020 16:49:48 -0700
commit

4fd170ac38a9c312f3dd1d0dd912d2c761f60fdb

parent

e6fd4f5e7ad18af845308b3d6a2f4ffb404545c9

M CHANGESCHANGES

@@ -20,6 +20,7 @@ - DS: Fix freeing memory for partial BIOS on load failure

- DS Video: Properly deinitialize - DS GX: Mask off invalid bits of the palette base - DS: Properly close save file on close + - DS Video: Fix size of VRAM zeroes buffer Misc: - DS GX: Clean up and unify texture mapping - DS Core: Add symbol loading
M include/mgba/internal/ds/gx.hinclude/mgba/internal/ds/gx.h

@@ -145,8 +145,8 @@ void (*drawScanline)(struct DSGXRenderer* renderer, int y);

void (*getScanline)(struct DSGXRenderer* renderer, int y, const color_t** output); void (*writeRegister)(struct DSGXRenderer* renderer, uint32_t address, uint16_t value); - uint16_t* tex[4]; - uint16_t* texPal[6]; + const uint16_t* tex[4]; + const uint16_t* texPal[6]; uint16_t* toonTable; };

@@ -187,8 +187,8 @@ struct DSGXVertex pendingVertices[8];

int pendingVertexIds[8]; bool reverseWinding; - uint16_t* tex[4]; - uint16_t* texPal[6]; + const uint16_t* tex[4]; + const uint16_t* texPal[6]; int mtxMode; int pvMatrixPointer;
M include/mgba/internal/ds/gx/software.hinclude/mgba/internal/ds/gx/software.h

@@ -20,8 +20,8 @@ struct DSGXPolygon* poly;

unsigned polyId; DSGXPolygonAttrs polyParams; DSGXTexParams texParams; - uint16_t* texBase; - uint16_t* palBase; + const uint16_t* texBase; + const uint16_t* palBase; int texFormat; int blendFormat; int texW;
M include/mgba/internal/ds/video.hinclude/mgba/internal/ds/video.h

@@ -104,13 +104,13 @@ void (*putPixels)(struct DSVideoRenderer* renderer, size_t stride, const void* pixels);

uint16_t* palette; uint16_t* vram; - uint16_t* vramABG[32]; - uint16_t* vramAOBJ[32]; - uint16_t* vramABGExtPal[4]; + const uint16_t* vramABG[32]; + const uint16_t* vramAOBJ[32]; + const uint16_t* vramABGExtPal[4]; uint16_t* vramAOBJExtPal; - uint16_t* vramBBG[32]; - uint16_t* vramBOBJ[32]; - uint16_t* vramBBGExtPal[4]; + const uint16_t* vramBBG[32]; + const uint16_t* vramBOBJ[32]; + const uint16_t* vramBBGExtPal[4]; uint16_t* vramBOBJExtPal; bool disableABG[4];

@@ -134,12 +134,12 @@ bool inCapture;

uint16_t palette[1024]; uint16_t* vram; - uint16_t* vramABG[32]; - uint16_t* vramAOBJ[32]; + const uint16_t* vramABG[32]; + const uint16_t* vramAOBJ[32]; uint16_t* vramABGExtPal[4]; uint16_t* vramAOBJExtPal; - uint16_t* vramBBG[32]; - uint16_t* vramBOBJ[32]; + const uint16_t* vramBBG[32]; + const uint16_t* vramBOBJ[32]; uint16_t* vramBBGExtPal[4]; uint16_t* vramBOBJExtPal; union DSOAM oam;
M src/ds/video.csrc/ds/video.c

@@ -45,7 +45,7 @@ 0x08000,

0x04000 }; -static uint16_t _zeroes[0x2000] = {0}; +static const uint16_t _zeroes[0x10000] = {0}; enum DSVRAMBankMode { MODE_A_BG = 0,