Compare commits

...

4 Commits

Author SHA1 Message Date
taylorthemushroom b00a9b019c Remove old toolchain URLs 2023-09-24 23:17:13 -04:00
taylorthemushroom 2da7947640 Oops
Forgot to update a few lines of code in the previous commit. Sorry!
2023-09-24 23:07:30 -04:00
taylorthemushroom 5432664f77 Rewrite asset file loading for new toolchain
Old implementation throws null dereference errors on new toolchain. New implementation has not been fully stress-tested but should be mostly operational.
2023-09-24 23:06:23 -04:00
taylorthemushroom 68eb40b99c Update ARM GNU toolchain URLs and hope nothing breaks :) 2023-09-24 14:36:12 -04:00
2 changed files with 11 additions and 10 deletions

View File

@ -1,11 +1,11 @@
# Pick URL
execute_process(COMMAND uname -m OUTPUT_VARIABLE arch OUTPUT_STRIP_TRAILING_WHITESPACE)
if(arch STREQUAL "x86_64")
set(toolchain_url "https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-x86_64-arm-none-linux-gnueabihf.tar.xz")
set(toolchain_sha256 "aa074fa8371a4f73fecbd16bd62c8b1945f23289e26414794f130d6ccdf8e39c")
set(toolchain_url "https://developer.arm.com/-/media/Files/downloads/gnu/12.3.rel1/binrel/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-linux-gnueabihf.tar.xz")
set(toolchain_sha256 "f5f3c1cfcb429833d363e8fec31bb1282974b119ca8169d6277ce8a549e26d54")
elseif(arch STREQUAL "aarch64" OR arch STREQUAL "armv8b" OR arch STREQUAL "armv8l")
set(toolchain_url "https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-aarch64-arm-none-linux-gnueabihf.tar.xz")
set(toolchain_sha256 "fccd7af76988da2b077f939eb2a78baa9935810918d2bf3f837bc74f52efa825")
set(toolchain_url "https://developer.arm.com/-/media/Files/downloads/gnu/12.3.rel1/binrel/arm-gnu-toolchain-12.3.rel1-aarch64-arm-none-linux-gnueabihf.tar.xz")
set(toolchain_sha256 "ac2806f4c1ba772817aded18a5b730b5004592b1f1224d8296de69942e3704bd")
else()
message(FATAL_ERROR "Unable To Download Prebuilt ARMHF Toolchain")
endif()

View File

@ -14,14 +14,15 @@
// Read Asset File
static AppPlatform_readAssetFile_return_value AppPlatform_readAssetFile_injection(__attribute__((unused)) unsigned char *app_platform, std::string const& path) {
// Read File
std::string full_path("data/");
full_path.append(path);
std::ifstream stream(full_path);
std::string str((std::istreambuf_iterator<char>(stream)), std::istreambuf_iterator<char>());
std::ifstream stream("data/" + path, std::ios_base::binary | std::ios_base::ate);
long len = stream.tellg();
char *buf = new char[len];
stream.seekg(0, stream.beg);
stream.read(buf, len);
// Return String
AppPlatform_readAssetFile_return_value ret;
ret.length = str.length();
ret.data = strdup(str.c_str());
ret.length = len;
ret.data = strdup(buf);
return ret;
}