82 lines
2 KiB
C++
82 lines
2 KiB
C++
/*
|
|
*
|
|
* Ham'n'Cheese
|
|
* Copyright (C) 2023-2024 Scott Duensing <scott@kangaroopunch.com>
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* as published by the Free Software Foundation; either version 3
|
|
* of the License, or (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>
|
|
*
|
|
*/
|
|
|
|
|
|
#include "embedded.h"
|
|
|
|
#define EMBED_HERE
|
|
|
|
extern "C" {
|
|
#include <stdio.h>
|
|
#include "stddclmr.h"
|
|
|
|
#ifdef __linux__
|
|
#ifdef __arm__
|
|
#include "embeds/linux_arm64.h"
|
|
#elif __x86_64__
|
|
#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;
|
|
#else
|
|
#include "embeds/linux_i386.h"
|
|
unsigned char *data = i386_linux_gnu_edge;
|
|
size_t length = (size_t)i386_linux_gnu_edge_len;
|
|
#endif
|
|
#elif _WIN32
|
|
#ifdef __x86_64__
|
|
#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;
|
|
#else
|
|
#include "embeds/windows_i686.h"
|
|
unsigned char *data = i686_w64_mingw32_edge_exe;
|
|
size_t length = (size_t)i686_w64_mingw32_edge_exe_len;
|
|
#endif
|
|
#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;
|
|
}
|