shithub: cstory

Download patch

ref: b9d9d339f831672710235330064902317a35e838
parent: 4ca6e12257518e1ff278996f26e82e1cd212a6b8
parent: f06884b2a35a45459fb594d2bf0a2ae611f0589c
author: gameblabla <gameblabla@users.noreply.github.com>
date: Thu Apr 13 10:04:14 EDT 2023

Merge pull request #1 from faithanalog/portable

track dkp changes - update _3DS to __3DS__ & update README

--- a/README.md
+++ b/README.md
@@ -188,7 +188,7 @@
 Open a terminal, and `cd` into the CSE2 directory. Then execute this command:
 
 ```
-cmake -B build3ds -DCMAKE_BUILD_TYPE=Release -DFORCE_LOCAL_LIBS=ON -DBACKEND_PLATFORM=3DS -DBACKEND_RENDERER=3DS -DBACKEND_AUDIO=3DS-Hardware -DDOCONFIG=OFF -DFREETYPE_FONTS=ON -DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/3ds.cmake
+cmake -B build3ds -DCMAKE_BUILD_TYPE=Release -DFORCE_LOCAL_LIBS=ON -DBACKEND_PLATFORM=3DS -DBACKEND_RENDERER=3DS -DBACKEND_AUDIO=3DS-Hardware -DDOCONFIG=OFF -DFREETYPE_FONTS=ON -DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/cmake/3DS.cmake -DCTRU_ROOT=$DEVKITPRO/libctru
 ```
 
 (Note that `FREETYPE_FONTS` is enabled. If you're creating a Japanese build,
@@ -210,7 +210,7 @@
 We can finally generate a `.3dsx` file:
 
 ```
-3dsxtool game_english/CSE2 game_english/CSE2.3dsx --romfs=game_english/data --smdh=build3ds/smdh.smdh
+3dsxtool game_english/CSE2.elf game_english/CSE2.3dsx --romfs=game_english/data --smdh=build3ds/smdh.smdh
 ```
 
 ## Licensing
--- a/src/Backends/Rendering/Software.cpp
+++ b/src/Backends/Rendering/Software.cpp
@@ -40,7 +40,7 @@
 	if (WindowBackend_Software_CreateWindow(window_title, screen_width, screen_height, fullscreen))
 	{
 		framebuffer.pixels = WindowBackend_Software_GetFramebuffer(&framebuffer.pitch);
-	#ifdef _3DS
+	#ifdef __3DS__
 		framebuffer.width = screen_height;
 		framebuffer.height = screen_width;
 	#else
@@ -88,7 +88,7 @@
 		return NULL;
 	}
 
-#ifdef _3DS
+#ifdef __3DS__
 	surface->width = height;
 	surface->height = width;
 	surface->pitch = height * 3;
@@ -121,7 +121,7 @@
 
 void RenderBackend_UploadSurface(RenderBackend_Surface *surface, const unsigned char *pixels, size_t width, size_t height)
 {
-#ifdef _3DS
+#ifdef __3DS__
 	// Rotate 90 degrees clockwise, and convert from RGB to BGR
 	const unsigned char *source_pointer = pixels;
 
@@ -146,7 +146,7 @@
 {
 	RenderBackend_Rect rect_clamped;
 
-#ifdef _3DS
+#ifdef __3DS__
 	// Rotate
 	rect_clamped.left = source_surface->width - rect->bottom;
 	rect_clamped.top = rect->left;
@@ -238,7 +238,7 @@
 {
 	RenderBackend_Rect rect_clamped;
 
-#ifdef _3DS
+#ifdef __3DS__
 	// Rotate
 	rect_clamped.left = surface->width - rect->bottom;
 	rect_clamped.top = rect->left;
@@ -282,7 +282,7 @@
 
 		for (long i = 0; i < rect_clamped.right - rect_clamped.left; ++i)
 		{
-		#ifdef _3DS
+		#ifdef __3DS__
 			*destination_pointer++ = blue;
 			*destination_pointer++ = green;
 			*destination_pointer++ = red;
@@ -305,7 +305,7 @@
 
 		if (atlas->pixels != NULL)
 		{
-		#ifdef _3DS
+		#ifdef __3DS__
 			atlas->width = height;
 			atlas->height = width;
 		#else
@@ -330,7 +330,7 @@
 
 void RenderBackend_UploadGlyph(RenderBackend_GlyphAtlas *atlas, size_t x, size_t y, const unsigned char *pixels, size_t width, size_t height, size_t pitch)
 {
-#ifdef _3DS
+#ifdef __3DS__
 	// Rotate
 	for (size_t h = 0; h < height; ++h)
 	{
@@ -350,7 +350,7 @@
 	glyph_atlas = atlas;
 	glyph_destination_surface = destination_surface;
 
-#ifdef _3DS
+#ifdef __3DS__
 	glyph_colour_channels[0] = blue;
 	glyph_colour_channels[1] = green;
 	glyph_colour_channels[2] = red;
@@ -363,7 +363,7 @@
 
 void RenderBackend_DrawGlyph(long x, long y, size_t glyph_x, size_t glyph_y, size_t glyph_width, size_t glyph_height)
 {
-#ifdef _3DS
+#ifdef __3DS__
 	// Rotate
 	const size_t new_glyph_width = glyph_height;
 	const size_t new_glyph_height = glyph_width;
--- a/src/Config.cpp
+++ b/src/Config.cpp
@@ -70,7 +70,7 @@
 	// Fun fact: The Linux port added this line:
 	// conf->display_mode = 1;
 
-#ifdef _3DS
+#ifdef __3DS__
 	conf->display_mode = 1;
 #elif defined(__riscos__)
 	conf->display_mode = 2;
--- a/src/Draw.cpp
+++ b/src/Draw.cpp
@@ -13,7 +13,7 @@
 #include <string.h>
 #include <string>
 
-#ifdef _3DS
+#ifdef __3DS__
  #include <3ds.h>
 #endif
 
@@ -87,7 +87,7 @@
 
 	RenderBackend_DrawScreen();
 
-#ifdef _3DS
+#ifdef __3DS__
 	// This would go in Backend_SystemTask, but that causes a hang
 	// because of a race condition: aptMainLoop cannot be called
 	// between C3D_FrameBegin and C3D_FrameEnd