DS: Fix freezing when going in-game without a texture pack

This commit is contained in:
UnknownShadow200 2024-04-30 20:42:39 +10:00
parent a7da47e552
commit e52be3a30a
2 changed files with 12 additions and 12 deletions

View File

@ -66,17 +66,18 @@ cc_uint64 Stopwatch_Measure(void) {
static void LogNocash(const char* msg, int len) { static void LogNocash(const char* msg, int len) {
// Can only be up to 120 bytes total // Can only be up to 120 bytes total
char buffer[120]; char buffer[120];
len = min(len, 119); len = min(len, 118);
Mem_Copy(buffer, msg, len); Mem_Copy(buffer, msg, len);
buffer[len] = '\n'; buffer[len + 0] = '\n';
nocashWrite(buffer, len + 1); buffer[len + 1] = '\0';
nocashWrite(buffer, len + 2);
} }
extern void consolePrintString(const char* ptr, int len); extern void consolePrintString(const char* ptr, int len);
void Platform_Log(const char* msg, int len) { void Platform_Log(const char* msg, int len) {
LogNocash(msg, len); LogNocash(msg, len);
if (!keyboardOpen) consolePrintString(msg, len); consolePrintString(msg, len);
} }
TimeMS DateTime_CurrentUTC(void) { TimeMS DateTime_CurrentUTC(void) {

View File

@ -269,7 +269,7 @@ void Window_AllocFramebuffer(struct Bitmap* bmp) {
bmp->scan0 = (BitmapCol*)Mem_Alloc(bmp->width * bmp->height, 4, "window pixels"); bmp->scan0 = (BitmapCol*)Mem_Alloc(bmp->width * bmp->height, 4, "window pixels");
} }
static void DrawIt(struct Bitmap* bmp) { static void DrawIt(void) {
Gfx_LoadIdentityMatrix(MATRIX_VIEW); Gfx_LoadIdentityMatrix(MATRIX_VIEW);
Gfx_LoadIdentityMatrix(MATRIX_PROJECTION); Gfx_LoadIdentityMatrix(MATRIX_PROJECTION);
Gfx_SetDepthTest(false); Gfx_SetDepthTest(false);
@ -281,19 +281,18 @@ static void DrawIt(struct Bitmap* bmp) {
Gfx_DrawVb_IndexedTris(4); Gfx_DrawVb_IndexedTris(4);
} }
static void DrawTV(struct Bitmap* bmp) { static void DrawTV(void) {
WHBGfxBeginRenderTV(); WHBGfxBeginRenderTV();
WHBGfxClearColor(0.0f, 0.0f, 1.0f, 1.0f); WHBGfxClearColor(0.0f, 0.0f, 1.0f, 1.0f);
DrawIt(bmp); DrawIt();
WHBGfxFinishRenderTV(); WHBGfxFinishRenderTV();
} }
static void DrawDRC(struct Bitmap* bmp) { static void DrawDRC(void) {
WHBGfxBeginRenderDRC(); WHBGfxBeginRenderDRC();
WHBGfxClearColor(1.0f, 0.0f, 0.0f, 1.0f); WHBGfxClearColor(1.0f, 0.0f, 0.0f, 1.0f);
DrawIt(bmp); DrawIt();
WHBGfxFinishRenderDRC(); WHBGfxFinishRenderDRC();
} }
void Window_DrawFramebuffer(Rect2D r, struct Bitmap* bmp) { void Window_DrawFramebuffer(Rect2D r, struct Bitmap* bmp) {
@ -306,8 +305,8 @@ void Window_DrawFramebuffer(Rect2D r, struct Bitmap* bmp) {
Gfx_UpdateTexture(&fb, r.x, r.y, &part, bmp->width, false); Gfx_UpdateTexture(&fb, r.x, r.y, &part, bmp->width, false);
WHBGfxBeginRender(); WHBGfxBeginRender();
DrawTV(bmp); DrawTV();
DrawDRC(bmp); DrawDRC();
WHBGfxFinishRender(); WHBGfxFinishRender();
} }