diff --git a/CHANGES b/CHANGES index 1285e13b6..9415d4864 100644 --- a/CHANGES +++ b/CHANGES @@ -20,6 +20,7 @@ Bugfixes: - 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 diff --git a/include/mgba/internal/ds/gx.h b/include/mgba/internal/ds/gx.h index 444131999..543795ab9 100644 --- a/include/mgba/internal/ds/gx.h +++ b/include/mgba/internal/ds/gx.h @@ -145,8 +145,8 @@ struct DSGXRenderer { 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 DSGX { 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; diff --git a/include/mgba/internal/ds/gx/software.h b/include/mgba/internal/ds/gx/software.h index 40fc29e31..9581e9997 100644 --- a/include/mgba/internal/ds/gx/software.h +++ b/include/mgba/internal/ds/gx/software.h @@ -20,8 +20,8 @@ struct DSGXSoftwarePolygon { 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; diff --git a/include/mgba/internal/ds/video.h b/include/mgba/internal/ds/video.h index b3f042050..71ad231a3 100644 --- a/include/mgba/internal/ds/video.h +++ b/include/mgba/internal/ds/video.h @@ -104,13 +104,13 @@ struct DSVideoRenderer { 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 @@ struct DSVideo { 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; diff --git a/src/ds/video.c b/src/ds/video.c index 1bdb0b4ab..437d89f1c 100644 --- a/src/ds/video.c +++ b/src/ds/video.c @@ -45,7 +45,7 @@ static const uint32_t _vramSize[9] = { 0x04000 }; -static uint16_t _zeroes[0x2000] = {0}; +static const uint16_t _zeroes[0x10000] = {0}; enum DSVRAMBankMode { MODE_A_BG = 0,