mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-07-04 11:19:58 -04:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3ca2e4d77a |
+13
-109
@@ -48,17 +48,12 @@ else ()
|
||||
message(STATUS "Unable to find git, commit information will not be available")
|
||||
endif ()
|
||||
|
||||
if (DUSK_WC_DESCRIBE MATCHES "^v([0-9]+)\\.([0-9]+)\\.([0-9]+)(-([0-9]+).*)?$")
|
||||
set(DUSK_SHORT_VERSION_STRING "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}")
|
||||
if (CMAKE_MATCH_5)
|
||||
set(DUSK_VERSION_STRING "${DUSK_SHORT_VERSION_STRING}.${CMAKE_MATCH_5}")
|
||||
else ()
|
||||
set(DUSK_VERSION_STRING "${DUSK_SHORT_VERSION_STRING}.0")
|
||||
endif ()
|
||||
if (DUSK_WC_DESCRIBE)
|
||||
string(REGEX REPLACE "v([0-9]+)\.([0-9]+)\.([0-9]+)\-([0-9]+).*" "\\1.\\2.\\3.\\4" DUSK_VERSION_STRING "${DUSK_WC_DESCRIBE}")
|
||||
string(REGEX REPLACE "v([0-9]+)\.([0-9]+)\.([0-9]+).*" "\\1.\\2.\\3" DUSK_SHORT_VERSION_STRING "${DUSK_WC_DESCRIBE}")
|
||||
else ()
|
||||
set(DUSK_WC_DESCRIBE "UNKNOWN-VERSION")
|
||||
set(DUSK_VERSION_STRING "0.0.0.0")
|
||||
set(DUSK_SHORT_VERSION_STRING "0.0.0")
|
||||
set(DUSK_VERSION_STRING "0.0.0")
|
||||
endif ()
|
||||
|
||||
# Add version information to CI environment variables
|
||||
@@ -100,10 +95,6 @@ option(DUSK_BUILD_WARNINGS "Enable compiler warnings (off by default)")
|
||||
option(DUSK_SELECTED_OPT "If on, selected parts of the project will be compiled with optimizations on Debug, intending to make the game run at 30 FPS. Note for MSVC: you will need to remove '/RTC1' from your debug flags in CMake.")
|
||||
option(DUSK_MOVIE_SUPPORT "If on, compile against libjpeg-turbo to enable THP file decoding" ON)
|
||||
|
||||
option(DUSK_ENABLE_SENTRY_NATIVE "Enable sentry-native crash reporting support" OFF)
|
||||
set(DUSK_SENTRY_DSN "" CACHE STRING "Sentry DSN")
|
||||
set(DUSK_SENTRY_ENVIRONMENT "development" CACHE STRING "Sentry environment")
|
||||
|
||||
if (DUSK_MOVIE_SUPPORT)
|
||||
find_package(libjpeg-turbo QUIET)
|
||||
if (libjpeg-turbo_FOUND)
|
||||
@@ -157,23 +148,21 @@ elseif (APPLE)
|
||||
set(CMAKE_INSTALL_RPATH "$ORIGIN")
|
||||
set(CMAKE_BUILD_RPATH "$ORIGIN")
|
||||
elseif (MSVC)
|
||||
add_compile_options(
|
||||
$<$<COMPILE_LANGUAGE:C,CXX>:/bigobj>
|
||||
$<$<COMPILE_LANGUAGE:C,CXX>:/Zc:strictStrings->
|
||||
$<$<COMPILE_LANGUAGE:C,CXX>:/MP>
|
||||
$<$<COMPILE_LANGUAGE:C,CXX>:/FS>
|
||||
)
|
||||
add_compile_options(/bigobj)
|
||||
add_compile_options(/Zc:strictStrings-)
|
||||
add_compile_options(/MP)
|
||||
add_compile_options(/FS)
|
||||
|
||||
if (NOT DUSK_BUILD_WARNINGS)
|
||||
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/W0>)
|
||||
add_compile_options(/W0)
|
||||
else ()
|
||||
# Disable warnings
|
||||
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4068>) # unknown pragma
|
||||
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4291>) # no matching delete operator, leaks if exception thrown
|
||||
add_compile_options(/wd4068) # unknown pragma
|
||||
add_compile_options(/wd4291) # no matching delete operator, leaks if exception thrown
|
||||
# Only show warnings once
|
||||
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wo4244>) # narrowing conversion, possible data loss
|
||||
add_compile_options(/wo4244) # narrowing conversion, possible data loss
|
||||
endif ()
|
||||
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/utf-8>)
|
||||
add_compile_options(/utf-8)
|
||||
endif ()
|
||||
|
||||
|
||||
@@ -194,46 +183,6 @@ FetchContent_Declare(json
|
||||
)
|
||||
FetchContent_MakeAvailable(cxxopts json)
|
||||
|
||||
if (DUSK_ENABLE_SENTRY_NATIVE)
|
||||
message(STATUS "dusk: Fetching sentry-native")
|
||||
set(SENTRY_BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
|
||||
set(SENTRY_BACKEND crashpad CACHE STRING "" FORCE)
|
||||
if (WIN32)
|
||||
set(SENTRY_TRANSPORT winhttp CACHE STRING "" FORCE)
|
||||
endif ()
|
||||
set(SENTRY_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
||||
set(SENTRY_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
||||
set(SENTRY_BUILD_BENCHMARKS OFF CACHE BOOL "" FORCE)
|
||||
FetchContent_Declare(sentry_native
|
||||
GIT_REPOSITORY https://github.com/getsentry/sentry-native.git
|
||||
GIT_TAG 0.13.6
|
||||
GIT_SHALLOW TRUE
|
||||
GIT_PROGRESS TRUE
|
||||
GIT_SUBMODULES_RECURSE TRUE
|
||||
)
|
||||
if (NOT sentry_native_POPULATED)
|
||||
FetchContent_Populate(sentry_native)
|
||||
set(_dusk_skip_install_rules ${CMAKE_SKIP_INSTALL_RULES})
|
||||
set(CMAKE_SKIP_INSTALL_RULES ON)
|
||||
add_subdirectory(${sentry_native_SOURCE_DIR} ${sentry_native_BINARY_DIR} EXCLUDE_FROM_ALL)
|
||||
set(CMAKE_SKIP_INSTALL_RULES ${_dusk_skip_install_rules})
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL Windows)
|
||||
set(PLATFORM_NAME win32)
|
||||
elseif (CMAKE_SYSTEM_NAME STREQUAL Darwin)
|
||||
if (IOS)
|
||||
set(PLATFORM_NAME ios)
|
||||
elseif (TVOS)
|
||||
set(PLATFORM_NAME tvos)
|
||||
else ()
|
||||
set(PLATFORM_NAME macos)
|
||||
endif ()
|
||||
else ()
|
||||
string(TOLOWER CMAKE_SYSTEM_NAME PLATFORM_NAME)
|
||||
endif ()
|
||||
|
||||
configure_file(${CMAKE_SOURCE_DIR}/version.h.in ${CMAKE_BINARY_DIR}/version.h)
|
||||
|
||||
include(files.cmake)
|
||||
@@ -242,10 +191,6 @@ include(files.cmake)
|
||||
|
||||
set(DUSK_BUNDLE_NAME Dusk)
|
||||
set(DUSK_BUNDLE_IDENTIFIER dev.decomp.dusk)
|
||||
set(DUSK_COMPANY_NAME "Twilit Realm")
|
||||
set(DUSK_FILE_DESCRIPTION "Dusk")
|
||||
set(DUSK_PRODUCT_NAME "Dusk")
|
||||
set(DUSK_COPYRIGHT "Copyright (C) Twilit Realm contributors")
|
||||
set(DUSK_GAME_NAME "GZ2E")
|
||||
set(DUSK_GAME_VERSION "01")
|
||||
set(DUSK_TP_VERSION ${DUSK_GAME_NAME}${DUSK_GAME_VERSION})
|
||||
@@ -271,13 +216,6 @@ set(GAME_INCLUDE_DIRS
|
||||
set(GAME_LIBS aurora::core aurora::gx aurora::gd aurora::si aurora::vi aurora::pad aurora::mtx aurora::os aurora::dvd
|
||||
aurora::card freeverb cxxopts::cxxopts absl::flat_hash_map nlohmann_json::nlohmann_json TracyClient)
|
||||
|
||||
list(APPEND GAME_LIBS libzstd_static)
|
||||
|
||||
if (DUSK_ENABLE_SENTRY_NATIVE)
|
||||
list(APPEND GAME_LIBS sentry)
|
||||
list(APPEND GAME_COMPILE_DEFS DUSK_ENABLE_SENTRY_NATIVE=1 SENTRY_BUILD_STATIC=1)
|
||||
endif ()
|
||||
|
||||
if (DUSK_MOVIE_SUPPORT)
|
||||
if (TARGET libjpeg-turbo::turbojpeg-static)
|
||||
list(APPEND GAME_LIBS libjpeg-turbo::turbojpeg-static)
|
||||
@@ -330,9 +268,6 @@ add_executable(dusk src/dusk/main.cpp)
|
||||
target_compile_definitions(dusk PRIVATE TARGET_PC AVOID_UB=1 VERSION=0)
|
||||
target_include_directories(dusk PRIVATE include)
|
||||
target_link_libraries(dusk PRIVATE game aurora::main)
|
||||
if (TARGET crashpad_handler)
|
||||
add_dependencies(dusk crashpad_handler)
|
||||
endif ()
|
||||
|
||||
add_custom_command(TARGET dusk POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
@@ -341,35 +276,6 @@ add_custom_command(TARGET dusk POST_BUILD
|
||||
COMMENT "Copying resources"
|
||||
)
|
||||
|
||||
if (WIN32)
|
||||
set(DUSK_WINDOWS_RESOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/platforms/windows)
|
||||
set(DUSK_WINDOWS_ICON_PNG ${CMAKE_CURRENT_SOURCE_DIR}/res/icon.png)
|
||||
set(DUSK_WINDOWS_ICON_ICO ${CMAKE_CURRENT_BINARY_DIR}/dusk.ico)
|
||||
set(DUSK_WINDOWS_RC ${CMAKE_CURRENT_BINARY_DIR}/dusk.rc)
|
||||
set(DUSK_WINDOWS_MANIFEST ${CMAKE_CURRENT_BINARY_DIR}/dusk.manifest)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${DUSK_WINDOWS_ICON_ICO}
|
||||
COMMAND powershell -ExecutionPolicy Bypass -File
|
||||
${DUSK_WINDOWS_RESOURCE_DIR}/Create-IcoFromPng.ps1
|
||||
-InputPng ${DUSK_WINDOWS_ICON_PNG}
|
||||
-OutputIco ${DUSK_WINDOWS_ICON_ICO}
|
||||
DEPENDS ${DUSK_WINDOWS_ICON_PNG} ${DUSK_WINDOWS_RESOURCE_DIR}/Create-IcoFromPng.ps1
|
||||
VERBATIM
|
||||
COMMENT "Generating Windows icon"
|
||||
)
|
||||
|
||||
configure_file(${DUSK_WINDOWS_RESOURCE_DIR}/dusk.manifest.in ${DUSK_WINDOWS_MANIFEST} @ONLY)
|
||||
configure_file(${DUSK_WINDOWS_RESOURCE_DIR}/dusk.rc.in ${DUSK_WINDOWS_RC} @ONLY)
|
||||
|
||||
target_sources(dusk PRIVATE ${DUSK_WINDOWS_ICON_ICO} ${DUSK_WINDOWS_RC})
|
||||
set_target_properties(dusk PROPERTIES WIN32_EXECUTABLE TRUE)
|
||||
|
||||
if (MSVC)
|
||||
target_link_options(dusk PRIVATE /MANIFEST:NO)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (APPLE)
|
||||
if (IOS)
|
||||
set(DUSK_RESOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/platforms/ios)
|
||||
@@ -458,8 +364,6 @@ if (TARGET crashpad_handler)
|
||||
list(APPEND EXTRA_TARGETS crashpad_handler)
|
||||
endif ()
|
||||
install(TARGETS ${BINARY_TARGETS} ${EXTRA_TARGETS} DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
aurora_install_runtime_dlls(dusk ${CMAKE_INSTALL_PREFIX})
|
||||
install(DIRECTORY ${CMAKE_SOURCE_DIR}/res DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
if (CMAKE_BUILD_TYPE STREQUAL Debug OR CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo)
|
||||
set(DEBUG_FILES_LIST "")
|
||||
foreach (target IN LISTS BINARY_TARGETS EXTRA_TARGETS)
|
||||
|
||||
+4
-4
@@ -88,7 +88,7 @@
|
||||
"name": "windows-msvc",
|
||||
"displayName": "Windows (MSVC)",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build/${presetName}",
|
||||
"binaryDir": "${sourceDir}/out/build/${presetName}",
|
||||
"architecture": {
|
||||
"value": "x64",
|
||||
"strategy": "external"
|
||||
@@ -96,7 +96,7 @@
|
||||
"cacheVariables": {
|
||||
"CMAKE_C_COMPILER": "cl",
|
||||
"CMAKE_CXX_COMPILER": "cl",
|
||||
"CMAKE_INSTALL_PREFIX": "${sourceDir}/build/install"
|
||||
"CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install"
|
||||
},
|
||||
"vendor": {
|
||||
"microsoft.com/VisualStudioSettings/CMake/1.0": {
|
||||
@@ -126,7 +126,7 @@
|
||||
"name": "windows-arm64-msvc",
|
||||
"displayName": "Windows ARM64 (MSVC)",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build/${presetName}",
|
||||
"binaryDir": "${sourceDir}/out/build/${presetName}",
|
||||
"architecture": {
|
||||
"value": "arm64",
|
||||
"strategy": "external"
|
||||
@@ -134,7 +134,7 @@
|
||||
"cacheVariables": {
|
||||
"CMAKE_C_COMPILER": "cl",
|
||||
"CMAKE_CXX_COMPILER": "cl",
|
||||
"CMAKE_INSTALL_PREFIX": "${sourceDir}/build/install",
|
||||
"CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install",
|
||||
"AURORA_DAWN_PROVIDER": "vendor"
|
||||
},
|
||||
"vendor": {
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
from PIL import Image
|
||||
FRAME_COUNT = 6572
|
||||
WIDTH = 48
|
||||
HEIGHT = 36
|
||||
|
||||
out = open("apple.dat", "wb")
|
||||
for frame in range(1, 6572+1):
|
||||
print(frame)
|
||||
img = Image.open(f"apples/{frame}.png")
|
||||
pixels = img.load()
|
||||
assert img.width == WIDTH
|
||||
assert img.height == HEIGHT
|
||||
for y in range(HEIGHT):
|
||||
for x in range(WIDTH):
|
||||
(r, g, b) = pixels[x, y]
|
||||
if r > 128:
|
||||
out.write(b"\x01")
|
||||
else:
|
||||
out.write(b"\x00")
|
||||
Vendored
+1
-1
Submodule extern/aurora updated: 4dd23c74d8...4c0d0feb02
@@ -1338,7 +1338,6 @@ set(DUSK_FILES
|
||||
src/d/actor/d_a_alink_dusk.cpp
|
||||
src/dusk/asserts.cpp
|
||||
src/dusk/config.cpp
|
||||
src/dusk/crash_reporting.cpp
|
||||
src/dusk/endian.cpp
|
||||
src/dusk/extras.c
|
||||
src/dusk/extras.cpp
|
||||
@@ -1374,8 +1373,6 @@ set(DUSK_FILES
|
||||
src/dusk/imgui/ImGuiStubLog.cpp
|
||||
src/dusk/imgui/ImGuiMapLoader.cpp
|
||||
src/dusk/imgui/ImGuiSaveEditor.cpp
|
||||
src/dusk/imgui/ImGuiStateShare.hpp
|
||||
src/dusk/imgui/ImGuiStateShare.cpp
|
||||
src/dusk/offset_ptr.cpp
|
||||
src/dusk/OSContext.cpp
|
||||
src/dusk/OSThread.cpp
|
||||
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
*
|
||||
*/
|
||||
class daObj_SMTile_c : public fopAc_ac_c {
|
||||
private:
|
||||
public:
|
||||
/* 0x568 */ mDoExt_brkAnm mBrk;
|
||||
/* 0x580 */ OBJ_SMTILE_HIO_CLASS* mpHIO;
|
||||
/* 0x584 */ request_of_phase_process_class mPhase;
|
||||
@@ -59,6 +59,10 @@ private:
|
||||
/* 0xB29 */ u8 field_0xb29;
|
||||
/* 0xB2A */ u8 field_0xb2a;
|
||||
/* 0xB2B */ u8 field_0xb2b;
|
||||
|
||||
bool bad_apple;
|
||||
u32 bad_apple_frame;
|
||||
JAISoundHandle apple_sound;
|
||||
public:
|
||||
virtual ~daObj_SMTile_c();
|
||||
int create();
|
||||
|
||||
@@ -308,11 +308,8 @@ private:
|
||||
/* 0x0000C */ dDlst_shadowSimple_c mSimple[128];
|
||||
/* 0x0340C */ int mNextID;
|
||||
/* 0x03410 */ dDlst_shadowReal_c mReal[8];
|
||||
/* 0x15EB0 */ TGXTexObj mShadowTexObj[2];
|
||||
/* 0x15EF0 */ void* mShadowTexData[2];
|
||||
#if TARGET_PC
|
||||
int mTexResScale;
|
||||
#endif
|
||||
/* 0x15EB0 */ TGXTexObj field_0x15eb0[2];
|
||||
/* 0x15EF0 */ void* field_0x15ef0[2];
|
||||
};
|
||||
|
||||
class dDlst_window_c {
|
||||
|
||||
@@ -146,12 +146,6 @@ concept ConfigValue =
|
||||
template <ConfigValue T>
|
||||
const ConfigImplBase* GetConfigImpl();
|
||||
|
||||
template <typename T>
|
||||
struct ConfigEnumRange {
|
||||
static constexpr auto min = std::numeric_limits<std::underlying_type_t<T>>::min();
|
||||
static constexpr auto max = std::numeric_limits<std::underlying_type_t<T>>::max();
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief A CVar storing values.
|
||||
*
|
||||
@@ -195,11 +189,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr const T& getDefaultValue() const noexcept {
|
||||
checkRegistered();
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Change the value of a CVar.
|
||||
*
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
namespace dusk {
|
||||
|
||||
void InitializeCrashReporting();
|
||||
void ShutdownCrashReporting();
|
||||
|
||||
} // namespace dusk
|
||||
@@ -20,11 +20,6 @@ void begin_record();
|
||||
void end_record();
|
||||
void interpolate(float step);
|
||||
float get_interpolation_step();
|
||||
|
||||
void notify_presentation_frame();
|
||||
void request_presentation_sync();
|
||||
bool presentation_sync_active();
|
||||
|
||||
void notify_sim_tick_complete();
|
||||
uint32_t begin_presentation_ui_pass();
|
||||
uint32_t get_presentation_ui_advance_ticks();
|
||||
|
||||
@@ -17,7 +17,6 @@ constexpr const char* SHOW_HEAP_VIEWER = "F4";
|
||||
constexpr const char* SHOW_STUB_LOG = "F5";
|
||||
constexpr const char* SHOW_CAMERA_DEBUG = "F6";
|
||||
constexpr const char* SHOW_AUDIO_DEBUG = "F7";
|
||||
constexpr const char* SHOW_STATE_SHARE = "F8";
|
||||
|
||||
constexpr const char* TURBO = "Tab";
|
||||
|
||||
|
||||
@@ -7,9 +7,6 @@
|
||||
void aurora_log_callback(AuroraLogLevel level, const char* module, const char* message, unsigned int len);
|
||||
|
||||
namespace dusk {
|
||||
void InitializeFileLogging(const char* configDir, AuroraLogLevel logLevel);
|
||||
void ShutdownFileLogging();
|
||||
const char* GetLogFilePath();
|
||||
void SendToStubLog(AuroraLogLevel level, const char* module, const char* message);
|
||||
}
|
||||
|
||||
|
||||
+1
-17
@@ -7,20 +7,6 @@ namespace dusk {
|
||||
|
||||
using namespace config;
|
||||
|
||||
enum class BloomMode : int {
|
||||
Off = 0,
|
||||
Classic = 1,
|
||||
Dusk = 2,
|
||||
};
|
||||
|
||||
namespace config {
|
||||
template <>
|
||||
struct ConfigEnumRange<BloomMode> {
|
||||
static constexpr auto min = BloomMode::Off;
|
||||
static constexpr auto max = BloomMode::Dusk;
|
||||
};
|
||||
}
|
||||
|
||||
// Persistent user settings
|
||||
|
||||
struct UserSettings {
|
||||
@@ -67,8 +53,7 @@ struct UserSettings {
|
||||
ConfigVar<bool> invertCameraXAxis;
|
||||
|
||||
// Graphics
|
||||
ConfigVar<BloomMode> bloomMode;
|
||||
ConfigVar<float> bloomMultiplier;
|
||||
ConfigVar<bool> enableBloom;
|
||||
ConfigVar<bool> enableWaterRefraction;
|
||||
ConfigVar<bool> enableFrameInterpolation;
|
||||
ConfigVar<int> shadowResolutionMultiplier;
|
||||
@@ -103,7 +88,6 @@ struct UserSettings {
|
||||
ConfigVar<bool> skipPreLaunchUI;
|
||||
ConfigVar<bool> showPipelineCompilation;
|
||||
ConfigVar<bool> wasPresetChosen;
|
||||
ConfigVar<bool> enableCrashReporting;
|
||||
} backend;
|
||||
};
|
||||
|
||||
|
||||
@@ -2,11 +2,7 @@
|
||||
|
||||
#include "JSystem/JStudio/JStudio/jstudio-object.h"
|
||||
|
||||
#if TARGET_PC
|
||||
#include "dusk/audio.h"
|
||||
#include "dusk/frame_interpolation.h"
|
||||
#include "dusk/settings.h"
|
||||
#endif
|
||||
|
||||
namespace JStudio {
|
||||
namespace {
|
||||
@@ -654,25 +650,10 @@ value_or_fun:
|
||||
return;
|
||||
|
||||
value:
|
||||
#if TARGET_PC
|
||||
if (dusk::getSettings().game.enableFrameInterpolation && u <= 5 &&
|
||||
(operation == data::UNK_0x2 || operation == data::UNK_0x3 || operation == data::UNK_0x12))
|
||||
{
|
||||
dusk::frame_interp::request_presentation_sync();
|
||||
}
|
||||
#endif
|
||||
adaptor->adaptor_setVariableValue(control, u, operation, param_2, param_3);
|
||||
return;
|
||||
|
||||
value_n:
|
||||
#if TARGET_PC
|
||||
if (dusk::getSettings().game.enableFrameInterpolation &&
|
||||
(pN == TAdaptor_camera::sauVariableValue_3_POSITION_XYZ || pN == TAdaptor_camera::sauVariableValue_3_TARGET_POSITION_XYZ) &&
|
||||
(operation == data::UNK_0x2 || operation == data::UNK_0x3 || operation == data::UNK_0x12))
|
||||
{
|
||||
dusk::frame_interp::request_presentation_sync();
|
||||
}
|
||||
#endif
|
||||
adaptor->adaptor_setVariableValue_n(control, pN, u, operation, param_2, param_3);
|
||||
return;
|
||||
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$InputPng,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$OutputIco
|
||||
)
|
||||
|
||||
Set-StrictMode -Version Latest
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
Add-Type -AssemblyName System.Drawing
|
||||
|
||||
$iconSizes = @(16, 24, 32, 48, 64, 128, 256)
|
||||
|
||||
$inputPath = (Resolve-Path $InputPng).Path
|
||||
$outputPath = [System.IO.Path]::GetFullPath($OutputIco)
|
||||
$outputDir = Split-Path -Parent $outputPath
|
||||
if (-not [string]::IsNullOrEmpty($outputDir)) {
|
||||
[System.IO.Directory]::CreateDirectory($outputDir) | Out-Null
|
||||
}
|
||||
|
||||
$sourceImage = [System.Drawing.Image]::FromFile($inputPath)
|
||||
|
||||
try {
|
||||
$entries = New-Object System.Collections.Generic.List[object]
|
||||
|
||||
foreach ($size in $iconSizes) {
|
||||
$bitmap = New-Object System.Drawing.Bitmap $size, $size
|
||||
try {
|
||||
$graphics = [System.Drawing.Graphics]::FromImage($bitmap)
|
||||
try {
|
||||
$graphics.Clear([System.Drawing.Color]::Transparent)
|
||||
$graphics.InterpolationMode = [System.Drawing.Drawing2D.InterpolationMode]::HighQualityBicubic
|
||||
$graphics.PixelOffsetMode = [System.Drawing.Drawing2D.PixelOffsetMode]::HighQuality
|
||||
$graphics.SmoothingMode = [System.Drawing.Drawing2D.SmoothingMode]::HighQuality
|
||||
$graphics.CompositingQuality = [System.Drawing.Drawing2D.CompositingQuality]::HighQuality
|
||||
$graphics.DrawImage($sourceImage, 0, 0, $size, $size)
|
||||
} finally {
|
||||
$graphics.Dispose()
|
||||
}
|
||||
|
||||
$memory = New-Object System.IO.MemoryStream
|
||||
try {
|
||||
$bitmap.Save($memory, [System.Drawing.Imaging.ImageFormat]::Png)
|
||||
$entries.Add([pscustomobject]@{
|
||||
Size = $size
|
||||
Bytes = $memory.ToArray()
|
||||
}) | Out-Null
|
||||
} finally {
|
||||
$memory.Dispose()
|
||||
}
|
||||
} finally {
|
||||
$bitmap.Dispose()
|
||||
}
|
||||
}
|
||||
|
||||
$fileStream = [System.IO.File]::Open($outputPath, [System.IO.FileMode]::Create, [System.IO.FileAccess]::Write)
|
||||
try {
|
||||
$writer = New-Object System.IO.BinaryWriter $fileStream
|
||||
try {
|
||||
$writer.Write([UInt16]0)
|
||||
$writer.Write([UInt16]1)
|
||||
$writer.Write([UInt16]$entries.Count)
|
||||
|
||||
$dataOffset = 6 + (16 * $entries.Count)
|
||||
foreach ($entry in $entries) {
|
||||
$dimension = if ($entry.Size -ge 256) { 0 } else { [byte]$entry.Size }
|
||||
$writer.Write([byte]$dimension)
|
||||
$writer.Write([byte]$dimension)
|
||||
$writer.Write([byte]0)
|
||||
$writer.Write([byte]0)
|
||||
$writer.Write([UInt16]1)
|
||||
$writer.Write([UInt16]32)
|
||||
$writer.Write([UInt32]$entry.Bytes.Length)
|
||||
$writer.Write([UInt32]$dataOffset)
|
||||
$dataOffset += $entry.Bytes.Length
|
||||
}
|
||||
|
||||
foreach ($entry in $entries) {
|
||||
$writer.Write($entry.Bytes)
|
||||
}
|
||||
} finally {
|
||||
$writer.Dispose()
|
||||
}
|
||||
} finally {
|
||||
$fileStream.Dispose()
|
||||
}
|
||||
} finally {
|
||||
$sourceImage.Dispose()
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<assemblyIdentity
|
||||
version="@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@.@PROJECT_VERSION_TWEAK@"
|
||||
processorArchitecture="*"
|
||||
name="@DUSK_BUNDLE_IDENTIFIER@"
|
||||
type="win32"/>
|
||||
<description>@DUSK_FILE_DESCRIPTION@</description>
|
||||
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<security>
|
||||
<requestedPrivileges>
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
processorArchitecture="*"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*"/>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
|
||||
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
|
||||
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
|
||||
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
|
||||
</application>
|
||||
</compatibility>
|
||||
|
||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<windowsSettings>
|
||||
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
|
||||
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
</assembly>
|
||||
@@ -1,38 +0,0 @@
|
||||
#include <windows.h>
|
||||
#include <winver.h>
|
||||
|
||||
IDI_MAIN_ICON ICON "@DUSK_WINDOWS_ICON_ICO@"
|
||||
1 RT_MANIFEST "@DUSK_WINDOWS_MANIFEST@"
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,@PROJECT_VERSION_TWEAK@
|
||||
PRODUCTVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,@PROJECT_VERSION_TWEAK@
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS VS_FF_DEBUG
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS VOS_NT_WINDOWS32
|
||||
FILETYPE VFT_APP
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904B0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "@DUSK_COMPANY_NAME@\0"
|
||||
VALUE "FileDescription", "@DUSK_FILE_DESCRIPTION@\0"
|
||||
VALUE "FileVersion", "@DUSK_VERSION_STRING@\0"
|
||||
VALUE "InternalName", "dusk\0"
|
||||
VALUE "LegalCopyright", "@DUSK_COPYRIGHT@\0"
|
||||
VALUE "OriginalFilename", "dusk.exe\0"
|
||||
VALUE "ProductName", "@DUSK_PRODUCT_NAME@\0"
|
||||
VALUE "ProductVersion", "@DUSK_VERSION_STRING@\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x0409, 1200
|
||||
END
|
||||
END
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 95 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 340 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 95 KiB |
@@ -4394,34 +4394,13 @@ void daAlink_c::setSelectEquipItem(BOOL param_0) {
|
||||
if (mClothesChangeWaitTimer == 0) {
|
||||
if (checkZoraWearAbility()) {
|
||||
if (checkZoraWearMaskDraw()) {
|
||||
#if TARGET_PC
|
||||
if (field_0x06f0 != NULL)
|
||||
#endif
|
||||
{
|
||||
field_0x06f0->show();
|
||||
}
|
||||
|
||||
field_0x06f0->show();
|
||||
if (!checkEquipHeavyBoots()) {
|
||||
#if TARGET_PC
|
||||
if (field_0x06e4 != NULL)
|
||||
#endif
|
||||
{
|
||||
field_0x06e4->show();
|
||||
}
|
||||
field_0x06e4->show();
|
||||
}
|
||||
} else {
|
||||
#if TARGET_PC
|
||||
if (field_0x06f0 != NULL)
|
||||
#endif
|
||||
{
|
||||
field_0x06f0->hide();
|
||||
}
|
||||
#if TARGET_PC
|
||||
if (field_0x06e4 != NULL)
|
||||
#endif
|
||||
{
|
||||
field_0x06e4->hide();
|
||||
}
|
||||
field_0x06f0->hide();
|
||||
field_0x06e4->hide();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19527,12 +19506,7 @@ int daAlink_c::draw() {
|
||||
field_0x06e8->hide();
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
if (field_0x06f0 != NULL)
|
||||
#endif
|
||||
{
|
||||
field_0x06f0->hide();
|
||||
}
|
||||
field_0x06f0->hide();
|
||||
|
||||
#if PLATFORM_SHIELD
|
||||
if (mProcID == PROC_HOOKSHOT_WALL_SHOOT || mProcID == PROC_HOOKSHOT_SUBJECT) {
|
||||
@@ -19562,12 +19536,7 @@ int daAlink_c::draw() {
|
||||
}
|
||||
|
||||
if (!checkZoraWearMaskDraw() && checkZoraWearAbility()) {
|
||||
#if TARGET_PC
|
||||
if (field_0x06f0 != NULL)
|
||||
#endif
|
||||
{
|
||||
field_0x06f0->hide();
|
||||
}
|
||||
field_0x06f0->hide();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19576,12 +19545,7 @@ int daAlink_c::draw() {
|
||||
}
|
||||
|
||||
if (checkZoraWearMaskDraw() || !checkZoraWearAbility()) {
|
||||
#if TARGET_PC
|
||||
if (field_0x06f0 != NULL)
|
||||
#endif
|
||||
{
|
||||
field_0x06f0->show();
|
||||
}
|
||||
field_0x06f0->show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -277,11 +277,6 @@ void daOnsTaru_c::mode_init_drop() {
|
||||
cLib_offBit<u32>(attention_info.flags, fopAc_AttnFlag_CARRY_e);
|
||||
gravity = -7.0f;
|
||||
mMode = MODE_DROP_e;
|
||||
|
||||
#if TARGET_PC
|
||||
// TODO: figure out why this is needed and where exactly the UB happens
|
||||
mCcStts.ClrCcMove();
|
||||
#endif
|
||||
}
|
||||
|
||||
void daOnsTaru_c::mode_proc_drop() {
|
||||
|
||||
@@ -6,8 +6,13 @@
|
||||
#include "d/dolzel_rel.h" // IWYU pragma: keep
|
||||
|
||||
#include "d/actor/d_a_obj_smtile.h"
|
||||
#include "d/d_com_inf_game.h"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include "JSystem/J3DGraphBase/J3DDrawBuffer.h"
|
||||
#include "JSystem/JParticle/JPAResourceManager.h"
|
||||
#include "SSystem/SComponent/c_counter.h"
|
||||
#include "d/d_com_inf_game.h"
|
||||
|
||||
static u32 l_bmdData[1][2] = {
|
||||
4, 1,
|
||||
@@ -117,7 +122,117 @@ int daObj_SMTile_c::Delete() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
constexpr u32 APPLE_FRAMES = 6572;
|
||||
constexpr u32 APPLE_WIDTH = 48;
|
||||
constexpr u32 APPLE_HEIGHT = 36;
|
||||
|
||||
static constexpr f32 APPLE_TILE_SEPARATION = 100;
|
||||
static constexpr f32 APPLE_TILE_SIZE = 90;
|
||||
static const cXyz APPLE_TILE_OFFSET = cXyz(APPLE_TILE_SEPARATION, APPLE_TILE_SEPARATION, 0);
|
||||
static const cXyz APPLE_OFFSET = cXyz(-(f32)APPLE_WIDTH/2 * APPLE_TILE_SEPARATION, 0, -(f32)APPLE_HEIGHT/2 * APPLE_TILE_SEPARATION - 400);
|
||||
|
||||
static cXyz applePositions[APPLE_HEIGHT * APPLE_WIDTH];
|
||||
static u8 appleData[APPLE_HEIGHT * APPLE_WIDTH];
|
||||
|
||||
class guhPacket : public J3DPacket {
|
||||
void draw() override {
|
||||
u8 rmId = dPa_control_c::getRM_ID(0x86EC);
|
||||
JPAResourceManager* rm = dPa_control_c::mEmitterMng->getResourceManager(rmId);
|
||||
auto resource = rm->getResource(0x86EC);
|
||||
rm->load(resource->getTexIdx(0), GX_TEXMAP0);
|
||||
|
||||
GXSetTevColor(GX_TEVREG0, GXColor{0xFF,0xFF,0xFF,0xFF});
|
||||
GXSetNumChans(1);
|
||||
GXSetChanCtrl(GX_COLOR0, GX_DISABLE, GX_SRC_REG, GX_SRC_REG, GX_LIGHT_NULL, GX_DF_CLAMP, GX_AF_NONE);
|
||||
GXSetNumTexGens(1);
|
||||
GXSetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY);
|
||||
GXSetNumTevStages(1);
|
||||
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0);
|
||||
GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_C0, GX_CC_TEXC, GX_CC_ZERO);
|
||||
GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV);
|
||||
GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_A0, GX_CA_TEXA, GX_CA_ZERO);
|
||||
GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV);
|
||||
GXSetZMode(GX_ENABLE, GX_LEQUAL, GX_DISABLE);
|
||||
GXSetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_CLEAR);
|
||||
GXSetNumIndStages(0);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_F32, 0);
|
||||
GXSetCullMode(GX_CULL_NONE);
|
||||
GXClearVtxDesc();
|
||||
GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
|
||||
GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT);
|
||||
|
||||
GXLoadPosMtxImm(j3dSys.getViewMtx(), GX_PNMTX0);
|
||||
GXSetCurrentMtx(GX_PNMTX0);
|
||||
|
||||
for (u32 y = 0; y < APPLE_HEIGHT; y++) {
|
||||
for (u32 x = 0; x < APPLE_WIDTH; x++) {
|
||||
u32 idx = y * APPLE_WIDTH + x;
|
||||
if (!appleData[idx]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
cXyz pos = applePositions[idx];
|
||||
|
||||
GXBegin(GX_TRIANGLES, GX_VTXFMT0, 6);
|
||||
|
||||
GXPosition3f32(pos.x, pos.y, pos.z);
|
||||
GXTexCoord2f32(0, 0);
|
||||
GXPosition3f32(pos.x+APPLE_TILE_SIZE, pos.y, pos.z);
|
||||
GXTexCoord2f32(1, 0);
|
||||
GXPosition3f32(pos.x+APPLE_TILE_SIZE, pos.y, pos.z+APPLE_TILE_SIZE);
|
||||
GXTexCoord2f32(1, 1);
|
||||
|
||||
GXPosition3f32(pos.x, pos.y, pos.z);
|
||||
GXTexCoord2f32(0, 0);
|
||||
GXPosition3f32(pos.x+APPLE_TILE_SIZE, pos.y, pos.z+APPLE_TILE_SIZE);
|
||||
GXTexCoord2f32(1, 1);
|
||||
GXPosition3f32(pos.x, pos.y, pos.z+APPLE_TILE_SIZE);
|
||||
GXTexCoord2f32(0, 1);
|
||||
|
||||
GXEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static guhPacket guh;
|
||||
|
||||
static std::ifstream AppleData(R"(E:\Projects\dusk\apple.dat)", std::ios_base::binary | std::ios_base::in);
|
||||
|
||||
static void AppleExecute(daObj_SMTile_c* tile) {
|
||||
if (tile->bad_apple_frame == APPLE_FRAMES) {
|
||||
tile->field_0xb2a = true;
|
||||
tile->bad_apple = false;
|
||||
return;
|
||||
}
|
||||
|
||||
AppleData.read((char*)appleData, sizeof(appleData));
|
||||
|
||||
tile->bad_apple_frame += 1;
|
||||
}
|
||||
|
||||
static void AppleInit(daObj_SMTile_c* tile) {
|
||||
tile->bad_apple = true;
|
||||
JAISoundStarter::getInstance()->startSound(0x0200007d, &tile->apple_sound, nullptr);
|
||||
|
||||
for (u32 y = 0; y < APPLE_HEIGHT; y++) {
|
||||
for (u32 x = 0; x < APPLE_WIDTH; x++) {
|
||||
u32 idx = y * APPLE_WIDTH + x;
|
||||
cXyz pos = tile->current.pos + cXyz(x, 0, y) * APPLE_TILE_SEPARATION + APPLE_OFFSET;
|
||||
applePositions[idx] = pos;
|
||||
// mDoMtx_stack_c::multVec(&pos, &);
|
||||
// appleEmitters[idx] = dComIfGp_particle_set(0x86EC, &applePositions[idx], nullptr, &appleScale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int daObj_SMTile_c::Execute() {
|
||||
if (bad_apple) {
|
||||
AppleExecute(this);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (home.roomNo == dComIfGp_roomControl_getStayNo()) {
|
||||
if (field_0xb2b != 0) {
|
||||
for (int i = 0; i < 21; i++) {
|
||||
@@ -174,10 +289,11 @@ int daObj_SMTile_c::Execute() {
|
||||
|
||||
if (field_0xa7c > 240) {
|
||||
field_0xb29 = 0;
|
||||
AppleInit(this);
|
||||
} else {
|
||||
if (field_0xa7c > 220) {
|
||||
field_0xb2a = 1;
|
||||
}
|
||||
// if (field_0xa7c > 220) {
|
||||
// field_0xb2a = 1;
|
||||
// }
|
||||
f32 fVar1 = (240 - field_0xa7c) / 40.0f;
|
||||
if (1.0f < fVar1) {
|
||||
fVar1 = 1.0f;
|
||||
@@ -196,6 +312,10 @@ int daObj_SMTile_c::Execute() {
|
||||
}
|
||||
|
||||
int daObj_SMTile_c::Draw() {
|
||||
if (bad_apple) {
|
||||
j3dSys.getDrawBuffer(J3DSysDrawBuf_Xlu)->entryImm(&guh, 0);
|
||||
}
|
||||
|
||||
J3DModelData* modelData = mModel->getModelData();
|
||||
g_env_light.settingTevStruct(0, ¤t.pos, &tevStr);
|
||||
g_env_light.setLightTevColorType_MAJI(mModel, &tevStr);
|
||||
|
||||
+1
-37
@@ -20,6 +20,7 @@
|
||||
#include "m_Do/m_Do_controller_pad.h"
|
||||
#include "m_Do/m_Do_graphic.h"
|
||||
#include "m_Do/m_Do_lib.h"
|
||||
#include "dusk/frame_interpolation.h"
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
|
||||
@@ -28,11 +29,6 @@
|
||||
#include "d/d_debug_camera.h"
|
||||
#endif
|
||||
|
||||
#if TARGET_PC
|
||||
#include "dusk/frame_interpolation.h"
|
||||
#include "dusk/logging.h"
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
|
||||
static f32 limitf(f32 value, f32 min, f32 max) {
|
||||
@@ -2052,18 +2048,6 @@ s32 dCamera_c::nextType(s32 i_curType) {
|
||||
bool dCamera_c::onTypeChange(s32 i_curType, s32 i_nextType) {
|
||||
daAlink_c* unusedPlayer = daAlink_getAlinkActorClass();
|
||||
|
||||
#if TARGET_PC
|
||||
const s32 event_type_id = specialType[CAM_TYPE_EVENT];
|
||||
DuskLog.debug(
|
||||
"frameInterp: onTypeChange {} -> {} (event_type_id={}, leaving_event={}, entering_event={})",
|
||||
static_cast<int>(i_curType),
|
||||
static_cast<int>(i_nextType),
|
||||
static_cast<int>(event_type_id),
|
||||
i_curType == event_type_id,
|
||||
i_nextType == event_type_id
|
||||
);
|
||||
#endif
|
||||
|
||||
if (i_curType == specialType[CAM_TYPE_EVENT]) {
|
||||
if (mCamSetup.CheckFlag(0x4000)) {
|
||||
mGear = 0;
|
||||
@@ -10177,26 +10161,6 @@ bool dCamera_c::eventCamera(s32 param_0) {
|
||||
ActionNames[var_r29]);
|
||||
#endif
|
||||
|
||||
#if TARGET_PC
|
||||
if (dusk::getSettings().game.enableFrameInterpolation) {
|
||||
switch (var_r29) {
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 12:
|
||||
dusk::frame_interp::request_presentation_sync();
|
||||
break;
|
||||
default:
|
||||
DuskLog.debug(
|
||||
"frameInterp: presentation sync not requested for ZEV event [{}] (staff idx {})",
|
||||
static_cast<const char*>(ActionNames[var_r29]),
|
||||
static_cast<int>(mEventData.mStaffIdx)
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (getEvFloatData(&sp28, "KeepDist") != 0 && mViewCache.mDirection.R() < sp28)
|
||||
{
|
||||
mViewCache.mDirection.R(sp28);
|
||||
|
||||
+32
-24
@@ -1440,17 +1440,16 @@ void dDlst_shadowSimple_c::set(cXyz* param_0, f32 param_1, f32 param_2, cXyz* pa
|
||||
|
||||
void dDlst_shadowControl_c::init() {
|
||||
#if TARGET_PC
|
||||
mTexResScale = dusk::getSettings().game.shadowResolutionMultiplier;
|
||||
u16 resMult = dusk::getSettings().game.shadowResolutionMultiplier;
|
||||
// Increase shadow map resolution
|
||||
u16 l_realImageSize[2] =
|
||||
{
|
||||
static_cast<u16>(192 * mTexResScale),
|
||||
static_cast<u16>(64 * mTexResScale)
|
||||
static_cast<u16>(192 * resMult),
|
||||
static_cast<u16>(64 * resMult)
|
||||
};
|
||||
#else
|
||||
static u16 l_realImageSize[2] = {192, 64};
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
u16 size = l_realImageSize[i];
|
||||
|
||||
@@ -1459,13 +1458,10 @@ void dDlst_shadowControl_c::init() {
|
||||
#else
|
||||
u32 buffer_size = GXGetTexBufferSize(size, size, 5, GX_DISABLE, 0);
|
||||
#endif
|
||||
delete mShadowTexData[i];
|
||||
mShadowTexData[i] = JKR_NEW_ARRAY_ARGS(u8, buffer_size, 0x20);
|
||||
|
||||
mShadowTexObj[i].reset();
|
||||
GXInitTexObj(&mShadowTexObj[i], mShadowTexData[i], size, size, GX_TF_RGB5A3, GX_CLAMP,
|
||||
field_0x15ef0[i] = JKR_NEW_ARRAY_ARGS(u8, buffer_size, 0x20);
|
||||
GXInitTexObj(&field_0x15eb0[i], field_0x15ef0[i], size, size, GX_TF_RGB5A3, GX_CLAMP,
|
||||
GX_CLAMP, GX_DISABLE);
|
||||
GXInitTexObjLOD(&mShadowTexObj[i], GX_LINEAR, GX_LINEAR, 0.0f, 0.0f, 0.0f, GX_FALSE,
|
||||
GXInitTexObjLOD(&field_0x15eb0[i], GX_LINEAR, GX_LINEAR, 0.0f, 0.0f, 0.0f, GX_FALSE,
|
||||
GX_FALSE, GX_ANISO_1);
|
||||
}
|
||||
}
|
||||
@@ -1483,13 +1479,25 @@ void dDlst_shadowControl_c::reset() {
|
||||
mRealNum = 0;
|
||||
field_0x4 = NULL;
|
||||
|
||||
#if TARGET_PC
|
||||
if (mTexResScale != dusk::getSettings().game.shadowResolutionMultiplier)
|
||||
init();
|
||||
#ifdef TARGET_PC
|
||||
field_0x15eb0[0].reset();
|
||||
field_0x15eb0[1].reset();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
int lastShadowValue = 0;
|
||||
#endif
|
||||
|
||||
void dDlst_shadowControl_c::imageDraw(Mtx param_0) {
|
||||
#if TARGET_PC
|
||||
if (lastShadowValue != dusk::getSettings().game.shadowResolutionMultiplier) {
|
||||
reset();
|
||||
init();
|
||||
lastShadowValue = dusk::getSettings().game.shadowResolutionMultiplier;
|
||||
}
|
||||
#endif
|
||||
|
||||
static u8 l_matDL[] ATTRIBUTE_ALIGN(32) = {
|
||||
0x10, 0x00, 0x00, 0x10, 0x0E, 0x00, 0x00, 0x04, 0x00, 0x10, 0x00, 0x00, 0x10, 0x10,
|
||||
0x00, 0x00, 0x04, 0x00, 0x61, 0x28, 0x38, 0x00, 0x00, 0x61, 0xC0, 0x08, 0xFF, 0xF2,
|
||||
@@ -1522,7 +1530,7 @@ void dDlst_shadowControl_c::imageDraw(Mtx param_0) {
|
||||
j3dSys.setDrawModeOpaTexEdge();
|
||||
J3DShape::resetVcdVatCache();
|
||||
dDlst_shadowReal_c* shadowReal = field_0x4;
|
||||
int chan = 0;
|
||||
int r29 = 0;
|
||||
int tex = 0;
|
||||
u16 r27;
|
||||
u16 r26;
|
||||
@@ -1531,8 +1539,8 @@ void dDlst_shadowControl_c::imageDraw(Mtx param_0) {
|
||||
#endif
|
||||
for (; shadowReal; shadowReal = shadowReal->getZsortNext()) {
|
||||
if (shadowReal->isUse()) {
|
||||
if (chan == 0) {
|
||||
r27 = GXGetTexObjWidth(&mShadowTexObj[tex]);
|
||||
if (r29 == 0) {
|
||||
r27 = GXGetTexObjWidth(field_0x15eb0 + tex);
|
||||
r26 = r27 * 2;
|
||||
#ifdef TARGET_PC
|
||||
GXCreateFrameBuffer(r26, r26);
|
||||
@@ -1541,27 +1549,27 @@ void dDlst_shadowControl_c::imageDraw(Mtx param_0) {
|
||||
GXSetViewport(0.0f, 0.0f, r26, r26, 0.0f, 1.0f);
|
||||
GXSetScissor(0, 0, r26, r26);
|
||||
}
|
||||
GXSetTevColor(GX_TEVREG0, l_imageDrawColor[chan]);
|
||||
if (chan == 3) {
|
||||
GXSetTevColor(GX_TEVREG0, l_imageDrawColor[r29]);
|
||||
if (r29 == 3) {
|
||||
GXSetColorUpdate(GX_DISABLE);
|
||||
GXSetAlphaUpdate(GX_ENABLE);
|
||||
}
|
||||
shadowReal->imageDraw(param_0);
|
||||
chan = (chan + 1) % 4;
|
||||
if (chan == 0) {
|
||||
r29 = (r29 + 1) % 4;
|
||||
if (r29 == 0) {
|
||||
GXSetTexCopySrc(0, 0, r26, r26);
|
||||
GXSetTexCopyDst(r27, r27, GX_TF_RGB5A3, GX_TRUE);
|
||||
GXSetColorUpdate(GX_ENABLE);
|
||||
GXCopyTex(mShadowTexData[tex++], GX_TRUE);
|
||||
GXCopyTex(field_0x15ef0[tex++], GX_TRUE);
|
||||
GXPixModeSync();
|
||||
GXSetAlphaUpdate(GX_DISABLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (chan) {
|
||||
if (r29) {
|
||||
GXSetTexCopySrc(0, 0, r26, r26);
|
||||
GXSetTexCopyDst(r27, r27, GX_TF_RGB5A3, GX_TRUE);
|
||||
GXCopyTex(mShadowTexData[tex], GX_TRUE);
|
||||
GXCopyTex(field_0x15ef0[tex], GX_TRUE);
|
||||
GXPixModeSync();
|
||||
GXSetAlphaUpdate(GX_DISABLE);
|
||||
}
|
||||
@@ -1613,7 +1621,7 @@ void dDlst_shadowControl_c::draw(Mtx param_0) {
|
||||
for (int i2 = 0, i3 = 0; real != NULL; real = real->getZsortNext()) {
|
||||
if (real->isUse()) {
|
||||
if (i2 == 0) {
|
||||
TGXTexObj* obj = &mShadowTexObj[i3];
|
||||
TGXTexObj* obj = &field_0x15eb0[i3];
|
||||
i3++;
|
||||
|
||||
GXLoadTexObj(obj, GX_TEXMAP0);
|
||||
|
||||
+2
-15
@@ -48,20 +48,13 @@ public:
|
||||
GXPixModeSync();
|
||||
#if TARGET_PC
|
||||
// init mTexObj at capture time so the gpu ref survives window resizes
|
||||
mCaptureWidth = mDoGph_gInf_c::getWidth();
|
||||
mCaptureHeight = mDoGph_gInf_c::getHeight();
|
||||
GXInitTexObj(&mTexObj, mDoGph_gInf_c::getFrameBufferTex(), mCaptureWidth, mCaptureHeight,
|
||||
GXInitTexObj(&mTexObj, mDoGph_gInf_c::getFrameBufferTex(), mDoGph_gInf_c::getWidth(), mDoGph_gInf_c::getHeight(),
|
||||
(GXTexFmt)mDoGph_gInf_c::getFrameBufferTimg()->format, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||
GXInitTexObjLOD(&mTexObj, GX_LINEAR, GX_LINEAR, 0.0f, 0.0f, 0.0f, GX_FALSE, GX_FALSE, GX_ANISO_1);
|
||||
#endif
|
||||
} else {
|
||||
#if TARGET_PC
|
||||
// If the window was resized since capture, force a re-capture at the new size
|
||||
if (mCaptureWidth != (u16)mDoGph_gInf_c::getWidth() ||
|
||||
mCaptureHeight != (u16)mDoGph_gInf_c::getHeight()) {
|
||||
mFlag = 1;
|
||||
return;
|
||||
}
|
||||
// reuse the persistent mTexObj
|
||||
GXLoadTexObj(&mTexObj, GX_TEXMAP0);
|
||||
#else
|
||||
TGXTexObj tex;
|
||||
@@ -119,10 +112,6 @@ public:
|
||||
mFlag = 0;
|
||||
mAlpha = 255;
|
||||
mTopFlag = 0;
|
||||
#if TARGET_PC
|
||||
mCaptureWidth = 0;
|
||||
mCaptureHeight = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void setCaptureFlag() { mFlag = 1; }
|
||||
@@ -137,8 +126,6 @@ private:
|
||||
/* 0x5 */ u8 mAlpha;
|
||||
/* 0x6 */ u8 mTopFlag;
|
||||
#if TARGET_PC
|
||||
u16 mCaptureWidth;
|
||||
u16 mCaptureHeight;
|
||||
TGXTexObj mTexObj;
|
||||
#endif
|
||||
};
|
||||
|
||||
+1
-40
@@ -5,7 +5,6 @@
|
||||
|
||||
#include "aurora/lib/logging.hpp"
|
||||
#include "dusk/io.hpp"
|
||||
#include "dusk/settings.h"
|
||||
|
||||
#include <limits>
|
||||
#include <string>
|
||||
@@ -38,24 +37,9 @@ const ConfigImplBase* ConfigVarBase::getImpl() const noexcept {
|
||||
return impl;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static T sanitizeEnumValue(const ConfigVar<T>& cVar, T value) {
|
||||
if constexpr (std::is_enum_v<T>) {
|
||||
using Underlying = std::underlying_type_t<T>;
|
||||
const Underlying raw = static_cast<Underlying>(value);
|
||||
const Underlying min = static_cast<Underlying>(ConfigEnumRange<T>::min);
|
||||
const Underlying max = static_cast<Underlying>(ConfigEnumRange<T>::max);
|
||||
if (raw < min || raw > max) {
|
||||
return cVar.getDefaultValue();
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
template<ConfigValue T>
|
||||
void ConfigImpl<T>::loadFromJson(ConfigVar<T>& cVar, const json& jsonValue) {
|
||||
cVar.setValue(sanitizeEnumValue(cVar, jsonValue.get<T>()), false);
|
||||
cVar.setValue(jsonValue.get<T>(), false);
|
||||
}
|
||||
|
||||
template<ConfigValue T>
|
||||
@@ -101,28 +85,6 @@ static void loadFromArgImpl(ConfigVar<std::string>& cVar, const std::string_view
|
||||
cVar.setOverrideValue(std::string(stringValue));
|
||||
}
|
||||
|
||||
template<ConfigValue T> requires std::is_enum_v<T>
|
||||
static void loadFromArgImpl(ConfigVar<T>& cVar, const std::string_view stringValue) {
|
||||
using Underlying = std::underlying_type_t<T>;
|
||||
const std::string str(stringValue);
|
||||
|
||||
if constexpr (std::is_signed_v<Underlying>) {
|
||||
const auto result = std::stoll(str);
|
||||
if (result >= std::numeric_limits<Underlying>::min() && result <= std::numeric_limits<Underlying>::max()) {
|
||||
cVar.setOverrideValue(sanitizeEnumValue(cVar, static_cast<T>(result)));
|
||||
} else {
|
||||
throw std::out_of_range("Value is too large");
|
||||
}
|
||||
} else {
|
||||
const auto result = std::stoull(str);
|
||||
if (result <= std::numeric_limits<Underlying>::max()) {
|
||||
cVar.setOverrideValue(sanitizeEnumValue(cVar, static_cast<T>(result)));
|
||||
} else {
|
||||
throw std::out_of_range("Value is too large");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<ConfigValue T>
|
||||
void ConfigImpl<T>::loadFromArg(ConfigVar<T>& cVar, const std::string_view stringValue) {
|
||||
loadFromArgImpl(cVar, stringValue);
|
||||
@@ -153,7 +115,6 @@ namespace dusk::config {
|
||||
template class ConfigImpl<f32>;
|
||||
template class ConfigImpl<f64>;
|
||||
template class ConfigImpl<std::string>;
|
||||
template class ConfigImpl<dusk::BloomMode>;
|
||||
}
|
||||
|
||||
void dusk::config::Register(ConfigVarBase& configVar) {
|
||||
|
||||
@@ -1,187 +0,0 @@
|
||||
#include "dusk/crash_reporting.h"
|
||||
|
||||
#include "dusk/app_info.hpp"
|
||||
#include "dusk/dusk.h"
|
||||
#include "dusk/logging.h"
|
||||
#include "dusk/settings.h"
|
||||
#include "version.h"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <filesystem>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <system_error>
|
||||
|
||||
#include "SDL3/SDL_filesystem.h"
|
||||
|
||||
#if DUSK_ENABLE_SENTRY_NATIVE
|
||||
#include <sentry.h>
|
||||
#endif
|
||||
|
||||
namespace dusk {
|
||||
|
||||
namespace {
|
||||
|
||||
#if DUSK_ENABLE_SENTRY_NATIVE
|
||||
bool g_sentryInitialized = false;
|
||||
|
||||
bool IsTruthy(std::string_view value) {
|
||||
return value == "1" || value == "true" || value == "TRUE" || value == "yes"
|
||||
|| value == "YES" || value == "on" || value == "ON";
|
||||
}
|
||||
|
||||
std::string GetEnvOrEmpty(const char* name) {
|
||||
if (const char* value = std::getenv(name)) {
|
||||
return value;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
bool GetEffectiveEnabled() {
|
||||
const std::string env = GetEnvOrEmpty("DUSK_SENTRY_ENABLED");
|
||||
if (!env.empty()) {
|
||||
return IsTruthy(env);
|
||||
}
|
||||
return getSettings().backend.enableCrashReporting;
|
||||
}
|
||||
|
||||
std::string GetEffectiveDsn() {
|
||||
const std::string env = GetEnvOrEmpty("DUSK_SENTRY_DSN");
|
||||
if (!env.empty()) {
|
||||
return env;
|
||||
}
|
||||
return DUSK_SENTRY_DSN;
|
||||
}
|
||||
|
||||
bool GetEffectiveDebug() {
|
||||
const std::string env = GetEnvOrEmpty("DUSK_SENTRY_DEBUG");
|
||||
if (!env.empty()) {
|
||||
return IsTruthy(env);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string GetReleaseName() {
|
||||
return std::string(AppName) + "@" DUSK_WC_DESCRIBE;
|
||||
}
|
||||
|
||||
std::filesystem::path GetSentryDatabasePath() {
|
||||
return std::filesystem::path(configPath) / "sentry";
|
||||
}
|
||||
|
||||
std::filesystem::path GetLogAttachmentPath() {
|
||||
if (const char* logPath = GetLogFilePath()) {
|
||||
return logPath;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
#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 = GetLogAttachmentPath();
|
||||
if (!logPath.empty()) {
|
||||
#if _WIN32
|
||||
sentry_options_add_attachmentw(options, logPath.wstring().c_str());
|
||||
#else
|
||||
sentry_options_add_attachment(options, logPath.string().c_str());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace
|
||||
|
||||
void InitializeCrashReporting() {
|
||||
#if DUSK_ENABLE_SENTRY_NATIVE
|
||||
if (g_sentryInitialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
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 = 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, GetEffectiveDebug() ? 1 : 0);
|
||||
sentry_options_set_cache_keep(options, 1);
|
||||
sentry_options_set_max_breadcrumbs(options, 100);
|
||||
ConfigurePathOptions(options);
|
||||
|
||||
if (sentry_init(options) != 0) {
|
||||
DuskLog.warn("Failed to initialize Sentry crash reporting");
|
||||
return;
|
||||
}
|
||||
|
||||
sentry_set_tag("git_branch", DUSK_WC_BRANCH);
|
||||
sentry_set_tag("build_type", DUSK_BUILD_TYPE);
|
||||
sentry_set_tag("tp_version", DUSK_TP_VERSION);
|
||||
g_sentryInitialized = true;
|
||||
|
||||
DuskLog.info("Initialized Sentry crash reporting");
|
||||
#endif
|
||||
}
|
||||
|
||||
void ShutdownCrashReporting() {
|
||||
#if DUSK_ENABLE_SENTRY_NATIVE
|
||||
if (!g_sentryInitialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
sentry_close();
|
||||
g_sentryInitialized = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace dusk
|
||||
@@ -63,10 +63,6 @@ bool s_initialized = false;
|
||||
bool g_enabled = false;
|
||||
bool g_recording = false;
|
||||
bool g_interpolating = false;
|
||||
bool g_sync_presentation = false;
|
||||
uint32_t g_presentation_counter = 0;
|
||||
uint32_t g_presentation_sync_end = 0;
|
||||
|
||||
float g_step = 0.0f;
|
||||
uint32_t g_pending_presentation_ui_ticks = 0;
|
||||
uint32_t g_current_presentation_ui_ticks = 0;
|
||||
@@ -239,7 +235,7 @@ void interpolate_branch(const Path& old_path, const Path& new_path, float step)
|
||||
}
|
||||
|
||||
const Mtx* resolve_replacement(const Mtx* source, Mtx* scratch) {
|
||||
if (!g_interpolating || source == nullptr || dusk::frame_interp::presentation_sync_active()) {
|
||||
if (!g_interpolating || source == nullptr) {
|
||||
return source;
|
||||
}
|
||||
|
||||
@@ -272,7 +268,6 @@ void begin_record() {
|
||||
ensure_initialized();
|
||||
if (!g_enabled) {
|
||||
g_interpolating = false;
|
||||
g_sync_presentation = false;
|
||||
g_previous_recording = {};
|
||||
g_current_recording = {};
|
||||
g_current_path.clear();
|
||||
@@ -280,10 +275,6 @@ void begin_record() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_sync_presentation && g_presentation_counter > g_presentation_sync_end) {
|
||||
g_sync_presentation = false;
|
||||
}
|
||||
|
||||
g_previous_recording = std::move(g_current_recording);
|
||||
g_current_recording = {};
|
||||
g_current_path.clear();
|
||||
@@ -301,38 +292,21 @@ void interpolate(float step) {
|
||||
ensure_initialized();
|
||||
clear_replacements();
|
||||
g_step = std::clamp(step, 0.0f, 1.0f);
|
||||
g_interpolating = g_enabled && !g_recording && !g_sync_presentation && has_recording_data(g_current_recording);
|
||||
g_interpolating = g_enabled && !g_recording && has_recording_data(g_current_recording);
|
||||
if (!g_interpolating) {
|
||||
return;
|
||||
}
|
||||
const Path& old_root = has_recording_data(g_previous_recording) ? g_previous_recording.root : g_current_recording.root;
|
||||
interpolate_branch(old_root, g_current_recording.root, g_step);
|
||||
}
|
||||
|
||||
void notify_presentation_frame() {
|
||||
ensure_initialized();
|
||||
++g_presentation_counter;
|
||||
}
|
||||
|
||||
void request_presentation_sync() {
|
||||
ensure_initialized();
|
||||
if (!g_enabled) {
|
||||
if (!has_recording_data(g_previous_recording)) {
|
||||
interpolate_branch(g_current_recording.root, g_current_recording.root, g_step);
|
||||
return;
|
||||
}
|
||||
g_sync_presentation = true;
|
||||
g_presentation_sync_end = g_presentation_counter + 1;
|
||||
}
|
||||
|
||||
bool presentation_sync_active() {
|
||||
if (!s_initialized || !g_enabled) {
|
||||
return false;
|
||||
}
|
||||
return g_sync_presentation;
|
||||
interpolate_branch(g_previous_recording.root, g_current_recording.root, g_step);
|
||||
}
|
||||
|
||||
float get_interpolation_step() {
|
||||
ensure_initialized();
|
||||
return presentation_sync_active() ? 1.0f : g_step;
|
||||
return g_step;
|
||||
}
|
||||
|
||||
void notify_sim_tick_complete() {
|
||||
@@ -397,7 +371,7 @@ void record_final_mtx_raw(const Mtx* dest, const Mtx src) {
|
||||
}
|
||||
|
||||
bool lookup_replacement(const void* source, Mtx out) {
|
||||
if (presentation_sync_active() || !g_interpolating || source == nullptr) {
|
||||
if (!s_initialized || !g_interpolating || source == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -411,7 +385,7 @@ bool lookup_replacement(const void* source, Mtx out) {
|
||||
}
|
||||
|
||||
bool lookup_concat_replacement(const void* lhs, const void* rhs, Mtx out) {
|
||||
if (presentation_sync_active() || !g_interpolating || lhs == nullptr || rhs == nullptr) {
|
||||
if (!s_initialized || !g_interpolating || lhs == nullptr || rhs == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -419,7 +393,9 @@ bool lookup_concat_replacement(const void* lhs, const void* rhs, Mtx out) {
|
||||
Mtx rhs_scratch;
|
||||
const Mtx* resolved_lhs = resolve_replacement(reinterpret_cast<const Mtx*>(lhs), &lhs_scratch);
|
||||
const Mtx* resolved_rhs = resolve_replacement(reinterpret_cast<const Mtx*>(rhs), &rhs_scratch);
|
||||
if (resolved_lhs == reinterpret_cast<const Mtx*>(lhs) && resolved_rhs == reinterpret_cast<const Mtx*>(rhs)) {
|
||||
if (resolved_lhs == reinterpret_cast<const Mtx*>(lhs) &&
|
||||
resolved_rhs == reinterpret_cast<const Mtx*>(rhs))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -269,7 +269,6 @@ namespace dusk {
|
||||
m_menuTools.ShowAudioDebug();
|
||||
m_menuTools.ShowSaveEditor();
|
||||
}
|
||||
m_menuTools.ShowStateShare();
|
||||
DuskDebugPad(); // temporary, remove later
|
||||
|
||||
// Only show cursor when menu or any windows are open
|
||||
|
||||
@@ -47,15 +47,4 @@ void DuskDebugPad() {
|
||||
pad.mMainStickValue = 1.0f;
|
||||
pad.mMainStickAngle = -0x4000;
|
||||
}
|
||||
|
||||
if (ImGui::IsKeyDown(ImGuiKey_Q)) {
|
||||
pad.mTriggerLeft = 1.0;
|
||||
pad.mTrigLockL = 1;
|
||||
pad.mHoldLockL = 1;
|
||||
}
|
||||
if (ImGui::IsKeyDown(ImGuiKey_E)) {
|
||||
pad.mTriggerRight = 1.0;
|
||||
pad.mTrigLockR = 1;
|
||||
pad.mHoldLockR = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,22 +29,13 @@ bool AssetExists(const std::string& path) {
|
||||
SDL_PathInfo pathInfo{};
|
||||
return SDL_GetPathInfo(path.c_str(), &pathInfo) && pathInfo.type == SDL_PATHTYPE_FILE;
|
||||
}
|
||||
|
||||
ImTextureID AddTexture(const char* assetName) {
|
||||
auto image = GetImage(GetAssetPath(assetName));
|
||||
if (image.data == nullptr || image.width == 0 || image.height == 0) {
|
||||
return 0;
|
||||
}
|
||||
return aurora_imgui_add_texture(image.width, image.height, image.data.get());
|
||||
}
|
||||
} // namespace
|
||||
|
||||
ImFont* ImGuiEngine::fontNormal;
|
||||
ImFont* ImGuiEngine::fontLarge;
|
||||
ImFont* ImGuiEngine::fontExtraLarge;
|
||||
ImFont* ImGuiEngine::fontMono;
|
||||
ImTextureID ImGuiEngine::orgIcon = 0;
|
||||
ImTextureID ImGuiEngine::duskLogo = 0;
|
||||
ImTextureID ImGuiEngine::duskIcon = 0;
|
||||
|
||||
inline ImFont* CreateFont(float size, const std::string& fontPath, std::string_view fontName) {
|
||||
bool fontFileExists = !fontPath.empty() && AssetExists(fontPath);
|
||||
@@ -158,7 +149,6 @@ void ImGuiEngine_Initialize(float scale) {
|
||||
|
||||
Image GetImage(const std::string& path) {
|
||||
if (!AssetExists(path)) {
|
||||
DuskLog.warn("Image '{}' does not exist", path);
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -197,11 +187,13 @@ Image GetImage(const std::string& path) {
|
||||
}
|
||||
|
||||
void ImGuiEngine_AddTextures() {
|
||||
if (ImGuiEngine::orgIcon == 0) {
|
||||
ImGuiEngine::orgIcon = AddTexture("org-icon.png");
|
||||
}
|
||||
if (ImGuiEngine::duskLogo == 0) {
|
||||
ImGuiEngine::duskLogo = AddTexture("logo.png");
|
||||
if (ImGuiEngine::duskIcon == 0) {
|
||||
auto icon = GetImage(GetAssetPath("icon.png"));
|
||||
if (icon.data == nullptr || icon.width == 0 || icon.height == 0) {
|
||||
ImGuiEngine::duskIcon = 0;
|
||||
return;
|
||||
}
|
||||
ImGuiEngine::duskIcon = aurora_imgui_add_texture(icon.width, icon.height, icon.data.get());
|
||||
}
|
||||
}
|
||||
} // namespace dusk
|
||||
|
||||
@@ -11,8 +11,7 @@ public:
|
||||
static ImFont* fontLarge;
|
||||
static ImFont* fontExtraLarge;
|
||||
static ImFont* fontMono;
|
||||
static ImTextureID orgIcon;
|
||||
static ImTextureID duskLogo;
|
||||
static ImTextureID duskIcon;
|
||||
};
|
||||
|
||||
void ImGuiEngine_Initialize(float scale);
|
||||
@@ -24,5 +23,5 @@ struct Image {
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
};
|
||||
Image GetImage(const std::string& path);
|
||||
Image GetImage(std::string_view path);
|
||||
} // namespace dusk
|
||||
|
||||
@@ -12,13 +12,11 @@ namespace dusk {
|
||||
static void ApplyPresetClassic() {
|
||||
auto& s = getSettings();
|
||||
s.video.lockAspectRatio.setValue(true);
|
||||
s.game.bloomMode.setValue(BloomMode::Classic);
|
||||
VILockAspectRatio(defaultAspectRatioW, defaultAspectRatioH);
|
||||
}
|
||||
|
||||
static void ApplyPresetHD() {
|
||||
auto& s = getSettings();
|
||||
s.game.bloomMode.setValue(BloomMode::Classic);
|
||||
s.game.hideTvSettingsScreen.setValue(true);
|
||||
s.game.skipWarningScreen.setValue(true);
|
||||
s.game.noReturnRupees.setValue(true);
|
||||
@@ -39,7 +37,6 @@ static void ApplyPresetDusk() {
|
||||
s.game.instantSaves.setValue(true);
|
||||
s.game.midnasLamentNonStop.setValue(true);
|
||||
s.game.enableFrameInterpolation.setValue(true);
|
||||
s.game.bloomMode.setValue(BloomMode::Dusk);
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
|
||||
@@ -62,30 +62,7 @@ namespace dusk {
|
||||
config::Save();
|
||||
}
|
||||
|
||||
constexpr const char* bloomModeNames[] = {"Off", "Classic", "Dusk"};
|
||||
int bloomMode = static_cast<int>(getSettings().game.bloomMode.getValue());
|
||||
if (ImGui::BeginCombo("Bloom", bloomModeNames[bloomMode])) {
|
||||
for (int i = 0; i < IM_ARRAYSIZE(bloomModeNames); i++) {
|
||||
const bool selected = bloomMode == i;
|
||||
if (ImGui::Selectable(bloomModeNames[i], selected)) {
|
||||
getSettings().game.bloomMode.setValue(static_cast<BloomMode>(i));
|
||||
config::Save();
|
||||
}
|
||||
if (selected) {
|
||||
ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
|
||||
bool bloomOff = bloomMode == static_cast<int>(BloomMode::Off);
|
||||
if (bloomOff) ImGui::BeginDisabled();
|
||||
float mult = getSettings().game.bloomMultiplier.getValue();
|
||||
if (ImGui::SliderFloat("Bloom Brightness", &mult, 0.0f, 1.0f, "%.2f")) {
|
||||
getSettings().game.bloomMultiplier.setValue(mult);
|
||||
config::Save();
|
||||
}
|
||||
if (bloomOff) ImGui::EndDisabled();
|
||||
config::ImGuiCheckbox("Native Bloom", getSettings().game.enableBloom);
|
||||
|
||||
config::ImGuiCheckbox("Enable Water Refraction", getSettings().game.enableWaterRefraction);
|
||||
|
||||
@@ -133,9 +110,6 @@ namespace dusk {
|
||||
if (ImGui::BeginMenu("Interface")) {
|
||||
config::ImGuiCheckbox("Skip Pre-Launch UI", getSettings().backend.skipPreLaunchUI);
|
||||
config::ImGuiCheckbox("Show Pipeline Compilation", getSettings().backend.showPipelineCompilation);
|
||||
#if DUSK_ENABLE_SENTRY_NATIVE
|
||||
config::ImGuiCheckbox("Enable Crash Reporting", getSettings().backend.enableCrashReporting);
|
||||
#endif
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
@@ -53,7 +53,6 @@ namespace dusk {
|
||||
ImGui::MenuItem("Map Loader", nullptr, &m_showMapLoader);
|
||||
ImGui::MenuItem("Player Info", nullptr, &m_showPlayerInfo);
|
||||
ImGui::MenuItem("Save Editor", nullptr, &m_showSaveEditor);
|
||||
ImGui::MenuItem("State Share", hotkeys::SHOW_STATE_SHARE, &m_showStateShare);
|
||||
ImGui::MenuItem("Audio Debug", hotkeys::SHOW_AUDIO_DEBUG, &m_showAudioDebug);
|
||||
|
||||
if (!dusk::IsGameLaunched) {
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
#include "imgui.h"
|
||||
#include "ImGuiSaveEditor.hpp"
|
||||
#include "ImGuiStateShare.hpp"
|
||||
|
||||
namespace dusk {
|
||||
class ImGuiMenuTools {
|
||||
@@ -24,7 +23,6 @@ namespace dusk {
|
||||
void ShowPlayerInfo();
|
||||
void ShowAudioDebug();
|
||||
void ShowSaveEditor();
|
||||
void ShowStateShare();
|
||||
|
||||
private:
|
||||
bool m_showDebugOverlay = false;
|
||||
@@ -59,9 +57,6 @@ namespace dusk {
|
||||
|
||||
bool m_showSaveEditor = false;
|
||||
ImGuiSaveEditor m_saveEditor;
|
||||
|
||||
bool m_showStateShare = false;
|
||||
ImGuiStateShare m_stateShare;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -80,20 +80,12 @@ void ImGuiPreLaunchWindow::draw() {
|
||||
|
||||
float iconSize = 150.f;
|
||||
ImGui::SameLine(windowSize.x / 2 - iconSize + (iconSize / 2));
|
||||
if (ImGuiEngine::orgIcon != 0) {
|
||||
ImGui::Image(ImGuiEngine::orgIcon, ImVec2{iconSize, iconSize});
|
||||
}
|
||||
if (ImGuiEngine::duskIcon != 0)
|
||||
ImGui::Image(ImGuiEngine::duskIcon, ImVec2{iconSize, iconSize});
|
||||
ImGuiTextCenter("Twilit Realm presents");
|
||||
if (ImGuiEngine::duskLogo) {
|
||||
ImGui::NewLine();
|
||||
float width = iconSize * 2.5f;
|
||||
ImGui::SameLine(windowSize.x / 2 - width + (width / 2));
|
||||
ImGui::Image(ImGuiEngine::duskLogo, ImVec2{width, iconSize});
|
||||
} else {
|
||||
ImGui::PushFont(ImGuiEngine::fontExtraLarge);
|
||||
ImGuiTextCenter("Dusk");
|
||||
ImGui::PopFont();
|
||||
}
|
||||
ImGui::PushFont(ImGuiEngine::fontExtraLarge);
|
||||
ImGuiTextCenter("Dusk");
|
||||
ImGui::PopFont();
|
||||
|
||||
(this->*drawTable[m_CurMenu])();
|
||||
|
||||
|
||||
@@ -1,133 +0,0 @@
|
||||
#include "ImGuiStateShare.hpp"
|
||||
#include "ImGuiMenuTools.hpp"
|
||||
#include "ImGuiConsole.hpp"
|
||||
|
||||
#include "imgui.h"
|
||||
#include "fmt/format.h"
|
||||
#include "absl/strings/escaping.h"
|
||||
|
||||
#include "d/d_com_inf_game.h"
|
||||
#include "dusk/main.h"
|
||||
|
||||
#include <zstd.h>
|
||||
|
||||
namespace dusk {
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct StateSharePacket {
|
||||
char stageName[8];
|
||||
int8_t roomNo;
|
||||
int8_t layer;
|
||||
int16_t startPoint;
|
||||
// followed by raw dSv_info_c bytes
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
static constexpr size_t PACKET_TOTAL = sizeof(StateSharePacket) + sizeof(dSv_info_c);
|
||||
|
||||
void ImGuiStateShare::copyState() {
|
||||
StateSharePacket pkt = {};
|
||||
strncpy(pkt.stageName, dComIfGp_getStartStageName(), 7);
|
||||
pkt.roomNo = dComIfGp_getStartStageRoomNo();
|
||||
pkt.layer = dComIfGp_getStartStageLayer();
|
||||
pkt.startPoint = dComIfGp_getStartStagePoint();
|
||||
|
||||
std::string raw(PACKET_TOTAL, '\0');
|
||||
memcpy(raw.data(), &pkt, sizeof(pkt));
|
||||
memcpy(raw.data() + sizeof(pkt), &g_dComIfG_gameInfo.info, sizeof(dSv_info_c));
|
||||
|
||||
size_t bound = ZSTD_compressBound(raw.size());
|
||||
std::string compressed(bound, '\0');
|
||||
compressed.resize(ZSTD_compress(compressed.data(), bound, raw.data(), raw.size(), 1));
|
||||
|
||||
std::string encoded = absl::Base64Escape(compressed);
|
||||
ImGui::SetClipboardText(encoded.c_str());
|
||||
m_statusMsg = "Copied to clipboard.";
|
||||
}
|
||||
|
||||
bool ImGuiStateShare::pasteState() {
|
||||
const char* clip = ImGui::GetClipboardText();
|
||||
if (!clip || clip[0] == '\0') {
|
||||
m_statusMsg = "Clipboard is empty.";
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string decoded;
|
||||
if (!absl::Base64Unescape(clip, &decoded)) {
|
||||
m_statusMsg = "Invalid base64.";
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned long long dSize = ZSTD_getFrameContentSize(decoded.data(), decoded.size());
|
||||
if (dSize == ZSTD_CONTENTSIZE_ERROR || dSize == ZSTD_CONTENTSIZE_UNKNOWN || dSize < PACKET_TOTAL) {
|
||||
m_statusMsg = "Not a valid state string.";
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string raw(static_cast<size_t>(dSize), '\0');
|
||||
size_t result = ZSTD_decompress(raw.data(), raw.size(), decoded.data(), decoded.size());
|
||||
if (ZSTD_isError(result)) {
|
||||
m_statusMsg = fmt::format("Decompression failed: {}", ZSTD_getErrorName(result));
|
||||
return false;
|
||||
}
|
||||
|
||||
StateSharePacket pkt;
|
||||
memcpy(&pkt, raw.data(), sizeof(pkt));
|
||||
pkt.stageName[7] = '\0';
|
||||
|
||||
memcpy(&g_dComIfG_gameInfo.info, raw.data() + sizeof(pkt), sizeof(dSv_info_c));
|
||||
|
||||
s16 spawnPoint = pkt.startPoint == -4 ? -1 : pkt.startPoint;
|
||||
|
||||
if (spawnPoint == -1) {
|
||||
dComIfGs_setRestartRoomParam(pkt.roomNo & 0x3F);
|
||||
}
|
||||
|
||||
dComIfGp_setNextStage(pkt.stageName, spawnPoint, pkt.roomNo, pkt.layer);
|
||||
m_pendingInfo = g_dComIfG_gameInfo.info;
|
||||
|
||||
m_statusMsg = fmt::format("Warping to {} room {} layer {}.", pkt.stageName, (int)pkt.roomNo, (int)pkt.layer);
|
||||
return true;
|
||||
}
|
||||
|
||||
void ImGuiStateShare::tickPendingApply() {
|
||||
if (!m_pendingInfo.has_value() || dComIfGp_isEnableNextStage())
|
||||
return;
|
||||
g_dComIfG_gameInfo.info = *m_pendingInfo;
|
||||
m_pendingInfo.reset();
|
||||
}
|
||||
|
||||
void ImGuiStateShare::draw(bool& open) {
|
||||
if (dusk::IsGameLaunched)
|
||||
tickPendingApply();
|
||||
|
||||
if (!open)
|
||||
return;
|
||||
|
||||
if (!ImGui::Begin("State Share", &open, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav)) {
|
||||
ImGui::End();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!dusk::IsGameLaunched) ImGui::BeginDisabled();
|
||||
if (ImGui::Button("Copy State")) copyState();
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Import State")) pasteState();
|
||||
if (!dusk::IsGameLaunched) ImGui::EndDisabled();
|
||||
|
||||
if (!m_statusMsg.empty()) {
|
||||
ImGui::Spacing();
|
||||
ImGui::Separator();
|
||||
ImGui::TextWrapped("%s", m_statusMsg.c_str());
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void ImGuiMenuTools::ShowStateShare() {
|
||||
if (!ImGuiConsole::CheckMenuViewToggle(ImGuiKey_F8, m_showStateShare))
|
||||
return;
|
||||
m_stateShare.draw(m_showStateShare);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
#ifndef DUSK_IMGUI_STATESHARE_HPP
|
||||
#define DUSK_IMGUI_STATESHARE_HPP
|
||||
|
||||
#include "d/d_save.h"
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
namespace dusk {
|
||||
class ImGuiStateShare {
|
||||
public:
|
||||
void draw(bool& open);
|
||||
|
||||
private:
|
||||
void copyState();
|
||||
bool pasteState();
|
||||
void tickPendingApply();
|
||||
|
||||
std::string m_statusMsg;
|
||||
std::optional<dSv_info_c> m_pendingInfo;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+22
-118
@@ -1,11 +1,6 @@
|
||||
#include "dusk/logging.h"
|
||||
#include <array>
|
||||
#include <chrono>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <filesystem>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
|
||||
#include "tracy/Tracy.hpp"
|
||||
|
||||
@@ -25,60 +20,6 @@ static constexpr std::string_view StubFragments[] = {
|
||||
"but selective updates are not implemented"sv,
|
||||
};
|
||||
|
||||
namespace {
|
||||
std::mutex g_logMutex;
|
||||
FILE* g_logFile = nullptr;
|
||||
std::string g_logFilePath;
|
||||
|
||||
const char* LogLevelString(AuroraLogLevel level) {
|
||||
switch (level) {
|
||||
case LOG_DEBUG:
|
||||
return "DEBUG";
|
||||
case LOG_INFO:
|
||||
return "INFO";
|
||||
case LOG_WARNING:
|
||||
return "WARNING";
|
||||
case LOG_ERROR:
|
||||
return "ERROR";
|
||||
case LOG_FATAL:
|
||||
return "FATAL";
|
||||
}
|
||||
|
||||
return "??";
|
||||
}
|
||||
|
||||
FILE* LogStreamForLevel(AuroraLogLevel level) {
|
||||
return level >= LOG_ERROR ? stderr : stdout;
|
||||
}
|
||||
|
||||
std::string MakeTimestampedLogName() {
|
||||
const auto now = std::chrono::system_clock::now();
|
||||
const std::time_t nowTime = std::chrono::system_clock::to_time_t(now);
|
||||
|
||||
std::tm localTime{};
|
||||
#if _WIN32
|
||||
localtime_s(&localTime, &nowTime);
|
||||
#else
|
||||
localtime_r(&nowTime, &localTime);
|
||||
#endif
|
||||
|
||||
std::array<char, 32> buffer{};
|
||||
std::strftime(buffer.data(), buffer.size(), "dusk-%Y%m%d-%H%M%S.log", &localTime);
|
||||
return buffer.data();
|
||||
}
|
||||
|
||||
void WriteLogLine(FILE* out, const char* levelStr, const char* module, const char* message, unsigned int len) {
|
||||
if (out == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::fprintf(out, "[%s | %s] ", levelStr, module);
|
||||
std::fwrite(message, 1, len, out);
|
||||
std::fputc('\n', out);
|
||||
std::fflush(out);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
static bool IsForStubLog(const char* message) {
|
||||
std::string_view msg_view(message);
|
||||
|
||||
@@ -99,69 +40,32 @@ void aurora_log_callback(AuroraLogLevel level, const char* module, const char* m
|
||||
return;
|
||||
}
|
||||
|
||||
if (module == nullptr) {
|
||||
module = "";
|
||||
const char* levelStr = "??";
|
||||
FILE* out = stdout;
|
||||
switch (level) {
|
||||
case LOG_DEBUG:
|
||||
levelStr = "DEBUG";
|
||||
break;
|
||||
case LOG_INFO:
|
||||
levelStr = "INFO";
|
||||
break;
|
||||
case LOG_WARNING:
|
||||
levelStr = "WARNING";
|
||||
break;
|
||||
case LOG_ERROR:
|
||||
levelStr = "ERROR";
|
||||
out = stderr;
|
||||
break;
|
||||
case LOG_FATAL:
|
||||
levelStr = "FATAL";
|
||||
out = stderr;
|
||||
break;
|
||||
}
|
||||
|
||||
const char* levelStr = LogLevelString(level);
|
||||
FILE* out = LogStreamForLevel(level);
|
||||
WriteLogLine(out, levelStr, module, message, len);
|
||||
|
||||
{
|
||||
std::lock_guard lock(g_logMutex);
|
||||
if (g_logFile != nullptr) {
|
||||
WriteLogLine(g_logFile, levelStr, module, message, len);
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(out, "[%s | %s] %s\n", levelStr, module, message);
|
||||
if (level == LOG_FATAL) {
|
||||
fflush(out);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
aurora::Module DuskLog("dusk");
|
||||
|
||||
void dusk::InitializeFileLogging(const char* configDir, AuroraLogLevel logLevel) {
|
||||
std::lock_guard lock(g_logMutex);
|
||||
if (g_logFile != nullptr || configDir == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::error_code ec;
|
||||
const std::filesystem::path logsDir = std::filesystem::path(configDir) / "logs";
|
||||
std::filesystem::create_directories(logsDir, ec);
|
||||
if (ec) {
|
||||
std::fprintf(stderr, "[WARNING | dusk] Failed to create log directory '%s': %s\n",
|
||||
logsDir.string().c_str(), ec.message().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
const std::filesystem::path logPath = logsDir / MakeTimestampedLogName();
|
||||
g_logFile = std::fopen(logPath.string().c_str(), "wb");
|
||||
if (g_logFile == nullptr) {
|
||||
std::fprintf(stderr, "[WARNING | dusk] Failed to open log file '%s'\n",
|
||||
logPath.string().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
g_logFilePath = logPath.string();
|
||||
aurora::g_config.logCallback = &aurora_log_callback;
|
||||
aurora::g_config.logLevel = logLevel;
|
||||
WriteLogLine(g_logFile, "INFO", "dusk", "File logging initialized", 24);
|
||||
}
|
||||
|
||||
void dusk::ShutdownFileLogging() {
|
||||
std::lock_guard lock(g_logMutex);
|
||||
if (g_logFile == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::fflush(g_logFile);
|
||||
std::fclose(g_logFile);
|
||||
g_logFile = nullptr;
|
||||
}
|
||||
|
||||
const char* dusk::GetLogFilePath() {
|
||||
std::lock_guard lock(g_logMutex);
|
||||
return g_logFilePath.empty() ? nullptr : g_logFilePath.c_str();
|
||||
}
|
||||
|
||||
+11
-111
@@ -1,126 +1,26 @@
|
||||
#if _WIN32
|
||||
#define WINDOWS_LEAN_AND_MEAN
|
||||
#include <Windows.h>
|
||||
#include <shellapi.h>
|
||||
#endif
|
||||
|
||||
#include <aurora/main.h>
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
int game_main(int argc, char* argv[]);
|
||||
|
||||
namespace {
|
||||
|
||||
#if _WIN32
|
||||
bool ShouldShowWindowsConsole(int argc, char* argv[]) {
|
||||
if (const auto* env = std::getenv("DUSK_CONSOLE")) {
|
||||
if (env[0] != '\0' && env[0] != '0') {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
if (std::string_view(argv[i]) == "--console") {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void SetupWindowsConsoleStreams() {
|
||||
FILE* stream = nullptr;
|
||||
freopen_s(&stream, "CONIN$", "r", stdin);
|
||||
freopen_s(&stream, "CONOUT$", "w", stdout);
|
||||
freopen_s(&stream, "CONOUT$", "w", stderr);
|
||||
}
|
||||
|
||||
void WindowsSetupConsole(bool showConsole) {
|
||||
if (!showConsole) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!AttachConsole(ATTACH_PARENT_PROCESS)) {
|
||||
AllocConsole();
|
||||
}
|
||||
|
||||
SetupWindowsConsoleStreams();
|
||||
SetConsoleOutputCP(CP_UTF8);
|
||||
|
||||
if (const HANDLE stdoutHandle = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
stdoutHandle != INVALID_HANDLE_VALUE && stdoutHandle != nullptr) {
|
||||
DWORD consoleMode = 0;
|
||||
if (GetConsoleMode(stdoutHandle, &consoleMode)) {
|
||||
SetConsoleMode(stdoutHandle,
|
||||
consoleMode | ENABLE_PROCESSED_OUTPUT
|
||||
| ENABLE_VIRTUAL_TERMINAL_PROCESSING);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int DuskMain(int argc, char* argv[]) {
|
||||
WindowsSetupConsole(ShouldShowWindowsConsole(argc, argv));
|
||||
return game_main(argc, argv);
|
||||
}
|
||||
|
||||
std::vector<std::string> WideArgsToUtf8(int argc, wchar_t** argv) {
|
||||
std::vector<std::string> utf8Args;
|
||||
utf8Args.reserve(argc);
|
||||
|
||||
for (int i = 0; i < argc; ++i) {
|
||||
const int requiredSize =
|
||||
WideCharToMultiByte(CP_UTF8, 0, argv[i], -1, nullptr, 0, nullptr, nullptr);
|
||||
if (requiredSize <= 0) {
|
||||
utf8Args.emplace_back();
|
||||
continue;
|
||||
}
|
||||
|
||||
std::vector<char> utf8Buffer(static_cast<size_t>(requiredSize));
|
||||
WideCharToMultiByte(CP_UTF8, 0, argv[i], -1, utf8Buffer.data(), requiredSize, nullptr,
|
||||
nullptr);
|
||||
utf8Args.emplace_back(utf8Buffer.data());
|
||||
}
|
||||
|
||||
return utf8Args;
|
||||
}
|
||||
|
||||
int RunWindowsGuiEntryPoint() {
|
||||
int argc = 0;
|
||||
wchar_t** wideArgv = CommandLineToArgvW(GetCommandLineW(), &argc);
|
||||
if (wideArgv == nullptr) {
|
||||
return DuskMain(__argc, __argv);
|
||||
}
|
||||
|
||||
std::vector<std::string> utf8Args = WideArgsToUtf8(argc, wideArgv);
|
||||
LocalFree(wideArgv);
|
||||
|
||||
std::vector<char*> argv;
|
||||
argv.reserve(utf8Args.size());
|
||||
for (auto& arg : utf8Args) {
|
||||
argv.push_back(arg.data());
|
||||
}
|
||||
|
||||
return DuskMain(argc, argv.data());
|
||||
}
|
||||
#else
|
||||
int DuskMain(int argc, char* argv[]) {
|
||||
return game_main(argc, argv);
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace
|
||||
void WindowsSetupConsole();
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
return DuskMain(argc, argv);
|
||||
WindowsSetupConsole();
|
||||
return game_main(argc, argv);
|
||||
}
|
||||
|
||||
void WindowsSetupConsole() {
|
||||
#if _WIN32
|
||||
int WINAPI wWinMain(HINSTANCE, HINSTANCE, PWSTR, int) {
|
||||
return RunWindowsGuiEntryPoint();
|
||||
}
|
||||
SetConsoleOutputCP(CP_UTF8);
|
||||
|
||||
auto stdout = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
DWORD consoleMode;
|
||||
GetConsoleMode(stdout, &consoleMode);
|
||||
SetConsoleMode(stdout, consoleMode | ENABLE_PROCESSED_OUTPUT | ENABLE_VIRTUAL_TERMINAL_PROCESSING);
|
||||
#endif
|
||||
}
|
||||
@@ -41,8 +41,7 @@ UserSettings g_userSettings = {
|
||||
.invertCameraXAxis {"game.invertCameraXAxis", false},
|
||||
|
||||
// Graphics
|
||||
.bloomMode {"game.bloomMode", BloomMode::Classic},
|
||||
.bloomMultiplier {"game.bloomMultiplier", 1.0f},
|
||||
.enableBloom {"game.enableBloom", true},
|
||||
.enableWaterRefraction {"game.enableWaterRefraction", true},
|
||||
.enableFrameInterpolation = {"game.enableFrameInterpolation", false},
|
||||
.shadowResolutionMultiplier {"game.shadowResolutionMultiplier", 1},
|
||||
@@ -76,8 +75,7 @@ UserSettings g_userSettings = {
|
||||
.graphicsBackend {"backend.graphicsBackend", "auto"},
|
||||
.skipPreLaunchUI {"backend.skipPreLaunchUI", false},
|
||||
.showPipelineCompilation {"backend.showPipelineCompilation", false},
|
||||
.wasPresetChosen {"backend.wasPresetChosen", false},
|
||||
.enableCrashReporting {"backend.enableCrashReporting", true}
|
||||
.wasPresetChosen {"backend.wasPresetChosen", false}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -115,8 +113,7 @@ void registerSettings() {
|
||||
Register(g_userSettings.game.instantSaves);
|
||||
Register(g_userSettings.game.enableMirrorMode);
|
||||
Register(g_userSettings.game.invertCameraXAxis);
|
||||
Register(g_userSettings.game.bloomMode);
|
||||
Register(g_userSettings.game.bloomMultiplier);
|
||||
Register(g_userSettings.game.enableBloom);
|
||||
Register(g_userSettings.game.enableWaterRefraction);
|
||||
Register(g_userSettings.game.shadowResolutionMultiplier);
|
||||
Register(g_userSettings.game.enableFastIronBoots);
|
||||
@@ -140,7 +137,6 @@ void registerSettings() {
|
||||
Register(g_userSettings.backend.skipPreLaunchUI);
|
||||
Register(g_userSettings.backend.showPipelineCompilation);
|
||||
Register(g_userSettings.backend.wasPresetChosen);
|
||||
Register(g_userSettings.backend.enableCrashReporting);
|
||||
}
|
||||
|
||||
// Transient settings
|
||||
|
||||
+41
-68
@@ -1259,7 +1259,7 @@ void mDoGph_gInf_c::bloom_c::remove() {
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
static void CopyToTexObj(GXTexObj* pDst, uintptr_t texID, u16 dstWidth, u16 dstHeight, GXTexFmt dstFmt = GX_TF_RGBA8) {
|
||||
static void CopyToTexObj(GXTexObj* pDst, uintptr_t texID, int dstWidth, int dstHeight, GXTexFmt dstFmt = GX_TF_RGBA8) {
|
||||
GXSetTexCopyDst(dstWidth, dstHeight, dstFmt, FALSE);
|
||||
GXCopyTex((void*)texID, false);
|
||||
GXInitTexObj(pDst, (void*)texID, dstWidth, dstHeight, dstFmt, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||
@@ -1311,58 +1311,35 @@ void mDoGph_gInf_c::bloom_c::draw2() {
|
||||
BlurPass0, BlurPassN = BlurPass0 + MaxDivNum,
|
||||
MaxTexNum,
|
||||
};
|
||||
struct {
|
||||
u16 x;
|
||||
u16 y;
|
||||
u16 w;
|
||||
u16 h;
|
||||
} divRects[MaxDivNum];
|
||||
divRects[0] = {
|
||||
0,
|
||||
0,
|
||||
static_cast<u16>(width),
|
||||
static_cast<u16>(height),
|
||||
};
|
||||
divRects[1] = {
|
||||
0,
|
||||
0,
|
||||
static_cast<u16>(divRects[0].w / 2),
|
||||
static_cast<u16>(divRects[0].h / 2),
|
||||
};
|
||||
divRects[2] = {
|
||||
divRects[1].w,
|
||||
0,
|
||||
static_cast<u16>(divRects[1].w / 2),
|
||||
static_cast<u16>(divRects[1].h / 2),
|
||||
};
|
||||
for (int i = 3; i < ARRAY_SIZE(divRects); i++) {
|
||||
const auto& prev = divRects[i - 1];
|
||||
divRects[i] = {
|
||||
prev.x,
|
||||
static_cast<u16>(prev.y + prev.h),
|
||||
static_cast<u16>(prev.w / 2),
|
||||
static_cast<u16>(prev.h / 2),
|
||||
};
|
||||
scissor_class divPorts[MaxDivNum];
|
||||
divPorts[0] = {0.0f, 0.0f, 1.0f, 1.0f}; // full-size texture
|
||||
divPorts[1] = {0.0f, 0.0f, 0.5f, 0.5f}; // bloom texture (wide enough, half-tall)
|
||||
divPorts[2] = {0.5f, 0.0f, 0.25f, 0.25f};
|
||||
for (int i = 3; i < ARRAY_SIZE(divPorts); i++) {
|
||||
auto& port = divPorts[i];
|
||||
auto const& prev = divPorts[i - 1];
|
||||
port.x_orig = prev.x_orig;
|
||||
port.y_orig = prev.y_orig + prev.height;
|
||||
port.width = prev.width * 0.5f;
|
||||
port.height = prev.height * 0.5f;
|
||||
}
|
||||
|
||||
auto divCopySrc = [&](int divNo) {
|
||||
auto const& rect = divRects[divNo];
|
||||
GXSetTexCopySrc(rect.x, rect.y, rect.w, rect.h);
|
||||
auto const& port = divPorts[divNo];
|
||||
GXSetTexCopySrc(port.x_orig * width, port.y_orig * height, port.width * width, port.height * height);
|
||||
};
|
||||
|
||||
TGXTexObj tmpTex[MaxTexNum];
|
||||
auto divCopyTex = [&](uintptr_t texNo, int divNo) -> GXTexObj * {
|
||||
auto const& rect = divRects[divNo];
|
||||
CopyToTexObj(&tmpTex[texNo], texNo, rect.w, rect.h);
|
||||
auto const& port = divPorts[divNo];
|
||||
CopyToTexObj(&tmpTex[texNo], texNo, port.width * width, port.height * height);
|
||||
return &tmpTex[texNo];
|
||||
};
|
||||
|
||||
auto divQuad = [&](int divNo) {
|
||||
auto const& rect = divRects[divNo];
|
||||
f32 x0 = rect.x / width;
|
||||
f32 y0 = rect.y / height;
|
||||
f32 x1 = (rect.x + rect.w) / width;
|
||||
f32 y1 = (rect.y + rect.h) / height;
|
||||
auto const& port = divPorts[divNo];
|
||||
f32 x0 = port.x_orig, y0 = port.y_orig;
|
||||
f32 x1 = x0 + port.width, y1 = y0 + port.height;
|
||||
GXBegin(GX_QUADS, GX_VTXFMT0, 4);
|
||||
GXPosition3f32(x0, y0, -5);
|
||||
GXTexCoord2s8(0, 0);
|
||||
@@ -1432,16 +1409,18 @@ void mDoGph_gInf_c::bloom_c::draw2() {
|
||||
// Setup blur filter TEV.
|
||||
GXSetNumTexGens(8);
|
||||
|
||||
auto SetupBlurMtx = [](float scale) {
|
||||
u32 texMtxID = GX_TEXMTX0;
|
||||
int angle = 0;
|
||||
for (int texCoord = (int)GX_TEXCOORD0; texCoord < (int)GX_MAX_TEXCOORD; texCoord++) {
|
||||
GXSetTexCoordGen((GXTexCoordID)texCoord, GX_TG_MTX2x4, GX_TG_TEX0, texMtxID);
|
||||
mDoMtx_stack_c::transS((blurScale * cM_scos(angle)) * getInvScale(),
|
||||
blurScale * cM_ssin(angle), 0.0f);
|
||||
mDoMtx_stack_c::transS((scale * cM_scos(angle)) * getInvScale(),
|
||||
scale * cM_ssin(angle), 0.0f);
|
||||
GXLoadTexMtxImm(mDoMtx_stack_c::get(), texMtxID, GX_MTX2x4);
|
||||
texMtxID += 3;
|
||||
angle += 0x2000;
|
||||
}
|
||||
};
|
||||
|
||||
GXSetNumTevStages(8);
|
||||
for (int stage = 0; stage < 8; stage++) {
|
||||
@@ -1454,20 +1433,19 @@ void mDoGph_gInf_c::bloom_c::draw2() {
|
||||
}
|
||||
|
||||
// Successively downsample and apply blurs.
|
||||
static int divStart = 2;
|
||||
static int divNum = 6; // inclusive
|
||||
int divStart = 2;
|
||||
int divNum = 6;
|
||||
|
||||
// The original mBlureRatio is multiplied into each sample, of which there are 8 samples originally.
|
||||
// This is applied over two passes, the second one with an alpha of 25%; however, the clipping that this introduces is a bit integral to the look,
|
||||
// so we do the same thing, letting it clip.
|
||||
float brightnessF32 = (mBlureRatio * 16 / 255.0f);
|
||||
|
||||
// Distribute the brightness through the total number of passes.
|
||||
f32 totalNumPasses = (divNum - divStart + 1);
|
||||
// Distribute the brightness through each pass.
|
||||
int totalNumPasses = (divNum - divStart) * 2; // down, up
|
||||
float brightnessF32 = (mBlureRatio / 255.0f);
|
||||
float brightnessPerPass = 255.0f * powf(brightnessF32, 1.0f / totalNumPasses);
|
||||
GXSetTevColorS10(GX_TEVREG1, {0, 0, 0, s16(brightnessPerPass / 8)});
|
||||
|
||||
for (int i = divStart; i < divNum; i++) {
|
||||
float blurStrength = 1.0f + (i - divStart) * 5.0f;
|
||||
SetupBlurMtx(blurScale * blurStrength);
|
||||
|
||||
// Apply blur filter.
|
||||
divQuad(i);
|
||||
|
||||
@@ -1479,18 +1457,16 @@ void mDoGph_gInf_c::bloom_c::draw2() {
|
||||
GXLoadTexObj(blurTex, GX_TEXMAP0);
|
||||
}
|
||||
|
||||
// All the way down at the bottom.
|
||||
// All the way down at the bottom. Instead of blurring the bottom layer by itself, we blur when going up to the next layer.
|
||||
// The remaining upscales are all just normal alpha blending.
|
||||
divQuad(divNum);
|
||||
|
||||
// Now successively alpha blend back up, don't blur anymore.
|
||||
GXSetNumTevStages(1);
|
||||
GXSetTevColorS10(GX_TEVREG1, {0, 0, 0, s16(255)});
|
||||
GXSetTevColorS10(GX_TEVREG1, {0, 0, 0, s16(brightnessPerPass)});
|
||||
GXSetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY);
|
||||
GXSetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_ONE, GX_LO_OR);
|
||||
GXSetBlendMode(GX_BM_BLEND, GX_BL_ONE, GX_BL_ONE, GX_LO_OR);
|
||||
for (int i = divNum; i > divStart; i--) {
|
||||
float alpha = 255.0f * powf(0.25f * dusk::getSettings().game.bloomMultiplier.getValue(), 1.0f / (divNum - i + 1));
|
||||
GXSetTevColorS10(GX_TEVREG0, {0, 0, 0, s16(alpha)});
|
||||
|
||||
divCopySrc(i);
|
||||
GXTexObj* upTex = divCopyTex(BlurPass0 + i, i);
|
||||
GXLoadTexObj(upTex, GX_TEXMAP0);
|
||||
@@ -1524,11 +1500,13 @@ void mDoGph_gInf_c::bloom_c::draw2() {
|
||||
|
||||
void mDoGph_gInf_c::bloom_c::draw() {
|
||||
ZoneScoped;
|
||||
if (dusk::getSettings().game.bloomMode.getValue() == dusk::BloomMode::Dusk) {
|
||||
draw2();
|
||||
if (!dusk::getSettings().game.enableBloom) {
|
||||
return;
|
||||
}
|
||||
if (dusk::getSettings().game.bloomMode.getValue() != dusk::BloomMode::Classic) {
|
||||
|
||||
static bool s_bloom2 = false;
|
||||
if (s_bloom2) {
|
||||
draw2();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1620,12 +1598,7 @@ void mDoGph_gInf_c::bloom_c::draw() {
|
||||
GXSetTevAlphaOp(GX_TEVSTAGE2, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE,
|
||||
GX_TEVPREV);
|
||||
GXSetBlendMode(GX_BM_NONE, GX_BL_ZERO, GX_BL_ZERO, GX_LO_OR);
|
||||
#if TARGET_PC
|
||||
s16 bloomAlpha = s16(0x40 * dusk::getSettings().game.bloomMultiplier.getValue());
|
||||
#else
|
||||
s16 bloomAlpha = 0x40;
|
||||
#endif
|
||||
GXColorS10 tevColor0 = {(s16)-mPoint, (s16)-mPoint, (s16)-mPoint, bloomAlpha};
|
||||
GXColorS10 tevColor0 = {(s16)-mPoint, (s16)-mPoint, (s16)-mPoint, 0x40};
|
||||
GXSetTevColorS10(GX_TEVREG0, tevColor0);
|
||||
GXColor tevColor1 = {mBlureRatio, mBlureRatio, mBlureRatio, mBlureRatio};
|
||||
GXSetTevColor(GX_TEVREG1, tevColor1);
|
||||
|
||||
+1
-56
@@ -43,12 +43,9 @@
|
||||
#include <cstring>
|
||||
|
||||
#include <chrono>
|
||||
#include <filesystem>
|
||||
#include <system_error>
|
||||
#include <thread>
|
||||
#include "SSystem/SComponent/c_API.h"
|
||||
#include "dusk/app_info.hpp"
|
||||
#include "dusk/crash_reporting.h"
|
||||
#include "dusk/dusk.h"
|
||||
#include "dusk/frame_interpolation.h"
|
||||
#include "dusk/gyro_aim.h"
|
||||
@@ -243,8 +240,6 @@ void main01(void) {
|
||||
}
|
||||
|
||||
if (dusk::getSettings().game.enableFrameInterpolation) {
|
||||
dusk::frame_interp::notify_presentation_frame();
|
||||
|
||||
while (accumulator >= kSimStepSeconds) {
|
||||
mDoCPd_c::read();
|
||||
if (dusk::getSettings().game.enableGyroAim) {
|
||||
@@ -368,48 +363,6 @@ static const char* CalculateConfigPath() {
|
||||
return result;
|
||||
}
|
||||
|
||||
static void EnsureInitialPipelineCache(const char* configDir) {
|
||||
if (configDir == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
const std::filesystem::path configPathFs(configDir);
|
||||
const std::filesystem::path pipelineCachePath = configPathFs / "pipeline_cache.db";
|
||||
if (std::filesystem::exists(pipelineCachePath)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const char* basePath = SDL_GetBasePath();
|
||||
if (basePath == nullptr) {
|
||||
DuskLog.warn("Unable to resolve base path while seeding pipeline cache: {}", SDL_GetError());
|
||||
return;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
std::error_code ec;
|
||||
std::filesystem::create_directories(configPathFs, ec);
|
||||
if (ec) {
|
||||
DuskLog.warn("Failed to create config directory '{}' for pipeline cache: {}",
|
||||
configPathFs.string(), ec.message());
|
||||
return;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
DuskLog.info("Seeded pipeline cache from '{}'", initialPipelineCachePath.string());
|
||||
}
|
||||
|
||||
static constexpr PADDefaultMapping defaultPadMapping = {
|
||||
.buttons = {
|
||||
{SDL_GAMEPAD_BUTTON_SOUTH, PAD_BUTTON_A},
|
||||
@@ -465,7 +418,6 @@ int game_main(int argc, char* argv[]) {
|
||||
arg_options.add_options()
|
||||
("l,log-level", "Log level from " + std::to_string(AuroraLogLevel::LOG_DEBUG) + " to " + std::to_string(AuroraLogLevel::LOG_FATAL), cxxopts::value<uint8_t>()->default_value("0"))
|
||||
("h,help", "Print usage")
|
||||
("console", "Show the Windows console window for logs", cxxopts::value<bool>()->default_value("false")->implicit_value("true"))
|
||||
("dvd", "Path to DVD image file", cxxopts::value<std::string>())
|
||||
("backend", "Graphics API backend to use (auto, d3d12, metal, vulkan, null)", cxxopts::value<std::string>())
|
||||
("cvar", "Override configuration variables without modifying config", cxxopts::value<std::vector<std::string>>());
|
||||
@@ -488,13 +440,9 @@ int game_main(int argc, char* argv[]) {
|
||||
}
|
||||
|
||||
configPath = CalculateConfigPath();
|
||||
const auto startupLogLevel = static_cast<AuroraLogLevel>(parsed_arg_options["log-level"].as<uint8_t>());
|
||||
dusk::InitializeFileLogging(configPath, startupLogLevel);
|
||||
|
||||
dusk::config::LoadFromUserPreferences();
|
||||
ApplyCVarOverrides(parsed_arg_options["cvar"]);
|
||||
dusk::InitializeCrashReporting();
|
||||
EnsureInitialPipelineCache(configPath);
|
||||
|
||||
AuroraConfig config{};
|
||||
config.appName = dusk::AppName;
|
||||
@@ -507,7 +455,7 @@ int game_main(int argc, char* argv[]) {
|
||||
config.windowHeight = defaultWindowHeight * 2;
|
||||
config.desiredBackend = ResolveDesiredBackend(parsed_arg_options);
|
||||
config.logCallback = &aurora_log_callback;
|
||||
config.logLevel = startupLogLevel;
|
||||
config.logLevel = (AuroraLogLevel)parsed_arg_options["log-level"].as<uint8_t>();
|
||||
config.mem1Size = 256 * 1024 * 1024;
|
||||
config.mem2Size = 24 * 1024 * 1024;
|
||||
config.allowJoystickBackgroundEvents = true;
|
||||
@@ -550,7 +498,6 @@ int game_main(int argc, char* argv[]) {
|
||||
if (!dvd_opened) {
|
||||
// pre game launch ui main loop
|
||||
if (!launchUILoop()) {
|
||||
dusk::ShutdownCrashReporting();
|
||||
aurora_shutdown();
|
||||
return 0;
|
||||
}
|
||||
@@ -588,8 +535,6 @@ int game_main(int argc, char* argv[]) {
|
||||
|
||||
main01();
|
||||
|
||||
dusk::ShutdownCrashReporting();
|
||||
dusk::ShutdownFileLogging();
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
|
||||
|
||||
+3
-9
@@ -10,17 +10,11 @@
|
||||
#define DUSK_BUILD_TYPE "@CMAKE_BUILD_TYPE@"
|
||||
|
||||
#if defined(__x86_64__) || defined(_M_AMD64)
|
||||
#define DUSK_ARCH "x86_64"
|
||||
#define DUSK_DLPACKAGE "dusk-@DUSK_WC_DESCRIBE@-@PLATFORM_NAME@-x86_64"
|
||||
#elif defined(__i386__) || defined(_M_IX86)
|
||||
#define DUSK_ARCH "x86"
|
||||
#define DUSK_DLPACKAGE "dusk-@DUSK_WC_DESCRIBE@-@PLATFORM_NAME@-x86"
|
||||
#elif defined(__aarch64__) || defined(_M_ARM64)
|
||||
#define DUSK_ARCH "arm64"
|
||||
#define DUSK_DLPACKAGE "dusk-@DUSK_WC_DESCRIBE@-@PLATFORM_NAME@-arm64"
|
||||
#endif
|
||||
|
||||
#define DUSK_PLATFORM_NAME "@PLATFORM_NAME@"
|
||||
#define DUSK_DLPACKAGE "dusk-@DUSK_WC_DESCRIBE@-" DUSK_PLATFORM_NAME "-" DUSK_ARCH
|
||||
|
||||
#define DUSK_SENTRY_DSN "@DUSK_SENTRY_DSN@"
|
||||
#define DUSK_SENTRY_ENVIRONMENT "@DUSK_SENTRY_ENVIRONMENT@"
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user