shithub: cstory

Download patch

ref: 0f6768e6e6ebb7415ba98e9326f8a1f37d2e69b3
parent: 65aac0bb2108c92b5d85e1de82af88dbd6bcbdb1
author: Clownacy <Clownacy@users.noreply.github.com>
date: Tue Oct 13 16:00:30 EDT 2020

Misc 3DS cleanup and tweaks

--- a/src/Backends/Rendering/3DS.cpp
+++ b/src/Backends/Rendering/3DS.cpp
@@ -102,7 +102,7 @@
 {
 	if (!frame_started)
 	{
-		C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
+		C3D_FrameBegin(0);
 		frame_started = true;
 	}
 
@@ -156,7 +156,7 @@
 			}
 			else
 			{
-				surface->render_target = C3D_RenderTargetCreateFromTex(&surface->texture, GPU_TEXFACE_2D, 0, GPU_RB_DEPTH16);
+				surface->render_target = C3D_RenderTargetCreateFromTex(&surface->texture, GPU_TEXFACE_2D, 0, -1);
 
 				if (surface->render_target != NULL)
 					return surface;
@@ -203,12 +203,12 @@
 {
 	Backend_PrintInfo("RenderBackend_UploadSurface");
 
-	unsigned char *rgba_buffer = (unsigned char*)linearAlloc(width * height * 4);
+	unsigned char *abgr_buffer = (unsigned char*)linearAlloc(width * height * 4);
 
-	if (rgba_buffer != NULL)
+	if (abgr_buffer != NULL)
 	{
 		const unsigned char *src = pixels;
-		unsigned char *dst = rgba_buffer;
+		unsigned char *dst = abgr_buffer;
 
 		// Convert from colour-keyed RGB to ABGR
 		for (size_t i = 0; i < width * height; ++i)
@@ -224,11 +224,11 @@
 		}
 
 		// ensure data is in physical ram
-		GSPGPU_FlushDataCache(rgba_buffer, width * height * 4);
+		GSPGPU_FlushDataCache(abgr_buffer, width * height * 4);
 
-		C3D_SyncDisplayTransfer((u32*)rgba_buffer, GX_BUFFER_DIM(width, height), (u32*)surface->texture.data, GX_BUFFER_DIM(surface->texture.width, surface->texture.height), TEXTURE_TRANSFER_FLAGS);
+		C3D_SyncDisplayTransfer((u32*)abgr_buffer, GX_BUFFER_DIM(width, height), (u32*)surface->texture.data, GX_BUFFER_DIM(surface->texture.width, surface->texture.height), TEXTURE_TRANSFER_FLAGS);
 
-		linearFree(rgba_buffer);
+		linearFree(abgr_buffer);
 	}
 	else
 	{
@@ -240,7 +240,7 @@
 {
 	if (!frame_started)
 	{
-		C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
+		C3D_FrameBegin(0);
 		frame_started = true;
 	}
 
@@ -270,7 +270,7 @@
 {
 	if (!frame_started)
 	{
-		C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
+		C3D_FrameBegin(0);
 		frame_started = true;
 	}