mirror of https://github.com/mgba-emu/mgba.git
GB Video: Add constants for OBJ maxima
This commit is contained in:
parent
7d77aac68f
commit
ce97e265a3
|
@ -10,6 +10,8 @@
|
|||
|
||||
CXX_GUARD_START
|
||||
|
||||
#include <mgba/core/interface.h>
|
||||
|
||||
enum GBModel {
|
||||
GB_MODEL_AUTODETECT = 0xFF,
|
||||
GB_MODEL_DMG = 0x00,
|
||||
|
|
|
@ -31,6 +31,9 @@ enum {
|
|||
|
||||
GB_VIDEO_TOTAL_LENGTH = 70224,
|
||||
|
||||
GB_VIDEO_MAX_OBJ = 40,
|
||||
GB_VIDEO_MAX_LINE_OBJ = 10,
|
||||
|
||||
GB_BASE_MAP = 0x1800,
|
||||
GB_SIZE_MAP = 0x0400,
|
||||
|
||||
|
@ -63,8 +66,8 @@ struct GBObj {
|
|||
};
|
||||
|
||||
union GBOAM {
|
||||
struct GBObj obj[40];
|
||||
uint8_t raw[160];
|
||||
struct GBObj obj[GB_VIDEO_MAX_OBJ];
|
||||
uint8_t raw[GB_VIDEO_MAX_OBJ * 4];
|
||||
};
|
||||
|
||||
struct mCacheSet;
|
||||
|
|
|
@ -119,7 +119,7 @@ void GBVideoProxyRendererDeinit(struct GBVideoRenderer* renderer) {
|
|||
static bool _parsePacket(struct mVideoLogger* logger, const struct mVideoLoggerDirtyInfo* item) {
|
||||
struct GBVideoProxyRenderer* proxyRenderer = logger->context;
|
||||
uint8_t sgbPacket[16];
|
||||
struct GBObj legacyBuffer[40];
|
||||
struct GBObj legacyBuffer[GB_VIDEO_MAX_OBJ];
|
||||
switch (item->type) {
|
||||
case DIRTY_REGISTER:
|
||||
proxyRenderer->backend->writeVideoRegister(proxyRenderer->backend, item->address, item->value);
|
||||
|
@ -160,7 +160,7 @@ static bool _parsePacket(struct mVideoLogger* logger, const struct mVideoLoggerD
|
|||
case DIRTY_BUFFER:
|
||||
switch (item->address) {
|
||||
case BUFFER_OAM:
|
||||
if (item->value2 / sizeof(struct GBObj) > 40) {
|
||||
if (item->value2 / sizeof(struct GBObj) > GB_VIDEO_MAX_OBJ) {
|
||||
return false;
|
||||
}
|
||||
logger->readData(logger, legacyBuffer, item->value2, true);
|
||||
|
|
|
@ -508,7 +508,7 @@ static void _cleanOAM(struct GBVideoSoftwareRenderer* renderer, int y) {
|
|||
}
|
||||
int o = 0;
|
||||
int i;
|
||||
for (i = 0; i < 40 && o < 10; ++i) {
|
||||
for (i = 0; i < GB_VIDEO_MAX_OBJ && o < GB_VIDEO_MAX_LINE_OBJ; ++i) {
|
||||
uint8_t oy = renderer->d.oam->obj[i].y;
|
||||
if (y < oy - 16 || y >= oy - 16 + spriteHeight) {
|
||||
continue;
|
||||
|
|
|
@ -409,7 +409,7 @@ static void _cleanOAM(struct GBVideo* video, int y) {
|
|||
}
|
||||
int o = 0;
|
||||
int i;
|
||||
for (i = 0; i < 40 && o < 10; ++i) {
|
||||
for (i = 0; i < GB_VIDEO_MAX_OBJ && o < GB_VIDEO_MAX_LINE_OBJ; ++i) {
|
||||
uint8_t oy = video->oam.obj[i].y;
|
||||
if (y < oy - 16 || y >= oy - 16 + spriteHeight) {
|
||||
continue;
|
||||
|
|
Loading…
Reference in New Issue