diff --git a/.gitignore b/.gitignore index b5523f6857..182b02d38c 100644 --- a/.gitignore +++ b/.gitignore @@ -56,3 +56,6 @@ flatbuild # Snap *.snap + +# Rust +launcher/hematite/target diff --git a/CMakeLists.txt b/CMakeLists.txt index dcf13c5772..3eaf987104 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.15) # minimum version required by QuaZip +cmake_minimum_required(VERSION 3.15) # minimum version required by QuaZip & Corrosion project(Launcher) @@ -332,13 +332,17 @@ endif() if(Launcher_QT_VERSION_MAJOR EQUAL 5) include(ECMQueryQt) + # ecm_query_qt(QT_BINS_DIR QT_INSTALL_BINS) ecm_query_qt(QT_PLUGINS_DIR QT_INSTALL_PLUGINS) ecm_query_qt(QT_LIBS_DIR QT_INSTALL_LIBS) ecm_query_qt(QT_LIBEXECS_DIR QT_INSTALL_LIBEXECS) + # ecm_query_qt(QT_QML_DIR QT_INSTALL_QML) else() + # set(QT_BINS_DIR ${QT${QT_VERSION_MAJOR}_INSTALL_PREFIX}/${QT${QT_VERSION_MAJOR}_INSTALL_BINS}) set(QT_PLUGINS_DIR ${QT${QT_VERSION_MAJOR}_INSTALL_PREFIX}/${QT${QT_VERSION_MAJOR}_INSTALL_PLUGINS}) set(QT_LIBS_DIR ${QT${QT_VERSION_MAJOR}_INSTALL_PREFIX}/${QT${QT_VERSION_MAJOR}_INSTALL_LIBS}) set(QT_LIBEXECS_DIR ${QT${QT_VERSION_MAJOR}_INSTALL_PREFIX}/${QT${QT_VERSION_MAJOR}_INSTALL_LIBEXECS}) + # set(QT_QML_DIR ${QT${QT_VERSION_MAJOR}_INSTALL_PREFIX}/${QT${QT_VERSION_MAJOR}_INSTALL_QML}) endif() # NOTE: Qt 6 already sets this by default @@ -384,6 +388,7 @@ if(UNIX AND APPLE) set(PLUGIN_DEST_DIR "${Launcher_Name}.app/Contents/MacOS") set(FRAMEWORK_DEST_DIR "${Launcher_Name}.app/Contents/Frameworks") set(RESOURCES_DEST_DIR "${Launcher_Name}.app/Contents/Resources") + # set(QML_DEST_DIR "${RESOURCES_DEST_DIR}/qml") set(JARS_DEST_DIR "${Launcher_Name}.app/Contents/MacOS/jars") # Apps to bundle @@ -442,7 +447,8 @@ elseif(UNIX) set(PLUGIN_DEST_DIR "plugins") set(BUNDLE_DEST_DIR ".") set(RESOURCES_DEST_DIR ".") - + # set(QML_DEST_DIR "qml") + # Apps to bundle set(APPS "\${CMAKE_INSTALL_PREFIX}/bin/${Launcher_APP_BINARY_NAME}") @@ -463,6 +469,7 @@ elseif(WIN32) set(LIBRARY_DEST_DIR ".") set(PLUGIN_DEST_DIR ".") set(RESOURCES_DEST_DIR ".") + # set(QML_DEST_DIR "qml") set(JARS_DEST_DIR "jars") # Apps to bundle diff --git a/launcher/Application.cpp b/launcher/Application.cpp index b0ff14a6b9..410f2ecd01 100644 --- a/launcher/Application.cpp +++ b/launcher/Application.cpp @@ -159,6 +159,8 @@ #include "WindowsConsole.h" #endif +#include "hematite_static/src/log.cxx.h" + #define STRINGIFY(x) #x #define TOSTRING(x) STRINGIFY(x) @@ -502,6 +504,8 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv) QLoggingCategory::setFilterRules(rules_str); } + prism::hematite::log::setup_rust_tracing_qdebug(); + qDebug() << "<> Log initialized."; } @@ -1938,4 +1942,4 @@ bool Application::checkQSavePath(QString path) } } return false; -} \ No newline at end of file +} diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index 604445ebd2..f848118024 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -97,7 +97,7 @@ set(CORE_SOURCES MTPixmapCache.h ) if (UNIX AND NOT CYGWIN AND NOT APPLE) -set(CORE_SOURCES + set(CORE_SOURCES ${CORE_SOURCES} # MangoHud @@ -1140,7 +1140,7 @@ SET(LAUNCHER_SOURCES ) if (NOT Apple) -set(LAUNCHER_SOURCES + set(LAUNCHER_SOURCES ${LAUNCHER_SOURCES} ui/dialogs/UpdateAvailableDialog.h @@ -1310,11 +1310,11 @@ if(APPLE) set(CMAKE_INSTALL_RPATH "@loader_path/../Frameworks/") if(Launcher_ENABLE_UPDATER) - file(DOWNLOAD ${MACOSX_SPARKLE_DOWNLOAD_URL} ${CMAKE_BINARY_DIR}/Sparkle.tar.xz EXPECTED_HASH SHA256=${MACOSX_SPARKLE_SHA256}) - file(ARCHIVE_EXTRACT INPUT ${CMAKE_BINARY_DIR}/Sparkle.tar.xz DESTINATION ${CMAKE_BINARY_DIR}/frameworks/Sparkle) + file(DOWNLOAD ${MACOSX_SPARKLE_DOWNLOAD_URL} ${CMAKE_BINARY_DIR}/Sparkle.tar.xz EXPECTED_HASH SHA256=${MACOSX_SPARKLE_SHA256}) + file(ARCHIVE_EXTRACT INPUT ${CMAKE_BINARY_DIR}/Sparkle.tar.xz DESTINATION ${CMAKE_BINARY_DIR}/frameworks/Sparkle) - find_library(SPARKLE_FRAMEWORK Sparkle "${CMAKE_BINARY_DIR}/frameworks/Sparkle") - add_compile_definitions(SPARKLE_ENABLED) + find_library(SPARKLE_FRAMEWORK Sparkle "${CMAKE_BINARY_DIR}/frameworks/Sparkle") + add_compile_definitions(SPARKLE_ENABLED) endif() target_link_libraries(Launcher_logic @@ -1324,7 +1324,7 @@ if(APPLE) "-framework ApplicationServices" ) if(Launcher_ENABLE_UPDATER) - target_link_libraries(Launcher_logic ${SPARKLE_FRAMEWORK}) + target_link_libraries(Launcher_logic ${SPARKLE_FRAMEWORK}) endif() endif() @@ -1345,6 +1345,8 @@ if(DEFINED Launcher_APP_BINARY_DEFS) target_compile_definitions(Launcher_logic PRIVATE ${Launcher_APP_BINARY_DEFS}) endif() +add_subdirectory(hematite) + install(TARGETS ${Launcher_Name} BUNDLE DESTINATION "." COMPONENT Runtime LIBRARY DESTINATION ${LIBRARY_DEST_DIR} COMPONENT Runtime @@ -1544,6 +1546,38 @@ if(INSTALL_BUNDLE STREQUAL "full") PATTERN "*qcertonlybackend*" EXCLUDE ) endif() + # # QML plugins + # install( + # DIRECTORY "${QT_QML_DIR}/QtQml" + # CONFIGURATIONS Debug RelWithDebInfo "" + # DESTINATION ${QML_DEST_DIR} + # COMPONENT Runtime + # ) + # install( + # DIRECTORY "${QT_QML_DIR}/QtQml" + # CONFIGURATIONS Release MinSizeRel + # DESTINATION ${QML_DEST_DIR} + # COMPONENT Runtime + # REGEX "d\\." EXCLUDE + # REGEX "_debug\\." EXCLUDE + # REGEX "\\.dSYM" EXCLUDE + # ) + # # QtQuick plugins + # install( + # DIRECTORY "${QT_QML_DIR}/QtQuick" + # CONFIGURATIONS Debug RelWithDebInfo "" + # DESTINATION ${QML_DEST_DIR} + # COMPONENT Runtime + # ) + # install( + # DIRECTORY "${QT_QML_DIR}/QtQuick" + # CONFIGURATIONS Release MinSizeRel + # DESTINATION ${QML_DEST_DIR} + # COMPONENT Runtime + # REGEX "d\\." EXCLUDE + # REGEX "_debug\\." EXCLUDE + # REGEX "\\.dSYM" EXCLUDE + # ) # Wayland support if(EXISTS "${QT_PLUGINS_DIR}/wayland-graphics-integration-client") install( diff --git a/launcher/hematite/.cargo/config.toml b/launcher/hematite/.cargo/config.toml new file mode 100644 index 0000000000..39fbaa5435 --- /dev/null +++ b/launcher/hematite/.cargo/config.toml @@ -0,0 +1,2 @@ +[alias] +xtask = "run --package xtask --" diff --git a/launcher/hematite/CMakeLists.txt b/launcher/hematite/CMakeLists.txt new file mode 100644 index 0000000000..4017277d5d --- /dev/null +++ b/launcher/hematite/CMakeLists.txt @@ -0,0 +1,49 @@ + +# SPDX-FileCopyrightText: 2022 Rachel Powers <508861+Ryex@users.noreply.github.com> +# +# SPDX-License-Identifier: GPL-3.0-only +# +# Prism Launcher - Minecraft Launcher +# Copyright (C) 2022 Rachel Powers <508861+Ryex@users.noreply.github.com> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Rust always links against non-debug Windows runtime on *-msvc targets +# Note it is best to set this on the command line to ensure all targets are consistent +# https://github.com/corrosion-rs/corrosion/blob/master/doc/src/common_issues.md #linking-debug-cc-libraries-into-rust-fails-on-windows-msvc-targets +# https://github.com/rust-lang/rust/issues/39016 +if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDLL") +endif() + +find_package(CxxQt QUIET) +if(NOT CxxQt_FOUND) + include(FetchContent) + FetchContent_Declare( + CxxQt + GIT_REPOSITORY https://github.com/kdab/cxx-qt-cmake.git + GIT_TAG v0.7.0 + ) + + FetchContent_MakeAvailable(CxxQt) +endif() + +cxx_qt_import_crate( + MANIFEST_PATH "./Cargo.toml" + CRATES hematite_static + QT_MODULES Qt::Core +) +target_link_libraries(hematite_static INTERFACE Qt::Core) + + +target_link_libraries(Launcher_logic hematite_static) diff --git a/launcher/hematite/Cargo.lock b/launcher/hematite/Cargo.lock new file mode 100644 index 0000000000..64e11cc65a --- /dev/null +++ b/launcher/hematite/Cargo.lock @@ -0,0 +1,1129 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "anstyle" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" + +[[package]] +name = "autocfg" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "bumpalo" +version = "3.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" + +[[package]] +name = "cc" +version = "1.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812acba72f0a070b003d3697490d2b55b837230ae7c6c6497f05cc2ddbb8d938" +dependencies = [ + "jobserver", + "libc", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chrono" +version = "0.4.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "num-traits", + "serde", + "windows-targets", +] + +[[package]] +name = "clang-format" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "696283b40e1a39d208ee614b92e5f6521d16962edeb47c48372585ec92419943" +dependencies = [ + "thiserror", +] + +[[package]] +name = "clap" +version = "4.5.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7be5744db7978a28d9df86a214130d106a89ce49644cbc4e3f0c22c3fba30615" +dependencies = [ + "clap_builder", +] + +[[package]] +name = "clap_builder" +version = "4.5.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5fbc17d3ef8278f55b282b2a2e75ae6f6c7d4bb70ed3d0382375104bfafdb4b" +dependencies = [ + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_lex" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" + +[[package]] +name = "codespan-reporting" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" +dependencies = [ + "termcolor", + "unicode-width", +] + +[[package]] +name = "convert_case" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "cxx" +version = "1.0.136" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad7c7515609502d316ab9a24f67dc045132d93bfd3f00713389e90d9898bf30d" +dependencies = [ + "cc", + "cxxbridge-cmd", + "cxxbridge-flags", + "cxxbridge-macro", + "foldhash", + "link-cplusplus", +] + +[[package]] +name = "cxx-build" +version = "1.0.136" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8bfd16fca6fd420aebbd80d643c201ee4692114a0de208b790b9cd02ceae65fb" +dependencies = [ + "cc", + "codespan-reporting", + "proc-macro2", + "quote", + "scratch", + "syn", +] + +[[package]] +name = "cxx-gen" +version = "0.7.133" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c2a735d8c536a288ef07b5d49328b1a48132a2cbe7a097afd296657f573e960" +dependencies = [ + "codespan-reporting", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "cxx-qt" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80f050c8baa5e049664109c564061034c9aa2adfaf75545111e807edff5c55a7" +dependencies = [ + "cxx", + "cxx-qt-build", + "cxx-qt-macro", + "qt-build-utils", + "static_assertions", +] + +[[package]] +name = "cxx-qt-build" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6390fa09cf1552c3e1066fe6e9a1fd8a450bdc310736b6d2dd4648d3272a37a6" +dependencies = [ + "cc", + "codespan-reporting", + "cxx-gen", + "cxx-qt-gen", + "proc-macro2", + "qt-build-utils", + "quote", + "serde", + "serde_json", + "version_check", +] + +[[package]] +name = "cxx-qt-gen" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea8c8af7ca92109c49ac9c832c16e8ab9bb26db2343abbd7bf33ecabe23320f4" +dependencies = [ + "clang-format", + "convert_case", + "indoc", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "cxx-qt-lib" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf6eebd6c5d3b84d7e456675e45e588e479d58dd65d1b7a70109536b091d9e2" +dependencies = [ + "cxx", + "cxx-qt", + "cxx-qt-build", + "qt-build-utils", + "serde", +] + +[[package]] +name = "cxx-qt-macro" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "380e8dfd965061880eb07810c91941e97a8fd611863ea41c2de59f2dae528d26" +dependencies = [ + "cxx-qt-gen", + "proc-macro2", + "syn", +] + +[[package]] +name = "cxxbridge-cmd" +version = "1.0.136" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c33fd49f5d956a1b7ee5f7a9768d58580c6752838d92e39d0d56439efdedc35" +dependencies = [ + "clap", + "codespan-reporting", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "cxxbridge-flags" +version = "1.0.136" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be0f1077278fac36299cce8446effd19fe93a95eedb10d39265f3bf67b3036c9" + +[[package]] +name = "cxxbridge-macro" +version = "1.0.136" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3da7e4d6e74af6b79031d264b2f13c3ea70af1978083741c41ffce9308f1f24f" +dependencies = [ + "proc-macro2", + "quote", + "rustversion", + "syn", +] + +[[package]] +name = "darling" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +dependencies = [ + "darling_core", + "quote", + "syn", +] + +[[package]] +name = "deranged" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", + "serde", +] + +[[package]] +name = "either" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foldhash" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f81ec6369c545a7d40e4589b5597581fa1c441fe1cce96dd1de43159910a36a2" + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" + +[[package]] +name = "hematite_static" +version = "0.1.0" +dependencies = [ + "cxx", + "cxx-build", + "cxx-qt", + "cxx-qt-build", + "cxx-qt-lib", + "indoc", + "serde", + "serde_ignored", + "serde_path_to_error", + "serde_with", + "toml", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "iana-time-zone" +version = "0.1.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", + "serde", +] + +[[package]] +name = "indexmap" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +dependencies = [ + "equivalent", + "hashbrown 0.15.0", + "serde", +] + +[[package]] +name = "indoc" +version = "2.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" + +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "jobserver" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" +dependencies = [ + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "libc" +version = "0.2.159" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" + +[[package]] +name = "link-cplusplus" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d240c6f7e1ba3a28b0249f774e6a9dd0175054b52dfbb61b16eb8505c3785c9" +dependencies = [ + "cc", +] + +[[package]] +name = "log" +version = "0.4.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f" + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "945462a4b81e43c4e3ba96bd7b49d834c6f61198356aa858733bc4acf3cbe62e" + +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "proc-macro2" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "qt-build-utils" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9bd6788f49a3c8c4389cb8ac1e99b6c7451e7ebbd50760bdd92e45c2e41f58" +dependencies = [ + "cc", + "thiserror", + "versions", +] + +[[package]] +name = "quote" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rustversion" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "scratch" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3cf7c11c38cb994f3d40e8a8cde3bbd1f72a435e4c49e85d6553d8312306152" + +[[package]] +name = "serde" +version = "1.0.210" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.210" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_ignored" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8e319a36d1b52126a0d608f24e93b2d81297091818cd70625fcf50a15d84ddf" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_json" +version = "1.0.128" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "serde_path_to_error" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af99884400da37c88f5e9146b7f1fd0fbcae8f6eec4e9da38b67d05486f814a6" +dependencies = [ + "itoa", + "serde", +] + +[[package]] +name = "serde_spanned" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_with" +version = "3.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6b6f7f2fcb69f747921f79f3926bd1e203fce4fef62c268dd3abfb6d86029aa" +dependencies = [ + "base64", + "chrono", + "hex", + "indexmap 1.9.3", + "indexmap 2.6.0", + "serde", + "serde_derive", + "serde_json", + "serde_with_macros", + "time", +] + +[[package]] +name = "serde_with_macros" +version = "3.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d00caa5193a3c8362ac2b73be6b9e768aa5a4b2f721d8f4b339600c3cb51f8e" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "smallvec" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fcf8323ef1faaee30a44a340193b1ac6814fd9b7b4e88e9d4519a3e4abe1cfd" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "syn" +version = "2.0.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "thiserror" +version = "1.0.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thread_local" +version = "1.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" +dependencies = [ + "cfg-if", + "once_cell", +] + +[[package]] +name = "time" +version = "0.3.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35e7868883861bd0e56d9ac6efcaaca0d6d5d82a2a7ec8209ff492c07cf37b21" +dependencies = [ + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "time-macros" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2834e6017e3e5e4b9834939793b282bc03b37a3336245fa820e35e233e2a85de" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "toml" +version = "0.8.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.22.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" +dependencies = [ + "indexmap 2.6.0", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + +[[package]] +name = "tracing" +version = "0.1.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" +dependencies = [ + "nu-ansi-term", + "sharded-slab", + "smallvec", + "thread_local", + "tracing-core", + "tracing-log", +] + +[[package]] +name = "unicode-ident" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" + +[[package]] +name = "unicode-segmentation" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" + +[[package]] +name = "unicode-width" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" + +[[package]] +name = "valuable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "versions" +version = "6.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f25d498b63d1fdb376b4250f39ab3a5ee8d103957346abacd911e2d8b612c139" +dependencies = [ + "itertools", + "nom", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" +dependencies = [ + "bumpalo", + "log", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-core" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winnow" +version = "0.6.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" +dependencies = [ + "memchr", +] diff --git a/launcher/hematite/Cargo.toml b/launcher/hematite/Cargo.toml new file mode 100644 index 0000000000..4a8bce3bbd --- /dev/null +++ b/launcher/hematite/Cargo.toml @@ -0,0 +1,47 @@ + +[package] +name = "hematite_static" +version = "0.1.0" +edition = "2021" +authors = [ + "Prism Launcher Contributors", + "Rachel Powers <508861+Ryex@users.noreply.github.com>", +] +description = "A rust extension crate for Prism Launcher" +readme = "Readme.md" +homepage = "https://prismlauncher.org/" +repository = "https://github.com/PrismLauncher/PrismLauncher" +license-file = "../LICENSE" +links = "hematite_static" + + +[dependencies] +cxx = { version = "1.0.136", features = ["c++17", "std"] } +cxx-qt = "0.7" +cxx-qt-lib = { version = "0.7", default-features = false, features = [ + # "qt_gui", + "serde", +] } +indoc = "2.0.5" +serde = { version = "1.0", features = ["derive"] } +serde_ignored = "0.1.10" +serde_path_to_error = "0.1.16" +serde_with = "3.12.0" +toml = "0.8.19" +tracing = "0.1.41" +tracing-subscriber = "0.3.19" + + +[build-dependencies] +cxx-qt-build = "0.7" +cxx-build = "1.0.136" + +# [profile.release] +# # Tell `rustc` to optimize for small code size. +# opt-level = "s" +# lto = true +# [profile.dev] +# opt-level = 1 + +[lib] +crate-type = ["staticlib"] diff --git a/launcher/hematite/Readme.md b/launcher/hematite/Readme.md new file mode 100644 index 0000000000..0a41af4c08 --- /dev/null +++ b/launcher/hematite/Readme.md @@ -0,0 +1,17 @@ +
+ +

