mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-07-04 03:12:48 -04:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 625f752fb9 |
@@ -10,7 +10,7 @@ on:
|
||||
env:
|
||||
SCCACHE_GHA_ENABLED: "true"
|
||||
RUSTC_WRAPPER: "sccache"
|
||||
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
|
||||
# SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
|
||||
|
||||
jobs:
|
||||
build-linux:
|
||||
@@ -50,7 +50,7 @@ jobs:
|
||||
libxss-dev libfuse2 libusb-1.0-0-dev libdecor-0-dev libpipewire-0.3-dev libunwind-dev
|
||||
|
||||
- name: Setup sccache
|
||||
uses: mozilla-actions/sccache-action@v0.0.10
|
||||
uses: mozilla-actions/sccache-action@v0.0.9
|
||||
|
||||
- name: Print sccache stats
|
||||
run: sccache --show-stats
|
||||
@@ -124,7 +124,7 @@ jobs:
|
||||
rustup target add x86_64-apple-darwin
|
||||
|
||||
- name: Setup sccache
|
||||
uses: mozilla-actions/sccache-action@v0.0.10
|
||||
uses: mozilla-actions/sccache-action@v0.0.9
|
||||
|
||||
- name: Configure CMake
|
||||
run: cmake --preset ${{matrix.preset}}
|
||||
@@ -175,7 +175,7 @@ jobs:
|
||||
java-version: 17
|
||||
|
||||
- name: Setup Android SDK
|
||||
uses: android-actions/setup-android@v4
|
||||
uses: android-actions/setup-android@v3
|
||||
|
||||
- name: Install Android SDK packages
|
||||
run: sdkmanager "platforms;android-36" "build-tools;36.1.0" "ndk;${ANDROID_NDK_VERSION}"
|
||||
@@ -186,7 +186,7 @@ jobs:
|
||||
rustup target add ${{matrix.rust_target}}
|
||||
|
||||
- name: Setup sccache
|
||||
uses: mozilla-actions/sccache-action@v0.0.10
|
||||
uses: mozilla-actions/sccache-action@v0.0.9
|
||||
|
||||
- name: Configure CMake
|
||||
run: cmake --preset ${{matrix.preset}}
|
||||
|
||||
@@ -444,12 +444,6 @@ target_link_libraries(dusk PRIVATE aurora::main ${GAME_LIBS} ${JSYSTEM_LINK_LIBR
|
||||
target_precompile_headers(dusk PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:${CMAKE_SOURCE_DIR}/include/dusk_pch.hpp>")
|
||||
if (TARGET crashpad_handler)
|
||||
add_dependencies(dusk crashpad_handler)
|
||||
add_custom_command(TARGET dusk POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
"$<TARGET_FILE:crashpad_handler>"
|
||||
"$<TARGET_FILE_DIR:dusk>"
|
||||
COMMENT "Copying crashpad handler"
|
||||
)
|
||||
endif ()
|
||||
|
||||
if (ANDROID)
|
||||
|
||||
+2
-8
@@ -30,7 +30,7 @@
|
||||
"CMAKE_CXX_COMPILER_LAUNCHER": "sccache",
|
||||
"DUSK_ENABLE_SENTRY_NATIVE": {
|
||||
"type": "BOOL",
|
||||
"value": true
|
||||
"value": false
|
||||
},
|
||||
"DUSK_SENTRY_DSN": "$env{SENTRY_DSN}",
|
||||
"DUSK_SENTRY_ENVIRONMENT": "production"
|
||||
@@ -358,13 +358,7 @@
|
||||
"inherits": [
|
||||
"android-base",
|
||||
"ci"
|
||||
],
|
||||
"cacheVariables": {
|
||||
"DUSK_ENABLE_SENTRY_NATIVE": {
|
||||
"type": "BOOL",
|
||||
"value": false
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "x-android-ci-arm64",
|
||||
|
||||
@@ -19,9 +19,6 @@ It aims to be as accurate as possible to the original while also providing new o
|
||||
> [!IMPORTANT]
|
||||
> Dusk does *not* provide any copyrighted assets. You must provide your own copy of the original game.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> At a minimum, Dusk requires a GPU with support for either D3D12, Vulkan, or Metal. Your experience with specific hardware, operating systems, and drivers may vary. In particular, older Intel iGPUs have a high likelyhood of incompatibility. We are also aware of a number of issues on devices with Adreno GPUs and are working to resolve them.
|
||||
|
||||
### 1. Verify your dump
|
||||
|
||||
First, make sure your dump of the game is clean and supported by Dusk. You can do this by checking the SHA-1 hash of your dump against this list of supported versions:
|
||||
@@ -55,7 +52,7 @@ First, make sure your dump of the game is clean and supported by Dusk. You can d
|
||||
|
||||
If you'd like to build Dusk from source, please read the [build instructions](docs/building.md).
|
||||
|
||||
Pull requests are welcomed! Note that we do not accept contributions that are primarily AI-generated and will close your PR if we suspect as much. Please also see the [code conventions](docs/code-conventions.md).
|
||||
Pull requests are welcomed! Note that we do not accept contributions that are primarily AI-generated and will close your PR if we suspect as much.
|
||||
|
||||
# Credits
|
||||
|
||||
|
||||
+8
-16
@@ -1,26 +1,18 @@
|
||||
#!/bin/bash -ex
|
||||
|
||||
if [[ -n "${GITHUB_WORKSPACE:-}" ]]; then
|
||||
cd "$GITHUB_WORKSPACE"
|
||||
fi
|
||||
|
||||
build_dir="$PWD/build"
|
||||
linuxdeploy="$build_dir/linuxdeploy-$(uname -m).AppImage"
|
||||
shopt -s extglob
|
||||
|
||||
# Get linuxdeploy
|
||||
mkdir -p "$build_dir"
|
||||
curl -fL "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-$(uname -m).AppImage" -o "$linuxdeploy"
|
||||
chmod +x "$linuxdeploy"
|
||||
cd "$RUNNER_WORKSPACE"
|
||||
curl -fOL https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-$(uname -m).AppImage
|
||||
chmod +x linuxdeploy-$(uname -m).AppImage
|
||||
|
||||
# Build AppImage
|
||||
cd "$GITHUB_WORKSPACE"
|
||||
mkdir -p build/appdir/usr/{bin,share/{applications,icons/hicolor}}
|
||||
for install_path in build/install/*; do
|
||||
[[ "$(basename "$install_path")" == *.* ]] && continue
|
||||
cp -r "$install_path" build/appdir/usr/bin
|
||||
done
|
||||
cp -r build/install/!(*.*) build/appdir/usr/bin
|
||||
cp -r platforms/freedesktop/{16x16,32x32,48x48,64x64,128x128,256x256,512x512,1024x1024} build/appdir/usr/share/icons/hicolor
|
||||
cp platforms/freedesktop/dusk.desktop build/appdir/usr/share/applications
|
||||
|
||||
cd build/install
|
||||
VERSION="$DUSK_VERSION" NO_STRIP=1 "$linuxdeploy" \
|
||||
-l /usr/lib/x86_64-linux-gnu/libusb-1.0.so --appdir "$build_dir/appdir" --output appimage
|
||||
VERSION="$DUSK_VERSION" NO_STRIP=1 "$RUNNER_WORKSPACE"/linuxdeploy-$(uname -m).AppImage \
|
||||
-l /usr/lib/x86_64-linux-gnu/libusb-1.0.so --appdir "$GITHUB_WORKSPACE"/build/appdir --output appimage
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
# Code conventions for Dusk
|
||||
|
||||
## Upstream when appropriate
|
||||
|
||||
Bug fixes, documentation improvements, code cleanup, etc that also apply to the [original decompilation project](https://github.com/zeldaret/tp) should preferably be PR'd there.
|
||||
|
||||
## Properly indicate Dusk-modified code
|
||||
|
||||
When modifying original game code (i.e. in decomp) for Dusk's purposes, please clearly delineate such code as being Dusk-specific. Generally, this can be done by using `#if TARGET_PC` and keeping the original code in place. Use `#if AVOID_UB` for Undefined Behavior fixes to the original codebase.
|
||||
|
||||
## Miscellaneous things
|
||||
|
||||
* The original codebase makes heavy use of global `operator new` and similar overloads to allocate into a strict tree of heaps. This would cause many linkage headaches for us, so effectively all uses of `new` or `delete` in the original game code have been replaced with `JKR_NEW`, `JKR_DELETE`, or similar macros. See `JKRHeap.h` for the full list.
|
||||
Vendored
+1
-1
Submodule extern/aurora updated: 9315919091...398054316e
@@ -1450,7 +1450,6 @@ set(DUSK_FILES
|
||||
src/dusk/imgui/ImGuiBloomWindow.hpp
|
||||
src/dusk/imgui/ImGuiMenuTools.cpp
|
||||
src/dusk/imgui/ImGuiMenuTools.hpp
|
||||
src/dusk/imgui/ImGuiActorSpawner.cpp
|
||||
src/dusk/imgui/ImGuiProcessOverlay.cpp
|
||||
src/dusk/imgui/ImGuiCameraOverlay.cpp
|
||||
src/dusk/imgui/ImGuiHeapOverlay.cpp
|
||||
@@ -1495,8 +1494,6 @@ set(DUSK_FILES
|
||||
src/dusk/ui/prelaunch.hpp
|
||||
src/dusk/ui/preset.cpp
|
||||
src/dusk/ui/preset.hpp
|
||||
src/dusk/ui/reporting.cpp
|
||||
src/dusk/ui/reporting.hpp
|
||||
src/dusk/ui/select_button.cpp
|
||||
src/dusk/ui/select_button.hpp
|
||||
src/dusk/ui/settings.cpp
|
||||
|
||||
@@ -5,73 +5,9 @@
|
||||
outputs = { self, nixpkgs }:
|
||||
let
|
||||
pkgs = import nixpkgs { system = "x86_64-linux"; };
|
||||
|
||||
# Dependencies that are not packaged in nixpkgs:
|
||||
aurora-src = pkgs.fetchFromGitHub {
|
||||
owner = "encounter";
|
||||
repo = "aurora";
|
||||
rev = "63606a43265a3bc18dafd500ab4d7a2108f109e6";
|
||||
hash = "sha256-xBvnAwGwNzav67Ac6oUz7RqDUwqgL2bsME3OOMn8Tqw=";
|
||||
};
|
||||
dawn-src = pkgs.fetchzip {
|
||||
url = "https://github.com/encounter/dawn-build/releases/download/v20260423.175430/dawn-linux-x86_64.tar.gz";
|
||||
hash = "sha256-HXfKTLHtMPwupnFnaflCARtXVPuS/0PoCePXidjE5xs=";
|
||||
stripRoot = false;
|
||||
};
|
||||
nod-src = pkgs.fetchzip {
|
||||
url = "https://github.com/encounter/nod/releases/download/v2.0.0-alpha.8/libnod-linux-x86_64.tar.gz";
|
||||
hash = "sha256-mUqvLsbsqaZ+HAjMmHYPYO+MgtanGRTw7Gzn5uXR5rE=";
|
||||
stripRoot = false;
|
||||
};
|
||||
# The version of imgui on nixpkgs does not map cleanly.
|
||||
imgui-src = pkgs.fetchFromGitHub {
|
||||
owner = "ocornut";
|
||||
repo = "imgui";
|
||||
rev = "v1.91.9b-docking";
|
||||
hash = "sha256-mQOJ6jCN+7VopgZ61yzaCnt4R1QLrW7+47xxMhFRHLQ=";
|
||||
};
|
||||
sqlite-src = pkgs.fetchzip {
|
||||
url = "https://sqlite.org/2026/sqlite-amalgamation-3510300.zip";
|
||||
hash = "sha256-pNMR8zxaaqfAzQ0AQBOXMct4usdjey1Q0Gnitg06UhM=";
|
||||
};
|
||||
rmlui-src = pkgs.fetchzip {
|
||||
url = "https://github.com/mikke89/RmlUi/archive/f9b8c9e2935d5df2c7dff2c190d3968e99b0c3dc.tar.gz";
|
||||
hash = "sha256-g4O/JZUrrcseOz8o2QJRt+2CeuiLnVeuDJc906xvuIg=";
|
||||
};
|
||||
# Dusk Actual
|
||||
dusk = pkgs.stdenv.mkDerivation {
|
||||
name = "dusk";
|
||||
src = ./.;
|
||||
postUnpack = ''
|
||||
mkdir -p $sourceRoot/extern/aurora
|
||||
cp -r ${aurora-src}/. $sourceRoot/extern/aurora/
|
||||
chmod -R u+w $sourceRoot/extern/aurora
|
||||
sed -i '/add_subdirectory(tests)/d' $sourceRoot/extern/aurora/CMakeLists.txt
|
||||
'';
|
||||
# Remove last line to re-enable tests
|
||||
cmakeFlags = [
|
||||
"-DFETCHCONTENT_FULLY_DISCONNECTED=ON"
|
||||
"-DFETCHCONTENT_SOURCE_DIR_CXXOPTS=${pkgs.cxxopts.src}"
|
||||
"-DFETCHCONTENT_SOURCE_DIR_JSON=${pkgs.nlohmann_json.src}"
|
||||
"-DFETCHCONTENT_SOURCE_DIR_DAWN_PREBUILT=${dawn-src}"
|
||||
"-DFETCHCONTENT_SOURCE_DIR_XXHASH=${pkgs.xxHash.src}"
|
||||
"-DFETCHCONTENT_SOURCE_DIR_FMT=${pkgs.fmt.src}"
|
||||
"-DFETCHCONTENT_SOURCE_DIR_TRACY=${pkgs.tracy.src}"
|
||||
"-DAURORA_SDL3_PROVIDER=system"
|
||||
"-DFETCHCONTENT_SOURCE_DIR_NOD_PREBUILT=${nod-src}"
|
||||
"-DAURORA_NOD_PROVIDER=package"
|
||||
"-DFETCHCONTENT_SOURCE_DIR_FREETYPE=${pkgs.freetype.src}"
|
||||
"-DFETCHCONTENT_SOURCE_DIR_ZSTD=${pkgs.zstd.src}"
|
||||
"-DFETCHCONTENT_SOURCE_DIR_SQLITE3=${sqlite-src}"
|
||||
"-DFETCHCONTENT_SOURCE_DIR_IMGUI=${imgui-src}"
|
||||
"-DFETCHCONTENT_SOURCE_DIR_RMLUI=${rmlui-src}"
|
||||
"-DCMAKE_CROSSCOMPILING=ON" # Tests are not working as I didn't want to work through getting google's test suite working as well. This is the only guard I could find to disable it.
|
||||
];
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp dusk $out/bin/dusk
|
||||
cp -r ./res $out/bin/res
|
||||
'';
|
||||
nativeBuildInputs = [
|
||||
pkgs.cmake
|
||||
pkgs.pkg-config
|
||||
@@ -89,13 +25,6 @@
|
||||
pkgs.libjpeg8
|
||||
pkgs.libxkbcommon
|
||||
pkgs.libglvnd
|
||||
pkgs.cxxopts
|
||||
pkgs.abseil-cpp
|
||||
pkgs.sdl3
|
||||
pkgs.fmt
|
||||
pkgs.tracy
|
||||
pkgs.freetype
|
||||
pkgs.zstd
|
||||
];
|
||||
};
|
||||
in {
|
||||
|
||||
@@ -1,17 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
namespace dusk::crash_reporting {
|
||||
namespace dusk {
|
||||
|
||||
enum class Consent {
|
||||
Unavailable,
|
||||
Unknown,
|
||||
Given,
|
||||
Revoked,
|
||||
};
|
||||
void InitializeCrashReporting();
|
||||
void ShutdownCrashReporting();
|
||||
|
||||
void initialize();
|
||||
void shutdown();
|
||||
Consent get_consent();
|
||||
void set_consent(bool enabled);
|
||||
|
||||
} // namespace dusk::crash_reporting
|
||||
} // namespace dusk
|
||||
|
||||
+5
-9
@@ -1,13 +1,14 @@
|
||||
#ifndef DUSK_IO_HPP
|
||||
#define DUSK_IO_HPP
|
||||
|
||||
#include <filesystem>
|
||||
#include <vector>
|
||||
#include <filesystem>
|
||||
|
||||
// I can't believe it's 2026 and neither SDL (no error codes) nor
|
||||
// C++ (no error codes) have a file system API functional enough for me to use.
|
||||
// Here you go, this one's inspired by C#. I only wrote the functions I need.
|
||||
|
||||
|
||||
namespace dusk::io {
|
||||
|
||||
/**
|
||||
@@ -82,7 +83,9 @@ public:
|
||||
/**
|
||||
* Get direct access to the underlying FILE* handle.
|
||||
*/
|
||||
[[nodiscard]] void* GetFileHandle() const noexcept { return file; }
|
||||
[[nodiscard]] void* GetFileHandle() const noexcept {
|
||||
return file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write data to the file.
|
||||
@@ -92,14 +95,7 @@ public:
|
||||
FILE* ToInner();
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a std::filesystem::path to a std::string, UTF-8, without exploding on Windows.
|
||||
*/
|
||||
inline std::string fs_path_to_string(const std::filesystem::path& path) {
|
||||
const auto u8str = path.u8string();
|
||||
return {reinterpret_cast<const char*>(u8str.c_str())};
|
||||
}
|
||||
|
||||
} // namespace dusk::io
|
||||
|
||||
#endif // DUSK_IO_HPP
|
||||
|
||||
@@ -144,8 +144,6 @@ struct UserSettings {
|
||||
ConfigVar<bool> freeCamera;
|
||||
ConfigVar<bool> invertCameraXAxis;
|
||||
ConfigVar<bool> invertCameraYAxis;
|
||||
ConfigVar<bool> invertFirstPersonXAxis;
|
||||
ConfigVar<bool> invertFirstPersonYAxis;
|
||||
ConfigVar<float> freeCameraSensitivity;
|
||||
ConfigVar<bool> debugFlyCam;
|
||||
ConfigVar<bool> debugFlyCamLockEvents;
|
||||
@@ -186,6 +184,7 @@ struct UserSettings {
|
||||
ConfigVar<bool> skipPreLaunchUI;
|
||||
ConfigVar<bool> showPipelineCompilation;
|
||||
ConfigVar<bool> wasPresetChosen;
|
||||
ConfigVar<bool> enableCrashReporting;
|
||||
ConfigVar<bool> checkForUpdates;
|
||||
ConfigVar<int> cardFileType;
|
||||
ConfigVar<bool> enableAdvancedSettings;
|
||||
|
||||
@@ -83,7 +83,5 @@
|
||||
<true/>
|
||||
<key>LSSupportsOpeningDocumentsInPlace</key>
|
||||
<true/>
|
||||
<key>LSSupportsGameMode</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -28,7 +28,5 @@
|
||||
<string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
<true/>
|
||||
<key>LSSupportsGameMode</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -45,7 +45,5 @@
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIUserInterfaceStyle</key>
|
||||
<string>Automatic</string>
|
||||
<key>LSSupportsGameMode</key>
|
||||
<true />
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -119,8 +119,8 @@ BOOL daAlink_c::setBodyAngleToCamera() {
|
||||
var_f31 /= dComIfGp_getCameraZoomScale(field_0x317c);
|
||||
}
|
||||
|
||||
shape_angle.y = shape_angle.y + (var_f31 * cM_ssin(mStickAngle) IF_DUSK(* (dusk::getSettings().game.invertFirstPersonXAxis ? -1.0f : 1.0f)));
|
||||
sp8 = mBodyAngle.x + (var_f31 * cM_scos(mStickAngle) IF_DUSK(* (dusk::getSettings().game.invertFirstPersonYAxis ? -1.0f : 1.0f)));
|
||||
shape_angle.y = shape_angle.y + (var_f31 * cM_ssin(mStickAngle));
|
||||
sp8 = mBodyAngle.x + (var_f31 * cM_scos(mStickAngle));
|
||||
|
||||
if (checkNotItemSinkLimit() && sp8 > 0 && sp8 > mBodyAngle.x) {
|
||||
sp8 = mBodyAngle.x;
|
||||
@@ -144,8 +144,8 @@ BOOL daAlink_c::setBodyAngleToCamera() {
|
||||
f32 gy_pitch = 0.f;
|
||||
dusk::gyro::getAimDeltas(gy_yaw, gy_pitch);
|
||||
|
||||
shape_angle.y = shape_angle.y + cM_rad2s(gy_yaw * gyro_scale * (dusk::getSettings().game.invertFirstPersonXAxis ? -1.0f : 1.0f));
|
||||
sp8 = sp8 + cM_rad2s(gy_pitch * gyro_scale * (dusk::getSettings().game.invertFirstPersonYAxis ? -1.0f : 1.0f));
|
||||
shape_angle.y = shape_angle.y + cM_rad2s(gy_yaw * gyro_scale);
|
||||
sp8 = sp8 + cM_rad2s(gy_pitch * gyro_scale);
|
||||
|
||||
if (checkNotItemSinkLimit() && sp8 > 0 && sp8 > mBodyAngle.x) {
|
||||
sp8 = mBodyAngle.x;
|
||||
|
||||
+1
-4
@@ -7648,10 +7648,7 @@ bool dCamera_c::freeCamera() {
|
||||
cXyz camMovement = {mPadInfo.mCStick.mLastPosX, mPadInfo.mCStick.mLastPosY, 0.0f};
|
||||
f32 magnitude = sqrt(mPadInfo.mCStick.mLastPosX * mPadInfo.mCStick.mLastPosX + mPadInfo.mCStick.mLastPosY * mPadInfo.mCStick.mLastPosY);
|
||||
|
||||
// If we aren't in manual cam mode, don't trigger it if the player tries to hit C-up
|
||||
// for first person
|
||||
if (mPadInfo.mCStick.mLastPosX != 0 || mPadInfo.mCStick.mLastPosY < 0 ||
|
||||
(mCamParam.mManualMode == 1 && mPadInfo.mCStick.mLastPosY != 0)) {
|
||||
if (mPadInfo.mCStick.mLastPosX != 0 || mPadInfo.mCStick.mLastPosY != 0) {
|
||||
mCamParam.mManualMode = 1;
|
||||
camMovement = camMovement.normalize();
|
||||
camMovement.y *= dusk::getSettings().game.invertCameraYAxis ? 1.0f : -1.0f;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "dusk/dusk.h"
|
||||
#include "dusk/logging.h"
|
||||
#include "dusk/main.h"
|
||||
#include "dusk/settings.h"
|
||||
#include "version.h"
|
||||
|
||||
#include <cstdlib>
|
||||
@@ -12,83 +13,114 @@
|
||||
#include <string_view>
|
||||
#include <system_error>
|
||||
|
||||
#include "SDL3/SDL_filesystem.h"
|
||||
|
||||
#if DUSK_ENABLE_SENTRY_NATIVE
|
||||
#include <sentry.h>
|
||||
#endif
|
||||
|
||||
namespace dusk::crash_reporting {
|
||||
namespace dusk {
|
||||
|
||||
namespace {
|
||||
|
||||
#if DUSK_ENABLE_SENTRY_NATIVE
|
||||
bool g_sentryInitialized = false;
|
||||
|
||||
bool truthy(std::string_view value) {
|
||||
return value == "1" || value == "true" || value == "TRUE" || value == "yes" || value == "YES" ||
|
||||
value == "on" || value == "ON";
|
||||
bool IsTruthy(std::string_view value) {
|
||||
return value == "1" || value == "true" || value == "TRUE" || value == "yes"
|
||||
|| value == "YES" || value == "on" || value == "ON";
|
||||
}
|
||||
|
||||
std::string env_or_empty(const char* name) {
|
||||
std::string GetEnvOrEmpty(const char* name) {
|
||||
if (const char* value = std::getenv(name)) {
|
||||
return value;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
bool disabled_by_env() {
|
||||
const std::string env = env_or_empty("DUSK_SENTRY_ENABLED");
|
||||
return !env.empty() && !truthy(env);
|
||||
bool GetEffectiveEnabled() {
|
||||
const std::string env = GetEnvOrEmpty("DUSK_SENTRY_ENABLED");
|
||||
if (!env.empty()) {
|
||||
return IsTruthy(env);
|
||||
}
|
||||
return getSettings().backend.enableCrashReporting;
|
||||
}
|
||||
|
||||
std::string effective_dsn() {
|
||||
const std::string env = env_or_empty("DUSK_SENTRY_DSN");
|
||||
std::string GetEffectiveDsn() {
|
||||
const std::string env = GetEnvOrEmpty("DUSK_SENTRY_DSN");
|
||||
if (!env.empty()) {
|
||||
return env;
|
||||
}
|
||||
return DUSK_SENTRY_DSN;
|
||||
}
|
||||
|
||||
bool effective_debug() {
|
||||
const std::string env = env_or_empty("DUSK_SENTRY_DEBUG");
|
||||
bool GetEffectiveDebug() {
|
||||
const std::string env = GetEnvOrEmpty("DUSK_SENTRY_DEBUG");
|
||||
if (!env.empty()) {
|
||||
return truthy(env);
|
||||
return IsTruthy(env);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string release_name() {
|
||||
std::string GetReleaseName() {
|
||||
return std::string(AppName) + "@" DUSK_WC_DESCRIBE;
|
||||
}
|
||||
|
||||
std::filesystem::path sentry_database_path() {
|
||||
std::filesystem::path GetSentryDatabasePath() {
|
||||
return dusk::ConfigPath / "sentry";
|
||||
}
|
||||
|
||||
std::filesystem::path log_attachment_path() {
|
||||
std::filesystem::path GetLogAttachmentPath() {
|
||||
if (const char* logPath = GetLogFilePath()) {
|
||||
return logPath;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
void configure_path_options(sentry_options_t* options) {
|
||||
const auto databasePath = sentry_database_path();
|
||||
std::filesystem::path GetCrashpadHandlerPath() {
|
||||
const char* basePath = SDL_GetBasePath();
|
||||
if (!basePath) {
|
||||
return {};
|
||||
}
|
||||
|
||||
const std::filesystem::path handlerDir(basePath);
|
||||
#if _WIN32
|
||||
return handlerDir / "crashpad_handler.exe";
|
||||
#else
|
||||
return handlerDir / "crashpad_handler";
|
||||
#endif
|
||||
}
|
||||
|
||||
void ConfigurePathOptions(sentry_options_t* options) {
|
||||
const auto databasePath = GetSentryDatabasePath();
|
||||
std::error_code ec;
|
||||
std::filesystem::create_directories(databasePath, ec);
|
||||
if (ec) {
|
||||
DuskLog.warn(
|
||||
"Unable to create Sentry database path '{}': {}", databasePath.string(), ec.message());
|
||||
DuskLog.warn("Unable to create Sentry database path '{}': {}",
|
||||
databasePath.string(), ec.message());
|
||||
}
|
||||
|
||||
#if _WIN32
|
||||
const std::wstring databasePathWide = databasePath.wstring();
|
||||
sentry_options_set_database_pathw(options, databasePathWide.c_str());
|
||||
|
||||
const auto handlerPath = GetCrashpadHandlerPath();
|
||||
if (!handlerPath.empty()) {
|
||||
const std::wstring handlerPathWide = handlerPath.wstring();
|
||||
sentry_options_set_handler_pathw(options, handlerPathWide.c_str());
|
||||
}
|
||||
#else
|
||||
const std::string databasePathUtf8 = databasePath.string();
|
||||
sentry_options_set_database_path(options, databasePathUtf8.c_str());
|
||||
|
||||
const auto handlerPath = GetCrashpadHandlerPath();
|
||||
if (!handlerPath.empty()) {
|
||||
const std::string handlerPathUtf8 = handlerPath.string();
|
||||
sentry_options_set_handler_path(options, handlerPathUtf8.c_str());
|
||||
}
|
||||
#endif
|
||||
|
||||
const auto logPath = log_attachment_path();
|
||||
const auto logPath = GetLogAttachmentPath();
|
||||
if (!logPath.empty()) {
|
||||
#if _WIN32
|
||||
sentry_options_add_attachmentw(options, logPath.wstring().c_str());
|
||||
@@ -101,29 +133,32 @@ void configure_path_options(sentry_options_t* options) {
|
||||
|
||||
} // namespace
|
||||
|
||||
void initialize() {
|
||||
void InitializeCrashReporting() {
|
||||
#if DUSK_ENABLE_SENTRY_NATIVE
|
||||
if (g_sentryInitialized || disabled_by_env()) {
|
||||
if (g_sentryInitialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
const std::string dsn = effective_dsn();
|
||||
if (!GetEffectiveEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const std::string dsn = GetEffectiveDsn();
|
||||
if (dsn.empty()) {
|
||||
DuskLog.warn("Crash reporting is enabled but no Sentry DSN is configured");
|
||||
return;
|
||||
}
|
||||
|
||||
const std::string release = release_name();
|
||||
const std::string release = GetReleaseName();
|
||||
|
||||
sentry_options_t* options = sentry_options_new();
|
||||
sentry_options_set_dsn(options, dsn.c_str());
|
||||
sentry_options_set_release(options, release.c_str());
|
||||
sentry_options_set_environment(options, DUSK_SENTRY_ENVIRONMENT);
|
||||
sentry_options_set_debug(options, effective_debug() ? 1 : 0);
|
||||
sentry_options_set_require_user_consent(options, 1);
|
||||
sentry_options_set_debug(options, GetEffectiveDebug() ? 1 : 0);
|
||||
sentry_options_set_cache_keep(options, 1);
|
||||
sentry_options_set_max_breadcrumbs(options, 100);
|
||||
configure_path_options(options);
|
||||
ConfigurePathOptions(options);
|
||||
|
||||
if (sentry_init(options) != 0) {
|
||||
DuskLog.warn("Failed to initialize Sentry crash reporting");
|
||||
@@ -138,7 +173,7 @@ void initialize() {
|
||||
#endif
|
||||
}
|
||||
|
||||
void shutdown() {
|
||||
void ShutdownCrashReporting() {
|
||||
#if DUSK_ENABLE_SENTRY_NATIVE
|
||||
if (!g_sentryInitialized) {
|
||||
return;
|
||||
@@ -149,40 +184,4 @@ void shutdown() {
|
||||
#endif
|
||||
}
|
||||
|
||||
Consent get_consent() {
|
||||
#if DUSK_ENABLE_SENTRY_NATIVE
|
||||
if (!g_sentryInitialized) {
|
||||
return Consent::Unavailable;
|
||||
}
|
||||
|
||||
switch (sentry_user_consent_get()) {
|
||||
case SENTRY_USER_CONSENT_GIVEN:
|
||||
return Consent::Given;
|
||||
case SENTRY_USER_CONSENT_REVOKED:
|
||||
return Consent::Revoked;
|
||||
case SENTRY_USER_CONSENT_UNKNOWN:
|
||||
default:
|
||||
return Consent::Unknown;
|
||||
}
|
||||
#else
|
||||
return Consent::Unavailable;
|
||||
#endif
|
||||
}
|
||||
|
||||
void set_consent(bool enabled) {
|
||||
#if DUSK_ENABLE_SENTRY_NATIVE
|
||||
if (!g_sentryInitialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (enabled) {
|
||||
sentry_user_consent_give();
|
||||
} else {
|
||||
sentry_user_consent_revoke();
|
||||
}
|
||||
#else
|
||||
(void)enabled;
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace dusk::crash_reporting
|
||||
} // namespace dusk
|
||||
|
||||
@@ -1,142 +0,0 @@
|
||||
#include "imgui.h"
|
||||
|
||||
#include "ImGuiMenuTools.hpp"
|
||||
#include "d/actor/d_a_alink.h"
|
||||
#include "d/d_com_inf_game.h"
|
||||
#include "f_op/f_op_actor_mng.h"
|
||||
#include "SSystem/SComponent/c_sxyz.h"
|
||||
#include "SSystem/SComponent/c_xyz.h"
|
||||
|
||||
namespace dusk {
|
||||
namespace {
|
||||
|
||||
struct ActorSpawnerState {
|
||||
int actorId = 0;
|
||||
int params = -1;
|
||||
int argument = -1;
|
||||
int angleX = 0;
|
||||
int angleY = 0;
|
||||
int angleZ = 0;
|
||||
float scaleX = 1.0f;
|
||||
float scaleY = 1.0f;
|
||||
float scaleZ = 1.0f;
|
||||
bool usePlayerRoom = true;
|
||||
int manualRoom = 0;
|
||||
int spawnCount = 1;
|
||||
bool hasResult = false;
|
||||
unsigned int lastResult = 0;
|
||||
int lastAttempted = 0;
|
||||
};
|
||||
|
||||
ActorSpawnerState s_state;
|
||||
|
||||
} // namespace
|
||||
|
||||
void ImGuiMenuTools::ShowActorSpawner() {
|
||||
if (!m_showActorSpawner) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ImGui::Begin("Actor Spawner", &m_showActorSpawner)) {
|
||||
ImGui::End();
|
||||
return;
|
||||
}
|
||||
|
||||
daAlink_c* player = (daAlink_c*)dComIfGp_getPlayer(0);
|
||||
|
||||
ImGui::SeparatorText("Actor");
|
||||
ImGui::InputInt("Actor ID", &s_state.actorId);
|
||||
ImGui::InputInt("Params (hex)", &s_state.params, 0, 0, ImGuiInputTextFlags_CharsHexadecimal);
|
||||
ImGui::InputInt("Argument", &s_state.argument);
|
||||
s_state.argument = (s_state.argument < -128) ? -128 : (s_state.argument > 127) ? 127 : s_state.argument;
|
||||
|
||||
ImGui::SeparatorText("Angle");
|
||||
ImGui::InputInt("Angle X", &s_state.angleX);
|
||||
ImGui::InputInt("Angle Y", &s_state.angleY);
|
||||
ImGui::InputInt("Angle Z", &s_state.angleZ);
|
||||
|
||||
ImGui::SeparatorText("Scale");
|
||||
ImGui::InputFloat("Scale X", &s_state.scaleX, 0.1f, 1.0f);
|
||||
ImGui::InputFloat("Scale Y", &s_state.scaleY, 0.1f, 1.0f);
|
||||
ImGui::InputFloat("Scale Z", &s_state.scaleZ, 0.1f, 1.0f);
|
||||
|
||||
ImGui::SeparatorText("Spawn");
|
||||
ImGui::InputInt("Count", &s_state.spawnCount);
|
||||
if (s_state.spawnCount < 1) {
|
||||
s_state.spawnCount = 1;
|
||||
}
|
||||
|
||||
ImGui::SeparatorText("Position");
|
||||
ImGui::Checkbox("Use player room", &s_state.usePlayerRoom);
|
||||
if (!s_state.usePlayerRoom) {
|
||||
ImGui::InputInt("Room No", &s_state.manualRoom);
|
||||
}
|
||||
|
||||
if (player != nullptr) {
|
||||
ImGui::Text("Spawn pos: %.2f, %.2f, %.2f",
|
||||
player->current.pos.x, player->current.pos.y, player->current.pos.z);
|
||||
} else {
|
||||
ImGui::TextDisabled("Player not available");
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
bool canSpawn = player != nullptr;
|
||||
if (!canSpawn) {
|
||||
ImGui::BeginDisabled();
|
||||
}
|
||||
|
||||
if (ImGui::Button("Spawn", ImVec2(-1, 0))) {
|
||||
cXyz pos = player->current.pos;
|
||||
csXyz angle;
|
||||
angle.set((s16)s_state.angleX, (s16)s_state.angleY, (s16)s_state.angleZ);
|
||||
cXyz scale(s_state.scaleX, s_state.scaleY, s_state.scaleZ);
|
||||
int roomNo = s_state.usePlayerRoom ? player->current.roomNo : s_state.manualRoom;
|
||||
|
||||
layer_class* savedLayer = fpcLy_CurrentLayer();
|
||||
base_process_class* playScene = fpcM_SearchByName(fpcNm_PLAY_SCENE_e);
|
||||
if (playScene != nullptr) {
|
||||
fpcLy_SetCurrentLayer(&((process_node_class*)playScene)->layer);
|
||||
}
|
||||
|
||||
s_state.lastResult = 0;
|
||||
s_state.lastAttempted = s_state.spawnCount;
|
||||
for (int i = 0; i < s_state.spawnCount; ++i) {
|
||||
unsigned int result = fopAcM_create(
|
||||
(s16)s_state.actorId,
|
||||
(u32)s_state.params,
|
||||
&pos,
|
||||
roomNo,
|
||||
&angle,
|
||||
&scale,
|
||||
(s8)s_state.argument
|
||||
);
|
||||
if (result != 0) {
|
||||
s_state.lastResult = result;
|
||||
}
|
||||
}
|
||||
s_state.hasResult = true;
|
||||
|
||||
fpcLy_SetCurrentLayer(savedLayer);
|
||||
}
|
||||
|
||||
if (!canSpawn) {
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
|
||||
if (s_state.hasResult) {
|
||||
if (s_state.lastResult != 0) {
|
||||
if (s_state.lastAttempted == 1) {
|
||||
ImGui::Text("Spawned: proc ID %u", s_state.lastResult);
|
||||
} else {
|
||||
ImGui::Text("Spawned %d (last proc ID %u)", s_state.lastAttempted, s_state.lastResult);
|
||||
}
|
||||
} else {
|
||||
ImGui::TextColored(ImVec4(1, 0.4f, 0.4f, 1), "Spawn failed (returned 0)");
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
} // namespace dusk
|
||||
@@ -313,9 +313,7 @@ namespace dusk {
|
||||
ImGui::PopFont();
|
||||
}
|
||||
ImGui::PushFont(ImGuiEngine::fontLarge);
|
||||
ImGuiTextCenter("Failed to initialize any graphics backend.");
|
||||
ImGuiTextCenter("\nYour system may be misconfigured, or your hardware may not support the required versions of any of the available backends.");
|
||||
ImGuiTextCenter("\nA clean reinstall of Dusk may help. For further assistance, please visit #tech-support on the Twilit Realm Discord server.");
|
||||
ImGuiTextCenter("Failed to initialize any graphics backend");
|
||||
const auto& style = ImGui::GetStyle();
|
||||
const auto retrySize = ImGui::CalcTextSize("Retry (Auto backend)");
|
||||
const auto quitSize = ImGui::CalcTextSize("Quit");
|
||||
@@ -375,7 +373,6 @@ namespace dusk {
|
||||
m_menuTools.ShowAudioDebug();
|
||||
m_menuTools.ShowSaveEditor();
|
||||
m_menuTools.ShowStateShare();
|
||||
m_menuTools.ShowActorSpawner();
|
||||
}
|
||||
|
||||
// Hide mouse cursor if the F1 menu is not open and the cursor is idle for 3 seconds.
|
||||
|
||||
@@ -107,7 +107,6 @@ namespace dusk {
|
||||
ImGui::MenuItem("Audio Debug", hotkeys::SHOW_AUDIO_DEBUG, &m_showAudioDebug);
|
||||
ImGui::MenuItem("Bloom", nullptr, &m_showBloomWindow);
|
||||
ImGui::MenuItem("Stub Log", nullptr, &m_showStubLog);
|
||||
ImGui::MenuItem("Actor Spawner", nullptr, &m_showActorSpawner);
|
||||
|
||||
if (!dusk::IsGameLaunched) {
|
||||
ImGui::EndDisabled();
|
||||
|
||||
@@ -28,7 +28,6 @@ namespace dusk {
|
||||
void ShowSaveEditor();
|
||||
void ShowStateShare();
|
||||
void ShowInputViewer();
|
||||
void ShowActorSpawner();
|
||||
|
||||
private:
|
||||
bool m_showDebugOverlay = false;
|
||||
@@ -71,7 +70,6 @@ namespace dusk {
|
||||
|
||||
bool m_showInputViewer = false;
|
||||
bool m_showInputViewerGyro = false;
|
||||
bool m_showActorSpawner = false;
|
||||
int m_inputOverlayCorner = 3;
|
||||
std::string m_controllerName;
|
||||
};
|
||||
|
||||
@@ -48,18 +48,19 @@ void ImGuiStateShare::onMergeFileSelected(void* userdata, const char* path, cons
|
||||
|
||||
|
||||
|
||||
static std::filesystem::path GetStatesFilePath() {
|
||||
return ConfigPath / STATES_FILENAME;
|
||||
static std::string GetStatesFilePath() {
|
||||
return (dusk::ConfigPath / STATES_FILENAME).string();
|
||||
}
|
||||
|
||||
void ImGuiStateShare::loadStatesFile() {
|
||||
m_loaded = true;
|
||||
const std::filesystem::path filePath = GetStatesFilePath();
|
||||
const std::filesystem::path filePath = dusk::ConfigPath / STATES_FILENAME;
|
||||
if (!std::filesystem::exists(filePath)) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
auto data = io::FileStream::ReadAllBytes(filePath);
|
||||
const std::string pathStr = filePath.string();
|
||||
auto data = io::FileStream::ReadAllBytes(pathStr.c_str());
|
||||
auto j = json::parse(data);
|
||||
if (!j.is_array()) {
|
||||
return;
|
||||
@@ -84,7 +85,7 @@ void ImGuiStateShare::saveStatesFile() {
|
||||
j.push_back(json{{"name", s.name}, {"data", s.encoded}});
|
||||
}
|
||||
try {
|
||||
io::FileStream::WriteAllText(GetStatesFilePath(), j.dump(2));
|
||||
io::FileStream::WriteAllText(GetStatesFilePath().c_str(), j.dump(2));
|
||||
} catch (const std::exception& e) {
|
||||
m_statusMsg = fmt::format("Failed to save states: {}", e.what());
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ void dusk::InitializeFileLogging(const std::filesystem::path& configDir, AuroraL
|
||||
std::filesystem::create_directories(logsDir, ec);
|
||||
if (ec) {
|
||||
std::fprintf(stderr, "[WARNING | dusk] Failed to create log directory '%s': %s\n",
|
||||
io::fs_path_to_string(logsDir).c_str(), ec.message().c_str());
|
||||
logsDir.string().c_str(), ec.message().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ void dusk::InitializeFileLogging(const std::filesystem::path& configDir, AuroraL
|
||||
g_logState.file = io::FileStream::Create(logPath).ToInner();
|
||||
if (g_logState.file == nullptr) {
|
||||
std::fprintf(stderr, "[WARNING | dusk] Failed to open log file '%s'\n",
|
||||
io::fs_path_to_string(logPath).c_str());
|
||||
logPath.string().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -6,7 +6,6 @@
|
||||
|
||||
#include <aurora/main.h>
|
||||
#include "dusk/main.h"
|
||||
#include "dusk/io.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
@@ -92,7 +91,7 @@ bool RestartProcess(int argc, char* argv[]) {
|
||||
|
||||
std::vector<std::string> args;
|
||||
args.reserve(static_cast<size_t>(std::max(argc, 1)));
|
||||
args.push_back(dusk::io::fs_path_to_string(executablePath));
|
||||
args.push_back(executablePath.string());
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
args.emplace_back(argv[i] != nullptr ? argv[i] : "");
|
||||
}
|
||||
|
||||
@@ -81,8 +81,6 @@ UserSettings g_userSettings = {
|
||||
.freeCamera {"game.freeCamera", false},
|
||||
.invertCameraXAxis {"game.invertCameraXAxis", false},
|
||||
.invertCameraYAxis {"game.invertCameraYAxis", false},
|
||||
.invertFirstPersonXAxis {"game.invertFirstPersonXAxis", false},
|
||||
.invertFirstPersonYAxis {"game.invertFirstPersonYAxis", false},
|
||||
.freeCameraSensitivity {"game.freeCameraSensitivity", 1.0f},
|
||||
.debugFlyCam {"game.debugFlyCam", false},
|
||||
.debugFlyCamLockEvents {"game.debugFlyCamLockEvents", true},
|
||||
@@ -123,6 +121,7 @@ UserSettings g_userSettings = {
|
||||
.skipPreLaunchUI {"backend.skipPreLaunchUI", false},
|
||||
.showPipelineCompilation {"backend.showPipelineCompilation", false},
|
||||
.wasPresetChosen {"backend.wasPresetChosen", false},
|
||||
.enableCrashReporting {"backend.enableCrashReporting", true},
|
||||
.checkForUpdates {"backend.checkForUpdates", true},
|
||||
.cardFileType {"backend.cardFileType", static_cast<int>(CARD_GCIFOLDER)},
|
||||
.enableAdvancedSettings {"backend.enableAdvancedSettings", false},
|
||||
@@ -172,8 +171,6 @@ void registerSettings() {
|
||||
Register(g_userSettings.game.enableMirrorMode);
|
||||
Register(g_userSettings.game.invertCameraXAxis);
|
||||
Register(g_userSettings.game.invertCameraYAxis);
|
||||
Register(g_userSettings.game.invertFirstPersonXAxis);
|
||||
Register(g_userSettings.game.invertFirstPersonYAxis);
|
||||
Register(g_userSettings.game.freeCameraSensitivity);
|
||||
Register(g_userSettings.game.minimalHUD);
|
||||
Register(g_userSettings.game.pauseOnFocusLost);
|
||||
@@ -231,6 +228,7 @@ void registerSettings() {
|
||||
Register(g_userSettings.backend.skipPreLaunchUI);
|
||||
Register(g_userSettings.backend.showPipelineCompilation);
|
||||
Register(g_userSettings.backend.wasPresetChosen);
|
||||
Register(g_userSettings.backend.enableCrashReporting);
|
||||
Register(g_userSettings.backend.checkForUpdates);
|
||||
Register(g_userSettings.backend.cardFileType);
|
||||
Register(g_userSettings.backend.enableAdvancedSettings);
|
||||
|
||||
@@ -208,15 +208,7 @@ bool input_neutral(int port) {
|
||||
bool keyboard_escape_pressed() {
|
||||
int keyCount = 0;
|
||||
const bool* keys = SDL_GetKeyboardState(&keyCount);
|
||||
if (keys == nullptr || SDL_SCANCODE_ESCAPE >= keyCount || !keys[SDL_SCANCODE_ESCAPE]) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < keyCount; ++i) {
|
||||
if (i != SDL_SCANCODE_ESCAPE && keys[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return keys != nullptr && SDL_SCANCODE_ESCAPE < keyCount && keys[SDL_SCANCODE_ESCAPE];
|
||||
}
|
||||
|
||||
Rml::String keyboard_key_name(s32 scancode) {
|
||||
|
||||
@@ -33,7 +33,6 @@ void applyPresetDusk() {
|
||||
s.game.fastTears.setValue(true);
|
||||
s.game.biggerWallets.setValue(true);
|
||||
s.game.invertCameraXAxis.setValue(true);
|
||||
s.game.invertFirstPersonYAxis.setValue(true);
|
||||
s.game.no2ndFishForCat.setValue(true);
|
||||
s.game.enableAchievementToasts.setValue(true);
|
||||
s.game.enableControllerToasts.setValue(true);
|
||||
|
||||
@@ -1,113 +0,0 @@
|
||||
#if DUSK_ENABLE_SENTRY_NATIVE
|
||||
|
||||
#include "reporting.hpp"
|
||||
|
||||
#include "button.hpp"
|
||||
#include "dusk/crash_reporting.h"
|
||||
#include "ui.hpp"
|
||||
|
||||
#include <dolphin/gx/GXAurora.h>
|
||||
|
||||
namespace dusk::ui {
|
||||
|
||||
CrashReportWindow::CrashReportWindow() : WindowSmall("modal", "modal-dialog") {
|
||||
mDialog->SetClass("modal-dialog", true);
|
||||
|
||||
auto* header = append(mDialog, "div");
|
||||
header->SetClass("modal-header", true);
|
||||
|
||||
auto* title = append(header, "div");
|
||||
title->SetClass("modal-title", true);
|
||||
title->SetInnerRML("Send Crash Reports");
|
||||
|
||||
auto* headIcon = append(header, "icon");
|
||||
headIcon->SetClass("question-mark", true);
|
||||
|
||||
auto* intro = append(mDialog, "div");
|
||||
intro->SetClass("modal-body", true);
|
||||
intro->SetInnerRML(
|
||||
"Dusk can automatically send crash reports to the developers. Crash reports contain the "
|
||||
"following:"
|
||||
"<br/>• Operating system version<br/>• CPU architecture<br/>• GPU model & driver version"
|
||||
"<br/>• File paths (may include account username)<br/>• Stack trace<br/><br/>"
|
||||
"This can be changed in the Settings menu at any time.");
|
||||
|
||||
auto* grid = append(mDialog, "div");
|
||||
grid->SetClass("preset-grid", true);
|
||||
|
||||
struct OptionInfo {
|
||||
const char* name;
|
||||
const char* desc;
|
||||
void (*apply)();
|
||||
};
|
||||
|
||||
static constexpr OptionInfo kOptions[] = {
|
||||
{"Enable",
|
||||
"Send crash reports to Dusk developers. Reports will include the information described "
|
||||
"above.",
|
||||
[] { crash_reporting::set_consent(true); }},
|
||||
{"Disable",
|
||||
"Do not send crash reports. This may make it more difficult to resolve issues you "
|
||||
"encounter.",
|
||||
[] { crash_reporting::set_consent(false); }},
|
||||
};
|
||||
|
||||
for (const auto& option : kOptions) {
|
||||
auto* col = append(grid, "div");
|
||||
col->SetClass("preset-col", true);
|
||||
|
||||
auto btn = std::make_unique<Button>(col, Rml::String(option.name));
|
||||
btn->on_nav_command([this, apply = option.apply](Rml::Event&, NavCommand cmd) {
|
||||
if (cmd == NavCommand::Confirm) {
|
||||
apply();
|
||||
hide(true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
mButtons.push_back(std::move(btn));
|
||||
|
||||
auto* desc = append(col, "div");
|
||||
desc->SetClass("preset-desc", true);
|
||||
desc->SetInnerRML(option.desc);
|
||||
}
|
||||
}
|
||||
|
||||
bool CrashReportWindow::focus() {
|
||||
if (!mButtons.empty()) {
|
||||
return mButtons.back()->focus();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CrashReportWindow::handle_nav_command(Rml::Event& event, NavCommand cmd) {
|
||||
if (cmd == NavCommand::Cancel || cmd == NavCommand::Menu) {
|
||||
return true;
|
||||
}
|
||||
int direction = 0;
|
||||
if (cmd == NavCommand::Left) {
|
||||
direction = -1;
|
||||
} else if (cmd == NavCommand::Right) {
|
||||
direction = 1;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
auto* target = event.GetTargetElement();
|
||||
for (int i = 0; i < static_cast<int>(mButtons.size()); ++i) {
|
||||
if (mButtons[i]->contains(target)) {
|
||||
const int next = i + direction;
|
||||
if (next >= 0 && next < static_cast<int>(mButtons.size())) {
|
||||
if (mButtons[next]->focus()) {
|
||||
mDoAud_seStartMenu(kSoundItemFocus);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace dusk::ui
|
||||
|
||||
#endif
|
||||
@@ -1,28 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#if DUSK_ENABLE_SENTRY_NATIVE
|
||||
|
||||
#include "component.hpp"
|
||||
#include "window.hpp"
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace dusk::ui {
|
||||
|
||||
class CrashReportWindow : public WindowSmall {
|
||||
public:
|
||||
CrashReportWindow();
|
||||
|
||||
bool focus() override;
|
||||
|
||||
protected:
|
||||
bool handle_nav_command(Rml::Event& event, NavCommand cmd) override;
|
||||
|
||||
private:
|
||||
std::vector<std::unique_ptr<Component>> mButtons;
|
||||
};
|
||||
|
||||
} // namespace dusk::ui
|
||||
|
||||
#endif
|
||||
+10
-26
@@ -19,10 +19,6 @@
|
||||
#include "prelaunch.hpp"
|
||||
#include "ui.hpp"
|
||||
|
||||
#if DUSK_ENABLE_SENTRY_NATIVE
|
||||
#include "dusk/crash_reporting.h"
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
namespace dusk::ui {
|
||||
@@ -645,10 +641,6 @@ SettingsWindow::SettingsWindow(bool prelaunch) : mPrelaunch(prelaunch) {
|
||||
config_percent_select(leftPane, rightPane, getSettings().game.freeCameraSensitivity,
|
||||
"Free Camera Sensitivity", "Adjusts twin-stick camera sensitivity.", 50, 200, 5,
|
||||
[] { return !getSettings().game.freeCamera; });
|
||||
addOption("Invert First Person X Axis", getSettings().game.invertFirstPersonXAxis,
|
||||
"Invert horizontal movement while aiming with items or first person camera. Applies to both stick and gyro aiming.");
|
||||
addOption("Invert First Person Y Axis", getSettings().game.invertFirstPersonYAxis,
|
||||
"Invert vertical movement while aiming with items or first person camera. Applies to both stick and gyro aiming.");
|
||||
|
||||
leftPane.add_section("Gyro");
|
||||
leftPane.register_control(
|
||||
@@ -1032,24 +1024,16 @@ SettingsWindow::SettingsWindow(bool prelaunch) : mPrelaunch(prelaunch) {
|
||||
pane.add_rml("<br/>Choose which notifications can be displayed.");
|
||||
});
|
||||
#if DUSK_ENABLE_SENTRY_NATIVE
|
||||
auto& crashReporting = leftPane.add_child<BoolButton>(BoolButton::Props{
|
||||
.key = "Crash Reporting",
|
||||
.getValue =
|
||||
[] { return crash_reporting::get_consent() == crash_reporting::Consent::Given; },
|
||||
.setValue = [](bool enabled) { crash_reporting::set_consent(enabled); },
|
||||
.isDisabled =
|
||||
[] {
|
||||
return crash_reporting::get_consent() == crash_reporting::Consent::Unavailable;
|
||||
},
|
||||
.isModified = [] { return false; },
|
||||
});
|
||||
leftPane.register_control(crashReporting, rightPane, [](Pane& pane) {
|
||||
pane.clear();
|
||||
pane.add_rml("Dusk can automatically send crash reports to the developers. Crash "
|
||||
"reports contain the following:<br/>• Operating system version<br/>• CPU "
|
||||
"architecture<br/>• GPU model & driver version<br/>• File paths (may "
|
||||
"include account username)<br/>• Stack trace");
|
||||
});
|
||||
config_bool_select(leftPane, rightPane, getSettings().backend.enableCrashReporting,
|
||||
{.key = "Crash Reporting",
|
||||
.helpText = "Enable automatic reporting of crashes to the developers.<br/><br/>"
|
||||
"Submissions include logs which may contain sensitive information. "
|
||||
"Refrain from "
|
||||
"enabling reporting if you do not agree with the following "
|
||||
"inclusions:<br/><br/> "
|
||||
"- Operating System<br/>- CPU Architecture<br/>- GPU Model & Driver "
|
||||
"Version<br/>"
|
||||
"- Account Username"});
|
||||
#endif
|
||||
config_bool_select(leftPane, rightPane, getSettings().backend.skipPreLaunchUI,
|
||||
{
|
||||
|
||||
+1
-2
@@ -11,7 +11,6 @@
|
||||
#include <ranges>
|
||||
|
||||
#include "aurora/lib/window.hpp"
|
||||
#include "dusk/io.hpp"
|
||||
#include "input.hpp"
|
||||
#include "prelaunch.hpp"
|
||||
#include "window.hpp"
|
||||
@@ -20,7 +19,7 @@ namespace dusk::ui {
|
||||
namespace {
|
||||
|
||||
void load_font(const char* filename, bool fallback = false) {
|
||||
Rml::LoadFontFace(io::fs_path_to_string(resource_path(filename)), fallback);
|
||||
Rml::LoadFontFace(resource_path(filename).string(), fallback);
|
||||
}
|
||||
|
||||
bool sInitialized = false;
|
||||
|
||||
@@ -740,8 +740,6 @@ static void fapGm_AfterRecord() {
|
||||
fapGm_After();
|
||||
}
|
||||
|
||||
BOOL isRecording = false;
|
||||
|
||||
static void duskExecute() {
|
||||
handleGamepadColor();
|
||||
updateAutoSave();
|
||||
@@ -749,11 +747,6 @@ static void duskExecute() {
|
||||
if (dusk::getSettings().game.recordingMode) {
|
||||
Z2GetSoundMgr()->getSeqMgr()->getParams()->moveVolume(0.0f, 0);
|
||||
Z2GetSoundMgr()->getStreamMgr()->getParams()->moveVolume(0.0f, 0);
|
||||
isRecording = true;
|
||||
} else if (isRecording) {
|
||||
Z2GetSoundMgr()->getSeqMgr()->getParams()->moveVolume(1.0f, 0);
|
||||
Z2GetSoundMgr()->getStreamMgr()->getParams()->moveVolume(1.0f, 0);
|
||||
isRecording = false;
|
||||
}
|
||||
|
||||
if (mDoCPd_c::getHoldR(PAD_1) && mDoCPd_c::getTrigX(PAD_1)) {
|
||||
|
||||
+20
-88
@@ -71,7 +71,6 @@
|
||||
#include <dolphin/dvd.h>
|
||||
|
||||
#include "SDL3/SDL_filesystem.h"
|
||||
#include "SDL3/SDL_iostream.h"
|
||||
#include "SDL3/SDL_misc.h"
|
||||
#include "cxxopts.hpp"
|
||||
#include "d/actor/d_a_movie_player.h"
|
||||
@@ -79,7 +78,6 @@
|
||||
#include "dusk/audio/DuskDsp.hpp"
|
||||
#include "dusk/config.hpp"
|
||||
#include "dusk/settings.h"
|
||||
#include "dusk/io.hpp"
|
||||
#include "dusk/version.hpp"
|
||||
#include "dusk/discord_presence.hpp"
|
||||
#include "tracy/Tracy.hpp"
|
||||
@@ -90,10 +88,6 @@
|
||||
#include <TargetConditionals.h>
|
||||
#endif
|
||||
|
||||
#if DUSK_ENABLE_SENTRY_NATIVE
|
||||
#include "dusk/ui/reporting.hpp"
|
||||
#endif
|
||||
|
||||
// --- GLOBALS ---
|
||||
s8 mDoMain::developmentMode = -1;
|
||||
OSTime mDoMain::sPowerOnTime;
|
||||
@@ -130,7 +124,7 @@ bool dusk::OpenDataFolder() {
|
||||
std::filesystem::path path = std::filesystem::absolute(ConfigPath, ec);
|
||||
if (ec) {
|
||||
DuskLog.warn("Failed to resolve absolute data folder path '{}': {}",
|
||||
io::fs_path_to_string(ConfigPath), ec.message());
|
||||
ConfigPath.string(), ec.message());
|
||||
path = ConfigPath;
|
||||
}
|
||||
|
||||
@@ -140,8 +134,7 @@ bool dusk::OpenDataFolder() {
|
||||
const std::string url = "file://" + path.generic_string();
|
||||
#endif
|
||||
if (!SDL_OpenURL(url.c_str())) {
|
||||
DuskLog.warn(
|
||||
"Failed to open data folder '{}': {}", io::fs_path_to_string(path), SDL_GetError());
|
||||
DuskLog.warn("Failed to open data folder '{}': {}", path.string(), SDL_GetError());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -511,21 +504,16 @@ static void EnsureInitialPipelineCache(const std::filesystem::path& configDir) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::string sourcePathString;
|
||||
SDL_IOStream* source = nullptr;
|
||||
|
||||
const char* basePath = SDL_GetBasePath();
|
||||
if (basePath != nullptr) {
|
||||
sourcePathString = dusk::io::fs_path_to_string(
|
||||
std::filesystem::path(basePath) / "initial_pipeline_cache.db");
|
||||
source = SDL_IOFromFile(sourcePathString.c_str(), "rb");
|
||||
if (basePath == nullptr) {
|
||||
DuskLog.warn("Unable to resolve base path while seeding pipeline cache: {}", SDL_GetError());
|
||||
return;
|
||||
}
|
||||
if (source == nullptr) {
|
||||
sourcePathString = "initial_pipeline_cache.db";
|
||||
source = SDL_IOFromFile(sourcePathString.c_str(), "rb");
|
||||
}
|
||||
if (source == nullptr) {
|
||||
DuskLog.info("No bundled initial pipeline cache found");
|
||||
|
||||
const std::filesystem::path initialPipelineCachePath =
|
||||
std::filesystem::path(basePath) / "initial_pipeline_cache.db";
|
||||
if (!std::filesystem::exists(initialPipelineCachePath)) {
|
||||
DuskLog.info("No bundled initial pipeline cache found at '{}'", initialPipelineCachePath.string());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -533,68 +521,18 @@ static void EnsureInitialPipelineCache(const std::filesystem::path& configDir) {
|
||||
std::filesystem::create_directories(configDir, ec);
|
||||
if (ec) {
|
||||
DuskLog.warn("Failed to create config directory '{}' for pipeline cache: {}",
|
||||
dusk::io::fs_path_to_string(configDir), ec.message());
|
||||
SDL_CloseIO(source);
|
||||
configDir.string(), ec.message());
|
||||
return;
|
||||
}
|
||||
|
||||
const auto pipelineCacheString = dusk::io::fs_path_to_string(pipelineCachePath);
|
||||
SDL_IOStream* destination = SDL_IOFromFile(pipelineCacheString.c_str(), "wb");
|
||||
if (destination == nullptr) {
|
||||
DuskLog.warn("Failed to open '{}' for seeded pipeline cache: {}", pipelineCacheString,
|
||||
SDL_GetError());
|
||||
SDL_CloseIO(source);
|
||||
std::filesystem::copy_file(initialPipelineCachePath, pipelineCachePath, std::filesystem::copy_options::none, ec);
|
||||
if (ec) {
|
||||
DuskLog.warn("Failed to seed pipeline cache from '{}' to '{}': {}",
|
||||
initialPipelineCachePath.string(), pipelineCachePath.string(), ec.message());
|
||||
return;
|
||||
}
|
||||
|
||||
bool copied = true;
|
||||
std::array<char, 64 * 1024> buffer{};
|
||||
while (true) {
|
||||
const size_t bytesRead = SDL_ReadIO(source, buffer.data(), buffer.size());
|
||||
if (bytesRead > 0) {
|
||||
size_t bytesWritten = 0;
|
||||
while (bytesWritten < bytesRead) {
|
||||
const size_t written = SDL_WriteIO(
|
||||
destination, buffer.data() + bytesWritten, bytesRead - bytesWritten);
|
||||
if (written == 0) {
|
||||
DuskLog.warn("Failed to write seeded pipeline cache '{}': {}",
|
||||
pipelineCacheString, SDL_GetError());
|
||||
copied = false;
|
||||
break;
|
||||
}
|
||||
bytesWritten += written;
|
||||
}
|
||||
}
|
||||
|
||||
if (!copied) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (bytesRead < buffer.size()) {
|
||||
if (SDL_GetIOStatus(source) == SDL_IO_STATUS_EOF) {
|
||||
break;
|
||||
}
|
||||
|
||||
DuskLog.warn(
|
||||
"Failed to read bundled pipeline cache '{}': {}", sourcePathString, SDL_GetError());
|
||||
copied = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!SDL_CloseIO(destination)) {
|
||||
DuskLog.warn("Failed to close seeded pipeline cache '{}': {}",
|
||||
dusk::io::fs_path_to_string(pipelineCachePath), SDL_GetError());
|
||||
copied = false;
|
||||
}
|
||||
SDL_CloseIO(source);
|
||||
|
||||
if (!copied) {
|
||||
std::filesystem::remove(pipelineCachePath, ec);
|
||||
return;
|
||||
}
|
||||
|
||||
DuskLog.info("Seeded pipeline cache from '{}'", sourcePathString);
|
||||
DuskLog.info("Seeded pipeline cache from '{}'", initialPipelineCachePath.string());
|
||||
}
|
||||
|
||||
static constexpr PADDefaultMapping defaultPadMapping = {
|
||||
@@ -697,7 +635,7 @@ int game_main(int argc, char* argv[]) {
|
||||
|
||||
dusk::config::LoadFromUserPreferences();
|
||||
ApplyCVarOverrides(parsed_arg_options["cvar"]);
|
||||
dusk::crash_reporting::initialize();
|
||||
dusk::InitializeCrashReporting();
|
||||
EnsureInitialPipelineCache(dusk::ConfigPath);
|
||||
// TODO: How to handle this?
|
||||
//PADSetDefaultMapping(&defaultPadMapping, PAD_TYPE_STANDARD);
|
||||
@@ -748,7 +686,7 @@ int game_main(int argc, char* argv[]) {
|
||||
// Run ImGui UI loop if Aurora couldn't initialize a backend
|
||||
if (auroraInfo.backend == BACKEND_NULL) {
|
||||
launchUILoop();
|
||||
dusk::crash_reporting::shutdown();
|
||||
dusk::ShutdownCrashReporting();
|
||||
dusk::ShutdownFileLogging();
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
@@ -826,7 +764,7 @@ int game_main(int argc, char* argv[]) {
|
||||
|
||||
// pre game launch ui main loop
|
||||
if (!launchUILoop()) {
|
||||
dusk::crash_reporting::shutdown();
|
||||
dusk::ShutdownCrashReporting();
|
||||
dusk::ShutdownFileLogging();
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
@@ -857,12 +795,6 @@ int game_main(int argc, char* argv[]) {
|
||||
dusk::IsGameLaunched = true;
|
||||
}
|
||||
|
||||
#if DUSK_ENABLE_SENTRY_NATIVE
|
||||
if (dusk::crash_reporting::get_consent() == dusk::crash_reporting::Consent::Unknown) {
|
||||
dusk::ui::push_document(std::make_unique<dusk::ui::CrashReportWindow>());
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!dusk::getSettings().backend.wasPresetChosen) {
|
||||
dusk::ui::push_document(std::make_unique<dusk::ui::PresetWindow>());
|
||||
}
|
||||
@@ -894,7 +826,7 @@ int game_main(int argc, char* argv[]) {
|
||||
|
||||
dusk::MoviePlayerShutdown();
|
||||
|
||||
dusk::crash_reporting::shutdown();
|
||||
dusk::ShutdownCrashReporting();
|
||||
dusk::ShutdownFileLogging();
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
|
||||
Reference in New Issue
Block a user