51 lines
956 B
C++
51 lines
956 B
C++
#include "embedded.h"
|
|
|
|
#define EMBED_HERE
|
|
|
|
extern "C" {
|
|
#include <stdio.h>
|
|
#include "stddclmr.h"
|
|
|
|
#ifdef __linux__
|
|
#ifdef __arm__
|
|
#include "embeds/linux_arm64.h"
|
|
#else
|
|
#include "embeds/linux_x86_64.h"
|
|
unsigned char *data = x86_64_linux_gnu_edge;
|
|
size_t length = (size_t)x86_64_linux_gnu_edge_len;
|
|
#endif
|
|
#elif _WIN32
|
|
#include "embeds/windows_x86_64.h"
|
|
unsigned char *data = x86_64_w64_mingw32_edge_exe;
|
|
size_t length = (size_t)x86_64_w64_mingw32_edge_exe_len;
|
|
#elif __APPLE__
|
|
#ifdef __arm__
|
|
#include "embeds/macos_arm64.h"
|
|
#else
|
|
#include "embeds/macos_x86_64.h"
|
|
#endif
|
|
#endif
|
|
}
|
|
|
|
|
|
|
|
Embedded::Embedded() {
|
|
}
|
|
|
|
|
|
void Embedded::_bind_methods() {
|
|
ClassDB::bind_method(D_METHOD("save_edge", "filename"), &Embedded::save_edge);
|
|
}
|
|
|
|
|
|
bool Embedded::save_edge(String filename) {
|
|
FILE *out;
|
|
|
|
out = fopen(filename.ascii().get_data(), "wb");
|
|
if (out) {
|
|
fwrite(data, length, 1, out);
|
|
fclose(out);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|