Prism Launcher - Hematite

+ +

+ A (experimental) rust cxx-qt based extension for Prism launcher +

+ +
+ + +## About + +Hematite, ~~is an iron oxide crystal which~~ -- is an atempt to allow Prismluancher to be extended and contributed to via rust. +It is not an attempt to rewrite the whole of Prism with rust. Currently an expariment to see if the process feels comfortable. + +Some of the initial decision will be wrong, some will feel like the "hard way" these are all nessacery to feel out the right and wrong way to go about it. diff --git a/launcher/hematite/build.rs b/launcher/hematite/build.rs new file mode 100644 index 0000000000..528216c93c --- /dev/null +++ b/launcher/hematite/build.rs @@ -0,0 +1,57 @@ +//Generated build.rs, modify as needed +use cxx_qt_build::{CxxQtBuilder, Interface}; +use std::path::PathBuf; + +const HEADER_DIR: &str = "hematite-static"; + +fn header_dir() -> PathBuf { + PathBuf::from(std::env::var("OUT_DIR").unwrap()) + .join("include") + .join(HEADER_DIR) +} + +fn write_headers() { + println!("cargo::rerun-if-changed=include/"); + std::fs::create_dir_all(header_dir()).expect("Failed to create include directory"); + + let headers = ["log.h"]; + + for file_path in headers { + println!("cargo::rerun-if-changed=include/{file_path}"); + std::fs::copy(format!("include/{file_path}"), header_dir().join(file_path)) + .expect("Failed to copy header file!"); + } +} + +fn main() { + write_headers(); + + let interface = Interface::default() + .export_include_directory(header_dir(), HEADER_DIR); + + let mut builder = CxxQtBuilder::library(interface); + + let cpp_files = ["src/log.cpp"]; + let rust_bridges = ["src/lib.rs", "src/log.rs"]; // files with cxx::bridge's + + for bridge in &rust_bridges { + builder = builder.file(bridge); + } + + builder = builder.cc_builder(move |cc| { + for cpp_file in &cpp_files { + cc.file(cpp_file); + println!("cargo::rerun-if-changed={cpp_file}"); + } + // additional includes? + // cc.include("../../"); + }); + + // TODO: not yet supported by cxx_qt + // builder = builder.initializer(qt_build_utils::Initializer { + // file: Some("src/init.cpp".into()), + // ..qt_build_utils::Initializer::default_signature("init_hematite_core") + // }); + + builder.build(); +} diff --git a/launcher/hematite/include/log.h b/launcher/hematite/include/log.h new file mode 100644 index 0000000000..cf1ab6e350 --- /dev/null +++ b/launcher/hematite/include/log.h @@ -0,0 +1,21 @@ +#pragma once + +#include +#include +#include + +#include "rust/cxx.h" + +Q_DECLARE_LOGGING_CATEGORY(hematiteLogC); + +namespace prism { +namespace hematite { +namespace log { + +void debug(rust::Str msg); +void warn(rust::Str msg); +void info(rust::Str msg); + +} // namespace log +} // namespace hematite +} // namespace prism diff --git a/launcher/hematite/src/init.cpp b/launcher/hematite/src/init.cpp new file mode 100644 index 0000000000..9c2912d4c4 --- /dev/null +++ b/launcher/hematite/src/init.cpp @@ -0,0 +1,37 @@ +#include + +// For versions less than Qt 6 we need to manually register the std numerics +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) +#include + +#include +#include + +extern "C" bool +init_hematite_core() +{ + static std::once_flag flag; + std::call_once(flag, []() { + // If we are using Qt 5 then register std numbers as a type for use in QML. + // + // See also: + // https://github.com/rust-lang/rust/issues/108081 + // https://github.com/KDAB/cxx-qt/pull/598 + + // call things like qRegisterMetaType(); + + }); + + return true; +} + +#else + +extern "C" bool +init_hematite_core() +{ + // Only needed for Qt5 + return true; +} + +#endif diff --git a/launcher/hematite/src/lib.rs b/launcher/hematite/src/lib.rs new file mode 100644 index 0000000000..4c3b3199ee --- /dev/null +++ b/launcher/hematite/src/lib.rs @@ -0,0 +1,138 @@ +use cxx_qt_lib::QList; +use qobject::QString; +use qobject::QStringList; +use serde::{Deserialize, Serialize}; +use std::fs; +use std::path::Path; + +pub mod log; + +serde_with::serde_conv!( + pub QStringListAsVecQString, + QStringList, + |qstringlist: &QStringList| -> Vec { + let qlist: QList = qstringlist.into(); + (&qlist).into() + }, + |vec: Vec| -> Result { + let qlist: QList = vec.into(); + Ok((&qlist).into()) + } +); + +/// The bridge definition for our QObject +#[cxx::bridge] +pub mod qobject { + + unsafe extern "C++" { + include!("cxx-qt-lib/qstring.h"); + include!("cxx-qt-lib/qstringlist.h"); + /// An alias to the QString type + type QString = cxx_qt_lib::QString; + type QStringList = cxx_qt_lib::QStringList; + } + + #[derive(Serialize, Deserialize)] + pub struct PackwizMod { + pub name: QString, + pub filename: QString, + pub side: Side, + #[serde(with = "serde_with::As::")] + pub loaders: QStringList, + + #[serde(with = "serde_with::As::")] + pub mc_versions: QStringList, + pub release_type: QString, + pub version_number: QString, + + pub download: Download, + pub update: Update, + } + + #[derive(Serialize, Deserialize)] + #[serde(rename_all = "lowercase")] + pub enum Side { + Client, + Server, + Both, + } + + #[derive(Serialize, Deserialize, Default)] + struct Download { + pub mode: QString, + pub url: QString, + pub hash: QString, + + #[serde(rename = "hash-format")] + pub hash_format: QString, + } + + #[derive(Serialize, Deserialize, Default)] + struct Update { + platform: QString, + mod_id: QString, + version: QString, + } + + #[namespace = "prism::hematite::serde"] + extern "Rust" { + fn load_packwiz_file(file_path: &QString) -> Result; + } +} + +fn load_packwiz_file(qfile_path: &QString) -> Result { + let file_path = qfile_path.to_string(); + let path = Path::new(&file_path); + + if !path.exists() { + return Err(format!("File not found: {}", file_path)); + } + + let file_content = fs::read_to_string(path).map_err(|e| e.to_string())?; + + let mut track = serde_path_to_error::Track::new(); + + let td = toml::Deserializer::new(&file_content); + let path = serde_path_to_error::Deserializer::new(td, &mut track); + + serde_ignored::deserialize(path, |path: serde_ignored::Path| { + tracing::warn!("Found ignored key: {path}"); + }) + .map_err(|e| { + let path = track.path().to_string(); + format!("TOML Error: path={path} | {e}",) + }) + + // Try parsing the content as JSON or TOML + // toml::from_str::(&file_content).map_err(|e| e.message().to_string()) +} + +impl Default for qobject::Side { + fn default() -> Self { + Self::Both + } +} + +#[derive(Serialize, Deserialize, Default)] +struct Modrinth { + mod_id: QString, + version: QString, +} + +#[derive(Serialize, Deserialize, Default)] +struct CurseForge { + project_id: QString, + file_id: QString, +} + +#[derive(Serialize, Deserialize, Debug)] +#[serde(tag = "type", content = "data")] +enum Platform { + #[serde(rename = "curseforge")] + CurseForge { + project_id: QString, + file_id: QString, + }, + #[serde(rename = "modrinth")] + Modrinth { mod_id: QString, version: QString }, +} diff --git a/launcher/hematite/src/log.cpp b/launcher/hematite/src/log.cpp new file mode 100644 index 0000000000..f383199b31 --- /dev/null +++ b/launcher/hematite/src/log.cpp @@ -0,0 +1,28 @@ +#include "hematite-static/log.h" +#include + +Q_LOGGING_CATEGORY(hematiteLogC, "launcher.hematite") + +namespace prism { +namespace hematite { +namespace log { + +void debug(rust::Str msg) +{ + QString qmsg = QString::fromUtf8(msg.data(), msg.size()); + qCDebug(hematiteLogC).noquote() << qmsg; +} +void warn(rust::Str msg) +{ + QString qmsg = QString::fromUtf8(msg.data(), msg.size()); + qCWarning(hematiteLogC).noquote() << qmsg; +} +void info(rust::Str msg) +{ + QString qmsg = QString::fromUtf8(msg.data(), msg.size()); + qCInfo(hematiteLogC).noquote() << qmsg; +} + +} // namespace log +} // namespace hematite +} // namespace prism diff --git a/launcher/hematite/src/log.rs b/launcher/hematite/src/log.rs new file mode 100644 index 0000000000..10b0090639 --- /dev/null +++ b/launcher/hematite/src/log.rs @@ -0,0 +1,83 @@ + +#[cxx::bridge] +pub mod ffi { + #[namespace = "prism::hematite::log"] + unsafe extern "C++" { + include!("hematite-static/log.h"); + fn debug(msg: &str); + fn warn(msg: &str); + fn info(msg: &str); + } + + #[namespace = "prism::hematite::log"] + extern "Rust" { + fn setup_rust_tracing_qdebug(); + } +} +fn setup_rust_tracing_qdebug() { + use tracing_subscriber::prelude::*; + tracing_subscriber::registry().with(QDebugLayer).init(); + tracing::info!( rust_enabled = true, "rust tracing qDebug subscriber registered", ); +} + +#[derive(Default)] +pub struct QDebugVisitor { + field_lines: Vec, +} + +impl QDebugVisitor { + pub fn lines(&self) -> String { + self.field_lines.join("\n") + } +} + +impl tracing::field::Visit for QDebugVisitor { + fn record_error( + &mut self, + field: &tracing::field::Field, + value: &(dyn std::error::Error + 'static), + ) { + self.field_lines + .push(format!(" field={} value=\"{}\"", field.name(), value)); + } + fn record_str(&mut self, field: &tracing::field::Field, value: &str) { + self.field_lines + .push(format!(" field={} value={:?}", field.name(), value)); + } + fn record_debug(&mut self, field: &tracing::field::Field, value: &dyn std::fmt::Debug) { + self.field_lines + .push(format!(" field={} value={:?}", field.name(), value)); + } +} + +pub struct QDebugLayer; +impl tracing_subscriber::Layer for QDebugLayer +where + S: tracing::Subscriber, +{ + fn on_event( + &self, + event: &tracing::Event<'_>, + _ctx: tracing_subscriber::layer::Context<'_, S>, + ) { + let mut msg = format!(" [{}] {} {}", + event.metadata().level(), + event.metadata().target(), + event.metadata().name() + ); + + let mut visitor = QDebugVisitor::default(); + event.record(&mut visitor); + let field_lines: String = visitor.lines(); + if !field_lines.is_empty() { + msg.push_str("\n "); + msg.push_str(&field_lines); + } + + match *event.metadata().level() { + tracing::Level::WARN => ffi::warn(&msg), + tracing::Level::INFO => ffi::info(&msg), + _ => ffi::debug(&msg), + } + } +} diff --git a/launcher/meta/BaseEntity.cpp b/launcher/meta/BaseEntity.cpp index b0e754ada9..6a912cba92 100644 --- a/launcher/meta/BaseEntity.cpp +++ b/launcher/meta/BaseEntity.cpp @@ -138,7 +138,7 @@ void BaseEntityLoadTask::executeTask() } } catch (const Exception& e) { - qDebug() << QString("Unable to parse file %1: %2").arg(fname, e.cause()); + qCritical() << QString("Unable to parse file %1: %2").arg(fname, e.cause()); // just make sure it's gone and we never consider it again. FS::deletePath(fname); m_entity->m_load_status = BaseEntity::LoadStatus::NotLoaded; @@ -167,10 +167,10 @@ void BaseEntityLoadTask::executeTask() m_task->addNetAction(dl); m_task->setAskRetry(false); connect(m_task.get(), &Task::failed, this, &BaseEntityLoadTask::emitFailed); - connect(m_task.get(), &Task::succeeded, this, &BaseEntityLoadTask::emitSucceeded); connect(m_task.get(), &Task::succeeded, this, [this]() { m_entity->m_load_status = BaseEntity::LoadStatus::Remote; m_entity->m_file_sha256 = m_entity->m_sha256; + emitSucceeded(); }); connect(m_task.get(), &Task::progress, this, &Task::setProgress); diff --git a/launcher/modplatform/packwiz/Packwiz.cpp b/launcher/modplatform/packwiz/Packwiz.cpp index a3bb74399e..a71bf8497b 100644 --- a/launcher/modplatform/packwiz/Packwiz.cpp +++ b/launcher/modplatform/packwiz/Packwiz.cpp @@ -23,7 +23,6 @@ #include #include #include -#include #include "FileSystem.h" #include "StringUtils.h" @@ -33,6 +32,8 @@ #include +#include "hematite_static/src/lib.cxx.h" + namespace Packwiz { auto getRealIndexName(const QDir& index_dir, QString normalized_fname, bool should_find_match) -> QString @@ -264,98 +265,57 @@ void V1::deleteModIndex(const QDir& index_dir, QVariant& mod_id) auto V1::getIndexForMod(const QDir& index_dir, QString slug) -> Mod { Mod mod; - - auto normalized_fname = indexFileName(slug); - auto real_fname = getRealIndexName(index_dir, normalized_fname, true); - if (real_fname.isEmpty()) - return {}; - - toml::table table; -#if TOML_EXCEPTIONS try { - table = toml::parse_file(StringUtils::toStdString(index_dir.absoluteFilePath(real_fname))); - } catch (const toml::parse_error& err) { - qWarning() << QString("Could not open file %1!").arg(normalized_fname); - qWarning() << "Reason: " << QString(err.what()); - return {}; - } -#else - toml::parse_result result = toml::parse_file(StringUtils::toStdString(index_dir.absoluteFilePath(real_fname))); - if (!result) { - qWarning() << QString("Could not open file %1!").arg(normalized_fname); - qWarning() << "Reason: " << result.error().description(); - return {}; - } - table = result.table(); -#endif - - // index_file.close(); - - mod.slug = slug; - - { // Basic info - mod.name = stringEntry(table, "name"); - mod.filename = stringEntry(table, "filename"); - mod.side = stringToSide(stringEntry(table, "side")); - mod.releaseType = ModPlatform::IndexedVersionType(table["x-prismlauncher-release-type"].value_or("")); - if (auto loaders = table["x-prismlauncher-loaders"]; loaders && loaders.is_array()) { - for (auto&& loader : *loaders.as_array()) { - if (loader.is_string()) { - mod.loaders |= ModPlatform::getModLoaderFromString(QString::fromStdString(loader.as_string()->value_or(""))); - } - } - } - if (auto versions = table["x-prismlauncher-mc-versions"]; versions && versions.is_array()) { - for (auto&& version : *versions.as_array()) { - if (version.is_string()) { - auto ver = QString::fromStdString(version.as_string()->value_or("")); - if (!ver.isEmpty()) { - mod.mcVersions << ver; - } - } - } - mod.mcVersions.sort(); - } - } - mod.version_number = table["x-prismlauncher-version-number"].value_or(""); - - { // [download] info - auto download_table = table["download"].as_table(); - if (!download_table) { - qCritical() << QString("No [download] section found on mod metadata!"); + auto normalized_fname = indexFileName(slug); + auto real_fname = getRealIndexName(index_dir, normalized_fname, true); + if (real_fname.isEmpty()) return {}; - } - mod.mode = stringEntry(*download_table, "mode"); - mod.url = stringEntry(*download_table, "url"); - mod.hash_format = stringEntry(*download_table, "hash-format"); - mod.hash = stringEntry(*download_table, "hash"); - } - - { // [update] info - using Provider = ModPlatform::ResourceProvider; + auto packwizMod = prism::hematite::serde::load_packwiz_file(index_dir.absoluteFilePath(real_fname)); + mod.slug = slug; + mod.name = packwizMod.name; + mod.filename = packwizMod.filename; + switch (packwizMod.side) { + case ::Side::Client: + mod.side = Side::ClientSide; + break; + case ::Side::Server: + mod.side = Side::ServerSide; + break; + case ::Side::Both: + mod.side = Side::UniversalSide; + break; + } - auto update_table = table["update"]; - if (!update_table || !update_table.is_table()) { - qCritical() << QString("No [update] section found on mod metadata!"); - return {}; + for (const auto& loader : packwizMod.loaders) { + mod.loaders |= ModPlatform::getModLoaderFromString(loader); } - toml::table* mod_provider_table = nullptr; - if ((mod_provider_table = update_table[ModPlatform::ProviderCapabilities::name(Provider::FLAME)].as_table())) { - mod.provider = Provider::FLAME; - mod.file_id = intEntry(*mod_provider_table, "file-id"); - mod.project_id = intEntry(*mod_provider_table, "project-id"); - } else if ((mod_provider_table = update_table[ModPlatform::ProviderCapabilities::name(Provider::MODRINTH)].as_table())) { - mod.provider = Provider::MODRINTH; - mod.mod_id() = stringEntry(*mod_provider_table, "mod-id"); - mod.version() = stringEntry(*mod_provider_table, "version"); - } else { - qCritical() << QString("No mod provider on mod metadata!"); - return {}; + for (const auto& mc_version : packwizMod.mc_versions) { + mod.mcVersions.append(mc_version); } - } + // Map release_type to IndexedVersionType if conversion logic exists + mod.releaseType = ModPlatform::IndexedVersionType(packwizMod.release_type); + + // Map download fields + mod.mode = packwizMod.download.mode; + mod.url = QUrl(packwizMod.download.url); + mod.hash_format = packwizMod.download.hash_format; + mod.hash = packwizMod.download.hash; + + // Map update fields + mod.provider = ModPlatform::ResourceProvider::MODRINTH; + if (packwizMod.update.platform == ModPlatform::ProviderCapabilities::name(ModPlatform::ResourceProvider::FLAME)) + mod.provider = ModPlatform::ResourceProvider::FLAME; + // else if (packwizMod.update.platform == "modrinth") + // mod.provider = ModPlatform::ResourceProvider::MODRINTH; + mod.file_id = packwizMod.update.version; + mod.project_id = packwizMod.update.mod_id; + mod.version_number = packwizMod.version_number; + } catch (const std::exception& e) { + qWarning() << "=================== " << e.what(); + } return mod; } diff --git a/launcher/net/ChecksumValidator.h b/launcher/net/ChecksumValidator.h index 7663d5d12b..5bdb8ec7ce 100644 --- a/launcher/net/ChecksumValidator.h +++ b/launcher/net/ChecksumValidator.h @@ -35,6 +35,7 @@ #pragma once +#include #include "Validator.h" #include @@ -72,7 +73,7 @@ class ChecksumValidator : public Validator { auto validate(QNetworkReply&) -> bool override { if (m_expected.size() && m_expected != hash()) { - qWarning() << "Checksum mismatch, download is bad."; + qCritical() << "Checksum mismatch, download is bad."; return false; } return true;