Added compatibility macros. Also make FIleAccess work with sfw.

This commit is contained in:
Relintai 2024-01-25 13:56:30 +01:00
parent 49bfdcdd2c
commit a516116eec
3 changed files with 34 additions and 2 deletions

View File

@ -268,7 +268,11 @@ void MLPPData::set_data_supervised(int k, const String &file_name, Ref<MLPPMatri
Vector<Vector<real_t>> input_set_tmp; Vector<Vector<real_t>> input_set_tmp;
Vector<real_t> output_set_tmp; Vector<real_t> 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); FileAccess *file = FileAccess::open(file_name, FileAccess::READ);
#endif
ERR_FAIL_COND(!file); ERR_FAIL_COND(!file);
@ -300,7 +304,11 @@ void MLPPData::set_data_unsupervised(int k, const String &file_name, Ref<MLPPMat
Vector<Vector<real_t>> input_set_tmp; Vector<Vector<real_t>> input_set_tmp;
input_set_tmp.resize(k); 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); FileAccess *file = FileAccess::open(file_name, FileAccess::READ);
#endif
ERR_FAIL_COND(!file); ERR_FAIL_COND(!file);
@ -322,7 +330,11 @@ void MLPPData::set_data_unsupervised(int k, const String &file_name, Ref<MLPPMat
void MLPPData::set_data_simple(const String &file_name, Ref<MLPPVector> input_set, Ref<MLPPVector> output_set) { void MLPPData::set_data_simple(const String &file_name, Ref<MLPPVector> input_set, Ref<MLPPVector> output_set) {
ERR_FAIL_COND(!input_set.is_valid() || !output_set.is_valid()); 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); FileAccess *file = FileAccess::open(file_name, FileAccess::READ);
#endif
ERR_FAIL_COND(!file); ERR_FAIL_COND(!file);

View File

@ -19224,4 +19224,6 @@ public:
#line 0 #line 0
#include "sfw_compat.h"
#endif #endif

View File

@ -1,5 +1,23 @@
#ifndef SFW_COMPAT_H #ifndef SFW_COMPAT_H
#define SFW_COMPAT_H #define SFW_COMPAT_H
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 #endif