Merge branch 'main' of https://github.com/geode-sdk/geode into copy-mods
2
.github/actions/setup-dump-sym/action.yml
vendored
|
@ -5,7 +5,7 @@ inputs:
|
|||
dump_syms_version:
|
||||
description: "Revision of mozilla/dump_syms repository to fetch"
|
||||
required: true
|
||||
default: "v2.2.2"
|
||||
default: "v2.3.3"
|
||||
outputs:
|
||||
binary-path:
|
||||
description: "Path of the dump_syms utility, including the executable."
|
||||
|
|
1
.gitignore
vendored
|
@ -50,6 +50,7 @@ bin
|
|||
# Ignore docs folders
|
||||
docs/**
|
||||
docs
|
||||
docs-dist/
|
||||
|
||||
# Ignore codegenned files
|
||||
loader/src/internal/about.cpp
|
||||
|
|
26
CHANGELOG.md
|
@ -1,5 +1,31 @@
|
|||
# Geode Changelog
|
||||
|
||||
## v3.4.0
|
||||
* Add an API for modifying the Geode UI via events; see [the corresponding docs page](https://docs.geode-sdk.org/tutorials/modify-geode) (2a3c35f)
|
||||
* Add `openInfoPopup` overload that accepts a mod ID and can open both an installed mod page or a server page (028bbf9)
|
||||
* Add `LoadingSpinner` for creating loading circles easily (5c84012)
|
||||
* Add `TextInput::focus` and `TextInput::unfocus` (749fdf1)
|
||||
* MDTextArea changes: hex colors are now formatted as `<c-XXXXXX></c>`; added support for `<cc>`, `<cd>`, `<cf>`, and `<cs>`; fixed `mod:` links (028bbf9)
|
||||
* Deprecate `cc3x` (6080fdb)
|
||||
* Don't cancel subtasks on `Task` destructor (4b4bc0e)
|
||||
|
||||
## v3.3.1
|
||||
* Move ObjectDecoder and its delegate to Cocos headers (95f9eeb, dceb91e)
|
||||
* Fix weird behavior with textures, objects and more by changing en-US.utf8 locale to C (2cd1a9e)
|
||||
* Change all C number parsing to use `numFromString` to further remove the risk of this happening again (006ede8)
|
||||
|
||||
## v3.3.0
|
||||
* Update network libraries, fixing problems with old Wine versions (e26fe95)
|
||||
* Fix scale on mod logos for low quality (ba7b0fa)
|
||||
* Fix platform-specific dependencies by using CLI 3.2.0 (98f82ff)
|
||||
* Add `GEODE_DONT_USE_CCACHE` CMake option (2edfb71)
|
||||
* Remove now useless `std::hash` impl for `std::filesystem::path` on android (2b35e0e)
|
||||
* Implement custom window for showing crashlog on windows (4f32197)
|
||||
* Update docs version to show v3.0.0 (f86d4db)
|
||||
* Check hash for downloaded mods (61e000d)
|
||||
* Update chinese installer translation (#995, #997)
|
||||
* Update polish installer translation (#998)
|
||||
|
||||
## v3.2.0
|
||||
* Fix auto-updater on MacOS (d752bc2)
|
||||
* Use tasks for `FileSettingNode` (f94e95e)
|
||||
|
|
|
@ -88,42 +88,46 @@ endif()
|
|||
|
||||
project(geode-sdk VERSION ${GEODE_VERSION} LANGUAGES CXX C)
|
||||
|
||||
message(STATUS "Looking for ccache/sccache")
|
||||
if (DEFINED CMAKE_C_COMPILER_LAUNCHER OR DEFINED CMAKE_CXX_COMPILER_LAUNCHER)
|
||||
message(STATUS "Looking for ccache/sccache - detecting variant")
|
||||
if (DEFINED CMAKE_C_COMPILER_LAUNCHER AND DEFINED CMAKE_CXX_COMPILER_LAUNCHER AND
|
||||
CMAKE_C_COMPILER_LAUNCHER STREQUAL CMAKE_CXX_COMPILER_LAUNCHER)
|
||||
if (CMAKE_CXX_COMPILER_LAUNCHER MATCHES "sccache(|.exe)$")
|
||||
message(STATUS "Looking for ccache/sccache - detected sccache")
|
||||
set(GEODE_CCACHE_VARIANT "sccache")
|
||||
elseif(CMAKE_CXX_COMPILER_LAUNCHER MATCHES "ccache(|.exe)$")
|
||||
message(STATUS "Looking for ccache/sccache - detected ccache")
|
||||
set(GEODE_CCACHE_VARIANT "ccache")
|
||||
if (NOT GEODE_DONT_USE_CCACHE)
|
||||
message(STATUS "Looking for ccache/sccache")
|
||||
if (DEFINED CMAKE_C_COMPILER_LAUNCHER OR DEFINED CMAKE_CXX_COMPILER_LAUNCHER)
|
||||
message(STATUS "Looking for ccache/sccache - detecting variant")
|
||||
if (DEFINED CMAKE_C_COMPILER_LAUNCHER AND DEFINED CMAKE_CXX_COMPILER_LAUNCHER AND
|
||||
CMAKE_C_COMPILER_LAUNCHER STREQUAL CMAKE_CXX_COMPILER_LAUNCHER)
|
||||
if (CMAKE_CXX_COMPILER_LAUNCHER MATCHES "sccache(|.exe)$")
|
||||
message(STATUS "Looking for ccache/sccache - detected sccache")
|
||||
set(GEODE_CCACHE_VARIANT "sccache")
|
||||
elseif(CMAKE_CXX_COMPILER_LAUNCHER MATCHES "ccache(|.exe)$")
|
||||
message(STATUS "Looking for ccache/sccache - detected ccache")
|
||||
set(GEODE_CCACHE_VARIANT "ccache")
|
||||
else()
|
||||
message(STATUS "Looking for ccache/sccache - none (custom compiler launcher: {CMAKE_C_COMPILER_LAUNCHER}, {CMAKE_CXX_COMPILER_LAUNCHER})")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Looking for ccache/sccache - none (custom compiler launcher: {CMAKE_C_COMPILER_LAUNCHER}, {CMAKE_CXX_COMPILER_LAUNCHER})")
|
||||
message(STATUS "Looking for ccache/sccache - skipped (custom compiler launcher: {CMAKE_C_COMPILER_LAUNCHER}, {CMAKE_CXX_COMPILER_LAUNCHER})")
|
||||
endif()
|
||||
elseif (CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
message(STATUS "Looking for ccache/sccache - skipped (Visual Studio generator)")
|
||||
else()
|
||||
message(STATUS "Looking for ccache/sccache - skipped (custom compiler launcher: {CMAKE_C_COMPILER_LAUNCHER}, {CMAKE_CXX_COMPILER_LAUNCHER})")
|
||||
find_program(GEODE_CCACHE NAMES sccache ccache)
|
||||
if (GEODE_CCACHE)
|
||||
if (${GEODE_CCACHE} MATCHES "sccache(|.exe)$")
|
||||
set(GEODE_CCACHE_VARIANT "sccache")
|
||||
else()
|
||||
set(GEODE_CCACHE_VARIANT "ccache")
|
||||
endif()
|
||||
message(STATUS "Looking for ccache/sccache - found ${GEODE_CCACHE_VARIANT}")
|
||||
message(NOTICE "Compiler launcher not set but ccache/sccache was found. "
|
||||
"Setting compiler launcher to that")
|
||||
set(CMAKE_C_COMPILER_LAUNCHER ${GEODE_CCACHE})
|
||||
set(CMAKE_CXX_COMPILER_LAUNCHER ${GEODE_CCACHE})
|
||||
else()
|
||||
message(STATUS "Looking for ccache/sccache - not found")
|
||||
endif()
|
||||
unset(GEODE_CCACHE)
|
||||
endif()
|
||||
elseif (CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
message(STATUS "Looking for ccache/sccache - skipped (Visual Studio generator)")
|
||||
else()
|
||||
find_program(GEODE_CCACHE NAMES sccache ccache)
|
||||
if (GEODE_CCACHE)
|
||||
if (${GEODE_CCACHE} MATCHES "sccache(|.exe)$")
|
||||
set(GEODE_CCACHE_VARIANT "sccache")
|
||||
else()
|
||||
set(GEODE_CCACHE_VARIANT "ccache")
|
||||
endif()
|
||||
message(STATUS "Looking for ccache/sccache - found ${GEODE_CCACHE_VARIANT}")
|
||||
message(NOTICE "Compiler launcher not set but ccache/sccache was found. "
|
||||
"Setting compiler launcher to that")
|
||||
set(CMAKE_C_COMPILER_LAUNCHER ${GEODE_CCACHE})
|
||||
set(CMAKE_CXX_COMPILER_LAUNCHER ${GEODE_CCACHE})
|
||||
else()
|
||||
message(STATUS "Looking for ccache/sccache - not found")
|
||||
endif()
|
||||
unset(GEODE_CCACHE)
|
||||
message(STATUS "Not looking for ccache because GEODE_DONT_USE_CCACHE was ON")
|
||||
endif()
|
||||
|
||||
if (DEFINED GEODE_CCACHE_VARIANT)
|
||||
|
|
94
CODE_OF_CONDUCT.md
Normal file
|
@ -0,0 +1,94 @@
|
|||
|
||||
# Code of Conduct
|
||||
|
||||
## Notes
|
||||
|
||||
As an open source project, our policies are based on a Code of Conduct. Please
|
||||
make sure you read it before using our services. We expect everyone to follow
|
||||
the guidelines presented in this document.
|
||||
|
||||
## Our Pledge
|
||||
|
||||
We as members, contributors, and leaders pledge to make participation in our
|
||||
community a harassment-free experience for everyone, regardless of age, body
|
||||
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||
identity and expression, level of experience, education, socio-economic status,
|
||||
nationality, personal appearance, race, caste, color, religion, or sexual
|
||||
identity and orientation.
|
||||
|
||||
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||
diverse, inclusive, and healthy community.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to a positive environment for our
|
||||
community include:
|
||||
|
||||
* Demonstrating empathy and kindness toward other people
|
||||
* Being respectful of differing opinions, viewpoints, and experiences
|
||||
* Giving and gracefully accepting constructive feedback
|
||||
* Accepting responsibility and apologizing to those affected by our mistakes,
|
||||
and learning from the experience
|
||||
* Focusing on what is best not just for us as individuals, but for the overall
|
||||
community
|
||||
|
||||
Examples of unacceptable behavior include:
|
||||
|
||||
* The use of sexualized language or imagery, and sexual attention or advances of
|
||||
any kind
|
||||
* Trolling (antagonistic, inflammatory, insincere behaviour), insulting or
|
||||
derogatory comments, and personal or political attacks
|
||||
* Threats of violence or violent acts towards others
|
||||
* Public or private harassment
|
||||
* Intentionally dead-naming or misgendering others
|
||||
* Publishing others' private information, such as a physical or email address,
|
||||
without their explicit permission
|
||||
* Gatekeeping others' access to mental health or accessibility tools
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Enforcement Responsibilities
|
||||
|
||||
Community leaders are responsible for clarifying and enforcing our standards of
|
||||
acceptable behavior and will take appropriate and fair corrective action in
|
||||
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||
or harmful. Actions may range from a warning to permanent removal from the
|
||||
community.
|
||||
|
||||
Community leaders have the right and responsibility to remove, edit, or reject
|
||||
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||
decisions when appropriate.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all community spaces, and also applies when
|
||||
an individual is officially representing the community in public spaces.
|
||||
Examples of representing our community include using an official email address,
|
||||
posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported to the community leaders directly on Discord, or via a private message
|
||||
to the official Geode X account ([@GeodeSDK](https://x.com/GeodeSDK)). If your report concerns a specific
|
||||
community team member or group of community team members, please send your
|
||||
report to a team member that is not part of the report, or a member of the
|
||||
administrative board.
|
||||
|
||||
All complaints will be reviewed and investigated promptly and fairly. All
|
||||
community leaders are obligated to respect the privacy and security of the
|
||||
reporter of any incident.
|
||||
|
||||
## Changes & Feedback
|
||||
|
||||
Since the world is a dynamic place, this Code of Conduct may need changes. We
|
||||
reserve the right to update this Code of Conduct at any time.
|
||||
|
||||
We welcome feedback and suggestions. Feel free to open an issue on our
|
||||
[GitHub](https://github.com/geode-sdk/geode).
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant version 2.1](https://www.contributor-covenant.org/version/2/1/code_of_conduct.html), with inspirations taken from [Prism Launcher Code of Conduct](https://prismlauncher.org/wiki/overview/code-of-conduct/) and [QuiltMC Code of Conduct](https://quiltmc.org/en/community/code-of-conduct/).
|
2
VERSION
|
@ -1 +1 @@
|
|||
3.2.0
|
||||
3.4.0
|
|
@ -119,7 +119,16 @@ function(setup_geode_mod proname)
|
|||
endif()
|
||||
|
||||
# Check dependencies using CLI
|
||||
if (${GEODE_CLI_VERSION} VERSION_GREATER_EQUAL "2.0.0")
|
||||
if (${GEODE_CLI_VERSION} VERSION_GREATER_EQUAL "3.2.0")
|
||||
execute_process(
|
||||
COMMAND ${GEODE_CLI} project check ${CMAKE_CURRENT_BINARY_DIR}
|
||||
--externals ${GEODE_MODS_BEING_BUILT} ${DONT_UPDATE_INDEX_ARG}
|
||||
--platform ${GEODE_TARGET_PLATFORM_SHORT}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMAND_ERROR_IS_FATAL ANY
|
||||
)
|
||||
elseif (${GEODE_CLI_VERSION} VERSION_GREATER_EQUAL "2.0.0")
|
||||
message(WARNING "If you use platform-specific dependencies, upgrade Geode CLI to version 3.2.0 or greater!")
|
||||
execute_process(
|
||||
COMMAND ${GEODE_CLI} project check ${CMAKE_CURRENT_BINARY_DIR}
|
||||
--externals ${GEODE_MODS_BEING_BUILT} ${DONT_UPDATE_INDEX_ARG}
|
||||
|
|
|
@ -14,6 +14,12 @@ if (GEODE_TARGET_PLATFORM STREQUAL "iOS")
|
|||
set(GEODE_OUTPUT_NAME "Geode.ios")
|
||||
set(GEODE_PLATFORM_BINARY "Geode.ios.dylib")
|
||||
set(GEODE_MOD_BINARY_SUFFIX ".ios.dylib" CACHE STRING "" FORCE)
|
||||
|
||||
if (NOT ${PROJECT_NAME} STREQUAL ${CMAKE_PROJECT_NAME})
|
||||
set(GEODE_TARGET_PLATFORM_SHORT "ios" PARENT_SCOPE)
|
||||
else()
|
||||
set(GEODE_TARGET_PLATFORM_SHORT "ios")
|
||||
endif()
|
||||
elseif (GEODE_TARGET_PLATFORM STREQUAL "MacOS")
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
SYSTEM_NAME MacOS
|
||||
|
@ -49,6 +55,12 @@ elseif (GEODE_TARGET_PLATFORM STREQUAL "MacOS")
|
|||
set(GEODE_OUTPUT_NAME "Geode")
|
||||
set(GEODE_PLATFORM_BINARY "Geode.dylib")
|
||||
set(GEODE_MOD_BINARY_SUFFIX ".dylib" CACHE STRING "" FORCE)
|
||||
|
||||
if (NOT ${PROJECT_NAME} STREQUAL ${CMAKE_PROJECT_NAME})
|
||||
set(GEODE_TARGET_PLATFORM_SHORT "mac" PARENT_SCOPE)
|
||||
else()
|
||||
set(GEODE_TARGET_PLATFORM_SHORT "mac")
|
||||
endif()
|
||||
elseif (GEODE_TARGET_PLATFORM STREQUAL "Win64")
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
SYSTEM_NAME Win64
|
||||
|
@ -77,6 +89,12 @@ elseif (GEODE_TARGET_PLATFORM STREQUAL "Win64")
|
|||
set(GEODE_OUTPUT_NAME "Geode")
|
||||
set(GEODE_PLATFORM_BINARY "Geode.lib")
|
||||
set(GEODE_MOD_BINARY_SUFFIX ".dll" CACHE STRING "" FORCE)
|
||||
|
||||
if (NOT ${PROJECT_NAME} STREQUAL ${CMAKE_PROJECT_NAME})
|
||||
set(GEODE_TARGET_PLATFORM_SHORT "win" PARENT_SCOPE)
|
||||
else()
|
||||
set(GEODE_TARGET_PLATFORM_SHORT "win")
|
||||
endif()
|
||||
elseif (GEODE_TARGET_PLATFORM STREQUAL "Android32")
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
SYSTEM_NAME Android
|
||||
|
@ -101,6 +119,12 @@ elseif (GEODE_TARGET_PLATFORM STREQUAL "Android32")
|
|||
set(GEODE_OUTPUT_NAME "Geode.android32")
|
||||
set(GEODE_PLATFORM_BINARY "Geode.android32.so")
|
||||
set(GEODE_MOD_BINARY_SUFFIX ".android32.so" CACHE STRING "" FORCE)
|
||||
|
||||
if (NOT ${PROJECT_NAME} STREQUAL ${CMAKE_PROJECT_NAME})
|
||||
set(GEODE_TARGET_PLATFORM_SHORT "android32" PARENT_SCOPE)
|
||||
else()
|
||||
set(GEODE_TARGET_PLATFORM_SHORT "android32")
|
||||
endif()
|
||||
elseif (GEODE_TARGET_PLATFORM STREQUAL "Android64")
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
SYSTEM_NAME Android
|
||||
|
@ -130,6 +154,12 @@ elseif (GEODE_TARGET_PLATFORM STREQUAL "Android64")
|
|||
set(GEODE_OUTPUT_NAME "Geode.android64")
|
||||
set(GEODE_PLATFORM_BINARY "Geode.android64.so")
|
||||
set(GEODE_MOD_BINARY_SUFFIX ".android64.so" CACHE STRING "" FORCE)
|
||||
|
||||
if (NOT ${PROJECT_NAME} STREQUAL ${CMAKE_PROJECT_NAME})
|
||||
set(GEODE_TARGET_PLATFORM_SHORT "android64" PARENT_SCOPE)
|
||||
else()
|
||||
set(GEODE_TARGET_PLATFORM_SHORT "android64")
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR "Unknown platform ${GEODE_TARGET_PLATFORM}")
|
||||
endif()
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
|
||||
# Configuration file for the Flash C++ documentation generator.
|
||||
# https://github.com/hjfod/flash
|
||||
# https://github.com/geode-sdk/flash
|
||||
|
||||
[project]
|
||||
name = "Geode"
|
||||
version = "v1.0.0"
|
||||
version = "v3.0.0"
|
||||
repository = "https://github.com/geode-sdk/geode"
|
||||
tree = "https://github.com/geode-sdk/geode/tree/main"
|
||||
icon = "loader/resources/logos/geode-circle.png"
|
||||
|
|
|
@ -8,7 +8,7 @@ ${LangFileString} MUI_UNTEXT_WELCOME_INFO_TEXT "このセットアップは$(^Na
|
|||
; installer
|
||||
|
||||
${LangFileString} GEODE_TEXT_GD_MISSING "$\r$\n$\r$\nこのパスにはGeometry Dashがインストールされていません!"
|
||||
${LangFileString} GEODE_TEXT_GD_OLD "$\r$\n$\r$\nYour version of Geometry Dash is too old for this version of Geode!"
|
||||
${LangFileString} GEODE_TEXT_GD_OLD "$\r$\n$\r$\nGeometry DashのバージョンはこのGeodeのバージョンには古すぎます!"
|
||||
${LangFileString} GEODE_TEXT_MOD_LOADER_ALREADY_INSTALLED "このパスには他のモッドがインストールされています!$\r$\nそれらはGeodeによって上書きされます。(the dll trademark)"
|
||||
|
||||
; uninstaller
|
||||
|
|
|
@ -8,7 +8,7 @@ ${LangFileString} MUI_UNTEXT_WELCOME_INFO_TEXT "Instalator przeprowadzi Cię prz
|
|||
; installer
|
||||
|
||||
${LangFileString} GEODE_TEXT_GD_MISSING "$\r$\n$\r$\nGeometry Dash nie jest zainstalowane w tym folderze!"
|
||||
${LangFileString} GEODE_TEXT_GD_OLD "$\r$\n$\r$\nYour version of Geometry Dash is too old for this version of Geode!"
|
||||
${LangFileString} GEODE_TEXT_GD_OLD "$\r$\n$\r$\nTwoja wersja Geometry Dash jest zbyt stara dla tej wersji Geode!"
|
||||
${LangFileString} GEODE_TEXT_MOD_LOADER_ALREADY_INSTALLED "W tym folderze zainstalowane są inne modyfikacje!$\r$\nZostaną one zastąpione przez Geode. (the dll trademark)"
|
||||
|
||||
; uninstaller
|
||||
|
|
|
@ -8,8 +8,8 @@ ${LangFileString} MUI_UNTEXT_WELCOME_INFO_TEXT "Setup会帮您卸载$(^NameDA)
|
|||
; installer
|
||||
|
||||
${LangFileString} GEODE_TEXT_GD_MISSING "$\r$\n$\r$\nGeometry Dash不在这文件夹,请再试一遍!"
|
||||
${LangFileString} GEODE_TEXT_GD_OLD "$\r$\n$\r$\nYour version of Geometry Dash is too old for this version of Geode!"
|
||||
${LangFileString} GEODE_TEXT_MOD_LOADER_ALREADY_INSTALLED "This path has other mods installed!$\r$\nThey will be overwritten by Geode. (the dll trademark)"
|
||||
${LangFileString} GEODE_TEXT_GD_OLD "$\r$\n$\r$\n您的Geometry Dash版本太旧了,不适合Geode的版本!"
|
||||
${LangFileString} GEODE_TEXT_MOD_LOADER_ALREADY_INSTALLED "这文件夹已经安装了不同的游戏修改器加载器!$\r$\nGeode会改写那些游戏修改器加载器。 (the dll trademark)"
|
||||
|
||||
; uninstaller
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@ ${LangFileString} MUI_UNTEXT_WELCOME_INFO_TEXT "Setup會幫您卸載$(^NameDA)
|
|||
; installer
|
||||
|
||||
${LangFileString} GEODE_TEXT_GD_MISSING "$\r$\n$\r$\nGeometry Dash不在這文件夾,請再試一遍!"
|
||||
${LangFileString} GEODE_TEXT_GD_OLD "$\r$\n$\r$\nYour version of Geometry Dash is too old for this version of Geode!"
|
||||
${LangFileString} GEODE_TEXT_MOD_LOADER_ALREADY_INSTALLED "This path has other mods installed!$\r$\nThey will be overwritten by Geode. (the dll trademark)"
|
||||
${LangFileString} GEODE_TEXT_GD_OLD "$\r$\n$\r$\n您的Geometry Dash版本太舊了,不適合Geode的版本!"
|
||||
${LangFileString} GEODE_TEXT_MOD_LOADER_ALREADY_INSTALLED "這文件夾已經安裝了不同的遊戲修改器加載器!$\r$\nGeode會改寫那些遊戲修改器加載器。 (the dll trademark)"
|
||||
|
||||
; uninstaller
|
||||
|
||||
|
|
|
@ -249,7 +249,7 @@ if (NOT GEODE_BUILDING_DOCS)
|
|||
set(MZ_FETCH_LIBS ON CACHE INTERNAL "" FORCE)
|
||||
set(MZ_FORCE_FETCH_LIBS ${WIN32} CACHE INTERNAL "")
|
||||
set(SKIP_INSTALL_ALL ON CACHE INTERNAL "")
|
||||
CPMAddPackage("gh:geode-sdk/minizip-ng#7548419")
|
||||
CPMAddPackage("gh:geode-sdk/minizip-ng#43d9254")
|
||||
if (WIN32)
|
||||
set_target_properties(zlib PROPERTIES SUFFIX "1.dll")
|
||||
endif()
|
||||
|
@ -335,7 +335,9 @@ if (APPLE)
|
|||
elseif (WIN32)
|
||||
add_subdirectory(launcher/windows)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} dbghelp)
|
||||
target_link_libraries(${PROJECT_NAME} dbghelp winmm)
|
||||
|
||||
target_compile_definitions(${PROJECT_NAME} PUBLIC ISOLATION_AWARE_ENABLED=1)
|
||||
|
||||
if (MSVC)
|
||||
# disable warnings about CCNode::setID
|
||||
|
|
|
@ -52,6 +52,8 @@ std::string calculateSHA256Text(std::filesystem::path const& path) {
|
|||
return picosha2::bytes_to_hex_string(hash.begin(), hash.end());
|
||||
}
|
||||
|
||||
std::string calculateHash(std::filesystem::path const& path) {
|
||||
return calculateSHA3_256(path);
|
||||
std::string calculateHash(std::span<const uint8_t> data) {
|
||||
std::vector<uint8_t> hash(picosha2::k_digest_size);
|
||||
picosha2::hash256(data.begin(), data.end(), hash);
|
||||
return picosha2::bytes_to_hex_string(hash.begin(), hash.end());
|
||||
}
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <string>
|
||||
#include <filesystem>
|
||||
#include <span>
|
||||
|
||||
std::string calculateSHA3_256(std::filesystem::path const& path);
|
||||
|
||||
|
@ -9,4 +10,8 @@ std::string calculateSHA256(std::filesystem::path const& path);
|
|||
|
||||
std::string calculateSHA256Text(std::filesystem::path const& path);
|
||||
|
||||
std::string calculateHash(std::filesystem::path const& path);
|
||||
/**
|
||||
* Calculates the SHA256 hash of the given data,
|
||||
* used for verifying mods.
|
||||
*/
|
||||
std::string calculateHash(std::span<const uint8_t> data);
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace geode::stl {
|
|||
}
|
||||
|
||||
namespace gd {
|
||||
#if defined(GEODE_IS_MACOS) || defined(GEODE_IS_WINDOWS)
|
||||
#if defined(GEODE_IS_MACOS) || defined(GEODE_IS_WINDOWS) || defined(GEODE_IS_IOS)
|
||||
// rob uses libc++ now! this will prob work fine
|
||||
using string = std::string;
|
||||
|
||||
|
@ -66,6 +66,7 @@ namespace gd {
|
|||
string(string const&);
|
||||
// string(string&&);
|
||||
string(char const*);
|
||||
string(char const*, size_t);
|
||||
string(std::string const&);
|
||||
// tried to add a string_view ctor, but got overload errors :(
|
||||
~string();
|
||||
|
|
4
loader/include/Geode/cocos/cocoa/CCArray.h
vendored
|
@ -186,7 +186,7 @@ public:
|
|||
* Returns first element, or null if empty
|
||||
* @note Geode addition
|
||||
*/
|
||||
CCObject* firstObject();
|
||||
GEODE_DLL CCObject* firstObject();
|
||||
/** Returns last element */
|
||||
CCObject* lastObject();
|
||||
/** Returns a random element */
|
||||
|
@ -215,7 +215,7 @@ public:
|
|||
* Remove first object, or do nothing if array is empty
|
||||
* @note Geode addition
|
||||
*/
|
||||
void removeFirstObject(bool bReleaseObj = true);
|
||||
GEODE_DLL void removeFirstObject(bool bReleaseObj = true);
|
||||
/** Remove last object */
|
||||
void removeLastObject(bool bReleaseObj = true);
|
||||
/** Remove a certain object */
|
||||
|
|
1
loader/include/Geode/cocos/include/cocos2d.h
vendored
|
@ -326,6 +326,7 @@ THE SOFTWARE.
|
|||
#include "../robtop/scene_nodes/CCSceneTransitionDelegate.h"
|
||||
|
||||
#include "../robtop/xml/DS_Dictionary.h"
|
||||
#include "../robtop/xml/ObjectDecoder.h"
|
||||
|
||||
// #include "../robtop/glfw/glfw3.h"
|
||||
|
||||
|
|
|
@ -265,6 +265,9 @@ protected:
|
|||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
public:
|
||||
// @note RobTop Addition
|
||||
virtual void updateEmissionRate();
|
||||
|
||||
// mode A
|
||||
virtual const CCPoint& getGravity();
|
||||
virtual void setGravity(const CCPoint& g);
|
||||
|
@ -630,9 +633,6 @@ public:
|
|||
void toggleUniformColorMode(bool);
|
||||
// @note RobTop Addition
|
||||
void updateVisible();
|
||||
|
||||
// @note RobTop Addition
|
||||
virtual void updateEmissionRate();
|
||||
};
|
||||
|
||||
// end of particle_nodes group
|
||||
|
|
|
@ -165,7 +165,7 @@ public:
|
|||
@since v2.1
|
||||
@note Robtop Addition: added a bool parameter
|
||||
*/
|
||||
virtual gd::string fullPathForFilename(const char* pszFileName, bool);
|
||||
virtual gd::string fullPathForFilename(const char* pszFileName, bool skipSuffix);
|
||||
|
||||
// @note RobTop Addition
|
||||
virtual void removeFullPath(const char* path);
|
||||
|
|
|
@ -42,6 +42,8 @@ NS_CC_BEGIN
|
|||
class CC_DLL CCFileUtilsAndroid : public CCFileUtils
|
||||
{
|
||||
GEODE_FRIEND_MODIFY
|
||||
GEODE_CUSTOM_CONSTRUCTOR_COCOS(CCFileUtilsAndroid, CCFileUtils)
|
||||
|
||||
friend class CCFileUtils;
|
||||
CCFileUtilsAndroid();
|
||||
public:
|
||||
|
|
29
loader/include/Geode/cocos/robtop/xml/ObjectDecoder.h
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
#ifndef __OBJECTDECODER_H__
|
||||
#define __OBJECTDECODER_H__
|
||||
|
||||
#include "../../include/cocos2d.h"
|
||||
|
||||
// @note RobTop Addition
|
||||
class CC_DLL ObjectDecoderDelegate {
|
||||
public:
|
||||
virtual cocos2d::CCObject* getDecodedObject(int objectType, DS_Dictionary* data) { return nullptr; }
|
||||
};
|
||||
|
||||
// @note RobTop Addition
|
||||
class CC_DLL ObjectDecoder : public cocos2d::CCNode {
|
||||
public:
|
||||
ObjectDecoder();
|
||||
~ObjectDecoder() {}
|
||||
GEODE_CUSTOM_CONSTRUCTOR_BEGIN(ObjectDecoder)
|
||||
|
||||
static ObjectDecoder* sharedDecoder();
|
||||
|
||||
cocos2d::CCObject* getDecodedObject(int, DS_Dictionary*);
|
||||
|
||||
virtual bool init();
|
||||
|
||||
public:
|
||||
ObjectDecoderDelegate* m_delegate;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -107,6 +107,7 @@ public:
|
|||
* @lua NA
|
||||
*/
|
||||
CCGLProgram();
|
||||
GEODE_CUSTOM_CONSTRUCTOR_COCOS(CCGLProgram, CCObject);
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
|
|
11
loader/include/Geode/fmod/fmod.h
vendored
|
@ -1,12 +1,12 @@
|
|||
/* ======================================================================================== */
|
||||
/* FMOD Core API - C header file. */
|
||||
/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2020. */
|
||||
/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2024. */
|
||||
/* */
|
||||
/* Use this header in conjunction with fmod_common.h (which contains all the constants / */
|
||||
/* callbacks) to develop using the C interface */
|
||||
/* */
|
||||
/* For more detail visit: */
|
||||
/* https://fmod.com/resources/documentation-api?version=2.0&page=core-api.html */
|
||||
/* https://fmod.com/docs/2.02/api/core-api.html */
|
||||
/* ======================================================================================== */
|
||||
|
||||
#ifndef _FMOD_H
|
||||
|
@ -27,11 +27,12 @@ FMOD_RESULT F_API FMOD_Memory_GetStats (int *currentalloced, int *ma
|
|||
FMOD_RESULT F_API FMOD_Debug_Initialize (FMOD_DEBUG_FLAGS flags, FMOD_DEBUG_MODE mode, FMOD_DEBUG_CALLBACK callback, const char *filename);
|
||||
FMOD_RESULT F_API FMOD_File_SetDiskBusy (int busy);
|
||||
FMOD_RESULT F_API FMOD_File_GetDiskBusy (int *busy);
|
||||
FMOD_RESULT F_API FMOD_Thread_SetAttributes (FMOD_THREAD_TYPE type, FMOD_THREAD_AFFINITY affinity, FMOD_THREAD_PRIORITY priority, FMOD_THREAD_STACK_SIZE stacksize);
|
||||
|
||||
/*
|
||||
FMOD System factory functions. Use this to create an FMOD System Instance. below you will see FMOD_System_Init/Close to get started.
|
||||
*/
|
||||
FMOD_RESULT /*F_API*/ FMOD_System_Create (FMOD_SYSTEM **system);
|
||||
FMOD_RESULT F_API FMOD_System_Create (FMOD_SYSTEM **system, unsigned int headerversion);
|
||||
FMOD_RESULT F_API FMOD_System_Release (FMOD_SYSTEM *system);
|
||||
|
||||
/*
|
||||
|
@ -100,7 +101,7 @@ FMOD_RESULT F_API FMOD_System_GetSpeakerModeChannels (FMOD_SYSTEM *system, FM
|
|||
FMOD_RESULT F_API FMOD_System_GetVersion (FMOD_SYSTEM *system, unsigned int *version);
|
||||
FMOD_RESULT F_API FMOD_System_GetOutputHandle (FMOD_SYSTEM *system, void **handle);
|
||||
FMOD_RESULT F_API FMOD_System_GetChannelsPlaying (FMOD_SYSTEM *system, int *channels, int *realchannels);
|
||||
FMOD_RESULT F_API FMOD_System_GetCPUUsage (FMOD_SYSTEM *system, float *dsp, float *stream, float *geometry, float *update, float *total);
|
||||
FMOD_RESULT F_API FMOD_System_GetCPUUsage (FMOD_SYSTEM *system, FMOD_CPU_USAGE *usage);
|
||||
FMOD_RESULT F_API FMOD_System_GetFileUsage (FMOD_SYSTEM *system, long long *sampleBytesRead, long long *streamBytesRead, long long *otherBytesRead);
|
||||
|
||||
/* Sound/DSP/Channel/FX creation and retrieval. */
|
||||
|
@ -114,6 +115,7 @@ FMOD_RESULT F_API FMOD_System_CreateReverb3D (FMOD_SYSTEM *system, FM
|
|||
FMOD_RESULT F_API FMOD_System_PlaySound (FMOD_SYSTEM *system, FMOD_SOUND *sound, FMOD_CHANNELGROUP *channelgroup, FMOD_BOOL paused, FMOD_CHANNEL **channel);
|
||||
FMOD_RESULT F_API FMOD_System_PlayDSP (FMOD_SYSTEM *system, FMOD_DSP *dsp, FMOD_CHANNELGROUP *channelgroup, FMOD_BOOL paused, FMOD_CHANNEL **channel);
|
||||
FMOD_RESULT F_API FMOD_System_GetChannel (FMOD_SYSTEM *system, int channelid, FMOD_CHANNEL **channel);
|
||||
FMOD_RESULT F_API FMOD_System_GetDSPInfoByType (FMOD_SYSTEM *system, FMOD_DSP_TYPE type, const FMOD_DSP_DESCRIPTION **description);
|
||||
FMOD_RESULT F_API FMOD_System_GetMasterChannelGroup (FMOD_SYSTEM *system, FMOD_CHANNELGROUP **channelgroup);
|
||||
FMOD_RESULT F_API FMOD_System_GetMasterSoundGroup (FMOD_SYSTEM *system, FMOD_SOUNDGROUP **soundgroup);
|
||||
|
||||
|
@ -533,6 +535,7 @@ FMOD_RESULT F_API FMOD_DSP_SetChannelFormat (FMOD_DSP *dsp, FMOD_CHA
|
|||
FMOD_RESULT F_API FMOD_DSP_GetChannelFormat (FMOD_DSP *dsp, FMOD_CHANNELMASK *channelmask, int *numchannels, FMOD_SPEAKERMODE *source_speakermode);
|
||||
FMOD_RESULT F_API FMOD_DSP_GetOutputChannelFormat (FMOD_DSP *dsp, FMOD_CHANNELMASK inmask, int inchannels, FMOD_SPEAKERMODE inspeakermode, FMOD_CHANNELMASK *outmask, int *outchannels, FMOD_SPEAKERMODE *outspeakermode);
|
||||
FMOD_RESULT F_API FMOD_DSP_Reset (FMOD_DSP *dsp);
|
||||
FMOD_RESULT F_API FMOD_DSP_SetCallback (FMOD_DSP *dsp, FMOD_DSP_CALLBACK callback);
|
||||
|
||||
/*
|
||||
DSP parameter control.
|
||||
|
|
11
loader/include/Geode/fmod/fmod.hpp
vendored
|
@ -1,12 +1,12 @@
|
|||
/* ======================================================================================== */
|
||||
/* FMOD Core API - C++ header file. */
|
||||
/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2020. */
|
||||
/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2024. */
|
||||
/* */
|
||||
/* Use this header in conjunction with fmod_common.h (which contains all the constants / */
|
||||
/* callbacks) to develop using the C++ language. */
|
||||
/* */
|
||||
/* For more detail visit: */
|
||||
/* https://fmod.com/resources/documentation-api?version=2.0&page=core-api.html */
|
||||
/* https://fmod.com/docs/2.02/api/core-api.html */
|
||||
/* ======================================================================================== */
|
||||
#ifndef _FMOD_HPP
|
||||
#define _FMOD_HPP
|
||||
|
@ -38,11 +38,12 @@ namespace FMOD
|
|||
inline FMOD_RESULT Debug_Initialize (FMOD_DEBUG_FLAGS flags, FMOD_DEBUG_MODE mode = FMOD_DEBUG_MODE_TTY, FMOD_DEBUG_CALLBACK callback = 0, const char *filename = 0) { return FMOD_Debug_Initialize(flags, mode, callback, filename); }
|
||||
inline FMOD_RESULT File_SetDiskBusy (int busy) { return FMOD_File_SetDiskBusy(busy); }
|
||||
inline FMOD_RESULT File_GetDiskBusy (int *busy) { return FMOD_File_GetDiskBusy(busy); }
|
||||
inline FMOD_RESULT Thread_SetAttributes (FMOD_THREAD_TYPE type, FMOD_THREAD_AFFINITY affinity = FMOD_THREAD_AFFINITY_GROUP_DEFAULT, FMOD_THREAD_PRIORITY priority = FMOD_THREAD_PRIORITY_DEFAULT, FMOD_THREAD_STACK_SIZE stacksize = FMOD_THREAD_STACK_SIZE_DEFAULT) { return FMOD_Thread_SetAttributes(type, affinity, priority, stacksize); }
|
||||
|
||||
/*
|
||||
FMOD System factory functions.
|
||||
*/
|
||||
inline FMOD_RESULT System_Create (System **system) { return FMOD_System_Create((FMOD_SYSTEM **)system); }
|
||||
inline FMOD_RESULT System_Create (System **system, unsigned int headerversion = FMOD_VERSION) { return FMOD_System_Create((FMOD_SYSTEM **)system, headerversion); }
|
||||
|
||||
/*
|
||||
'System' API
|
||||
|
@ -122,7 +123,7 @@ namespace FMOD
|
|||
FMOD_RESULT F_API getVersion (unsigned int *version);
|
||||
FMOD_RESULT F_API getOutputHandle (void **handle);
|
||||
FMOD_RESULT F_API getChannelsPlaying (int *channels, int *realchannels = 0);
|
||||
FMOD_RESULT F_API getCPUUsage (float *dsp, float *stream, float *geometry, float *update, float *total);
|
||||
FMOD_RESULT F_API getCPUUsage (FMOD_CPU_USAGE *usage);
|
||||
FMOD_RESULT F_API getFileUsage (long long *sampleBytesRead, long long *streamBytesRead, long long *otherBytesRead);
|
||||
|
||||
// Sound/DSP/Channel/FX creation and retrieval.
|
||||
|
@ -137,6 +138,7 @@ namespace FMOD
|
|||
FMOD_RESULT F_API playSound (Sound *sound, ChannelGroup *channelgroup, bool paused, Channel **channel);
|
||||
FMOD_RESULT F_API playDSP (DSP *dsp, ChannelGroup *channelgroup, bool paused, Channel **channel);
|
||||
FMOD_RESULT F_API getChannel (int channelid, Channel **channel);
|
||||
FMOD_RESULT F_API getDSPInfoByType (FMOD_DSP_TYPE type, const FMOD_DSP_DESCRIPTION **description);
|
||||
FMOD_RESULT F_API getMasterChannelGroup (ChannelGroup **channelgroup);
|
||||
FMOD_RESULT F_API getMasterSoundGroup (SoundGroup **soundgroup);
|
||||
|
||||
|
@ -471,6 +473,7 @@ namespace FMOD
|
|||
FMOD_RESULT F_API getChannelFormat (FMOD_CHANNELMASK *channelmask, int *numchannels, FMOD_SPEAKERMODE *source_speakermode);
|
||||
FMOD_RESULT F_API getOutputChannelFormat (FMOD_CHANNELMASK inmask, int inchannels, FMOD_SPEAKERMODE inspeakermode, FMOD_CHANNELMASK *outmask, int *outchannels, FMOD_SPEAKERMODE *outspeakermode);
|
||||
FMOD_RESULT F_API reset ();
|
||||
FMOD_RESULT F_API setCallback (FMOD_DSP_CALLBACK callback);
|
||||
|
||||
// DSP parameter control.
|
||||
FMOD_RESULT F_API setParameterFloat (int index, float value);
|
||||
|
|
7
loader/include/Geode/fmod/fmod_android.h
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "fmod_common.h"
|
||||
#include <jni.h>
|
||||
|
||||
extern "C" FMOD_RESULT F_API FMOD_Android_JNI_Init(JavaVM *vm, jobject javaActivity);
|
||||
extern "C" FMOD_RESULT F_API FMOD_Android_JNI_Close();
|
71
loader/include/Geode/fmod/fmod_codec.h
vendored
|
@ -1,6 +1,6 @@
|
|||
/* ======================================================================================== */
|
||||
/* FMOD Core API - Codec development header file. */
|
||||
/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2020. */
|
||||
/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2024. */
|
||||
/* */
|
||||
/* Use this header if you are wanting to develop your own file format plugin to use with */
|
||||
/* FMOD's codec system. With this header you can make your own fileformat plugin that FMOD */
|
||||
|
@ -8,7 +8,7 @@
|
|||
/* plugin. */
|
||||
/* */
|
||||
/* For more detail visit: */
|
||||
/* https://fmod.com/resources/documentation-api?version=2.0&page=core-api.html */
|
||||
/* https://fmod.com/docs/2.02/api/core-api.html */
|
||||
/* ======================================================================================== */
|
||||
#ifndef _FMOD_CODEC_H
|
||||
#define _FMOD_CODEC_H
|
||||
|
@ -22,7 +22,12 @@ typedef struct FMOD_CODEC_WAVEFORMAT FMOD_CODEC_WAVEFORMAT;
|
|||
/*
|
||||
Codec constants
|
||||
*/
|
||||
#define FMOD_CODEC_WAVEFORMAT_VERSION 3
|
||||
#define FMOD_CODEC_PLUGIN_VERSION 1
|
||||
|
||||
typedef int FMOD_CODEC_SEEK_METHOD;
|
||||
#define FMOD_CODEC_SEEK_METHOD_SET 0
|
||||
#define FMOD_CODEC_SEEK_METHOD_CURRENT 1
|
||||
#define FMOD_CODEC_SEEK_METHOD_END 2
|
||||
|
||||
/*
|
||||
Codec callbacks
|
||||
|
@ -34,14 +39,27 @@ typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_GETLENGTH_CALLBACK) (FMOD_CODEC_S
|
|||
typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_SETPOSITION_CALLBACK) (FMOD_CODEC_STATE *codec_state, int subsound, unsigned int position, FMOD_TIMEUNIT postype);
|
||||
typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_GETPOSITION_CALLBACK) (FMOD_CODEC_STATE *codec_state, unsigned int *position, FMOD_TIMEUNIT postype);
|
||||
typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_SOUNDCREATE_CALLBACK) (FMOD_CODEC_STATE *codec_state, int subsound, FMOD_SOUND *sound);
|
||||
typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_METADATA_CALLBACK) (FMOD_CODEC_STATE *codec_state, FMOD_TAGTYPE tagtype, char *name, void *data, unsigned int datalen, FMOD_TAGDATATYPE datatype, int unique);
|
||||
typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_GETWAVEFORMAT_CALLBACK)(FMOD_CODEC_STATE *codec_state, int index, FMOD_CODEC_WAVEFORMAT *waveformat);
|
||||
|
||||
/*
|
||||
Codec functions
|
||||
*/
|
||||
typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_METADATA_FUNC) (FMOD_CODEC_STATE *codec_state, FMOD_TAGTYPE tagtype, char *name, void *data, unsigned int datalen, FMOD_TAGDATATYPE datatype, int unique);
|
||||
typedef void * (F_CALLBACK *FMOD_CODEC_ALLOC_FUNC) (unsigned int size, unsigned int align, const char *file, int line);
|
||||
typedef void (F_CALLBACK *FMOD_CODEC_FREE_FUNC) (void *ptr, const char *file, int line);
|
||||
typedef void (F_CALLBACK *FMOD_CODEC_LOG_FUNC) (FMOD_DEBUG_FLAGS level, const char *file, int line, const char *function, const char *string, ...);
|
||||
|
||||
typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_FILE_READ_FUNC) (FMOD_CODEC_STATE *codec_state, void *buffer, unsigned int sizebytes, unsigned int *bytesread);
|
||||
typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_FILE_SEEK_FUNC) (FMOD_CODEC_STATE *codec_state, unsigned int pos, FMOD_CODEC_SEEK_METHOD method);
|
||||
typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_FILE_TELL_FUNC) (FMOD_CODEC_STATE *codec_state, unsigned int *pos);
|
||||
typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_FILE_SIZE_FUNC) (FMOD_CODEC_STATE *codec_state, unsigned int *size);
|
||||
|
||||
/*
|
||||
Codec structures
|
||||
*/
|
||||
typedef struct FMOD_CODEC_DESCRIPTION
|
||||
{
|
||||
unsigned int apiversion;
|
||||
const char *name;
|
||||
unsigned int version;
|
||||
int defaultasstream;
|
||||
|
@ -73,21 +91,46 @@ struct FMOD_CODEC_WAVEFORMAT
|
|||
float peakvolume;
|
||||
};
|
||||
|
||||
typedef struct FMOD_CODEC_STATE_FUNCTIONS
|
||||
{
|
||||
FMOD_CODEC_METADATA_FUNC metadata;
|
||||
FMOD_CODEC_ALLOC_FUNC alloc;
|
||||
FMOD_CODEC_FREE_FUNC free;
|
||||
FMOD_CODEC_LOG_FUNC log;
|
||||
FMOD_CODEC_FILE_READ_FUNC read;
|
||||
FMOD_CODEC_FILE_SEEK_FUNC seek;
|
||||
FMOD_CODEC_FILE_TELL_FUNC tell;
|
||||
FMOD_CODEC_FILE_SIZE_FUNC size;
|
||||
} FMOD_CODEC_STATE_FUNCTIONS;
|
||||
|
||||
struct FMOD_CODEC_STATE
|
||||
{
|
||||
int numsubsounds;
|
||||
FMOD_CODEC_WAVEFORMAT *waveformat;
|
||||
void *plugindata;
|
||||
|
||||
void *filehandle;
|
||||
unsigned int filesize;
|
||||
FMOD_FILE_READ_CALLBACK fileread;
|
||||
FMOD_FILE_SEEK_CALLBACK fileseek;
|
||||
FMOD_CODEC_METADATA_CALLBACK metadata;
|
||||
|
||||
int waveformatversion;
|
||||
FMOD_CODEC_WAVEFORMAT *waveformat;
|
||||
FMOD_CODEC_STATE_FUNCTIONS *functions;
|
||||
int numsubsounds;
|
||||
};
|
||||
|
||||
/*
|
||||
Codec macros
|
||||
*/
|
||||
#define FMOD_CODEC_METADATA(_state, _tagtype, _name, _data, _datalen, _datatype, _unique) \
|
||||
(_state)->functions->metadata(_state, _tagtype, _name, _data, _datalen, _datatype, _unique)
|
||||
#define FMOD_CODEC_ALLOC(_state, _size, _align) \
|
||||
(_state)->functions->alloc(_size, _align, __FILE__, __LINE__)
|
||||
#define FMOD_CODEC_FREE(_state, _ptr) \
|
||||
(_state)->functions->free(_ptr, __FILE__, __LINE__)
|
||||
#define FMOD_CODEC_LOG(_state, _level, _location, _format, ...) \
|
||||
(_state)->functions->log(_level, __FILE__, __LINE__, _location, _format, __VA_ARGS__)
|
||||
#define FMOD_CODEC_FILE_READ(_state, _buffer, _sizebytes, _bytesread) \
|
||||
(_state)->functions->read(_state, _buffer, _sizebytes, _bytesread)
|
||||
#define FMOD_CODEC_FILE_SEEK(_state, _pos, _method) \
|
||||
(_state)->functions->seek(_state, _pos, _method)
|
||||
#define FMOD_CODEC_FILE_TELL(_state, _pos) \
|
||||
(_state)->functions->tell(_state, _pos)
|
||||
#define FMOD_CODEC_FILE_SIZE(_state, _size) \
|
||||
(_state)->functions->size(_state, _size)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
171
loader/include/Geode/fmod/fmod_common.h
vendored
|
@ -1,11 +1,11 @@
|
|||
/* ======================================================================================== */
|
||||
/* FMOD Core API - Common C/C++ header file. */
|
||||
/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2020. */
|
||||
/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2024. */
|
||||
/* */
|
||||
/* This header is included by fmod.hpp (C++ interface) and fmod.h (C interface) */
|
||||
/* */
|
||||
/* For more detail visit: */
|
||||
/* https://fmod.com/resources/documentation-api?version=2.0&page=core-api-common.html */
|
||||
/* https://fmod.com/docs/2.02/api/core-api-common.html */
|
||||
/* ======================================================================================== */
|
||||
#ifndef _FMOD_COMMON_H
|
||||
#define _FMOD_COMMON_H
|
||||
|
@ -52,13 +52,11 @@ typedef struct FMOD_POLYGON FMOD_POLYGON;
|
|||
typedef struct FMOD_GEOMETRY FMOD_GEOMETRY;
|
||||
typedef struct FMOD_SYNCPOINT FMOD_SYNCPOINT;
|
||||
typedef struct FMOD_ASYNCREADINFO FMOD_ASYNCREADINFO;
|
||||
typedef unsigned int FMOD_PORT_TYPE;
|
||||
typedef unsigned long long FMOD_PORT_INDEX;
|
||||
|
||||
/*
|
||||
FMOD constants
|
||||
*/
|
||||
#define FMOD_VERSION 0x00020010 /* 0xaaaabbcc -> aaaa = product version, bb = major version, cc = minor version.*/
|
||||
#define FMOD_VERSION 0x00020223 /* 0xaaaabbcc -> aaaa = product version, bb = major version, cc = minor version.*/
|
||||
|
||||
typedef unsigned int FMOD_DEBUG_FLAGS;
|
||||
#define FMOD_DEBUG_LEVEL_NONE 0x00000000
|
||||
|
@ -88,6 +86,7 @@ typedef unsigned int FMOD_INITFLAGS;
|
|||
#define FMOD_INIT_STREAM_FROM_UPDATE 0x00000001
|
||||
#define FMOD_INIT_MIX_FROM_UPDATE 0x00000002
|
||||
#define FMOD_INIT_3D_RIGHTHANDED 0x00000004
|
||||
#define FMOD_INIT_CLIP_OUTPUT 0x00000008
|
||||
#define FMOD_INIT_CHANNEL_LOWPASS 0x00000100
|
||||
#define FMOD_INIT_CHANNEL_DISTANCEFILTER 0x00000200
|
||||
#define FMOD_INIT_PROFILE_ENABLE 0x00010000
|
||||
|
@ -126,6 +125,10 @@ typedef unsigned int FMOD_SYSTEM_CALLBACK_TYPE;
|
|||
#define FMOD_SYSTEM_CALLBACK_PREUPDATE 0x00000400
|
||||
#define FMOD_SYSTEM_CALLBACK_POSTUPDATE 0x00000800
|
||||
#define FMOD_SYSTEM_CALLBACK_RECORDLISTCHANGED 0x00001000
|
||||
#define FMOD_SYSTEM_CALLBACK_BUFFEREDNOMIX 0x00002000
|
||||
#define FMOD_SYSTEM_CALLBACK_DEVICEREINITIALIZE 0x00004000
|
||||
#define FMOD_SYSTEM_CALLBACK_OUTPUTUNDERRUN 0x00008000
|
||||
#define FMOD_SYSTEM_CALLBACK_RECORDPOSITIONCHANGED 0x00010000
|
||||
#define FMOD_SYSTEM_CALLBACK_ALL 0xFFFFFFFF
|
||||
|
||||
typedef unsigned int FMOD_MODE;
|
||||
|
@ -169,7 +172,6 @@ typedef unsigned int FMOD_CHANNELMASK;
|
|||
#define FMOD_CHANNELMASK_BACK_LEFT 0x00000040
|
||||
#define FMOD_CHANNELMASK_BACK_RIGHT 0x00000080
|
||||
#define FMOD_CHANNELMASK_BACK_CENTER 0x00000100
|
||||
|
||||
#define FMOD_CHANNELMASK_MONO (FMOD_CHANNELMASK_FRONT_LEFT)
|
||||
#define FMOD_CHANNELMASK_STEREO (FMOD_CHANNELMASK_FRONT_LEFT | FMOD_CHANNELMASK_FRONT_RIGHT)
|
||||
#define FMOD_CHANNELMASK_LRC (FMOD_CHANNELMASK_FRONT_LEFT | FMOD_CHANNELMASK_FRONT_RIGHT | FMOD_CHANNELMASK_FRONT_CENTER)
|
||||
|
@ -180,6 +182,92 @@ typedef unsigned int FMOD_CHANNELMASK;
|
|||
#define FMOD_CHANNELMASK_7POINT0 (FMOD_CHANNELMASK_FRONT_LEFT | FMOD_CHANNELMASK_FRONT_RIGHT | FMOD_CHANNELMASK_FRONT_CENTER | FMOD_CHANNELMASK_SURROUND_LEFT | FMOD_CHANNELMASK_SURROUND_RIGHT | FMOD_CHANNELMASK_BACK_LEFT | FMOD_CHANNELMASK_BACK_RIGHT)
|
||||
#define FMOD_CHANNELMASK_7POINT1 (FMOD_CHANNELMASK_FRONT_LEFT | FMOD_CHANNELMASK_FRONT_RIGHT | FMOD_CHANNELMASK_FRONT_CENTER | FMOD_CHANNELMASK_LOW_FREQUENCY | FMOD_CHANNELMASK_SURROUND_LEFT | FMOD_CHANNELMASK_SURROUND_RIGHT | FMOD_CHANNELMASK_BACK_LEFT | FMOD_CHANNELMASK_BACK_RIGHT)
|
||||
|
||||
typedef unsigned long long FMOD_PORT_INDEX;
|
||||
#define FMOD_PORT_INDEX_NONE 0xFFFFFFFFFFFFFFFF
|
||||
#define FMOD_PORT_INDEX_FLAG_VR_CONTROLLER 0x1000000000000000
|
||||
|
||||
typedef int FMOD_THREAD_PRIORITY;
|
||||
/* Platform specific priority range */
|
||||
#define FMOD_THREAD_PRIORITY_PLATFORM_MIN (-32 * 1024)
|
||||
#define FMOD_THREAD_PRIORITY_PLATFORM_MAX ( 32 * 1024)
|
||||
/* Platform agnostic priorities, maps internally to platform specific value */
|
||||
#define FMOD_THREAD_PRIORITY_DEFAULT (FMOD_THREAD_PRIORITY_PLATFORM_MIN - 1)
|
||||
#define FMOD_THREAD_PRIORITY_LOW (FMOD_THREAD_PRIORITY_PLATFORM_MIN - 2)
|
||||
#define FMOD_THREAD_PRIORITY_MEDIUM (FMOD_THREAD_PRIORITY_PLATFORM_MIN - 3)
|
||||
#define FMOD_THREAD_PRIORITY_HIGH (FMOD_THREAD_PRIORITY_PLATFORM_MIN - 4)
|
||||
#define FMOD_THREAD_PRIORITY_VERY_HIGH (FMOD_THREAD_PRIORITY_PLATFORM_MIN - 5)
|
||||
#define FMOD_THREAD_PRIORITY_EXTREME (FMOD_THREAD_PRIORITY_PLATFORM_MIN - 6)
|
||||
#define FMOD_THREAD_PRIORITY_CRITICAL (FMOD_THREAD_PRIORITY_PLATFORM_MIN - 7)
|
||||
/* Thread defaults */
|
||||
#define FMOD_THREAD_PRIORITY_MIXER FMOD_THREAD_PRIORITY_EXTREME
|
||||
#define FMOD_THREAD_PRIORITY_FEEDER FMOD_THREAD_PRIORITY_CRITICAL
|
||||
#define FMOD_THREAD_PRIORITY_STREAM FMOD_THREAD_PRIORITY_VERY_HIGH
|
||||
#define FMOD_THREAD_PRIORITY_FILE FMOD_THREAD_PRIORITY_HIGH
|
||||
#define FMOD_THREAD_PRIORITY_NONBLOCKING FMOD_THREAD_PRIORITY_HIGH
|
||||
#define FMOD_THREAD_PRIORITY_RECORD FMOD_THREAD_PRIORITY_HIGH
|
||||
#define FMOD_THREAD_PRIORITY_GEOMETRY FMOD_THREAD_PRIORITY_LOW
|
||||
#define FMOD_THREAD_PRIORITY_PROFILER FMOD_THREAD_PRIORITY_MEDIUM
|
||||
#define FMOD_THREAD_PRIORITY_STUDIO_UPDATE FMOD_THREAD_PRIORITY_MEDIUM
|
||||
#define FMOD_THREAD_PRIORITY_STUDIO_LOAD_BANK FMOD_THREAD_PRIORITY_MEDIUM
|
||||
#define FMOD_THREAD_PRIORITY_STUDIO_LOAD_SAMPLE FMOD_THREAD_PRIORITY_MEDIUM
|
||||
#define FMOD_THREAD_PRIORITY_CONVOLUTION1 FMOD_THREAD_PRIORITY_VERY_HIGH
|
||||
#define FMOD_THREAD_PRIORITY_CONVOLUTION2 FMOD_THREAD_PRIORITY_VERY_HIGH
|
||||
|
||||
typedef unsigned int FMOD_THREAD_STACK_SIZE;
|
||||
#define FMOD_THREAD_STACK_SIZE_DEFAULT 0
|
||||
#define FMOD_THREAD_STACK_SIZE_MIXER (80 * 1024)
|
||||
#define FMOD_THREAD_STACK_SIZE_FEEDER (16 * 1024)
|
||||
#define FMOD_THREAD_STACK_SIZE_STREAM (96 * 1024)
|
||||
#define FMOD_THREAD_STACK_SIZE_FILE (64 * 1024)
|
||||
#define FMOD_THREAD_STACK_SIZE_NONBLOCKING (112 * 1024)
|
||||
#define FMOD_THREAD_STACK_SIZE_RECORD (16 * 1024)
|
||||
#define FMOD_THREAD_STACK_SIZE_GEOMETRY (48 * 1024)
|
||||
#define FMOD_THREAD_STACK_SIZE_PROFILER (128 * 1024)
|
||||
#define FMOD_THREAD_STACK_SIZE_STUDIO_UPDATE (96 * 1024)
|
||||
#define FMOD_THREAD_STACK_SIZE_STUDIO_LOAD_BANK (96 * 1024)
|
||||
#define FMOD_THREAD_STACK_SIZE_STUDIO_LOAD_SAMPLE (96 * 1024)
|
||||
#define FMOD_THREAD_STACK_SIZE_CONVOLUTION1 (16 * 1024)
|
||||
#define FMOD_THREAD_STACK_SIZE_CONVOLUTION2 (16 * 1024)
|
||||
|
||||
typedef long long FMOD_THREAD_AFFINITY;
|
||||
/* Platform agnostic thread groupings */
|
||||
#define FMOD_THREAD_AFFINITY_GROUP_DEFAULT 0x4000000000000000
|
||||
#define FMOD_THREAD_AFFINITY_GROUP_A 0x4000000000000001
|
||||
#define FMOD_THREAD_AFFINITY_GROUP_B 0x4000000000000002
|
||||
#define FMOD_THREAD_AFFINITY_GROUP_C 0x4000000000000003
|
||||
/* Thread defaults */
|
||||
#define FMOD_THREAD_AFFINITY_MIXER FMOD_THREAD_AFFINITY_GROUP_A
|
||||
#define FMOD_THREAD_AFFINITY_FEEDER FMOD_THREAD_AFFINITY_GROUP_C
|
||||
#define FMOD_THREAD_AFFINITY_STREAM FMOD_THREAD_AFFINITY_GROUP_C
|
||||
#define FMOD_THREAD_AFFINITY_FILE FMOD_THREAD_AFFINITY_GROUP_C
|
||||
#define FMOD_THREAD_AFFINITY_NONBLOCKING FMOD_THREAD_AFFINITY_GROUP_C
|
||||
#define FMOD_THREAD_AFFINITY_RECORD FMOD_THREAD_AFFINITY_GROUP_C
|
||||
#define FMOD_THREAD_AFFINITY_GEOMETRY FMOD_THREAD_AFFINITY_GROUP_C
|
||||
#define FMOD_THREAD_AFFINITY_PROFILER FMOD_THREAD_AFFINITY_GROUP_C
|
||||
#define FMOD_THREAD_AFFINITY_STUDIO_UPDATE FMOD_THREAD_AFFINITY_GROUP_B
|
||||
#define FMOD_THREAD_AFFINITY_STUDIO_LOAD_BANK FMOD_THREAD_AFFINITY_GROUP_C
|
||||
#define FMOD_THREAD_AFFINITY_STUDIO_LOAD_SAMPLE FMOD_THREAD_AFFINITY_GROUP_C
|
||||
#define FMOD_THREAD_AFFINITY_CONVOLUTION1 FMOD_THREAD_AFFINITY_GROUP_C
|
||||
#define FMOD_THREAD_AFFINITY_CONVOLUTION2 FMOD_THREAD_AFFINITY_GROUP_C
|
||||
/* Core mask, valid up to 1 << 62 */
|
||||
#define FMOD_THREAD_AFFINITY_CORE_ALL 0
|
||||
#define FMOD_THREAD_AFFINITY_CORE_0 (1 << 0)
|
||||
#define FMOD_THREAD_AFFINITY_CORE_1 (1 << 1)
|
||||
#define FMOD_THREAD_AFFINITY_CORE_2 (1 << 2)
|
||||
#define FMOD_THREAD_AFFINITY_CORE_3 (1 << 3)
|
||||
#define FMOD_THREAD_AFFINITY_CORE_4 (1 << 4)
|
||||
#define FMOD_THREAD_AFFINITY_CORE_5 (1 << 5)
|
||||
#define FMOD_THREAD_AFFINITY_CORE_6 (1 << 6)
|
||||
#define FMOD_THREAD_AFFINITY_CORE_7 (1 << 7)
|
||||
#define FMOD_THREAD_AFFINITY_CORE_8 (1 << 8)
|
||||
#define FMOD_THREAD_AFFINITY_CORE_9 (1 << 9)
|
||||
#define FMOD_THREAD_AFFINITY_CORE_10 (1 << 10)
|
||||
#define FMOD_THREAD_AFFINITY_CORE_11 (1 << 11)
|
||||
#define FMOD_THREAD_AFFINITY_CORE_12 (1 << 12)
|
||||
#define FMOD_THREAD_AFFINITY_CORE_13 (1 << 13)
|
||||
#define FMOD_THREAD_AFFINITY_CORE_14 (1 << 14)
|
||||
#define FMOD_THREAD_AFFINITY_CORE_15 (1 << 15)
|
||||
|
||||
/* Preset for FMOD_REVERB_PROPERTIES */
|
||||
#define FMOD_PRESET_OFF { 1000, 7, 11, 5000, 100, 100, 100, 250, 0, 20, 96, -80.0f }
|
||||
#define FMOD_PRESET_GENERIC { 1500, 7, 11, 5000, 83, 100, 100, 250, 0, 14500, 96, -8.0f }
|
||||
|
@ -210,7 +298,26 @@ typedef unsigned int FMOD_CHANNELMASK;
|
|||
#define FMOD_MAX_SYSTEMS 8
|
||||
#define FMOD_MAX_LISTENERS 8
|
||||
#define FMOD_REVERB_MAXINSTANCES 4
|
||||
#define FMOD_PORT_INDEX_NONE 0xFFFFFFFFFFFFFFFF
|
||||
|
||||
typedef enum FMOD_THREAD_TYPE
|
||||
{
|
||||
FMOD_THREAD_TYPE_MIXER,
|
||||
FMOD_THREAD_TYPE_FEEDER,
|
||||
FMOD_THREAD_TYPE_STREAM,
|
||||
FMOD_THREAD_TYPE_FILE,
|
||||
FMOD_THREAD_TYPE_NONBLOCKING,
|
||||
FMOD_THREAD_TYPE_RECORD,
|
||||
FMOD_THREAD_TYPE_GEOMETRY,
|
||||
FMOD_THREAD_TYPE_PROFILER,
|
||||
FMOD_THREAD_TYPE_STUDIO_UPDATE,
|
||||
FMOD_THREAD_TYPE_STUDIO_LOAD_BANK,
|
||||
FMOD_THREAD_TYPE_STUDIO_LOAD_SAMPLE,
|
||||
FMOD_THREAD_TYPE_CONVOLUTION1,
|
||||
FMOD_THREAD_TYPE_CONVOLUTION2,
|
||||
|
||||
FMOD_THREAD_TYPE_MAX,
|
||||
FMOD_THREAD_TYPE_FORCEINT = 65536
|
||||
} FMOD_THREAD_TYPE;
|
||||
|
||||
typedef enum FMOD_RESULT
|
||||
{
|
||||
|
@ -330,6 +437,9 @@ typedef enum FMOD_OUTPUTTYPE
|
|||
FMOD_OUTPUTTYPE_NNAUDIO,
|
||||
FMOD_OUTPUTTYPE_WINSONIC,
|
||||
FMOD_OUTPUTTYPE_AAUDIO,
|
||||
FMOD_OUTPUTTYPE_AUDIOWORKLET,
|
||||
FMOD_OUTPUTTYPE_PHASE,
|
||||
FMOD_OUTPUTTYPE_OHAUDIO,
|
||||
|
||||
FMOD_OUTPUTTYPE_MAX,
|
||||
FMOD_OUTPUTTYPE_FORCEINT = 65536
|
||||
|
@ -531,6 +641,14 @@ typedef enum FMOD_DSP_RESAMPLER
|
|||
FMOD_DSP_RESAMPLER_FORCEINT = 65536
|
||||
} FMOD_DSP_RESAMPLER;
|
||||
|
||||
typedef enum FMOD_DSP_CALLBACK_TYPE
|
||||
{
|
||||
FMOD_DSP_CALLBACK_DATAPARAMETERRELEASE,
|
||||
|
||||
FMOD_DSP_CALLBACK_MAX,
|
||||
FMOD_DSP_CALLBACK_FORCEINT = 65536
|
||||
} FMOD_DSP_CALLBACK_TYPE;
|
||||
|
||||
typedef enum FMOD_DSPCONNECTION_TYPE
|
||||
{
|
||||
FMOD_DSPCONNECTION_TYPE_STANDARD,
|
||||
|
@ -574,12 +692,27 @@ typedef enum FMOD_TAGDATATYPE
|
|||
FMOD_TAGDATATYPE_FORCEINT = 65536
|
||||
} FMOD_TAGDATATYPE;
|
||||
|
||||
typedef enum FMOD_PORT_TYPE
|
||||
{
|
||||
FMOD_PORT_TYPE_MUSIC,
|
||||
FMOD_PORT_TYPE_COPYRIGHT_MUSIC,
|
||||
FMOD_PORT_TYPE_VOICE,
|
||||
FMOD_PORT_TYPE_CONTROLLER,
|
||||
FMOD_PORT_TYPE_PERSONAL,
|
||||
FMOD_PORT_TYPE_VIBRATION,
|
||||
FMOD_PORT_TYPE_AUX,
|
||||
|
||||
FMOD_PORT_TYPE_MAX,
|
||||
FMOD_PORT_TYPE_FORCEINT = 65536
|
||||
} FMOD_PORT_TYPE;
|
||||
|
||||
/*
|
||||
FMOD callbacks
|
||||
*/
|
||||
typedef FMOD_RESULT (F_CALL *FMOD_DEBUG_CALLBACK) (FMOD_DEBUG_FLAGS flags, const char *file, int line, const char* func, const char* message);
|
||||
typedef FMOD_RESULT (F_CALL *FMOD_SYSTEM_CALLBACK) (FMOD_SYSTEM *system, FMOD_SYSTEM_CALLBACK_TYPE type, void *commanddata1, void* commanddata2, void *userdata);
|
||||
typedef FMOD_RESULT (F_CALL *FMOD_CHANNELCONTROL_CALLBACK) (FMOD_CHANNELCONTROL *channelcontrol, FMOD_CHANNELCONTROL_TYPE controltype, FMOD_CHANNELCONTROL_CALLBACK_TYPE callbacktype, void *commanddata1, void *commanddata2);
|
||||
typedef FMOD_RESULT (F_CALL *FMOD_DSP_CALLBACK) (FMOD_DSP *dsp, FMOD_DSP_CALLBACK_TYPE type, void *data);
|
||||
typedef FMOD_RESULT (F_CALL *FMOD_SOUND_NONBLOCK_CALLBACK) (FMOD_SOUND *sound, FMOD_RESULT result);
|
||||
typedef FMOD_RESULT (F_CALL *FMOD_SOUND_PCMREAD_CALLBACK) (FMOD_SOUND *sound, void *data, unsigned int datalen);
|
||||
typedef FMOD_RESULT (F_CALL *FMOD_SOUND_PCMSETPOS_CALLBACK) (FMOD_SOUND *sound, int subsound, unsigned int position, FMOD_TIMEUNIT postype);
|
||||
|
@ -659,12 +792,11 @@ typedef struct FMOD_ADVANCEDSETTINGS
|
|||
float distanceFilterCenterFreq;
|
||||
int reverb3Dinstance;
|
||||
int DSPBufferPoolSize;
|
||||
unsigned int stackSizeStream;
|
||||
unsigned int stackSizeNonBlocking;
|
||||
unsigned int stackSizeMixer;
|
||||
FMOD_DSP_RESAMPLER resamplerMethod;
|
||||
unsigned int commandQueueSize;
|
||||
unsigned int randomSeed;
|
||||
int maxConvolutionThreads;
|
||||
int maxOpusCodecs;
|
||||
int maxSpatialObjects;
|
||||
} FMOD_ADVANCEDSETTINGS;
|
||||
|
||||
typedef struct FMOD_TAG
|
||||
|
@ -742,6 +874,23 @@ typedef struct FMOD_ERRORCALLBACK_INFO
|
|||
const char *functionparams;
|
||||
} FMOD_ERRORCALLBACK_INFO;
|
||||
|
||||
typedef struct FMOD_CPU_USAGE
|
||||
{
|
||||
float dsp;
|
||||
float stream;
|
||||
float geometry;
|
||||
float update;
|
||||
float convolution1;
|
||||
float convolution2;
|
||||
} FMOD_CPU_USAGE;
|
||||
|
||||
typedef struct FMOD_DSP_DATA_PARAMETER_INFO
|
||||
{
|
||||
void *data;
|
||||
unsigned int length;
|
||||
int index;
|
||||
} FMOD_DSP_DATA_PARAMETER_INFO;
|
||||
|
||||
/*
|
||||
FMOD optional headers for plugin development
|
||||
*/
|
||||
|
|
13
loader/include/Geode/fmod/fmod_dsp.h
vendored
|
@ -1,13 +1,13 @@
|
|||
/* ======================================================================================== */
|
||||
/* FMOD Core API - DSP header file. */
|
||||
/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2020. */
|
||||
/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2024. */
|
||||
/* */
|
||||
/* Use this header if you are wanting to develop your own DSP plugin to use with FMODs */
|
||||
/* dsp system. With this header you can make your own DSP plugin that FMOD can */
|
||||
/* register and use. See the documentation and examples on how to make a working plugin. */
|
||||
/* */
|
||||
/* For more detail visit: */
|
||||
/* https://fmod.com/resources/documentation-api?version=2.0&page=plugin-api-dsp.html */
|
||||
/* https://fmod.com/docs/2.02/api/plugin-api-dsp.html */
|
||||
/* =========================================================================================*/
|
||||
#ifndef _FMOD_DSP_H
|
||||
#define _FMOD_DSP_H
|
||||
|
@ -66,6 +66,7 @@ typedef enum
|
|||
FMOD_DSP_PARAMETER_DATA_TYPE_SIDECHAIN = -3,
|
||||
FMOD_DSP_PARAMETER_DATA_TYPE_FFT = -4,
|
||||
FMOD_DSP_PARAMETER_DATA_TYPE_3DATTRIBUTES_MULTI = -5,
|
||||
FMOD_DSP_PARAMETER_DATA_TYPE_ATTENUATION_RANGE = -6,
|
||||
} FMOD_DSP_PARAMETER_DATA_TYPE;
|
||||
|
||||
/*
|
||||
|
@ -96,7 +97,7 @@ typedef FMOD_RESULT (F_CALL *FMOD_DSP_SYSTEM_MIX_CALLBACK) (FMOD_
|
|||
typedef void * (F_CALL *FMOD_DSP_ALLOC_FUNC) (unsigned int size, FMOD_MEMORY_TYPE type, const char *sourcestr);
|
||||
typedef void * (F_CALL *FMOD_DSP_REALLOC_FUNC) (void *ptr, unsigned int size, FMOD_MEMORY_TYPE type, const char *sourcestr);
|
||||
typedef void (F_CALL *FMOD_DSP_FREE_FUNC) (void *ptr, FMOD_MEMORY_TYPE type, const char *sourcestr);
|
||||
typedef void (F_CALL *FMOD_DSP_LOG_FUNC) (FMOD_DEBUG_FLAGS level, const char *file, int line, const char *function, const char *string);
|
||||
typedef void (F_CALL *FMOD_DSP_LOG_FUNC) (FMOD_DEBUG_FLAGS level, const char *file, int line, const char *function, const char *str, ...);
|
||||
typedef FMOD_RESULT (F_CALL *FMOD_DSP_GETSAMPLERATE_FUNC) (FMOD_DSP_STATE *dsp_state, int *rate);
|
||||
typedef FMOD_RESULT (F_CALL *FMOD_DSP_GETBLOCKSIZE_FUNC) (FMOD_DSP_STATE *dsp_state, unsigned int *blocksize);
|
||||
typedef FMOD_RESULT (F_CALL *FMOD_DSP_GETSPEAKERMODE_FUNC) (FMOD_DSP_STATE *dsp_state, FMOD_SPEAKERMODE *speakermode_mixer, FMOD_SPEAKERMODE *speakermode_output);
|
||||
|
@ -207,6 +208,12 @@ typedef struct FMOD_DSP_PARAMETER_3DATTRIBUTES_MULTI
|
|||
FMOD_3D_ATTRIBUTES absolute;
|
||||
} FMOD_DSP_PARAMETER_3DATTRIBUTES_MULTI;
|
||||
|
||||
typedef struct FMOD_DSP_PARAMETER_ATTENUATION_RANGE
|
||||
{
|
||||
float min;
|
||||
float max;
|
||||
} FMOD_DSP_PARAMETER_ATTENUATION_RANGE;
|
||||
|
||||
typedef struct FMOD_DSP_PARAMETER_SIDECHAIN
|
||||
{
|
||||
FMOD_BOOL sidechainenable;
|
||||
|
|
48
loader/include/Geode/fmod/fmod_dsp_effects.h
vendored
|
@ -1,12 +1,12 @@
|
|||
/* ============================================================================================================= */
|
||||
/* FMOD Core API - Built-in effects header file. */
|
||||
/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2020. */
|
||||
/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2024. */
|
||||
/* */
|
||||
/* In this header you can find parameter structures for FMOD system registered DSP effects */
|
||||
/* and generators. */
|
||||
/* */
|
||||
/* For more detail visit: */
|
||||
/* https://fmod.com/resources/documentation-api?version=2.0&page=core-api-common-dsp-effects.html#fmod_dsp_type */
|
||||
/* https://fmod.com/docs/2.02/api/core-api-common-dsp-effects.html#fmod_dsp_type */
|
||||
/* ============================================================================================================= */
|
||||
|
||||
#ifndef _FMOD_DSP_EFFECTS_H
|
||||
|
@ -126,7 +126,7 @@ typedef enum
|
|||
typedef enum
|
||||
{
|
||||
FMOD_DSP_NORMALIZE_FADETIME,
|
||||
FMOD_DSP_NORMALIZE_THRESHHOLD,
|
||||
FMOD_DSP_NORMALIZE_THRESHOLD,
|
||||
FMOD_DSP_NORMALIZE_MAXAMP
|
||||
} FMOD_DSP_NORMALIZE;
|
||||
|
||||
|
@ -363,6 +363,8 @@ typedef enum
|
|||
FMOD_DSP_PAN_OVERALL_GAIN,
|
||||
FMOD_DSP_PAN_SURROUND_SPEAKER_MODE,
|
||||
FMOD_DSP_PAN_2D_HEIGHT_BLEND,
|
||||
FMOD_DSP_PAN_ATTENUATION_RANGE,
|
||||
FMOD_DSP_PAN_OVERRIDE_RANGE
|
||||
} FMOD_DSP_PAN;
|
||||
|
||||
|
||||
|
@ -404,6 +406,42 @@ typedef enum
|
|||
FMOD_DSP_FFT_DOMINANT_FREQ
|
||||
} FMOD_DSP_FFT;
|
||||
|
||||
#define FMOD_DSP_LOUDNESS_METER_HISTOGRAM_SAMPLES 66
|
||||
|
||||
typedef enum
|
||||
{
|
||||
FMOD_DSP_LOUDNESS_METER_STATE,
|
||||
FMOD_DSP_LOUDNESS_METER_WEIGHTING,
|
||||
FMOD_DSP_LOUDNESS_METER_INFO
|
||||
} FMOD_DSP_LOUDNESS_METER;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
FMOD_DSP_LOUDNESS_METER_STATE_RESET_INTEGRATED = -3,
|
||||
FMOD_DSP_LOUDNESS_METER_STATE_RESET_MAXPEAK = -2,
|
||||
FMOD_DSP_LOUDNESS_METER_STATE_RESET_ALL = -1,
|
||||
FMOD_DSP_LOUDNESS_METER_STATE_PAUSED = 0,
|
||||
FMOD_DSP_LOUDNESS_METER_STATE_ANALYZING = 1
|
||||
} FMOD_DSP_LOUDNESS_METER_STATE_TYPE;
|
||||
|
||||
typedef struct FMOD_DSP_LOUDNESS_METER_INFO_TYPE
|
||||
{
|
||||
float momentaryloudness;
|
||||
float shorttermloudness;
|
||||
float integratedloudness;
|
||||
float loudness10thpercentile;
|
||||
float loudness95thpercentile;
|
||||
float loudnesshistogram[FMOD_DSP_LOUDNESS_METER_HISTOGRAM_SAMPLES];
|
||||
float maxtruepeak;
|
||||
float maxmomentaryloudness;
|
||||
} FMOD_DSP_LOUDNESS_METER_INFO_TYPE;
|
||||
|
||||
typedef struct FMOD_DSP_LOUDNESS_METER_WEIGHTING_TYPE
|
||||
{
|
||||
float channelweight[32];
|
||||
} FMOD_DSP_LOUDNESS_METER_WEIGHTING_TYPE;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
@ -530,7 +568,9 @@ typedef enum
|
|||
FMOD_DSP_OBJECTPAN_3D_SOUND_SIZE,
|
||||
FMOD_DSP_OBJECTPAN_3D_MIN_EXTENT,
|
||||
FMOD_DSP_OBJECTPAN_OVERALL_GAIN,
|
||||
FMOD_DSP_OBJECTPAN_OUTPUTGAIN
|
||||
FMOD_DSP_OBJECTPAN_OUTPUTGAIN,
|
||||
FMOD_DSP_OBJECTPAN_ATTENUATION_RANGE,
|
||||
FMOD_DSP_OBJECTPAN_OVERRIDE_RANGE
|
||||
} FMOD_DSP_OBJECTPAN;
|
||||
|
||||
#endif
|
||||
|
|
110
loader/include/Geode/fmod/fmod_errors.h
vendored
Normal file
|
@ -0,0 +1,110 @@
|
|||
/* ============================================================================================== */
|
||||
/* FMOD Core / Studio API - Error string header file. */
|
||||
/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2024. */
|
||||
/* */
|
||||
/* Use this header if you want to store or display a string version / english explanation */
|
||||
/* of the FMOD error codes. */
|
||||
/* */
|
||||
/* For more detail visit: */
|
||||
/* https://fmod.com/docs/2.02/api/core-api-common.html#fmod_result */
|
||||
/* =============================================================================================== */
|
||||
#ifndef _FMOD_ERRORS_H
|
||||
#define _FMOD_ERRORS_H
|
||||
|
||||
#include "fmod.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
static const char *FMOD_ErrorString(FMOD_RESULT errcode) __attribute__((unused));
|
||||
#endif
|
||||
|
||||
static const char *FMOD_ErrorString(FMOD_RESULT errcode)
|
||||
{
|
||||
switch (errcode)
|
||||
{
|
||||
case FMOD_OK: return "No errors.";
|
||||
case FMOD_ERR_BADCOMMAND: return "Tried to call a function on a data type that does not allow this type of functionality (ie calling Sound::lock on a streaming sound).";
|
||||
case FMOD_ERR_CHANNEL_ALLOC: return "Error trying to allocate a channel.";
|
||||
case FMOD_ERR_CHANNEL_STOLEN: return "The specified channel has been reused to play another sound.";
|
||||
case FMOD_ERR_DMA: return "DMA Failure. See debug output for more information.";
|
||||
case FMOD_ERR_DSP_CONNECTION: return "DSP connection error. Connection possibly caused a cyclic dependency or connected dsps with incompatible buffer counts.";
|
||||
case FMOD_ERR_DSP_DONTPROCESS: return "DSP return code from a DSP process query callback. Tells mixer not to call the process callback and therefore not consume CPU. Use this to optimize the DSP graph.";
|
||||
case FMOD_ERR_DSP_FORMAT: return "DSP Format error. A DSP unit may have attempted to connect to this network with the wrong format, or a matrix may have been set with the wrong size if the target unit has a specified channel map.";
|
||||
case FMOD_ERR_DSP_INUSE: return "DSP is already in the mixer's DSP network. It must be removed before being reinserted or released.";
|
||||
case FMOD_ERR_DSP_NOTFOUND: return "DSP connection error. Couldn't find the DSP unit specified.";
|
||||
case FMOD_ERR_DSP_RESERVED: return "DSP operation error. Cannot perform operation on this DSP as it is reserved by the system.";
|
||||
case FMOD_ERR_DSP_SILENCE: return "DSP return code from a DSP process query callback. Tells mixer silence would be produced from read, so go idle and not consume CPU. Use this to optimize the DSP graph.";
|
||||
case FMOD_ERR_DSP_TYPE: return "DSP operation cannot be performed on a DSP of this type.";
|
||||
case FMOD_ERR_FILE_BAD: return "Error loading file.";
|
||||
case FMOD_ERR_FILE_COULDNOTSEEK: return "Couldn't perform seek operation. This is a limitation of the medium (ie netstreams) or the file format.";
|
||||
case FMOD_ERR_FILE_DISKEJECTED: return "Media was ejected while reading.";
|
||||
case FMOD_ERR_FILE_EOF: return "End of file unexpectedly reached while trying to read essential data (truncated?).";
|
||||
case FMOD_ERR_FILE_ENDOFDATA: return "End of current chunk reached while trying to read data.";
|
||||
case FMOD_ERR_FILE_NOTFOUND: return "File not found.";
|
||||
case FMOD_ERR_FORMAT: return "Unsupported file or audio format.";
|
||||
case FMOD_ERR_HEADER_MISMATCH: return "There is a version mismatch between the FMOD header and either the FMOD Studio library or the FMOD Low Level library.";
|
||||
case FMOD_ERR_HTTP: return "A HTTP error occurred. This is a catch-all for HTTP errors not listed elsewhere.";
|
||||
case FMOD_ERR_HTTP_ACCESS: return "The specified resource requires authentication or is forbidden.";
|
||||
case FMOD_ERR_HTTP_PROXY_AUTH: return "Proxy authentication is required to access the specified resource.";
|
||||
case FMOD_ERR_HTTP_SERVER_ERROR: return "A HTTP server error occurred.";
|
||||
case FMOD_ERR_HTTP_TIMEOUT: return "The HTTP request timed out.";
|
||||
case FMOD_ERR_INITIALIZATION: return "FMOD was not initialized correctly to support this function.";
|
||||
case FMOD_ERR_INITIALIZED: return "Cannot call this command after System::init.";
|
||||
case FMOD_ERR_INTERNAL: return "An error occured in the FMOD system. Use the logging version of FMOD for more information.";
|
||||
case FMOD_ERR_INVALID_FLOAT: return "Value passed in was a NaN, Inf or denormalized float.";
|
||||
case FMOD_ERR_INVALID_HANDLE: return "An invalid object handle was used.";
|
||||
case FMOD_ERR_INVALID_PARAM: return "An invalid parameter was passed to this function.";
|
||||
case FMOD_ERR_INVALID_POSITION: return "An invalid seek position was passed to this function.";
|
||||
case FMOD_ERR_INVALID_SPEAKER: return "An invalid speaker was passed to this function based on the current speaker mode.";
|
||||
case FMOD_ERR_INVALID_SYNCPOINT: return "The syncpoint did not come from this sound handle.";
|
||||
case FMOD_ERR_INVALID_THREAD: return "Tried to call a function on a thread that is not supported.";
|
||||
case FMOD_ERR_INVALID_VECTOR: return "The vectors passed in are not unit length, or perpendicular.";
|
||||
case FMOD_ERR_MAXAUDIBLE: return "Reached maximum audible playback count for this sound's soundgroup.";
|
||||
case FMOD_ERR_MEMORY: return "Not enough memory or resources.";
|
||||
case FMOD_ERR_MEMORY_CANTPOINT: return "Can't use FMOD_OPENMEMORY_POINT on non PCM source data, or non mp3/xma/adpcm data if FMOD_CREATECOMPRESSEDSAMPLE was used.";
|
||||
case FMOD_ERR_NEEDS3D: return "Tried to call a command on a 2d sound when the command was meant for 3d sound.";
|
||||
case FMOD_ERR_NEEDSHARDWARE: return "Tried to use a feature that requires hardware support.";
|
||||
case FMOD_ERR_NET_CONNECT: return "Couldn't connect to the specified host.";
|
||||
case FMOD_ERR_NET_SOCKET_ERROR: return "A socket error occurred. This is a catch-all for socket-related errors not listed elsewhere.";
|
||||
case FMOD_ERR_NET_URL: return "The specified URL couldn't be resolved.";
|
||||
case FMOD_ERR_NET_WOULD_BLOCK: return "Operation on a non-blocking socket could not complete immediately.";
|
||||
case FMOD_ERR_NOTREADY: return "Operation could not be performed because specified sound/DSP connection is not ready.";
|
||||
case FMOD_ERR_OUTPUT_ALLOCATED: return "Error initializing output device, but more specifically, the output device is already in use and cannot be reused.";
|
||||
case FMOD_ERR_OUTPUT_CREATEBUFFER: return "Error creating hardware sound buffer.";
|
||||
case FMOD_ERR_OUTPUT_DRIVERCALL: return "A call to a standard soundcard driver failed, which could possibly mean a bug in the driver or resources were missing or exhausted.";
|
||||
case FMOD_ERR_OUTPUT_FORMAT: return "Soundcard does not support the specified format.";
|
||||
case FMOD_ERR_OUTPUT_INIT: return "Error initializing output device.";
|
||||
case FMOD_ERR_OUTPUT_NODRIVERS: return "The output device has no drivers installed. If pre-init, FMOD_OUTPUT_NOSOUND is selected as the output mode. If post-init, the function just fails.";
|
||||
case FMOD_ERR_PLUGIN: return "An unspecified error has been returned from a plugin.";
|
||||
case FMOD_ERR_PLUGIN_MISSING: return "A requested output, dsp unit type or codec was not available.";
|
||||
case FMOD_ERR_PLUGIN_RESOURCE: return "A resource that the plugin requires cannot be allocated or found. (ie the DLS file for MIDI playback)";
|
||||
case FMOD_ERR_PLUGIN_VERSION: return "A plugin was built with an unsupported SDK version.";
|
||||
case FMOD_ERR_RECORD: return "An error occurred trying to initialize the recording device.";
|
||||
case FMOD_ERR_REVERB_CHANNELGROUP: return "Reverb properties cannot be set on this channel because a parent channelgroup owns the reverb connection.";
|
||||
case FMOD_ERR_REVERB_INSTANCE: return "Specified instance in FMOD_REVERB_PROPERTIES couldn't be set. Most likely because it is an invalid instance number or the reverb doesn't exist.";
|
||||
case FMOD_ERR_SUBSOUNDS: return "The error occurred because the sound referenced contains subsounds when it shouldn't have, or it doesn't contain subsounds when it should have. The operation may also not be able to be performed on a parent sound.";
|
||||
case FMOD_ERR_SUBSOUND_ALLOCATED: return "This subsound is already being used by another sound, you cannot have more than one parent to a sound. Null out the other parent's entry first.";
|
||||
case FMOD_ERR_SUBSOUND_CANTMOVE: return "Shared subsounds cannot be replaced or moved from their parent stream, such as when the parent stream is an FSB file.";
|
||||
case FMOD_ERR_TAGNOTFOUND: return "The specified tag could not be found or there are no tags.";
|
||||
case FMOD_ERR_TOOMANYCHANNELS: return "The sound created exceeds the allowable input channel count. This can be increased using the 'maxinputchannels' parameter in System::setSoftwareFormat.";
|
||||
case FMOD_ERR_TRUNCATED: return "The retrieved string is too long to fit in the supplied buffer and has been truncated.";
|
||||
case FMOD_ERR_UNIMPLEMENTED: return "Something in FMOD hasn't been implemented when it should be. Contact support.";
|
||||
case FMOD_ERR_UNINITIALIZED: return "This command failed because System::init or System::setDriver was not called.";
|
||||
case FMOD_ERR_UNSUPPORTED: return "A command issued was not supported by this object. Possibly a plugin without certain callbacks specified.";
|
||||
case FMOD_ERR_VERSION: return "The version number of this file format is not supported.";
|
||||
case FMOD_ERR_EVENT_ALREADY_LOADED: return "The specified bank has already been loaded.";
|
||||
case FMOD_ERR_EVENT_LIVEUPDATE_BUSY: return "The live update connection failed due to the game already being connected.";
|
||||
case FMOD_ERR_EVENT_LIVEUPDATE_MISMATCH: return "The live update connection failed due to the game data being out of sync with the tool.";
|
||||
case FMOD_ERR_EVENT_LIVEUPDATE_TIMEOUT: return "The live update connection timed out.";
|
||||
case FMOD_ERR_EVENT_NOTFOUND: return "The requested event, parameter, bus or vca could not be found.";
|
||||
case FMOD_ERR_STUDIO_UNINITIALIZED: return "The Studio::System object is not yet initialized.";
|
||||
case FMOD_ERR_STUDIO_NOT_LOADED: return "The specified resource is not loaded, so it can't be unloaded.";
|
||||
case FMOD_ERR_INVALID_STRING: return "An invalid string was passed to this function.";
|
||||
case FMOD_ERR_ALREADY_LOCKED: return "The specified resource is already locked.";
|
||||
case FMOD_ERR_NOT_LOCKED: return "The specified resource is not locked, so it can't be unlocked.";
|
||||
case FMOD_ERR_RECORD_DISCONNECTED: return "The specified recording driver has been disconnected.";
|
||||
case FMOD_ERR_TOOMANYSAMPLES: return "The length provided exceeds the allowable limit.";
|
||||
default : return "Unknown error.";
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
23
loader/include/Geode/fmod/fmod_output.h
vendored
|
@ -1,6 +1,6 @@
|
|||
/* ======================================================================================== */
|
||||
/* FMOD Core API - output development header file. */
|
||||
/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2020. */
|
||||
/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2024. */
|
||||
/* */
|
||||
/* Use this header if you are wanting to develop your own output plugin to use with */
|
||||
/* FMOD's output system. With this header you can make your own output plugin that FMOD */
|
||||
|
@ -8,7 +8,7 @@
|
|||
/* plugin. */
|
||||
/* */
|
||||
/* For more detail visit: */
|
||||
/* https://fmod.com/resources/documentation-api?version=2.0&page=plugin-api-output.html */
|
||||
/* https://fmod.com/docs/2.02/api/plugin-api-output.html */
|
||||
/* ======================================================================================== */
|
||||
#ifndef _FMOD_OUTPUT_H
|
||||
#define _FMOD_OUTPUT_H
|
||||
|
@ -19,27 +19,23 @@ typedef struct FMOD_OUTPUT_OBJECT3DINFO FMOD_OUTPUT_OBJECT3DINFO;
|
|||
/*
|
||||
Output constants
|
||||
*/
|
||||
#define FMOD_OUTPUT_PLUGIN_VERSION 4
|
||||
#define FMOD_OUTPUT_PLUGIN_VERSION 5
|
||||
|
||||
typedef unsigned int FMOD_OUTPUT_METHOD;
|
||||
#define FMOD_OUTPUT_METHOD_MIX_DIRECT 0
|
||||
#define FMOD_OUTPUT_METHOD_POLLING 1
|
||||
#define FMOD_OUTPUT_METHOD_MIX_BUFFERED 2
|
||||
#define FMOD_OUTPUT_METHOD_MIX_BUFFERED 1
|
||||
|
||||
/*
|
||||
Output callbacks
|
||||
*/
|
||||
typedef FMOD_RESULT (F_CALL *FMOD_OUTPUT_GETNUMDRIVERS_CALLBACK) (FMOD_OUTPUT_STATE *output_state, int *numdrivers);
|
||||
typedef FMOD_RESULT (F_CALL *FMOD_OUTPUT_GETDRIVERINFO_CALLBACK) (FMOD_OUTPUT_STATE *output_state, int id, char *name, int namelen, FMOD_GUID *guid, int *systemrate, FMOD_SPEAKERMODE *speakermode, int *speakermodechannels);
|
||||
typedef FMOD_RESULT (F_CALL *FMOD_OUTPUT_INIT_CALLBACK) (FMOD_OUTPUT_STATE *output_state, int selecteddriver, FMOD_INITFLAGS flags, int *outputrate, FMOD_SPEAKERMODE *speakermode, int *speakermodechannels, FMOD_SOUND_FORMAT *outputformat, int dspbufferlength, int dspnumbuffers, void *extradriverdata);
|
||||
typedef FMOD_RESULT (F_CALL *FMOD_OUTPUT_INIT_CALLBACK) (FMOD_OUTPUT_STATE *output_state, int selecteddriver, FMOD_INITFLAGS flags, int *outputrate, FMOD_SPEAKERMODE *speakermode, int *speakermodechannels, FMOD_SOUND_FORMAT *outputformat, int dspbufferlength, int *dspnumbuffers, int *dspnumadditionalbuffers, void *extradriverdata);
|
||||
typedef FMOD_RESULT (F_CALL *FMOD_OUTPUT_START_CALLBACK) (FMOD_OUTPUT_STATE *output_state);
|
||||
typedef FMOD_RESULT (F_CALL *FMOD_OUTPUT_STOP_CALLBACK) (FMOD_OUTPUT_STATE *output_state);
|
||||
typedef FMOD_RESULT (F_CALL *FMOD_OUTPUT_CLOSE_CALLBACK) (FMOD_OUTPUT_STATE *output_state);
|
||||
typedef FMOD_RESULT (F_CALL *FMOD_OUTPUT_UPDATE_CALLBACK) (FMOD_OUTPUT_STATE *output_state);
|
||||
typedef FMOD_RESULT (F_CALL *FMOD_OUTPUT_GETHANDLE_CALLBACK) (FMOD_OUTPUT_STATE *output_state, void **handle);
|
||||
typedef FMOD_RESULT (F_CALL *FMOD_OUTPUT_GETPOSITION_CALLBACK) (FMOD_OUTPUT_STATE *output_state, unsigned int *pcm);
|
||||
typedef FMOD_RESULT (F_CALL *FMOD_OUTPUT_LOCK_CALLBACK) (FMOD_OUTPUT_STATE *output_state, unsigned int offset, unsigned int length, void **ptr1, void **ptr2, unsigned int *len1, unsigned int *len2);
|
||||
typedef FMOD_RESULT (F_CALL *FMOD_OUTPUT_UNLOCK_CALLBACK) (FMOD_OUTPUT_STATE *output_state, void *ptr1, void *ptr2, unsigned int len1, unsigned int len2);
|
||||
typedef FMOD_RESULT (F_CALL *FMOD_OUTPUT_MIXER_CALLBACK) (FMOD_OUTPUT_STATE *output_state);
|
||||
typedef FMOD_RESULT (F_CALL *FMOD_OUTPUT_OBJECT3DGETINFO_CALLBACK) (FMOD_OUTPUT_STATE *output_state, int *maxhardwareobjects);
|
||||
typedef FMOD_RESULT (F_CALL *FMOD_OUTPUT_OBJECT3DALLOC_CALLBACK) (FMOD_OUTPUT_STATE *output_state, void **object3d);
|
||||
|
@ -57,7 +53,7 @@ typedef FMOD_RESULT (F_CALL *FMOD_OUTPUT_COPYPORT_FUNC) (FMOD_OUTPUT
|
|||
typedef FMOD_RESULT (F_CALL *FMOD_OUTPUT_REQUESTRESET_FUNC) (FMOD_OUTPUT_STATE *output_state);
|
||||
typedef void * (F_CALL *FMOD_OUTPUT_ALLOC_FUNC) (unsigned int size, unsigned int align, const char *file, int line);
|
||||
typedef void (F_CALL *FMOD_OUTPUT_FREE_FUNC) (void *ptr, const char *file, int line);
|
||||
typedef void (F_CALL *FMOD_OUTPUT_LOG_FUNC) (FMOD_DEBUG_FLAGS level, const char *file, int line, const char *function, const char *string);
|
||||
typedef void (F_CALL *FMOD_OUTPUT_LOG_FUNC) (FMOD_DEBUG_FLAGS level, const char *file, int line, const char *function, const char *string, ...);
|
||||
|
||||
/*
|
||||
Output structures
|
||||
|
@ -67,7 +63,7 @@ typedef struct FMOD_OUTPUT_DESCRIPTION
|
|||
unsigned int apiversion;
|
||||
const char *name;
|
||||
unsigned int version;
|
||||
FMOD_OUTPUT_METHOD polling; /* This will become "method" on the next major version */
|
||||
FMOD_OUTPUT_METHOD method;
|
||||
FMOD_OUTPUT_GETNUMDRIVERS_CALLBACK getnumdrivers;
|
||||
FMOD_OUTPUT_GETDRIVERINFO_CALLBACK getdriverinfo;
|
||||
FMOD_OUTPUT_INIT_CALLBACK init;
|
||||
|
@ -76,9 +72,6 @@ typedef struct FMOD_OUTPUT_DESCRIPTION
|
|||
FMOD_OUTPUT_CLOSE_CALLBACK close;
|
||||
FMOD_OUTPUT_UPDATE_CALLBACK update;
|
||||
FMOD_OUTPUT_GETHANDLE_CALLBACK gethandle;
|
||||
FMOD_OUTPUT_GETPOSITION_CALLBACK getposition;
|
||||
FMOD_OUTPUT_LOCK_CALLBACK lock;
|
||||
FMOD_OUTPUT_UNLOCK_CALLBACK unlock;
|
||||
FMOD_OUTPUT_MIXER_CALLBACK mixer;
|
||||
FMOD_OUTPUT_OBJECT3DGETINFO_CALLBACK object3dgetinfo;
|
||||
FMOD_OUTPUT_OBJECT3DALLOC_CALLBACK object3dalloc;
|
||||
|
@ -120,7 +113,7 @@ struct FMOD_OUTPUT_OBJECT3DINFO
|
|||
#define FMOD_OUTPUT_FREE(_state, _ptr) \
|
||||
(_state)->free(_ptr, __FILE__, __LINE__)
|
||||
#define FMOD_OUTPUT_LOG(_state, _level, _location, _format, ...) \
|
||||
(_state)->log(_level, __FILE__, __LINE__, _location, _format, __VA_ARGS__)
|
||||
(_state)->log(_level, __FILE__, __LINE__, _location, _format, ##__VA_ARGS__)
|
||||
#define FMOD_OUTPUT_COPYPORT(_state, _id, _buffer, _length) \
|
||||
(_state)->copyport(_state, _id, _buffer, _length)
|
||||
#define FMOD_OUTPUT_REQUESTRESET(_state) \
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <mutex>
|
||||
#include <deque>
|
||||
#include <unordered_set>
|
||||
#include <atomic>
|
||||
|
||||
namespace geode {
|
||||
class Mod;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include <type_traits>
|
||||
#include "ItaniumCast.hpp"
|
||||
|
||||
namespace geode {
|
||||
|
|
|
@ -1,8 +1,107 @@
|
|||
#pragma once
|
||||
|
||||
#include "../loader/Mod.hpp"
|
||||
#include <Geode/binding/FLAlertLayer.hpp>
|
||||
|
||||
class ModPopup;
|
||||
class ModItem;
|
||||
class ModLogoSprite;
|
||||
class FLAlertLayer; // for macos :3
|
||||
|
||||
namespace geode {
|
||||
/**
|
||||
* Event posted whenever a popup is opened for a mod. Allows mods to modify
|
||||
* the Geode UI. See the [tutorial on Geode UI modification](https://docs.geode-sdk.org/tutorials/modify-geode)
|
||||
* for **very important notes on these events**!
|
||||
*/
|
||||
class GEODE_DLL ModPopupUIEvent final : public Event {
|
||||
private:
|
||||
class Impl;
|
||||
std::unique_ptr<Impl> m_impl;
|
||||
|
||||
friend class ::ModPopup;
|
||||
|
||||
ModPopupUIEvent(std::unique_ptr<Impl>&& impl);
|
||||
|
||||
public:
|
||||
virtual ~ModPopupUIEvent();
|
||||
|
||||
/**
|
||||
* Get the popup itself
|
||||
*/
|
||||
FLAlertLayer* getPopup() const;
|
||||
/**
|
||||
* Get the ID of the mod this popup is for
|
||||
*/
|
||||
std::string getModID() const;
|
||||
/**
|
||||
* If this popup is of an installed mod, get it
|
||||
*/
|
||||
std::optional<Mod*> getMod() const;
|
||||
};
|
||||
|
||||
/**
|
||||
* Event posted whenever a logo sprite is created for a mod. Allows mods to modify
|
||||
* the Geode UI. See the [tutorial on Geode UI modification](https://docs.geode-sdk.org/tutorials/modify-geode)
|
||||
* for **very important notes on these events**!
|
||||
*/
|
||||
class GEODE_DLL ModItemUIEvent final : public Event {
|
||||
private:
|
||||
class Impl;
|
||||
std::unique_ptr<Impl> m_impl;
|
||||
|
||||
friend class ::ModItem;
|
||||
|
||||
ModItemUIEvent(std::unique_ptr<Impl>&& impl);
|
||||
|
||||
public:
|
||||
virtual ~ModItemUIEvent();
|
||||
|
||||
/**
|
||||
* Get the item itself
|
||||
*/
|
||||
cocos2d::CCNode* getItem() const;
|
||||
/**
|
||||
* Get the ID of the mod this logo is for
|
||||
*/
|
||||
std::string getModID() const;
|
||||
/**
|
||||
* If this logo is of an installed mod, get it
|
||||
*/
|
||||
std::optional<Mod*> getMod() const;
|
||||
};
|
||||
|
||||
/**
|
||||
* Event posted whenever a logo sprite is created for a mod. Allows mods to modify
|
||||
* the Geode UI. See the [tutorial on Geode UI modification](https://docs.geode-sdk.org/tutorials/modify-geode)
|
||||
* for **very important notes on these events**!
|
||||
*/
|
||||
class GEODE_DLL ModLogoUIEvent final : public Event {
|
||||
private:
|
||||
class Impl;
|
||||
std::unique_ptr<Impl> m_impl;
|
||||
|
||||
friend class ::ModLogoSprite;
|
||||
|
||||
ModLogoUIEvent(std::unique_ptr<Impl>&& impl);
|
||||
|
||||
public:
|
||||
virtual ~ModLogoUIEvent();
|
||||
|
||||
/**
|
||||
* Get the sprite itself
|
||||
*/
|
||||
cocos2d::CCNode* getSprite() const;
|
||||
/**
|
||||
* Get the ID of the mod this logo is for
|
||||
*/
|
||||
std::string getModID() const;
|
||||
/**
|
||||
* If this logo is of an installed mod, get it
|
||||
*/
|
||||
std::optional<Mod*> getMod() const;
|
||||
};
|
||||
|
||||
/**
|
||||
* Open the Geode mods list
|
||||
*/
|
||||
|
@ -11,6 +110,15 @@ namespace geode {
|
|||
* Open the info popup for a mod
|
||||
*/
|
||||
GEODE_DLL void openInfoPopup(Mod* mod);
|
||||
/**
|
||||
* Open the info popup for a mod based on an ID. If the mod is installed,
|
||||
* its installed popup is opened. Otherwise will check if the servers
|
||||
* have this mod, or if not, show an error popup
|
||||
* @returns A Task that completes to `true` if the mod was found and a
|
||||
* popup was opened, and `false` otherwise. If you wish to modify the
|
||||
* created popup, listen for the Geode UI events listed in `GeodeUI.hpp`
|
||||
*/
|
||||
GEODE_DLL Task<bool> openInfoPopup(std::string const& modID);
|
||||
/**
|
||||
* Open the info popup for a mod on the changelog page
|
||||
*/
|
||||
|
|
29
loader/include/Geode/ui/LoadingSpinner.hpp
Normal file
|
@ -0,0 +1,29 @@
|
|||
#pragma once
|
||||
|
||||
#include <cocos2d.h>
|
||||
|
||||
namespace geode {
|
||||
/**
|
||||
* An eternally spinning loading circle. Essentially just a more convenient
|
||||
* alternative to RobTop's `LoadingCircle` class, as this one respects its
|
||||
* content size and is a lot more stripped down (not requiring a `show`
|
||||
* method or anything - it just works!)
|
||||
*/
|
||||
class GEODE_DLL LoadingSpinner : public cocos2d::CCNode {
|
||||
protected:
|
||||
cocos2d::CCSprite* m_spinner;
|
||||
|
||||
bool init(float size);
|
||||
|
||||
void spin();
|
||||
|
||||
public:
|
||||
/**
|
||||
* Create a loading circle
|
||||
* @param size The diameter of the circle in Cocos units
|
||||
*/
|
||||
static LoadingSpinner* create(float size);
|
||||
|
||||
void setVisible(bool visible) override;
|
||||
};
|
||||
}
|
|
@ -138,6 +138,15 @@ namespace geode {
|
|||
*/
|
||||
std::string getString() const;
|
||||
|
||||
/**
|
||||
* Focus this input (activate the cursor)
|
||||
*/
|
||||
void focus();
|
||||
/**
|
||||
* Defocus this input (deactivate the cursor)
|
||||
*/
|
||||
void defocus();
|
||||
|
||||
CCTextInputNode* getInputNode() const;
|
||||
cocos2d::extension::CCScale9Sprite* getBGSprite() const;
|
||||
};
|
||||
|
|
|
@ -163,9 +163,12 @@ namespace geode {
|
|||
m_status = Status::Cancelled;
|
||||
// If this task carries extra data, call the extra data's
|
||||
// handling method
|
||||
if (m_extraData) {
|
||||
m_extraData->cancel();
|
||||
}
|
||||
// Actually: don't do this! This will cancel tasks even if
|
||||
// they have other listeners! The extra data's destructor
|
||||
// will handle cancellation if it has no other listeners!
|
||||
// if (m_extraData) {
|
||||
// m_extraData->cancel();
|
||||
// }
|
||||
// No need to actually post an event because this Task is
|
||||
// unlisteanable
|
||||
m_finalEventPosted = true;
|
||||
|
|
|
@ -149,16 +149,16 @@ namespace cocos2d {
|
|||
return s1.width != s2.width || s1.height != s2.height;
|
||||
}
|
||||
static bool operator<(cocos2d::CCSize const& s1, cocos2d::CCSize const& s2) {
|
||||
return s1.width < s2.width || s1.height < s2.height;
|
||||
return s1.width < s2.width && s1.height < s2.height;
|
||||
}
|
||||
static bool operator<=(cocos2d::CCSize const& s1, cocos2d::CCSize const& s2) {
|
||||
return s1.width <= s2.width || s1.height <= s2.height;
|
||||
return s1.width <= s2.width && s1.height <= s2.height;
|
||||
}
|
||||
static bool operator>(cocos2d::CCSize const& s1, cocos2d::CCSize const& s2) {
|
||||
return s1.width > s2.width || s1.height > s2.height;
|
||||
return s1.width > s2.width && s1.height > s2.height;
|
||||
}
|
||||
static bool operator>=(cocos2d::CCSize const& s1, cocos2d::CCSize const& s2) {
|
||||
return s1.width >= s2.width || s1.height >= s2.height;
|
||||
return s1.width >= s2.width && s1.height >= s2.height;
|
||||
}
|
||||
static bool operator==(cocos2d::CCRect const& r1, cocos2d::CCRect const& r2) {
|
||||
return r1.origin == r2.origin && r1.size == r2.size;
|
||||
|
@ -861,6 +861,7 @@ namespace geode::cocos {
|
|||
return {color.r / 255.f, color.g / 255.f, color.b / 255.f, color.a / 255.f};
|
||||
}
|
||||
|
||||
[[deprecated("This function may have unintended behavior, use cc3bFromHexString or manually expand the color instead")]]
|
||||
constexpr cocos2d::ccColor3B cc3x(int hexValue) {
|
||||
if (hexValue <= 0xf)
|
||||
return cocos2d::ccColor3B{
|
||||
|
@ -1300,7 +1301,7 @@ namespace geode::cocos {
|
|||
cocos2d::CCNode* offSprite,
|
||||
utils::MiniFunction<void(CCMenuItemToggler*)>&& callback
|
||||
) {
|
||||
auto item = CCMenuItemToggler::create(onSprite, offSprite, nullptr, nullptr);
|
||||
auto item = CCMenuItemToggler::create(offSprite, onSprite, nullptr, nullptr);
|
||||
assignCallback(item, std::forward<std::remove_reference_t<decltype(callback)>>(callback));
|
||||
return item;
|
||||
}
|
||||
|
@ -1315,7 +1316,7 @@ namespace geode::cocos {
|
|||
offSprite->setScale(scale);
|
||||
onSprite->setScale(scale);
|
||||
|
||||
return createToggler(offSprite, onSprite, std::forward<std::remove_reference_t<decltype(callback)>>(callback));
|
||||
return createToggler(onSprite, offSprite, std::forward<std::remove_reference_t<decltype(callback)>>(callback));
|
||||
}
|
||||
|
||||
static CCMenuItemToggler* createTogglerWithFilename(
|
||||
|
@ -1330,7 +1331,7 @@ namespace geode::cocos {
|
|||
offSprite->setScale(scale);
|
||||
onSprite->setScale(scale);
|
||||
|
||||
return createToggler(offSprite, onSprite, std::forward<std::remove_reference_t<decltype(callback)>>(callback));
|
||||
return createToggler(onSprite, offSprite, std::forward<std::remove_reference_t<decltype(callback)>>(callback));
|
||||
}
|
||||
|
||||
static CCMenuItemToggler* createTogglerWithFrameName(
|
||||
|
@ -1345,7 +1346,7 @@ namespace geode::cocos {
|
|||
offSprite->setScale(scale);
|
||||
onSprite->setScale(scale);
|
||||
|
||||
return createToggler(offSprite, onSprite, std::forward<std::remove_reference_t<decltype(callback)>>(callback));
|
||||
return createToggler(onSprite, offSprite, std::forward<std::remove_reference_t<decltype(callback)>>(callback));
|
||||
}
|
||||
|
||||
template <class Node>
|
||||
|
|
|
@ -14,16 +14,6 @@
|
|||
#include <clocale>
|
||||
#include <type_traits>
|
||||
|
||||
// only windows seems to properly implement std::hash on std::filesystem::path
|
||||
#ifdef GEODE_IS_ANDROID
|
||||
template <>
|
||||
struct std::hash<std::filesystem::path> {
|
||||
std::size_t operator()(std::filesystem::path const& path) const noexcept {
|
||||
return std::filesystem::hash_value(path);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
namespace geode {
|
||||
using ByteVector = std::vector<uint8_t>;
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "../DefaultInclude.hpp"
|
||||
#include <exception>
|
||||
|
||||
namespace geode {
|
||||
class Mod;
|
||||
|
|
|
@ -125,11 +125,13 @@ namespace geode::utils::web {
|
|||
WebTask patch(std::string_view url);
|
||||
|
||||
WebRequest& header(std::string_view name, std::string_view value);
|
||||
WebRequest& removeHeader(std::string_view name);
|
||||
WebRequest& param(std::string_view name, std::string_view value);
|
||||
template <std::integral T>
|
||||
WebRequest& param(std::string_view name, T value) {
|
||||
return this->param(name, std::to_string(value));
|
||||
}
|
||||
WebRequest& removeParam(std::string_view name);
|
||||
|
||||
/**
|
||||
* Sets the request's user agent.
|
||||
|
|
BIN
loader/include/link/win64/crypto.lib
Normal file → Executable file
BIN
loader/include/link/win64/libcurl.lib
Normal file → Executable file
BIN
loader/include/link/win64/nghttp2.lib
Normal file → Executable file
BIN
loader/include/link/win64/nghttp3.lib
Normal file → Executable file
BIN
loader/include/link/win64/ngtcp2.lib
Normal file → Executable file
BIN
loader/include/link/win64/ngtcp2_crypto_boringssl.lib
Normal file → Executable file
BIN
loader/include/link/win64/ssl.lib
Normal file → Executable file
Before Width: | Height: | Size: 2 KiB After Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 3 KiB After Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 267 B After Width: | Height: | Size: 5.3 KiB |
|
@ -14,7 +14,7 @@ using geode::stl::StringImpl;
|
|||
#define impl implFor((*this))
|
||||
|
||||
namespace gd {
|
||||
#if !defined(GEODE_IS_MACOS) && !defined(GEODE_IS_WINDOWS)
|
||||
#if !defined(GEODE_IS_MACOS) && !defined(GEODE_IS_IOS) && !defined(GEODE_IS_WINDOWS)
|
||||
string::string() {
|
||||
impl.setEmpty();
|
||||
}
|
||||
|
@ -34,6 +34,10 @@ namespace gd {
|
|||
impl.setStorage(str);
|
||||
}
|
||||
|
||||
string::string(char const* str, size_t size) {
|
||||
impl.setStorage(std::string_view(str, size));
|
||||
}
|
||||
|
||||
string::string(std::string const& str) {
|
||||
impl.setStorage(str);
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ void CCNode::setID(std::string const& id) {
|
|||
}
|
||||
|
||||
CCNode* CCNode::getChildByID(std::string const& id) {
|
||||
for (auto child : CCArrayExt<CCNode*>(m_pChildren)) {
|
||||
for (auto child : CCArrayExt<CCNode*>(this->getChildren())) {
|
||||
if (child->getID() == id) {
|
||||
return child;
|
||||
}
|
||||
|
|
|
@ -53,6 +53,11 @@ void crashlog::printMods(std::stringstream& stream) {
|
|||
}
|
||||
|
||||
std::string crashlog::writeCrashlog(geode::Mod* faultyMod, std::string const& info, std::string const& stacktrace, std::string const& registers) {
|
||||
std::filesystem::path outPath;
|
||||
return writeCrashlog(faultyMod, info, stacktrace, registers, outPath);
|
||||
}
|
||||
|
||||
std::string crashlog::writeCrashlog(geode::Mod* faultyMod, std::string const& info, std::string const& stacktrace, std::string const& registers, std::filesystem::path& outPath) {
|
||||
// make sure crashlog directory exists
|
||||
(void)utils::file::createDirectoryAll(crashlog::getCrashLogDirectory());
|
||||
|
||||
|
@ -94,9 +99,10 @@ std::string crashlog::writeCrashlog(geode::Mod* faultyMod, std::string const& in
|
|||
printMods(file);
|
||||
|
||||
// save actual file
|
||||
outPath = crashlog::getCrashLogDirectory() / (getDateString(true) + ".log");
|
||||
std::ofstream actualFile;
|
||||
actualFile.open(
|
||||
crashlog::getCrashLogDirectory() / (getDateString(true) + ".log"), std::ios::app
|
||||
outPath, std::ios::app
|
||||
);
|
||||
actualFile << file.rdbuf() << std::flush;
|
||||
actualFile.close();
|
||||
|
|
|
@ -33,6 +33,8 @@ namespace crashlog {
|
|||
|
||||
std::string GEODE_DLL writeCrashlog(geode::Mod* faultyMod, std::string const& info, std::string const& stacktrace, std::string const& registers);
|
||||
|
||||
std::string writeCrashlog(geode::Mod* faultyMod, std::string const& info, std::string const& stacktrace, std::string const& registers, std::filesystem::path& outCrashlogPath);
|
||||
|
||||
std::string getDateString(bool filesafe);
|
||||
|
||||
void GEODE_DLL printGeodeInfo(std::stringstream& stream);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <Geode/utils/VersionInfo.hpp>
|
||||
#include <Geode/utils/file.hpp>
|
||||
#include <Geode/utils/string.hpp>
|
||||
#include <Geode/utils/general.hpp>
|
||||
#include <about.hpp>
|
||||
#include <matjson.hpp>
|
||||
#include <utility>
|
||||
|
@ -149,13 +150,9 @@ Result<ModMetadata> ModMetadata::Impl::createFromSchemaV010(ModJson const& rawJs
|
|||
ver = "0.000";
|
||||
}
|
||||
if (ver != "*") {
|
||||
double val = 0.0;
|
||||
errno = 0;
|
||||
if (std::setlocale(LC_NUMERIC, "en_US.utf8")) {
|
||||
val = std::strtod(ver.c_str(), nullptr);
|
||||
if (errno == ERANGE) {
|
||||
return Err("[mod.json] has invalid target GD version");
|
||||
}
|
||||
auto res = numFromString<double>(ver);
|
||||
if (res.isErr()) {
|
||||
return Err("[mod.json] has invalid target GD version");
|
||||
}
|
||||
impl->m_gdVersion = ver;
|
||||
}
|
||||
|
@ -567,7 +564,11 @@ Result<> ModMetadata::checkGameVersion() const {
|
|||
if (!m_impl->m_gdVersion.empty()) {
|
||||
auto const ver = m_impl->m_gdVersion;
|
||||
|
||||
double modTargetVer = std::stod(ver);
|
||||
auto res = numFromString<double>(ver);
|
||||
if (res.isErr()) {
|
||||
return Err("Invalid target GD version");
|
||||
}
|
||||
double modTargetVer = res.unwrap();
|
||||
|
||||
if (modTargetVer == 0.0) { // O.o
|
||||
return Err(fmt::format("This mod doesn't support the current platform."));
|
||||
|
|
|
@ -264,7 +264,11 @@ int writeAndGetPid() {
|
|||
log::warn("Failed to read last-pid file: {}", res.error());
|
||||
}
|
||||
else {
|
||||
lastPid = std::stoi(res.unwrap());
|
||||
auto res = numFromString<int>(res.unwrap());
|
||||
if (!res) {
|
||||
log::warn("Failed to parse last-pid file: {}", res.error());
|
||||
}
|
||||
else lastPid = res.unwrap();
|
||||
}
|
||||
|
||||
std::error_code ec;
|
||||
|
|
|
@ -464,6 +464,7 @@ static std::string getInfo(LPEXCEPTION_POINTERS info, Mod* faultyMod, Mod* suspe
|
|||
|
||||
static void handleException(LPEXCEPTION_POINTERS info) {
|
||||
std::string text;
|
||||
std::filesystem::path crashlogPath;
|
||||
|
||||
// calling SymInitialize from multiple threads can have unexpected behavior, so synchronize this part
|
||||
static std::mutex symMutex;
|
||||
|
@ -492,7 +493,8 @@ static void handleException(LPEXCEPTION_POINTERS info) {
|
|||
faultyMod,
|
||||
crashInfo,
|
||||
stacktrace,
|
||||
getRegisters(info->ContextRecord)
|
||||
getRegisters(info->ContextRecord),
|
||||
crashlogPath
|
||||
);
|
||||
|
||||
if (g_symbolsInitialized) {
|
||||
|
@ -500,7 +502,13 @@ static void handleException(LPEXCEPTION_POINTERS info) {
|
|||
}
|
||||
}
|
||||
|
||||
MessageBoxA(nullptr, text.c_str(), "Geometry Dash Crashed", MB_ICONERROR);
|
||||
// defined in crashlogWindow.cpp
|
||||
extern bool showCustomCrashlogWindow(std::string text, std::filesystem::path const& crashlogPath);
|
||||
|
||||
if (!showCustomCrashlogWindow(text, crashlogPath)) {
|
||||
// if the window fails to show, we show a message box instead
|
||||
MessageBoxA(nullptr, text.c_str(), "Geometry Dash Crashed", MB_ICONERROR);
|
||||
}
|
||||
}
|
||||
|
||||
static LONG WINAPI exceptionHandler(LPEXCEPTION_POINTERS info) {
|
||||
|
|
228
loader/src/platform/windows/crashlogWindow.cpp
Normal file
|
@ -0,0 +1,228 @@
|
|||
#define ISOLATION_AWARE_ENABLED 1
|
||||
|
||||
#include <Windows.h>
|
||||
|
||||
#include <Geode/loader/Log.hpp>
|
||||
#include <Geode/utils/file.hpp>
|
||||
#include <Geode/utils/general.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <filesystem>
|
||||
|
||||
// comctl32 v6
|
||||
#pragma comment(linker, "\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
||||
|
||||
enum {
|
||||
ID_CRASHLOG_TEXT = 101,
|
||||
ID_BUTTON_CLOSE = 102,
|
||||
ID_BUTTON_OPEN_FOLDER = 103,
|
||||
ID_BUTTON_COPY_CLIPBOARD = 104,
|
||||
ID_BUTTON_RESTART_GAME = 105,
|
||||
};
|
||||
#define TO_HMENU(x) reinterpret_cast<HMENU>(static_cast<size_t>(x))
|
||||
|
||||
namespace layout {
|
||||
static constexpr int CRASHLOG_FONT_SIZE = 16;
|
||||
static constexpr int BUTTON_HEIGHT = 30;
|
||||
static constexpr int BUTTON_WIDTH = 120;
|
||||
static constexpr int BUTTON_SPACING = 10;
|
||||
|
||||
static constexpr int PADDING = 10;
|
||||
}
|
||||
|
||||
// dont judge
|
||||
std::filesystem::path g_crashlogPath;
|
||||
std::string g_crashlogText;
|
||||
|
||||
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
|
||||
switch (msg) {
|
||||
case WM_CLOSE:
|
||||
DestroyWindow(hwnd);
|
||||
break;
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
|
||||
case WM_CREATE: {
|
||||
{
|
||||
// center the window
|
||||
RECT desktopRect;
|
||||
GetClientRect(GetDesktopWindow(), &desktopRect);
|
||||
|
||||
RECT windowRect;
|
||||
GetWindowRect(hwnd, &windowRect);
|
||||
|
||||
auto x = desktopRect.right / 2 - (windowRect.right - windowRect.left) / 2;
|
||||
auto y = desktopRect.bottom / 2 - (windowRect.bottom - windowRect.top) / 2;
|
||||
|
||||
SetWindowPos(hwnd, NULL, x, y, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
|
||||
}
|
||||
|
||||
auto monoFont = CreateFontA(layout::CRASHLOG_FONT_SIZE, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, ANSI_CHARSET,
|
||||
OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
|
||||
DEFAULT_PITCH | FF_DONTCARE, TEXT("Consolas"));
|
||||
auto guiFont = static_cast<HFONT>(GetStockObject(DEFAULT_GUI_FONT));
|
||||
|
||||
auto handleText = CreateWindowA(
|
||||
"EDIT", "Crashlog text goes here", WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_LEFT | ES_MULTILINE | ES_READONLY | ES_AUTOVSCROLL | WS_BORDER,
|
||||
0, 0, 100, 100,
|
||||
hwnd, TO_HMENU(ID_CRASHLOG_TEXT), NULL, NULL
|
||||
);
|
||||
SendMessage(handleText, WM_SETFONT, WPARAM(monoFont), TRUE);
|
||||
// does nothing :(
|
||||
// Edit_SetEndOfLine(handleText, EC_ENDOFLINE_LF);
|
||||
|
||||
auto button = CreateWindowA(
|
||||
"BUTTON", "Close",
|
||||
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
|
||||
0, 0, layout::BUTTON_WIDTH, layout::BUTTON_HEIGHT,
|
||||
hwnd, TO_HMENU(ID_BUTTON_CLOSE), NULL, NULL
|
||||
);
|
||||
SendMessage(button, WM_SETFONT, WPARAM(guiFont), TRUE);
|
||||
|
||||
button = CreateWindowA(
|
||||
"BUTTON", "Open crashlog folder",
|
||||
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
|
||||
0, 0, layout::BUTTON_WIDTH, layout::BUTTON_HEIGHT,
|
||||
hwnd, TO_HMENU(ID_BUTTON_OPEN_FOLDER), NULL, NULL
|
||||
);
|
||||
SendMessage(button, WM_SETFONT, WPARAM(guiFont), TRUE);
|
||||
|
||||
button = CreateWindowA(
|
||||
"BUTTON", "Copy to clipboard",
|
||||
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
|
||||
0, 0, layout::BUTTON_WIDTH, layout::BUTTON_HEIGHT,
|
||||
hwnd, TO_HMENU(ID_BUTTON_COPY_CLIPBOARD), NULL, NULL
|
||||
);
|
||||
SendMessage(button, WM_SETFONT, WPARAM(guiFont), TRUE);
|
||||
|
||||
button = CreateWindowA(
|
||||
"BUTTON", "Restart game",
|
||||
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
|
||||
0, 0, layout::BUTTON_WIDTH, layout::BUTTON_HEIGHT,
|
||||
hwnd, TO_HMENU(ID_BUTTON_RESTART_GAME), NULL, NULL
|
||||
);
|
||||
SendMessage(button, WM_SETFONT, WPARAM(guiFont), TRUE);
|
||||
} break;
|
||||
|
||||
case WM_SIZE: {
|
||||
RECT clientRect;
|
||||
GetClientRect(hwnd, &clientRect);
|
||||
|
||||
SetWindowPos(
|
||||
GetDlgItem(hwnd, ID_CRASHLOG_TEXT), NULL,
|
||||
layout::PADDING, layout::PADDING,
|
||||
clientRect.right - layout::PADDING * 2, clientRect.bottom - layout::BUTTON_HEIGHT - layout::PADDING * 3,
|
||||
SWP_NOZORDER
|
||||
);
|
||||
|
||||
auto buttonY = clientRect.bottom - layout::BUTTON_HEIGHT - layout::PADDING;
|
||||
SetWindowPos(
|
||||
GetDlgItem(hwnd, ID_BUTTON_COPY_CLIPBOARD), NULL,
|
||||
layout::PADDING, buttonY,
|
||||
0, 0,
|
||||
SWP_NOZORDER | SWP_NOSIZE
|
||||
);
|
||||
SetWindowPos(
|
||||
GetDlgItem(hwnd, ID_BUTTON_CLOSE), NULL,
|
||||
clientRect.right - layout::BUTTON_WIDTH - layout::PADDING, buttonY,
|
||||
0, 0,
|
||||
SWP_NOZORDER | SWP_NOSIZE
|
||||
);
|
||||
SetWindowPos(
|
||||
GetDlgItem(hwnd, ID_BUTTON_OPEN_FOLDER), NULL,
|
||||
clientRect.right - layout::BUTTON_WIDTH * 2 - layout::BUTTON_SPACING - layout::PADDING, buttonY,
|
||||
0, 0,
|
||||
SWP_NOZORDER | SWP_NOSIZE
|
||||
);
|
||||
SetWindowPos(
|
||||
GetDlgItem(hwnd, ID_BUTTON_RESTART_GAME), NULL,
|
||||
clientRect.right - layout::BUTTON_WIDTH * 3 - layout::BUTTON_SPACING * 2 - layout::PADDING, buttonY,
|
||||
0, 0,
|
||||
SWP_NOZORDER | SWP_NOSIZE
|
||||
);
|
||||
|
||||
// force redraw buttons to fix weird artifacts
|
||||
RedrawWindow(GetDlgItem(hwnd, ID_BUTTON_CLOSE), NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_FRAME);
|
||||
RedrawWindow(GetDlgItem(hwnd, ID_BUTTON_OPEN_FOLDER), NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_FRAME);
|
||||
RedrawWindow(GetDlgItem(hwnd, ID_BUTTON_COPY_CLIPBOARD), NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_FRAME);
|
||||
RedrawWindow(GetDlgItem(hwnd, ID_BUTTON_RESTART_GAME), NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_FRAME);
|
||||
} break;
|
||||
|
||||
case WM_CTLCOLORSTATIC: {
|
||||
return (LRESULT)(COLOR_WINDOWFRAME);
|
||||
} break;
|
||||
|
||||
case WM_COMMAND: {
|
||||
auto id = LOWORD(wParam);
|
||||
if (id == ID_BUTTON_CLOSE) {
|
||||
DestroyWindow(hwnd);
|
||||
} else if (id == ID_BUTTON_OPEN_FOLDER) {
|
||||
geode::utils::file::openFolder(g_crashlogPath);
|
||||
} else if (id == ID_BUTTON_COPY_CLIPBOARD) {
|
||||
geode::utils::clipboard::write(g_crashlogText);
|
||||
} else if (id == ID_BUTTON_RESTART_GAME) {
|
||||
geode::utils::game::restart();
|
||||
}
|
||||
} break;
|
||||
|
||||
default:
|
||||
return DefWindowProc(hwnd, msg, wParam, lParam);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool showCustomCrashlogWindow(std::string text, std::filesystem::path const& crashlogPath) {
|
||||
static constexpr auto WINDOW_CLASS_NAME = "GeodeCrashHandlerWindow";
|
||||
|
||||
g_crashlogPath = crashlogPath;
|
||||
g_crashlogText = text;
|
||||
|
||||
// i cant get the edit control to use LF, so just replace them myself :-)
|
||||
for (int i = 0; i < text.size(); ++i) {
|
||||
auto c = text[i];
|
||||
if (c == '\n') {
|
||||
text.insert(text.begin() + i, '\r');
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
WNDCLASS wc = {0};
|
||||
wc.lpfnWndProc = &WndProc;
|
||||
wc.hInstance = GetModuleHandleA(NULL);
|
||||
wc.lpszClassName = WINDOW_CLASS_NAME;
|
||||
|
||||
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
|
||||
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wc.hbrBackground = (HBRUSH)COLOR_WINDOW;
|
||||
|
||||
if (!RegisterClass(&wc)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto hwnd = CreateWindowExA(
|
||||
0,
|
||||
WINDOW_CLASS_NAME,
|
||||
"Geode Crash Handler",
|
||||
WS_OVERLAPPEDWINDOW,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, 800, 600,
|
||||
NULL, NULL, wc.hInstance, NULL
|
||||
);
|
||||
|
||||
if (hwnd == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
SetWindowTextA(GetDlgItem(hwnd, ID_CRASHLOG_TEXT), text.c_str());
|
||||
|
||||
ShowWindow(hwnd, SW_SHOWNORMAL);
|
||||
PlaySound((LPCTSTR)SND_ALIAS_SYSTEMDEFAULT, NULL, SND_ASYNC | SND_ALIAS_ID);
|
||||
UpdateWindow(hwnd);
|
||||
|
||||
MSG message;
|
||||
while (GetMessage(&message, NULL, 0, 0) > 0) {
|
||||
TranslateMessage(&message);
|
||||
DispatchMessage(&message);
|
||||
}
|
||||
return true;
|
||||
}
|
|
@ -3,6 +3,7 @@
|
|||
#include <Geode/loader/Dirs.hpp>
|
||||
#include <Geode/utils/map.hpp>
|
||||
#include <optional>
|
||||
#include <hash/hash.hpp>
|
||||
|
||||
using namespace server;
|
||||
|
||||
|
@ -103,8 +104,16 @@ public:
|
|||
m_downloadListener.bind([this, hash = version.hash](web::WebTask::Event* event) {
|
||||
if (auto value = event->getValue()) {
|
||||
if (value->ok()) {
|
||||
if (auto actualHash = ::calculateHash(value->data()); actualHash != hash) {
|
||||
log::error("Failed to download {}, hash mismatch ({} != {})", m_id, actualHash, hash);
|
||||
m_status = DownloadStatusError {
|
||||
.details = "Hash mismatch, downloaded file did not match what was expected",
|
||||
};
|
||||
ModDownloadEvent(m_id).post();
|
||||
return;
|
||||
}
|
||||
|
||||
bool removingInstalledWasError = false;
|
||||
bool disablingReplacedWasError = false;
|
||||
std::string id = m_replacesMod.has_value() ? m_replacesMod.value() : m_id;
|
||||
if (auto mod = Loader::get()->getInstalledMod(id)) {
|
||||
std::error_code ec;
|
||||
|
|
|
@ -2,11 +2,78 @@
|
|||
#include <Geode/loader/Dirs.hpp>
|
||||
#include <Geode/ui/GeodeUI.hpp>
|
||||
#include <Geode/ui/MDPopup.hpp>
|
||||
#include <Geode/ui/LoadingSpinner.hpp>
|
||||
#include <Geode/utils/web.hpp>
|
||||
#include <server/Server.hpp>
|
||||
#include "mods/GeodeStyle.hpp"
|
||||
#include "mods/settings/ModSettingsPopup.hpp"
|
||||
#include "mods/popups/ModPopup.hpp"
|
||||
#include "GeodeUIEvent.hpp"
|
||||
|
||||
class LoadServerModLayer : public Popup<std::string const&> {
|
||||
protected:
|
||||
std::string m_id;
|
||||
EventListener<server::ServerRequest<server::ServerModMetadata>> m_listener;
|
||||
|
||||
bool setup(std::string const& id) override {
|
||||
m_closeBtn->setVisible(false);
|
||||
|
||||
this->setTitle("Loading mod...");
|
||||
|
||||
auto spinner = LoadingSpinner::create(40);
|
||||
m_mainLayer->addChildAtPosition(spinner, Anchor::Center, ccp(0, -10));
|
||||
|
||||
m_id = id;
|
||||
m_listener.bind(this, &LoadServerModLayer::onRequest);
|
||||
m_listener.setFilter(server::getMod(id));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void onRequest(server::ServerRequest<server::ServerModMetadata>::Event* event) {
|
||||
if (auto res = event->getValue()) {
|
||||
if (res->isOk()) {
|
||||
// Copy info first as onClose may free the listener which will free the event
|
||||
auto info = **res;
|
||||
this->onClose(nullptr);
|
||||
// Run this on next frame because otherwise the popup is unable to call server::getMod for some reason
|
||||
Loader::get()->queueInMainThread([info = std::move(info)]() mutable {
|
||||
ModPopup::create(ModSource(std::move(info)))->show();
|
||||
});
|
||||
}
|
||||
else {
|
||||
auto id = m_id;
|
||||
this->onClose(nullptr);
|
||||
FLAlertLayer::create(
|
||||
"Error Loading Mod",
|
||||
fmt::format("Unable to find mod with the ID <cr>{}</c>!", id),
|
||||
"OK"
|
||||
)->show();
|
||||
}
|
||||
}
|
||||
else if (event->isCancelled()) {
|
||||
this->onClose(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
Task<bool> listen() const {
|
||||
return m_listener.getFilter().map(
|
||||
[](auto* result) -> bool { return result->isOk(); },
|
||||
[](auto) -> std::monostate { return std::monostate(); }
|
||||
);
|
||||
}
|
||||
|
||||
static LoadServerModLayer* create(std::string const& id) {
|
||||
auto ret = new LoadServerModLayer();
|
||||
if (ret && ret->initAnchored(180, 100, id, "square01_001.png", CCRectZero)) {
|
||||
ret->autorelease();
|
||||
return ret;
|
||||
}
|
||||
CC_SAFE_RELEASE(ret);
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
void geode::openModsList() {
|
||||
ModsLayer::scene();
|
||||
|
@ -68,6 +135,18 @@ void geode::openSupportPopup(ModMetadata const& metadata) {
|
|||
void geode::openInfoPopup(Mod* mod) {
|
||||
ModPopup::create(mod)->show();
|
||||
}
|
||||
Task<bool> geode::openInfoPopup(std::string const& modID) {
|
||||
if (auto mod = Loader::get()->getInstalledMod(modID)) {
|
||||
openInfoPopup(mod);
|
||||
return Task<bool>::immediate(true);
|
||||
}
|
||||
else {
|
||||
auto popup = LoadServerModLayer::create(modID);
|
||||
auto task = popup->listen();
|
||||
popup->show();
|
||||
return task;
|
||||
}
|
||||
}
|
||||
void geode::openIndexPopup(Mod* mod) {
|
||||
// deprecated func
|
||||
openInfoPopup(mod);
|
||||
|
@ -98,6 +177,9 @@ protected:
|
|||
this->setAnchorPoint({ .5f, .5f });
|
||||
this->setContentSize({ 50, 50 });
|
||||
|
||||
// This is a default ID, nothing should ever rely on the ID of any ModLogoSprite being this
|
||||
this->setID(std::string(Mod::get()->expandSpriteName(fmt::format("sprite-{}", id))));
|
||||
|
||||
m_modID = id;
|
||||
m_listener.bind(this, &ModLogoSprite::onFetch);
|
||||
|
||||
|
@ -105,19 +187,22 @@ protected:
|
|||
if (!fetch) {
|
||||
this->setSprite(id == "geode.loader" ?
|
||||
CCSprite::createWithSpriteFrameName("geode-logo.png"_spr) :
|
||||
CCSprite::create(fmt::format("{}/logo.png", id).c_str())
|
||||
CCSprite::create(fmt::format("{}/logo.png", id).c_str()),
|
||||
false
|
||||
);
|
||||
}
|
||||
// Asynchronously fetch from server
|
||||
else {
|
||||
this->setSprite(createLoadingCircle(25));
|
||||
this->setSprite(createLoadingCircle(25), false);
|
||||
m_listener.setFilter(server::getModLogo(id));
|
||||
}
|
||||
|
||||
ModLogoUIEvent(std::make_unique<ModLogoUIEvent::Impl>(this, id)).post();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void setSprite(CCNode* sprite) {
|
||||
void setSprite(CCNode* sprite, bool postEvent) {
|
||||
// Remove any existing sprite
|
||||
if (m_sprite) {
|
||||
m_sprite->removeFromParent();
|
||||
|
@ -129,15 +214,20 @@ protected:
|
|||
}
|
||||
// Set sprite and scale it to node size
|
||||
m_sprite = sprite;
|
||||
limitNodeSize(m_sprite, m_obContentSize, 99.f, .05f);
|
||||
m_sprite->setID("sprite");
|
||||
limitNodeSize(m_sprite, m_obContentSize, 99.f, 0.f);
|
||||
this->addChildAtPosition(m_sprite, Anchor::Center);
|
||||
|
||||
if (postEvent) {
|
||||
ModLogoUIEvent(std::make_unique<ModLogoUIEvent::Impl>(this, m_modID)).post();
|
||||
}
|
||||
}
|
||||
|
||||
void onFetch(server::ServerRequest<ByteVector>::Event* event) {
|
||||
if (auto result = event->getValue()) {
|
||||
// Set default sprite on error
|
||||
if (result->isErr()) {
|
||||
this->setSprite(nullptr);
|
||||
this->setSprite(nullptr, true);
|
||||
}
|
||||
// Otherwise load downloaded sprite to memory
|
||||
else {
|
||||
|
@ -146,11 +236,11 @@ protected:
|
|||
image->initWithImageData(const_cast<uint8_t*>(data.data()), data.size());
|
||||
|
||||
auto texture = CCTextureCache::get()->addUIImage(image, m_modID.c_str());
|
||||
this->setSprite(CCSprite::createWithTexture(texture));
|
||||
this->setSprite(CCSprite::createWithTexture(texture), true);
|
||||
}
|
||||
}
|
||||
else if (event->isCancelled()) {
|
||||
this->setSprite(nullptr);
|
||||
this->setSprite(nullptr, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
68
loader/src/ui/GeodeUIEvent.cpp
Normal file
|
@ -0,0 +1,68 @@
|
|||
#include "GeodeUIEvent.hpp"
|
||||
|
||||
ModPopupUIEvent::ModPopupUIEvent(std::unique_ptr<Impl>&& impl) : m_impl(std::move(impl)) {}
|
||||
ModPopupUIEvent::~ModPopupUIEvent() = default;
|
||||
|
||||
FLAlertLayer* ModPopupUIEvent::getPopup() const {
|
||||
return m_impl->popup;
|
||||
}
|
||||
std::string ModPopupUIEvent::getModID() const {
|
||||
return m_impl->popup->getSource().getID();
|
||||
}
|
||||
std::optional<Mod*> ModPopupUIEvent::getMod() const {
|
||||
auto mod = m_impl->popup->getSource().asMod();
|
||||
return mod ? std::optional(mod) : std::nullopt;
|
||||
}
|
||||
|
||||
ModItemUIEvent::ModItemUIEvent(std::unique_ptr<Impl>&& impl) : m_impl(std::move(impl)) {}
|
||||
ModItemUIEvent::~ModItemUIEvent() = default;
|
||||
|
||||
CCNode* ModItemUIEvent::getItem() const {
|
||||
return m_impl->item;
|
||||
}
|
||||
std::string ModItemUIEvent::getModID() const {
|
||||
return m_impl->item->getSource().getID();
|
||||
}
|
||||
std::optional<Mod*> ModItemUIEvent::getMod() const {
|
||||
auto mod = m_impl->item->getSource().asMod();
|
||||
return mod ? std::optional(mod) : std::nullopt;
|
||||
}
|
||||
|
||||
ModLogoUIEvent::ModLogoUIEvent(std::unique_ptr<Impl>&& impl) : m_impl(std::move(impl)) {}
|
||||
ModLogoUIEvent::~ModLogoUIEvent() = default;
|
||||
|
||||
CCNode* ModLogoUIEvent::getSprite() const {
|
||||
return m_impl->sprite;
|
||||
}
|
||||
std::string ModLogoUIEvent::getModID() const {
|
||||
return m_impl->modID;
|
||||
}
|
||||
std::optional<Mod*> ModLogoUIEvent::getMod() const {
|
||||
if (auto mod = Loader::get()->getInstalledMod(m_impl->modID)) {
|
||||
return mod;
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
// $execute {
|
||||
// new EventListener<EventFilter<ModLogoUIEvent>>(+[](ModLogoUIEvent* event) {
|
||||
// if (event->getModID() == "geode.loader") {
|
||||
// auto fart = CCSprite::createWithSpriteFrameName("GJ_demonIcon_001.png");
|
||||
// fart->setScaleX(5);
|
||||
// fart->setScaleY(3);
|
||||
// event->getSprite()->addChildAtPosition(fart, Anchor::Center);
|
||||
// }
|
||||
// return ListenerResult::Propagate;
|
||||
// });
|
||||
// new EventListener<EventFilter<ModItemUIEvent>>(+[](ModItemUIEvent* event) {
|
||||
// if (event->getModID() == "geode.loader") {
|
||||
// auto fart = CCSprite::createWithSpriteFrameName("GJ_demonIcon_001.png");
|
||||
// fart->setScaleX(4);
|
||||
// fart->setScaleY(2);
|
||||
// if (auto dev = event->getItem()->querySelector("developers-button")) {
|
||||
// dev->addChildAtPosition(fart, Anchor::Center, ccp(-15, 0));
|
||||
// }
|
||||
// }
|
||||
// return ListenerResult::Propagate;
|
||||
// });
|
||||
// }
|
32
loader/src/ui/GeodeUIEvent.hpp
Normal file
|
@ -0,0 +1,32 @@
|
|||
#pragma once
|
||||
|
||||
#include <Geode/ui/GeodeUI.hpp>
|
||||
#include "mods/popups/ModPopup.hpp"
|
||||
#include "mods/list/ModItem.hpp"
|
||||
|
||||
using namespace geode::prelude;
|
||||
|
||||
class ModPopupUIEvent::Impl {
|
||||
public:
|
||||
ModPopup* popup;
|
||||
|
||||
Impl(ModPopup* popup)
|
||||
: popup(popup) {}
|
||||
};
|
||||
|
||||
class ModItemUIEvent::Impl {
|
||||
public:
|
||||
ModItem* item;
|
||||
|
||||
Impl(ModItem* item)
|
||||
: item(item) {}
|
||||
};
|
||||
|
||||
class ModLogoUIEvent::Impl {
|
||||
public:
|
||||
CCNode* sprite;
|
||||
std::string modID;
|
||||
|
||||
Impl(CCNode* sprite, std::string const& modID)
|
||||
: sprite(sprite), modID(modID) {}
|
||||
};
|
|
@ -3,6 +3,7 @@
|
|||
#include <Geode/utils/ColorProvider.hpp>
|
||||
#include <Geode/loader/SettingEvent.hpp>
|
||||
#include <Geode/binding/ButtonSprite.hpp>
|
||||
#include <Geode/ui/LoadingSpinner.hpp>
|
||||
|
||||
$on_mod(Loaded) {
|
||||
// todo: these names should probably be shorter so they fit in SSO...
|
||||
|
@ -134,51 +135,6 @@ void GeodeSquareSprite::setState(bool state) {
|
|||
}
|
||||
}
|
||||
|
||||
class LoadingSpinner : public CCNode {
|
||||
protected:
|
||||
CCSprite* m_spinner;
|
||||
|
||||
bool init(float sideLength) {
|
||||
if (!CCNode::init())
|
||||
return false;
|
||||
|
||||
this->setID("loading-spinner");
|
||||
this->setContentSize({ sideLength, sideLength });
|
||||
this->setAnchorPoint({ .5f, .5f });
|
||||
|
||||
m_spinner = CCSprite::create("loadingCircle.png");
|
||||
m_spinner->setBlendFunc({ GL_ONE, GL_ONE });
|
||||
limitNodeSize(m_spinner, m_obContentSize, 1.f, .1f);
|
||||
this->addChildAtPosition(m_spinner, Anchor::Center);
|
||||
|
||||
this->spin();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void spin() {
|
||||
m_spinner->runAction(CCRepeatForever::create(CCRotateBy::create(1.f, 360.f)));
|
||||
}
|
||||
|
||||
public:
|
||||
static LoadingSpinner* create(float sideLength) {
|
||||
auto ret = new LoadingSpinner();
|
||||
if (ret->init(sideLength)) {
|
||||
ret->autorelease();
|
||||
return ret;
|
||||
}
|
||||
delete ret;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void setVisible(bool visible) override {
|
||||
CCNode::setVisible(visible);
|
||||
if (visible) {
|
||||
this->spin();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
CCNode* createLoadingCircle(float sideLength, const char* id) {
|
||||
auto spinner = LoadingSpinner::create(sideLength);
|
||||
spinner->setID(id);
|
||||
|
|
|
@ -350,17 +350,17 @@ bool ModsLayer::init() {
|
|||
reloadBtn->setID("reload-button");
|
||||
actionsMenu->addChild(reloadBtn);
|
||||
|
||||
auto themeSpr = createGeodeCircleButton(
|
||||
auto settingsSpr = createGeodeCircleButton(
|
||||
CCSprite::createWithSpriteFrameName("settings.png"_spr), 1.f,
|
||||
CircleBaseSize::Medium
|
||||
);
|
||||
themeSpr->setScale(.8f);
|
||||
themeSpr->setTopOffset(ccp(.5f, 0));
|
||||
auto themeBtn = CCMenuItemSpriteExtra::create(
|
||||
themeSpr, this, menu_selector(ModsLayer::onSettings)
|
||||
settingsSpr->setScale(.8f);
|
||||
settingsSpr->setTopOffset(ccp(.5f, 0));
|
||||
auto settingsBtn = CCMenuItemSpriteExtra::create(
|
||||
settingsSpr, this, menu_selector(ModsLayer::onSettings)
|
||||
);
|
||||
themeBtn->setID("theme-button");
|
||||
actionsMenu->addChild(themeBtn);
|
||||
settingsBtn->setID("settings-button");
|
||||
actionsMenu->addChild(settingsBtn);
|
||||
|
||||
auto folderSpr = createGeodeCircleButton(
|
||||
CCSprite::createWithSpriteFrameName("gj_folderBtn_001.png"), 1.f,
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "../popups/DevPopup.hpp"
|
||||
#include "ui/mods/popups/ModErrorPopup.hpp"
|
||||
#include "ui/mods/sources/ModSource.hpp"
|
||||
#include "../../GeodeUIEvent.hpp"
|
||||
|
||||
bool ModItem::init(ModSource&& source) {
|
||||
if (!CCNode::init())
|
||||
|
@ -407,6 +408,8 @@ void ModItem::updateState() {
|
|||
on->setOpacity(105);
|
||||
}
|
||||
}
|
||||
|
||||
ModItemUIEvent(std::make_unique<ModItemUIEvent::Impl>(this)).post();
|
||||
}
|
||||
|
||||
void ModItem::updateSize(float width, bool big) {
|
||||
|
@ -521,3 +524,7 @@ ModItem* ModItem::create(ModSource&& source) {
|
|||
delete ret;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ModSource& ModItem::getSource() & {
|
||||
return m_source;
|
||||
}
|
||||
|
|
|
@ -56,4 +56,6 @@ public:
|
|||
static ModItem* create(ModSource&& source);
|
||||
|
||||
void updateSize(float width, bool big);
|
||||
|
||||
ModSource& getSource() &;
|
||||
};
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "ConfirmUninstallPopup.hpp"
|
||||
#include "../settings/ModSettingsPopup.hpp"
|
||||
#include "../../../internal/about.hpp"
|
||||
#include "../../GeodeUIEvent.hpp"
|
||||
|
||||
class FetchTextArea : public CCNode {
|
||||
public:
|
||||
|
@ -29,6 +30,7 @@ protected:
|
|||
m_noneText = noneText;
|
||||
|
||||
m_textarea = MDTextArea::create("", size);
|
||||
m_textarea->setID("textarea");
|
||||
this->addChildAtPosition(m_textarea, Anchor::Center);
|
||||
|
||||
m_loading = createLoadingCircle(30);
|
||||
|
@ -67,6 +69,8 @@ bool ModPopup::setup(ModSource&& src) {
|
|||
m_source = std::move(src);
|
||||
m_noElasticity = true;
|
||||
|
||||
this->setID(std::string(Mod::get()->expandSpriteName(fmt::format("popup-{}", src.getID()))));
|
||||
|
||||
if (src.asMod() == Mod::get()) {
|
||||
// Display commit hashes
|
||||
auto loaderHash = about::getLoaderCommitHash();
|
||||
|
@ -97,6 +101,7 @@ bool ModPopup::setup(ModSource&& src) {
|
|||
titleContainer->setAnchorPoint({ .5f, .5f });
|
||||
|
||||
auto logo = m_source.createModLogo();
|
||||
logo->setID("mod-logo");
|
||||
limitNodeSize(
|
||||
logo,
|
||||
ccp(titleContainer->getContentHeight(), titleContainer->getContentHeight()),
|
||||
|
@ -112,12 +117,14 @@ bool ModPopup::setup(ModSource&& src) {
|
|||
auto title = CCLabelBMFont::create(m_source.getMetadata().getName().c_str(), "bigFont.fnt");
|
||||
title->limitLabelWidth(titleContainer->getContentWidth() - devAndTitlePos, .45f, .1f);
|
||||
title->setAnchorPoint({ .0f, .5f });
|
||||
title->setID("mod-name-label");
|
||||
titleContainer->addChildAtPosition(title, Anchor::TopLeft, ccp(devAndTitlePos, -titleContainer->getContentHeight() * .25f));
|
||||
|
||||
auto by = "By " + m_source.formatDevelopers();
|
||||
auto dev = CCLabelBMFont::create(by.c_str(), "goldFont.fnt");
|
||||
dev->limitLabelWidth(titleContainer->getContentWidth() - devAndTitlePos, .35f, .05f);
|
||||
dev->setAnchorPoint({ .0f, .5f });
|
||||
dev->setID("mod-developer-label");
|
||||
titleContainer->addChildAtPosition(dev, Anchor::BottomLeft, ccp(devAndTitlePos, titleContainer->getContentHeight() * .25f));
|
||||
|
||||
// Suggestions
|
||||
|
@ -170,6 +177,7 @@ bool ModPopup::setup(ModSource&& src) {
|
|||
idLabel->limitLabelWidth(leftColumn->getContentWidth(), .25f, .05f);
|
||||
idLabel->setColor({ 150, 150, 150 });
|
||||
idLabel->setOpacity(140);
|
||||
idLabel->setID("mod-id-label");
|
||||
leftColumn->addChild(idLabel);
|
||||
|
||||
auto statsContainer = CCNode::create();
|
||||
|
@ -186,6 +194,7 @@ bool ModPopup::setup(ModSource&& src) {
|
|||
m_stats = CCNode::create();
|
||||
m_stats->setContentSize(statsContainer->getContentSize() - ccp(10, 10));
|
||||
m_stats->setAnchorPoint({ .5f, .5f });
|
||||
m_stats->setID("mod-stats-container");
|
||||
|
||||
for (auto stat : std::initializer_list<std::tuple<
|
||||
const char*, const char*, const char*, std::optional<std::string>, const char*
|
||||
|
@ -264,6 +273,7 @@ bool ModPopup::setup(ModSource&& src) {
|
|||
m_tags->ignoreAnchorPointForPosition(false);
|
||||
m_tags->setContentSize(tagsContainer->getContentSize() - ccp(10, 10));
|
||||
m_tags->setAnchorPoint({ .5f, .5f });
|
||||
m_tags->setID("tags-container");
|
||||
|
||||
m_tags->addChild(createLoadingCircle(50));
|
||||
|
||||
|
@ -438,6 +448,7 @@ bool ModPopup::setup(ModSource&& src) {
|
|||
linksMenu->ignoreAnchorPointForPosition(false);
|
||||
linksMenu->setContentSize(linksContainer->getContentSize() - ccp(10, 10));
|
||||
linksMenu->setAnchorPoint({ .5f, .5f });
|
||||
linksMenu->setID("links-container");
|
||||
|
||||
// auto linksLabel = CCLabelBMFont::create("Links", "bigFont.fnt");
|
||||
// linksLabel->setLayoutOptions(
|
||||
|
@ -447,28 +458,29 @@ bool ModPopup::setup(ModSource&& src) {
|
|||
// linksMenu->addChild(linksLabel);
|
||||
|
||||
for (auto stat : std::initializer_list<std::tuple<
|
||||
const char*, std::optional<std::string>, SEL_MenuHandler
|
||||
const char*, const char*, std::optional<std::string>, SEL_MenuHandler
|
||||
>> {
|
||||
{ "homepage.png"_spr, m_source.getMetadata().getLinks().getHomepageURL(), nullptr },
|
||||
{ "github.png"_spr, m_source.getMetadata().getLinks().getSourceURL(), nullptr },
|
||||
{ "gj_discordIcon_001.png", m_source.getMetadata().getLinks().getCommunityURL(), nullptr },
|
||||
{ "gift.png"_spr, m_source.getMetadata().getSupportInfo(), menu_selector(ModPopup::onSupport) },
|
||||
{ "homepage", "homepage.png"_spr, m_source.getMetadata().getLinks().getHomepageURL(), nullptr },
|
||||
{ "github", "github.png"_spr, m_source.getMetadata().getLinks().getSourceURL(), nullptr },
|
||||
{ "discord", "gj_discordIcon_001.png", m_source.getMetadata().getLinks().getCommunityURL(), nullptr },
|
||||
{ "support", "gift.png"_spr, m_source.getMetadata().getSupportInfo(), menu_selector(ModPopup::onSupport) },
|
||||
}) {
|
||||
auto spr = CCSprite::createWithSpriteFrameName(std::get<0>(stat));
|
||||
auto spr = CCSprite::createWithSpriteFrameName(std::get<1>(stat));
|
||||
spr->setScale(.75f);
|
||||
if (!std::get<1>(stat).has_value()) {
|
||||
if (!std::get<2>(stat).has_value()) {
|
||||
spr->setColor({ 155, 155, 155 });
|
||||
spr->setOpacity(155);
|
||||
}
|
||||
auto btn = CCMenuItemSpriteExtra::create(
|
||||
spr, this, (
|
||||
std::get<1>(stat).has_value() ?
|
||||
(std::get<2>(stat) ? std::get<2>(stat) : menu_selector(ModPopup::onLink)) :
|
||||
std::get<2>(stat).has_value() ?
|
||||
(std::get<3>(stat) ? std::get<3>(stat) : menu_selector(ModPopup::onLink)) :
|
||||
nullptr
|
||||
)
|
||||
);
|
||||
if (!std::get<2>(stat) && std::get<1>(stat)) {
|
||||
btn->setUserObject("url", CCString::create(*std::get<1>(stat)));
|
||||
btn->setID(std::get<0>(stat));
|
||||
if (!std::get<3>(stat) && std::get<2>(stat)) {
|
||||
btn->setUserObject("url", CCString::create(*std::get<2>(stat)));
|
||||
}
|
||||
linksMenu->addChild(btn);
|
||||
}
|
||||
|
@ -510,17 +522,19 @@ bool ModPopup::setup(ModSource&& src) {
|
|||
tabsMenu->setScale(.65f);
|
||||
tabsMenu->setContentWidth(m_rightColumn->getContentWidth() / tabsMenu->getScale());
|
||||
tabsMenu->setAnchorPoint({ .5f, 1.f });
|
||||
tabsMenu->setID("tabs-menu");
|
||||
|
||||
for (auto mdTab : std::initializer_list<std::tuple<const char*, const char*, Tab>> {
|
||||
{ "message.png"_spr, "Description", Tab::Details },
|
||||
{ "changelog.png"_spr, "Changelog", Tab::Changelog }
|
||||
for (auto mdTab : std::initializer_list<std::tuple<const char*, const char*, const char*, Tab>> {
|
||||
{ "message.png"_spr, "Description", "description", Tab::Details },
|
||||
{ "changelog.png"_spr, "Changelog", "changelog", Tab::Changelog }
|
||||
// { "version.png"_spr, "Versions", Tab::Versions },
|
||||
}) {
|
||||
auto spr = GeodeTabSprite::create(std::get<0>(mdTab), std::get<1>(mdTab), 140, m_source.asServer());
|
||||
auto btn = CCMenuItemSpriteExtra::create(spr, this, menu_selector(ModPopup::onTab));
|
||||
btn->setTag(static_cast<int>(std::get<2>(mdTab)));
|
||||
btn->setTag(static_cast<int>(std::get<3>(mdTab)));
|
||||
btn->setID(std::get<2>(mdTab));
|
||||
tabsMenu->addChild(btn);
|
||||
m_tabs.insert({ std::get<2>(mdTab), { spr, nullptr } });
|
||||
m_tabs.insert({ std::get<3>(mdTab), { spr, nullptr } });
|
||||
}
|
||||
|
||||
// placeholder external link until versions tab is implemented
|
||||
|
@ -532,7 +546,7 @@ bool ModPopup::setup(ModSource&& src) {
|
|||
|
||||
auto externalLinkBtn = CCMenuItemSpriteExtra::create(externalLinkSpr, this, menu_selector(ModPopup::onLink));
|
||||
externalLinkBtn->setUserObject("url", CCString::create(modUrl));
|
||||
|
||||
externalLinkBtn->setID("mod-online-page-button");
|
||||
m_buttonMenu->addChildAtPosition(externalLinkBtn, Anchor::TopRight, ccp(-14, -16));
|
||||
|
||||
tabsMenu->setLayout(RowLayout::create()->setAxisAlignment(AxisAlignment::Start));
|
||||
|
@ -548,6 +562,7 @@ bool ModPopup::setup(ModSource&& src) {
|
|||
auto settingsBtn = CCMenuItemSpriteExtra::create(
|
||||
settingsSpr, this, menu_selector(ModPopup::onSettings)
|
||||
);
|
||||
settingsBtn->setID("settings-button");
|
||||
m_buttonMenu->addChildAtPosition(settingsBtn, Anchor::BottomLeft, ccp(28, 25));
|
||||
|
||||
if (!m_source.asMod() || !m_source.asMod()->hasSettings()) {
|
||||
|
@ -707,6 +722,8 @@ void ModPopup::updateState() {
|
|||
}
|
||||
|
||||
m_installMenu->updateLayout();
|
||||
|
||||
ModPopupUIEvent(std::make_unique<ModPopupUIEvent::Impl>(this)).post();
|
||||
}
|
||||
|
||||
void ModPopup::setStatIcon(CCNode* stat, const char* spr) {
|
||||
|
@ -794,6 +811,7 @@ void ModPopup::onLoadServerInfo(typename server::ServerRequest<server::ServerMod
|
|||
this->setStatValue(stat, id.second);
|
||||
}
|
||||
}
|
||||
ModPopupUIEvent(std::make_unique<ModPopupUIEvent::Impl>(this)).post();
|
||||
}
|
||||
else if (event->isCancelled() || (event->getValue() && event->getValue()->isErr())) {
|
||||
for (auto child : CCArrayExt<CCNode*>(m_stats->getChildren())) {
|
||||
|
@ -801,6 +819,7 @@ void ModPopup::onLoadServerInfo(typename server::ServerRequest<server::ServerMod
|
|||
this->setStatValue(child, "N/A");
|
||||
}
|
||||
}
|
||||
ModPopupUIEvent(std::make_unique<ModPopupUIEvent::Impl>(this)).post();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -851,6 +870,8 @@ void ModPopup::onLoadTags(typename server::ServerRequest<std::unordered_set<std:
|
|||
}
|
||||
|
||||
m_tags->updateLayout();
|
||||
|
||||
ModPopupUIEvent(std::make_unique<ModPopupUIEvent::Impl>(this)).post();
|
||||
}
|
||||
else if (event->isCancelled() || (event->getValue() && event->getValue()->isErr())) {
|
||||
m_tags->removeAllChildren();
|
||||
|
@ -860,6 +881,8 @@ void ModPopup::onLoadTags(typename server::ServerRequest<std::unordered_set<std:
|
|||
m_tags->addChild(label);
|
||||
|
||||
m_tags->updateLayout();
|
||||
|
||||
ModPopupUIEvent(std::make_unique<ModPopupUIEvent::Impl>(this)).post();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -888,6 +911,7 @@ void ModPopup::loadTab(ModPopup::Tab tab) {
|
|||
"No description provided",
|
||||
size / mdScale
|
||||
);
|
||||
m_currentTabPage->setID("description-container");
|
||||
m_currentTabPage->setScale(mdScale);
|
||||
} break;
|
||||
|
||||
|
@ -897,12 +921,14 @@ void ModPopup::loadTab(ModPopup::Tab tab) {
|
|||
"No changelog provided",
|
||||
size / mdScale
|
||||
);
|
||||
m_currentTabPage->setID("changelog-container");
|
||||
m_currentTabPage->setScale(mdScale);
|
||||
} break;
|
||||
|
||||
case Tab::Versions: {
|
||||
m_currentTabPage = CCNode::create();
|
||||
m_currentTabPage->setContentSize(size);
|
||||
m_currentTabPage->setID("versions-container");
|
||||
} break;
|
||||
}
|
||||
m_currentTabPage->setAnchorPoint({ .5f, .0f });
|
||||
|
@ -995,3 +1021,7 @@ ModPopup* ModPopup::create(ModSource&& src) {
|
|||
delete ret;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ModSource& ModPopup::getSource() & {
|
||||
return m_source;
|
||||
}
|
||||
|
|
|
@ -65,4 +65,6 @@ protected:
|
|||
public:
|
||||
void loadTab(Tab tab);
|
||||
static ModPopup* create(ModSource&& src);
|
||||
|
||||
ModSource& getSource() &;
|
||||
};
|
||||
|
|
|
@ -9,37 +9,13 @@
|
|||
#include <Geode/binding/CCMenuItemToggler.hpp>
|
||||
#include <Geode/loader/Loader.hpp>
|
||||
#include <Geode/loader/Dirs.hpp>
|
||||
#include <Geode/utils/general.hpp>
|
||||
#include <charconv>
|
||||
#include <clocale>
|
||||
#include <filesystem>
|
||||
|
||||
// Helpers
|
||||
|
||||
template <class Num>
|
||||
Num parseNumForInput(std::string const& str) {
|
||||
if constexpr (std::is_same_v<Num, int64_t>) {
|
||||
int64_t i = 0;
|
||||
auto res = std::from_chars(str.data(), str.data() + str.size(), i);
|
||||
if (res.ec == std::errc()) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
else if constexpr (std::is_same_v<Num, double>) {
|
||||
double val = 0.0;
|
||||
errno = 0;
|
||||
if (std::setlocale(LC_NUMERIC, "en_US.utf8")) {
|
||||
val = std::strtod(str.c_str(), nullptr);
|
||||
if (errno == 0) {
|
||||
return val;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
static_assert(!std::is_same_v<Num, Num>, "Impl Num for parseNumForInput");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
static float valueToSlider(T const& setting, typename T::ValueType value) {
|
||||
auto min = setting.min ? setting.min.value() : -100;
|
||||
|
@ -193,7 +169,9 @@ void IntSettingNode::onArrow(CCObject* sender) {
|
|||
}
|
||||
|
||||
void IntSettingNode::textChanged(CCTextInputNode* input) {
|
||||
m_uncommittedValue = parseNumForInput<ValueType>(input->getString());
|
||||
auto res = numFromString<ValueType>(input->getString());
|
||||
if (!res) return;
|
||||
m_uncommittedValue = res.unwrap();
|
||||
this->valueChanged(false);
|
||||
}
|
||||
|
||||
|
@ -275,7 +253,9 @@ void FloatSettingNode::onArrow(CCObject* sender) {
|
|||
}
|
||||
|
||||
void FloatSettingNode::textChanged(CCTextInputNode* input) {
|
||||
m_uncommittedValue = parseNumForInput<ValueType>(input->getString());
|
||||
auto res = numFromString<ValueType>(input->getString());
|
||||
if (!res) return;
|
||||
m_uncommittedValue = res.unwrap();
|
||||
this->valueChanged(false);
|
||||
}
|
||||
|
||||
|
|
|
@ -150,10 +150,10 @@ protected:
|
|||
|
||||
virtual void valueChanged(bool updateText = true) {
|
||||
if (this->hasUncommittedChanges()) {
|
||||
m_nameLabel->setColor(cc3x(0x1d0));
|
||||
m_nameLabel->setColor({0x11, 0xdd, 0x00});
|
||||
}
|
||||
else {
|
||||
m_nameLabel->setColor(cc3x(0xfff));
|
||||
m_nameLabel->setColor({0xff, 0xff, 0xff});
|
||||
}
|
||||
if (m_resetBtn) m_resetBtn->setVisible(this->hasNonDefaultValue());
|
||||
auto isValid = setting()->validate(m_uncommittedValue);
|
||||
|
|
|
@ -145,22 +145,22 @@ void ModSettingsPopup::onResetAll(CCObject*) {
|
|||
|
||||
void ModSettingsPopup::settingValueCommitted(SettingNode*) {
|
||||
if (this->hasUncommitted()) {
|
||||
m_applyBtnSpr->setColor(cc3x(0xf));
|
||||
m_applyBtnSpr->setColor({0xff, 0xff, 0xff});
|
||||
m_applyBtn->setEnabled(true);
|
||||
}
|
||||
else {
|
||||
m_applyBtnSpr->setColor(cc3x(0x4));
|
||||
m_applyBtnSpr->setColor({0x44, 0x44, 0x44});
|
||||
m_applyBtn->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void ModSettingsPopup::settingValueChanged(SettingNode*) {
|
||||
if (this->hasUncommitted()) {
|
||||
m_applyBtnSpr->setColor(cc3x(0xf));
|
||||
m_applyBtnSpr->setColor({0xff, 0xff, 0xff});
|
||||
m_applyBtn->setEnabled(true);
|
||||
}
|
||||
else {
|
||||
m_applyBtnSpr->setColor(cc3x(0x4));
|
||||
m_applyBtnSpr->setColor({0x44, 0x44, 0x44});
|
||||
m_applyBtn->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,27 +10,6 @@
|
|||
|
||||
using namespace geode::prelude;
|
||||
|
||||
static GLubyte parseInt(char const* str) {
|
||||
int i = 0;
|
||||
auto res = std::from_chars(str, str + strlen(str), i);
|
||||
if (res.ec == std::errc()) {
|
||||
return static_cast<GLubyte>(i);
|
||||
}
|
||||
return 255;
|
||||
}
|
||||
|
||||
static GLubyte parseFloat(char const* str) {
|
||||
float val = 0.0f;
|
||||
errno = 0;
|
||||
if (std::setlocale(LC_NUMERIC, "en_US.utf8")) {
|
||||
val = std::strtof(str, nullptr);
|
||||
if (errno == 0) {
|
||||
return val;
|
||||
}
|
||||
}
|
||||
return 255.f;
|
||||
}
|
||||
|
||||
bool ColorPickPopup::setup(ccColor4B const& color, bool isRGBA) {
|
||||
m_noElasticity = true;
|
||||
m_color = color;
|
||||
|
@ -307,8 +286,7 @@ bool ColorPickPopup::setup(ccColor4B const& color, bool isRGBA) {
|
|||
sliderWrapper->addChildAtPosition(m_opacitySlider, Anchor::Center, ccp(0, 0));
|
||||
sliderColumn->addChild(sliderWrapper);
|
||||
|
||||
m_opacityInput = TextInput::create(60.f, "0.00");
|
||||
m_opacityInput->setPosition(85.f, -95.f);
|
||||
m_opacityInput = TextInput::create(60.f, "Opacity");
|
||||
m_opacityInput->setScale(.7f);
|
||||
m_opacityInput->setDelegate(this, TAG_OPACITY_INPUT);
|
||||
m_opacityInput->setID("opacity-input");
|
||||
|
@ -382,15 +360,27 @@ void ColorPickPopup::textChanged(CCTextInputNode* input) {
|
|||
}
|
||||
break;
|
||||
|
||||
case TAG_OPACITY_INPUT:
|
||||
{
|
||||
m_color.a = parseFloat(input->getString().c_str());
|
||||
}
|
||||
case TAG_OPACITY_INPUT: {
|
||||
auto res = numFromString<float>(input->getString().c_str());
|
||||
if (res) m_color.a = std::clamp(static_cast<int>(res.unwrap() * 255.f), 0, 255);
|
||||
break;
|
||||
}
|
||||
|
||||
case TAG_R_INPUT: m_color.r = parseInt(input->getString().c_str()); break;
|
||||
case TAG_G_INPUT: m_color.g = parseInt(input->getString().c_str()); break;
|
||||
case TAG_B_INPUT: m_color.b = parseInt(input->getString().c_str()); break;
|
||||
case TAG_R_INPUT: {
|
||||
auto res = numFromString<uint32_t>(input->getString().c_str());
|
||||
if (res) m_color.r = std::clamp(res.unwrap(), 0u, 255u);
|
||||
break;
|
||||
}
|
||||
case TAG_G_INPUT: {
|
||||
auto res = numFromString<uint32_t>(input->getString().c_str());
|
||||
if (res) m_color.g = std::clamp(res.unwrap(), 0u, 255u);
|
||||
break;
|
||||
}
|
||||
case TAG_B_INPUT: {
|
||||
auto res = numFromString<uint32_t>(input->getString().c_str());
|
||||
if (res) m_color.b = std::clamp(res.unwrap(), 0u, 255u);
|
||||
break;
|
||||
}
|
||||
|
||||
default: break;
|
||||
}
|
||||
|
|
43
loader/src/ui/nodes/LoadingSpinner.cpp
Normal file
|
@ -0,0 +1,43 @@
|
|||
#include <Geode/ui/LoadingSpinner.hpp>
|
||||
#include <Geode/utils/cocos.hpp>
|
||||
|
||||
using namespace geode::prelude;
|
||||
|
||||
bool LoadingSpinner::init(float sideLength) {
|
||||
if (!CCNode::init())
|
||||
return false;
|
||||
|
||||
this->setID("loading-spinner");
|
||||
this->setContentSize({ sideLength, sideLength });
|
||||
this->setAnchorPoint({ .5f, .5f });
|
||||
|
||||
m_spinner = CCSprite::create("loadingCircle.png");
|
||||
m_spinner->setBlendFunc({ GL_ONE, GL_ONE });
|
||||
limitNodeSize(m_spinner, m_obContentSize, 1.f, .1f);
|
||||
this->addChildAtPosition(m_spinner, Anchor::Center);
|
||||
|
||||
this->spin();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void LoadingSpinner::spin() {
|
||||
m_spinner->runAction(CCRepeatForever::create(CCRotateBy::create(1.f, 360.f)));
|
||||
}
|
||||
|
||||
LoadingSpinner* LoadingSpinner::create(float sideLength) {
|
||||
auto ret = new LoadingSpinner();
|
||||
if (ret->init(sideLength)) {
|
||||
ret->autorelease();
|
||||
return ret;
|
||||
}
|
||||
delete ret;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void LoadingSpinner::setVisible(bool visible) {
|
||||
CCNode::setVisible(visible);
|
||||
if (visible) {
|
||||
this->spin();
|
||||
}
|
||||
}
|
|
@ -15,6 +15,8 @@
|
|||
#include <md4c.h>
|
||||
#include <charconv>
|
||||
#include <Geode/loader/Log.hpp>
|
||||
#include <Geode/ui/GeodeUI.hpp>
|
||||
#include <server/Server.hpp>
|
||||
|
||||
using namespace geode::prelude;
|
||||
|
||||
|
@ -22,7 +24,7 @@ static constexpr float g_fontScale = .5f;
|
|||
static constexpr float g_paragraphPadding = 7.f;
|
||||
static constexpr float g_indent = 7.f;
|
||||
static constexpr float g_codeBlockIndent = 8.f;
|
||||
static constexpr ccColor3B g_linkColor = cc3x(0x7ff4f4);
|
||||
static constexpr ccColor3B g_linkColor = {0x7f, 0xf4, 0xf4};
|
||||
|
||||
TextRenderer::Font g_mdFont = [](int style) -> TextRenderer::Label {
|
||||
if ((style & TextStyleBold) && (style & TextStyleItalic)) {
|
||||
|
@ -77,14 +79,12 @@ public:
|
|||
};
|
||||
|
||||
Result<ccColor3B> colorForIdentifier(std::string const& tag) {
|
||||
if (utils::string::contains(tag, ' ')) {
|
||||
auto hexStr = utils::string::split(utils::string::normalize(tag), " ").at(1);
|
||||
int hex = 0;
|
||||
auto res = std::from_chars(hexStr.data(), hexStr.data() + hexStr.size(), hex, 16);
|
||||
if (res.ec != std::errc()) {
|
||||
return Err("Invalid hex");
|
||||
}
|
||||
return Ok(cc3x(hex));
|
||||
if (tag.length() > 2 && tag[1] == '-') {
|
||||
return cc3bFromHexString(tag.substr(2));
|
||||
}
|
||||
// Support the old form of <carbitaryletters hex>
|
||||
else if (tag.find(' ') != std::string::npos) {
|
||||
return cc3bFromHexString(string::trim(tag.substr(tag.find(' ') + 1)));
|
||||
}
|
||||
else {
|
||||
auto colorText = tag.substr(1);
|
||||
|
@ -96,15 +96,19 @@ Result<ccColor3B> colorForIdentifier(std::string const& tag) {
|
|||
}
|
||||
else {
|
||||
switch (colorText.front()) {
|
||||
case 'a': return Ok(cc3x(0x9632ff)); break;
|
||||
case 'b': return Ok(cc3x(0x4a52e1)); break;
|
||||
case 'g': return Ok(cc3x(0x40e348)); break;
|
||||
case 'l': return Ok(cc3x(0x60abef)); break;
|
||||
case 'j': return Ok(cc3x(0x32c8ff)); break;
|
||||
case 'y': return Ok(cc3x(0xffff00)); break;
|
||||
case 'o': return Ok(cc3x(0xffa54b)); break;
|
||||
case 'r': return Ok(cc3x(0xff5a5a)); break;
|
||||
case 'p': return Ok(cc3x(0xff00ff)); break;
|
||||
case 'a': return Ok(ccc3(150, 50, 255)); break;
|
||||
case 'b': return Ok(ccc3(74, 82, 225)); break;
|
||||
case 'c': return Ok(ccc3(255, 255, 150)); break;
|
||||
case 'd': return Ok(ccc3(255, 150, 255)); break;
|
||||
case 'f': return Ok(ccc3(150, 255, 255)); break;
|
||||
case 'g': return Ok(ccc3(64, 227, 72)); break;
|
||||
case 'j': return Ok(ccc3(50, 200, 255)); break;
|
||||
case 'l': return Ok(ccc3(96, 171, 239)); break;
|
||||
case 'o': return Ok(ccc3(255, 165, 75)); break;
|
||||
case 'p': return Ok(ccc3(255, 0, 255)); break;
|
||||
case 'r': return Ok(ccc3(255, 90, 90)); break;
|
||||
case 's': return Ok(ccc3(255, 220, 65)); break;
|
||||
case 'y': return Ok(ccc3(255, 255, 0)); break;
|
||||
default: return Err("Unknown color " + colorText);
|
||||
}
|
||||
}
|
||||
|
@ -190,82 +194,44 @@ void MDTextArea::onGDProfile(CCObject* pSender) {
|
|||
auto href = as<CCString*>(as<CCNode*>(pSender)->getUserObject());
|
||||
auto profile = std::string(href->getCString());
|
||||
profile = profile.substr(profile.find(":") + 1);
|
||||
int id = 0;
|
||||
auto res = std::from_chars(profile.data(), profile.data() + profile.size(), id);
|
||||
if (res.ec != std::errc()) {
|
||||
auto res = numFromString<int>(profile);
|
||||
if (res.isErr()) {
|
||||
FLAlertLayer::create(
|
||||
"Error",
|
||||
"Invalid profile ID: <cr>" + profile +
|
||||
"</c>. This is "
|
||||
"probably the mod developer's fault, report the bug to them.",
|
||||
"OK"
|
||||
)
|
||||
->show();
|
||||
)->show();
|
||||
return;
|
||||
}
|
||||
ProfilePage::create(id, false)->show();
|
||||
ProfilePage::create(res.unwrap(), false)->show();
|
||||
}
|
||||
|
||||
void MDTextArea::onGDLevel(CCObject* pSender) {
|
||||
auto href = as<CCString*>(as<CCNode*>(pSender)->getUserObject());
|
||||
auto level = std::string(href->getCString());
|
||||
level = level.substr(level.find(":") + 1);
|
||||
int id = 0;
|
||||
auto res = std::from_chars(level.data(), level.data() + level.size(), id);
|
||||
if (res.ec != std::errc()) {
|
||||
auto res = numFromString<int>(level);
|
||||
if (res.isErr()) {
|
||||
FLAlertLayer::create(
|
||||
"Error",
|
||||
"Invalid level ID: <cr>" + level +
|
||||
"</c>. This is "
|
||||
"probably the mod developers's fault, report the bug to them.",
|
||||
"OK"
|
||||
)
|
||||
->show();
|
||||
)->show();
|
||||
return;
|
||||
}
|
||||
auto searchObject = GJSearchObject::create(SearchType::Type19, fmt::format("{}&gameVersion=22", id));
|
||||
auto searchObject = GJSearchObject::create(SearchType::Type19, fmt::format("{}&gameVersion=22", res.unwrap()));
|
||||
auto scene = LevelBrowserLayer::scene(searchObject);
|
||||
CCDirector::sharedDirector()->replaceScene(CCTransitionFade::create(0.5f, scene));
|
||||
}
|
||||
|
||||
void MDTextArea::onGeodeMod(CCObject* pSender) {
|
||||
// TODO
|
||||
// auto href = as<CCString*>(as<CCNode*>(pSender)->getUserObject());
|
||||
// auto modString = std::string(href->getCString());
|
||||
// modString = modString.substr(modString.find(":") + 1);
|
||||
// auto loader = Loader::get();
|
||||
// auto index = Index::get();
|
||||
// Mod* mod;
|
||||
// bool success = false;
|
||||
// IndexItemHandle indexItem;
|
||||
// bool isIndexMod = !loader->isModInstalled(modString);
|
||||
|
||||
// if (isIndexMod) {
|
||||
// auto indexSearch = index->getItemsByModID(modString);
|
||||
// if (indexSearch.size() != 0) {
|
||||
// indexItem = indexSearch.back();
|
||||
// Mod mod2 = Mod(indexItem->getMetadata());
|
||||
// mod = &mod2;
|
||||
// auto item = Index::get()->getItem(mod);
|
||||
// IndexItemInfoPopup::create(item, nullptr)->show();
|
||||
// success = true;
|
||||
// }
|
||||
// } else {
|
||||
// mod = loader->getLoadedMod(modString);
|
||||
// LocalModInfoPopup::create(mod, nullptr)->show();
|
||||
// success = true;
|
||||
// }
|
||||
|
||||
// if (!success) {
|
||||
// FLAlertLayer::create(
|
||||
// "Error",
|
||||
// "Invalid mod ID: <cr>" + modString +
|
||||
// "</c>. This is "
|
||||
// "probably the mod developers's fault, report the bug to them.",
|
||||
// "OK"
|
||||
// )
|
||||
// ->show();
|
||||
// }
|
||||
void MDTextArea::onGeodeMod(CCObject* sender) {
|
||||
auto href = as<CCString*>(as<CCNode*>(sender)->getUserObject());
|
||||
auto modID = std::string(href->getCString());
|
||||
(void)openInfoPopup(modID.substr(modID.find(":") + 1));
|
||||
}
|
||||
|
||||
void MDTextArea::FLAlert_Clicked(FLAlertLayer* layer, bool btn) {
|
||||
|
|
|
@ -191,6 +191,13 @@ std::string TextInput::getString() const {
|
|||
return m_input->getString();
|
||||
}
|
||||
|
||||
void TextInput::focus() {
|
||||
m_input->onClickTrackNode(true);
|
||||
}
|
||||
void TextInput::defocus() {
|
||||
m_input->detachWithIME();
|
||||
}
|
||||
|
||||
CCTextInputNode* TextInput::getInputNode() const {
|
||||
return m_input;
|
||||
}
|
||||
|
|
|
@ -131,11 +131,11 @@ Result<ccColor3B> geode::cocos::cc3bFromHexString(std::string const& rawHexValue
|
|||
if (hexValue.size() > 6) {
|
||||
return Err("Hex value too large");
|
||||
}
|
||||
size_t numValue;
|
||||
auto res = std::from_chars(hexValue.data(), hexValue.data() + hexValue.size(), numValue, 16);
|
||||
if (res.ec != std::errc()) {
|
||||
auto res = numFromString<uint32_t>(hexValue, 16);
|
||||
if (!res) {
|
||||
return Err("Invalid hex value '{}'", hexValue);
|
||||
}
|
||||
auto numValue = res.unwrap();
|
||||
switch (hexValue.size()) {
|
||||
case 6: {
|
||||
auto r = static_cast<uint8_t>((numValue & 0xFF0000) >> 16);
|
||||
|
@ -189,11 +189,11 @@ Result<ccColor4B> geode::cocos::cc4bFromHexString(std::string const& rawHexValue
|
|||
if (hexValue.size() > 8) {
|
||||
return Err("Hex value too large");
|
||||
}
|
||||
size_t numValue;
|
||||
auto res = std::from_chars(hexValue.data(), hexValue.data() + hexValue.size(), numValue, 16);
|
||||
if (res.ec != std::errc()) {
|
||||
auto res = numFromString<uint32_t>(hexValue, 16);
|
||||
if (!res) {
|
||||
return Err("Invalid hex value '{}'", hexValue);
|
||||
}
|
||||
auto numValue = res.unwrap();
|
||||
switch (hexValue.size()) {
|
||||
case 8: {
|
||||
auto r = static_cast<uint8_t>((numValue & 0xFF000000) >> 24);
|
||||
|
|
|
@ -488,7 +488,13 @@ WebRequest& WebRequest::header(std::string_view name, std::string_view value) {
|
|||
const size_t comma = value.find(',', numStart);
|
||||
const size_t numLength = (comma == std::string::npos ? value.size() : comma) - numStart;
|
||||
|
||||
timeout(std::chrono::seconds(std::stol(std::string(value.substr(numStart, numLength)))));
|
||||
int timeoutValue = 5;
|
||||
auto res = numFromString<int>(value.substr(numStart, numLength));
|
||||
if (res) {
|
||||
timeoutValue = res.value();
|
||||
}
|
||||
|
||||
timeout(std::chrono::seconds(timeoutValue));
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
@ -499,11 +505,21 @@ WebRequest& WebRequest::header(std::string_view name, std::string_view value) {
|
|||
return *this;
|
||||
}
|
||||
|
||||
WebRequest& WebRequest::removeHeader(std::string_view name) {
|
||||
m_impl->m_headers.erase(std::string(name));
|
||||
return *this;
|
||||
}
|
||||
|
||||
WebRequest& WebRequest::param(std::string_view name, std::string_view value) {
|
||||
m_impl->m_urlParameters.insert_or_assign(std::string(name), std::string(value));
|
||||
return *this;
|
||||
}
|
||||
|
||||
WebRequest& WebRequest::removeParam(std::string_view name) {
|
||||
m_impl->m_urlParameters.erase(std::string(name));
|
||||
return *this;
|
||||
}
|
||||
|
||||
WebRequest& WebRequest::userAgent(std::string_view name) {
|
||||
m_impl->m_userAgent = name;
|
||||
return *this;
|
||||
|
|