shithub: cstory

Download patch

ref: 584ea57c5d0b661d0b07fb9c3b254381a5408009
parent: 37c5236b9b0d3b297ff907c1c3af3087582d658a
author: Clownacy <Clownacy@users.noreply.github.com>
date: Tue Mar 31 12:28:28 EDT 2020

Split SDL2 code from Profile.cpp and TextScr.cpp

--- a/src/Backends/Platform.h
+++ b/src/Backends/Platform.h
@@ -9,3 +9,5 @@
 void PlatformBackend_GetBasePath(char *string_buffer);
 
 BOOL PlatformBackend_SystemTask(void);
+
+void PlatformBackend_ShowMessageBox(const char *title, const char *message);
--- a/src/Backends/Platform/SDL2.cpp
+++ b/src/Backends/Platform/SDL2.cpp
@@ -252,3 +252,8 @@
 
 	return TRUE;
 }
+
+void PlatformBackend_ShowMessageBox(const char *title, const char *message)
+{
+	SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, title, message, NULL);
+}
--- a/src/Profile.cpp
+++ b/src/Profile.cpp
@@ -4,10 +4,9 @@
 #include <stdio.h>
 #include <string.h>
 
-#include "SDL.h"
-
 #include "WindowsWrapper.h"
 
+#include "Backends/Platform.h"
 #include "ArmsItem.h"
 #include "BossLife.h"
 #include "Fade.h"
@@ -248,9 +247,9 @@
 	if (!TransferStage(13, 200, 10, 8))
 	{
 #ifdef JAPANESE
-		SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "エラー", "ステージの読み込みに失敗", NULL);
+		PlatformBackend_ShowMessageBox("エラー", "ステージの読み込みに失敗");
 #else
-		SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", "Failed to load stage", NULL);
+		PlatformBackend_ShowMessageBox("Error", "Failed to load stage");
 #endif
 
 		return FALSE;
--- a/src/TextScr.cpp
+++ b/src/TextScr.cpp
@@ -4,10 +4,9 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "SDL.h"
-
 #include "WindowsWrapper.h"
 
+#include "Backends/Platform.h"
 #include "ArmsItem.h"
 #include "Boss.h"
 #include "BossLife.h"
@@ -727,9 +726,9 @@
 						if (!TransferStage(z, w, x, y))
 						{
 							#ifdef JAPANESE
-							SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "エラー", "ステージの読み込みに失敗", NULL);
+							PlatformBackend_ShowMessageBox("エラー", "ステージの読み込みに失敗");
 							#else
-							SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", "Failed to load stage", NULL);
+							PlatformBackend_ShowMessageBox("Error", "Failed to load stage");
 							#endif
 
 							return enum_ESCRETURN_exit;
@@ -1284,10 +1283,10 @@
 						char str_0[0x40];
 						#ifdef JAPANESE
 						sprintf(str_0, "不明のコード:<%c%c%c", gTS.data[gTS.p_read + 1], gTS.data[gTS.p_read + 2], gTS.data[gTS.p_read + 3]);
-						SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "エラー", str_0, NULL);
+						PlatformBackend_ShowMessageBox("エラー", str_0);
 						#else
 						sprintf(str_0, "Unknown code:<%c%c%c", gTS.data[gTS.p_read + 1], gTS.data[gTS.p_read + 2], gTS.data[gTS.p_read + 3]);
-						SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", str_0, NULL);
+						PlatformBackend_ShowMessageBox("Error", str_0);
 						#endif
 
 						return enum_ESCRETURN_exit;
--