mirror of https://github.com/mgba-emu/mgba.git
3DS: Fix crash when pushing too many verts
This commit is contained in:
parent
f5ee8330f7
commit
0c748d3bfc
|
@ -27,7 +27,7 @@ struct ctrUIVertex {
|
|||
u32 abgr;
|
||||
};
|
||||
|
||||
#define MAX_NUM_QUADS 1024
|
||||
#define MAX_NUM_QUADS 256
|
||||
#define VERTEX_BUFFER_SIZE MAX_NUM_QUADS * sizeof(struct ctrUIVertex)
|
||||
|
||||
static struct ctrUIVertex* ctrVertexBuffer = NULL;
|
||||
|
@ -146,6 +146,13 @@ void ctrActivateTexture(C3D_Tex* texture) {
|
|||
}
|
||||
|
||||
void ctrAddRectScaled(u32 color, s16 x, s16 y, s16 w, s16 h, s16 u, s16 v, s16 uw, s16 vh) {
|
||||
if (x >= 400 && w >= 0) {
|
||||
return;
|
||||
}
|
||||
if (y >= 240 && h >= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ctrNumVerts + ctrVertStart == MAX_NUM_QUADS) {
|
||||
ctrFlushBatch();
|
||||
C3D_Flush();
|
||||
|
|
|
@ -95,7 +95,7 @@ void GUIFontIconMetrics(const struct GUIFont* font, enum GUIIcon icon, unsigned*
|
|||
void GUIFontDrawGlyph(const struct GUIFont* font, int glyph_x, int glyph_y, uint32_t color, uint32_t glyph) {
|
||||
int index = fontGlyphIndexFromCodePoint(glyph);
|
||||
fontGlyphPos_s data;
|
||||
fontCalcGlyphPos(&data, index, GLYPH_POS_CALC_VTXCOORD, 1.0, 1.0);
|
||||
fontCalcGlyphPos(&data, index, 0, 1.0, 1.0);
|
||||
|
||||
C3D_Tex* tex = &font->sheets[data.sheetIndex];
|
||||
ctrActivateTexture(tex);
|
||||
|
|
Loading…
Reference in New Issue