mirror of https://github.com/ClassiCube/ClassiCube
Saturn: Fix not freeing memory, and overwriting VRAM
This commit is contained in:
parent
c7b66b2ea4
commit
308bd12fad
|
|
@ -128,6 +128,11 @@ static GfxResourceID Gfx_AllocTexture(struct Bitmap* bmp, int rowWidth, cc_uint8
|
||||||
tex->height = bmp->height;
|
tex->height = bmp->height;
|
||||||
|
|
||||||
tex_vram_addr += tex->width * tex->height * 2;
|
tex_vram_addr += tex->width * tex->height * 2;
|
||||||
|
if (tex_vram_addr >= gourad_base) {
|
||||||
|
Platform_LogConst("OUT OF VRAM");
|
||||||
|
Mem_Free(tmp);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Only copy when rowWidth != bmp->width
|
// TODO: Only copy when rowWidth != bmp->width
|
||||||
for (int y = 0; y < bmp->height; y++)
|
for (int y = 0; y < bmp->height; y++)
|
||||||
|
|
@ -143,6 +148,7 @@ static GfxResourceID Gfx_AllocTexture(struct Bitmap* bmp, int rowWidth, cc_uint8
|
||||||
|
|
||||||
scu_dma_transfer(0, tex->addr, tmp, tex->width * tex->height * 2);
|
scu_dma_transfer(0, tex->addr, tmp, tex->width * tex->height * 2);
|
||||||
scu_dma_transfer_wait(0);
|
scu_dma_transfer_wait(0);
|
||||||
|
Mem_Free(tmp);
|
||||||
return tex;
|
return tex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue