From 1a6471a3a87e5a0608d49a2b0f1a88873ffc5a33 Mon Sep 17 00:00:00 2001
From: Mr-Wiseguy <mrwiseguyromhacking@gmail.com>
Date: Thu, 3 Apr 2025 03:42:04 -0400
Subject: [PATCH] Switch to runtime concatenation of function name in data API
 error reporting to fix Linux compilation issue

---
 src/game/recomp_data_api.cpp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/game/recomp_data_api.cpp b/src/game/recomp_data_api.cpp
index 9b13c57..bb7d37c 100644
--- a/src/game/recomp_data_api.cpp
+++ b/src/game/recomp_data_api.cpp
@@ -172,13 +172,18 @@ LockedSlotmap<MemorySlotmap> memory_slotmaps{};
 
 #define REGISTER_FUNC(name) recomp::overlays::register_base_export(#name, name)
 
+static void show_fatal_error_message_box(const char* funcname, const char* errstr) {
+    std::string message = std::string{"Fatal error in mod - "} + funcname + " : " + errstr;
+    recompui::message_box(message.c_str());
+}
+
 #define HANDLE_INVALID_ERROR() \
-    recompui::message_box("Fatal error in mod - " __FUNCTION__ " : handle is invalid"); \
+    show_fatal_error_message_box(__FUNCTION__, "handle is invalid"); \
     assert(false); \
     ultramodern::error_handling::quick_exit(__FILE__, __LINE__, __FUNCTION__);
 
 #define SLOTMAP_KEY_INVALID_ERROR() \
-    recompui::message_box("Fatal error in mod - " __FUNCTION__ " : slotmap key is invalid"); \
+    show_fatal_error_message_box(__FUNCTION__, "slotmap key is invalid"); \
     assert(false); \
     ultramodern::error_handling::quick_exit(__FILE__, __LINE__, __FUNCTION__);