shithub: cstory

Download patch

ref: 94dd41985874ba15a75cea23709438426f12f598
parent: 8eb4e29b1041507e5824ac719be6a8a4c0f72f6c
author: Clownacy <Clownacy@users.noreply.github.com>
date: Sun Oct 4 10:19:16 EDT 2020

Add explicit parameter for render targets

With the new Wii U upscaling code, 640x480 uses too much MEM1.

Honestly, maybe I should just overhaul how render targets work on the
Wii U. Surely there's a way to dynamically allocate only one colour
buffer at a time?

--- a/src/Draw.cpp
+++ b/src/Draw.cpp
@@ -379,7 +379,7 @@
 }
 
 // TODO - Inaccurate stack frame
-BOOL MakeSurface_Generic(int bxsize, int bysize, SurfaceID surf_no, BOOL bSystem)
+BOOL MakeSurface_Generic(int bxsize, int bysize, SurfaceID surf_no, BOOL bSystem, BOOL bTarget)
 {
 #ifdef FIX_BUGS
 	if (surf_no >= SURFACE_ID_MAX)
@@ -391,7 +391,7 @@
 	if (surf[surf_no] != NULL)
 		return FALSE;
 
-	surf[surf_no] = RenderBackend_CreateSurface(bxsize * mag, bysize * mag, true);
+	surf[surf_no] = RenderBackend_CreateSurface(bxsize * mag, bysize * mag, bTarget);
 
 	if (surf[surf_no] == NULL)
 		return FALSE;
--- a/src/Draw.h
+++ b/src/Draw.h
@@ -49,7 +49,7 @@
 BOOL MakeSurface_File(const char *name, SurfaceID surf_no);
 BOOL ReloadBitmap_Resource(const char *name, SurfaceID surf_no);
 BOOL ReloadBitmap_File(const char *name, SurfaceID surf_no);
-BOOL MakeSurface_Generic(int bxsize, int bysize, SurfaceID surf_no, BOOL bSystem);
+BOOL MakeSurface_Generic(int bxsize, int bysize, SurfaceID surf_no, BOOL bSystem, BOOL bTarget);
 void BackupSurface(SurfaceID surf_no, const RECT *rect);
 void PutBitmap3(const RECT *rcView, int x, int y, const RECT *rect, SurfaceID surf_no);
 void PutBitmap4(const RECT *rcView, int x, int y, const RECT *rect, SurfaceID surf_no);
--- a/src/GenericLoad.cpp
+++ b/src/GenericLoad.cpp
@@ -191,16 +191,16 @@
 	if (bError)
 		return FALSE;
 
-	MakeSurface_Generic(WINDOW_WIDTH, WINDOW_HEIGHT, SURFACE_ID_SCREEN_GRAB, TRUE);
-	MakeSurface_Generic(320, 240, SURFACE_ID_LEVEL_BACKGROUND, FALSE);
-	MakeSurface_Generic(WINDOW_WIDTH, WINDOW_HEIGHT, SURFACE_ID_MAP, TRUE);
-	MakeSurface_Generic(320, 240, SURFACE_ID_CASTS, FALSE);
-	MakeSurface_Generic(256, 256, SURFACE_ID_LEVEL_TILESET, FALSE);
-	MakeSurface_Generic(160, 16, SURFACE_ID_ROOM_NAME, FALSE);
-	MakeSurface_Generic(40, 240, SURFACE_ID_VALUE_VIEW, FALSE);
-	MakeSurface_Generic(320, 240, SURFACE_ID_LEVEL_SPRITESET_1, FALSE);
-	MakeSurface_Generic(320, 240, SURFACE_ID_LEVEL_SPRITESET_2, FALSE);
-	MakeSurface_Generic(320, 16 * (MAX_STRIP - 1), SURFACE_ID_CREDIT_CAST, FALSE);
+	MakeSurface_Generic(WINDOW_WIDTH, WINDOW_HEIGHT, SURFACE_ID_SCREEN_GRAB, TRUE, TRUE);
+	MakeSurface_Generic(320, 240, SURFACE_ID_LEVEL_BACKGROUND, FALSE, FALSE);
+	MakeSurface_Generic(WINDOW_WIDTH, WINDOW_HEIGHT, SURFACE_ID_MAP, TRUE, TRUE);
+	MakeSurface_Generic(320, 240, SURFACE_ID_CASTS, FALSE, FALSE);
+	MakeSurface_Generic(256, 256, SURFACE_ID_LEVEL_TILESET, FALSE, FALSE);
+	MakeSurface_Generic(160, 16, SURFACE_ID_ROOM_NAME, FALSE, TRUE);
+	MakeSurface_Generic(40, 240, SURFACE_ID_VALUE_VIEW, FALSE, TRUE);
+	MakeSurface_Generic(320, 240, SURFACE_ID_LEVEL_SPRITESET_1, FALSE, FALSE);
+	MakeSurface_Generic(320, 240, SURFACE_ID_LEVEL_SPRITESET_2, FALSE, FALSE);
+	MakeSurface_Generic(320, 16 * (MAX_STRIP - 1), SURFACE_ID_CREDIT_CAST, FALSE, TRUE);
 
 	pt_size = 0;
 	pt_size += MakePixToneObject(&gPtpTable[0], 2, 32);
--- a/src/TextScr.cpp
+++ b/src/TextScr.cpp
@@ -68,7 +68,7 @@
 
 	// Create line surfaces
 	for (i = 0; i < 4; ++i)
-		MakeSurface_Generic(gRect_line.right, gRect_line.bottom, (SurfaceID)(SURFACE_ID_TEXT_LINE1 + i), FALSE);
+		MakeSurface_Generic(gRect_line.right, gRect_line.bottom, (SurfaceID)(SURFACE_ID_TEXT_LINE1 + i), FALSE, TRUE);
 
 	// Clear text
 	memset(text, 0, sizeof(text));