From a516116eecb137221bd608942c856954c2f57a07 Mon Sep 17 00:00:00 2001 From: Relintai Date: Thu, 25 Jan 2024 13:56:30 +0100 Subject: [PATCH] Added compatibility macros. Also make FIleAccess work with sfw. --- data/data.cpp | 12 ++++++++++++ platform/sfw.h | 2 ++ platform/sfw_compat.h | 22 ++++++++++++++++++++-- 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/data/data.cpp b/data/data.cpp index d7a8daf..8393710 100644 --- a/data/data.cpp +++ b/data/data.cpp @@ -268,7 +268,11 @@ void MLPPData::set_data_supervised(int k, const String &file_name, Ref> input_set_tmp; Vector output_set_tmp; +#ifdef USING_SFW + FileAccess *file = FileAccess::create_and_open(file_name, FileAccess::READ); +#else FileAccess *file = FileAccess::open(file_name, FileAccess::READ); +#endif ERR_FAIL_COND(!file); @@ -300,7 +304,11 @@ void MLPPData::set_data_unsupervised(int k, const String &file_name, Ref> input_set_tmp; input_set_tmp.resize(k); +#ifdef USING_SFW + FileAccess *file = FileAccess::create_and_open(file_name, FileAccess::READ); +#else FileAccess *file = FileAccess::open(file_name, FileAccess::READ); +#endif ERR_FAIL_COND(!file); @@ -322,7 +330,11 @@ void MLPPData::set_data_unsupervised(int k, const String &file_name, Ref input_set, Ref output_set) { ERR_FAIL_COND(!input_set.is_valid() || !output_set.is_valid()); +#ifdef USING_SFW + FileAccess *file = FileAccess::create_and_open(file_name, FileAccess::READ); +#else FileAccess *file = FileAccess::open(file_name, FileAccess::READ); +#endif ERR_FAIL_COND(!file); diff --git a/platform/sfw.h b/platform/sfw.h index 3de3c5e..f9aa6da 100644 --- a/platform/sfw.h +++ b/platform/sfw.h @@ -19224,4 +19224,6 @@ public: #line 0 +#include "sfw_compat.h" + #endif diff --git a/platform/sfw_compat.h b/platform/sfw_compat.h index 439a6fd..b9a82e7 100644 --- a/platform/sfw_compat.h +++ b/platform/sfw_compat.h @@ -1,5 +1,23 @@ - #ifndef SFW_COMPAT_H #define SFW_COMPAT_H -#endif +class ClassDB { +public: + static void bind_method(...) {} +}; + +#define GDCLASS(m_class, m_inherits) SFW_OBJECT(m_class, m_inherits); + +#define VARIANT_ENUM_CAST(...) + +#define BIND_ENUM_CONSTANT(...) + +#define D_METHOD(...) "" + +#define PLOG_MSG LOG_MSG + +#define PropertyInfo(...) "" +#define ADD_PROPERTY(...) + + +#endif \ No newline at end of file