mirror of
https://github.com/Vita3K/Vita3K-Android.git
synced 2024-11-27 07:20:51 +00:00
Update submodules + minor changes (#1137)
* cmake: Add NOMINMAX globally to avoid Windows compilation issues with std::min/std::max * main/net: add missing include files * rtc: Remove convert_filetime/convert_timespec functions as they have been replaced with _wstat/stat * external: Update better-enums to tag "0.11.3" * external: Update CLI11 to tag "v1.9.1" * external: Update elfio to tag "Release_3.8" * external: Update glad to tag "0.1.34" * external: Update googletest to tag "release-1.10.0" * external: Update imgui to tag "v1.80" * external: Update imgui_club * external: Update miniz to tag "2.1.0" * external: Update pugixml to tag "v1.11.4" * external: Update spdlog to tag "v1.8.2" * external: Update stb * external: Update yaml-cpp to tag "yaml-cpp-0.6.3" * external: Switch to vitasdk/vita-toolchain * external: Refactor xxHash integration
This commit is contained in:
parent
2f2fc4430c
commit
5e3a6eb982
2
.gitmodules
vendored
2
.gitmodules
vendored
@ -71,7 +71,7 @@
|
||||
url = https://github.com/Vita3K/unicorn.git
|
||||
[submodule "external/vita-toolchain"]
|
||||
path = external/vita-toolchain
|
||||
url = https://github.com/Vita3K/vita-toolchain
|
||||
url = https://github.com/vitasdk/vita-toolchain.git
|
||||
[submodule "external/VulkanMemoryAllocator"]
|
||||
path = external/VulkanMemoryAllocator
|
||||
url = https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
|
||||
|
@ -40,7 +40,7 @@ if(NOT CI)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
add_definitions (/D "_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS" /D "_CRT_SECURE_NO_WARNINGS")
|
||||
add_definitions (/D "_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS" /D "_CRT_SECURE_NO_WARNINGS" /D "NOMINMAX")
|
||||
endif()
|
||||
|
||||
# Allow per-translation-unit parallel builds when using MSVC
|
||||
|
12
external/CMakeLists.txt
vendored
12
external/CMakeLists.txt
vendored
@ -42,11 +42,11 @@ endif()
|
||||
add_library(printf INTERFACE)
|
||||
target_include_directories(printf INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/printf")
|
||||
|
||||
add_library(elfio INTERFACE)
|
||||
target_include_directories(elfio INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/elfio")
|
||||
add_subdirectory(elfio)
|
||||
|
||||
option(SPDLOG_WCHAR_FILENAMES "Support wchar filenames" ON)
|
||||
option(SPDLOG_NO_THREAD_ID "prevent spdlog from querying the thread id on each log call if thread id is not needed" ON)
|
||||
add_subdirectory(spdlog EXCLUDE_FROM_ALL)
|
||||
target_compile_definitions(spdlog INTERFACE SPDLOG_WCHAR_FILENAMES=1 SPDLOG_NO_THREAD_ID=1 SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_TRACE)
|
||||
|
||||
add_library(stb INTERFACE)
|
||||
target_include_directories(stb INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/stb")
|
||||
@ -92,7 +92,7 @@ endif()
|
||||
add_subdirectory(libfat16)
|
||||
|
||||
# The imgui target is including both imgui and imgui_club.
|
||||
add_library(imgui STATIC imgui/imgui.cpp imgui/imgui_draw.cpp imgui/imgui_widgets.cpp imgui/misc/cpp/imgui_stdlib.cpp)
|
||||
add_library(imgui STATIC imgui/imgui.cpp imgui/imgui_draw.cpp imgui/imgui_tables.cpp imgui/imgui_widgets.cpp imgui/misc/cpp/imgui_stdlib.cpp)
|
||||
target_include_directories(imgui PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/imgui"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/imgui_club/imgui_memory_editor/")
|
||||
|
||||
@ -247,3 +247,7 @@ endif()
|
||||
|
||||
add_subdirectory(ffmpeg)
|
||||
add_subdirectory(psvpfstools)
|
||||
|
||||
option(BUILD_SHARED_LIBS "Build shared library" OFF)
|
||||
option(XXHASH_BUILD_XXHSUM "Build the xxhsum binary" OFF)
|
||||
add_subdirectory(xxHash/cmake_unofficial EXCLUDE_FROM_ALL)
|
||||
|
2
external/better-enums
vendored
2
external/better-enums
vendored
@ -1 +1 @@
|
||||
Subproject commit 1ea7f04bb9afdf7a0c83ba676b9c95b0c4185b4c
|
||||
Subproject commit c35576bed0295689540b39873126129adfa0b4c8
|
177
external/cli11/CLI11.hpp
vendored
177
external/cli11/CLI11.hpp
vendored
@ -1,11 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
// CLI11: Version 1.9.0
|
||||
// CLI11: Version 1.9.1
|
||||
// Originally designed by Henry Schreiner
|
||||
// https://github.com/CLIUtils/CLI11
|
||||
//
|
||||
// This is a standalone header file generated by MakeSingleHeader.py in CLI11/scripts
|
||||
// from: v1.9.0
|
||||
// from: v1.9.1
|
||||
//
|
||||
// From LICENSE:
|
||||
//
|
||||
@ -62,18 +62,18 @@
|
||||
#include <vector>
|
||||
|
||||
|
||||
// Verbatim copy from CLI/Version.hpp:
|
||||
// Verbatim copy from Version.hpp:
|
||||
|
||||
|
||||
#define CLI11_VERSION_MAJOR 1
|
||||
#define CLI11_VERSION_MINOR 9
|
||||
#define CLI11_VERSION_PATCH 0
|
||||
#define CLI11_VERSION "1.9.0"
|
||||
#define CLI11_VERSION_PATCH 1
|
||||
#define CLI11_VERSION "1.9.1"
|
||||
|
||||
|
||||
|
||||
|
||||
// Verbatim copy from CLI/Macros.hpp:
|
||||
// Verbatim copy from Macros.hpp:
|
||||
|
||||
|
||||
// The following version macro is very similar to the one in PyBind11
|
||||
@ -112,7 +112,7 @@
|
||||
|
||||
|
||||
|
||||
// Verbatim copy from CLI/Validators.hpp:
|
||||
// Verbatim copy from Validators.hpp:
|
||||
|
||||
|
||||
// C standard library
|
||||
@ -125,7 +125,14 @@
|
||||
#else
|
||||
#include <filesystem>
|
||||
#if defined __cpp_lib_filesystem && __cpp_lib_filesystem >= 201703
|
||||
#if defined _GLIBCXX_RELEASE && _GLIBCXX_RELEASE >= 9
|
||||
#define CLI11_HAS_FILESYSTEM 1
|
||||
#elif defined(__GLIBCXX__)
|
||||
// if we are using gcc and Version <9 default to no filesystem
|
||||
#define CLI11_HAS_FILESYSTEM 0
|
||||
#else
|
||||
#define CLI11_HAS_FILESYSTEM 1
|
||||
#endif
|
||||
#else
|
||||
#define CLI11_HAS_FILESYSTEM 0
|
||||
#endif
|
||||
@ -142,15 +149,15 @@
|
||||
|
||||
|
||||
|
||||
// From CLI/Version.hpp:
|
||||
// From Version.hpp:
|
||||
|
||||
|
||||
|
||||
// From CLI/Macros.hpp:
|
||||
// From Macros.hpp:
|
||||
|
||||
|
||||
|
||||
// From CLI/StringTools.hpp:
|
||||
// From StringTools.hpp:
|
||||
|
||||
namespace CLI {
|
||||
|
||||
@ -179,9 +186,9 @@ constexpr int expected_max_vector_size{1 << 29};
|
||||
inline std::vector<std::string> split(const std::string &s, char delim) {
|
||||
std::vector<std::string> elems;
|
||||
// Check to see if empty string, give consistent result
|
||||
if(s.empty())
|
||||
if(s.empty()) {
|
||||
elems.emplace_back();
|
||||
else {
|
||||
} else {
|
||||
std::stringstream ss;
|
||||
ss.str(s);
|
||||
std::string item;
|
||||
@ -401,8 +408,9 @@ inline std::ptrdiff_t find_member(std::string name,
|
||||
it = std::find_if(std::begin(names), std::end(names), [&name](std::string local_name) {
|
||||
return detail::remove_underscore(local_name) == name;
|
||||
});
|
||||
} else
|
||||
} else {
|
||||
it = std::find(std::begin(names), std::end(names), name);
|
||||
}
|
||||
|
||||
return (it != std::end(names)) ? (it - std::begin(names)) : (-1);
|
||||
}
|
||||
@ -514,7 +522,7 @@ inline std::string &add_quotes_if_needed(std::string &str) {
|
||||
|
||||
} // namespace CLI
|
||||
|
||||
// From CLI/Error.hpp:
|
||||
// From Error.hpp:
|
||||
|
||||
namespace CLI {
|
||||
|
||||
@ -747,11 +755,11 @@ class RequiredError : public ParseError {
|
||||
class ArgumentMismatch : public ParseError {
|
||||
CLI11_ERROR_DEF(ParseError, ArgumentMismatch)
|
||||
CLI11_ERROR_SIMPLE(ArgumentMismatch)
|
||||
ArgumentMismatch(std::string name, int expected, std::size_t recieved)
|
||||
ArgumentMismatch(std::string name, int expected, std::size_t received)
|
||||
: ArgumentMismatch(expected > 0 ? ("Expected exactly " + std::to_string(expected) + " arguments to " + name +
|
||||
", got " + std::to_string(recieved))
|
||||
", got " + std::to_string(received))
|
||||
: ("Expected at least " + std::to_string(-expected) + " arguments to " + name +
|
||||
", got " + std::to_string(recieved)),
|
||||
", got " + std::to_string(received)),
|
||||
ExitCodes::ArgumentMismatch) {}
|
||||
|
||||
static ArgumentMismatch AtLeast(std::string name, int num, std::size_t received) {
|
||||
@ -840,7 +848,7 @@ class OptionNotFound : public Error {
|
||||
|
||||
} // namespace CLI
|
||||
|
||||
// From CLI/TypeTools.hpp:
|
||||
// From TypeTools.hpp:
|
||||
|
||||
namespace CLI {
|
||||
|
||||
@ -1049,15 +1057,24 @@ template <typename S> class is_tuple_like {
|
||||
};
|
||||
|
||||
/// Convert an object to a string (directly forward if this can become a string)
|
||||
template <typename T, enable_if_t<std::is_constructible<std::string, T>::value, detail::enabler> = detail::dummy>
|
||||
template <typename T, enable_if_t<std::is_convertible<T, std::string>::value, detail::enabler> = detail::dummy>
|
||||
auto to_string(T &&value) -> decltype(std::forward<T>(value)) {
|
||||
return std::forward<T>(value);
|
||||
}
|
||||
|
||||
/// Construct a string from the object
|
||||
template <typename T,
|
||||
enable_if_t<std::is_constructible<std::string, T>::value && !std::is_convertible<T, std::string>::value,
|
||||
detail::enabler> = detail::dummy>
|
||||
std::string to_string(const T &value) {
|
||||
return std::string(value);
|
||||
}
|
||||
|
||||
/// Convert an object to a string (streaming must be supported for that type)
|
||||
template <typename T,
|
||||
enable_if_t<!std::is_constructible<std::string, T>::value && is_ostreamable<T>::value, detail::enabler> =
|
||||
detail::dummy>
|
||||
enable_if_t<!std::is_convertible<std::string, T>::value && !std::is_constructible<std::string, T>::value &&
|
||||
is_ostreamable<T>::value,
|
||||
detail::enabler> = detail::dummy>
|
||||
std::string to_string(T &&value) {
|
||||
std::stringstream stream;
|
||||
stream << value;
|
||||
@ -1379,7 +1396,7 @@ inline std::string type_name() {
|
||||
// Lexical cast
|
||||
|
||||
/// Convert a flag into an integer value typically binary flags
|
||||
inline int64_t to_flag_value(std::string val) {
|
||||
inline std::int64_t to_flag_value(std::string val) {
|
||||
static const std::string trueString("true");
|
||||
static const std::string falseString("false");
|
||||
if(val == trueString) {
|
||||
@ -1389,10 +1406,10 @@ inline int64_t to_flag_value(std::string val) {
|
||||
return -1;
|
||||
}
|
||||
val = detail::to_lower(val);
|
||||
int64_t ret;
|
||||
std::int64_t ret;
|
||||
if(val.size() == 1) {
|
||||
if(val[0] >= '1' && val[0] <= '9') {
|
||||
return (static_cast<int64_t>(val[0]) - '0');
|
||||
return (static_cast<std::int64_t>(val[0]) - '0');
|
||||
}
|
||||
switch(val[0]) {
|
||||
case '0':
|
||||
@ -1803,7 +1820,7 @@ bool lexical_conversion(const std::vector<std ::string> &strings, T &output) {
|
||||
template <typename T,
|
||||
enable_if_t<std::is_integral<T>::value && std::is_unsigned<T>::value, detail::enabler> = detail::dummy>
|
||||
void sum_flag_vector(const std::vector<std::string> &flags, T &output) {
|
||||
int64_t count{0};
|
||||
std::int64_t count{0};
|
||||
for(auto &flag : flags) {
|
||||
count += detail::to_flag_value(flag);
|
||||
}
|
||||
@ -1818,7 +1835,7 @@ void sum_flag_vector(const std::vector<std::string> &flags, T &output) {
|
||||
template <typename T,
|
||||
enable_if_t<std::is_integral<T>::value && std::is_signed<T>::value, detail::enabler> = detail::dummy>
|
||||
void sum_flag_vector(const std::vector<std::string> &flags, T &output) {
|
||||
int64_t count{0};
|
||||
std::int64_t count{0};
|
||||
for(auto &flag : flags) {
|
||||
count += detail::to_flag_value(flag);
|
||||
}
|
||||
@ -1828,7 +1845,7 @@ void sum_flag_vector(const std::vector<std::string> &flags, T &output) {
|
||||
} // namespace detail
|
||||
} // namespace CLI
|
||||
|
||||
// From CLI/Split.hpp:
|
||||
// From Split.hpp:
|
||||
|
||||
namespace CLI {
|
||||
namespace detail {
|
||||
@ -1953,7 +1970,7 @@ get_names(const std::vector<std::string> &input) {
|
||||
} // namespace detail
|
||||
} // namespace CLI
|
||||
|
||||
// From CLI/ConfigFwd.hpp:
|
||||
// From ConfigFwd.hpp:
|
||||
|
||||
namespace CLI {
|
||||
|
||||
@ -2070,7 +2087,7 @@ class ConfigTOML : public ConfigINI {
|
||||
};
|
||||
} // namespace CLI
|
||||
|
||||
// From CLI/Validators.hpp:
|
||||
// From Validators.hpp:
|
||||
|
||||
namespace CLI {
|
||||
|
||||
@ -2129,14 +2146,14 @@ class Validator {
|
||||
}
|
||||
}
|
||||
return retstring;
|
||||
};
|
||||
}
|
||||
|
||||
/// This is the required operator for a Validator - provided to help
|
||||
/// users (CLI11 uses the member `func` directly)
|
||||
std::string operator()(const std::string &str) const {
|
||||
std::string value = str;
|
||||
return (active_) ? func_(value) : std::string{};
|
||||
};
|
||||
}
|
||||
|
||||
/// Specify the type string
|
||||
Validator &description(std::string validator_desc) {
|
||||
@ -2190,13 +2207,13 @@ class Validator {
|
||||
Validator &application_index(int app_index) {
|
||||
application_index_ = app_index;
|
||||
return *this;
|
||||
};
|
||||
}
|
||||
/// Specify the application index of a validator
|
||||
Validator application_index(int app_index) const {
|
||||
Validator newval(*this);
|
||||
newval.application_index_ = app_index;
|
||||
return newval;
|
||||
};
|
||||
}
|
||||
/// Get the current value of the application index
|
||||
int get_application_index() const { return application_index_; }
|
||||
/// Get a boolean if the validator is active
|
||||
@ -2304,7 +2321,7 @@ class CustomValidator : public Validator {
|
||||
namespace detail {
|
||||
|
||||
/// CLI enumeration of different file types
|
||||
enum class path_type { nonexistant, file, directory };
|
||||
enum class path_type { nonexistent, file, directory };
|
||||
|
||||
#if defined CLI11_HAS_FILESYSTEM && CLI11_HAS_FILESYSTEM > 0
|
||||
/// get the type of the path from a file name
|
||||
@ -2312,12 +2329,12 @@ inline path_type check_path(const char *file) noexcept {
|
||||
std::error_code ec;
|
||||
auto stat = std::filesystem::status(file, ec);
|
||||
if(ec) {
|
||||
return path_type::nonexistant;
|
||||
return path_type::nonexistent;
|
||||
}
|
||||
switch(stat.type()) {
|
||||
case std::filesystem::file_type::none:
|
||||
case std::filesystem::file_type::not_found:
|
||||
return path_type::nonexistant;
|
||||
return path_type::nonexistent;
|
||||
case std::filesystem::file_type::directory:
|
||||
return path_type::directory;
|
||||
case std::filesystem::file_type::symlink:
|
||||
@ -2345,7 +2362,7 @@ inline path_type check_path(const char *file) noexcept {
|
||||
return ((buffer.st_mode & S_IFDIR) != 0) ? path_type::directory : path_type::file;
|
||||
}
|
||||
#endif
|
||||
return path_type::nonexistant;
|
||||
return path_type::nonexistent;
|
||||
}
|
||||
#endif
|
||||
/// Check for an existing file (returns error message if check fails)
|
||||
@ -2354,7 +2371,7 @@ class ExistingFileValidator : public Validator {
|
||||
ExistingFileValidator() : Validator("FILE") {
|
||||
func_ = [](std::string &filename) {
|
||||
auto path_result = check_path(filename.c_str());
|
||||
if(path_result == path_type::nonexistant) {
|
||||
if(path_result == path_type::nonexistent) {
|
||||
return "File does not exist: " + filename;
|
||||
}
|
||||
if(path_result == path_type::directory) {
|
||||
@ -2371,7 +2388,7 @@ class ExistingDirectoryValidator : public Validator {
|
||||
ExistingDirectoryValidator() : Validator("DIR") {
|
||||
func_ = [](std::string &filename) {
|
||||
auto path_result = check_path(filename.c_str());
|
||||
if(path_result == path_type::nonexistant) {
|
||||
if(path_result == path_type::nonexistent) {
|
||||
return "Directory does not exist: " + filename;
|
||||
}
|
||||
if(path_result == path_type::file) {
|
||||
@ -2388,7 +2405,7 @@ class ExistingPathValidator : public Validator {
|
||||
ExistingPathValidator() : Validator("PATH(existing)") {
|
||||
func_ = [](std::string &filename) {
|
||||
auto path_result = check_path(filename.c_str());
|
||||
if(path_result == path_type::nonexistant) {
|
||||
if(path_result == path_type::nonexistent) {
|
||||
return "Path does not exist: " + filename;
|
||||
}
|
||||
return std::string();
|
||||
@ -2402,7 +2419,7 @@ class NonexistentPathValidator : public Validator {
|
||||
NonexistentPathValidator() : Validator("PATH(non-existing)") {
|
||||
func_ = [](std::string &filename) {
|
||||
auto path_result = check_path(filename.c_str());
|
||||
if(path_result != path_type::nonexistant) {
|
||||
if(path_result != path_type::nonexistent) {
|
||||
return "Path already exists: " + filename;
|
||||
}
|
||||
return std::string();
|
||||
@ -2802,7 +2819,7 @@ class Transformer : public Validator {
|
||||
// if the type does not have first_type and second_type, these are both value_type
|
||||
using element_t = typename detail::element_type<T>::type; // Removes (smart) pointers if needed
|
||||
using item_t = typename detail::pair_adaptor<element_t>::first_type; // Is value_type if not a map
|
||||
using local_item_t = typename IsMemberType<item_t>::type; // This will convert bad types to good ones
|
||||
using local_item_t = typename IsMemberType<item_t>::type; // Will convert bad types to good ones
|
||||
// (const char * to std::string)
|
||||
|
||||
// Make a local copy of the filter function, using a std::function if not one already
|
||||
@ -2860,10 +2877,9 @@ class CheckedTransformer : public Validator {
|
||||
// if the type does not have first_type and second_type, these are both value_type
|
||||
using element_t = typename detail::element_type<T>::type; // Removes (smart) pointers if needed
|
||||
using item_t = typename detail::pair_adaptor<element_t>::first_type; // Is value_type if not a map
|
||||
using local_item_t = typename IsMemberType<item_t>::type; // This will convert bad types to good ones
|
||||
using local_item_t = typename IsMemberType<item_t>::type; // Will convert bad types to good ones
|
||||
// (const char * to std::string)
|
||||
using iteration_type_t = typename detail::pair_adaptor<element_t>::value_type; // the type of the object pair //
|
||||
// the type of the object pair
|
||||
using iteration_type_t = typename detail::pair_adaptor<element_t>::value_type; // the type of the object pair
|
||||
|
||||
// Make a local copy of the filter function, using a std::function if not one already
|
||||
std::function<local_item_t(local_item_t)> filter_fn = filter_function;
|
||||
@ -3071,7 +3087,7 @@ class AsNumberWithUnit : public Validator {
|
||||
/// "2 EiB" => 2^61 // Units up to exibyte are supported
|
||||
class AsSizeValue : public AsNumberWithUnit {
|
||||
public:
|
||||
using result_t = uint64_t;
|
||||
using result_t = std::uint64_t;
|
||||
|
||||
/// If kb_is_1000 is true,
|
||||
/// interpret 'kb', 'k' as 1000 and 'kib', 'ki' as 1024
|
||||
@ -3152,7 +3168,7 @@ inline std::pair<std::string, std::string> split_program_name(std::string comman
|
||||
|
||||
} // namespace CLI
|
||||
|
||||
// From CLI/FormatterFwd.hpp:
|
||||
// From FormatterFwd.hpp:
|
||||
|
||||
namespace CLI {
|
||||
|
||||
@ -3165,9 +3181,9 @@ class App;
|
||||
/// the second argument.
|
||||
|
||||
enum class AppFormatMode {
|
||||
Normal, //< The normal, detailed help
|
||||
All, //< A fully expanded help
|
||||
Sub, //< Used when printed as part of expanded subcommand
|
||||
Normal, ///< The normal, detailed help
|
||||
All, ///< A fully expanded help
|
||||
Sub, ///< Used when printed as part of expanded subcommand
|
||||
};
|
||||
|
||||
/// This is the minimum requirements to run a formatter.
|
||||
@ -3320,7 +3336,7 @@ class Formatter : public FormatterBase {
|
||||
|
||||
} // namespace CLI
|
||||
|
||||
// From CLI/Option.hpp:
|
||||
// From Option.hpp:
|
||||
|
||||
namespace CLI {
|
||||
|
||||
@ -3807,7 +3823,7 @@ class Option : public OptionBase<Option> {
|
||||
|
||||
/// Can find a string if needed
|
||||
template <typename T = App> Option *needs(std::string opt_name) {
|
||||
auto opt = dynamic_cast<T *>(parent_)->get_option_no_throw(opt_name);
|
||||
auto opt = static_cast<T *>(parent_)->get_option_no_throw(opt_name);
|
||||
if(opt == nullptr) {
|
||||
throw IncorrectConstruction::MissingOption(opt_name);
|
||||
}
|
||||
@ -3849,7 +3865,7 @@ class Option : public OptionBase<Option> {
|
||||
|
||||
/// Can find a string if needed
|
||||
template <typename T = App> Option *excludes(std::string opt_name) {
|
||||
auto opt = dynamic_cast<T *>(parent_)->get_option_no_throw(opt_name);
|
||||
auto opt = static_cast<T *>(parent_)->get_option_no_throw(opt_name);
|
||||
if(opt == nullptr) {
|
||||
throw IncorrectConstruction::MissingOption(opt_name);
|
||||
}
|
||||
@ -3886,7 +3902,7 @@ class Option : public OptionBase<Option> {
|
||||
template <typename T = App> Option *ignore_case(bool value = true) {
|
||||
if(!ignore_case_ && value) {
|
||||
ignore_case_ = value;
|
||||
auto *parent = dynamic_cast<T *>(parent_);
|
||||
auto *parent = static_cast<T *>(parent_);
|
||||
for(const Option_p &opt : parent->options_) {
|
||||
if(opt.get() == this) {
|
||||
continue;
|
||||
@ -3911,7 +3927,7 @@ class Option : public OptionBase<Option> {
|
||||
|
||||
if(!ignore_underscore_ && value) {
|
||||
ignore_underscore_ = value;
|
||||
auto *parent = dynamic_cast<T *>(parent_);
|
||||
auto *parent = static_cast<T *>(parent_);
|
||||
for(const Option_p &opt : parent->options_) {
|
||||
if(opt.get() == this) {
|
||||
continue;
|
||||
@ -4028,8 +4044,8 @@ class Option : public OptionBase<Option> {
|
||||
/// Will include / prefer the positional name if positional is true.
|
||||
/// If all_options is false, pick just the most descriptive name to show.
|
||||
/// Use `get_name(true)` to get the positional name (replaces `get_pname`)
|
||||
std::string get_name(bool positional = false, //<[input] Show the positional name
|
||||
bool all_options = false //<[input] Show every option
|
||||
std::string get_name(bool positional = false, ///< Show the positional name
|
||||
bool all_options = false ///< Show every option
|
||||
) const {
|
||||
if(get_group().empty())
|
||||
return {}; // Hidden
|
||||
@ -4575,7 +4591,7 @@ class Option : public OptionBase<Option> {
|
||||
|
||||
} // namespace CLI
|
||||
|
||||
// From CLI/App.hpp:
|
||||
// From App.hpp:
|
||||
|
||||
namespace CLI {
|
||||
|
||||
@ -5312,8 +5328,9 @@ class App {
|
||||
}
|
||||
|
||||
/// Vector version to capture multiple flags.
|
||||
template <typename T,
|
||||
enable_if_t<!std::is_assignable<std::function<void(int64_t)>, T>::value, detail::enabler> = detail::dummy>
|
||||
template <
|
||||
typename T,
|
||||
enable_if_t<!std::is_assignable<std::function<void(std::int64_t)>, T>::value, detail::enabler> = detail::dummy>
|
||||
Option *add_flag(std::string flag_name,
|
||||
std::vector<T> &flag_results, ///< A vector of values with the flag results
|
||||
std::string flag_description = "") {
|
||||
@ -5348,11 +5365,11 @@ class App {
|
||||
|
||||
/// Add option for callback with an integer value
|
||||
Option *add_flag_function(std::string flag_name,
|
||||
std::function<void(int64_t)> function, ///< A function to call, void(int)
|
||||
std::function<void(std::int64_t)> function, ///< A function to call, void(int)
|
||||
std::string flag_description = "") {
|
||||
|
||||
CLI::callback_t fun = [function](const CLI::results_t &res) {
|
||||
int64_t flag_count = 0;
|
||||
std::int64_t flag_count = 0;
|
||||
detail::sum_flag_vector(res, flag_count);
|
||||
function(flag_count);
|
||||
return true;
|
||||
@ -5364,7 +5381,7 @@ class App {
|
||||
#ifdef CLI11_CPP14
|
||||
/// Add option for callback (C++14 or better only)
|
||||
Option *add_flag(std::string flag_name,
|
||||
std::function<void(int64_t)> function, ///< A function to call, void(int64_t)
|
||||
std::function<void(std::int64_t)> function, ///< A function to call, void(std::int64_t)
|
||||
std::string flag_description = "") {
|
||||
return add_flag_function(std::move(flag_name), std::move(function), std::move(flag_description));
|
||||
}
|
||||
@ -5522,7 +5539,7 @@ class App {
|
||||
/// creates an option group as part of the given app
|
||||
template <typename T = Option_group>
|
||||
T *add_option_group(std::string group_name, std::string group_description = "") {
|
||||
auto option_group = std::make_shared<T>(std::move(group_description), group_name, nullptr);
|
||||
auto option_group = std::make_shared<T>(std::move(group_description), group_name, this);
|
||||
auto ptr = option_group.get();
|
||||
// move to App_p for overload resolution on older gcc versions
|
||||
App_p app_ptr = std::dynamic_pointer_cast<App>(option_group);
|
||||
@ -5531,7 +5548,7 @@ class App {
|
||||
}
|
||||
|
||||
///@}
|
||||
/// @name Subcommmands
|
||||
/// @name Subcommands
|
||||
///@{
|
||||
|
||||
/// Add a subcommand. Inherits INHERITABLE and OptionDefaults, and help flag
|
||||
@ -5793,8 +5810,9 @@ class App {
|
||||
name_ = nstr.first;
|
||||
}
|
||||
commandline = std::move(nstr.second);
|
||||
} else
|
||||
} else {
|
||||
detail::trim(commandline);
|
||||
}
|
||||
// the next section of code is to deal with quoted arguments after an '=' or ':' for windows like operations
|
||||
if(!commandline.empty()) {
|
||||
commandline = detail::find_and_modify(commandline, "=", detail::escape_detect);
|
||||
@ -5860,15 +5878,15 @@ class App {
|
||||
int exit(const Error &e, std::ostream &out = std::cout, std::ostream &err = std::cerr) const {
|
||||
|
||||
/// Avoid printing anything if this is a CLI::RuntimeError
|
||||
if(dynamic_cast<const CLI::RuntimeError *>(&e) != nullptr)
|
||||
if(e.get_name() == "RuntimeError")
|
||||
return e.get_exit_code();
|
||||
|
||||
if(dynamic_cast<const CLI::CallForHelp *>(&e) != nullptr) {
|
||||
if(e.get_name() == "CallForHelp") {
|
||||
out << help();
|
||||
return e.get_exit_code();
|
||||
}
|
||||
|
||||
if(dynamic_cast<const CLI::CallForAllHelp *>(&e) != nullptr) {
|
||||
if(e.get_name() == "CallForAllHelp") {
|
||||
out << help("", AppFormatMode::All);
|
||||
return e.get_exit_code();
|
||||
}
|
||||
@ -6070,7 +6088,12 @@ class App {
|
||||
|
||||
/// Access the config formatter as a configBase pointer
|
||||
std::shared_ptr<ConfigBase> get_config_formatter_base() const {
|
||||
// This is safer as a dynamic_cast if we have RTTI, as Config -> ConfigBase
|
||||
#if defined(__cpp_rtti) || (defined(__GXX_RTTI) && __GXX_RTTI) || (defined(_HAS_STATIC_RTTI) && (_HAS_STATIC_RTTI == 0))
|
||||
return std::dynamic_pointer_cast<ConfigBase>(config_formatter_);
|
||||
#else
|
||||
return std::static_pointer_cast<ConfigBase>(config_formatter_);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// Get the app or subcommand description
|
||||
@ -7601,7 +7624,18 @@ inline std::string help(const App *app, const Error &e) {
|
||||
namespace detail {
|
||||
/// This class is simply to allow tests access to App's protected functions
|
||||
struct AppFriend {
|
||||
#ifdef CLI11_CPP14
|
||||
|
||||
/// Wrap _parse_short, perfectly forward arguments and return
|
||||
template <typename... Args> static decltype(auto) parse_arg(App *app, Args &&... args) {
|
||||
return app->_parse_arg(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
/// Wrap _parse_subcommand, perfectly forward arguments and return
|
||||
template <typename... Args> static decltype(auto) parse_subcommand(App *app, Args &&... args) {
|
||||
return app->_parse_subcommand(std::forward<Args>(args)...);
|
||||
}
|
||||
#else
|
||||
/// Wrap _parse_short, perfectly forward arguments and return
|
||||
template <typename... Args>
|
||||
static auto parse_arg(App *app, Args &&... args) ->
|
||||
@ -7615,6 +7649,7 @@ struct AppFriend {
|
||||
typename std::result_of<decltype (&App::_parse_subcommand)(App, Args...)>::type {
|
||||
return app->_parse_subcommand(std::forward<Args>(args)...);
|
||||
}
|
||||
#endif
|
||||
/// Wrap the fallthrough parent function to make sure that is working correctly
|
||||
static App *get_fallthrough_parent(App *app) { return app->_get_fallthrough_parent(); }
|
||||
};
|
||||
@ -7622,7 +7657,7 @@ struct AppFriend {
|
||||
|
||||
} // namespace CLI
|
||||
|
||||
// From CLI/Config.hpp:
|
||||
// From Config.hpp:
|
||||
|
||||
namespace CLI {
|
||||
|
||||
@ -7952,7 +7987,7 @@ ConfigBase::to_config(const App *app, bool default_also, bool write_description,
|
||||
|
||||
} // namespace CLI
|
||||
|
||||
// From CLI/Formatter.hpp:
|
||||
// From Formatter.hpp:
|
||||
|
||||
namespace CLI {
|
||||
|
||||
|
2
external/elfio
vendored
2
external/elfio
vendored
@ -1 +1 @@
|
||||
Subproject commit 580da2467b3d7da4c817d45a99a367e4b0d6d326
|
||||
Subproject commit 1c91bc2bc506ffdb959d045dc45f571980757710
|
2
external/glad/include/KHR/khrplatform.h
vendored
2
external/glad/include/KHR/khrplatform.h
vendored
@ -119,7 +119,7 @@
|
||||
* This follows the return type of the function and precedes the function
|
||||
* name in the function prototype.
|
||||
*/
|
||||
#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(KHRONOS_STATIC)
|
||||
#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
|
||||
/* Win32 but not WinCE */
|
||||
# define KHRONOS_APIENTRY __stdcall
|
||||
#else
|
||||
|
28
external/glad/include/glad/glad.h
vendored
28
external/glad/include/glad/glad.h
vendored
@ -1,6 +1,6 @@
|
||||
/*
|
||||
|
||||
OpenGL loader generated by glad 0.1.31 on Sun Jul 28 01:55:08 2019.
|
||||
OpenGL loader generated by glad 0.1.34 on Sun Oct 4 19:21:34 2020.
|
||||
|
||||
Language/Generator: C/C++ Debug
|
||||
Specification: gl
|
||||
@ -1487,6 +1487,18 @@ typedef void (APIENTRY *GLVULKANPROCNV)(void);
|
||||
#define GL_LOSE_CONTEXT_ON_RESET 0x8252
|
||||
#define GL_NO_RESET_NOTIFICATION 0x8261
|
||||
#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT 0x00000004
|
||||
#define GL_COLOR_TABLE 0x80D0
|
||||
#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1
|
||||
#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2
|
||||
#define GL_PROXY_COLOR_TABLE 0x80D3
|
||||
#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4
|
||||
#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5
|
||||
#define GL_CONVOLUTION_1D 0x8010
|
||||
#define GL_CONVOLUTION_2D 0x8011
|
||||
#define GL_SEPARABLE_2D 0x8012
|
||||
#define GL_HISTOGRAM 0x8024
|
||||
#define GL_PROXY_HISTOGRAM 0x8025
|
||||
#define GL_MINMAX 0x802E
|
||||
#define GL_CONTEXT_RELEASE_BEHAVIOR 0x82FB
|
||||
#define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH 0x82FC
|
||||
#ifndef GL_VERSION_1_0
|
||||
@ -2764,7 +2776,7 @@ typedef void (APIENTRYP PFNGLGETINTEGER64VPROC)(GLenum pname, GLint64 *data);
|
||||
GLAPI PFNGLGETINTEGER64VPROC glad_glGetInteger64v;
|
||||
GLAPI PFNGLGETINTEGER64VPROC glad_debug_glGetInteger64v;
|
||||
#define glGetInteger64v glad_debug_glGetInteger64v
|
||||
typedef void (APIENTRYP PFNGLGETSYNCIVPROC)(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
|
||||
typedef void (APIENTRYP PFNGLGETSYNCIVPROC)(GLsync sync, GLenum pname, GLsizei count, GLsizei *length, GLint *values);
|
||||
GLAPI PFNGLGETSYNCIVPROC glad_glGetSynciv;
|
||||
GLAPI PFNGLGETSYNCIVPROC glad_debug_glGetSynciv;
|
||||
#define glGetSynciv glad_debug_glGetSynciv
|
||||
@ -3148,11 +3160,11 @@ typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC)(GLuint program, G
|
||||
GLAPI PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC glad_glGetActiveSubroutineUniformiv;
|
||||
GLAPI PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC glad_debug_glGetActiveSubroutineUniformiv;
|
||||
#define glGetActiveSubroutineUniformiv glad_debug_glGetActiveSubroutineUniformiv
|
||||
typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC)(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
|
||||
typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC)(GLuint program, GLenum shadertype, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);
|
||||
GLAPI PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC glad_glGetActiveSubroutineUniformName;
|
||||
GLAPI PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC glad_debug_glGetActiveSubroutineUniformName;
|
||||
#define glGetActiveSubroutineUniformName glad_debug_glGetActiveSubroutineUniformName
|
||||
typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINENAMEPROC)(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
|
||||
typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINENAMEPROC)(GLuint program, GLenum shadertype, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);
|
||||
GLAPI PFNGLGETACTIVESUBROUTINENAMEPROC glad_glGetActiveSubroutineName;
|
||||
GLAPI PFNGLGETACTIVESUBROUTINENAMEPROC glad_debug_glGetActiveSubroutineName;
|
||||
#define glGetActiveSubroutineName glad_debug_glGetActiveSubroutineName
|
||||
@ -3228,7 +3240,7 @@ typedef void (APIENTRYP PFNGLRELEASESHADERCOMPILERPROC)(void);
|
||||
GLAPI PFNGLRELEASESHADERCOMPILERPROC glad_glReleaseShaderCompiler;
|
||||
GLAPI PFNGLRELEASESHADERCOMPILERPROC glad_debug_glReleaseShaderCompiler;
|
||||
#define glReleaseShaderCompiler glad_debug_glReleaseShaderCompiler
|
||||
typedef void (APIENTRYP PFNGLSHADERBINARYPROC)(GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
|
||||
typedef void (APIENTRYP PFNGLSHADERBINARYPROC)(GLsizei count, const GLuint *shaders, GLenum binaryFormat, const void *binary, GLsizei length);
|
||||
GLAPI PFNGLSHADERBINARYPROC glad_glShaderBinary;
|
||||
GLAPI PFNGLSHADERBINARYPROC glad_debug_glShaderBinary;
|
||||
#define glShaderBinary glad_debug_glShaderBinary
|
||||
@ -3592,7 +3604,7 @@ typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC)(GL
|
||||
GLAPI PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC glad_glDrawElementsInstancedBaseVertexBaseInstance;
|
||||
GLAPI PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC glad_debug_glDrawElementsInstancedBaseVertexBaseInstance;
|
||||
#define glDrawElementsInstancedBaseVertexBaseInstance glad_debug_glDrawElementsInstancedBaseVertexBaseInstance
|
||||
typedef void (APIENTRYP PFNGLGETINTERNALFORMATIVPROC)(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);
|
||||
typedef void (APIENTRYP PFNGLGETINTERNALFORMATIVPROC)(GLenum target, GLenum internalformat, GLenum pname, GLsizei count, GLint *params);
|
||||
GLAPI PFNGLGETINTERNALFORMATIVPROC glad_glGetInternalformativ;
|
||||
GLAPI PFNGLGETINTERNALFORMATIVPROC glad_debug_glGetInternalformativ;
|
||||
#define glGetInternalformativ glad_debug_glGetInternalformativ
|
||||
@ -3660,7 +3672,7 @@ typedef void (APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVPROC)(GLenum target, GLenu
|
||||
GLAPI PFNGLGETFRAMEBUFFERPARAMETERIVPROC glad_glGetFramebufferParameteriv;
|
||||
GLAPI PFNGLGETFRAMEBUFFERPARAMETERIVPROC glad_debug_glGetFramebufferParameteriv;
|
||||
#define glGetFramebufferParameteriv glad_debug_glGetFramebufferParameteriv
|
||||
typedef void (APIENTRYP PFNGLGETINTERNALFORMATI64VPROC)(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params);
|
||||
typedef void (APIENTRYP PFNGLGETINTERNALFORMATI64VPROC)(GLenum target, GLenum internalformat, GLenum pname, GLsizei count, GLint64 *params);
|
||||
GLAPI PFNGLGETINTERNALFORMATI64VPROC glad_glGetInternalformati64v;
|
||||
GLAPI PFNGLGETINTERNALFORMATI64VPROC glad_debug_glGetInternalformati64v;
|
||||
#define glGetInternalformati64v glad_debug_glGetInternalformati64v
|
||||
@ -3708,7 +3720,7 @@ typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCENAMEPROC)(GLuint program, GLenum
|
||||
GLAPI PFNGLGETPROGRAMRESOURCENAMEPROC glad_glGetProgramResourceName;
|
||||
GLAPI PFNGLGETPROGRAMRESOURCENAMEPROC glad_debug_glGetProgramResourceName;
|
||||
#define glGetProgramResourceName glad_debug_glGetProgramResourceName
|
||||
typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCEIVPROC)(GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCEIVPROC)(GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei count, GLsizei *length, GLint *params);
|
||||
GLAPI PFNGLGETPROGRAMRESOURCEIVPROC glad_glGetProgramResourceiv;
|
||||
GLAPI PFNGLGETPROGRAMRESOURCEIVPROC glad_debug_glGetProgramResourceiv;
|
||||
#define glGetProgramResourceiv glad_debug_glGetProgramResourceiv
|
||||
|
5
external/glad/src/glad.c
vendored
5
external/glad/src/glad.c
vendored
@ -1,6 +1,6 @@
|
||||
/*
|
||||
|
||||
OpenGL loader generated by glad 0.1.31 on Sun Jul 28 01:55:08 2019.
|
||||
OpenGL loader generated by glad 0.1.34 on Sun Oct 4 19:21:34 2020.
|
||||
|
||||
Language/Generator: C/C++ Debug
|
||||
Specification: gl
|
||||
@ -59,6 +59,9 @@ void glad_set_post_callback(GLADcallback cb) {
|
||||
static void* get_proc(const char *namez);
|
||||
|
||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||
#ifndef _WINDOWS_
|
||||
#undef APIENTRY
|
||||
#endif
|
||||
#include <windows.h>
|
||||
static HMODULE libGL;
|
||||
|
||||
|
2
external/googletest
vendored
2
external/googletest
vendored
@ -1 +1 @@
|
||||
Subproject commit 2fe3bd994b3189899d93f1d5a881e725e046fdc2
|
||||
Subproject commit 703bd9caab50b139428cea1aaff9974ebee5742e
|
2
external/imgui
vendored
2
external/imgui
vendored
@ -1 +1 @@
|
||||
Subproject commit 5503c0a12e0c929e84b3f61b2cb4bb9177ea3da1
|
||||
Subproject commit 58075c4414b985b352d10718b02a8c43f25efd7c
|
2
external/imgui_club
vendored
2
external/imgui_club
vendored
@ -1 +1 @@
|
||||
Subproject commit 50b79d1609c496b67c199aa79de4f7c590d5a5d7
|
||||
Subproject commit 60275e79c3e0b0568ee1e41486233e958eac2e80
|
147
external/miniz/miniz.c
vendored
147
external/miniz/miniz.c
vendored
@ -397,6 +397,32 @@ int mz_inflateInit(mz_streamp pStream)
|
||||
return mz_inflateInit2(pStream, MZ_DEFAULT_WINDOW_BITS);
|
||||
}
|
||||
|
||||
int mz_inflateReset(mz_streamp pStream)
|
||||
{
|
||||
inflate_state *pDecomp;
|
||||
if (!pStream)
|
||||
return MZ_STREAM_ERROR;
|
||||
|
||||
pStream->data_type = 0;
|
||||
pStream->adler = 0;
|
||||
pStream->msg = NULL;
|
||||
pStream->total_in = 0;
|
||||
pStream->total_out = 0;
|
||||
pStream->reserved = 0;
|
||||
|
||||
pDecomp = (inflate_state *)pStream->state;
|
||||
|
||||
tinfl_init(&pDecomp->m_decomp);
|
||||
pDecomp->m_dict_ofs = 0;
|
||||
pDecomp->m_dict_avail = 0;
|
||||
pDecomp->m_last_status = TINFL_STATUS_NEEDS_MORE_INPUT;
|
||||
pDecomp->m_first_call = 1;
|
||||
pDecomp->m_has_flushed = 0;
|
||||
/* pDecomp->m_window_bits = window_bits */;
|
||||
|
||||
return MZ_OK;
|
||||
}
|
||||
|
||||
int mz_inflate(mz_streamp pStream, int flush)
|
||||
{
|
||||
inflate_state *pState;
|
||||
@ -1340,13 +1366,13 @@ static int tdefl_flush_block(tdefl_compressor *d, int flush)
|
||||
|
||||
#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES
|
||||
#ifdef MINIZ_UNALIGNED_USE_MEMCPY
|
||||
static inline mz_uint16 TDEFL_READ_UNALIGNED_WORD(const mz_uint8* p)
|
||||
static mz_uint16 TDEFL_READ_UNALIGNED_WORD(const mz_uint8* p)
|
||||
{
|
||||
mz_uint16 ret;
|
||||
memcpy(&ret, p, sizeof(mz_uint16));
|
||||
return ret;
|
||||
}
|
||||
static inline mz_uint16 TDEFL_READ_UNALIGNED_WORD2(const mz_uint16* p)
|
||||
static mz_uint16 TDEFL_READ_UNALIGNED_WORD2(const mz_uint16* p)
|
||||
{
|
||||
mz_uint16 ret;
|
||||
memcpy(&ret, p, sizeof(mz_uint16));
|
||||
@ -1455,6 +1481,16 @@ static MZ_FORCEINLINE void tdefl_find_match(tdefl_compressor *d, mz_uint lookahe
|
||||
#endif /* #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES */
|
||||
|
||||
#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN
|
||||
#ifdef MINIZ_UNALIGNED_USE_MEMCPY
|
||||
static mz_uint32 TDEFL_READ_UNALIGNED_WORD32(const mz_uint8* p)
|
||||
{
|
||||
mz_uint32 ret;
|
||||
memcpy(&ret, p, sizeof(mz_uint32));
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
#define TDEFL_READ_UNALIGNED_WORD32(p) *(const mz_uint32 *)(p)
|
||||
#endif
|
||||
static mz_bool tdefl_compress_fast(tdefl_compressor *d)
|
||||
{
|
||||
/* Faster, minimally featured LZRW1-style match+parse loop with better register utilization. Intended for applications where raw throughput is valued more highly than ratio. */
|
||||
@ -1489,12 +1525,12 @@ static mz_bool tdefl_compress_fast(tdefl_compressor *d)
|
||||
{
|
||||
mz_uint cur_match_dist, cur_match_len = 1;
|
||||
mz_uint8 *pCur_dict = d->m_dict + cur_pos;
|
||||
mz_uint first_trigram = (*(const mz_uint32 *)pCur_dict) & 0xFFFFFF;
|
||||
mz_uint first_trigram = TDEFL_READ_UNALIGNED_WORD32(pCur_dict) & 0xFFFFFF;
|
||||
mz_uint hash = (first_trigram ^ (first_trigram >> (24 - (TDEFL_LZ_HASH_BITS - 8)))) & TDEFL_LEVEL1_HASH_SIZE_MASK;
|
||||
mz_uint probe_pos = d->m_hash[hash];
|
||||
d->m_hash[hash] = (mz_uint16)lookahead_pos;
|
||||
|
||||
if (((cur_match_dist = (mz_uint16)(lookahead_pos - probe_pos)) <= dict_size) && ((*(const mz_uint32 *)(d->m_dict + (probe_pos &= TDEFL_LZ_DICT_SIZE_MASK)) & 0xFFFFFF) == first_trigram))
|
||||
if (((cur_match_dist = (mz_uint16)(lookahead_pos - probe_pos)) <= dict_size) && ((TDEFL_READ_UNALIGNED_WORD32(d->m_dict + (probe_pos &= TDEFL_LZ_DICT_SIZE_MASK)) & 0xFFFFFF) == first_trigram))
|
||||
{
|
||||
const mz_uint16 *p = (const mz_uint16 *)pCur_dict;
|
||||
const mz_uint16 *q = (const mz_uint16 *)(d->m_dict + probe_pos);
|
||||
@ -1524,7 +1560,11 @@ static mz_bool tdefl_compress_fast(tdefl_compressor *d)
|
||||
cur_match_dist--;
|
||||
|
||||
pLZ_code_buf[0] = (mz_uint8)(cur_match_len - TDEFL_MIN_MATCH_LEN);
|
||||
#ifdef MINIZ_UNALIGNED_USE_MEMCPY
|
||||
memcpy(&pLZ_code_buf[1], &cur_match_dist, sizeof(cur_match_dist));
|
||||
#else
|
||||
*(mz_uint16 *)(&pLZ_code_buf[1]) = (mz_uint16)cur_match_dist;
|
||||
#endif
|
||||
pLZ_code_buf += 3;
|
||||
*pLZ_flags = (mz_uint8)((*pLZ_flags >> 1) | 0x80);
|
||||
|
||||
@ -2143,6 +2183,7 @@ void *tdefl_write_image_to_png_file_in_memory(const void *pImage, int w, int h,
|
||||
return tdefl_write_image_to_png_file_in_memory_ex(pImage, w, h, num_chans, pLen_out, 6, MZ_FALSE);
|
||||
}
|
||||
|
||||
#ifndef MINIZ_NO_MALLOC
|
||||
/* Allocate the tdefl_compressor and tinfl_decompressor structures in C so that */
|
||||
/* non-C language bindings to tdefL_ and tinfl_ API don't need to worry about */
|
||||
/* structure size and allocation mechanism. */
|
||||
@ -2155,6 +2196,7 @@ void tdefl_compressor_free(tdefl_compressor *pComp)
|
||||
{
|
||||
MZ_FREE(pComp);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
@ -2688,8 +2730,12 @@ tinfl_status tinfl_decompress(tinfl_decompressor *r, const mz_uint8 *pIn_buf_nex
|
||||
const mz_uint8 *pSrc_end = pSrc + (counter & ~7);
|
||||
do
|
||||
{
|
||||
#ifdef MINIZ_UNALIGNED_USE_MEMCPY
|
||||
memcpy(pOut_buf_cur, pSrc, sizeof(mz_uint32)*2);
|
||||
#else
|
||||
((mz_uint32 *)pOut_buf_cur)[0] = ((const mz_uint32 *)pSrc)[0];
|
||||
((mz_uint32 *)pOut_buf_cur)[1] = ((const mz_uint32 *)pSrc)[1];
|
||||
#endif
|
||||
pOut_buf_cur += 8;
|
||||
} while ((pSrc += 8) < pSrc_end);
|
||||
if ((counter &= 7) < 3)
|
||||
@ -2881,6 +2927,7 @@ int tinfl_decompress_mem_to_callback(const void *pIn_buf, size_t *pIn_buf_size,
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifndef MINIZ_NO_MALLOC
|
||||
tinfl_decompressor *tinfl_decompressor_alloc()
|
||||
{
|
||||
tinfl_decompressor *pDecomp = (tinfl_decompressor *)MZ_MALLOC(sizeof(tinfl_decompressor));
|
||||
@ -2893,6 +2940,7 @@ void tinfl_decompressor_free(tinfl_decompressor *pDecomp)
|
||||
{
|
||||
MZ_FREE(pDecomp);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
@ -2961,8 +3009,8 @@ static FILE *mz_freopen(const char *pPath, const char *pMode, FILE *pStream)
|
||||
#define MZ_FWRITE fwrite
|
||||
#define MZ_FTELL64 _ftelli64
|
||||
#define MZ_FSEEK64 _fseeki64
|
||||
#define MZ_FILE_STAT_STRUCT _stat
|
||||
#define MZ_FILE_STAT _stat
|
||||
#define MZ_FILE_STAT_STRUCT _stat64
|
||||
#define MZ_FILE_STAT _stat64
|
||||
#define MZ_FFLUSH fflush
|
||||
#define MZ_FREOPEN mz_freopen
|
||||
#define MZ_DELETE_FILE remove
|
||||
@ -2996,7 +3044,7 @@ static FILE *mz_freopen(const char *pPath, const char *pMode, FILE *pStream)
|
||||
#define MZ_FFLUSH fflush
|
||||
#define MZ_FREOPEN(f, m, s) freopen(f, m, s)
|
||||
#define MZ_DELETE_FILE remove
|
||||
#elif defined(__GNUC__) && _LARGEFILE64_SOURCE
|
||||
#elif defined(__GNUC__) && defined(_LARGEFILE64_SOURCE)
|
||||
#ifndef MINIZ_NO_TIME
|
||||
#include <utime.h>
|
||||
#endif
|
||||
@ -3250,6 +3298,7 @@ static MZ_FORCEINLINE mz_bool mz_zip_array_push_back(mz_zip_archive *pZip, mz_zi
|
||||
size_t orig_size = pArray->m_size;
|
||||
if (!mz_zip_array_resize(pZip, pArray, orig_size + n, MZ_TRUE))
|
||||
return MZ_FALSE;
|
||||
if (n > 0)
|
||||
memcpy((mz_uint8 *)pArray->m_p + orig_size * pArray->m_element_size, pElements, n * pArray->m_element_size);
|
||||
return MZ_TRUE;
|
||||
}
|
||||
@ -3647,7 +3696,27 @@ static mz_bool mz_zip_reader_read_central_dir(mz_zip_archive *pZip, mz_uint flag
|
||||
|
||||
if (extra_size_remaining)
|
||||
{
|
||||
const mz_uint8 *pExtra_data = p + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + filename_size;
|
||||
const mz_uint8 *pExtra_data;
|
||||
void* buf = NULL;
|
||||
|
||||
if (MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + filename_size + ext_data_size > n)
|
||||
{
|
||||
buf = MZ_MALLOC(ext_data_size);
|
||||
if(buf==NULL)
|
||||
return mz_zip_set_error(pZip, MZ_ZIP_ALLOC_FAILED);
|
||||
|
||||
if (pZip->m_pRead(pZip->m_pIO_opaque, cdir_ofs + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + filename_size, buf, ext_data_size) != ext_data_size)
|
||||
{
|
||||
MZ_FREE(buf);
|
||||
return mz_zip_set_error(pZip, MZ_ZIP_FILE_READ_FAILED);
|
||||
}
|
||||
|
||||
pExtra_data = (mz_uint8*)buf;
|
||||
}
|
||||
else
|
||||
{
|
||||
pExtra_data = p + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + filename_size;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
@ -3655,13 +3724,19 @@ static mz_bool mz_zip_reader_read_central_dir(mz_zip_archive *pZip, mz_uint flag
|
||||
mz_uint32 field_data_size;
|
||||
|
||||
if (extra_size_remaining < (sizeof(mz_uint16) * 2))
|
||||
{
|
||||
MZ_FREE(buf);
|
||||
return mz_zip_set_error(pZip, MZ_ZIP_INVALID_HEADER_OR_CORRUPTED);
|
||||
}
|
||||
|
||||
field_id = MZ_READ_LE16(pExtra_data);
|
||||
field_data_size = MZ_READ_LE16(pExtra_data + sizeof(mz_uint16));
|
||||
|
||||
if ((field_data_size + sizeof(mz_uint16) * 2) > extra_size_remaining)
|
||||
{
|
||||
MZ_FREE(buf);
|
||||
return mz_zip_set_error(pZip, MZ_ZIP_INVALID_HEADER_OR_CORRUPTED);
|
||||
}
|
||||
|
||||
if (field_id == MZ_ZIP64_EXTENDED_INFORMATION_FIELD_HEADER_ID)
|
||||
{
|
||||
@ -3674,6 +3749,8 @@ static mz_bool mz_zip_reader_read_central_dir(mz_zip_archive *pZip, mz_uint flag
|
||||
pExtra_data += sizeof(mz_uint16) * 2 + field_data_size;
|
||||
extra_size_remaining = extra_size_remaining - sizeof(mz_uint16) * 2 - field_data_size;
|
||||
} while (extra_size_remaining);
|
||||
|
||||
MZ_FREE(buf);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4870,7 +4947,7 @@ size_t mz_zip_reader_extract_iter_read(mz_zip_reader_extract_iter_state* pState,
|
||||
if ((pState->flags & MZ_ZIP_FLAG_COMPRESSED_DATA) || (!pState->file_stat.m_method))
|
||||
{
|
||||
/* The file is stored or the caller has requested the compressed data, calc amount to return. */
|
||||
copied_to_caller = MZ_MIN( buf_size, pState->comp_remaining );
|
||||
copied_to_caller = (size_t)MZ_MIN( buf_size, pState->comp_remaining );
|
||||
|
||||
/* Zip is in memory....or requires reading from a file? */
|
||||
if (pState->pZip->m_pState->m_pMem)
|
||||
@ -5947,7 +6024,7 @@ static mz_bool mz_zip_writer_add_to_central_dir(mz_zip_archive *pZip, const char
|
||||
if (((mz_uint64)pState->m_central_dir.m_size + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + filename_size + extra_size + user_extra_data_len + comment_size) >= MZ_UINT32_MAX)
|
||||
return mz_zip_set_error(pZip, MZ_ZIP_UNSUPPORTED_CDIR_SIZE);
|
||||
|
||||
if (!mz_zip_writer_create_central_dir_header(pZip, central_dir_header, filename_size, extra_size + user_extra_data_len, comment_size, uncomp_size, comp_size, uncomp_crc32, method, bit_flags, dos_time, dos_date, local_header_ofs, ext_attributes))
|
||||
if (!mz_zip_writer_create_central_dir_header(pZip, central_dir_header, filename_size, (mz_uint16)(extra_size + user_extra_data_len), comment_size, uncomp_size, comp_size, uncomp_crc32, method, bit_flags, dos_time, dos_date, local_header_ofs, ext_attributes))
|
||||
return mz_zip_set_error(pZip, MZ_ZIP_INTERNAL_ERROR);
|
||||
|
||||
if ((!mz_zip_array_push_back(pZip, &pState->m_central_dir, central_dir_header, MZ_ZIP_CENTRAL_DIR_HEADER_SIZE)) ||
|
||||
@ -5971,13 +6048,7 @@ static mz_bool mz_zip_writer_validate_archive_name(const char *pArchive_name)
|
||||
if (*pArchive_name == '/')
|
||||
return MZ_FALSE;
|
||||
|
||||
while (*pArchive_name)
|
||||
{
|
||||
if ((*pArchive_name == '\\') || (*pArchive_name == ':'))
|
||||
return MZ_FALSE;
|
||||
|
||||
pArchive_name++;
|
||||
}
|
||||
/* Making sure the name does not contain drive letters or DOS style backward slashes is the responsibility of the program using miniz*/
|
||||
|
||||
return MZ_TRUE;
|
||||
}
|
||||
@ -6168,7 +6239,7 @@ mz_bool mz_zip_writer_add_mem_ex_v2(mz_zip_archive *pZip, const char *pArchive_n
|
||||
(uncomp_size >= MZ_UINT32_MAX) ? &comp_size : NULL, (local_dir_header_ofs >= MZ_UINT32_MAX) ? &local_dir_header_ofs : NULL);
|
||||
}
|
||||
|
||||
if (!mz_zip_writer_create_local_dir_header(pZip, local_dir_header, (mz_uint16)archive_name_size, extra_size + user_extra_data_len, 0, 0, 0, method, bit_flags, dos_time, dos_date))
|
||||
if (!mz_zip_writer_create_local_dir_header(pZip, local_dir_header, (mz_uint16)archive_name_size, (mz_uint16)(extra_size + user_extra_data_len), 0, 0, 0, method, bit_flags, dos_time, dos_date))
|
||||
return mz_zip_set_error(pZip, MZ_ZIP_INTERNAL_ERROR);
|
||||
|
||||
if (pZip->m_pWrite(pZip->m_pIO_opaque, local_dir_header_ofs, local_dir_header, sizeof(local_dir_header)) != sizeof(local_dir_header))
|
||||
@ -6195,7 +6266,7 @@ mz_bool mz_zip_writer_add_mem_ex_v2(mz_zip_archive *pZip, const char *pArchive_n
|
||||
{
|
||||
if ((comp_size > MZ_UINT32_MAX) || (cur_archive_file_ofs > MZ_UINT32_MAX))
|
||||
return mz_zip_set_error(pZip, MZ_ZIP_ARCHIVE_TOO_LARGE);
|
||||
if (!mz_zip_writer_create_local_dir_header(pZip, local_dir_header, (mz_uint16)archive_name_size, user_extra_data_len, 0, 0, 0, method, bit_flags, dos_time, dos_date))
|
||||
if (!mz_zip_writer_create_local_dir_header(pZip, local_dir_header, (mz_uint16)archive_name_size, (mz_uint16)user_extra_data_len, 0, 0, 0, method, bit_flags, dos_time, dos_date))
|
||||
return mz_zip_set_error(pZip, MZ_ZIP_INTERNAL_ERROR);
|
||||
|
||||
if (pZip->m_pWrite(pZip->m_pIO_opaque, local_dir_header_ofs, local_dir_header, sizeof(local_dir_header)) != sizeof(local_dir_header))
|
||||
@ -6288,7 +6359,7 @@ mz_bool mz_zip_writer_add_mem_ex_v2(mz_zip_archive *pZip, const char *pArchive_n
|
||||
(uncomp_size >= MZ_UINT32_MAX) ? &comp_size : NULL, (local_dir_header_ofs >= MZ_UINT32_MAX) ? &local_dir_header_ofs : NULL);
|
||||
}
|
||||
|
||||
if (!mz_zip_writer_add_to_central_dir(pZip, pArchive_name, (mz_uint16)archive_name_size, pExtra_data, extra_size, pComment,
|
||||
if (!mz_zip_writer_add_to_central_dir(pZip, pArchive_name, (mz_uint16)archive_name_size, pExtra_data, (mz_uint16)extra_size, pComment,
|
||||
comment_size, uncomp_size, comp_size, uncomp_crc32, method, bit_flags, dos_time, dos_date, local_dir_header_ofs, ext_attributes,
|
||||
user_extra_data_central, user_extra_data_central_len))
|
||||
return MZ_FALSE;
|
||||
@ -6299,8 +6370,7 @@ mz_bool mz_zip_writer_add_mem_ex_v2(mz_zip_archive *pZip, const char *pArchive_n
|
||||
return MZ_TRUE;
|
||||
}
|
||||
|
||||
#ifndef MINIZ_NO_STDIO
|
||||
mz_bool mz_zip_writer_add_cfile(mz_zip_archive *pZip, const char *pArchive_name, MZ_FILE *pSrc_file, mz_uint64 size_to_add, const MZ_TIME_T *pFile_time, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags,
|
||||
mz_bool mz_zip_writer_add_read_buf_callback(mz_zip_archive *pZip, const char *pArchive_name, mz_file_read_func read_callback, void* callback_opaque, mz_uint64 size_to_add, const MZ_TIME_T *pFile_time, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags,
|
||||
const char *user_extra_data, mz_uint user_extra_data_len, const char *user_extra_data_central, mz_uint user_extra_data_central_len)
|
||||
{
|
||||
mz_uint16 gen_flags = MZ_ZIP_LDH_BIT_FLAG_HAS_LOCATOR;
|
||||
@ -6313,6 +6383,7 @@ mz_bool mz_zip_writer_add_cfile(mz_zip_archive *pZip, const char *pArchive_name,
|
||||
mz_uint32 extra_size = 0;
|
||||
mz_uint8 extra_data[MZ_ZIP64_MAX_CENTRAL_EXTRA_FIELD_SIZE];
|
||||
mz_zip_internal_state *pState;
|
||||
mz_uint64 file_ofs = 0;
|
||||
|
||||
if (!(level_and_flags & MZ_ZIP_FLAG_ASCII_FILENAME))
|
||||
gen_flags |= MZ_ZIP_GENERAL_PURPOSE_BIT_FLAG_UTF8;
|
||||
@ -6415,7 +6486,7 @@ mz_bool mz_zip_writer_add_cfile(mz_zip_archive *pZip, const char *pArchive_name,
|
||||
(uncomp_size >= MZ_UINT32_MAX) ? &comp_size : NULL, (local_dir_header_ofs >= MZ_UINT32_MAX) ? &local_dir_header_ofs : NULL);
|
||||
}
|
||||
|
||||
if (!mz_zip_writer_create_local_dir_header(pZip, local_dir_header, (mz_uint16)archive_name_size, extra_size + user_extra_data_len, 0, 0, 0, method, gen_flags, dos_time, dos_date))
|
||||
if (!mz_zip_writer_create_local_dir_header(pZip, local_dir_header, (mz_uint16)archive_name_size, (mz_uint16)(extra_size + user_extra_data_len), 0, 0, 0, method, gen_flags, dos_time, dos_date))
|
||||
return mz_zip_set_error(pZip, MZ_ZIP_INTERNAL_ERROR);
|
||||
|
||||
if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_archive_file_ofs, local_dir_header, sizeof(local_dir_header)) != sizeof(local_dir_header))
|
||||
@ -6439,7 +6510,7 @@ mz_bool mz_zip_writer_add_cfile(mz_zip_archive *pZip, const char *pArchive_name,
|
||||
{
|
||||
if ((comp_size > MZ_UINT32_MAX) || (cur_archive_file_ofs > MZ_UINT32_MAX))
|
||||
return mz_zip_set_error(pZip, MZ_ZIP_ARCHIVE_TOO_LARGE);
|
||||
if (!mz_zip_writer_create_local_dir_header(pZip, local_dir_header, (mz_uint16)archive_name_size, user_extra_data_len, 0, 0, 0, method, gen_flags, dos_time, dos_date))
|
||||
if (!mz_zip_writer_create_local_dir_header(pZip, local_dir_header, (mz_uint16)archive_name_size, (mz_uint16)user_extra_data_len, 0, 0, 0, method, gen_flags, dos_time, dos_date))
|
||||
return mz_zip_set_error(pZip, MZ_ZIP_INTERNAL_ERROR);
|
||||
|
||||
if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_archive_file_ofs, local_dir_header, sizeof(local_dir_header)) != sizeof(local_dir_header))
|
||||
@ -6477,11 +6548,12 @@ mz_bool mz_zip_writer_add_cfile(mz_zip_archive *pZip, const char *pArchive_name,
|
||||
while (uncomp_remaining)
|
||||
{
|
||||
mz_uint n = (mz_uint)MZ_MIN((mz_uint64)MZ_ZIP_MAX_IO_BUF_SIZE, uncomp_remaining);
|
||||
if ((MZ_FREAD(pRead_buf, 1, n, pSrc_file) != n) || (pZip->m_pWrite(pZip->m_pIO_opaque, cur_archive_file_ofs, pRead_buf, n) != n))
|
||||
if ((read_callback(callback_opaque, file_ofs, pRead_buf, n) != n) || (pZip->m_pWrite(pZip->m_pIO_opaque, cur_archive_file_ofs, pRead_buf, n) != n))
|
||||
{
|
||||
pZip->m_pFree(pZip->m_pAlloc_opaque, pRead_buf);
|
||||
return mz_zip_set_error(pZip, MZ_ZIP_FILE_READ_FAILED);
|
||||
}
|
||||
file_ofs += n;
|
||||
uncomp_crc32 = (mz_uint32)mz_crc32(uncomp_crc32, (const mz_uint8 *)pRead_buf, n);
|
||||
uncomp_remaining -= n;
|
||||
cur_archive_file_ofs += n;
|
||||
@ -6516,12 +6588,13 @@ mz_bool mz_zip_writer_add_cfile(mz_zip_archive *pZip, const char *pArchive_name,
|
||||
tdefl_status status;
|
||||
tdefl_flush flush = TDEFL_NO_FLUSH;
|
||||
|
||||
if (MZ_FREAD(pRead_buf, 1, in_buf_size, pSrc_file) != in_buf_size)
|
||||
if (read_callback(callback_opaque, file_ofs, pRead_buf, in_buf_size)!= in_buf_size)
|
||||
{
|
||||
mz_zip_set_error(pZip, MZ_ZIP_FILE_READ_FAILED);
|
||||
break;
|
||||
}
|
||||
|
||||
file_ofs += in_buf_size;
|
||||
uncomp_crc32 = (mz_uint32)mz_crc32(uncomp_crc32, (const mz_uint8 *)pRead_buf, in_buf_size);
|
||||
uncomp_remaining -= in_buf_size;
|
||||
|
||||
@ -6589,7 +6662,7 @@ mz_bool mz_zip_writer_add_cfile(mz_zip_archive *pZip, const char *pArchive_name,
|
||||
(uncomp_size >= MZ_UINT32_MAX) ? &comp_size : NULL, (local_dir_header_ofs >= MZ_UINT32_MAX) ? &local_dir_header_ofs : NULL);
|
||||
}
|
||||
|
||||
if (!mz_zip_writer_add_to_central_dir(pZip, pArchive_name, (mz_uint16)archive_name_size, pExtra_data, extra_size, pComment, comment_size,
|
||||
if (!mz_zip_writer_add_to_central_dir(pZip, pArchive_name, (mz_uint16)archive_name_size, pExtra_data, (mz_uint16)extra_size, pComment, comment_size,
|
||||
uncomp_size, comp_size, uncomp_crc32, method, gen_flags, dos_time, dos_date, local_dir_header_ofs, ext_attributes,
|
||||
user_extra_data_central, user_extra_data_central_len))
|
||||
return MZ_FALSE;
|
||||
@ -6600,6 +6673,26 @@ mz_bool mz_zip_writer_add_cfile(mz_zip_archive *pZip, const char *pArchive_name,
|
||||
return MZ_TRUE;
|
||||
}
|
||||
|
||||
#ifndef MINIZ_NO_STDIO
|
||||
|
||||
static size_t mz_file_read_func_stdio(void *pOpaque, mz_uint64 file_ofs, void *pBuf, size_t n)
|
||||
{
|
||||
MZ_FILE *pSrc_file = (MZ_FILE *)pOpaque;
|
||||
mz_int64 cur_ofs = MZ_FTELL64(pSrc_file);
|
||||
|
||||
if (((mz_int64)file_ofs < 0) || (((cur_ofs != (mz_int64)file_ofs)) && (MZ_FSEEK64(pSrc_file, (mz_int64)file_ofs, SEEK_SET))))
|
||||
return 0;
|
||||
|
||||
return MZ_FREAD(pBuf, 1, n, pSrc_file);
|
||||
}
|
||||
|
||||
mz_bool mz_zip_writer_add_cfile(mz_zip_archive *pZip, const char *pArchive_name, MZ_FILE *pSrc_file, mz_uint64 size_to_add, const MZ_TIME_T *pFile_time, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags,
|
||||
const char *user_extra_data, mz_uint user_extra_data_len, const char *user_extra_data_central, mz_uint user_extra_data_central_len)
|
||||
{
|
||||
return mz_zip_writer_add_read_buf_callback(pZip, pArchive_name, mz_file_read_func_stdio, pSrc_file, size_to_add, pFile_time, pComment, comment_size, level_and_flags,
|
||||
user_extra_data, user_extra_data_len, user_extra_data_central, user_extra_data_central_len);
|
||||
}
|
||||
|
||||
mz_bool mz_zip_writer_add_file(mz_zip_archive *pZip, const char *pArchive_name, const char *pSrc_filename, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags)
|
||||
{
|
||||
MZ_FILE *pSrc_file = NULL;
|
||||
|
35
external/miniz/miniz.h
vendored
35
external/miniz/miniz.h
vendored
@ -1,4 +1,4 @@
|
||||
/* miniz.c 2.0.8 - public domain deflate/inflate, zlib-subset, ZIP reading/writing/appending, PNG writing
|
||||
/* miniz.c 2.1.0 - public domain deflate/inflate, zlib-subset, ZIP reading/writing/appending, PNG writing
|
||||
See "unlicense" statement at the end of this file.
|
||||
Rich Geldreich <richgel99@gmail.com>, last updated Oct. 13, 2013
|
||||
Implements RFC 1950: http://www.ietf.org/rfc/rfc1950.txt and RFC 1951: http://www.ietf.org/rfc/rfc1951.txt
|
||||
@ -24,7 +24,7 @@
|
||||
zlib replacement in many apps:
|
||||
The z_stream struct, optional memory allocation callbacks
|
||||
deflateInit/deflateInit2/deflate/deflateReset/deflateEnd/deflateBound
|
||||
inflateInit/inflateInit2/inflate/inflateEnd
|
||||
inflateInit/inflateInit2/inflate/inflateReset/inflateEnd
|
||||
compress, compress2, compressBound, uncompress
|
||||
CRC-32, Adler-32 - Using modern, minimal code size, CPU cache friendly routines.
|
||||
Supports raw deflate streams or standard zlib streams with adler-32 checking.
|
||||
@ -170,12 +170,16 @@
|
||||
#define MINIZ_LITTLE_ENDIAN 0
|
||||
#endif
|
||||
|
||||
/* Set MINIZ_USE_UNALIGNED_LOADS_AND_STORES only if not set */
|
||||
#if !defined(MINIZ_USE_UNALIGNED_LOADS_AND_STORES)
|
||||
#if MINIZ_X86_OR_X64_CPU
|
||||
/* Set MINIZ_USE_UNALIGNED_LOADS_AND_STORES to 1 on CPU's that permit efficient integer loads and stores from unaligned addresses. */
|
||||
#define MINIZ_USE_UNALIGNED_LOADS_AND_STORES 1
|
||||
#define MINIZ_UNALIGNED_USE_MEMCPY
|
||||
#else
|
||||
#define MINIZ_USE_UNALIGNED_LOADS_AND_STORES 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_M_X64) || defined(_WIN64) || defined(__MINGW64__) || defined(_LP64) || defined(__LP64__) || defined(__ia64__) || defined(__x86_64__)
|
||||
/* Set MINIZ_HAS_64BIT_REGISTERS to 1 if operations on 64-bit integers are reasonably fast (and don't involve compiler generated calls to helper functions). */
|
||||
@ -234,11 +238,11 @@ enum
|
||||
MZ_DEFAULT_COMPRESSION = -1
|
||||
};
|
||||
|
||||
#define MZ_VERSION "10.0.3"
|
||||
#define MZ_VERNUM 0xA030
|
||||
#define MZ_VERSION "10.1.0"
|
||||
#define MZ_VERNUM 0xA100
|
||||
#define MZ_VER_MAJOR 10
|
||||
#define MZ_VER_MINOR 0
|
||||
#define MZ_VER_REVISION 3
|
||||
#define MZ_VER_MINOR 1
|
||||
#define MZ_VER_REVISION 0
|
||||
#define MZ_VER_SUBREVISION 0
|
||||
|
||||
#ifndef MINIZ_NO_ZLIB_APIS
|
||||
@ -361,6 +365,9 @@ int mz_inflateInit(mz_streamp pStream);
|
||||
/* window_bits must be MZ_DEFAULT_WINDOW_BITS (to parse zlib header/footer) or -MZ_DEFAULT_WINDOW_BITS (raw deflate). */
|
||||
int mz_inflateInit2(mz_streamp pStream, int window_bits);
|
||||
|
||||
/* Quickly resets a compressor without having to reallocate anything. Same as calling mz_inflateEnd() followed by mz_inflateInit()/mz_inflateInit2(). */
|
||||
int mz_inflateReset(mz_streamp pStream);
|
||||
|
||||
/* Decompresses the input stream to the output, consuming only as much of the input as needed, and writing as much to the output as possible. */
|
||||
/* Parameters: */
|
||||
/* pStream is the stream to read from and write to. You must initialize/update the next_in, avail_in, next_out, and avail_out members. */
|
||||
@ -444,6 +451,7 @@ typedef void *const voidpc;
|
||||
#define compressBound mz_compressBound
|
||||
#define inflateInit mz_inflateInit
|
||||
#define inflateInit2 mz_inflateInit2
|
||||
#define inflateReset mz_inflateReset
|
||||
#define inflate mz_inflate
|
||||
#define inflateEnd mz_inflateEnd
|
||||
#define uncompress mz_uncompress
|
||||
@ -737,11 +745,13 @@ mz_uint32 tdefl_get_adler32(tdefl_compressor *d);
|
||||
/* strategy may be either MZ_DEFAULT_STRATEGY, MZ_FILTERED, MZ_HUFFMAN_ONLY, MZ_RLE, or MZ_FIXED */
|
||||
mz_uint tdefl_create_comp_flags_from_zip_params(int level, int window_bits, int strategy);
|
||||
|
||||
#ifndef MINIZ_NO_MALLOC
|
||||
/* Allocate the tdefl_compressor structure in C so that */
|
||||
/* non-C language bindings to tdefl_ API don't need to worry about */
|
||||
/* structure size and allocation mechanism. */
|
||||
tdefl_compressor *tdefl_compressor_alloc();
|
||||
tdefl_compressor *tdefl_compressor_alloc(void);
|
||||
void tdefl_compressor_free(tdefl_compressor *pComp);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
@ -789,12 +799,13 @@ int tinfl_decompress_mem_to_callback(const void *pIn_buf, size_t *pIn_buf_size,
|
||||
struct tinfl_decompressor_tag;
|
||||
typedef struct tinfl_decompressor_tag tinfl_decompressor;
|
||||
|
||||
#ifndef MINIZ_NO_MALLOC
|
||||
/* Allocate the tinfl_decompressor structure in C so that */
|
||||
/* non-C language bindings to tinfl_ API don't need to worry about */
|
||||
/* structure size and allocation mechanism. */
|
||||
|
||||
tinfl_decompressor *tinfl_decompressor_alloc();
|
||||
tinfl_decompressor *tinfl_decompressor_alloc(void);
|
||||
void tinfl_decompressor_free(tinfl_decompressor *pDecomp);
|
||||
#endif
|
||||
|
||||
/* Max size of LZ dictionary. */
|
||||
#define TINFL_LZ_DICT_SIZE 32768
|
||||
@ -1269,6 +1280,12 @@ mz_bool mz_zip_writer_add_mem_ex_v2(mz_zip_archive *pZip, const char *pArchive_n
|
||||
mz_uint64 uncomp_size, mz_uint32 uncomp_crc32, MZ_TIME_T *last_modified, const char *user_extra_data_local, mz_uint user_extra_data_local_len,
|
||||
const char *user_extra_data_central, mz_uint user_extra_data_central_len);
|
||||
|
||||
/* Adds the contents of a file to an archive. This function also records the disk file's modified time into the archive. */
|
||||
/* File data is supplied via a read callback function. User mz_zip_writer_add_(c)file to add a file directly.*/
|
||||
mz_bool mz_zip_writer_add_read_buf_callback(mz_zip_archive *pZip, const char *pArchive_name, mz_file_read_func read_callback, void* callback_opaque, mz_uint64 size_to_add,
|
||||
const MZ_TIME_T *pFile_time, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags, const char *user_extra_data_local, mz_uint user_extra_data_local_len,
|
||||
const char *user_extra_data_central, mz_uint user_extra_data_central_len);
|
||||
|
||||
#ifndef MINIZ_NO_STDIO
|
||||
/* Adds the contents of a disk file to an archive. This function also records the disk file's modified time into the archive. */
|
||||
/* level_and_flags - compression level (0-10, see MZ_BEST_SPEED, MZ_BEST_COMPRESSION, etc.) logically OR'd with zero or more mz_zip_flags, or just set to MZ_DEFAULT_COMPRESSION. */
|
||||
|
2
external/pugixml
vendored
2
external/pugixml
vendored
@ -1 +1 @@
|
||||
Subproject commit c5752917c72da7cee2271394a827d022ccd4b367
|
||||
Subproject commit 08b3433180727ea2f78fe02e860a08471db1e03c
|
2
external/spdlog
vendored
2
external/spdlog
vendored
@ -1 +1 @@
|
||||
Subproject commit a7148b718ea2fabb8387cb90aee9bf448da63e65
|
||||
Subproject commit de0dbfa3596a18cd70a4619b6a9766847a941276
|
2
external/stb
vendored
2
external/stb
vendored
@ -1 +1 @@
|
||||
Subproject commit c72a95d766b8cbf5514e68d3ddbf6437ac9425b1
|
||||
Subproject commit b42009b3b9d4ca35bc703f5310eedc74f584be58
|
2
external/vita-toolchain
vendored
2
external/vita-toolchain
vendored
@ -1 +1 @@
|
||||
Subproject commit d45a757dd3cf891d3482ee104c36189c2eeb758c
|
||||
Subproject commit 4553ee96482d9ba36b9f6c6dcded465ee5ab6ca5
|
2
external/yaml-cpp
vendored
2
external/yaml-cpp
vendored
@ -1 +1 @@
|
||||
Subproject commit 012269756149ae99745b6dafefd415843d7420bb
|
||||
Subproject commit 9a3624205e8774953ef18f57067b3426c1c5ada6
|
@ -17,10 +17,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <util/log.h>
|
||||
#include <util/system.h>
|
||||
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
// clang-format off
|
||||
// Singular options produced in config file
|
||||
// Order is code(option_type, option_name, option_default, member_name)
|
||||
|
@ -52,4 +52,4 @@ add_library(
|
||||
|
||||
target_include_directories(gui PUBLIC include ${CMAKE_SOURCE_DIR}/vita3k)
|
||||
target_link_libraries(gui PUBLIC app host imgui glutil)
|
||||
target_link_libraries(gui PRIVATE nativefiledialog pugixml stb renderer)
|
||||
target_link_libraries(gui PRIVATE nativefiledialog pugixml::pugixml stb renderer)
|
||||
|
@ -142,7 +142,7 @@ void draw_app_selector(GuiState &gui, HostState &host) {
|
||||
gui.live_area.information_bar = true;
|
||||
|
||||
if (!gui.file_menu.pkg_install_dialog) {
|
||||
if (ImGui::IsAnyWindowHovered() || ImGui::IsAnyItemActive() || ImGui::IsAnyItemHovered())
|
||||
if (ImGui::IsWindowHovered(ImGuiHoveredFlags_AnyWindow) || ImGui::IsAnyItemActive() || ImGui::IsAnyItemHovered())
|
||||
last_time["start"] = 0;
|
||||
else {
|
||||
if (last_time["start"] == 0)
|
||||
|
@ -100,7 +100,7 @@ static void init_style() {
|
||||
style->Colors[ImGuiCol_PlotHistogram] = ImVec4(0.40f, 0.39f, 0.38f, 0.63f);
|
||||
style->Colors[ImGuiCol_PlotHistogramHovered] = ImVec4(0.25f, 1.00f, 0.00f, 1.00f);
|
||||
style->Colors[ImGuiCol_TextSelectedBg] = ImVec4(1.00f, 1.00f, 0.00f, 0.50f);
|
||||
style->Colors[ImGuiCol_ModalWindowDarkening] = ImVec4(1.00f, 0.98f, 0.95f, 0.73f);
|
||||
style->Colors[ImGuiCol_ModalWindowDimBg] = ImVec4(1.00f, 0.98f, 0.95f, 0.73f);
|
||||
}
|
||||
|
||||
static void init_font(GuiState &gui, HostState &host) {
|
||||
|
@ -23,4 +23,4 @@ target_link_libraries(host PUBLIC psvpfsparser app audio config ctrl dialog io k
|
||||
if(USE_GDBSTUB)
|
||||
target_link_libraries(host PUBLIC gdbstub)
|
||||
endif()
|
||||
target_link_libraries(host PRIVATE elfio FAT16 vita-toolchain)
|
||||
target_link_libraries(host PRIVATE elfio::elfio FAT16 vita-toolchain)
|
||||
|
@ -160,9 +160,9 @@ static bool load_imports(const sce_module_info_raw &module, Ptr<const void> segm
|
||||
const sce_module_imports_raw *const imports_end = reinterpret_cast<const sce_module_imports_raw *>(base + module.import_end);
|
||||
|
||||
for (const sce_module_imports_raw *imports = imports_begin; imports < imports_end; imports = reinterpret_cast<const sce_module_imports_raw *>(reinterpret_cast<const uint8_t *>(imports) + imports->size)) {
|
||||
assert(imports->num_syms_unk == 0);
|
||||
assert(imports->num_syms_tls_vars == 0);
|
||||
|
||||
Address module_name{};
|
||||
Address library_name{};
|
||||
Address func_nid_table{};
|
||||
Address func_entry_table{};
|
||||
Address var_nid_table{};
|
||||
@ -170,14 +170,14 @@ static bool load_imports(const sce_module_info_raw &module, Ptr<const void> segm
|
||||
|
||||
if (imports->size == 0x24) {
|
||||
auto short_imports = reinterpret_cast<const sce_module_imports_short_raw *>(imports);
|
||||
module_name = short_imports->module_name;
|
||||
library_name = short_imports->library_name;
|
||||
func_nid_table = short_imports->func_nid_table;
|
||||
func_entry_table = short_imports->func_entry_table;
|
||||
var_nid_table = short_imports->var_nid_table;
|
||||
var_entry_table = short_imports->var_entry_table;
|
||||
} else if (imports->size == 0x34) {
|
||||
auto long_imports = imports;
|
||||
module_name = long_imports->module_name;
|
||||
library_name = long_imports->library_name;
|
||||
func_nid_table = long_imports->func_nid_table;
|
||||
func_entry_table = long_imports->func_entry_table;
|
||||
var_nid_table = long_imports->var_nid_table;
|
||||
@ -186,7 +186,7 @@ static bool load_imports(const sce_module_info_raw &module, Ptr<const void> segm
|
||||
|
||||
std::string lib_name;
|
||||
if (cfg.log_imports) {
|
||||
lib_name = Ptr<const char>(module_name).get(mem);
|
||||
lib_name = Ptr<const char>(library_name).get(mem);
|
||||
LOG_INFO("Loading func imports from {}", lib_name);
|
||||
}
|
||||
|
||||
@ -281,7 +281,7 @@ static bool load_exports(Ptr<const void> &entry_point, const sce_module_info_raw
|
||||
const sce_module_exports_raw *const exports_end = reinterpret_cast<const sce_module_exports_raw *>(base + module.export_end);
|
||||
|
||||
for (const sce_module_exports_raw *exports = exports_begin; exports < exports_end; exports = reinterpret_cast<const sce_module_exports_raw *>(reinterpret_cast<const uint8_t *>(exports) + exports->size)) {
|
||||
const char *const lib_name = Ptr<const char>(exports->module_name).get(mem);
|
||||
const char *const lib_name = Ptr<const char>(exports->library_name).get(mem);
|
||||
|
||||
if (cfg.log_exports) {
|
||||
LOG_INFO("Loading func exports from {}", lib_name ? lib_name : "unknown");
|
||||
@ -429,7 +429,7 @@ SceUID load_self(Ptr<const void> &entry_point, KernelState &kernel, MemState &me
|
||||
|
||||
for (const auto [seg, infos] : segment_reloc_info) {
|
||||
LOG_INFO("Loaded module segment {} @ [0x{:08X} - 0x{:08X} / 0x{:08X}] (size: 0x{:08X}) of module {}", seg, infos.addr, infos.addr + infos.size, infos.p_vaddr, infos.size, self_path);
|
||||
kernel.module_regions.push_back({ module_info->library_nid,
|
||||
kernel.module_regions.push_back({ module_info->module_nid,
|
||||
module_info->name,
|
||||
infos.addr,
|
||||
static_cast<uint32_t>(infos.size),
|
||||
@ -455,9 +455,9 @@ SceUID load_self(Ptr<const void> &entry_point, KernelState &kernel, MemState &me
|
||||
|
||||
//unk40
|
||||
//unk44
|
||||
sceKernelModuleInfo->tlsInit = Ptr<const void>((!module_info->field_38 ? 0 : (module_info_segment_address.address() + module_info->field_38)));
|
||||
sceKernelModuleInfo->tlsInitSize = module_info->field_3C;
|
||||
sceKernelModuleInfo->tlsAreaSize = module_info->field_40;
|
||||
sceKernelModuleInfo->tlsInit = Ptr<const void>((!module_info->tls_start ? 0 : (module_info_segment_address.address() + module_info->tls_start)));
|
||||
sceKernelModuleInfo->tlsInitSize = module_info->tls_filesz;
|
||||
sceKernelModuleInfo->tlsAreaSize = module_info->tls_memsz;
|
||||
|
||||
if (sceKernelModuleInfo->tlsInit) {
|
||||
kernel.tls_address = sceKernelModuleInfo->tlsInit;
|
||||
|
@ -913,7 +913,7 @@ void make_fself(const std::string &input_file, const std::string &output_file) {
|
||||
control_6.common.type = 6;
|
||||
control_6.common.size = sizeof(control_6);
|
||||
control_6.common.unk = 1;
|
||||
control_6.unk1 = 1;
|
||||
control_6.is_used = 1;
|
||||
SCE_controlinfo_7 control_7 = { 0 };
|
||||
control_7.common.type = 7;
|
||||
control_7.common.size = sizeof(control_7);
|
||||
|
@ -39,7 +39,9 @@
|
||||
#endif
|
||||
|
||||
#include <SDL.h>
|
||||
#include <chrono>
|
||||
#include <cstdlib>
|
||||
#include <thread>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
Root root_paths;
|
||||
|
@ -189,4 +189,5 @@ add_library(modules STATIC
|
||||
SceWlanBt/SceWlan.cpp SceWlanBt/SceWlan.h
|
||||
)
|
||||
target_include_directories(modules PUBLIC include)
|
||||
target_link_libraries(modules PRIVATE xxHash::xxhash)
|
||||
target_link_libraries(modules PUBLIC module)
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
#include <modules/module_parent.h>
|
||||
|
||||
#include "../xxHash/xxh3.h"
|
||||
#include <xxh3.h>
|
||||
|
||||
#include <gxm/functions.h>
|
||||
#include <gxm/types.h>
|
||||
|
@ -23,6 +23,9 @@
|
||||
#include <net/types.h>
|
||||
#include <util/lock_and_find.h>
|
||||
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
EXPORT(int, sceNetAccept, int sid, SceNetSockaddr *addr, unsigned int *addrlen) {
|
||||
auto sock = lock_and_find(sid, host.net.socks, host.kernel.mutex);
|
||||
if (!sock) {
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include <map>
|
||||
|
||||
#ifdef WIN32
|
||||
#define NOMINMAX
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#include <Ws2tcpip.h>
|
||||
|
@ -10,4 +10,4 @@ add_library(np
|
||||
|
||||
target_include_directories(np PUBLIC include)
|
||||
target_link_libraries(np PUBLIC yaml-cpp mem)
|
||||
target_link_libraries(np PRIVATE io util pugixml)
|
||||
target_link_libraries(np PRIVATE io util pugixml::pugixml)
|
||||
|
@ -57,5 +57,4 @@ add_library(
|
||||
|
||||
target_include_directories(renderer PUBLIC include)
|
||||
target_link_libraries(renderer PUBLIC crypto stb shader glutil threads config util ${RENDERER_VULKAN_LIBRARIES})
|
||||
target_link_libraries(renderer PRIVATE sdl2 stb ffmpeg)
|
||||
|
||||
target_link_libraries(renderer PRIVATE sdl2 stb ffmpeg xxHash::xxhash)
|
||||
|
@ -17,6 +17,8 @@
|
||||
#include <features/state.h>
|
||||
#include <gxm/functions.h>
|
||||
|
||||
#include <spdlog/fmt/bin_to_hex.h>
|
||||
|
||||
namespace renderer::gl {
|
||||
static GLenum translate_primitive(SceGxmPrimitiveType primType) {
|
||||
R_PROFILE(__func__);
|
||||
@ -72,14 +74,8 @@ void draw(GLState &renderer, GLContext &context, GxmContextState &state, const F
|
||||
const std::string hash_text_v = hex_string(state.vertex_program.get(mem)->renderer_data->hash);
|
||||
|
||||
LOG_DEBUG("\nVertex : {}\nFragment: {}", hash_text_v, hash_text_f);
|
||||
|
||||
std::stringstream vert_ub;
|
||||
dump_hex(context.ubo_data[0], vert_ub);
|
||||
LOG_DEBUG("Vertex default uniform buffer: \n{}", vert_ub.str());
|
||||
|
||||
std::stringstream frag_ub;
|
||||
dump_hex(context.ubo_data[SCE_GXM_REAL_MAX_UNIFORM_BUFFER], frag_ub);
|
||||
LOG_DEBUG("Fragment default uniform buffer: \n{}", frag_ub.str());
|
||||
LOG_DEBUG("Vertex default uniform buffer: {:a}\n", spdlog::to_hex(context.ubo_data[0].begin(), context.ubo_data[0].end(), 16));
|
||||
LOG_DEBUG("Fragment default uniform buffer: {:a}\n", spdlog::to_hex(context.ubo_data[SCE_GXM_REAL_MAX_UNIFORM_BUFFER].begin(), context.ubo_data[SCE_GXM_REAL_MAX_UNIFORM_BUFFER].end(), 16));
|
||||
}
|
||||
|
||||
if (!program_id) {
|
||||
|
@ -6,10 +6,10 @@
|
||||
#include <mem/ptr.h>
|
||||
#include <util/log.h>
|
||||
|
||||
#include "../xxHash/xxh3.h"
|
||||
#include <algorithm> // find
|
||||
#include <cstring> // memcmp
|
||||
#include <numeric> // accumulate, reduce
|
||||
#include <xxh3.h>
|
||||
#ifdef WIN32
|
||||
#include <execution>
|
||||
#endif
|
||||
|
@ -23,8 +23,6 @@
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
struct _FILETIME;
|
||||
|
||||
// This is the # of microseconds between January 1, 0001 and January 1, 1970.
|
||||
// Grabbed from JPSCP
|
||||
static constexpr auto RTC_OFFSET = 62135596800000000ULL;
|
||||
@ -85,11 +83,6 @@ inline time_t rtc_timegm(struct tm *tm) {
|
||||
|
||||
std::uint64_t rtc_base_ticks();
|
||||
std::uint64_t rtc_get_ticks(uint64_t base_tick);
|
||||
#ifdef WIN32
|
||||
std::uint64_t convert_filetime(const _FILETIME &filetime);
|
||||
#else
|
||||
std::uint64_t convert_timespec(const timespec ×pec);
|
||||
#endif
|
||||
void __RtcPspTimeToTm(tm *val, const SceDateTime *pt);
|
||||
void __RtcTicksToPspTime(SceDateTime *t, std::uint64_t ticks);
|
||||
std::uint64_t __RtcPspTimeToTicks(const SceDateTime *pt);
|
||||
|
@ -33,23 +33,6 @@ std::uint64_t rtc_get_ticks(uint64_t base_ticks) {
|
||||
return base_ticks + rtc_ticks_since_epoch();
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
std::uint64_t convert_filetime(const _FILETIME &filetime) {
|
||||
// Microseconds between 1601-01-01 00:00:00 UTC and 1970-01-01 00:00:00 UTC
|
||||
static const uint64_t EPOCH_DIFFERENCE_MICROS = 11644473600000000ull;
|
||||
|
||||
// First convert 100-ns intervals to microseconds, then adjust for the
|
||||
// epoch difference
|
||||
uint64_t total_us = (((uint64_t)filetime.dwHighDateTime << 32) | (uint64_t)filetime.dwLowDateTime) / 10;
|
||||
total_us -= EPOCH_DIFFERENCE_MICROS;
|
||||
return total_us;
|
||||
}
|
||||
#else
|
||||
std::uint64_t convert_timespec(const timespec ×pec) {
|
||||
return timespec.tv_sec * 1'000'000 + timespec.tv_nsec / 1'000;
|
||||
}
|
||||
#endif
|
||||
|
||||
// The following functions are from PPSSPP
|
||||
// Copyright (c) 2012- PPSSPP Project.
|
||||
|
||||
|
@ -23,4 +23,4 @@ add_library(
|
||||
)
|
||||
|
||||
target_include_directories(util PUBLIC include)
|
||||
target_link_libraries(util PUBLIC ${Boost_LIBRARIES} spdlog)
|
||||
target_link_libraries(util PUBLIC ${Boost_LIBRARIES} spdlog::spdlog)
|
||||
|
@ -17,6 +17,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_TRACE
|
||||
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <util/exit_code.h>
|
||||
#include <util/fs.h>
|
||||
@ -69,5 +71,3 @@ std::string log_hex(T val) {
|
||||
using unsigned_type = typename std::make_unsigned<T>::type;
|
||||
return fmt::format("0x{:0X}", static_cast<unsigned_type>(val));
|
||||
}
|
||||
|
||||
void dump_hex(const std::vector<uint8_t> &bytes, std::ostream &stream);
|
@ -56,7 +56,6 @@ ExitCode init(const Root &root_paths, bool use_stdout) {
|
||||
assert(0);
|
||||
});
|
||||
|
||||
spdlog::flush_on(spdlog::level::debug);
|
||||
return Success;
|
||||
}
|
||||
|
||||
@ -282,51 +281,6 @@ std::uint32_t nearest_power_of_two(std::uint32_t num) {
|
||||
return num;
|
||||
}
|
||||
|
||||
// based on https://gist.github.com/shreyasbharath/32a8092666303a916e24a81b18af146b
|
||||
void dump_hex(const std::vector<uint8_t> &bytes, std::ostream &stream) {
|
||||
char buff[17];
|
||||
size_t i = 0;
|
||||
|
||||
stream << std::hex;
|
||||
|
||||
// Process every byte in the data.
|
||||
for (i = 0; i < bytes.size(); i++) {
|
||||
// Multiple of 16 means new line (with line offset).
|
||||
|
||||
if ((i % 16) == 0) {
|
||||
// Just don't print ASCII for the zeroth line.
|
||||
if (i != 0) {
|
||||
stream << " " << buff << std::endl;
|
||||
}
|
||||
|
||||
// Output the offset.
|
||||
stream << " " << std::setw(4) << std::setfill('0') << static_cast<unsigned int>(i);
|
||||
}
|
||||
|
||||
// Now the hex code for the specific character.
|
||||
stream << " " << std::setw(2) << std::setfill('0') << static_cast<unsigned int>(bytes[i]);
|
||||
|
||||
// And store a printable ASCII character for later.
|
||||
if ((bytes[i] < 0x20) || (bytes[i] > 0x7e)) {
|
||||
buff[i % 16] = '.';
|
||||
} else {
|
||||
buff[i % 16] = bytes[i];
|
||||
}
|
||||
buff[(i % 16) + 1] = '\0';
|
||||
}
|
||||
|
||||
stream << std::dec;
|
||||
|
||||
// Pad out last line if not exactly 16 characters.
|
||||
while ((i % 16) != 0) {
|
||||
stream << " ";
|
||||
i++;
|
||||
}
|
||||
|
||||
// And print the final ASCII bit.
|
||||
stream << " " << buff << std::endl;
|
||||
}
|
||||
|
||||
// Encode code taken from https://github.com/yifanlu/UVLoader/blob/master/resolve.c
|
||||
|
||||
uint32_t encode_arm_inst(uint8_t type, uint16_t immed, uint16_t reg) {
|
||||
|
Loading…
Reference in New Issue
Block a user