From 588eb5feb0dd5ecc67d425c0b2eff6042e2a7ec8 Mon Sep 17 00:00:00 2001 From: Taylor Stephensen Date: Sun, 24 Sep 2023 14:36:12 -0400 Subject: [PATCH 1/4] Update ARM GNU toolchain URLs and hope nothing breaks :) --- cmake/prebuilt-armhf-toolchain.cmake | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/cmake/prebuilt-armhf-toolchain.cmake b/cmake/prebuilt-armhf-toolchain.cmake index 1980389d..1aee02ea 100644 --- a/cmake/prebuilt-armhf-toolchain.cmake +++ b/cmake/prebuilt-armhf-toolchain.cmake @@ -1,11 +1,15 @@ # 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-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-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() From 67ef3655050e63d679086a3547b6fa1069727ec0 Mon Sep 17 00:00:00 2001 From: Taylor Stephensen Date: Sun, 24 Sep 2023 23:06:23 -0400 Subject: [PATCH 2/4] 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. --- mods/src/misc/misc.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mods/src/misc/misc.cpp b/mods/src/misc/misc.cpp index 44d31289..79c8825d 100644 --- a/mods/src/misc/misc.cpp +++ b/mods/src/misc/misc.cpp @@ -14,10 +14,11 @@ // 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(stream)), std::istreambuf_iterator()); + 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(); From cef22a53252bd958b978178b7215a5ab04c8ae74 Mon Sep 17 00:00:00 2001 From: Taylor Stephensen Date: Sun, 24 Sep 2023 23:07:30 -0400 Subject: [PATCH 3/4] Oops Forgot to update a few lines of code in the previous commit. Sorry! --- mods/src/misc/misc.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/src/misc/misc.cpp b/mods/src/misc/misc.cpp index 79c8825d..2c484184 100644 --- a/mods/src/misc/misc.cpp +++ b/mods/src/misc/misc.cpp @@ -21,8 +21,8 @@ static AppPlatform_readAssetFile_return_value AppPlatform_readAssetFile_injectio 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; } From 99424546f8311c405c2eac994adcb3d6b209bfa0 Mon Sep 17 00:00:00 2001 From: Taylor Stephensen Date: Sun, 24 Sep 2023 23:17:13 -0400 Subject: [PATCH 4/4] Remove old toolchain URLs --- cmake/prebuilt-armhf-toolchain.cmake | 4 ---- 1 file changed, 4 deletions(-) diff --git a/cmake/prebuilt-armhf-toolchain.cmake b/cmake/prebuilt-armhf-toolchain.cmake index 1aee02ea..2b33add3 100644 --- a/cmake/prebuilt-armhf-toolchain.cmake +++ b/cmake/prebuilt-armhf-toolchain.cmake @@ -1,13 +1,9 @@ # 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()