Added remaining msvc compile issues

This commit is contained in:
KiritoDv
2023-08-25 20:36:50 -06:00
parent fbaf50aadd
commit 211d9fb150
12 changed files with 430 additions and 68 deletions
+2
View File
@@ -51,7 +51,9 @@ build/*
*.map
.assets-local.txt
build/
build-cmake/*
cmake-msvc-*/*
cmake-build-*/*
.idea/*
ghostship.cfg.json
+1 -1
View File
@@ -1,4 +1,4 @@
Refresh 15 (mostly a hotfix for RSP microcode selection)
Refresh 15 (mostly a hotfix for RSP microcode selection)
1.) Renamed frame_buffer funcs and _ZBUFFER (#1184)
2.) RSP Microcode Hotfix (#1183)
+9 -6
View File
@@ -34,11 +34,7 @@ set(VCPKG_TARGET_TRIPLET x64-mingw-static)
endif()
vcpkg_bootstrap()
if(MSVC)
vcpkg_install_packages(zlib bzip2 libpng getopt dirent libusb pthread)
else()
vcpkg_install_packages(fontconfig)
endif()
vcpkg_install_packages(fontconfig sdl2 zlib bzip2 libpng getopt dirent libusb pthread glew glfw3)
endif()
if (MSVC)
@@ -56,10 +52,17 @@ add_subdirectory(tools)
# Find Python 3 for the custom target
find_package(Python3 COMPONENTS Interpreter REQUIRED)
set(TOOLS_PATH "")
if(WIN32)
set(TOOLS_PATH ${CMAKE_BINARY_DIR}/$<$<CONFIG:Debug>:Debug>$<$<CONFIG:Release>:Release>)
message(STATUS "TOOLS_PATH: ${TOOLS_PATH}")
endif()
# Add a custom target to extract assets
add_custom_target(
ExtractAssets
COMMAND ${CMAKE_COMMAND} -E env "TOOLS_PATH=$<TARGET_FILE_DIR:mio0>" ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/extract_assets.py ${VERSION}
COMMAND ${CMAKE_COMMAND} -E env "TOOLS_PATH=$<TARGET_FILE_DIR:mio0>" ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/extract_assets.py ${VERSION} ${TOOLS_PATH}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Running asset extraction..."
DEPENDS Tools
+191
View File
@@ -0,0 +1,191 @@
#------------------------------------------------------------------------------------------------------------
#
# Automate-VCPKG by Andre Taulien
# ===============================
#
# Project Repository: https://github.com/REGoth-project/Automate-VCPKG
# License ..........: MIT, see end of file.
#
# Based on: https://github.com/sutambe/cpptruths/blob/vcpkg_cmake_blog/cpp0x/vcpkg_test/CMakeLists.txt
#
#
# While [Vcpkg](https://github.com/microsoft/vcpkg) on it's own is awesome, it does add
# a little bit of complexity to getting a project to build. Even more if the one trying
# to compile your application is not too fond of the commandline. Additionally, CMake
# commands tend to get rather long with the toolchain path.
#
# To keep things simple for new users who just want to get the project to build, this
# script offers a solution.
#
# Lets assume your main `CMakelists.txt` looks something like this:
#
# cmake_minimum_required (VERSION 3.12.0)
# project (MyProject)
#
# add_executable(MyExecutable main.c)
#
# To integrate Vcpkg into that `CMakelists.txt`, simple put the following lines before the
# call to `project(MyProject)`:
#
# include(cmake/automate-vcpkg.cmake)
#
# vcpkg_bootstrap()
# vcpkg_install_packages(libsquish physfs)
#
# The call to `vcpkg_bootstrap()` will clone the official Vcpkg repository and bootstrap it.
# If it detected an existing environment variable defining a valid `VCPKG_ROOT`, it will
# update the existing installation of Vcpkg.
#
# Arguments to `vcpkg_install_packages()` are the packages you want to install using Vcpkg.
#
# If you want to keep the possibility for users to chose their own copy of Vcpkg, you can
# simply not run the code snippet mentioned above, something like this will work:
#
# option(SKIP_AUTOMATE_VCPKG "When ON, you will need to built the packages
# required by MyProject on your own or supply your own vcpkg toolchain.")
#
# if (NOT SKIP_AUTOMATE_VCPKG)
# include(cmake/automate-vcpkg.cmake)
#
# vcpkg_bootstrap()
# vcpkg_install_packages(libsquish physfs)
# endif()
#
# Then, the user has to supply the packages on their own, be it through Vcpkg or manually
# specifying their locations.
#------------------------------------------------------------------------------------------------------------
cmake_minimum_required (VERSION 3.12)
if(WIN32)
set(VCPKG_FALLBACK_ROOT ${CMAKE_CURRENT_BINARY_DIR}/vcpkg CACHE STRING "vcpkg configuration directory to use if vcpkg was not installed on the system before")
else()
set(VCPKG_FALLBACK_ROOT ${CMAKE_CURRENT_BINARY_DIR}/.vcpkg CACHE STRING "vcpkg configuration directory to use if vcpkg was not installed on the system before")
endif()
# On Windows, Vcpkg defaults to x86, even on x64 systems. If we're
# doing a 64-bit build, we need to fix that.
if (WIN32)
# Since the compiler checks haven't run yet, we need to figure
# out the value of CMAKE_SIZEOF_VOID_P ourselfs
include(CheckTypeSize)
enable_language(C)
check_type_size("void*" SIZEOF_VOID_P BUILTIN_TYPES_ONLY)
if (SIZEOF_VOID_P EQUAL 8)
message(STATUS "Using Vcpkg triplet 'x64-windows'")
set(VCPKG_TRIPLET x64-windows)
endif()
endif()
if(NOT DEFINED VCPKG_ROOT)
if(NOT DEFINED ENV{VCPKG_ROOT})
set(VCPKG_ROOT ${VCPKG_FALLBACK_ROOT})
else()
set(VCPKG_ROOT $ENV{VCPKG_ROOT})
endif()
endif()
# Installs a new copy of Vcpkg or updates an existing one
macro(vcpkg_bootstrap)
_install_or_update_vcpkg()
# Find out whether the user supplied their own VCPKG toolchain file
if(NOT DEFINED ${CMAKE_TOOLCHAIN_FILE})
# We know this wasn't set before so we need point the toolchain file to the newly found VCPKG_ROOT
set(CMAKE_TOOLCHAIN_FILE ${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake CACHE STRING "")
# Just setting vcpkg.cmake as toolchain file does not seem to actually pull in the code
include(${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake)
set(AUTOMATE_VCPKG_USE_SYSTEM_VCPKG OFF)
else()
# VCPKG_ROOT has been defined by the toolchain file already
set(AUTOMATE_VCPKG_USE_SYSTEM_VCPKG ON)
endif()
message(STATUS "Automate VCPKG status:")
message(STATUS " VCPKG_ROOT.....: ${VCPKG_ROOT}")
message(STATUS " VCPKG_EXEC.....: ${VCPKG_EXEC}")
message(STATUS " VCPKG_BOOTSTRAP: ${VCPKG_BOOTSTRAP}")
endmacro()
macro(_install_or_update_vcpkg)
if(NOT EXISTS ${VCPKG_ROOT})
message(STATUS "Cloning vcpkg in ${VCPKG_ROOT}")
execute_process(COMMAND git clone https://github.com/Microsoft/vcpkg.git ${VCPKG_ROOT})
# If a reproducible build is desired (and potentially old libraries are # ok), uncomment the
# following line and pin the vcpkg repository to a specific githash.
# execute_process(COMMAND git checkout 745a0aea597771a580d0b0f4886ea1e3a94dbca6 WORKING_DIRECTORY ${VCPKG_ROOT})
else()
# The following command has no effect if the vcpkg repository is in a detached head state.
message(STATUS "Auto-updating vcpkg in ${VCPKG_ROOT}")
execute_process(COMMAND git pull WORKING_DIRECTORY ${VCPKG_ROOT})
endif()
if(NOT EXISTS ${VCPKG_ROOT}/README.md)
message(FATAL_ERROR "***** FATAL ERROR: Could not clone vcpkg *****")
endif()
if(WIN32)
set(VCPKG_EXEC ${VCPKG_ROOT}/vcpkg.exe)
set(VCPKG_BOOTSTRAP ${VCPKG_ROOT}/bootstrap-vcpkg.bat)
else()
set(VCPKG_EXEC ${VCPKG_ROOT}/vcpkg)
set(VCPKG_BOOTSTRAP ${VCPKG_ROOT}/bootstrap-vcpkg.sh)
endif()
if(NOT EXISTS ${VCPKG_EXEC})
message("Bootstrapping vcpkg in ${VCPKG_ROOT}")
execute_process(COMMAND ${VCPKG_BOOTSTRAP} WORKING_DIRECTORY ${VCPKG_ROOT})
endif()
if(NOT EXISTS ${VCPKG_EXEC})
message(FATAL_ERROR "***** FATAL ERROR: Could not bootstrap vcpkg *****")
endif()
endmacro()
# Installs the list of packages given as parameters using Vcpkg
macro(vcpkg_install_packages)
# Need the given list to be space-separated
#string (REPLACE ";" " " PACKAGES_LIST_STR "${ARGN}")
message(STATUS "Installing/Updating the following vcpkg-packages: ${PACKAGES_LIST_STR}")
if (VCPKG_TRIPLET)
set(ENV{VCPKG_DEFAULT_TRIPLET} "${VCPKG_TRIPLET}")
endif()
execute_process(
COMMAND ${VCPKG_EXEC} install ${ARGN}
WORKING_DIRECTORY ${VCPKG_ROOT}
)
endmacro()
# MIT License
#
# Copyright (c) 2019 REGoth-project
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
+34
View File
@@ -0,0 +1,34 @@
# - Find PulseAudio includes and libraries
#
# PULSEAUDIO_FOUND - True if PULSEAUDIO_INCLUDE_DIR &
# PULSEAUDIO_LIBRARY are found
#
# PULSEAUDIO_INCLUDE_DIR - where to find pulse/pulseaudio.h, etc.
# PULSEAUDIO_LIBRARY - the pulse library
# PULSEAUDIO_VERSION_STRING - the version of PulseAudio found
#
find_path(PULSEAUDIO_INCLUDE_DIR
NAMES pulse/pulseaudio.h
DOC "The PulseAudio include directory"
)
find_library(PULSEAUDIO_LIBRARY
NAMES pulse
DOC "The PulseAudio library"
)
if(PULSEAUDIO_INCLUDE_DIR AND EXISTS "${PULSEAUDIO_INCLUDE_DIR}/pulse/version.h")
file(STRINGS "${PULSEAUDIO_INCLUDE_DIR}/pulse/version.h" pulse_version_str
REGEX "^#define[\t ]+pa_get_headers_version\\(\\)[\t ]+\\(\".*\"\\)")
string(REGEX REPLACE "^.*pa_get_headers_version\\(\\)[\t ]+\\(\"([^\"]*)\"\\).*$" "\\1"
PULSEAUDIO_VERSION_STRING "${pulse_version_str}")
unset(pulse_version_str)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PulseAudio
REQUIRED_VARS PULSEAUDIO_LIBRARY PULSEAUDIO_INCLUDE_DIR
VERSION_VAR PULSEAUDIO_VERSION_STRING
)
+48
View File
@@ -0,0 +1,48 @@
if (MSVC)
set(WINDOWS_LIBUSB_PATH "$ENV{LIBUSB_PATH}/VS2019/MS64/static")
# check if we're using something else than 64bit..
if (NOT "${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
set(WINDOWS_LIBUSB_PATH "$ENV{LIBUSB_PATH}/VS2019/MS32/static")
endif()
endif()
if (MINGW)
set(WINDOWS_LIBUSB_PATH "$ENV{LIBUSB_PATH}/MinGW64/static")
# check if we're using something else than 64bit..
if (NOT "${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
set(WINDOWS_LIBUSB_PATH "$ENV{LIBUSB_PATH}/MinGW32/static")
endif()
endif()
find_library (LIBUSB_LIBRARY
NAMES libusb libusb-1.0 usb-1.0
PATHS "/usr/lib" "/usr/local/lib/" "${WINDOWS_LIBUSB_PATH}")
find_path (LIBUSB_INCLUDEDIR
NAMES libusb.h libusb-1.0.h
PATHS "/usr/local/include/" "$ENV{LIBUSB_PATH}/include/libusb-1.0"
PATH_SUFFIXES "include" "libusb" "libusb-1.0")
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(libUsb DEFAULT_MSG
LIBUSB_LIBRARY
LIBUSB_INCLUDEDIR)
if (LIBUSB_FOUND AND NOT TARGET libUsb::libUsb)
add_library(libUsb::libUsb STATIC IMPORTED)
set_target_properties(
libUsb::libUsb
PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${LIBUSB_INCLUDEDIR}"
IMPORTED_LOCATION "${LIBUSB_LIBRARY}")
if (MSVC OR MINGW)
set_target_properties(
libUsb::libUsb
PROPERTIES
IMPORTED_IMPLIB "${LIBUSB_LIBRARY}"
)
endif()
endif()
+84
View File
@@ -0,0 +1,84 @@
# - try to find the udev library
#
# Cache Variables: (probably not for direct use in your scripts)
# UDEV_INCLUDE_DIR
# UDEV_SOURCE_DIR
# UDEV_LIBRARY
#
# Non-cache variables you might use in your CMakeLists.txt:
# UDEV_FOUND
# UDEV_INCLUDE_DIRS
# UDEV_LIBRARIES
#
# Requires these CMake modules:
# FindPackageHandleStandardArgs (known included with CMake >=2.6.2)
#
# Original Authors:
# 2014, Kevin M. Godby <kevin@godby.org>
# 2021, Ryan Pavlik <ryan.pavlik@collabora.com> <abiryan@ryand.net>
#
# Copyright 2014, Kevin M. Godby <kevin@godby.org>
# Copyright 2021, Collabora, Ltd.
#
# SPDX-License-Identifier: BSL-1.0
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
set(UDEV_ROOT_DIR
"${UDEV_ROOT_DIR}"
CACHE
PATH
"Directory to search for udev")
if(NOT ANDROID)
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
pkg_check_modules(PC_LIBUDEV QUIET libudev)
endif()
endif()
find_library(UDEV_LIBRARY
NAMES
udev
PATHS
${PC_LIBUDEV_LIBRARY_DIRS}
${PC_LIBUDEV_LIBDIR}
HINTS
"${UDEV_ROOT_DIR}"
PATH_SUFFIXES
lib
)
get_filename_component(_libdir "${UDEV_LIBRARY}" PATH)
find_path(UDEV_INCLUDE_DIR
NAMES
libudev.h
PATHS
${PC_LIBUDEV_INCLUDE_DIRS}
${PC_LIBUDEV_INCLUDEDIR}
HINTS
"${_libdir}"
"${_libdir}/.."
"${UDEV_ROOT_DIR}"
PATH_SUFFIXES
include
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(udev
DEFAULT_MSG
UDEV_LIBRARY
UDEV_INCLUDE_DIR
)
if(UDEV_FOUND)
list(APPEND UDEV_LIBRARIES ${UDEV_LIBRARY})
list(APPEND UDEV_INCLUDE_DIRS ${UDEV_INCLUDE_DIR})
mark_as_advanced(UDEV_ROOT_DIR)
endif()
mark_as_advanced(UDEV_INCLUDE_DIR
UDEV_LIBRARY)
+26
View File
@@ -0,0 +1,26 @@
set (CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_PROCESSOR x86_64)
# specify the cross compiler
set (CMAKE_C_COMPILER x86_64-w64-mingw32-gcc CACHE STRING "The C compiler to use")
set (CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++ CACHE STRING "The C++ compiler to use")
# where is the target environment
set (CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32)
# search for programs in the build host directories
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set (CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
# set the resource compiler (RHBZ #652435)
set (CMAKE_RC_COMPILER windres)
set (CMAKE_MC_COMPILER windmc)
# override boost thread component suffix as mingw-w64-boost is compiled with threadapi=win32
set (Boost_THREADAPI win32)
set (CMAKE_AR:FILEPATH x86_64-w64-mingw32-ar)
set (CMAKE_RANLIB:FILEPATH x86_64-w64-mingw32-ranlib)
+15 -51
View File
@@ -76,6 +76,12 @@ def main():
clean_assets(local_asset_file)
sys.exit(0)
prefix = ""
if len(sys.argv) > 2:
prefix = sys.argv[2]
print("Prefixing assets with", prefix)
exit(1)
all_langs = ["jp", "us", "eu", "sh"]
if not langs or not all(a in all_langs for a in langs):
langs_str = " ".join("[" + lang + "]" for lang in all_langs)
@@ -153,10 +159,11 @@ def main():
)
sys.exit(1)
# Make sure tools exist
subprocess.check_call(
["make", "-s", "-C", "tools/", "n64graphics", "skyconv", "mio0", "aifc_decode"]
)
if os.name != 'nt':
# Make sure tools exist
subprocess.check_call(
["make", "-s", "-C", "tools/", "mio0", "aifc_decode"]
)
# Go through the assets in roughly alphabetical order (but assets in the same
# mio0 file still go together).
@@ -169,9 +176,10 @@ def main():
if mio0 == "@sound":
rom = roms[lang]
args = [
"python3",
sys.executable,
"tools/disassemble_sound.py",
"baserom." + lang + ".z64",
prefix
]
def append_args(key):
size, locs = asset_map["@sound " + key + " " + lang]
@@ -194,7 +202,7 @@ def main():
if mio0 is not None:
image = subprocess.run(
[
"./tools/mio0",
f"{prefix}{'mio0.exe' if os.name == 'nt' else 'tools/mio0'}",
"-d",
"-o",
str(mio0),
@@ -211,51 +219,7 @@ def main():
print("extracting", asset)
input = image[pos : pos + size]
os.makedirs(os.path.dirname(asset), exist_ok=True)
if asset.endswith(".png"):
png_file = tempfile.NamedTemporaryFile(prefix="asset", delete=False)
try:
png_file.write(input)
png_file.flush()
png_file.close()
if asset.startswith("textures/skyboxes/") or asset.startswith("levels/ending/cake"):
if asset.startswith("textures/skyboxes/"):
imagetype = "sky"
else:
imagetype = "cake" + ("-eu" if "eu" in asset else "")
subprocess.run(
[
"./tools/skyconv",
"--type",
imagetype,
"--combine",
png_file.name,
asset,
],
check=True,
)
else:
w, h = meta
fmt = asset.split(".")[-2]
subprocess.run(
[
"./tools/n64graphics",
"-e",
png_file.name,
"-g",
asset,
"-f",
fmt,
"-w",
str(w),
"-h",
str(h),
],
check=True,
)
finally:
png_file.close()
os.remove(png_file.name)
else:
if not asset.endswith(".png"):
with open(asset, "wb") as f:
f.write(input)
+4
View File
@@ -14,6 +14,10 @@ else()
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
endif()
if (MSVC)
set(INSTALL_DIR .)
endif()
set(mio0_SOURCES libmio0.c)
add_executable(mio0 ${mio0_SOURCES})
target_compile_definitions(mio0 PUBLIC MIO0_STANDALONE)
+10 -9
View File
@@ -516,13 +516,13 @@ def write_aifc(entry, out):
writer.finish()
def write_aiff(entry, filename):
def write_aiff(prefix, entry, filename):
temp = tempfile.NamedTemporaryFile(suffix=".aifc", delete=False)
try:
write_aifc(entry, temp)
temp.flush()
temp.close()
aifc_decode = os.path.join("./cmake-msvc-dbg/tools/Debug", "aifc_decode.exe")
aifc_decode = os.path.join(prefix, "aifc_decode.exe" if os.name == "nt" else "aifc_decode")
print(aifc_decode)
subprocess.run([aifc_decode, temp.name, filename], check=True)
finally:
@@ -601,7 +601,7 @@ def main():
else:
args.append(a)
expected_num_args = 5 + (0 if only_samples else 2)
expected_num_args = 6 + (0 if only_samples else 2)
if (
need_help
or len(args) != expected_num_args
@@ -618,13 +618,14 @@ def main():
sys.exit(0 if need_help else 1)
rom_file = open(args[0], "rb")
prefix = args[1]
def read_at(offset, size):
rom_file.seek(int(offset))
return rom_file.read(int(size))
ctl_data = read_at(args[1], args[2])
tbl_data = read_at(args[3], args[4])
ctl_data = read_at(args[2], args[3])
tbl_data = read_at(args[4], args[5])
ctl_header_data = None
tbl_header_data = None
@@ -633,8 +634,8 @@ def main():
tbl_header_data = read_at(shindou_headers[2], shindou_headers[3])
if not only_samples:
samples_out_dir = args[5]
banks_out_dir = args[6]
samples_out_dir = args[6]
banks_out_dir = args[7]
banks = []
@@ -685,7 +686,7 @@ def main():
os.makedirs(dir, exist_ok=True)
created_dirs.add(dir)
os.makedirs(dir, exist_ok=True)
write_aiff(entry, filename)
write_aiff(prefix, entry, filename)
return
# Generate aiff files
@@ -713,7 +714,7 @@ def main():
# (The last chunk follows a more complex garbage pattern)
assert all(x == 0 for x in garbage)
filename = os.path.join(dir, entry.name + ".aiff")
write_aiff(entry, filename)
write_aiff(prefix, entry, filename)
# Generate sound bank .json files
os.makedirs(banks_out_dir, exist_ok=True)
+6 -1
View File
@@ -17,6 +17,11 @@
#define ELF_ST_TYPE(x) (((unsigned int) x) & 0xf)
#ifdef _MSC_VER
#define __builtin_bswap16 _byteswap_ushort
#define __builtin_bswap32 _byteswap_ulong
#endif
typedef uint32_t Elf32_Addr;
typedef uint32_t Elf32_Off;
@@ -145,7 +150,7 @@ uint16_t u16be(uint16_t val) {
return __builtin_bswap16(val);
#else
return val;
#endif
#endif
}
static bool elf_get_section_range(uint8_t *file, const char *searched_name, uint32_t *address, uint32_t *offset, uint32_t *size, uint32_t *section_index) {