mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-07-04 11:19:58 -04:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1520205403 | |||
| d2d7459d05 | |||
| c71272af05 |
+1
-1
@@ -2,7 +2,7 @@
|
||||
Language: Cpp
|
||||
Standard: C++03
|
||||
AccessModifierOffset: -4
|
||||
AlignAfterOpenBracket: DontAlign
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignConsecutiveDeclarations: false
|
||||
AlignOperands: true
|
||||
|
||||
+37
-101
@@ -7,12 +7,8 @@ on:
|
||||
- '*LICENSE'
|
||||
pull_request:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || format('run-{0}', github.run_id) }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
env:
|
||||
SCCACHE_GHA_ENABLED: "true"
|
||||
# SCCACHE_GHA_ENABLED: "true"
|
||||
RUSTC_WRAPPER: "sccache"
|
||||
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
|
||||
|
||||
@@ -26,13 +22,13 @@ jobs:
|
||||
matrix:
|
||||
include:
|
||||
- name: GCC x86_64
|
||||
runner: ubuntu-24.04
|
||||
runner: [self-hosted, Linux]
|
||||
preset: gcc
|
||||
artifact_arch: x86_64
|
||||
- name: GCC aarch64
|
||||
runner: ubuntu-24.04-arm
|
||||
preset: gcc
|
||||
artifact_arch: aarch64
|
||||
# - name: GCC aarch64
|
||||
# runner: ubuntu-24.04-arm
|
||||
# preset: gcc
|
||||
# artifact_arch: aarch64
|
||||
# - name: Clang x86_64
|
||||
# runner: ubuntu-latest
|
||||
# preset: clang
|
||||
@@ -45,6 +41,7 @@ jobs:
|
||||
submodules: recursive
|
||||
|
||||
- name: Install dependencies
|
||||
if: 'false' # disabled for self-hosted
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get -y install ninja-build clang lld openssl libcurl4-openssl-dev \
|
||||
@@ -54,7 +51,8 @@ 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
|
||||
if: 'false' # disabled for self-hosted
|
||||
uses: mozilla-actions/sccache-action@v0.0.9
|
||||
|
||||
- name: Print sccache stats
|
||||
run: sccache --show-stats
|
||||
@@ -69,16 +67,17 @@ jobs:
|
||||
run: ci/build-appimage.sh
|
||||
|
||||
- name: Upload artifacts
|
||||
if: startsWith(github.event.ref, 'refs/tags/v')
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: dusklight-${{env.DUSK_VERSION}}-linux-${{matrix.preset}}-${{matrix.artifact_arch}}
|
||||
name: dusk-${{env.DUSK_VERSION}}-linux-${{matrix.preset}}-${{matrix.artifact_arch}}
|
||||
path: |
|
||||
build/install/Dusklight-*.AppImage
|
||||
build/install/Dusk-*.AppImage
|
||||
build/install/debug.tar.*
|
||||
|
||||
build-apple:
|
||||
name: Build Apple (${{matrix.name}})
|
||||
runs-on: macos-latest
|
||||
runs-on: [self-hosted, macOS]
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -87,14 +86,14 @@ jobs:
|
||||
platform: macos
|
||||
preset: x-macos-ci-arm64
|
||||
artifact_name: macos-appleclang-arm64
|
||||
- name: AppleClang macOS x86_64
|
||||
platform: macos
|
||||
preset: x-macos-ci-x86_64
|
||||
artifact_name: macos-appleclang-x86_64
|
||||
- name: AppleClang iOS arm64
|
||||
platform: ios
|
||||
preset: x-ios-ci
|
||||
artifact_name: ios-appleclang-arm64
|
||||
# - name: AppleClang macOS x86_64
|
||||
# platform: macos
|
||||
# preset: x-macos-ci-x86_64
|
||||
# artifact_name: macos-appleclang-x86_64
|
||||
# - name: AppleClang iOS arm64
|
||||
# platform: ios
|
||||
# preset: x-ios-ci
|
||||
# artifact_name: ios-appleclang-arm64
|
||||
# - name: AppleClang tvOS arm64
|
||||
# platform: tvos
|
||||
# preset: x-tvos-ci
|
||||
@@ -107,6 +106,7 @@ jobs:
|
||||
submodules: recursive
|
||||
|
||||
- name: Install dependencies
|
||||
if: 'false'
|
||||
run: brew install cmake ninja
|
||||
|
||||
- name: Install Rust iOS target
|
||||
@@ -128,7 +128,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}}
|
||||
@@ -137,80 +137,14 @@ jobs:
|
||||
run: cmake --build --preset ${{matrix.preset}}
|
||||
|
||||
- name: Upload artifacts
|
||||
if: startsWith(github.event.ref, 'refs/tags/v')
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: dusklight-${{env.DUSK_VERSION}}-${{matrix.artifact_name}}
|
||||
name: dusk-${{env.DUSK_VERSION}}-${{matrix.artifact_name}}
|
||||
path: |
|
||||
build/install/Dusklight.app
|
||||
build/install/Dusk.app
|
||||
build/install/debug.tar.*
|
||||
|
||||
build-android:
|
||||
name: Build Android (${{matrix.name}})
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- name: Clang arm64-v8a
|
||||
preset: x-android-ci-arm64
|
||||
abi: arm64-v8a
|
||||
artifact_arch: arm64
|
||||
rust_target: aarch64-linux-android
|
||||
|
||||
env:
|
||||
ANDROID_NDK_VERSION: "29.0.14206865"
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get -y install ninja-build
|
||||
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: 17
|
||||
|
||||
- name: Setup Android SDK
|
||||
uses: android-actions/setup-android@v4
|
||||
|
||||
- name: Install Android SDK packages
|
||||
run: sdkmanager "platforms;android-36" "build-tools;36.1.0" "ndk;${ANDROID_NDK_VERSION}"
|
||||
|
||||
- name: Install Rust Android target
|
||||
run: |
|
||||
rustup toolchain install stable
|
||||
rustup target add ${{matrix.rust_target}}
|
||||
|
||||
- name: Setup sccache
|
||||
uses: mozilla-actions/sccache-action@v0.0.10
|
||||
|
||||
- name: Configure CMake
|
||||
run: cmake --preset ${{matrix.preset}}
|
||||
|
||||
- name: Build native library
|
||||
run: cmake --build --preset ${{matrix.preset}} --target dusklight
|
||||
|
||||
- name: Stage stripped JNI library
|
||||
run: ANDROID_STAGE_ABIS="${{matrix.abi}}" platforms/android/scripts/stage-jni-libs.sh
|
||||
|
||||
- name: Build APK
|
||||
working-directory: platforms/android
|
||||
run: ./gradlew :app:assembleRelease --rerun-tasks
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: dusklight-${{env.DUSK_VERSION}}-android-${{matrix.artifact_arch}}
|
||||
path: platforms/android/app/build/outputs/apk/release/app-${{matrix.abi}}-release-unsigned.apk
|
||||
|
||||
build-windows:
|
||||
name: Build Windows (${{matrix.name}})
|
||||
runs-on: ${{matrix.runner}}
|
||||
@@ -220,17 +154,17 @@ jobs:
|
||||
matrix:
|
||||
include:
|
||||
- name: MSVC x86_64
|
||||
runner: windows-latest
|
||||
runner: [self-hosted, Windows]
|
||||
preset: msvc
|
||||
msvc_arch: amd64
|
||||
vcpkg_arch: x64
|
||||
artifact_arch: x86_64
|
||||
- name: MSVC arm64
|
||||
runner: windows-latest
|
||||
preset: arm64-msvc
|
||||
msvc_arch: amd64_arm64
|
||||
vcpkg_arch: arm64
|
||||
artifact_arch: arm64
|
||||
# - name: MSVC arm64
|
||||
# runner: windows-11-arm
|
||||
# preset: arm64-msvc
|
||||
# msvc_arch: arm64
|
||||
# vcpkg_arch: arm64
|
||||
# artifact_arch: arm64
|
||||
# - name: Clang x86_64
|
||||
# runner: windows-latest
|
||||
# preset: clang
|
||||
@@ -257,9 +191,10 @@ jobs:
|
||||
uses: mozilla-actions/sccache-action@v0.0.9
|
||||
|
||||
- name: Install dependencies
|
||||
if: 'false' # disabled for self-hosted
|
||||
run: |
|
||||
choco install ninja
|
||||
vcpkg install freetype:${{matrix.vcpkg_arch}}-windows zstd:${{matrix.vcpkg_arch}}-windows
|
||||
vcpkg install freetype:${{matrix.vcpkg_arch}}-windows-static zstd:${{matrix.vcpkg_arch}}-windows-static
|
||||
|
||||
- name: Configure CMake
|
||||
run: cmake --preset x-windows-ci-${{matrix.preset}}
|
||||
@@ -268,9 +203,10 @@ jobs:
|
||||
run: cmake --build --preset x-windows-ci-${{matrix.preset}}
|
||||
|
||||
- name: Upload artifacts
|
||||
if: startsWith(github.event.ref, 'refs/tags/v')
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: dusklight-${{env.DUSK_VERSION}}-win32-msvc-${{matrix.artifact_arch}}
|
||||
name: dusk-${{env.DUSK_VERSION}}-win32-msvc-${{matrix.artifact_arch}}
|
||||
path: |
|
||||
build/install/*.exe
|
||||
build/install/*.dll
|
||||
|
||||
@@ -41,10 +41,6 @@ compile_commands.json
|
||||
# MacOS
|
||||
.DS_Store
|
||||
|
||||
# direnv / nix
|
||||
.direnv/
|
||||
.envrc
|
||||
|
||||
# ISOs
|
||||
*.iso
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -2,7 +2,7 @@
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "(gdb) Launch Dusklight MSVC",
|
||||
"name": "(gdb) Launch Dusk MSVC",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${command:cmake.launchTargetPath}",
|
||||
|
||||
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"cmake.buildDirectory": "${workspaceFolder}/build/dusklight/${buildType}/${variant:tp_version}",
|
||||
"cmake.buildDirectory": "${workspaceFolder}/build/dusk/${buildType}/${variant:tp_version}",
|
||||
"cmake.generator": "Ninja",
|
||||
"cmake.configureSettings": {
|
||||
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
|
||||
|
||||
+108
-168
@@ -5,20 +5,8 @@ if (NOT CMAKE_BUILD_TYPE)
|
||||
"Build type options: Debug Release RelWithDebInfo MinSizeRel" FORCE)
|
||||
endif ()
|
||||
|
||||
set(DUSK_VERSION_OVERRIDE "" CACHE STRING "Override version string (skips git detection and format validation)")
|
||||
|
||||
if (DUSK_VERSION_OVERRIDE)
|
||||
set(DUSK_WC_DESCRIBE "${DUSK_VERSION_OVERRIDE}")
|
||||
set(DUSK_VERSION_STRING "0.0.0.0")
|
||||
set(DUSK_SHORT_VERSION_STRING "0.0.0")
|
||||
set(DUSK_VERSION_CODE "1")
|
||||
set(DUSK_WC_REVISION "")
|
||||
set(DUSK_WC_BRANCH "")
|
||||
set(DUSK_WC_DATE "")
|
||||
message(STATUS "Dusklight version overridden to ${DUSK_WC_DESCRIBE}")
|
||||
else ()
|
||||
# obtain revision info from git
|
||||
find_package(Git)
|
||||
# obtain revision info from git
|
||||
find_package(Git)
|
||||
if (GIT_FOUND)
|
||||
# make sure version information gets re-run when the current Git HEAD changes
|
||||
execute_process(WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse --git-path HEAD
|
||||
@@ -60,48 +48,29 @@ 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]+)([-+].*)?$")
|
||||
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}")
|
||||
set(_ver_major ${CMAKE_MATCH_1})
|
||||
set(_ver_minor ${CMAKE_MATCH_2})
|
||||
set(_ver_patch ${CMAKE_MATCH_3})
|
||||
set(DUSK_VERSION_TWEAK "0")
|
||||
if (DUSK_WC_DESCRIBE MATCHES "^v[0-9]+\\.[0-9]+\\.[0-9]+-([0-9]+)(-dirty)?$")
|
||||
set(DUSK_VERSION_TWEAK "${CMAKE_MATCH_1}")
|
||||
elseif (DUSK_WC_DESCRIBE MATCHES "^v[0-9]+\\.[0-9]+\\.[0-9]+-[0-9A-Za-z.-]+-([0-9]+)(-dirty)?$")
|
||||
set(DUSK_VERSION_TWEAK "${CMAKE_MATCH_1}")
|
||||
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 ()
|
||||
set(DUSK_VERSION_STRING "${DUSK_SHORT_VERSION_STRING}.${DUSK_VERSION_TWEAK}")
|
||||
if(DUSK_VERSION_TWEAK GREATER 999)
|
||||
set(_tweak 999)
|
||||
else()
|
||||
set(_tweak ${DUSK_VERSION_TWEAK})
|
||||
endif()
|
||||
# encoding: major*1e7 + minor*1e5 + patch*1e3 + tweak; collision-free for major<210, minor<100, patch<100, tweak<=999
|
||||
math(EXPR DUSK_VERSION_CODE
|
||||
"${_ver_major} * 10000000 + ${_ver_minor} * 100000 + ${_ver_patch} * 1000 + ${_tweak}")
|
||||
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_CODE "1")
|
||||
endif ()
|
||||
|
||||
endif ()
|
||||
|
||||
# Add version information to CI environment variables
|
||||
if(DEFINED ENV{GITHUB_ENV})
|
||||
file(APPEND "$ENV{GITHUB_ENV}" "DUSK_VERSION=${DUSK_WC_DESCRIBE}\n")
|
||||
file(APPEND "$ENV{GITHUB_ENV}" "DUSK_VERSION_CODE=${DUSK_VERSION_CODE}\n")
|
||||
endif()
|
||||
message(STATUS "Dusklight version set to ${DUSK_WC_DESCRIBE}")
|
||||
message(STATUS "Dusk version set to ${DUSK_WC_DESCRIBE}")
|
||||
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
|
||||
project(dusklight LANGUAGES C CXX VERSION ${DUSK_VERSION_STRING})
|
||||
project(dusk LANGUAGES C CXX VERSION ${DUSK_VERSION_STRING})
|
||||
if (APPLE)
|
||||
enable_language(OBJC OBJCXX)
|
||||
enable_language(OBJC)
|
||||
endif ()
|
||||
# Adjust CMAKE_SYSTEM_PROCESSOR on Windows to match compiler target
|
||||
include(cmake/WindowsTargetProcessor.cmake)
|
||||
if (APPLE AND NOT TVOS AND CMAKE_SYSTEM_NAME STREQUAL tvOS)
|
||||
# ios.toolchain.cmake hack for SDL
|
||||
set(TVOS ON)
|
||||
@@ -131,36 +100,32 @@ if (CMAKE_SYSTEM_NAME STREQUAL Linux)
|
||||
endif ()
|
||||
set(AURORA_ENABLE_DVD ON CACHE BOOL "Enable DVD API support" FORCE)
|
||||
set(AURORA_ENABLE_CARD ON CACHE BOOL "Enable CARD API support" FORCE)
|
||||
set(AURORA_ENABLE_RMLUI ON CACHE BOOL "Enable RmlUi UI support" FORCE)
|
||||
add_subdirectory(extern/aurora EXCLUDE_FROM_ALL)
|
||||
target_compile_definitions(aurora_mtx PRIVATE MTX_USE_PS=1)
|
||||
|
||||
add_subdirectory(libs/freeverb)
|
||||
|
||||
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_UPDATE_CHECKER "Enable update checking support" ON)
|
||||
|
||||
if(ANDROID)
|
||||
set(DUSK_MOVIE_SUPPORT OFF)
|
||||
set(NOD_COMPRESS_BZIP2 OFF CACHE BOOL "" FORCE)
|
||||
set(NOD_COMPRESS_LZMA OFF CACHE BOOL "" FORCE)
|
||||
set(NOD_COMPRESS_ZLIB OFF CACHE BOOL "" FORCE)
|
||||
set(NOD_COMPRESS_ZSTD OFF CACHE BOOL "" FORCE)
|
||||
endif ()
|
||||
|
||||
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")
|
||||
|
||||
# Edit & Continue
|
||||
if (MSVC)
|
||||
if ("${CMAKE_MSVC_DEBUG_INFORMATION_FORMAT}" STREQUAL "" AND CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "EditAndContinue")
|
||||
endif ()
|
||||
if (CMAKE_MSVC_DEBUG_INFORMATION_FORMAT STREQUAL "EditAndContinue")
|
||||
add_link_options("/INCREMENTAL")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (DUSK_MOVIE_SUPPORT)
|
||||
find_package(libjpeg-turbo 3.0 CONFIG QUIET)
|
||||
if (libjpeg-turbo_FOUND)
|
||||
message(STATUS "dusklight: Using system libjpeg-turbo")
|
||||
message(STATUS "dusk: Using system libjpeg-turbo")
|
||||
else ()
|
||||
message(STATUS "dusklight: Fetching libjpeg-turbo")
|
||||
message(STATUS "dusk: Fetching libjpeg-turbo")
|
||||
include(ExternalProject)
|
||||
set(_jpeg_install_dir ${CMAKE_BINARY_DIR}/libjpeg-turbo-install)
|
||||
if (WIN32)
|
||||
@@ -170,7 +135,6 @@ if (DUSK_MOVIE_SUPPORT)
|
||||
endif ()
|
||||
set(_jpeg_cmake_args
|
||||
-DCMAKE_INSTALL_PREFIX=${_jpeg_install_dir}
|
||||
-DCMAKE_PROJECT_INCLUDE=${CMAKE_CURRENT_SOURCE_DIR}/cmake/WindowsTargetProcessor.cmake
|
||||
-DENABLE_SHARED=OFF
|
||||
-DWITH_TURBOJPEG=ON
|
||||
-DWITH_JAVA=OFF
|
||||
@@ -180,14 +144,11 @@ if (DUSK_MOVIE_SUPPORT)
|
||||
list(APPEND _jpeg_cmake_args -DCMAKE_TOOLCHAIN_FILE=${_jpeg_toolchain_file})
|
||||
endif ()
|
||||
set(_jpeg_passthrough_vars
|
||||
ANDROID_ABI
|
||||
ANDROID_PLATFORM
|
||||
CMAKE_BUILD_TYPE
|
||||
CMAKE_C_COMPILER
|
||||
CMAKE_C_COMPILER_LAUNCHER
|
||||
CMAKE_MAKE_PROGRAM
|
||||
CMAKE_MSVC_RUNTIME_LIBRARY
|
||||
CMAKE_MSVC_DEBUG_INFORMATION_FORMAT
|
||||
CMAKE_OSX_ARCHITECTURES
|
||||
DEPLOYMENT_TARGET
|
||||
ENABLE_ARC
|
||||
@@ -253,13 +214,13 @@ endif ()
|
||||
include(FetchContent)
|
||||
|
||||
# Declare all dependencies first so CMake can download them in parallel
|
||||
message(STATUS "dusklight: Fetching cxxopts")
|
||||
message(STATUS "dusk: Fetching cxxopts")
|
||||
FetchContent_Declare(cxxopts
|
||||
URL https://github.com/jarro2783/cxxopts/archive/refs/tags/v3.3.1.tar.gz
|
||||
URL_HASH SHA256=3bfc70542c521d4b55a46429d808178916a579b28d048bd8c727ee76c39e2072
|
||||
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
|
||||
)
|
||||
message(STATUS "dusklight: Fetching nlohmann/json")
|
||||
message(STATUS "dusk: Fetching nlohmann/json")
|
||||
FetchContent_Declare(json
|
||||
URL https://github.com/nlohmann/json/releases/download/v3.12.0/json.tar.xz
|
||||
URL_HASH SHA256=42f6e95cad6ec532fd372391373363b62a14af6d771056dbfc86160e6dfff7aa
|
||||
@@ -268,7 +229,7 @@ FetchContent_Declare(json
|
||||
FetchContent_MakeAvailable(cxxopts json)
|
||||
|
||||
if (DUSK_ENABLE_SENTRY_NATIVE)
|
||||
message(STATUS "dusklight: Fetching 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)
|
||||
@@ -293,12 +254,6 @@ if (DUSK_ENABLE_SENTRY_NATIVE)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# Use signed char on ARM to match the original game (and x86)
|
||||
string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" _arch)
|
||||
if(_arch MATCHES "^(arm|aarch64)" AND CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "GNU")
|
||||
add_compile_options(-fsigned-char)
|
||||
endif()
|
||||
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL Windows)
|
||||
set(PLATFORM_NAME win32)
|
||||
elseif (CMAKE_SYSTEM_NAME STREQUAL Darwin)
|
||||
@@ -319,17 +274,17 @@ include(files.cmake)
|
||||
|
||||
# TODO: version handling for res includes
|
||||
|
||||
set(DUSK_BUNDLE_NAME Dusklight)
|
||||
set(DUSK_BUNDLE_NAME Dusk)
|
||||
set(DUSK_BUNDLE_IDENTIFIER dev.twilitrealm.dusk)
|
||||
set(DUSK_COMPANY_NAME "Twilit Realm")
|
||||
set(DUSK_FILE_DESCRIPTION "Dusklight")
|
||||
set(DUSK_PRODUCT_NAME "Dusklight")
|
||||
set(DUSK_FILE_DESCRIPTION "Dusk")
|
||||
set(DUSK_PRODUCT_NAME "Dusk")
|
||||
set(DUSK_COPYRIGHT "Copyright (C) Twilit Realm contributors")
|
||||
|
||||
source_group("dolzel" FILES ${DOLZEL_FILES} ${Z2AUDIOLIB_FILES} ${REL_FILES})
|
||||
source_group("dusklight" FILES ${DUSK_FILES} ${DUSK_HTTP_BACKEND_FILES})
|
||||
source_group("dusk" FILES ${DUSK_FILES})
|
||||
|
||||
set(GAME_COMPILE_DEFS TARGET_PC WIDESCREEN_SUPPORT=1 AVOID_UB=1 VERSION=0 MTX_USE_PS=1)
|
||||
set(GAME_COMPILE_DEFS TARGET_PC WIDESCREEN_SUPPORT=1 AVOID_UB=1 VERSION=0)
|
||||
|
||||
set(GAME_INCLUDE_DIRS
|
||||
include
|
||||
@@ -341,10 +296,8 @@ set(GAME_INCLUDE_DIRS
|
||||
extern
|
||||
${CMAKE_BINARY_DIR})
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
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 fmt::fmt
|
||||
Threads::Threads)
|
||||
aurora::card freeverb cxxopts::cxxopts absl::flat_hash_map nlohmann_json::nlohmann_json TracyClient fmt::fmt)
|
||||
|
||||
list(APPEND GAME_LIBS libzstd_static)
|
||||
|
||||
@@ -355,47 +308,8 @@ endif ()
|
||||
|
||||
if (WIN32)
|
||||
list(APPEND GAME_LIBS Ws2_32)
|
||||
if (CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||
list(APPEND GAME_LIBS dbghelp)
|
||||
list(APPEND GAME_COMPILE_DEFS DUSK_CRASH_DBGHELP=1)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
set(DUSK_HTTP_BACKEND_SOURCE src/dusk/http/no_backend.cpp)
|
||||
if (DUSK_ENABLE_UPDATE_CHECKER)
|
||||
list(APPEND GAME_COMPILE_DEFS DUSK_ENABLE_UPDATE_CHECKER=1)
|
||||
if (WIN32)
|
||||
set(DUSK_HTTP_BACKEND_SOURCE src/dusk/http/winhttp.cpp)
|
||||
list(APPEND GAME_LIBS winhttp)
|
||||
list(APPEND GAME_COMPILE_DEFS DUSK_HTTP_BACKEND_WINHTTP=1)
|
||||
message(STATUS "dusklight: Enabled update checker (WinHTTP)")
|
||||
elseif (ANDROID)
|
||||
set(DUSK_HTTP_BACKEND_SOURCE src/dusk/http/android.cpp)
|
||||
list(APPEND GAME_COMPILE_DEFS DUSK_HTTP_BACKEND_ANDROID=1)
|
||||
message(STATUS "dusklight: Enabled update checker (Android)")
|
||||
elseif (APPLE)
|
||||
find_library(FOUNDATION_FRAMEWORK Foundation REQUIRED)
|
||||
set(DUSK_HTTP_BACKEND_SOURCE src/dusk/http/url_session.mm)
|
||||
set_source_files_properties(src/dusk/http/url_session.mm PROPERTIES COMPILE_FLAGS -fobjc-arc)
|
||||
list(APPEND GAME_LIBS ${FOUNDATION_FRAMEWORK})
|
||||
list(APPEND GAME_COMPILE_DEFS DUSK_HTTP_BACKEND_URLSESSION=1)
|
||||
message(STATUS "dusklight: Enabled update checker (NSURLSession)")
|
||||
elseif (CMAKE_SYSTEM_NAME STREQUAL Linux)
|
||||
find_package(CURL QUIET OPTIONAL_COMPONENTS HTTPS SSL)
|
||||
if (CURL_FOUND AND CURL_HTTPS_FOUND AND CURL_SSL_FOUND)
|
||||
set(DUSK_HTTP_BACKEND_SOURCE src/dusk/http/curl.cpp)
|
||||
list(APPEND GAME_LIBS CURL::libcurl)
|
||||
list(APPEND GAME_COMPILE_DEFS DUSK_HTTP_BACKEND_LIBCURL=1)
|
||||
message(STATUS "dusklight: Enabled update checker (libcurl)")
|
||||
else ()
|
||||
message(STATUS "dusklight: Disabled update checker (libcurl + HTTPS/SSL not found)")
|
||||
endif ()
|
||||
else ()
|
||||
message(STATUS "dusklight: Disabled update checker (unsupported platform)")
|
||||
endif ()
|
||||
endif ()
|
||||
list(APPEND DUSK_FILES ${DUSK_HTTP_BACKEND_SOURCE})
|
||||
|
||||
if (DUSK_MOVIE_SUPPORT)
|
||||
if (TARGET libjpeg-turbo::turbojpeg-static)
|
||||
list(APPEND GAME_LIBS libjpeg-turbo::turbojpeg-static)
|
||||
@@ -405,13 +319,56 @@ if (DUSK_MOVIE_SUPPORT)
|
||||
list(APPEND GAME_COMPILE_DEFS MOVIE_SUPPORT=1)
|
||||
endif ()
|
||||
|
||||
set(DUSK_ENABLE_DISCORD_DEFAULT ON)
|
||||
if (DEFINED DUSK_ENABLE_DISCORD_RPC AND NOT DEFINED DUSK_ENABLE_DISCORD)
|
||||
set(DUSK_ENABLE_DISCORD_DEFAULT ${DUSK_ENABLE_DISCORD_RPC})
|
||||
option(DUSK_ENABLE_DISCORD_RPC "Enable Discord Rich Presence support" ON)
|
||||
if (DUSK_ENABLE_DISCORD_RPC AND NOT ANDROID AND NOT IOS AND NOT TVOS)
|
||||
|
||||
FetchContent_Populate(discord_rpc
|
||||
URL https://github.com/discord/discord-rpc/archive/refs/tags/v3.4.0.tar.gz
|
||||
URL_HASH SHA256=e13427019027acd187352dacba6c65953af66fdf3c35fcf38fc40b454a9d7855
|
||||
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
|
||||
)
|
||||
# RapidJSON is a git submodule absent from the discord-rpc tarball; fetch separately.
|
||||
FetchContent_Populate(rapidjson
|
||||
URL https://github.com/Tencent/rapidjson/archive/refs/tags/v1.1.0.tar.gz
|
||||
URL_HASH SHA256=bf7ced29704a1e696fbccf2a2b4ea068e7774fa37f6d7dd4039d0787f8bed98e
|
||||
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
|
||||
)
|
||||
|
||||
if (NOT TARGET discord-rpc)
|
||||
set(_drpc ${discord_rpc_SOURCE_DIR}/src)
|
||||
set(_drpc_src
|
||||
${_drpc}/discord_rpc.cpp
|
||||
${_drpc}/rpc_connection.cpp
|
||||
${_drpc}/serialization.cpp
|
||||
)
|
||||
if (WIN32)
|
||||
list(APPEND _drpc_src ${_drpc}/connection_win.cpp ${_drpc}/discord_register_win.cpp)
|
||||
elseif (APPLE)
|
||||
list(APPEND _drpc_src ${_drpc}/connection_unix.cpp ${_drpc}/discord_register_osx.m)
|
||||
else ()
|
||||
list(APPEND _drpc_src ${_drpc}/connection_unix.cpp ${_drpc}/discord_register_linux.cpp)
|
||||
endif ()
|
||||
add_library(discord-rpc STATIC ${_drpc_src})
|
||||
target_include_directories(discord-rpc PUBLIC
|
||||
${discord_rpc_SOURCE_DIR}/include
|
||||
${rapidjson_SOURCE_DIR}/include
|
||||
)
|
||||
if (UNIX)
|
||||
target_link_libraries(discord-rpc PUBLIC pthread)
|
||||
endif ()
|
||||
endif ()
|
||||
list(APPEND GAME_LIBS discord-rpc)
|
||||
list(APPEND GAME_COMPILE_DEFS DUSK_DISCORD_RPC=1)
|
||||
endif ()
|
||||
option(DUSK_ENABLE_DISCORD "Enable Discord Rich Presence support" ${DUSK_ENABLE_DISCORD_DEFAULT})
|
||||
if (DUSK_ENABLE_DISCORD AND NOT ANDROID AND NOT IOS AND NOT TVOS)
|
||||
list(APPEND GAME_COMPILE_DEFS DUSK_DISCORD=1)
|
||||
|
||||
# Edit & Continue
|
||||
if (MSVC)
|
||||
if ("${CMAKE_MSVC_DEBUG_INFORMATION_FORMAT}" STREQUAL "" AND CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "EditAndContinue")
|
||||
endif ()
|
||||
if (CMAKE_MSVC_DEBUG_INFORMATION_FORMAT STREQUAL "EditAndContinue")
|
||||
add_link_options("/INCREMENTAL")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if(ANDROID)
|
||||
@@ -469,41 +426,31 @@ endif ()
|
||||
|
||||
set(DUSK_FILES src/dusk/main.cpp ${GAME_BASE_FILES} ${GAME_DEBUG_FILES})
|
||||
if(ANDROID)
|
||||
add_library(dusklight SHARED ${DUSK_FILES})
|
||||
set_target_properties(dusklight PROPERTIES OUTPUT_NAME main)
|
||||
add_library(dusk SHARED ${DUSK_FILES})
|
||||
set_target_properties(dusk PROPERTIES OUTPUT_NAME main)
|
||||
else ()
|
||||
add_executable(dusklight ${DUSK_FILES})
|
||||
add_executable(dusk ${DUSK_FILES})
|
||||
endif ()
|
||||
|
||||
target_compile_definitions(dusklight PRIVATE ${GAME_COMPILE_DEFS})
|
||||
target_include_directories(dusklight PRIVATE ${GAME_INCLUDE_DIRS})
|
||||
target_link_libraries(dusklight PRIVATE aurora::main ${GAME_LIBS} ${JSYSTEM_LINK_LIBRARIES})
|
||||
target_precompile_headers(dusklight PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:${CMAKE_SOURCE_DIR}/include/dusk_pch.hpp>")
|
||||
target_compile_definitions(dusk PRIVATE ${GAME_COMPILE_DEFS})
|
||||
target_include_directories(dusk PRIVATE ${GAME_INCLUDE_DIRS})
|
||||
target_link_libraries(dusk PRIVATE aurora::main ${GAME_LIBS} ${JSYSTEM_LINK_LIBRARIES})
|
||||
target_precompile_headers(dusk PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:${CMAKE_SOURCE_DIR}/include/dusk_pch.hpp>")
|
||||
if (TARGET crashpad_handler)
|
||||
add_dependencies(dusklight crashpad_handler)
|
||||
add_custom_command(TARGET dusklight POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
"$<TARGET_FILE:crashpad_handler>"
|
||||
"$<TARGET_FILE_DIR:dusklight>"
|
||||
COMMENT "Copying crashpad handler"
|
||||
)
|
||||
add_dependencies(dusk crashpad_handler)
|
||||
endif ()
|
||||
|
||||
if (ANDROID)
|
||||
# SDLActivity loads SDL_main via dlsym on Android. Since aurora::main is a static
|
||||
# archive, force an undefined reference so the linker keeps the SDL_main object.
|
||||
target_link_options(dusklight PRIVATE "-Wl,-u,SDL_main")
|
||||
endif ()
|
||||
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL Linux)
|
||||
target_link_options(dusklight PRIVATE "-Wl,--build-id=sha1")
|
||||
target_link_options(dusk PRIVATE "-Wl,-u,SDL_main")
|
||||
endif ()
|
||||
|
||||
if (NOT APPLE)
|
||||
add_custom_command(TARGET dusklight POST_BUILD
|
||||
add_custom_command(TARGET dusk POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
"${CMAKE_SOURCE_DIR}/res"
|
||||
"$<TARGET_FILE_DIR:dusklight>/res"
|
||||
"$<TARGET_FILE_DIR:dusk>/res"
|
||||
COMMENT "Copying resources"
|
||||
)
|
||||
endif ()
|
||||
@@ -511,9 +458,9 @@ endif ()
|
||||
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}/dusklight.ico)
|
||||
set(DUSK_WINDOWS_RC ${CMAKE_CURRENT_BINARY_DIR}/dusklight.rc)
|
||||
set(DUSK_WINDOWS_MANIFEST ${CMAKE_CURRENT_BINARY_DIR}/dusklight.manifest)
|
||||
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}
|
||||
@@ -526,14 +473,14 @@ if (WIN32)
|
||||
COMMENT "Generating Windows icon"
|
||||
)
|
||||
|
||||
configure_file(${DUSK_WINDOWS_RESOURCE_DIR}/dusklight.manifest.in ${DUSK_WINDOWS_MANIFEST} @ONLY)
|
||||
configure_file(${DUSK_WINDOWS_RESOURCE_DIR}/dusklight.rc.in ${DUSK_WINDOWS_RC} @ONLY)
|
||||
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(dusklight PRIVATE ${DUSK_WINDOWS_ICON_ICO} ${DUSK_WINDOWS_RC})
|
||||
set_target_properties(dusklight PROPERTIES WIN32_EXECUTABLE TRUE)
|
||||
target_sources(dusk PRIVATE ${DUSK_WINDOWS_ICON_ICO} ${DUSK_WINDOWS_RC})
|
||||
set_target_properties(dusk PROPERTIES WIN32_EXECUTABLE TRUE)
|
||||
|
||||
if (MSVC)
|
||||
target_link_options(dusklight PRIVATE /MANIFEST:NO)
|
||||
target_link_options(dusk PRIVATE /MANIFEST:NO)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
@@ -549,10 +496,10 @@ if (APPLE)
|
||||
file(GLOB_RECURSE DUSK_RESOURCE_FILES
|
||||
"${DUSK_RESOURCE_DIR}/Assets.car"
|
||||
"${DUSK_RESOURCE_DIR}/Base.lproj/*"
|
||||
"${DUSK_RESOURCE_DIR}/Dusklight.icns")
|
||||
"${DUSK_RESOURCE_DIR}/Dusk.icns")
|
||||
file(GLOB_RECURSE DUSK_APP_RESOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/res/*")
|
||||
target_sources(dusklight PRIVATE ${DUSK_RESOURCE_FILES})
|
||||
target_sources(dusklight PRIVATE ${DUSK_APP_RESOURCE_FILES})
|
||||
target_sources(dusk PRIVATE ${DUSK_RESOURCE_FILES})
|
||||
target_sources(dusk PRIVATE ${DUSK_APP_RESOURCE_FILES})
|
||||
foreach (FILE ${DUSK_RESOURCE_FILES})
|
||||
file(RELATIVE_PATH NEW_FILE "${DUSK_RESOURCE_DIR}" ${FILE})
|
||||
get_filename_component(NEW_FILE_PATH ${NEW_FILE} DIRECTORY)
|
||||
@@ -564,36 +511,29 @@ if (APPLE)
|
||||
set_property(SOURCE ${FILE} PROPERTY MACOSX_PACKAGE_LOCATION "Resources/${NEW_FILE_PATH}")
|
||||
endforeach ()
|
||||
set_target_properties(
|
||||
dusklight PROPERTIES
|
||||
dusk PROPERTIES
|
||||
MACOSX_BUNDLE TRUE
|
||||
MACOSX_BUNDLE_BUNDLE_NAME ${DUSK_BUNDLE_NAME}
|
||||
MACOSX_BUNDLE_GUI_IDENTIFIER ${DUSK_BUNDLE_IDENTIFIER}
|
||||
MACOSX_BUNDLE_BUNDLE_VERSION ${DUSK_VERSION_STRING}
|
||||
MACOSX_BUNDLE_SHORT_VERSION_STRING ${DUSK_SHORT_VERSION_STRING}
|
||||
MACOSX_BUNDLE_INFO_PLIST ${DUSK_INFO_PLIST}
|
||||
OUTPUT_NAME Dusklight
|
||||
OUTPUT_NAME Dusk
|
||||
XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "YES"
|
||||
XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "YES"
|
||||
)
|
||||
endif ()
|
||||
|
||||
if (APPLE AND NOT IOS AND NOT TVOS)
|
||||
find_library(APPKIT_FRAMEWORK AppKit REQUIRED)
|
||||
target_sources(dusklight PRIVATE src/dusk/file_select_macos.mm)
|
||||
set_source_files_properties(src/dusk/file_select_macos.mm PROPERTIES COMPILE_FLAGS -fobjc-arc)
|
||||
target_link_libraries(dusklight PRIVATE ${APPKIT_FRAMEWORK})
|
||||
endif ()
|
||||
|
||||
if (IOS)
|
||||
find_library(UIKIT_FRAMEWORK UIKit REQUIRED)
|
||||
find_library(UNIFORM_TYPE_IDENTIFIERS_FRAMEWORK UniformTypeIdentifiers REQUIRED)
|
||||
target_sources(dusklight PRIVATE src/dusk/ios/FileSelectDialog.m)
|
||||
target_sources(dusk PRIVATE src/dusk/ios/FileSelectDialog.m)
|
||||
set_source_files_properties(src/dusk/ios/FileSelectDialog.m PROPERTIES COMPILE_FLAGS -fobjc-arc)
|
||||
target_link_libraries(dusklight PRIVATE ${UIKIT_FRAMEWORK} ${UNIFORM_TYPE_IDENTIFIERS_FRAMEWORK})
|
||||
target_link_libraries(dusk PRIVATE ${UIKIT_FRAMEWORK} ${UNIFORM_TYPE_IDENTIFIERS_FRAMEWORK})
|
||||
endif ()
|
||||
|
||||
include(extern/aurora/cmake/AuroraCopyRuntimeDLLs.cmake)
|
||||
aurora_copy_runtime_dlls(dusklight)
|
||||
aurora_copy_runtime_dlls(dusk)
|
||||
|
||||
if (DUSK_SELECTED_OPT)
|
||||
if (CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")
|
||||
@@ -631,13 +571,13 @@ function(get_target_prefix target result_var)
|
||||
endif ()
|
||||
endif ()
|
||||
endfunction()
|
||||
list(APPEND BINARY_TARGETS dusklight)
|
||||
list(APPEND BINARY_TARGETS dusk)
|
||||
set(EXTRA_TARGETS "")
|
||||
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(dusklight ${CMAKE_INSTALL_PREFIX})
|
||||
aurora_install_runtime_dlls(dusk ${CMAKE_INSTALL_PREFIX})
|
||||
if (NOT APPLE)
|
||||
install(DIRECTORY ${CMAKE_SOURCE_DIR}/res DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
endif ()
|
||||
|
||||
+31
-59
@@ -33,11 +33,7 @@
|
||||
"value": true
|
||||
},
|
||||
"DUSK_SENTRY_DSN": "$env{SENTRY_DSN}",
|
||||
"DUSK_SENTRY_ENVIRONMENT": "production",
|
||||
"Rust_RUSTUP_INSTALL_MISSING_TARGET": {
|
||||
"type": "BOOL",
|
||||
"value": true
|
||||
}
|
||||
"DUSK_SENTRY_ENVIRONMENT": "production"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -253,11 +249,22 @@
|
||||
"type": "BOOL",
|
||||
"value": false
|
||||
},
|
||||
"CMAKE_DISABLE_FIND_PACKAGE_PkgConfig": {
|
||||
"CMAKE_DISABLE_FIND_PACKAGE_BZip2": {
|
||||
"type": "BOOL",
|
||||
"value": true
|
||||
},
|
||||
"CMAKE_IGNORE_PREFIX_PATH": "/opt/homebrew"
|
||||
"CMAKE_DISABLE_FIND_PACKAGE_LibLZMA": {
|
||||
"type": "BOOL",
|
||||
"value": true
|
||||
},
|
||||
"CMAKE_DISABLE_FIND_PACKAGE_zstd": {
|
||||
"type": "BOOL",
|
||||
"value": true
|
||||
},
|
||||
"CMAKE_DISABLE_FIND_PACKAGE_Freetype": {
|
||||
"type": "BOOL",
|
||||
"value": true
|
||||
}
|
||||
},
|
||||
"vendor": {
|
||||
"microsoft.com/VisualStudioSettings/CMake/1.0": {
|
||||
@@ -322,13 +329,7 @@
|
||||
"cacheVariables": {
|
||||
"CMAKE_INSTALL_PREFIX": "${sourceDir}/build/install",
|
||||
"CMAKE_TOOLCHAIN_FILE": "$env{ANDROID_HOME}/ndk/$env{ANDROID_NDK_VERSION}/build/cmake/android.toolchain.cmake",
|
||||
"ANDROID_PLATFORM": "android-28",
|
||||
"BUILD_SHARED_LIBS": {
|
||||
"type": "BOOL",
|
||||
"value": false
|
||||
},
|
||||
"AURORA_SDL3_VERSION": "3.4.8",
|
||||
"AURORA_SDL3_REF": "refs/tags/release-3.4.8"
|
||||
"ANDROID_PLATFORM": "android-28"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -351,31 +352,6 @@
|
||||
"ANDROID_ABI": "x86_64"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "x-android-ci",
|
||||
"hidden": true,
|
||||
"inherits": [
|
||||
"android-base",
|
||||
"ci"
|
||||
],
|
||||
"cacheVariables": {
|
||||
"DUSK_ENABLE_SENTRY_NATIVE": {
|
||||
"type": "BOOL",
|
||||
"value": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "x-android-ci-arm64",
|
||||
"binaryDir": "${sourceDir}/build/android-arm64",
|
||||
"inherits": [
|
||||
"x-android-ci"
|
||||
],
|
||||
"cacheVariables": {
|
||||
"ANDROID_ABI": "arm64-v8a",
|
||||
"Rust_CARGO_TARGET": "aarch64-linux-android"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "x-linux-ci",
|
||||
"hidden": true,
|
||||
@@ -415,7 +391,7 @@
|
||||
},
|
||||
"CMAKE_OSX_DEPLOYMENT_TARGET": "11.0",
|
||||
"CMAKE_IGNORE_PREFIX_PATH": "/opt/homebrew",
|
||||
"BUILD_SHARED_LIBS": {
|
||||
"DUSK_MOVIE_SUPPORT": {
|
||||
"type": "BOOL",
|
||||
"value": false
|
||||
}
|
||||
@@ -447,7 +423,11 @@
|
||||
],
|
||||
"cacheVariables": {
|
||||
"CMAKE_C_COMPILER_LAUNCHER": "sccache",
|
||||
"CMAKE_CXX_COMPILER_LAUNCHER": "sccache"
|
||||
"CMAKE_CXX_COMPILER_LAUNCHER": "sccache",
|
||||
"DUSK_MOVIE_SUPPORT": {
|
||||
"type": "BOOL",
|
||||
"value": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -457,7 +437,11 @@
|
||||
],
|
||||
"cacheVariables": {
|
||||
"CMAKE_C_COMPILER_LAUNCHER": "sccache",
|
||||
"CMAKE_CXX_COMPILER_LAUNCHER": "sccache"
|
||||
"CMAKE_CXX_COMPILER_LAUNCHER": "sccache",
|
||||
"DUSK_MOVIE_SUPPORT": {
|
||||
"type": "BOOL",
|
||||
"value": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -495,10 +479,7 @@
|
||||
"inherits": [
|
||||
"x-windows-ci",
|
||||
"windows-arm64-msvc"
|
||||
],
|
||||
"cacheVariables": {
|
||||
"VCPKG_TARGET_TRIPLET": "arm64-windows"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"buildPresets": [
|
||||
@@ -544,7 +525,7 @@
|
||||
"description": "iOS release build with debug info",
|
||||
"displayName": "iOS RelWithDebInfo",
|
||||
"targets": [
|
||||
"dusklight"
|
||||
"dusk"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -553,7 +534,7 @@
|
||||
"description": "tvOS release build with debug info",
|
||||
"displayName": "tvOS RelWithDebInfo",
|
||||
"targets": [
|
||||
"dusklight"
|
||||
"dusk"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -562,7 +543,7 @@
|
||||
"description": "Android arm64-v8a release build with debug info",
|
||||
"displayName": "Android arm64-v8a RelWithDebInfo",
|
||||
"targets": [
|
||||
"dusklight"
|
||||
"dusk"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -571,16 +552,7 @@
|
||||
"description": "Android x86_64 release build with debug info",
|
||||
"displayName": "Android x86_64 RelWithDebInfo",
|
||||
"targets": [
|
||||
"dusklight"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "x-android-ci-arm64",
|
||||
"configurePreset": "x-android-ci-arm64",
|
||||
"description": "(Internal) Android CI arm64-v8a",
|
||||
"displayName": "(Internal) Android CI arm64-v8a",
|
||||
"targets": [
|
||||
"dusklight"
|
||||
"dusk"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,64 +1,31 @@
|
||||
<div align="center">
|
||||
<img src="res/logo.png" alt="Logo" width="640">
|
||||

|
||||
|
||||
<p align="center">
|
||||
<a href="https://twilitrealm.dev">Official Website</a>
|
||||
•
|
||||
<a href="https://discord.gg/6NpMhefCK9">Discord</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
# Overview
|
||||
|
||||
Dusklight is a reverse-engineered reimplementation of Twilight Princess.
|
||||
|
||||
It aims to be as accurate as possible to the original while also providing new options, enhancements, and tools to customize your experience.
|
||||
- ### **[Official Website](https://twilitrealm.dev)**
|
||||
- ### **[Discord](https://discord.gg/QACynxeyna)**
|
||||
|
||||
# Setup
|
||||
**⚠️ Dusk does NOT provide any copyrighted assets. You must provide your own copy of the game.**
|
||||
|
||||
> [!IMPORTANT]
|
||||
> Dusklight does *not* provide any copyrighted assets. You must provide your own copy of the original game.
|
||||
### 1. Verify your ROM dump
|
||||
First make sure your dump of the game is clean and supported by Dusk. You can do this by checking the sha1 hash of your dump against this list of supported versions.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> At a minimum, Dusklight 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 likelihood of incompatibility. We are also aware of a number of issues on devices with Adreno GPUs and are working to resolve them.
|
||||
| Version | sha1 hash |
|
||||
|--------------| ---------------------------------------- |
|
||||
| GameCube USA | 75edd3ddff41f125d1b4ce1a40378f1b565519e7 |
|
||||
| GameCube PAL | 2601822a488eeb86fb89db16ca8f29c2c953e1ca |
|
||||
|
||||
### 1. Dump your game
|
||||
|
||||
You must dump your own copy of the game, please see [this article](https://wiki.dolphin-emu.org/index.php?title=Ripping_Games) for instructions. After dumping, you can use a program like [Dolphin](https://dolphin-emu.org/) or [nodtool](https://github.com/encounter/nod/releases) to convert the `.iso` to a `.rvz` to save space.
|
||||
|
||||
Currently, only the GameCube USA and EUR releases are supported. Support for other versions of the game is planned in the future.
|
||||
|
||||
### 2. Download [Dusklight](https://github.com/TwilitRealm/dusklight/releases)
|
||||
### 2. Download [Dusk](https://github.com/TwilitRealm/dusk/releases)
|
||||
|
||||
### 3. Setup the game
|
||||
**Windows / macOS / Linux**
|
||||
- Extract the .zip file
|
||||
- Launch Dusklight
|
||||
- Press **Select Disc Image** and provide the path to your supported game dump
|
||||
- Press **Play**!
|
||||
- Extract the zip folder
|
||||
- Launch Dusk
|
||||
- Select Options, then set the ISO Path to your supported game dump
|
||||
- Press Start Game to play!
|
||||
|
||||
**iOS**
|
||||
- Follow the [iOS setup guide](docs/ios-install-altstore.md)
|
||||
|
||||
**Android**
|
||||
- Install the Dusklight APK
|
||||
- Launch Dusklight
|
||||
- Press **Select Disc Image** and provide the path to your supported game dump
|
||||
- Press **Play**!
|
||||

|
||||
|
||||
# Building
|
||||
|
||||
If you'd like to build Dusklight 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).
|
||||
If you'd like to build Dusk from source, please read the [build instructions](docs/building.md).
|
||||
|
||||
# Credits
|
||||
|
||||
Special thanks to the [TP decompilation](https://github.com/zeldaret/tp) team, the GC/Wii decompilation community, the [Aurora](https://github.com/encounter/aurora) developers, the [TP speedrunning community](https://zsrtp.link), and all [contributors](https://github.com/TwilitRealm/dusklight/graphs/contributors).
|
||||
|
||||
<br/>
|
||||
<div align="center">
|
||||
<a href="https://github.com/encounter/aurora">
|
||||
<img src="assets/aurora-powered.png" alt="Powered by Aurora" width="800">
|
||||
</a>
|
||||
</div>
|
||||
Special thanks to the [TP decompilation](https://github.com/zeldaret/tp) team, the GC/Wii decompilation community, the [Aurora](https://github.com/encounter/aurora) developers, the [TP speedrunning community](https://zsrtp.link), and all [contributors](https://github.com/TwilitRealm/dusk/graphs/contributors).
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 27 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 82 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 85 KiB |
@@ -1,66 +0,0 @@
|
||||
<svg width="600" height="600" viewBox="0 0 300 300" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="150" cy="150" r="105" fill="none" stroke="white" stroke-width="4"/>
|
||||
<circle cx="150" cy="150" r="95" fill="none" stroke="white" stroke-width="4"/>
|
||||
<circle cx="150" cy="150" r="60" fill="none" stroke="white" stroke-width="4"/>
|
||||
<circle cx="150" cy="150" r="75" fill="none" stroke="white" stroke-width="4"/>
|
||||
|
||||
<defs>
|
||||
<line id="ray" x1="150" y1="55" x2="150" y2="45"/>
|
||||
<clipPath id="zigzag-clip">
|
||||
<circle cx="150" cy="150" r="75"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
|
||||
<g stroke="white" stroke-width="3">
|
||||
<use href="#ray"/>
|
||||
<use href="#ray" transform="rotate(18 150 150)"/>
|
||||
<use href="#ray" transform="rotate(36 150 150)"/>
|
||||
<use href="#ray" transform="rotate(54 150 150)"/>
|
||||
<use href="#ray" transform="rotate(72 150 150)"/>
|
||||
<use href="#ray" transform="rotate(90 150 150)"/>
|
||||
<use href="#ray" transform="rotate(108 150 150)"/>
|
||||
<use href="#ray" transform="rotate(126 150 150)"/>
|
||||
<use href="#ray" transform="rotate(144 150 150)"/>
|
||||
<use href="#ray" transform="rotate(162 150 150)"/>
|
||||
<use href="#ray" transform="rotate(180 150 150)"/>
|
||||
<use href="#ray" transform="rotate(198 150 150)"/>
|
||||
<use href="#ray" transform="rotate(216 150 150)"/>
|
||||
<use href="#ray" transform="rotate(234 150 150)"/>
|
||||
<use href="#ray" transform="rotate(252 150 150)"/>
|
||||
<use href="#ray" transform="rotate(270 150 150)"/>
|
||||
<use href="#ray" transform="rotate(288 150 150)"/>
|
||||
<use href="#ray" transform="rotate(306 150 150)"/>
|
||||
<use href="#ray" transform="rotate(324 150 150)"/>
|
||||
<use href="#ray" transform="rotate(342 150 150)"/>
|
||||
</g>
|
||||
|
||||
<polygon fill="none" stroke="white" stroke-width="4" opacity="1" clip-path="url(#zigzag-clip)"
|
||||
points="
|
||||
126.82,78.67
|
||||
150,90
|
||||
173.18,78.67
|
||||
185.27,101.46
|
||||
210.68,105.92
|
||||
207.06,131.46
|
||||
225,150
|
||||
207.06,168.54
|
||||
210.68,194.08
|
||||
185.27,198.54
|
||||
173.18,221.33
|
||||
150,210
|
||||
126.82,221.33
|
||||
114.73,198.54
|
||||
89.32,194.08
|
||||
92.94,168.54
|
||||
75,150
|
||||
92.94,131.46
|
||||
89.32,105.92
|
||||
114.73,101.46
|
||||
"/>
|
||||
|
||||
<g fill="none" stroke="white" stroke-width="4">
|
||||
<polygon points="150,105 130,140 170,140"/>
|
||||
<polygon points="130,140 110,175 150,175"/>
|
||||
<polygon points="170,140 150,175 190,175"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 2.3 KiB |
+9
-18
@@ -1,27 +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"
|
||||
lib_dir="/usr/lib/$(uname -m)-linux-gnu"
|
||||
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/dev.twilitrealm.dusk.desktop build/appdir/usr/share/applications
|
||||
cp platforms/freedesktop/dusk.desktop build/appdir/usr/share/applications
|
||||
|
||||
cd build/install
|
||||
VERSION="$DUSK_VERSION" NO_STRIP=1 "$linuxdeploy" \
|
||||
-l "$lib_dir/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,9 +0,0 @@
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
if (CMAKE_C_COMPILER_ARCHITECTURE_ID STREQUAL "ARM64" OR CMAKE_C_COMPILER_ARCHITECTURE_ID STREQUAL "ARM64EC")
|
||||
set(CMAKE_SYSTEM_PROCESSOR "ARM64")
|
||||
elseif (CMAKE_C_COMPILER_ARCHITECTURE_ID STREQUAL "x64")
|
||||
set(CMAKE_SYSTEM_PROCESSOR "AMD64")
|
||||
elseif (CMAKE_C_COMPILER_ARCHITECTURE_ID STREQUAL "X86")
|
||||
set(CMAKE_SYSTEM_PROCESSOR "X86")
|
||||
endif ()
|
||||
endif ()
|
||||
+52
-182
@@ -1,165 +1,51 @@
|
||||
# Building Dusklight
|
||||
|
||||
## Dependencies
|
||||
|
||||
The following dependencies are required:
|
||||
|
||||
### Building
|
||||
#### Prerequisites
|
||||
* [CMake 3.25+](https://cmake.org)
|
||||
* Windows: Install `CMake Tools` in Visual Studio
|
||||
* macOS: `brew install cmake`
|
||||
* [Python 3+](https://python.org)
|
||||
|
||||
### Windows
|
||||
|
||||
* Install [CMake 3.25+](https://cmake.org) by searching `CMake Tools` in Visual Studio
|
||||
* Install Python 3 from the [Microsoft Store](https://go.microsoft.com/fwlink?linkID=2082640) and verify it's added to `%PATH%` by typing `python` in `cmd`.
|
||||
|
||||
Recommended IDEs:
|
||||
|
||||
* [Visual Studio 2026 Community](https://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx). During installation:
|
||||
* Select `C++ Development` and verify the following packages are included:
|
||||
* `Windows 11 SDK`
|
||||
* `CMake Tools`
|
||||
* `C++ Clang Compiler`
|
||||
* `C++ Clang-cl`
|
||||
|
||||
### macOS
|
||||
|
||||
* Make sure [Homebrew](https://brew.sh) is installed
|
||||
* Install [CMake 3.25+](https://cmake.org)
|
||||
|
||||
* Windows: [Microsoft Store](https://go.microsoft.com/fwlink?linkID=2082640)
|
||||
* Verify it's added to `%PATH%` by typing `python` in `cmd`.
|
||||
* macOS: `brew install python@3`
|
||||
* **[Windows]** [Visual Studio 2026 Community](https://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx)
|
||||
* Select `C++ Development` and verify the following packages are included:
|
||||
* `Windows 11 SDK`
|
||||
* `CMake Tools`
|
||||
* `C++ Clang Compiler`
|
||||
* `C++ Clang-cl`
|
||||
* **[macOS]** [Xcode 16.4+](https://developer.apple.com/xcode/download/)
|
||||
* **[Linux]** Actively tested on Ubuntu 24.04, Arch Linux & derivatives.
|
||||
* Ubuntu 24.04+ packages
|
||||
```
|
||||
build-essential curl git ninja-build clang lld zlib1g-dev libcurl4-openssl-dev \
|
||||
libglu1-mesa-dev libdbus-1-dev libvulkan-dev libxi-dev libxrandr-dev libasound2-dev libpulse-dev \
|
||||
libudev-dev libpng-dev libncurses5-dev cmake libx11-xcb-dev python3 python-is-python3 \
|
||||
libclang-dev libfreetype-dev libxinerama-dev libxcursor-dev python3-markupsafe libgtk-3-dev \
|
||||
libxss-dev libxtst-dev
|
||||
```
|
||||
* Arch Linux packages
|
||||
```
|
||||
base-devel cmake ninja llvm vulkan-headers python python-markupsafe clang lld alsa-lib libpulse libxrandr freetype2
|
||||
```
|
||||
* Fedora packages
|
||||
```
|
||||
cmake vulkan-headers ninja-build clang-devel llvm-devel libpng-devel
|
||||
```
|
||||
* It's also important that you install the developer tools and libraries
|
||||
```
|
||||
sudo dnf groupinstall "Development Tools" "Development Libraries"
|
||||
```
|
||||
#### Setup
|
||||
Clone and initialize the Dusk repository
|
||||
```sh
|
||||
brew install cmake
|
||||
```
|
||||
|
||||
* Install Python 3
|
||||
|
||||
```sh
|
||||
brew install python@3
|
||||
```
|
||||
|
||||
Recommended IDEs:
|
||||
|
||||
* [Xcode 16.4 or later](https://developer.apple.com/xcode/)
|
||||
* [Visual Studio Code](https://code.visualstudio.com/download/)
|
||||
* [CLion](https://www.jetbrains.com/clion/)
|
||||
|
||||
### Linux
|
||||
|
||||
Actively tested on Ubuntu 24.04, Arch Linux & derivatives.
|
||||
|
||||
**Ubuntu 24.04+ packages**
|
||||
|
||||
<details>
|
||||
<summary>Click to expand</summary>
|
||||
|
||||
* Run the following command to install the required dependencies:
|
||||
|
||||
```sh
|
||||
sudo apt update && sudo apt install -y \
|
||||
build-essential \
|
||||
clang \
|
||||
cmake \
|
||||
curl \
|
||||
git \
|
||||
libasound2-dev \
|
||||
libclang-dev \
|
||||
libcurl4-openssl-dev \
|
||||
libdbus-1-dev \
|
||||
libfreetype-dev \
|
||||
libglu1-mesa-dev \
|
||||
libgtk-3-dev \
|
||||
libncurses5-dev \
|
||||
libpng-dev \
|
||||
libpulse-dev \
|
||||
libudev-dev \
|
||||
libvulkan-dev \
|
||||
libx11-xcb-dev \
|
||||
libxcursor-dev \
|
||||
libxi-dev \
|
||||
libxinerama-dev \
|
||||
libxrandr-dev \
|
||||
libxss-dev \
|
||||
libxtst-dev \
|
||||
lld \
|
||||
ninja-build \
|
||||
python-is-python3 \
|
||||
python3 \
|
||||
python3-markupsafe \
|
||||
zlib1g-dev
|
||||
```
|
||||
|
||||
</details>
|
||||
<br>
|
||||
|
||||
**Arch Linux packages**
|
||||
|
||||
<details>
|
||||
<summary>Click to expand</summary>
|
||||
|
||||
* Run the following command to install the required dependencies:
|
||||
|
||||
```sh
|
||||
sudo pacman -S --needed \
|
||||
alsa-lib \
|
||||
base-devel \
|
||||
clang \
|
||||
cmake \
|
||||
freetype2 \
|
||||
libpulse \
|
||||
libxrandr \
|
||||
lld \
|
||||
llvm \
|
||||
ninja \
|
||||
python \
|
||||
python-markupsafe \
|
||||
vulkan-headers
|
||||
```
|
||||
|
||||
</details>
|
||||
<br>
|
||||
|
||||
**Fedora packages**
|
||||
|
||||
<details>
|
||||
<summary>Click to expand</summary>
|
||||
|
||||
* Run the following command to install the required dependencies:
|
||||
|
||||
```sh
|
||||
sudo dnf install -y \
|
||||
clang-devel \
|
||||
cmake \
|
||||
libpng-devel \
|
||||
llvm-devel \
|
||||
ninja-build \
|
||||
vulkan-headers
|
||||
```
|
||||
|
||||
* It's also important that you install the developer tools and libraries
|
||||
|
||||
```sh
|
||||
sudo dnf groupinstall \
|
||||
"Development Libraries" "Development Tools"
|
||||
```
|
||||
|
||||
</details>
|
||||
<br>
|
||||
|
||||
Recommended IDEs:
|
||||
|
||||
* [CLion](https://www.jetbrains.com/clion/)
|
||||
* [Visual Studio Code](https://code.visualstudio.com/download/)
|
||||
|
||||
## Building
|
||||
|
||||
* Clone and initialize the Dusklight repository:
|
||||
|
||||
```sh
|
||||
git clone --recursive https://github.com/TwilitRealm/dusklight.git
|
||||
git clone --recursive https://github.com/TwilitRealm/dusk.git
|
||||
cd dusk
|
||||
git pull
|
||||
cd dusklight
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
#### Building
|
||||
|
||||
**CLion (Windows / macOS / Linux)**
|
||||
|
||||
Open the project directory in CLion. Enable the appropriate presets for your platform:
|
||||
@@ -178,8 +64,7 @@ cmake --build --preset macos-default-relwithdebinfo
|
||||
```
|
||||
|
||||
Alternate presets available:
|
||||
|
||||
* `macos-default-debug`: Clang, Debug
|
||||
- `macos-default-debug`: Clang, Debug
|
||||
|
||||
**ninja (Linux)**
|
||||
|
||||
@@ -189,10 +74,9 @@ cmake --build --preset linux-default-relwithdebinfo
|
||||
```
|
||||
|
||||
Alternate presets available:
|
||||
|
||||
* `linux-default-debug`: GCC, Debug
|
||||
* `linux-clang-relwithdebinfo`: Clang, RelWithDebInfo
|
||||
* `linux-clang-debug`: Clang, Debug
|
||||
- `linux-default-debug`: GCC, Debug
|
||||
- `linux-clang-relwithdebinfo`: Clang, RelWithDebInfo
|
||||
- `linux-clang-debug`: Clang, Debug
|
||||
|
||||
**ninja (Windows)**
|
||||
|
||||
@@ -202,27 +86,13 @@ cmake --build --preset windows-msvc-relwithdebinfo
|
||||
```
|
||||
|
||||
Alternate presets available:
|
||||
- `windows-msvc-debug`: MSVC, Debug
|
||||
- `windows-clang-relwithdebinfo`: Clang-cl, RelWithDebInfo
|
||||
- `windows-clang-debug`: Clang-cl, Debug
|
||||
|
||||
* `windows-msvc-debug`: MSVC, Debug
|
||||
* `windows-clang-relwithdebinfo`: Clang-cl, RelWithDebInfo
|
||||
* `windows-clang-debug`: Clang-cl, Debug
|
||||
|
||||
## Running
|
||||
|
||||
**Windows / Linux**
|
||||
|
||||
* Pass the disc image as a positional argument using the `--dvd` flag. Supported formats are: ISO (GCM), RVZ, WIA, WBFS, CISO, GCZ
|
||||
|
||||
#### Running
|
||||
Pass the disc image as a positional argument. Supported formats: ISO (GCM), RVZ, WIA, WBFS, CISO, GCZ
|
||||
```sh
|
||||
build/{preset}/dusklight --dvd /path/to/game.iso
|
||||
```
|
||||
|
||||
**macOS**
|
||||
|
||||
macOS builds an `.app` bundle which contains the executable and all necessary resources.
|
||||
|
||||
* Pass the disc image as a positional argument using the `--dvd` flag. Supported formats are: ISO (GCM), RVZ, WIA, WBFS, CISO, GCZ
|
||||
|
||||
```sh
|
||||
build/{preset}/Dusklight.app/Contents/MacOS/Dusklight --dvd /path/to/game.iso
|
||||
build/{preset}/dusk /path/to/game.rvz
|
||||
```
|
||||
If no path is specified, Dusk defaults to `game.iso` in the current working directory.
|
||||
|
||||
@@ -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.
|
||||
@@ -1,48 +0,0 @@
|
||||
# Installing Dusklight on iOS via iloader
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- A Windows, Linux, or macOS device
|
||||
- iOS device connected to computer via USB
|
||||
- Dusklight IPA file (download the latest `Dusklight-vX.X.X-ios-arm64.ipa` from the [releases page](https://github.com/TwilitRealm/dusklight/releases))
|
||||
- Legally acquired game disc - `GZ2E01` (Gamecube USA) or `GZ2PE01` (Gamecube PAL)
|
||||
|
||||
## 1. Install iloader
|
||||
|
||||
- Executable bundles can be installed from [iloader's main page](https://iloader.app/) or [their GitHub](https://github.com/nab138/iloader) for Windows, Linux, and macOS.
|
||||
- Windows WILL require iTunes to be installed
|
||||
- Linux WILL require usbmuxd to be installed, this is installed by default in most distros though
|
||||
|
||||
## 2. Enable Developer Mode (iOS 16+)
|
||||
|
||||
- On your iPhone, go to **Settings > Privacy & Security > Developer Mode**
|
||||
- Toggle it on, put in your device passcode, and restart when prompted
|
||||
|
||||
## 3. Install Dusklight on Your iPhone
|
||||
|
||||
1. Sign into your Apple ID (this is required for registering app IDs, it is sent securely directly to Apple and not stored by iloader)
|
||||
* You may be prompted to put in a code from your iOS device if you have 2FA enabled, do so
|
||||
2. Plug in your iOS device via USB into your PC. If you're missing a dependency, an error pop-up will tell you to install it
|
||||
* You will need to hit `Refresh` after plugging it in at this stage so that it can be detected, it does not automatically refresh
|
||||
3. Leave settings unchanged (the Anisette server should stay Sidestore (.io))
|
||||
3.(a) Installing SideStore directly is not required, but provides you a way to install Dusklight on your phone without being plugged into a computer later
|
||||
4. Press `Import IPA` and choose your downloaded `Dusklight-v.X.X.X-ios-arm64.ipa`, it will begin installing on your device
|
||||
|
||||
**NOTE:** *At various stages, you may be prompted to trust your device, do so*
|
||||
|
||||
## 3. Getting Dusklight trusted
|
||||
When installing sideloaded iOS applications, at first you will need to manually trust the app due to Apple's security policies
|
||||
* Go to **Settings > General > VPN & Device Management**
|
||||
* Tap the Apple ID you signed into iloader with under "Developer App" and tap **Trust**
|
||||
* Tap **Allow** on the pop-up
|
||||
|
||||
## 4. Copy Files to Your iPhone
|
||||
|
||||
Transfer the game disc (and optionally, the Dusklight IPA) to your iPhone so they are accessible in the Files app. A few ways to do this:
|
||||
|
||||
- **AirDrop** - Right-click the files on your Mac and choose Share > AirDrop
|
||||
- **iCloud Drive** - Place files in iCloud Drive on your Mac and they'll sync to Files on your iPhone
|
||||
- **USB transfer** - Connect your iPhone and drag files via Finder's sidebar
|
||||
- **Cloud storage** - Upload to Google Drive, Dropbox, etc. and download on your iPhone
|
||||
|
||||
You may now use Dusklight on iOS and iPadOS!
|
||||
Vendored
+1
-1
Submodule extern/aurora updated: cb2c340d6c...7784b6fc95
+13
-74
@@ -1,7 +1,7 @@
|
||||
|
||||
set(DOLZEL_FILES
|
||||
src/m_Do/m_Do_main.cpp
|
||||
#src/m_Do/m_Do_printf.cpp
|
||||
src/m_Do/m_Do_printf.cpp
|
||||
src/m_Do/m_Do_audio.cpp
|
||||
src/m_Do/m_Do_controller_pad.cpp
|
||||
#src/m_Do/m_Re_controller_pad.cpp
|
||||
@@ -1411,7 +1411,6 @@ set(DOLPHIN_FILES
|
||||
)
|
||||
|
||||
set(DUSK_FILES
|
||||
include/dusk/action_bindings.h
|
||||
include/dusk/endian_gx.hpp
|
||||
include/dusk/config.hpp
|
||||
include/dusk/dvd_asset.hpp
|
||||
@@ -1420,10 +1419,7 @@ set(DUSK_FILES
|
||||
src/d/actor/d_a_alink_dusk.cpp
|
||||
src/dusk/asserts.cpp
|
||||
src/dusk/config.cpp
|
||||
src/dusk/crash_handler.cpp
|
||||
src/dusk/crash_reporting.cpp
|
||||
src/dusk/data.cpp
|
||||
src/dusk/data.hpp
|
||||
src/dusk/endian.cpp
|
||||
src/dusk/extras.c
|
||||
src/dusk/file_select.cpp
|
||||
@@ -1433,105 +1429,48 @@ set(DUSK_FILES
|
||||
src/dusk/globals.cpp
|
||||
src/dusk/gyro.cpp
|
||||
src/dusk/gamepad_color.cpp
|
||||
src/dusk/autosave.cpp
|
||||
src/dusk/http/http.hpp
|
||||
src/dusk/io.cpp
|
||||
src/dusk/layout.cpp
|
||||
src/dusk/logging.cpp
|
||||
src/dusk/settings.cpp
|
||||
src/dusk/speedrun.cpp
|
||||
src/dusk/string.cpp
|
||||
src/dusk/stubs.cpp
|
||||
src/dusk/update_check.cpp
|
||||
src/dusk/update_check.hpp
|
||||
#src/dusk/m_Do_ext_dusk.cpp
|
||||
src/dusk/imgui/ImGuiConfig.hpp
|
||||
src/dusk/imgui/ImGuiConsole.hpp
|
||||
src/dusk/imgui/ImGuiConsole.cpp
|
||||
src/dusk/imgui/ImGuiEngine.cpp
|
||||
src/dusk/imgui/ImGuiEngine.hpp
|
||||
src/dusk/imgui/ImGuiMenuGame.cpp
|
||||
src/dusk/imgui/ImGuiMenuGame.hpp
|
||||
src/dusk/imgui/ImGuiBloomWindow.cpp
|
||||
src/dusk/imgui/ImGuiBloomWindow.hpp
|
||||
src/dusk/imgui/ImGuiMenuTools.cpp
|
||||
src/dusk/imgui/ImGuiMenuTools.hpp
|
||||
src/dusk/imgui/ImGuiActorSpawner.cpp
|
||||
src/dusk/imgui/ImGuiPreLaunchWindow.cpp
|
||||
src/dusk/imgui/ImGuiPreLaunchWindow.hpp
|
||||
src/dusk/imgui/ImGuiFirstRunPreset.hpp
|
||||
src/dusk/imgui/ImGuiFirstRunPreset.cpp
|
||||
src/dusk/imgui/ImGuiProcessOverlay.cpp
|
||||
src/dusk/imgui/ImGuiCameraOverlay.cpp
|
||||
src/dusk/imgui/ImGuiHeapOverlay.cpp
|
||||
src/dusk/imgui/ImGuiActorSpawner.cpp
|
||||
src/dusk/imgui/ImGuiDebugPad.cpp
|
||||
src/dusk/imgui/ImGuiControllerOverlay.cpp
|
||||
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/ui/achievements.cpp
|
||||
src/dusk/ui/achievements.hpp
|
||||
src/dusk/ui/bool_button.cpp
|
||||
src/dusk/ui/bool_button.hpp
|
||||
src/dusk/ui/button.cpp
|
||||
src/dusk/ui/button.hpp
|
||||
src/dusk/ui/component.cpp
|
||||
src/dusk/ui/component.hpp
|
||||
src/dusk/ui/controller_config.cpp
|
||||
src/dusk/ui/controller_config.hpp
|
||||
src/dusk/ui/document.cpp
|
||||
src/dusk/ui/document.hpp
|
||||
src/dusk/ui/editor.cpp
|
||||
src/dusk/ui/editor.hpp
|
||||
src/dusk/ui/event.cpp
|
||||
src/dusk/ui/event.hpp
|
||||
src/dusk/ui/graphics_tuner.cpp
|
||||
src/dusk/ui/graphics_tuner.hpp
|
||||
src/dusk/ui/input.cpp
|
||||
src/dusk/ui/input.hpp
|
||||
src/dusk/ui/modal.cpp
|
||||
src/dusk/ui/modal.hpp
|
||||
src/dusk/ui/nav_types.hpp
|
||||
src/dusk/ui/number_button.cpp
|
||||
src/dusk/ui/number_button.hpp
|
||||
src/dusk/ui/overlay.cpp
|
||||
src/dusk/ui/overlay.hpp
|
||||
src/dusk/ui/pane.cpp
|
||||
src/dusk/ui/pane.hpp
|
||||
src/dusk/ui/menu_bar.cpp
|
||||
src/dusk/ui/menu_bar.hpp
|
||||
src/dusk/ui/prelaunch.cpp
|
||||
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
|
||||
src/dusk/ui/settings.hpp
|
||||
src/dusk/ui/string_button.cpp
|
||||
src/dusk/ui/string_button.hpp
|
||||
src/dusk/ui/tab_bar.cpp
|
||||
src/dusk/ui/tab_bar.hpp
|
||||
src/dusk/ui/ui.cpp
|
||||
src/dusk/ui/ui.hpp
|
||||
src/dusk/ui/warp.cpp
|
||||
src/dusk/ui/warp.hpp
|
||||
src/dusk/ui/window.cpp
|
||||
src/dusk/ui/window.hpp
|
||||
src/dusk/imgui/ImGuiAchievements.hpp
|
||||
src/dusk/imgui/ImGuiAchievements.cpp
|
||||
src/dusk/achievements.cpp
|
||||
src/dusk/iso_validate.cpp
|
||||
src/dusk/livesplit.cpp
|
||||
src/dusk/offset_ptr.cpp
|
||||
src/dusk/vmem.cpp
|
||||
src/dusk/OSContext.cpp
|
||||
src/dusk/OSReport.cpp
|
||||
src/dusk/OSThread.cpp
|
||||
src/dusk/OSMutex.cpp
|
||||
src/dusk/discord.cpp
|
||||
src/dusk/discord.hpp
|
||||
src/dusk/discord_presence.cpp
|
||||
src/dusk/version.cpp
|
||||
src/dusk/action_bindings.cpp
|
||||
)
|
||||
|
||||
set(DUSK_HTTP_BACKEND_FILES
|
||||
src/dusk/http/no_backend.cpp
|
||||
src/dusk/http/curl.cpp
|
||||
src/dusk/http/winhttp.cpp
|
||||
src/dusk/http/url_session.mm
|
||||
)
|
||||
|
||||
Generated
+3
-3
@@ -2,11 +2,11 @@
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1778869304,
|
||||
"narHash": "sha256-30sZNZoA1cqF5JNO9fVX+wgiQYjB7HJqqJ4ztCDeBZE=",
|
||||
"lastModified": 1775710090,
|
||||
"narHash": "sha256-ar3rofg+awPB8QXDaFJhJ2jJhu+KqN/PRCXeyuXR76E=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "d233902339c02a9c334e7e593de68855ad26c4cb",
|
||||
"rev": "4c1018dae018162ec878d42fec712642d214fdfa",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
@@ -1,374 +1,33 @@
|
||||
{
|
||||
description = "Dusklight — native PC port of the Twilight Princess decompilation";
|
||||
|
||||
inputs.nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
||||
|
||||
outputs =
|
||||
{ self, nixpkgs }:
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
||||
};
|
||||
outputs = { self, nixpkgs }:
|
||||
let
|
||||
inherit (nixpkgs) lib;
|
||||
|
||||
supportedSystems = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
"x86_64-darwin"
|
||||
"aarch64-darwin"
|
||||
];
|
||||
forAllSystems = lib.genAttrs supportedSystems;
|
||||
|
||||
dawnVersion = "v20260423.175430";
|
||||
nodVersion = "v2.0.0-alpha.8";
|
||||
versionSuffix = "nix-" + (self.shortRev or self.dirtyShortRev or "dirty");
|
||||
|
||||
dawnInfo = {
|
||||
"x86_64-linux" = {
|
||||
triple = "linux-x86_64";
|
||||
hash = "sha256-HXfKTLHtMPwupnFnaflCARtXVPuS/0PoCePXidjE5xs=";
|
||||
};
|
||||
"aarch64-linux" = {
|
||||
triple = "linux-aarch64";
|
||||
hash = "sha256-34yyFpfqBZUwoFXQ41F0AwAU78FaNihOSY0oriwn6B0=";
|
||||
};
|
||||
"aarch64-darwin" = {
|
||||
triple = "darwin-arm64";
|
||||
hash = "sha256-eQnzrBp6gjiBek1VYQ9A5W13ClYWrDDKjIqv/7eNTR4=";
|
||||
};
|
||||
"x86_64-darwin" = {
|
||||
triple = "darwin-x86_64";
|
||||
hash = "sha256-QGWiGdxiI9kci3NPXH6QFFirxn16851zB/w3jqhIBJ4=";
|
||||
};
|
||||
pkgs = import nixpkgs { system = "x86_64-linux"; };
|
||||
dusk = pkgs.stdenv.mkDerivation {
|
||||
name = "dusk";
|
||||
src = ./.;
|
||||
nativeBuildInputs = [
|
||||
pkgs.cmake
|
||||
pkgs.pkg-config
|
||||
pkgs.wayland
|
||||
];
|
||||
buildInputs = [
|
||||
pkgs.libGL
|
||||
pkgs.libX11
|
||||
pkgs.libXcursor
|
||||
pkgs.libxi
|
||||
pkgs.libxcb
|
||||
pkgs.libxrandr
|
||||
pkgs.libxscrnsaver
|
||||
pkgs.libxtst
|
||||
pkgs.libjpeg8
|
||||
pkgs.libxkbcommon
|
||||
pkgs.libglvnd
|
||||
];
|
||||
};
|
||||
|
||||
nodPrebuiltInfo = {
|
||||
"x86_64-linux" = {
|
||||
triple = "linux-x86_64";
|
||||
hash = "sha256-mUqvLsbsqaZ+HAjMmHYPYO+MgtanGRTw7Gzn5uXR5rE=";
|
||||
};
|
||||
"aarch64-darwin" = {
|
||||
triple = "macos-arm64";
|
||||
hash = "sha256-UPy1ywCcv0K6VJOU3uUelJuUdBh3UNaPRlyP5LOBeDw=";
|
||||
};
|
||||
};
|
||||
|
||||
perSystem =
|
||||
system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
inherit (pkgs.stdenv.hostPlatform) isDarwin;
|
||||
hasNodPrebuilt = nodPrebuiltInfo ? ${system};
|
||||
|
||||
aurora = pkgs.fetchFromGitHub {
|
||||
owner = "encounter";
|
||||
repo = "aurora";
|
||||
rev = "10006618ee493f248b8597e4dfa1d2871d76a1d9";
|
||||
hash = "sha256-lY2xuVyB7aPJ9+2wwLRB3F5U/BuPSxdSpegdG+qNd9o=";
|
||||
};
|
||||
|
||||
dawn = pkgs.fetchzip {
|
||||
url = "https://github.com/encounter/dawn-build/releases/download/${dawnVersion}/dawn-${dawnInfo.${system}.triple}.tar.gz";
|
||||
hash = dawnInfo.${system}.hash;
|
||||
stripRoot = false;
|
||||
};
|
||||
|
||||
corrosion = pkgs.fetchFromGitHub {
|
||||
owner = "corrosion-rs";
|
||||
repo = "corrosion";
|
||||
rev = "v0.6.1";
|
||||
hash = "sha256-ppuDNObfKhneD9AlnPAvyCRHKW3BidXKglD1j/LE9CM=";
|
||||
};
|
||||
|
||||
nodFromSource = pkgs.stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "nod";
|
||||
version = nodVersion;
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "encounter";
|
||||
repo = "nod";
|
||||
rev = nodVersion;
|
||||
hash = "sha256-+zrtVzjo0+X/6uMcNUn1+FaSR+jOhrcQSDNBFjw0NDs=";
|
||||
};
|
||||
cargoDeps = pkgs.rustPlatform.importCargoLock {
|
||||
lockFile = "${finalAttrs.src}/Cargo.lock";
|
||||
};
|
||||
postPatch = ''
|
||||
substituteInPlace CMakeLists.txt \
|
||||
--replace-warn "add_subdirectory(nod-ffi/examples)" ""
|
||||
'';
|
||||
nativeBuildInputs = [
|
||||
pkgs.cmake
|
||||
pkgs.ninja
|
||||
pkgs.rustPlatform.cargoSetupHook
|
||||
pkgs.cargo
|
||||
pkgs.rustc
|
||||
];
|
||||
CARGO_NET_OFFLINE = "true";
|
||||
cmakeFlags = [
|
||||
"-DFETCHCONTENT_FULLY_DISCONNECTED=ON"
|
||||
"-DFETCHCONTENT_SOURCE_DIR_CORROSION=${corrosion}"
|
||||
"-DNOD_ENABLE_INSTALL=ON"
|
||||
"-DBUILD_SHARED_LIBS=OFF"
|
||||
];
|
||||
doCheck = false;
|
||||
});
|
||||
|
||||
nod =
|
||||
if hasNodPrebuilt then
|
||||
pkgs.fetchzip {
|
||||
url = "https://github.com/encounter/nod/releases/download/${nodVersion}/libnod-${
|
||||
nodPrebuiltInfo.${system}.triple
|
||||
}.tar.gz";
|
||||
hash = nodPrebuiltInfo.${system}.hash;
|
||||
stripRoot = false;
|
||||
}
|
||||
else
|
||||
nodFromSource;
|
||||
|
||||
fetchContentDirs = {
|
||||
DAWN_PREBUILT = dawn;
|
||||
NOD_PREBUILT = nod;
|
||||
CXXOPTS = pkgs.cxxopts.src;
|
||||
JSON = pkgs.nlohmann_json.src;
|
||||
XXHASH = pkgs.xxHash.src;
|
||||
ZSTD = pkgs.zstd.src;
|
||||
FMT = pkgs.fetchzip {
|
||||
url = "https://github.com/fmtlib/fmt/archive/refs/tags/11.1.4.tar.gz";
|
||||
hash = "sha256-sUbxlYi/Aupaox3JjWFqXIjcaQa0LFjclQAOleT+FRA=";
|
||||
};
|
||||
TRACY = pkgs.fetchzip {
|
||||
url = "https://github.com/wolfpld/tracy/archive/a64b9a20294d59421a2f57aeca3c6383d8c48169.tar.gz";
|
||||
hash = "sha256-hbNGOsGeyGSvCJ2No8RkwOib1lX2on3vNZSzyVkZdXw=";
|
||||
};
|
||||
IMGUI = pkgs.fetchFromGitHub {
|
||||
owner = "ocornut";
|
||||
repo = "imgui";
|
||||
rev = "v1.91.9b-docking";
|
||||
hash = "sha256-mQOJ6jCN+7VopgZ61yzaCnt4R1QLrW7+47xxMhFRHLQ=";
|
||||
};
|
||||
SQLITE3 = pkgs.fetchzip {
|
||||
url = "https://sqlite.org/2026/sqlite-amalgamation-3510300.zip";
|
||||
hash = "sha256-pNMR8zxaaqfAzQ0AQBOXMct4usdjey1Q0Gnitg06UhM=";
|
||||
};
|
||||
RMLUI = pkgs.fetchzip {
|
||||
url = "https://github.com/mikke89/RmlUi/archive/f9b8c9e2935d5df2c7dff2c190d3968e99b0c3dc.tar.gz";
|
||||
hash = "sha256-g4O/JZUrrcseOz8o2QJRt+2CeuiLnVeuDJc906xvuIg=";
|
||||
};
|
||||
};
|
||||
|
||||
dusklight = pkgs.stdenv.mkDerivation {
|
||||
pname = "dusklight";
|
||||
version = versionSuffix;
|
||||
src = ./.;
|
||||
|
||||
postUnpack = ''
|
||||
chmod -R u+w "$sourceRoot"
|
||||
rm -rf "$sourceRoot/extern/aurora"
|
||||
mkdir -p "$sourceRoot/extern"
|
||||
cp -r ${aurora} "$sourceRoot/extern/aurora"
|
||||
chmod -R u+w "$sourceRoot/extern/aurora"
|
||||
substituteInPlace "$sourceRoot/extern/aurora/CMakeLists.txt" \
|
||||
--replace-warn "add_subdirectory(tests)" ""
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [
|
||||
pkgs.cmake
|
||||
pkgs.ninja
|
||||
pkgs.pkg-config
|
||||
pkgs.python3
|
||||
pkgs.python3Packages.markupsafe
|
||||
]
|
||||
++ lib.optionals (!isDarwin) [ pkgs.autoPatchelfHook ];
|
||||
|
||||
buildInputs = [
|
||||
pkgs.sdl3
|
||||
pkgs.freetype
|
||||
pkgs.zstd
|
||||
pkgs.cxxopts
|
||||
pkgs.nlohmann_json
|
||||
pkgs.xxHash
|
||||
pkgs.abseil-cpp
|
||||
pkgs.zlib
|
||||
pkgs.libpng
|
||||
pkgs.libjpeg_turbo
|
||||
pkgs.curl
|
||||
pkgs.openssl
|
||||
]
|
||||
++ lib.optionals isDarwin [
|
||||
pkgs.apple-sdk_15
|
||||
pkgs.libiconv
|
||||
]
|
||||
++ lib.optionals (!isDarwin) [
|
||||
pkgs.libGL
|
||||
pkgs.libGLU
|
||||
pkgs.libglvnd
|
||||
pkgs.vulkan-loader
|
||||
pkgs.libX11
|
||||
pkgs.libxcb
|
||||
pkgs.libXcursor
|
||||
pkgs.libxi
|
||||
pkgs.libxrandr
|
||||
pkgs.libxscrnsaver
|
||||
pkgs.libxtst
|
||||
pkgs.libxinerama
|
||||
pkgs.libxkbcommon
|
||||
pkgs.wayland
|
||||
pkgs.libdecor
|
||||
pkgs.alsa-lib
|
||||
pkgs.libpulseaudio
|
||||
pkgs.pipewire
|
||||
pkgs.dbus
|
||||
pkgs.udev
|
||||
pkgs.libusb1
|
||||
pkgs.libunwind
|
||||
pkgs.gtk3
|
||||
];
|
||||
|
||||
cmakeBuildType = "RelWithDebInfo";
|
||||
ninjaFlags = [ "dusklight" ];
|
||||
|
||||
cmakeFlags = [
|
||||
"-DDUSK_VERSION_OVERRIDE=${versionSuffix}"
|
||||
"-DFETCHCONTENT_FULLY_DISCONNECTED=ON"
|
||||
"-DAURORA_DAWN_PROVIDER=package"
|
||||
"-DAURORA_DAWN_LINKAGE=static"
|
||||
"-DAURORA_NOD_PROVIDER=package"
|
||||
"-DAURORA_NOD_LINKAGE=static"
|
||||
"-DAURORA_SDL3_PROVIDER=system"
|
||||
]
|
||||
++ lib.mapAttrsToList (key: src: "-DFETCHCONTENT_SOURCE_DIR_${key}=${src}") fetchContentDirs;
|
||||
|
||||
installPhase =
|
||||
if isDarwin then
|
||||
''
|
||||
runHook preInstall
|
||||
mkdir -p "$out/Applications"
|
||||
cp -r Dusklight.app "$out/Applications/Dusklight.app"
|
||||
runHook postInstall
|
||||
''
|
||||
else
|
||||
''
|
||||
runHook preInstall
|
||||
install -Dm755 dusklight "$out/bin/dusklight"
|
||||
cp -r "$src/res" "$out/bin/res"
|
||||
install -Dm644 "$src/platforms/freedesktop/dev.twilitrealm.dusk.desktop" \
|
||||
"$out/share/applications/dev.twilitrealm.dusk.desktop"
|
||||
for size in 16 32 48 64 128 256 512 1024; do
|
||||
install -Dm644 "$src/platforms/freedesktop/''${size}x''${size}/apps/dev.twilitrealm.dusk.png" \
|
||||
"$out/share/icons/hicolor/''${size}x''${size}/apps/dev.twilitrealm.dusk.png"
|
||||
done
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
dontStrip = true;
|
||||
|
||||
meta = {
|
||||
description = "Dusklight — native PC port of the Twilight Princess decompilation";
|
||||
homepage = "https://github.com/zeldaret/tp";
|
||||
platforms = supportedSystems;
|
||||
mainProgram = "dusklight";
|
||||
};
|
||||
};
|
||||
|
||||
# Tooling common to every supported host (Linux and macOS).
|
||||
commonDevTools = [
|
||||
pkgs.cmake
|
||||
pkgs.ninja
|
||||
pkgs.pkg-config
|
||||
pkgs.git
|
||||
pkgs.python3
|
||||
pkgs.python3Packages.markupsafe
|
||||
pkgs.rustc
|
||||
pkgs.cargo
|
||||
pkgs.sccache
|
||||
];
|
||||
|
||||
# Linux-only system libraries — mirrors the apt deps from .github/workflows/build.yml
|
||||
# so the cmake presets resolve the same set of headers as CI.
|
||||
linuxDevDeps = [
|
||||
# Compilers / linkers
|
||||
pkgs.clang
|
||||
pkgs.lld
|
||||
# C/C++ utilities
|
||||
pkgs.curl
|
||||
pkgs.openssl
|
||||
pkgs.zlib
|
||||
pkgs.libpng
|
||||
pkgs.libjpeg_turbo
|
||||
pkgs.freetype
|
||||
pkgs.zstd
|
||||
pkgs.fmt
|
||||
pkgs.tracy
|
||||
pkgs.cxxopts
|
||||
pkgs.abseil-cpp
|
||||
pkgs.sdl3
|
||||
pkgs.ncurses
|
||||
pkgs.libunwind
|
||||
pkgs.libusb1
|
||||
pkgs.fuse
|
||||
# Wayland / display server
|
||||
pkgs.wayland
|
||||
pkgs.wayland-protocols
|
||||
pkgs.libxkbcommon
|
||||
pkgs.libdecor
|
||||
# OpenGL / Vulkan
|
||||
pkgs.libGL
|
||||
pkgs.libGLU
|
||||
pkgs.libglvnd
|
||||
pkgs.vulkan-headers
|
||||
pkgs.vulkan-loader
|
||||
# X11
|
||||
pkgs.libX11
|
||||
pkgs.libxcb
|
||||
pkgs.libXcursor
|
||||
pkgs.libxi
|
||||
pkgs.libxrandr
|
||||
pkgs.libxscrnsaver
|
||||
pkgs.libxtst
|
||||
pkgs.libxinerama
|
||||
# Audio
|
||||
pkgs.alsa-lib
|
||||
pkgs.libpulseaudio
|
||||
pkgs.pipewire
|
||||
# System integration
|
||||
pkgs.dbus
|
||||
pkgs.udev
|
||||
pkgs.gtk3
|
||||
];
|
||||
|
||||
# On macOS we deliberately avoid pulling Nix's cc-wrapper so CMake picks up
|
||||
# Apple Clang and the Xcode SDK directly, matching the macOS CI workflow.
|
||||
darwinShell = pkgs.mkShellNoCC {
|
||||
packages = commonDevTools;
|
||||
shellHook = ''
|
||||
echo "Dusklight dev shell (macOS)"
|
||||
echo "Requires Xcode Command Line Tools for Apple Clang and the macOS SDK."
|
||||
echo "Configure: cmake --preset macos-default-relwithdebinfo"
|
||||
echo "Build: cmake --build --preset macos-default-relwithdebinfo"
|
||||
'';
|
||||
};
|
||||
|
||||
linuxShell = pkgs.mkShell {
|
||||
packages = commonDevTools ++ linuxDevDeps;
|
||||
shellHook = ''
|
||||
echo "Dusklight dev shell (Linux)"
|
||||
echo "Configure: cmake --preset linux-default-relwithdebinfo"
|
||||
echo " cmake --preset linux-clang-relwithdebinfo"
|
||||
echo "Build: cmake --build --preset <preset>"
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
packages = {
|
||||
default = dusklight;
|
||||
dusklight = dusklight;
|
||||
}
|
||||
// lib.optionalAttrs (!hasNodPrebuilt) { nod = nodFromSource; };
|
||||
|
||||
devShells.default = if isDarwin then darwinShell else linuxShell;
|
||||
};
|
||||
|
||||
systems = forAllSystems perSystem;
|
||||
in
|
||||
{
|
||||
packages = lib.mapAttrs (_: s: s.packages) systems;
|
||||
devShells = lib.mapAttrs (_: s: s.devShells) systems;
|
||||
in {
|
||||
packages.x86_64-linux.default = dusk;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4552,19 +4552,6 @@ public:
|
||||
void handleWolfHowl();
|
||||
void handleQuickTransform();
|
||||
bool checkGyroAimContext();
|
||||
|
||||
void onIronBallChainInterpCallback();
|
||||
|
||||
static const int IRON_BALL_CHAIN_COUNT = 102;
|
||||
cXyz mIBChainInterpPrevPos[IRON_BALL_CHAIN_COUNT];
|
||||
cXyz mIBChainInterpCurrPos[IRON_BALL_CHAIN_COUNT];
|
||||
csXyz mIBChainInterpPrevAngle[IRON_BALL_CHAIN_COUNT];
|
||||
csXyz mIBChainInterpCurrAngle[IRON_BALL_CHAIN_COUNT];
|
||||
cXyz mIBChainInterpPrevHandRoot;
|
||||
cXyz mIBChainInterpCurrHandRoot;
|
||||
bool mIBChainInterpPrevValid;
|
||||
bool mIBChainInterpCurrValid;
|
||||
bool mIsRollstab = false;
|
||||
#endif
|
||||
}; // Size: 0x385C
|
||||
|
||||
|
||||
@@ -80,12 +80,6 @@ public:
|
||||
/* 0x125C */ u32 field_0x125c;
|
||||
/* 0x1260 */ u8 field_0x1260[0x126C - 0x1260];
|
||||
/* 0x126C */ u8 HIOInit;
|
||||
#if TARGET_PC
|
||||
cXyz mStalkLineInterpPrev[12];
|
||||
cXyz mStalkLineInterpCurr[12];
|
||||
bool mStalkLineInterpPrevValid;
|
||||
bool mStalkLineInterpCurrValid;
|
||||
#endif
|
||||
};
|
||||
|
||||
STATIC_ASSERT(sizeof(e_db_class) == 0x1270);
|
||||
|
||||
@@ -73,12 +73,6 @@ public:
|
||||
/* 0x124C */ f32 field_0x124c;
|
||||
/* 0x1250 */ u8 field_0x1250[0x1264 - 0x1250];
|
||||
/* 0x1264 */ u8 HIOInit;
|
||||
#if TARGET_PC
|
||||
cXyz mStalkLineInterpPrev[12];
|
||||
cXyz mStalkLineInterpCurr[12];
|
||||
bool mStalkLineInterpPrevValid;
|
||||
bool mStalkLineInterpCurrValid;
|
||||
#endif
|
||||
};
|
||||
|
||||
STATIC_ASSERT(sizeof(e_hb_class) == 0x1268);
|
||||
|
||||
@@ -81,15 +81,6 @@ public:
|
||||
/* 0x306D */ u8 field_0x306D[0x307C - 0x306D];
|
||||
/* 0x307C */ u32 mBodyEffEmtrID;
|
||||
/* 0x3080 */ u8 mInitHIO;
|
||||
|
||||
#if TARGET_PC
|
||||
static const int HAIR_STRAND_COUNT = 22;
|
||||
static const int HAIR_SEGMENT_COUNT = 16;
|
||||
cXyz mHairInterpPrev[HAIR_STRAND_COUNT * HAIR_SEGMENT_COUNT];
|
||||
cXyz mHairInterpCurr[HAIR_STRAND_COUNT * HAIR_SEGMENT_COUNT];
|
||||
bool mHairInterpPrevValid;
|
||||
bool mHairInterpCurrValid;
|
||||
#endif
|
||||
};
|
||||
|
||||
STATIC_ASSERT(sizeof(e_s1_class) == 0x3084);
|
||||
|
||||
@@ -74,12 +74,6 @@ public:
|
||||
/* 0x1250 */ f32 field_0x1250;
|
||||
/* 0x1254 */ u8 field_0x1254[0x1268 - 0x1254];
|
||||
/* 0x1268 */ u8 field_0x1268;
|
||||
#if TARGET_PC
|
||||
cXyz mLineMatInterpPrev[12];
|
||||
cXyz mLineMatInterpCurr[12];
|
||||
bool mLineMatInterpPrevValid;
|
||||
bool mLineMatInterpCurrValid;
|
||||
#endif
|
||||
};
|
||||
|
||||
STATIC_ASSERT(sizeof(e_yd_class) == 0x126c);
|
||||
|
||||
@@ -63,15 +63,6 @@ public:
|
||||
/* 0x0BB4 */ yg_ke_s mYgKes[13];
|
||||
/* 0x1880 */ mDoExt_3DlineMat0_c mLineMat;
|
||||
/* 0x189C */ u8 mIsFirstSpawn;
|
||||
|
||||
#if TARGET_PC
|
||||
static const int TENTACLE_STRAND_COUNT = 13;
|
||||
static const int TENTACLE_SEGMENT_COUNT = 10;
|
||||
cXyz mTentacleInterpPrev[TENTACLE_STRAND_COUNT * TENTACLE_SEGMENT_COUNT];
|
||||
cXyz mTentacleInterpCurr[TENTACLE_STRAND_COUNT * TENTACLE_SEGMENT_COUNT];
|
||||
bool mTentacleInterpPrevValid;
|
||||
bool mTentacleInterpCurrValid;
|
||||
#endif
|
||||
};
|
||||
|
||||
STATIC_ASSERT(sizeof(e_yg_class) == 0x18a0);
|
||||
|
||||
@@ -77,12 +77,6 @@ public:
|
||||
/* 0x1260 */ u32 field_0x1260;
|
||||
/* 0x1260 */ u8 field_0x1264[0x1270 - 0x1264];
|
||||
/* 0x1270 */ bool mIsHIOOwner;
|
||||
#if TARGET_PC
|
||||
cXyz mLineInterpPrev[12];
|
||||
cXyz mLineInterpCurr[12];
|
||||
bool mLineInterpPrevValid;
|
||||
bool mLineInterpCurrValid;
|
||||
#endif
|
||||
};
|
||||
|
||||
STATIC_ASSERT(sizeof(e_yh_class) == 0x1274);
|
||||
|
||||
@@ -27,7 +27,6 @@ public:
|
||||
/* 0x17C */ cXyz mViewScale;
|
||||
#if TARGET_PC
|
||||
bool mbReset = false;
|
||||
bool mbHadEntry = false;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include <thp.h>
|
||||
#else
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
#endif
|
||||
#include "f_op/f_op_actor.h"
|
||||
#include "d/d_drawlist.h"
|
||||
@@ -126,7 +125,6 @@ struct daMP_THPPlayer {
|
||||
/* 0x0D4 */ s32 curCount;
|
||||
#if TARGET_PC
|
||||
/* 0x0D8 */ std::atomic<s32> videoDecodeCount;
|
||||
std::chrono::steady_clock::time_point thpPlaybackClock;
|
||||
#else
|
||||
/* 0x0D8 */ s32 videoDecodeCount;
|
||||
#endif
|
||||
|
||||
@@ -31,10 +31,6 @@ public:
|
||||
csXyz* getAngle() { return field_0x8a4; }
|
||||
J3DModelData* getModelData() { return mModelData; }
|
||||
|
||||
#if TARGET_PC
|
||||
void onInterpCallback();
|
||||
#endif
|
||||
|
||||
private:
|
||||
/* 0x568 */ request_of_phase_process_class mPhase;
|
||||
/* 0x570 */ J3DModelData* mModelData;
|
||||
@@ -46,14 +42,6 @@ private:
|
||||
/* 0x694 */ cXyz field_0x694[22];
|
||||
/* 0x79C */ cXyz field_0x79c[22];
|
||||
/* 0x8A4 */ csXyz field_0x8a4[22];
|
||||
|
||||
#if TARGET_PC
|
||||
static const int CHAIN_COUNT = 22;
|
||||
cXyz mChainInterpPrev[CHAIN_COUNT];
|
||||
cXyz mChainInterpCurr[CHAIN_COUNT];
|
||||
bool mChainInterpPrevValid;
|
||||
bool mChainInterpCurrValid;
|
||||
#endif
|
||||
};
|
||||
|
||||
STATIC_ASSERT(sizeof(daObjFchain_c) == 0x928);
|
||||
|
||||
@@ -25,10 +25,6 @@ public:
|
||||
int Draw();
|
||||
int Delete();
|
||||
|
||||
#if TARGET_PC
|
||||
void onInterpCallback();
|
||||
#endif
|
||||
|
||||
enum Param_e {
|
||||
LOCK_e = (1 << 6), NO_BASE_DISP = (1 << 7)
|
||||
};
|
||||
@@ -54,13 +50,6 @@ private:
|
||||
/* 0x1020 */ dCcD_Cyl mCylinderCollider;
|
||||
/* 0x115C */ s32 mStopSwingingFrames;
|
||||
|
||||
#if TARGET_PC
|
||||
cXyz mChainInterpPrev[64];
|
||||
cXyz mChainInterpCurr[64];
|
||||
bool mChainInterpPrevValid;
|
||||
bool mChainInterpCurrValid;
|
||||
#endif
|
||||
|
||||
// Number of chain models
|
||||
u32 getArg0() {
|
||||
return fopAcM_GetParamBit(this, 0, 6);
|
||||
|
||||
@@ -77,7 +77,7 @@ private:
|
||||
#define PLAYER_CREATE_ANM_HEAP_F(heap, type, fmt, ...) \
|
||||
{ \
|
||||
char pcah_name_buf[32]; \
|
||||
snprintf(pcah_name_buf, sizeof(pcah_name_buf), fmt, ##__VA_ARGS__); \
|
||||
sprintf(pcah_name_buf, fmt, ##__VA_ARGS__); \
|
||||
(heap).createHeap(type, pcah_name_buf); \
|
||||
\
|
||||
}
|
||||
|
||||
+12
-28
@@ -118,18 +118,6 @@ class camera_class;
|
||||
class dCamera_c;
|
||||
typedef bool (dCamera_c::*engine_fn)(s32);
|
||||
|
||||
#if TARGET_PC
|
||||
struct DebugFlyCam {
|
||||
bool initialized;
|
||||
f32 pitch;
|
||||
f32 yaw;
|
||||
cXyz savedCenter;
|
||||
cXyz savedEye;
|
||||
f32 savedFovy;
|
||||
cSAngle savedBank;
|
||||
};
|
||||
#endif
|
||||
|
||||
class dCamera_c {
|
||||
public:
|
||||
class dCamInfo_c {
|
||||
@@ -444,7 +432,8 @@ public:
|
||||
/* 0x1C */ f32 mFovy;
|
||||
/* 0x20 */ f32 mBank;
|
||||
/* 0x24 */ fopAc_ac_c* mRelActor;
|
||||
/* 0x28 */ char mRelUseMask[4];
|
||||
/* 0x28 */ char mRelUseMask;
|
||||
/* 0x29 */ char field_0x29;
|
||||
/* 0x2C */ int mTimer;
|
||||
/* 0x30 */ bool field_0x30;
|
||||
/* 0x34 */ cXyz mBasePos;
|
||||
@@ -525,7 +514,7 @@ public:
|
||||
/* 0x3C */ fopAc_ac_c* field_0x3c;
|
||||
/* 0x40 */ fopAc_ac_c* field_0x40;
|
||||
/* 0x44 */ fpc_ProcID field_0x44;
|
||||
/* 0x48 */ char field_0x48[4];
|
||||
/* 0x48 */ char field_0x48;
|
||||
/* 0x4C */ int field_0x4c;
|
||||
};
|
||||
|
||||
@@ -540,7 +529,11 @@ public:
|
||||
/* 0x3C */ f32 field_0x3c;
|
||||
/* 0x40 */ fopAc_ac_c* mRelActor;
|
||||
/* 0x44 */ fpc_ProcID mRelActorID;
|
||||
/* 0x48 */ char mRelUseMask[8];
|
||||
/* 0x48 */ char mRelUseMask;
|
||||
/* 0x49 */ char field_0x49;
|
||||
/* 0x4A */ char field_0x4a;
|
||||
/* 0x4B */ char field_0x4b;
|
||||
/* 0x4C */ u8 field_0x4c[4];
|
||||
/* 0x50 */ int mTimer;
|
||||
/* 0x54 */ int mTransType;
|
||||
/* 0x58 */ f32 mCushion;
|
||||
@@ -691,7 +684,8 @@ public:
|
||||
/* 0x24 */ f32* field_0x24;
|
||||
/* 0x28 */ f32 field_0x28;
|
||||
/* 0x2C */ fopAc_ac_c* mRelActor;
|
||||
/* 0x30 */ char mRelUseMask[4];
|
||||
/* 0x30 */ char mRelUseMask;
|
||||
/* 0x31 */ char field_0x31;
|
||||
/* 0x34 */ int mTimer;
|
||||
/* 0x38 */ int field_0x38;
|
||||
/* 0x3C */ int mChoice;
|
||||
@@ -774,7 +768,8 @@ public:
|
||||
/* 0xAC */ f32 field_0xac;
|
||||
/* 0xB0 */ fopAc_ac_c* mRelActor;
|
||||
/* 0xB4 */ fpc_ProcID mRelActorID;
|
||||
/* 0xB8 */ char mRelUseMask[4];
|
||||
/* 0xB8 */ char mRelUseMask;
|
||||
/* 0xB9 */ char field_0xb9;
|
||||
/* 0xBC */ f32 mCushion;
|
||||
/* 0xC0 */ u32 field_0xc0[6];
|
||||
};
|
||||
@@ -910,12 +905,7 @@ public:
|
||||
char* getEvStringPntData(char*, char*);
|
||||
char* getEvStringPntData(char*);
|
||||
bool getEvXyzData(cXyz*, char*, cXyz);
|
||||
#if TARGET_PC
|
||||
template<size_t N>
|
||||
bool getEvStringData(char (&)[N], char*, char*);
|
||||
#else
|
||||
bool getEvStringData(char*, char*, char*);
|
||||
#endif
|
||||
fopAc_ac_c* getEvActor(char*);
|
||||
fopAc_ac_c* getEvActor(char*, char*);
|
||||
bool pauseEvCamera();
|
||||
@@ -1038,8 +1028,6 @@ public:
|
||||
bool test2Camera(s32);
|
||||
#if TARGET_PC
|
||||
bool freeCamera();
|
||||
bool executeDebugFlyCam();
|
||||
void deactivateDebugFlyCam();
|
||||
#endif
|
||||
bool towerCamera(s32);
|
||||
bool hookshotCamera(s32);
|
||||
@@ -1388,10 +1376,6 @@ public:
|
||||
/* 0x970 */ dCamSetup_c mCamSetup;
|
||||
/* 0xAEC */ dCamParam_c mCamParam;
|
||||
/* 0xB0C */ u8 field_0xb0c;
|
||||
|
||||
#if TARGET_PC
|
||||
DebugFlyCam mDebugFlyCam;
|
||||
#endif
|
||||
}; // Size: 0xB10
|
||||
|
||||
dCamera_c* dCam_getBody();
|
||||
|
||||
@@ -1845,13 +1845,7 @@ inline void dComIfGs_addDeathCount() {
|
||||
g_dComIfG_gameInfo.info.getPlayer().getPlayerInfo().addDeathCount();
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
inline u16 dComIfGs_getDeathCount() {
|
||||
return g_dComIfG_gameInfo.info.getPlayer().getPlayerInfo().getDeathCount();
|
||||
}
|
||||
#endif
|
||||
|
||||
inline TEXT_SPAN dComIfGs_getPlayerName() {
|
||||
inline char* dComIfGs_getPlayerName() {
|
||||
return g_dComIfG_gameInfo.info.getPlayer().getPlayerInfo().getPlayerName();
|
||||
}
|
||||
|
||||
@@ -1859,7 +1853,7 @@ inline void dComIfGs_setPlayerName(const char* i_name) {
|
||||
g_dComIfG_gameInfo.info.getPlayer().getPlayerInfo().setPlayerName(i_name);
|
||||
}
|
||||
|
||||
inline TEXT_SPAN dComIfGs_getHorseName() {
|
||||
inline char* dComIfGs_getHorseName() {
|
||||
return g_dComIfG_gameInfo.info.getPlayer().getPlayerInfo().getHorseName();
|
||||
}
|
||||
|
||||
|
||||
@@ -196,11 +196,7 @@ public:
|
||||
/* 0x108 */ int mSkipTimer;
|
||||
/* 0x10C */ int mSkipParameter;
|
||||
/* 0x110 */ BOOL mIsSkipFade;
|
||||
#if TARGET_PC
|
||||
/* 0x114 */ char mSkipEventName[21];
|
||||
#else
|
||||
/* 0x114 */ char mSkipEventName[20];
|
||||
#endif
|
||||
/* 0x128 */ u8 mCompulsory;
|
||||
/* 0x129 */ bool mRoomInfoSet;
|
||||
/* 0x12C */ int mRoomNo;
|
||||
|
||||
@@ -46,10 +46,10 @@ private:
|
||||
/* 0x22 */ u8 field_0x22;
|
||||
/* 0x24 */ CPaneMgrAlpha* mDatBase;
|
||||
/* 0x28 */ CPaneMgrAlpha* mNoDatBase;
|
||||
/* 0x2C */ TEXT_SPAN mPlayerName;
|
||||
/* 0x30 */ TEXT_SPAN mSaveDate;
|
||||
/* 0x34 */ TEXT_SPAN mPlayTime;
|
||||
/* 0x38 */ TEXT_SPAN mSaveStatus;
|
||||
/* 0x2C */ char* mPlayerName;
|
||||
/* 0x30 */ char* mSaveDate;
|
||||
/* 0x34 */ char* mPlayTime;
|
||||
/* 0x38 */ char* mSaveStatus;
|
||||
};
|
||||
|
||||
typedef void (dFile_info_c::*warningFunc)(void);
|
||||
|
||||
@@ -11,42 +11,7 @@
|
||||
|
||||
class dFile_info_c;
|
||||
class J2DPicture;
|
||||
#if TARGET_PC
|
||||
static bool cachedPanes = false;
|
||||
|
||||
struct PaneCache {
|
||||
u64 tag;
|
||||
f32 origTransX;
|
||||
f32 origTransY;
|
||||
bool cached;
|
||||
};
|
||||
|
||||
static PaneCache mSelDtPanes[] = {
|
||||
{MULTI_CHAR('tate_n0'), 0.0f, false},
|
||||
{MULTI_CHAR('tate_n1'), 0.0f, false},
|
||||
{MULTI_CHAR('ken_n0'), 0.0f, false},
|
||||
{MULTI_CHAR('ken_n1'), 0.0f, false},
|
||||
{MULTI_CHAR('fuku_n0'), 0.0f, false},
|
||||
{MULTI_CHAR('fuku_n1'), 0.0f, false},
|
||||
{MULTI_CHAR('fuku_n2'), 0.0f, false},
|
||||
{MULTI_CHAR('gray_n'), 0.0f, false},
|
||||
{MULTI_CHAR('b_base'), 0.0f, false},
|
||||
{MULTI_CHAR('b_base1'), 0.0f, false},
|
||||
};
|
||||
|
||||
static PaneCache fileSelPanes[] = {
|
||||
{MULTI_CHAR('w_uzu00'), 0.0f, false},
|
||||
{MULTI_CHAR('w_uzu01'), 0.0f, false},
|
||||
{MULTI_CHAR('w_uzu02'), 0.0f, false},
|
||||
{MULTI_CHAR('w_uzu03'), 0.0f, false},
|
||||
{MULTI_CHAR('w_uzu04'), 0.0f, false},
|
||||
{MULTI_CHAR('w_uzu05'), 0.0f, false},
|
||||
{MULTI_CHAR('w_uzu06'), 0.0f, false},
|
||||
{MULTI_CHAR('w_uzu07'), 0.0f, false},
|
||||
{MULTI_CHAR('w_uzu08'), 0.0f, false},
|
||||
{MULTI_CHAR('w_uzu09'), 0.0f, false},
|
||||
};
|
||||
#endif
|
||||
class dDlst_FileSel_c : public dDlst_base_c {
|
||||
public:
|
||||
void draw();
|
||||
@@ -565,7 +530,7 @@ public:
|
||||
/* 0x0130 */ int field_0x0130;
|
||||
/* 0x0134 */ int field_0x0134;
|
||||
/* 0x0138 */ CPaneMgrAlpha* mErrorMsgTxtPane[2];
|
||||
/* 0x0140 */ TEXT_SPAN mErrorMsgStringPtr[2];
|
||||
/* 0x0140 */ char* mErrorMsgStringPtr[2];
|
||||
/* 0x0148 */ u8 mErrorTxtDispIdx;
|
||||
/* 0x0149 */ u8 field_0x0149;
|
||||
/* 0x014A */ bool field_0x014a;
|
||||
@@ -609,7 +574,7 @@ public:
|
||||
/* 0x020A */ u8 mFadeTimer;
|
||||
/* 0x020B */ u8 field_0x020b;
|
||||
/* 0x020C */ CPaneMgrAlpha* mHeaderTxtPane[2];
|
||||
/* 0x0214 */ TEXT_SPAN mHeaderStringPtr[2];
|
||||
/* 0x0214 */ char* mHeaderStringPtr[2];
|
||||
/* 0x021C */ u8 mHeaderTxtDispIdx;
|
||||
/* 0x021D */ u8 field_0x021d;
|
||||
/* 0x021E */ u8 field_0x021e;
|
||||
@@ -626,7 +591,7 @@ public:
|
||||
/* 0x024B */ u8 field_0x024b;
|
||||
/* 0x024C */ u8 field_0x024c;
|
||||
/* 0x024B */ u8 field_0x024d[3];
|
||||
/* 0x0250 */ TEXT_SPAN mModoruStringPtr;
|
||||
/* 0x0250 */ char* mModoruStringPtr;
|
||||
/* 0x0254 */ STControl* stick;
|
||||
/* 0x0258 */ u8 mIsDataNew[3];
|
||||
/* 0x025B */ u8 mIsNoData[3];
|
||||
|
||||
@@ -223,9 +223,6 @@ private:
|
||||
/* 0x8F */ u8 field_0x8f;
|
||||
/* 0x90 */ u8 field_0x90;
|
||||
/* 0x91 */ u8 field_0x91;
|
||||
#if TARGET_PC
|
||||
bool previousMirror;
|
||||
#endif
|
||||
}; // Size: 0x94
|
||||
|
||||
class dMap_HIO_list_c : public dMpath_HIO_n::hioList_c {
|
||||
|
||||
@@ -15,49 +15,6 @@ class dMenu_Fishing_c;
|
||||
class dMenu_Skill_c;
|
||||
class dMenu_Insect_c;
|
||||
class dSelect_cursor_c;
|
||||
#if TARGET_PC
|
||||
static bool cachedPanes = false;
|
||||
|
||||
struct PaneCache {
|
||||
u64 tag;
|
||||
f32 origTransX;
|
||||
f32 origTransY;
|
||||
bool cached;
|
||||
};
|
||||
|
||||
static PaneCache mpScreenPanes[] = {
|
||||
{MULTI_CHAR('sa_tex_n'), 0.0f, false},
|
||||
{MULTI_CHAR('op_tex_n'), 0.0f, false},
|
||||
{MULTI_CHAR('heart_n'), 0.0f, false},
|
||||
{MULTI_CHAR('wolf_n'), 0.0f, false},
|
||||
{MULTI_CHAR('item_0_n'), 0.0f, false},
|
||||
{MULTI_CHAR('item_1_n'), 0.0f, false},
|
||||
{MULTI_CHAR('item_2_n'), 0.0f, false},
|
||||
{MULTI_CHAR('fish_3_n'), 0.0f, false},
|
||||
{MULTI_CHAR('lett_4_n'), 0.0f, false},
|
||||
{MULTI_CHAR('maki_5_n'), 0.0f, false},
|
||||
{MULTI_CHAR('fuku_n0'), 0.0f, false},
|
||||
{MULTI_CHAR('fuku_n1'), 0.0f, false},
|
||||
{MULTI_CHAR('fuku_n2'), 0.0f, false},
|
||||
{MULTI_CHAR('tate_n0'), 0.0f, false},
|
||||
{MULTI_CHAR('tate_n1'), 0.0f, false},
|
||||
{MULTI_CHAR('ken_n0'), 0.0f, false},
|
||||
{MULTI_CHAR('ken_n1'), 0.0f, false},
|
||||
{MULTI_CHAR('kabu_6n'), 0.0f, false},
|
||||
{MULTI_CHAR('t_t00'), 0.0f, false},
|
||||
{MULTI_CHAR('f_t00'), 0.0f, false},
|
||||
{MULTI_CHAR('itemn_n'), 0.0f, false},
|
||||
{MULTI_CHAR('infotxtn'), 0.0f, false},
|
||||
{MULTI_CHAR('sa_op_n'), 0.0f, false},
|
||||
{MULTI_CHAR('title_n'), 0.0f, false},
|
||||
{MULTI_CHAR('menu_n'), 0.0f, false},
|
||||
{MULTI_CHAR('w_er_n'), 0.0f, false},
|
||||
{MULTI_CHAR('center_n'), 0.0f, false},
|
||||
{MULTI_CHAR('info_n'), 0.0f, false},
|
||||
{MULTI_CHAR('lavel_n'), 0.0f, false},
|
||||
{MULTI_CHAR('modelbgn'), 0.0f, false},
|
||||
};
|
||||
#endif
|
||||
|
||||
class dMenu_Collect2D_c;
|
||||
class dMenu_Collect2DTop_c : public dDlst_base_c {
|
||||
|
||||
@@ -91,10 +91,6 @@ public:
|
||||
void calcCursor();
|
||||
void drawCursor();
|
||||
|
||||
#if TARGET_PC
|
||||
void dMapBgWide();
|
||||
#endif
|
||||
|
||||
void setDPDFloorSelCurPos(s8 i_pos) { field_0xdd6 = i_pos; }
|
||||
|
||||
f32 getMapWidth() { return mMapWidth; }
|
||||
@@ -183,11 +179,6 @@ public:
|
||||
/* 0xDD8 */ u8 field_0xdd8;
|
||||
/* 0xDD9 */ u8 field_0xdd9;
|
||||
/* 0xDDA */ u8 field_0xdda;
|
||||
|
||||
#if TARGET_PC
|
||||
J2DTextBox* mpPoeCountPane;
|
||||
J2DPicture* mpPoeCountIcon;
|
||||
#endif
|
||||
};
|
||||
|
||||
class dMenu_Dmap_c {
|
||||
|
||||
@@ -81,10 +81,6 @@ public:
|
||||
void calcDrawPriority();
|
||||
void setArrowPosAxis(f32, f32);
|
||||
|
||||
#if TARGET_PC
|
||||
void fMapBackWide();
|
||||
#endif
|
||||
|
||||
virtual void draw();
|
||||
virtual ~dMenu_Fmap2DBack_c();
|
||||
|
||||
@@ -169,12 +165,6 @@ public:
|
||||
|
||||
void mapBlink() {}
|
||||
|
||||
#if PLATFORM_WII || TARGET_PC
|
||||
f32 getMirrorPosX(f32 param_0, f32 param_1) {
|
||||
return (field_0x11dc * 2.0f - (param_0 + param_1)) - param_1;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Unknown name
|
||||
struct RegionTexData {
|
||||
/* 0x00 */ float mMinX;
|
||||
@@ -340,10 +330,6 @@ public:
|
||||
void setHIO(bool);
|
||||
bool isWarpAccept();
|
||||
|
||||
#if TARGET_PC
|
||||
void fMapTopWide();
|
||||
#endif
|
||||
|
||||
virtual void draw();
|
||||
virtual ~dMenu_Fmap2DTop_c();
|
||||
|
||||
@@ -421,12 +407,6 @@ public:
|
||||
/* 0xC2 */ u8 mAlphaButtonZ;
|
||||
/* 0xC3 */ u8 mAlphaAnalogStick;
|
||||
/* 0xC4 */ u8 mAlphaDpad;
|
||||
|
||||
#if TARGET_PC
|
||||
J2DTextBox* mpPoeCountPane;
|
||||
J2DPicture* mpPoeCountIcon;
|
||||
u8 mSelectRegionNo;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif /* D_MENU_D_MENU_FMAP2D_H */
|
||||
|
||||
@@ -66,21 +66,6 @@ public:
|
||||
_c90 = param_2;
|
||||
}
|
||||
|
||||
#if PLATFORM_WII || TARGET_PC
|
||||
f32 getMirrorCenterPosX(f32 param_0, f32 param_1) {
|
||||
if (_c90) {
|
||||
return (mCenterPosX * 2.0f - (param_0 + param_1)) - param_1;
|
||||
}
|
||||
|
||||
return param_0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if TARGET_PC
|
||||
static void getDmapPoeCount(const std::string& stageName, int& nowCount, int& totalCount);
|
||||
static void getFmapPoeCount(const int regionNo, int& nowCount, int& totalCount);
|
||||
#endif
|
||||
|
||||
struct Stage_c {
|
||||
// Incomplete class
|
||||
|
||||
|
||||
@@ -313,7 +313,7 @@ private:
|
||||
/* 0x00B8 */ int field_0xb8;
|
||||
/* 0x00BC */ int field_0xbc;
|
||||
/* 0x00C0 */ CPaneMgrAlpha* mpErrTxtPane[2];
|
||||
/* 0x00C8 */ TEXT_SPAN mpErrTxt[2];
|
||||
/* 0x00C8 */ char* mpErrTxt[2];
|
||||
/* 0x00D0 */ u8 mErrTxtType;
|
||||
/* 0x00D1 */ u8 mErrTxtAnmComplete;
|
||||
/* 0x00D2 */ u8 field_0xd2;
|
||||
@@ -344,7 +344,7 @@ private:
|
||||
/* 0x0160 */ J2DAnmTevRegKey* field_0x160;
|
||||
/* 0x0164 */ int field_0x164;
|
||||
/* 0x0168 */ CPaneMgrAlpha* mpHeaderTxtPane[2];
|
||||
/* 0x0170 */ TEXT_SPAN mpHeaderTxt[2];
|
||||
/* 0x0170 */ char* mpHeaderTxt[2];
|
||||
/* 0x0178 */ u8 mHeaderTxtType; // 0: Select Menu 1: YesNo Menu
|
||||
/* 0x0179 */ u8 mHeaderAnmComplete;
|
||||
/* 0x017A */ u8 field_0x17a;
|
||||
|
||||
@@ -67,9 +67,9 @@ public:
|
||||
s16 decFloatingMessageTimer();
|
||||
void resetFloatingMessage();
|
||||
void decMsgKeyWaitTimer();
|
||||
void getString(u32 i_stringID, TEXT_SPAN o_string, JMSMesgEntry_c* i_msgEntry);
|
||||
void getStringKana(u32 i_stringID, TEXT_SPAN o_string, JMSMesgEntry_c* i_msgEntry);
|
||||
void getStringKanji(u32 i_stringID, TEXT_SPAN o_string, JMSMesgEntry_c* i_msgEntry);
|
||||
void getString(u32 i_stringID, char* o_string, JMSMesgEntry_c* i_msgEntry);
|
||||
void getStringKana(u32 i_stringID, char* o_string, JMSMesgEntry_c* i_msgEntry);
|
||||
void getStringKanji(u32 i_stringID, char* o_string, JMSMesgEntry_c* i_msgEntry);
|
||||
f32 getStringLength(J2DTextBox* i_textbox, char* i_string);
|
||||
f32 getStringLength(JUTFont* i_font, f32 param_2, f32 param_3, char* i_string);
|
||||
void onDirectUseItem(int);
|
||||
@@ -348,15 +348,15 @@ inline CPaneMgr* dMeter2Info_getMeterItemPanePtr(s32 i_idx) {
|
||||
return g_meter2_info.getMeterItemPanePtr(i_idx);
|
||||
}
|
||||
|
||||
inline void dMeter2Info_getString(u32 i_stringID, TEXT_SPAN o_string, JMSMesgEntry_c* i_msgEntry) {
|
||||
inline void dMeter2Info_getString(u32 i_stringID, char* o_string, JMSMesgEntry_c* i_msgEntry) {
|
||||
g_meter2_info.getString(i_stringID, o_string, i_msgEntry);
|
||||
}
|
||||
|
||||
inline void dMeter2Info_getStringKanji(u32 i_stringID, TEXT_SPAN o_string, JMSMesgEntry_c* i_msgEntry) {
|
||||
inline void dMeter2Info_getStringKanji(u32 i_stringID, char* o_string, JMSMesgEntry_c* i_msgEntry) {
|
||||
g_meter2_info.getStringKanji(i_stringID, o_string, i_msgEntry);
|
||||
}
|
||||
|
||||
inline void dMeter2Info_getStringKana(u32 i_stringID, TEXT_SPAN o_string, JMSMesgEntry_c* i_msgEntry) {
|
||||
inline void dMeter2Info_getStringKana(u32 i_stringID, char* o_string, JMSMesgEntry_c* i_msgEntry) {
|
||||
g_meter2_info.getStringKana(i_stringID, o_string, i_msgEntry);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#ifndef D_METER_D_METER_BUTTON_H
|
||||
#define D_METER_D_METER_BUTTON_H
|
||||
|
||||
#include "global.h"
|
||||
#include "JSystem/J2DGraph/J2DScreen.h"
|
||||
#include "JSystem/J2DGraph/J2DTextBox.h"
|
||||
#include "d/d_drawlist.h"
|
||||
@@ -195,7 +194,7 @@ public:
|
||||
/* 0x0FC */ CPaneMgr* field_0x0fc[4];
|
||||
/* 0x10C */ JKRHeap* mpHeap;
|
||||
/* 0x110 */ void* mpFishingTex;
|
||||
/* 0x114 */ char mButtonText[2][DUSK_IF_ELSE(32, 15)];
|
||||
/* 0x114 */ char mButtonText[2][15];
|
||||
/* 0x132 */ u8 field_0x132[0x134 - 0x132];
|
||||
/* 0x134 */ f32 field_0x134;
|
||||
/* 0x138 */ f32 field_0x138;
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "JSystem/JMessage/JMessage.h"
|
||||
#include "SSystem/SComponent/c_xyz.h"
|
||||
#include "dusk/endian.h"
|
||||
#include "dusk/string.hpp"
|
||||
|
||||
#if REGION_JPN
|
||||
#define D_MSG_CLASS_PAGE_CNT_MAX 30
|
||||
@@ -68,7 +67,7 @@ struct jmessage_tReference : public JMessage::TReference {
|
||||
void pageSend();
|
||||
void selectMessage();
|
||||
void inputNumber();
|
||||
TEXT_SPAN getWord(int);
|
||||
char* getWord(int);
|
||||
void resetWord();
|
||||
void setCharactor(u16);
|
||||
void addCharactor(u16);
|
||||
@@ -229,11 +228,11 @@ struct jmessage_tReference : public JMessage::TReference {
|
||||
f32 getSelRubyCharSpace() { return mSelRubyCharSpace; }
|
||||
f32 getRubySize() { return mRubySize; }
|
||||
f32 getRubyCharSpace() { return mRubyCharSpace; }
|
||||
TEXT_SPAN getSelTextPtr(int idx) { return mSelText[idx]; }
|
||||
TEXT_SPAN getSelRubyPtr(int idx) { return mSelRuby[idx]; }
|
||||
TEXT_SPAN getTextPtr() { return mText; }
|
||||
TEXT_SPAN getTextSPtr() { return mTextS; }
|
||||
TEXT_SPAN getRubyPtr() { return mRuby; }
|
||||
char* getSelTextPtr(int idx) { return mSelText[idx]; }
|
||||
char* getSelRubyPtr(int idx) { return mSelRuby[idx]; }
|
||||
char* getTextPtr() { return mText; }
|
||||
char* getTextSPtr() { return mTextS; }
|
||||
char* getRubyPtr() { return mRuby; }
|
||||
u8 getSelectRubyFlag() { return mSelectRubyFlag; }
|
||||
f32 getSelTBoxWidth() { return mSelTBoxWidth; }
|
||||
u8 getSelectPos() { return mSelectPos; }
|
||||
@@ -464,7 +463,7 @@ struct jmessage_tRenderingProcessor : public JMessage::TRenderingProcessor {
|
||||
f32 getLineLength(int);
|
||||
void do_strcat(char*, bool, bool, bool);
|
||||
void do_rubyset(void const*, u32);
|
||||
void do_rubystrcat(char*, TEXT_SPAN, f32, f32);
|
||||
void do_rubystrcat(char*, char*, f32, f32);
|
||||
void do_name1();
|
||||
void do_numset(s16);
|
||||
void push_word();
|
||||
|
||||
@@ -53,8 +53,8 @@ public:
|
||||
void demoMessageGroupLocal();
|
||||
void endFlowGroupLocal();
|
||||
void changeGroupLocal(s16);
|
||||
bool getStringLocal(u32, J2DTextBox*, J2DTextBox*, JUTFont*, COutFont_c*, TEXT_SPAN,
|
||||
TEXT_SPAN, TEXT_SPAN, s16*);
|
||||
bool getStringLocal(u32, J2DTextBox*, J2DTextBox*, JUTFont*, COutFont_c*, char*,
|
||||
char*, char*, s16*);
|
||||
bool isGetItemMessage();
|
||||
bool isKanbanMessage();
|
||||
bool isHowlMessage();
|
||||
@@ -67,9 +67,6 @@ public:
|
||||
bool isStaffMessage();
|
||||
bool isSaveMessage();
|
||||
bool isTalkMessage();
|
||||
#if TARGET_PC
|
||||
bool isShopItemMessage();
|
||||
#endif
|
||||
const char* getSmellName();
|
||||
const char* getPortalName();
|
||||
const char* getBombName();
|
||||
@@ -121,7 +118,7 @@ public:
|
||||
static void endFlowGroup();
|
||||
static void changeGroup(s16);
|
||||
static bool getString(u32, J2DTextBox*, J2DTextBox*, JUTFont*, COutFont_c*,
|
||||
TEXT_SPAN, TEXT_SPAN, TEXT_SPAN, s16*);
|
||||
char*, char*, char*, s16*);
|
||||
static void* getMsgDtPtr();
|
||||
static void setProcessID(fpc_ProcID);
|
||||
static msg_class* getActor();
|
||||
@@ -246,12 +243,12 @@ public:
|
||||
|
||||
static void setWord(const char* i_word);
|
||||
void setWordLocal(const char* i_word) {
|
||||
SAFE_STRCPY(mWord, i_word);
|
||||
strcpy(mWord, i_word);
|
||||
}
|
||||
|
||||
static void setSelectWord(int i_no, const char* i_word);
|
||||
void setSelectWordLocal(int i_no, const char* i_word) {
|
||||
SAFE_STRCPY(mSelectWord[i_no], i_word);
|
||||
strcpy(mSelectWord[i_no], i_word);
|
||||
}
|
||||
|
||||
jmessage_tSequenceProcessor* getSequenceProcessor() { return mpSeqProc; }
|
||||
@@ -426,8 +423,8 @@ inline void dMsgObject_setTalkActor(fopAc_ac_c* actor) {
|
||||
}
|
||||
|
||||
inline bool dMsgObject_getString(u32 i_msgId, J2DTextBox* i_tbox, J2DTextBox* i_rubyTbox,
|
||||
JUTFont* i_font, COutFont_c* i_outFont, TEXT_SPAN o_text,
|
||||
TEXT_SPAN o_ruby, TEXT_SPAN o_textS, s16* param_8) {
|
||||
JUTFont* i_font, COutFont_c* i_outFont, char* o_text,
|
||||
char* o_ruby, char* o_textS, s16* param_8) {
|
||||
return dMsgObject_getMsgObjectClass()->getString(i_msgId, i_tbox, i_rubyTbox, i_font, i_outFont, o_text, o_ruby,
|
||||
o_textS, param_8);
|
||||
}
|
||||
|
||||
@@ -20,12 +20,12 @@ public:
|
||||
f32 getStringPageLocal(u32, u8, u8, J2DTextBox*, J2DTextBox*, JUTFont*,
|
||||
COutFont_c*, u8);
|
||||
u8 getPageMax(int);
|
||||
f32 getMessageLocal(u32, TEXT_SPAN);
|
||||
f32 getMessageLocal(u32, char*);
|
||||
|
||||
virtual f32 getString(u32, J2DTextBox*, J2DTextBox*, JUTFont*, COutFont_c*, u8);
|
||||
virtual f32 getStringPage(u32, u8, u8, J2DTextBox*, J2DTextBox*, JUTFont*, COutFont_c*,
|
||||
u8);
|
||||
virtual f32 getMessage(u32, TEXT_SPAN);
|
||||
virtual f32 getMessage(u32, char*);
|
||||
virtual void resetStringLocal(J2DTextBox*);
|
||||
virtual void drawOutFontLocal(J2DTextBox*, f32);
|
||||
virtual void drawFontLocal(J2DTextBox*, u8, f32, f32, f32, f32, u32, u8);
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
class dMsgUnit_c {
|
||||
public:
|
||||
dMsgUnit_c();
|
||||
void setTag(int, int, TEXT_SPAN, bool);
|
||||
void setTag(int, int, char*, bool);
|
||||
|
||||
virtual ~dMsgUnit_c();
|
||||
};
|
||||
|
||||
extern dMsgUnit_c g_msg_unit;
|
||||
|
||||
inline void dMsgUnit_setTag(int param_0, int param_1, TEXT_SPAN param_2) {
|
||||
inline void dMsgUnit_setTag(int param_0, int param_1, char* param_2) {
|
||||
g_msg_unit.setTag(param_0, param_1, param_2, true);
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -127,7 +127,7 @@ public:
|
||||
u8 isInputEnd() { return mIsInputEnd; }
|
||||
char* getInputStrPtr() { return mInputStr; }
|
||||
void hideIcon() { mSelIcon->setAlphaRate(0.0f); }
|
||||
void setNextNameStr(char* i_name) { SAFE_STRCPY(mNextNameStr,i_name); }
|
||||
void setNextNameStr(char* i_name) { strcpy(mNextNameStr,i_name); }
|
||||
void draw() { _draw(); }
|
||||
|
||||
private:
|
||||
@@ -140,9 +140,9 @@ private:
|
||||
/* 0x02C */ J2DAnmTextureSRTKey* mCursorTexKey;
|
||||
/* 0x030 */ int mCurTexAnmF;
|
||||
/* 0x034 */ CPaneMgrAlpha* mNameCursor[8];
|
||||
/* 0x054 */ TEXT_SPAN mNameText[8];
|
||||
/* 0x054 */ char* mNameText[8];
|
||||
/* 0x074 */ CPaneMgr* mMojiIcon[65];
|
||||
/* 0x178 */ TEXT_SPAN mMojiText[65];
|
||||
/* 0x178 */ char* mMojiText[65];
|
||||
/* 0x27C */ J2DPane* mMojiPane;
|
||||
/* 0x280 */ J2DPane* mMenuPane;
|
||||
/* 0x284 */ CPaneMgr* mMenuIcon[4];
|
||||
|
||||
+4
-11
@@ -486,27 +486,20 @@ public:
|
||||
mDeathCount++;
|
||||
}
|
||||
}
|
||||
#if TARGET_PC
|
||||
u16 getDeathCount() const { return mDeathCount; }
|
||||
TEXT_SPAN getPlayerName() const { return const_cast<char(&)[17]>(mPlayerName); }
|
||||
#else
|
||||
char* getPlayerName() const { return const_cast<char*>(mPlayerName); }
|
||||
#endif
|
||||
void setPlayerName(const char* i_name) {
|
||||
#if AVOID_UB
|
||||
dusk::SafeStringCopyTruncate(mPlayerName, i_name);
|
||||
strncpy(mPlayerName, i_name, sizeof(mPlayerName) - 1);
|
||||
mPlayerName[sizeof(mPlayerName) - 1] = '\0';
|
||||
#else
|
||||
strcpy(mPlayerName, i_name);
|
||||
#endif
|
||||
}
|
||||
#if TARGET_PC
|
||||
TEXT_SPAN getHorseName() const { return const_cast<char(&)[17]>(mHorseName); }
|
||||
#else
|
||||
char* getHorseName() const { return const_cast<char*>(mHorseName); }
|
||||
#endif
|
||||
void setHorseName(const char* i_name) {
|
||||
#if AVOID_UB
|
||||
dusk::SafeStringCopyTruncate(mHorseName, i_name);
|
||||
strncpy(mHorseName, i_name, sizeof(mHorseName) - 1);
|
||||
mHorseName[sizeof(mHorseName) - 1] = '\0';
|
||||
#else
|
||||
strcpy(mHorseName, i_name);
|
||||
#endif
|
||||
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
f32 getPositionX() const { return mPositionX; }
|
||||
f32 getPositionY() const { return mPositionY; }
|
||||
|
||||
void refreshAspectScale(f32 param_0);
|
||||
void refreshAspectScale();
|
||||
#endif
|
||||
|
||||
void onUpdateFlag() { mUpdateFlag = true; }
|
||||
|
||||
+1
-1
@@ -1225,7 +1225,7 @@ public:
|
||||
#endif
|
||||
}
|
||||
static JKRExpHeap* getMemoryBlockHeap(int i_no) { return mMemoryBlock[i_no]; }
|
||||
static TEXT_SPAN getDemoArcName() { return mDemoArcName; }
|
||||
static char* getDemoArcName() { return mDemoArcName; }
|
||||
static void offNoChangeRoom() { mNoChangeRoom = false; }
|
||||
static void onNoChangeRoom() { mNoChangeRoom = true; }
|
||||
|
||||
|
||||
@@ -4,18 +4,16 @@
|
||||
#include <functional>
|
||||
#include <queue>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
#include "nlohmann/json.hpp"
|
||||
|
||||
namespace dusk {
|
||||
|
||||
enum class AchievementCategory : uint8_t {
|
||||
Challenge,
|
||||
Story,
|
||||
Collection,
|
||||
Challenge,
|
||||
Minigame,
|
||||
Misc,
|
||||
Glitched
|
||||
};
|
||||
|
||||
@@ -42,14 +40,10 @@ public:
|
||||
void save();
|
||||
void tick();
|
||||
void clearAll();
|
||||
void clearOne(const char* key);
|
||||
|
||||
// Signals are visible to all achievement checks within the same tick, then cleared.
|
||||
void signal(const char* key);
|
||||
bool hasSignal(const char* key) const;
|
||||
int signalCount(const char* key) const;
|
||||
|
||||
std::vector<Achievement> getAchievements() const;
|
||||
bool hasPendingUnlock() const { return !m_pendingUnlocks.empty(); }
|
||||
std::string consumePendingUnlock();
|
||||
|
||||
private:
|
||||
struct Entry {
|
||||
@@ -63,9 +57,9 @@ private:
|
||||
void processEntry(Entry& e);
|
||||
|
||||
std::vector<Entry> m_entries;
|
||||
std::unordered_map<std::string_view, int> m_signals;
|
||||
bool m_loaded = false;
|
||||
bool m_dirty = false;
|
||||
std::queue<std::string> m_pendingUnlocks;
|
||||
};
|
||||
|
||||
} // namespace dusk
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
#include "dusk/config_var.hpp"
|
||||
|
||||
namespace dusk {
|
||||
|
||||
enum class ActionBinds {
|
||||
FIRST_PERSON_CAMERA,
|
||||
CALL_MIDNA,
|
||||
OPEN_DUSKLIGHT_MENU,
|
||||
TURBO_SPEED_BUTTON,
|
||||
COUNT,
|
||||
};
|
||||
|
||||
struct ActionBindData {
|
||||
std::array<config::ActionBindConfigVar, 4>* configVars{};
|
||||
std::string actionName{};
|
||||
};
|
||||
|
||||
struct ActionBindPressData {
|
||||
bool pressedCurFrame{false};
|
||||
bool pressedPrevFrame{false};
|
||||
};
|
||||
|
||||
using ActionBindsMap = std::unordered_map<ActionBinds, ActionBindData>;
|
||||
|
||||
ActionBindsMap& getActionBinds();
|
||||
|
||||
bool isActionBound(ActionBinds action, u32 port);
|
||||
|
||||
void updateActionBindings();
|
||||
|
||||
bool getActionBindTrig(ActionBinds action, u32 port);
|
||||
|
||||
bool getActionBindHold(ActionBinds action, u32 port);
|
||||
|
||||
bool getActionBindHoldAnyPort(ActionBinds action);
|
||||
|
||||
int getActionBindButton(ActionBinds action, u32 port);
|
||||
|
||||
}
|
||||
@@ -7,12 +7,7 @@ namespace dusk {
|
||||
*
|
||||
* This gets used for file paths and such, and cannot be changed!
|
||||
*/
|
||||
constexpr auto AppName = "Dusklight";
|
||||
|
||||
/**
|
||||
* Previous AppName to migrate data from.
|
||||
*/
|
||||
constexpr auto LegacyAppName = "Dusk";
|
||||
constexpr auto AppName = "Dusk";
|
||||
|
||||
/**
|
||||
* \brief The internal organization name for the game.
|
||||
|
||||
@@ -1,19 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <cmath>
|
||||
#include <dolphin/types.h>
|
||||
|
||||
namespace dusk::audio {
|
||||
|
||||
// Converts a 0-1 volume to a linear amplitude multiplier.
|
||||
// The curve is -4 dB per 10% step: 100% = 0 dB, 90% = -4 dB, ..., 0% = -inf dB
|
||||
inline f32 MasterVolumeToLinear(f32 v) {
|
||||
if (v <= 0.0f) {
|
||||
return 0.0f;
|
||||
}
|
||||
return std::pow(10.0f, (v - 1.0f) * 2.0f);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the audio system and start playing audio.
|
||||
*/
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef AUTOSAVE_H
|
||||
#define AUTOSAVE_H
|
||||
|
||||
#include <m_Do/m_Do_MemCardRWmng.h>
|
||||
#include <m_Do/m_Do_MemCard.h>
|
||||
#include <d/actor/d_a_alink.h>
|
||||
|
||||
void noAutoSave();
|
||||
void triggerAutoSave();
|
||||
void updateAutoSave();
|
||||
void enterAutoSave();
|
||||
void autoSaving();
|
||||
void waitingForWrite();
|
||||
void endAutoSave();
|
||||
void toggleAutoSave(bool enabled);
|
||||
|
||||
#endif
|
||||
@@ -1,7 +1,6 @@
|
||||
#ifndef DUSK_CONFIG_HPP
|
||||
#define DUSK_CONFIG_HPP
|
||||
|
||||
#include <functional>
|
||||
#include <stdexcept>
|
||||
#include "nlohmann/json.hpp"
|
||||
#include "config_var.hpp"
|
||||
@@ -112,18 +111,6 @@ void Save();
|
||||
*/
|
||||
ConfigVarBase* GetConfigVar(std::string_view name);
|
||||
|
||||
/**
|
||||
* \brief Resets all custom action bindings for a specific port to nothing
|
||||
*
|
||||
* @param port The port to be cleared of action bindings
|
||||
*/
|
||||
void ClearAllActionBindings(int port);
|
||||
|
||||
/**
|
||||
* \brief Call a function on every registered CVar.
|
||||
*/
|
||||
void EnumerateRegistered(std::function<void(ConfigVarBase&)> callback);
|
||||
|
||||
template <ConfigValue T>
|
||||
const ConfigImplBase* GetConfigImpl() {
|
||||
static ConfigImpl<T> config;
|
||||
|
||||
@@ -48,13 +48,6 @@ enum class ConfigVarLayer : u8 {
|
||||
* Will not get saved to config.
|
||||
*/
|
||||
Override,
|
||||
|
||||
/**
|
||||
* The CVar is temporarily overridden by speedrun mode.
|
||||
* Will not get saved to config. Cleared when speedrun mode is disabled.
|
||||
* Lower priority than Override, so launch args still win.
|
||||
*/
|
||||
Speedrun,
|
||||
};
|
||||
|
||||
class ConfigImplBase;
|
||||
@@ -120,12 +113,6 @@ public:
|
||||
* This is necessary to make it legal to access.
|
||||
*/
|
||||
void markRegistered();
|
||||
|
||||
/**
|
||||
* Clear a speedrun-mode override if one is active on this CVar.
|
||||
* Safe to call on any CVar, no-op if not at the Speedrun layer.
|
||||
*/
|
||||
virtual void clearSpeedrunOverride() {}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
@@ -175,7 +162,6 @@ class ConfigVar : public ConfigVarBase {
|
||||
T defaultValue;
|
||||
T value;
|
||||
T overrideValue;
|
||||
ConfigVarLayer priorLayer = ConfigVarLayer::Default;
|
||||
|
||||
public:
|
||||
/**
|
||||
@@ -203,7 +189,6 @@ public:
|
||||
case ConfigVarLayer::Value:
|
||||
return value;
|
||||
case ConfigVarLayer::Override:
|
||||
case ConfigVarLayer::Speedrun:
|
||||
return overrideValue;
|
||||
default:
|
||||
abort();
|
||||
@@ -254,54 +239,8 @@ public:
|
||||
overrideValue = std::move(newValue);
|
||||
layer = ConfigVarLayer::Override;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Give a CVar a speedrun-mode override value.
|
||||
*
|
||||
* Lower priority than a launch-arg override. Cleared when speedrun mode is disabled.
|
||||
* The overridden value will not get saved to config.
|
||||
*
|
||||
* @param newValue The new value the CVar will get.
|
||||
*/
|
||||
void setSpeedrunValue(T newValue) {
|
||||
checkRegistered();
|
||||
if (layer != ConfigVarLayer::Override) {
|
||||
priorLayer = layer;
|
||||
overrideValue = std::move(newValue);
|
||||
layer = ConfigVarLayer::Speedrun;
|
||||
}
|
||||
}
|
||||
|
||||
void clearOverride() {
|
||||
checkRegistered();
|
||||
if (layer == ConfigVarLayer::Override) {
|
||||
overrideValue = {};
|
||||
layer = ConfigVarLayer::Value;
|
||||
}
|
||||
}
|
||||
|
||||
void clearSpeedrunOverride() override {
|
||||
checkRegistered();
|
||||
if (layer == ConfigVarLayer::Speedrun) {
|
||||
overrideValue = {};
|
||||
layer = priorLayer;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Get the user-persisted value, ignoring any temporary overrides.
|
||||
*
|
||||
* Used by Save() to write the correct value even when a speedrun override is active.
|
||||
*/
|
||||
[[nodiscard]] constexpr const T& getValueForSave() const noexcept {
|
||||
checkRegistered();
|
||||
const ConfigVarLayer effectiveLayer = (layer == ConfigVarLayer::Speedrun) ? priorLayer : layer;
|
||||
return effectiveLayer == ConfigVarLayer::Default ? defaultValue : value;
|
||||
}
|
||||
};
|
||||
|
||||
using ActionBindConfigVar = ConfigVar<int>;
|
||||
|
||||
}
|
||||
|
||||
#endif // DUSK_CONFIG_VAR_HPP
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
namespace dusk::crash_handler {
|
||||
|
||||
void install();
|
||||
|
||||
} // namespace dusk::crash_handler
|
||||
@@ -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
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef DUSK_DISCORD
|
||||
#ifdef DUSK_DISCORD_RPC
|
||||
|
||||
namespace dusk::discord {
|
||||
namespace dusk {
|
||||
namespace discord {
|
||||
|
||||
void initialize();
|
||||
void run_callbacks();
|
||||
void update_presence();
|
||||
void shutdown();
|
||||
void Initialize();
|
||||
|
||||
} // namespace dusk::discord
|
||||
void RunCallbacks();
|
||||
|
||||
#endif // DUSK_DISCORD
|
||||
void UpdatePresence();
|
||||
|
||||
void Shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
#endif // DUSK_DISCORD_RPC
|
||||
|
||||
@@ -227,28 +227,6 @@ struct BE<Mtx> {
|
||||
}
|
||||
};
|
||||
|
||||
typedef f32 Mtx23[2][3];
|
||||
template <>
|
||||
struct BE<Mtx23> {
|
||||
BE<f32> contents[2][3];
|
||||
|
||||
auto& operator[](int x) {
|
||||
return contents[x];
|
||||
}
|
||||
|
||||
auto& operator[](int x) const {
|
||||
return contents[x];
|
||||
}
|
||||
|
||||
void to_host(Mtx23& mtx) const {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
for (int j = 0; j < 3; j++) {
|
||||
mtx[i][j] = contents[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
void be_swap(T& val) {
|
||||
val = BE<T>::swap(val);
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include "settings.h"
|
||||
|
||||
class camera_process_class;
|
||||
class view_class;
|
||||
@@ -18,8 +17,7 @@ void ensure_initialized();
|
||||
void begin_record();
|
||||
void end_record();
|
||||
void begin_sim_tick();
|
||||
uint64_t sim_tick_seq();
|
||||
void begin_frame(FrameInterpMode mode, bool is_sim_frame, float step);
|
||||
void begin_frame(bool enabled, bool is_sim_frame, float step);
|
||||
void interpolate();
|
||||
float get_interpolation_step();
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ void rollgoalTableOffset(s16& out_ax, s16& out_az);
|
||||
extern bool s_sensor_keep_alive;
|
||||
bool get_sensor_keep_alive();
|
||||
void set_sensor_keep_alive(bool value);
|
||||
bool rollgoal_gyro_enabled();
|
||||
} // namespace dusk::gyro
|
||||
|
||||
#endif
|
||||
|
||||
@@ -14,6 +14,7 @@ constexpr const char* SHOW_DEBUG_OVERLAY = "F3";
|
||||
constexpr const char* SHOW_HEAP_VIEWER = "F4";
|
||||
constexpr const char* SHOW_PLAYER_INFO = "F5";
|
||||
constexpr const char* SHOW_SAVE_EDITOR = "F6";
|
||||
constexpr const char* SHOW_MAP_LOADER = "F7";
|
||||
constexpr const char* SHOW_STATE_SHARE = "F8";
|
||||
constexpr const char* SHOW_DEBUG_CAMERA = "F9";
|
||||
constexpr const char* SHOW_AUDIO_DEBUG = "F10";
|
||||
|
||||
+5
-40
@@ -1,7 +1,6 @@
|
||||
#ifndef DUSK_IO_HPP
|
||||
#define DUSK_IO_HPP
|
||||
|
||||
#include <filesystem>
|
||||
#include <vector>
|
||||
|
||||
// I can't believe it's 2026 and neither SDL (no error codes) nor
|
||||
@@ -16,7 +15,7 @@ namespace dusk::io {
|
||||
* Methods on this class throw appropriate C++ exceptions when an error occurs.
|
||||
*/
|
||||
class FileStream {
|
||||
FILE* file;
|
||||
void* file;
|
||||
|
||||
public:
|
||||
FileStream() noexcept;
|
||||
@@ -24,27 +23,17 @@ public:
|
||||
/**
|
||||
* \brief Take ownership of a FILE* handle.
|
||||
*/
|
||||
explicit FileStream(FILE* file);
|
||||
explicit FileStream(void* file);
|
||||
FileStream(const FileStream& other) = delete;
|
||||
FileStream(FileStream&& other) noexcept;
|
||||
|
||||
~FileStream();
|
||||
|
||||
/**
|
||||
* \brief Flush buffered writes and throw if the flush fails.
|
||||
*/
|
||||
void Flush();
|
||||
|
||||
/**
|
||||
* \brief Open a file for reading at the given path.
|
||||
*/
|
||||
static FileStream OpenRead(const char* utf8Path);
|
||||
|
||||
/**
|
||||
* \brief Open a file for reading at the given path.
|
||||
*/
|
||||
static FileStream OpenRead(const std::filesystem::path& path);
|
||||
|
||||
/**
|
||||
* \brief Create a file for writing.
|
||||
*
|
||||
@@ -52,33 +41,16 @@ public:
|
||||
*/
|
||||
static FileStream Create(const char* utf8Path);
|
||||
|
||||
/**
|
||||
* \brief Create a file for writing.
|
||||
*
|
||||
* If there is an existing file, its contents are demolished.
|
||||
*/
|
||||
static FileStream Create(const std::filesystem::path& path);
|
||||
|
||||
/**
|
||||
* \brief Read the byte contents of a file directly into a vector.
|
||||
*/
|
||||
static std::vector<u8> ReadAllBytes(const char* utf8Path);
|
||||
|
||||
/**
|
||||
* \brief Read the byte contents of a file directly into a vector.
|
||||
*/
|
||||
static std::vector<u8> ReadAllBytes(const std::filesystem::path& path);
|
||||
|
||||
/**
|
||||
* \brief Read the byte contents of a file directly into a vector.
|
||||
*/
|
||||
static void WriteAllText(const char* utf8Path, std::string_view text);
|
||||
|
||||
/**
|
||||
* \brief Read the byte contents of a file directly into a vector.
|
||||
*/
|
||||
static void WriteAllText(const std::filesystem::path& path, std::string_view text);
|
||||
|
||||
/**
|
||||
* \brief Read the remaining contents of the file directly into a vector.
|
||||
*/
|
||||
@@ -87,24 +59,17 @@ 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.
|
||||
*/
|
||||
void Write(const char* data, size_t dataLen);
|
||||
|
||||
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
|
||||
|
||||
@@ -12,7 +12,6 @@ namespace dusk {
|
||||
void InitializeFileLogging(const std::filesystem::path& configDir, AuroraLogLevel logLevel);
|
||||
void ShutdownFileLogging();
|
||||
const char* GetLogFilePath();
|
||||
int GetLogFileDescriptor();
|
||||
void SendToStubLog(AuroraLogLevel level, const char* module, const char* message);
|
||||
}
|
||||
|
||||
@@ -20,11 +19,7 @@ extern bool StubLogEnabled;
|
||||
|
||||
extern aurora::Module DuskLog;
|
||||
|
||||
#ifndef NDEBUG
|
||||
#define STUB_LOG() DuskLog.debug("{} is a stub", __FUNCTION__)
|
||||
#else
|
||||
#define STUB_LOG()
|
||||
#endif
|
||||
|
||||
#if TARGET_PC
|
||||
#define STUB_RET(...) \
|
||||
|
||||
+6
-18
@@ -4,23 +4,11 @@
|
||||
#include <filesystem>
|
||||
|
||||
namespace dusk {
|
||||
|
||||
extern bool IsRunning;
|
||||
extern bool IsShuttingDown;
|
||||
extern bool IsGameLaunched;
|
||||
extern bool RestartRequested;
|
||||
extern std::filesystem::path ConfigPath;
|
||||
extern std::filesystem::path CachePath;
|
||||
|
||||
#if defined(__ANDROID__) || (defined(TARGET_OS_IOS) && TARGET_OS_IOS) || \
|
||||
(defined(TARGET_OS_TV) && TARGET_OS_TV)
|
||||
inline constexpr bool SupportsProcessRestart = false;
|
||||
#else
|
||||
inline constexpr bool SupportsProcessRestart = true;
|
||||
#endif
|
||||
|
||||
void RequestRestart() noexcept;
|
||||
|
||||
} // namespace dusk
|
||||
extern bool IsRunning;
|
||||
extern bool IsShuttingDown;
|
||||
extern bool IsGameLaunched;
|
||||
extern bool IsFocusPaused;
|
||||
extern std::filesystem::path ConfigPath;
|
||||
}
|
||||
|
||||
#endif // DUSK_MAIN_H
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
|
||||
struct RoomEntry {
|
||||
u8 roomNo;
|
||||
std::vector<s16> roomPoints = {};
|
||||
|
||||
+137
-1
@@ -2,6 +2,9 @@
|
||||
#define _SRC_DUSK_MATH_H_
|
||||
|
||||
#include <cmath>
|
||||
#include <array>
|
||||
#include <limits>
|
||||
#include <bit>
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846f
|
||||
@@ -16,6 +19,139 @@ inline float i_cosf(float x) { return cos(x); }
|
||||
inline float i_tanf(float x) { return tan(x); }
|
||||
inline float i_acosf(float x) { return acos(x); }
|
||||
|
||||
#include <dolphin/ppc_math.h>
|
||||
|
||||
// frsqrte matching courtesy of Geotale, with reference to https://achurch.org/cpu-tests/ppc750cl.s
|
||||
|
||||
struct BaseAndDec32 {
|
||||
uint32_t base;
|
||||
int32_t dec;
|
||||
};
|
||||
|
||||
struct BaseAndDec64 {
|
||||
uint64_t base;
|
||||
int64_t dec;
|
||||
};
|
||||
|
||||
union c32 {
|
||||
constexpr c32(const float p) {
|
||||
f = p;
|
||||
}
|
||||
|
||||
constexpr c32(const uint32_t p) {
|
||||
u = p;
|
||||
}
|
||||
|
||||
uint32_t u;
|
||||
float f;
|
||||
};
|
||||
|
||||
union c64 {
|
||||
constexpr c64(const double p) {
|
||||
f = p;
|
||||
}
|
||||
|
||||
constexpr c64(const uint64_t p) {
|
||||
u = p;
|
||||
}
|
||||
|
||||
uint64_t u;
|
||||
double f;
|
||||
};
|
||||
|
||||
static constexpr uint64_t EXPONENT_SHIFT_F64 = 52;
|
||||
static constexpr uint64_t MANTISSA_MASK_F64 = 0x000fffffffffffffULL;
|
||||
static constexpr uint64_t EXPONENT_MASK_F64 = 0x7ff0000000000000ULL;
|
||||
static constexpr uint64_t SIGN_MASK_F64 = 0x8000000000000000ULL;
|
||||
|
||||
static constexpr std::array<BaseAndDec64, 32> RSQRTE_TABLE = {{
|
||||
{0x69fa000000000ULL, -0x15a0000000LL},
|
||||
{0x5f2e000000000ULL, -0x13cc000000LL},
|
||||
{0x554a000000000ULL, -0x1234000000LL},
|
||||
{0x4c30000000000ULL, -0x10d4000000LL},
|
||||
{0x43c8000000000ULL, -0x0f9c000000LL},
|
||||
{0x3bfc000000000ULL, -0x0e88000000LL},
|
||||
{0x34b8000000000ULL, -0x0d94000000LL},
|
||||
{0x2df0000000000ULL, -0x0cb8000000LL},
|
||||
{0x2794000000000ULL, -0x0bf0000000LL},
|
||||
{0x219c000000000ULL, -0x0b40000000LL},
|
||||
{0x1bfc000000000ULL, -0x0aa0000000LL},
|
||||
{0x16ae000000000ULL, -0x0a0c000000LL},
|
||||
{0x11a8000000000ULL, -0x0984000000LL},
|
||||
{0x0ce6000000000ULL, -0x090c000000LL},
|
||||
{0x0862000000000ULL, -0x0898000000LL},
|
||||
{0x0416000000000ULL, -0x082c000000LL},
|
||||
{0xffe8000000000ULL, -0x1e90000000LL},
|
||||
{0xf0a4000000000ULL, -0x1c00000000LL},
|
||||
{0xe2a8000000000ULL, -0x19c0000000LL},
|
||||
{0xd5c8000000000ULL, -0x17c8000000LL},
|
||||
{0xc9e4000000000ULL, -0x1610000000LL},
|
||||
{0xbedc000000000ULL, -0x1490000000LL},
|
||||
{0xb498000000000ULL, -0x1330000000LL},
|
||||
{0xab00000000000ULL, -0x11f8000000LL},
|
||||
{0xa204000000000ULL, -0x10e8000000LL},
|
||||
{0x9994000000000ULL, -0x0fe8000000LL},
|
||||
{0x91a0000000000ULL, -0x0f08000000LL},
|
||||
{0x8a1c000000000ULL, -0x0e38000000LL},
|
||||
{0x8304000000000ULL, -0x0d78000000LL},
|
||||
{0x7c48000000000ULL, -0x0cc8000000LL},
|
||||
{0x75e4000000000ULL, -0x0c28000000LL},
|
||||
{0x6fd0000000000ULL, -0x0b98000000LL},
|
||||
}};
|
||||
|
||||
[[nodiscard]] static inline double frsqrte(const double val) {
|
||||
c64 bits(val);
|
||||
|
||||
uint64_t mantissa = bits.u & MANTISSA_MASK_F64;
|
||||
int64_t exponent = bits.u & EXPONENT_MASK_F64;
|
||||
bool sign = (bits.u & SIGN_MASK_F64) != 0;
|
||||
|
||||
// Handle 0 case
|
||||
if (mantissa == 0 && exponent == 0) {
|
||||
return std::copysign(std::numeric_limits<double>::infinity(), bits.f);
|
||||
}
|
||||
|
||||
// Handle NaN-like
|
||||
if (exponent == EXPONENT_MASK_F64) {
|
||||
if (mantissa == 0) {
|
||||
return sign ? std::numeric_limits<double>::quiet_NaN() : 0.0;
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
// Handle negative inputs
|
||||
if (sign) {
|
||||
return std::numeric_limits<double>::quiet_NaN();
|
||||
}
|
||||
|
||||
if (exponent == 0) {
|
||||
// Shift so one bit goes to where the exponent would be,
|
||||
// then clear that bit to mimic a not-subnormal number!
|
||||
// Aka, if there are 12 leading zeroes, shift left once
|
||||
uint32_t shift = std::countl_zero(mantissa) - static_cast<uint32_t>(63 - EXPONENT_SHIFT_F64);
|
||||
|
||||
mantissa <<= shift;
|
||||
mantissa &= MANTISSA_MASK_F64;
|
||||
// The shift is subtracted by 1 because denormals by default
|
||||
// are offset by 1 (exponent 0 doesn't have implied 1 bit)
|
||||
exponent -= static_cast<int64_t>(shift - 1) << EXPONENT_SHIFT_F64;
|
||||
}
|
||||
|
||||
// In reality this doesn't get the full exponent -- Only the least significant bit
|
||||
// Only that's needed because square roots of higher exponent bits simply multiply the
|
||||
// result by 2!!
|
||||
uint32_t key = static_cast<uint32_t>((static_cast<uint64_t>(exponent) | mantissa) >> 37);
|
||||
uint64_t new_exp =
|
||||
(static_cast<uint64_t>((0xbfcLL << EXPONENT_SHIFT_F64) - exponent) >> 1) & EXPONENT_MASK_F64;
|
||||
|
||||
// Remove the bits relating to anything higher than the LSB of the exponent
|
||||
const auto &entry = RSQRTE_TABLE[0x1f & (key >> 11)];
|
||||
|
||||
// The result is given by an estimate then an adjustment based on the original
|
||||
// key that was computed
|
||||
uint64_t new_mantissa = static_cast<uint64_t>(entry.base + entry.dec * static_cast<int64_t>(key & 0x7ff));
|
||||
|
||||
return c64(new_exp | new_mantissa).f;
|
||||
}
|
||||
|
||||
#endif // _SRC_DUSK_MATH_H_
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
#ifndef DUSK_MEMORY_H
|
||||
#define DUSK_MEMORY_H
|
||||
|
||||
#if TARGET_PC
|
||||
#define HEAP_SIZE(original, dusk) (dusk)
|
||||
#else
|
||||
#define HEAP_SIZE(original, dusk) (original)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+9
-118
@@ -1,8 +1,6 @@
|
||||
#ifndef DUSK_CONFIG_H
|
||||
#define DUSK_CONFIG_H
|
||||
|
||||
#include <array>
|
||||
|
||||
#include "dusk/config_var.hpp"
|
||||
|
||||
namespace dusk {
|
||||
@@ -15,17 +13,6 @@ enum class BloomMode : int {
|
||||
Dusk = 2,
|
||||
};
|
||||
|
||||
enum class DepthOfFieldMode : int {
|
||||
Off = 0,
|
||||
Classic = 1,
|
||||
Dusk = 2,
|
||||
};
|
||||
|
||||
enum class Resampler : int {
|
||||
Bilinear = 0,
|
||||
Area = 1,
|
||||
};
|
||||
|
||||
enum class GameLanguage : u8 {
|
||||
English = OS_LANGUAGE_ENGLISH,
|
||||
German = OS_LANGUAGE_GERMAN,
|
||||
@@ -34,29 +21,6 @@ enum class GameLanguage : u8 {
|
||||
Italian = OS_LANGUAGE_ITALIAN,
|
||||
};
|
||||
|
||||
enum class DiscVerificationState : u8 {
|
||||
Unknown = 0,
|
||||
Success,
|
||||
HashMismatch,
|
||||
};
|
||||
|
||||
enum class GyroMode : u8 {
|
||||
Sensor = 0,
|
||||
Mouse = 1,
|
||||
};
|
||||
|
||||
enum class FrameInterpMode : u8 {
|
||||
Off = 0,
|
||||
Capped = 1,
|
||||
Unlimited = 2,
|
||||
};
|
||||
|
||||
enum class MenuScaling : u8 {
|
||||
GameCube = 0,
|
||||
Wii = 1,
|
||||
Dusklight = 2,
|
||||
};
|
||||
|
||||
namespace config {
|
||||
template <>
|
||||
struct ConfigEnumRange<BloomMode> {
|
||||
@@ -64,48 +28,12 @@ struct ConfigEnumRange<BloomMode> {
|
||||
static constexpr auto max = BloomMode::Dusk;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ConfigEnumRange<DepthOfFieldMode> {
|
||||
static constexpr auto min = DepthOfFieldMode::Off;
|
||||
static constexpr auto max = DepthOfFieldMode::Dusk;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ConfigEnumRange<Resampler> {
|
||||
static constexpr auto min = Resampler::Bilinear;
|
||||
static constexpr auto max = Resampler::Area;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ConfigEnumRange<GameLanguage> {
|
||||
static constexpr auto min = GameLanguage::English;
|
||||
static constexpr auto max = GameLanguage::Italian;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ConfigEnumRange<DiscVerificationState> {
|
||||
static constexpr auto min = DiscVerificationState::Unknown;
|
||||
static constexpr auto max = DiscVerificationState::HashMismatch;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ConfigEnumRange<GyroMode> {
|
||||
static constexpr auto min = GyroMode::Sensor;
|
||||
static constexpr auto max = GyroMode::Mouse;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ConfigEnumRange<FrameInterpMode> {
|
||||
static constexpr auto min = FrameInterpMode::Off;
|
||||
static constexpr auto max = FrameInterpMode::Unlimited;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ConfigEnumRange<MenuScaling> {
|
||||
static constexpr auto min = MenuScaling::GameCube;
|
||||
static constexpr auto max = MenuScaling::Dusklight;
|
||||
};
|
||||
} // namespace config
|
||||
}
|
||||
|
||||
// Persistent user settings
|
||||
|
||||
@@ -117,9 +45,6 @@ struct UserSettings {
|
||||
ConfigVar<bool> enableFullscreen;
|
||||
ConfigVar<bool> enableVsync;
|
||||
ConfigVar<bool> lockAspectRatio;
|
||||
ConfigVar<bool> enableFpsOverlay;
|
||||
ConfigVar<int> fpsOverlayCorner;
|
||||
ConfigVar<int> maxFrameRate;
|
||||
} video;
|
||||
|
||||
struct {
|
||||
@@ -130,8 +55,6 @@ struct UserSettings {
|
||||
ConfigVar<int> soundEffectsVolume;
|
||||
ConfigVar<int> fanfareVolume;
|
||||
ConfigVar<bool> enableReverb;
|
||||
ConfigVar<bool> enableHrtf;
|
||||
ConfigVar<bool> menuSounds;
|
||||
} audio;
|
||||
|
||||
// Game settings
|
||||
@@ -142,6 +65,7 @@ struct UserSettings {
|
||||
// QoL
|
||||
ConfigVar<bool> enableQuickTransform;
|
||||
ConfigVar<bool> hideTvSettingsScreen;
|
||||
ConfigVar<bool> skipWarningScreen;
|
||||
ConfigVar<bool> biggerWallets;
|
||||
ConfigVar<bool> noReturnRupees;
|
||||
ConfigVar<bool> disableRupeeCutscenes;
|
||||
@@ -156,38 +80,30 @@ struct UserSettings {
|
||||
ConfigVar<bool> instantSaves;
|
||||
ConfigVar<bool> instantText;
|
||||
ConfigVar<bool> sunsSong;
|
||||
ConfigVar<bool> autoSave;
|
||||
ConfigVar<bool> enhancedMapMenus;
|
||||
|
||||
// Preferences
|
||||
ConfigVar<bool> enableMirrorMode;
|
||||
ConfigVar<bool> minimalHUD;
|
||||
ConfigVar<bool> disableMainHUD;
|
||||
ConfigVar<bool> pauseOnFocusLost;
|
||||
ConfigVar<bool> enableLinkDollRotation;
|
||||
ConfigVar<bool> enableAchievementToasts;
|
||||
ConfigVar<bool> enableControllerToasts;
|
||||
ConfigVar<bool> enableDiscordPresence;
|
||||
ConfigVar<MenuScaling> menuScalingMode;
|
||||
ConfigVar<bool> enableAchievementNotifications;
|
||||
|
||||
|
||||
// Graphics
|
||||
ConfigVar<BloomMode> bloomMode;
|
||||
ConfigVar<float> bloomMultiplier;
|
||||
ConfigVar<DepthOfFieldMode> depthOfFieldMode;
|
||||
ConfigVar<bool> disableWaterRefraction;
|
||||
ConfigVar<bool> enableTextureReplacements;
|
||||
ConfigVar<FrameInterpMode> enableFrameInterpolation;
|
||||
ConfigVar<bool> enableFrameInterpolation;
|
||||
ConfigVar<int> internalResolutionScale;
|
||||
ConfigVar<int> shadowResolutionMultiplier;
|
||||
ConfigVar<Resampler> resampler;
|
||||
ConfigVar<bool> enableDepthOfField;
|
||||
ConfigVar<bool> enableMapBackground;
|
||||
ConfigVar<bool> disableCutscenePillarboxing;
|
||||
|
||||
// Audio
|
||||
ConfigVar<bool> noLowHpSound;
|
||||
ConfigVar<bool> midnasLamentNonStop;
|
||||
|
||||
// Input
|
||||
ConfigVar<GyroMode> gyroMode;
|
||||
ConfigVar<bool> enableGyroAim;
|
||||
ConfigVar<bool> enableGyroRollgoal;
|
||||
ConfigVar<float> gyroSensitivityX;
|
||||
@@ -200,19 +116,11 @@ struct UserSettings {
|
||||
ConfigVar<bool> freeCamera;
|
||||
ConfigVar<bool> invertCameraXAxis;
|
||||
ConfigVar<bool> invertCameraYAxis;
|
||||
ConfigVar<bool> invertFirstPersonXAxis;
|
||||
ConfigVar<bool> invertFirstPersonYAxis;
|
||||
ConfigVar<bool> invertAirSwimX;
|
||||
ConfigVar<bool> invertAirSwimY;
|
||||
ConfigVar<float> freeCameraSensitivity;
|
||||
ConfigVar<bool> debugFlyCam;
|
||||
ConfigVar<bool> debugFlyCamLockEvents;
|
||||
ConfigVar<bool> allowBackgroundInput;
|
||||
|
||||
// Cheats
|
||||
ConfigVar<bool> infiniteHearts;
|
||||
ConfigVar<bool> infiniteArrows;
|
||||
ConfigVar<bool> infiniteSeeds;
|
||||
ConfigVar<bool> infiniteBombs;
|
||||
ConfigVar<bool> infiniteOil;
|
||||
ConfigVar<bool> infiniteOxygen;
|
||||
@@ -223,47 +131,30 @@ struct UserSettings {
|
||||
ConfigVar<bool> alwaysGreatspin;
|
||||
ConfigVar<bool> enableFastIronBoots;
|
||||
ConfigVar<bool> canTransformAnywhere;
|
||||
ConfigVar<bool> fastRoll;
|
||||
ConfigVar<bool> fastSpinner;
|
||||
ConfigVar<bool> freeMagicArmor;
|
||||
ConfigVar<bool> invincibleEnemies;
|
||||
|
||||
// Technical
|
||||
ConfigVar<bool> restoreWiiGlitches;
|
||||
|
||||
// Controls
|
||||
ConfigVar<bool> enableTurboKeybind;
|
||||
ConfigVar<bool> enableResetKeybind;
|
||||
|
||||
// Tools
|
||||
ConfigVar<bool> speedrunMode;
|
||||
ConfigVar<bool> liveSplitEnabled;
|
||||
ConfigVar<bool> showSpeedrunRTATimer;
|
||||
ConfigVar<bool> recordingMode;
|
||||
ConfigVar<bool> removeQuestMapMarkers;
|
||||
ConfigVar<bool> showInputViewer;
|
||||
ConfigVar<bool> showInputViewerGyro;
|
||||
} game;
|
||||
|
||||
struct {
|
||||
ConfigVar<std::string> isoPath;
|
||||
ConfigVar<DiscVerificationState> isoVerification;
|
||||
ConfigVar<std::string> graphicsBackend;
|
||||
ConfigVar<bool> skipPreLaunchUI;
|
||||
ConfigVar<bool> showPipelineCompilation;
|
||||
ConfigVar<bool> wasPresetChosen;
|
||||
ConfigVar<bool> checkForUpdates;
|
||||
ConfigVar<bool> enableCrashReporting;
|
||||
ConfigVar<bool> duskMenuOpen;
|
||||
ConfigVar<int> cardFileType;
|
||||
ConfigVar<bool> enableAdvancedSettings;
|
||||
} backend;
|
||||
|
||||
// Arrays of size 4 for 4 ports
|
||||
struct {
|
||||
std::array<ActionBindConfigVar, 4> firstPersonCamera;
|
||||
std::array<ActionBindConfigVar, 4> callMidna;
|
||||
std::array<ActionBindConfigVar, 4> openDusklightMenu;
|
||||
std::array<ActionBindConfigVar, 4> turboSpeedButton;
|
||||
} actionBindings;
|
||||
};
|
||||
|
||||
UserSettings& getSettings();
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
#pragma once
|
||||
#include <aurora/aurora.h>
|
||||
|
||||
namespace dusk {
|
||||
|
||||
struct SpeedrunInfo {
|
||||
void startRun() {
|
||||
m_isRunStarted = true;
|
||||
m_startTimestamp = OSGetTime();
|
||||
}
|
||||
|
||||
void stopRun() {
|
||||
m_isRunStarted = false;
|
||||
m_endTimestamp = OSGetTime() - m_startTimestamp;
|
||||
}
|
||||
|
||||
void reset() {
|
||||
m_isRunStarted = false;
|
||||
m_startTimestamp = 0;
|
||||
m_endTimestamp = 0;
|
||||
m_isPauseIGT = false;
|
||||
m_loadStartTimestamp = 0;
|
||||
m_totalLoadTime = 0;
|
||||
m_igtTimer = 0;
|
||||
}
|
||||
|
||||
bool m_isRunStarted = false;
|
||||
OSTime m_startTimestamp = 0;
|
||||
OSTime m_endTimestamp = 0;
|
||||
|
||||
bool m_isPauseIGT = false;
|
||||
OSTime m_loadStartTimestamp = 0;
|
||||
OSTime m_totalLoadTime = 0;
|
||||
OSTime m_igtTimer = 0;
|
||||
};
|
||||
|
||||
extern SpeedrunInfo m_speedrunInfo;
|
||||
|
||||
void resetForSpeedrunMode();
|
||||
|
||||
} // namespace dusk
|
||||
+28
-98
@@ -1,55 +1,22 @@
|
||||
#ifndef DUSK_STRING_HPP
|
||||
#define DUSK_STRING_HPP
|
||||
#include <cstdarg>
|
||||
|
||||
#include "global.h"
|
||||
#include <cstring>
|
||||
#include <dolphin/os.h>
|
||||
|
||||
namespace dusk {
|
||||
|
||||
struct TextSpan {
|
||||
char* buffer;
|
||||
size_t size;
|
||||
|
||||
constexpr operator char*() const {
|
||||
return buffer;
|
||||
}
|
||||
|
||||
constexpr TextSpan(char* buffer, size_t size) : buffer(buffer), size(size) { }
|
||||
|
||||
template<size_t BufSize>
|
||||
constexpr TextSpan(char (&buffer)[BufSize]) : buffer(buffer), size(BufSize) {
|
||||
}
|
||||
|
||||
constexpr TextSpan() : buffer(nullptr), size(0) { }
|
||||
|
||||
constexpr TextSpan operator++(int) {
|
||||
const auto prev = *this;
|
||||
|
||||
if (size > 0) [[likely]] {
|
||||
size--;
|
||||
}
|
||||
buffer++;
|
||||
|
||||
return prev;
|
||||
}
|
||||
|
||||
constexpr char& operator*() const {
|
||||
if (size == 0) [[unlikely]] {
|
||||
CrashSpawnEmpty();
|
||||
}
|
||||
|
||||
return *buffer;
|
||||
}
|
||||
|
||||
private:
|
||||
static void CrashSpawnEmpty();
|
||||
};
|
||||
|
||||
#if TARGET_PC
|
||||
#define TEXT_SPAN dusk::TextSpan
|
||||
#else
|
||||
#define TEXT_SPAN char*
|
||||
inline void strncpyProxy(char* dst, const char* src, size_t count) {
|
||||
#if _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4996)
|
||||
#endif
|
||||
|
||||
void SafeStringCopyTruncate(char* buffer, size_t bufSize, const char* src);
|
||||
strncpy(dst, src, count);
|
||||
#if _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy a string to a fixed-size array.
|
||||
@@ -58,28 +25,13 @@ void SafeStringCopyTruncate(char* buffer, size_t bufSize, const char* src);
|
||||
template <size_t BufSize>
|
||||
void SafeStringCopyTruncate(char (&buffer)[BufSize], const char* src) {
|
||||
static_assert(BufSize > 0, "Target buffer cannot be size zero");
|
||||
SafeStringCopyTruncate(buffer, BufSize, src);
|
||||
}
|
||||
|
||||
void SafeStringCopy(char* buffer, size_t bufSize, const char* src);
|
||||
void SafeStringCat(char* buffer, size_t bufSize, const char* src);
|
||||
int SafeStringVPrintf(char* buffer, size_t bufSize, const char* src, std::va_list args);
|
||||
if (buffer == src) {
|
||||
CRASH("Cannot copy string to same buffer");
|
||||
}
|
||||
|
||||
inline void SafeStringCopy(TextSpan dst, const char* src) {
|
||||
SafeStringCopy(dst.buffer, dst.size, src);
|
||||
}
|
||||
|
||||
inline void SafeStringCat(TextSpan dst, const char* src) {
|
||||
SafeStringCat(dst.buffer, dst.size, src);
|
||||
}
|
||||
|
||||
inline int SafeStringPrintf(TextSpan dst, const char* format, ...) {
|
||||
std::va_list args;
|
||||
va_start(args, format);
|
||||
const auto ret = SafeStringVPrintf(dst.buffer, dst.size, format, args);
|
||||
va_end(args);
|
||||
|
||||
return ret;
|
||||
strncpyProxy(buffer, src, BufSize);
|
||||
buffer[BufSize - 1] = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -89,40 +41,18 @@ inline int SafeStringPrintf(TextSpan dst, const char* format, ...) {
|
||||
template <size_t BufSize>
|
||||
void SafeStringCopy(char (&buffer)[BufSize], const char* src) {
|
||||
static_assert(BufSize > 0, "Target buffer cannot be size zero");
|
||||
SafeStringCopy(buffer, BufSize, src);
|
||||
if (buffer == src) {
|
||||
CRASH("Cannot copy string to same buffer");
|
||||
}
|
||||
|
||||
if (strlen(src) > BufSize - 1) {
|
||||
CRASH("Destination buffer too small!");
|
||||
}
|
||||
|
||||
strncpyProxy(buffer, src, BufSize);
|
||||
buffer[BufSize - 1] = 0;
|
||||
}
|
||||
|
||||
template <size_t BufSize>
|
||||
void SafeStringCat(char (&buffer)[BufSize], const char* src) {
|
||||
static_assert(BufSize > 0, "Target buffer cannot be size zero");
|
||||
SafeStringCat(buffer, BufSize, src);
|
||||
}
|
||||
|
||||
template <size_t BufSize>
|
||||
int SafeStringPrintf(char (&buffer)[BufSize], const char* format, ...) {
|
||||
static_assert(BufSize > 0, "Target buffer cannot be size zero");
|
||||
|
||||
std::va_list args;
|
||||
va_start(args, format);
|
||||
const auto ret = SafeStringVPrintf(buffer, BufSize, format, args);
|
||||
va_end(args);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
#define SAFE_STRCPY dusk::SafeStringCopy
|
||||
#define SAFE_STRCAT dusk::SafeStringCat
|
||||
#define SAFE_SPRINTF dusk::SafeStringPrintf
|
||||
#define SAFE_STRCPY_BOUNDED dusk::SafeStringCopy
|
||||
#define SAFE_STRCAT_BOUNDED dusk::SafeStringCat
|
||||
#else
|
||||
#define SAFE_STRCPY strcpy
|
||||
#define SAFE_STRCAT strcat
|
||||
#define SAFE_SPRINTF sprintf
|
||||
#define SAFE_STRCPY_BOUNDED strcpy
|
||||
#define SAFE_STRCPY_BOUNDED strcat
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // DUSK_STRING_HPP
|
||||
|
||||
+4
-40
@@ -17,24 +17,16 @@
|
||||
#include <shellapi.h>
|
||||
#include <intrin.h>
|
||||
#endif
|
||||
#ifdef __APPLE__
|
||||
#include <mach/mach_time.h>
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
#include <immintrin.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
class Limiter {
|
||||
public:
|
||||
using duration_t = Uint64;
|
||||
|
||||
void Reset() {
|
||||
m_oldTime = SDL_GetTicksNS();
|
||||
}
|
||||
void Reset() { m_oldTime = SDL_GetTicksNS(); }
|
||||
|
||||
duration_t Sleep(duration_t targetFrameTime) {
|
||||
void Sleep(duration_t targetFrameTime) {
|
||||
if (targetFrameTime == 0) {
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
const Uint64 start = SDL_GetTicksNS();
|
||||
@@ -49,8 +41,6 @@ public:
|
||||
}
|
||||
}
|
||||
Reset();
|
||||
|
||||
return adjustedSleepTime;
|
||||
}
|
||||
|
||||
duration_t SleepTime(duration_t targetFrameTime) {
|
||||
@@ -84,6 +74,7 @@ private:
|
||||
if (!initialized || numSleeps++ % 1000 == 0) {
|
||||
LARGE_INTEGER freq;
|
||||
if (QueryPerformanceFrequency(&freq) == 0) {
|
||||
DuskLog.warn("QueryPerformanceFrequency failed: {}", GetLastError());
|
||||
return;
|
||||
}
|
||||
countPerNs = static_cast<double>(freq.QuadPart) / 1e9;
|
||||
@@ -107,33 +98,6 @@ private:
|
||||
#endif
|
||||
} while (current.QuadPart - start.QuadPart < ticksToWait);
|
||||
}
|
||||
#elif defined (__APPLE__)
|
||||
void NanoSleep(const duration_t duration) {
|
||||
// Hybrid approach using Apple Mach
|
||||
uint64_t start_mach = mach_absolute_time();
|
||||
|
||||
mach_timebase_info_data_t timebase_info;
|
||||
mach_timebase_info(&timebase_info);
|
||||
|
||||
uint64_t total_mach_ticks = (duration * timebase_info.denom) / timebase_info.numer;
|
||||
uint64_t target_mach = start_mach + total_mach_ticks;
|
||||
|
||||
uint64_t buffer_ns = 2'000'000ULL;
|
||||
uint64_t buffer_mach_ticks = (buffer_ns * timebase_info.denom) / timebase_info.numer;
|
||||
|
||||
if (total_mach_ticks > buffer_mach_ticks) {
|
||||
uint64_t sleep_until_mach = target_mach - buffer_mach_ticks;
|
||||
mach_wait_until(sleep_until_mach);
|
||||
}
|
||||
|
||||
while (mach_absolute_time() < target_mach) {
|
||||
#if defined(__aarch64__) || defined(__arm__)
|
||||
asm volatile("yield" ::: "memory"); // Hardware hint, not a scheduler hint.
|
||||
#else
|
||||
_mm_pause();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#else
|
||||
void NanoSleep(const duration_t duration) { SDL_DelayPrecise(duration); }
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
#pragma once
|
||||
#include <stddef.h>
|
||||
#ifndef __cplusplus
|
||||
#include <stdbool.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace dusk {
|
||||
#endif
|
||||
|
||||
// Reserve a contiguous virtual address range without committing physical pages
|
||||
void* vmem_reserve(size_t size);
|
||||
|
||||
// Commit physical backing for pages in a previously reserved range, ptr and size should be page-aligned
|
||||
bool vmem_commit(void* ptr, size_t size);
|
||||
|
||||
// Decommit physical pages in a reserved range, releasing RAM without releasing address space
|
||||
void vmem_decommit(void* ptr, size_t size);
|
||||
|
||||
// Release an entire virtual reservation obtained from vmem_reserve
|
||||
void vmem_release(void* ptr, size_t size);
|
||||
|
||||
// Returns the OS page size
|
||||
size_t vmem_page_size();
|
||||
|
||||
// Shared vmem arena
|
||||
// All JKR heap vmem reservations are sub-allocated from a single large reservation,
|
||||
// keeping the total entry count at 1 regardless of how many heaps exist
|
||||
|
||||
// Must be called once before any JKR heap is created
|
||||
void vmem_arena_init();
|
||||
|
||||
// Allocate a slot of size bytes (page-aligned) from the arena
|
||||
void* vmem_arena_alloc(size_t size);
|
||||
|
||||
// Return a slot to the arena and decommit its physical pages
|
||||
void vmem_arena_free(void* ptr, size_t size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // namespace dusk
|
||||
|
||||
// Total virtual address space reserved for the shared JKR heap arena
|
||||
inline constexpr size_t JKR_VMEM_ARENA_SIZE = 128ULL * 1024 * 1024 * 1024; // 128 GB
|
||||
|
||||
// Virtual address space reserved per JKR heap (one slot in the shared arena)
|
||||
inline constexpr size_t JKR_HEAP_VIRTUAL_RESERVE = 64ULL * 1024 * 1024; // 64 MB
|
||||
|
||||
// Minimum growth increment when a JKR heap expands into reserved but uncommitted pages
|
||||
inline constexpr size_t JKR_HEAP_GROW_CHUNK = 4ULL * 1024 * 1024; // 4 MB
|
||||
|
||||
// Maximum number of free slots the arena can track (= total slots in the arena)
|
||||
inline constexpr size_t JKR_VMEM_MAX_FREE_SLOTS = JKR_VMEM_ARENA_SIZE / JKR_HEAP_VIRTUAL_RESERVE;
|
||||
|
||||
#endif
|
||||
@@ -108,7 +108,7 @@ struct fopAcM_search_prm {
|
||||
struct fOpAcm_HIO_entry_c : public mDoHIO_entry_c {
|
||||
virtual ~fOpAcm_HIO_entry_c() {}
|
||||
|
||||
#if DEBUG && !TARGET_PC
|
||||
#if DEBUG
|
||||
void removeHIO(const fopAc_ac_c* i_this) { removeHIO(*i_this); }
|
||||
void removeHIO(const fopAc_ac_c& i_this) { removeHIO(i_this.base); }
|
||||
void removeHIO(const fopEn_enemy_c& i_this) { removeHIO(i_this.base); }
|
||||
|
||||
@@ -50,7 +50,7 @@ fpc_ProcID fopMsgM_messageSet(u32 i_msgIdx, fopAc_ac_c* i_talkActor, u32 param_2
|
||||
fpc_ProcID fopMsgM_messageSet(u32 i_msgIdx, u32 param_1);
|
||||
fpc_ProcID fopMsgM_messageSetDemo(u32 i_msgidx);
|
||||
msg_class* fopMsgM_SearchByID(fpc_ProcID i_id);
|
||||
TEXT_SPAN fopMsgM_messageGet(TEXT_SPAN i_stringBuf, u32 i_msgId);
|
||||
char* fopMsgM_messageGet(char* i_stringBuf, u32 i_msgId);
|
||||
fpc_ProcID fop_Timer_create(s16 i_procName, u8 i_mode, u32 i_limitMs, u8 i_type, u8 param_4,
|
||||
f32 param_5, f32 param_6, f32 param_7, f32 param_8,
|
||||
fopMsgCreateFunc i_createFunc);
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "Z2AudioLib/Z2EnvSeMgr.h"
|
||||
#include "Z2AudioLib/Z2LinkMgr.h"
|
||||
#include "dusk/audio.h"
|
||||
#include "dusk/settings.h"
|
||||
|
||||
class mDoAud_zelAudio_c : public Z2AudioMgr {
|
||||
public:
|
||||
@@ -133,18 +132,6 @@ inline void mDoAud_seStart(u32 i_sfxID, const Vec* i_sePos, u32 param_2, s8 i_re
|
||||
-1.0f, -1.0f, 0);
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
inline void mDoAud_seStartMenu(u32 i_sfxID) {
|
||||
if (!mDoAud_zelAudio_c::isInitFlag()) {
|
||||
return;
|
||||
}
|
||||
if (!dusk::getSettings().audio.menuSounds.getValue()) {
|
||||
return;
|
||||
}
|
||||
mDoAud_seStart(i_sfxID, nullptr, 0, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
inline void mDoAud_seStartLevel(u32 i_sfxID, const Vec* i_sePos, u32 param_2, s8 i_reverb) {
|
||||
DUSK_AUDIO_SKIP()
|
||||
Z2AudioMgr::getInterface()->seStartLevel(i_sfxID, i_sePos, param_2, i_reverb, 1.0f, 1.0f,
|
||||
|
||||
@@ -116,7 +116,7 @@ private:
|
||||
*
|
||||
*/
|
||||
struct J2DIndTexMtxInfo {
|
||||
/* 0x00 */ BE(Mtx23) mMtx;
|
||||
/* 0x00 */ Mtx23 mMtx;
|
||||
/* 0x18 */ s8 mScaleExp;
|
||||
|
||||
J2DIndTexMtxInfo& operator=(const J2DIndTexMtxInfo& other) {
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include "JSystem/J2DGraph/J2DMaterial.h"
|
||||
#include "JSystem/J2DGraph/J2DPane.h"
|
||||
#include "dusk/endian.h"
|
||||
#include "dusk/string.hpp"
|
||||
|
||||
class J2DMaterial;
|
||||
class JUTFont;
|
||||
@@ -99,8 +98,7 @@ public:
|
||||
void initiate(ResFONT const*, char const*, s16, J2DTextBoxHBinding,
|
||||
J2DTextBoxVBinding);
|
||||
void private_readStream(J2DPane*, JSURandomInputStream*, JKRArchive*);
|
||||
TEXT_SPAN getStringPtr() const;
|
||||
dusk::TextSpan getSpan() const;
|
||||
char* getStringPtr() const;
|
||||
s32 setString(s16, char const*, ...);
|
||||
s32 setString(char const*, ...);
|
||||
|
||||
|
||||
@@ -1575,12 +1575,6 @@ struct J3DAlphaComp {
|
||||
u8 getRef1() const { return mRef1; }
|
||||
|
||||
void load() const {
|
||||
#ifdef AVOID_UB
|
||||
if (mID > 255) {
|
||||
J3DGDSetAlphaCompare(GX_ALWAYS, 0, GX_AOP_OR, GX_ALWAYS, 0);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
J3DGDSetAlphaCompare((GXCompare)getComp0(), mRef0, (GXAlphaOp)getOp(), (GXCompare)getComp1(), mRef1);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifndef J3DSTRUCT_H
|
||||
#define J3DSTRUCT_H
|
||||
|
||||
#include <cstring>
|
||||
#include <gx.h>
|
||||
#include <mtx.h>
|
||||
#include <mtx.h>
|
||||
#include "global.h"
|
||||
#include "JSystem/JMath/JMath.h"
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-j3d
|
||||
*
|
||||
*
|
||||
*/
|
||||
struct J3DLightInfo {
|
||||
bool operator==(J3DLightInfo& other) const;
|
||||
@@ -28,7 +28,7 @@ struct J3DLightInfo {
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-j3d
|
||||
*
|
||||
*
|
||||
*/
|
||||
struct J3DTextureSRTInfo {
|
||||
// NOTE: Big endian when loaded from file!
|
||||
@@ -79,7 +79,7 @@ enum J3DTexMtxMode {
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-j3d
|
||||
*
|
||||
*
|
||||
*/
|
||||
struct J3DTexMtxInfo {
|
||||
bool operator==(J3DTexMtxInfo& other) const;
|
||||
@@ -97,7 +97,7 @@ struct J3DTexMtxInfo {
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-j3d
|
||||
*
|
||||
*
|
||||
*/
|
||||
struct J3DIndTexMtxInfo {
|
||||
J3DIndTexMtxInfo& operator=(J3DIndTexMtxInfo const&);
|
||||
@@ -107,7 +107,7 @@ struct J3DIndTexMtxInfo {
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-j3d
|
||||
*
|
||||
*
|
||||
*/
|
||||
struct J3DFogInfo {
|
||||
bool operator==(J3DFogInfo&) const;
|
||||
@@ -126,7 +126,7 @@ struct J3DFogInfo {
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-j3d
|
||||
*
|
||||
*
|
||||
*/
|
||||
struct J3DNBTScaleInfo {
|
||||
bool operator==(const J3DNBTScaleInfo& other) const;
|
||||
@@ -153,7 +153,7 @@ struct J3DIndTexOrderInfo {
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-j3d
|
||||
*
|
||||
*
|
||||
*/
|
||||
struct J3DTevSwapModeInfo {
|
||||
/* 0x0 */ u8 mRasSel;
|
||||
@@ -164,7 +164,7 @@ struct J3DTevSwapModeInfo {
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-j3d
|
||||
*
|
||||
*
|
||||
*/
|
||||
struct J3DTevSwapModeTableInfo {
|
||||
/* 0x0 */ u8 field_0x0;
|
||||
@@ -175,7 +175,7 @@ struct J3DTevSwapModeTableInfo {
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-j3d
|
||||
*
|
||||
*
|
||||
*/
|
||||
struct J3DTevStageInfo {
|
||||
/* 0x0 */ u8 field_0x0;
|
||||
@@ -202,7 +202,7 @@ struct J3DTevStageInfo {
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-j3d
|
||||
*
|
||||
*
|
||||
*/
|
||||
struct J3DIndTevStageInfo {
|
||||
/* 0x0 */ u8 mIndStage;
|
||||
@@ -219,7 +219,7 @@ struct J3DIndTevStageInfo {
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-j3d
|
||||
*
|
||||
*
|
||||
*/
|
||||
struct J3DTexCoordInfo {
|
||||
/* 0x0 */ u8 mTexGenType;
|
||||
@@ -265,7 +265,7 @@ struct J3DBlendInfo {
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-j3d
|
||||
*
|
||||
*
|
||||
*/
|
||||
struct J3DTevOrderInfo {
|
||||
void operator=(const J3DTevOrderInfo& other) {
|
||||
|
||||
@@ -59,9 +59,6 @@ public:
|
||||
bool isActive() const { return mSeqList.getNumLinks() != 0; }
|
||||
int getNumActiveSeqs() const { return mSeqList.getNumLinks(); }
|
||||
void pause(bool paused) { mActivity.field_0x0.flags.flag2 = paused; }
|
||||
#if TARGET_PC
|
||||
JSUList<JAISeq>* getSeqList() { return &mSeqList; }
|
||||
#endif
|
||||
|
||||
private:
|
||||
/* 0x08 */ JAIAudience* mAudience;
|
||||
|
||||
@@ -287,28 +287,28 @@ template <typename T>
|
||||
class JASPoolAllocObject {
|
||||
public:
|
||||
#if TARGET_PC
|
||||
static void* operator new(size_t n, JKRHeapToken) IF_DUSK(noexcept) {
|
||||
static void* operator new(size_t n, JKRHeapToken) {
|
||||
return operator new(n);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void* operator new(size_t n) IF_DUSK(noexcept) {
|
||||
static void* operator new(size_t n) {
|
||||
#if PLATFORM_GCN
|
||||
JASMemPool<T>& memPool_ = getMemPool_();
|
||||
#endif
|
||||
return memPool_.alloc(n);
|
||||
}
|
||||
static void* operator new(size_t n, void* ptr) IF_DUSK(noexcept) {
|
||||
static void* operator new(size_t n, void* ptr) {
|
||||
return ptr;
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
static void operator delete(void* ptr, size_t n, JKRHeapToken) IF_DUSK(noexcept) {
|
||||
static void operator delete(void* ptr, size_t n, JKRHeapToken) {
|
||||
operator delete(ptr, n);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void operator delete(void* ptr, size_t n) IF_DUSK(noexcept) {
|
||||
static void operator delete(void* ptr, size_t n) {
|
||||
#if PLATFORM_GCN
|
||||
JASMemPool<T>& memPool_ = getMemPool_();
|
||||
#endif
|
||||
@@ -402,28 +402,28 @@ template <typename T>
|
||||
class JASPoolAllocObject_MultiThreaded {
|
||||
public:
|
||||
#if TARGET_PC
|
||||
static void* operator new(size_t n, JKRHeapToken) IF_DUSK(noexcept) {
|
||||
static void* operator new(size_t n, JKRHeapToken) {
|
||||
return operator new(n);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void* operator new(size_t n) IF_DUSK(noexcept) {
|
||||
static void* operator new(size_t n) {
|
||||
#if PLATFORM_GCN
|
||||
JASMemPool_MultiThreaded<T>& memPool_ = getMemPool();
|
||||
#endif
|
||||
return memPool_.alloc(n);
|
||||
}
|
||||
static void* operator new(size_t n, void* ptr) IF_DUSK(noexcept) {
|
||||
static void* operator new(size_t n, void* ptr) {
|
||||
return ptr;
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
static void operator delete(void* ptr, size_t n, JKRHeapToken) IF_DUSK(noexcept) {
|
||||
static void operator delete(void* ptr, size_t n, JKRHeapToken) {
|
||||
return operator delete(ptr, n);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void operator delete(void* ptr, size_t n) IF_DUSK(noexcept) {
|
||||
static void operator delete(void* ptr, size_t n) {
|
||||
#if PLATFORM_GCN
|
||||
JASMemPool_MultiThreaded<T>& memPool_ = getMemPool();
|
||||
#endif
|
||||
|
||||
@@ -127,6 +127,13 @@ public:
|
||||
[[nodiscard]] const CMemBlock* getFreeHead() const { return mHeadFreeList; }
|
||||
[[nodiscard]] CMemBlock* getUsedHead() { return mHeadUsedList; }
|
||||
[[nodiscard]] const CMemBlock* getUsedHead() const { return mHeadUsedList; }
|
||||
|
||||
void* mVmemBase; // base of VM reservation
|
||||
size_t mVmemCapacity; // total reserved bytes
|
||||
size_t mVmemCommitted; // page-aligned committed bytes so far
|
||||
|
||||
// Commit more pages and splice them into the free list
|
||||
bool growHeap(u32 needed);
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -237,11 +237,11 @@ enum class JKRHeapToken {
|
||||
Dummy
|
||||
};
|
||||
|
||||
inline void* operator new(size_t, JKRHeapToken, void* where) noexcept {
|
||||
inline void* operator new(size_t, JKRHeapToken, void* where) {
|
||||
return where;
|
||||
}
|
||||
|
||||
inline void* operator new[](size_t, JKRHeapToken, void* where) noexcept {
|
||||
inline void* operator new[](size_t, JKRHeapToken, void* where) {
|
||||
return where;
|
||||
}
|
||||
|
||||
@@ -264,21 +264,21 @@ inline void* operator new[](size_t, JKRHeapToken, void* where) noexcept {
|
||||
#define JKR_HEAP_TOKEN_PARAM
|
||||
#endif
|
||||
|
||||
void* operator new(size_t size JKR_HEAP_TOKEN_PARAM) IF_DUSK(noexcept);
|
||||
void* operator new(size_t size JKR_HEAP_TOKEN_PARAM, int alignment) IF_DUSK(noexcept);
|
||||
void* operator new(size_t size JKR_HEAP_TOKEN_PARAM, JKRHeap* heap, int alignment) IF_DUSK(noexcept);
|
||||
void* operator new(size_t size JKR_HEAP_TOKEN_PARAM);
|
||||
void* operator new(size_t size JKR_HEAP_TOKEN_PARAM, int alignment);
|
||||
void* operator new(size_t size JKR_HEAP_TOKEN_PARAM, JKRHeap* heap, int alignment);
|
||||
|
||||
// On PC, these new[] overloads are only used to catch usages of JKR_NEW with [].
|
||||
void* operator new[](size_t size JKR_HEAP_TOKEN_PARAM) IF_DUSK(noexcept);
|
||||
void* operator new[](size_t size JKR_HEAP_TOKEN_PARAM, int alignment) IF_DUSK(noexcept);
|
||||
void* operator new[](size_t size JKR_HEAP_TOKEN_PARAM, JKRHeap* heap, int alignment) IF_DUSK(noexcept);
|
||||
void* operator new[](size_t size JKR_HEAP_TOKEN_PARAM);
|
||||
void* operator new[](size_t size JKR_HEAP_TOKEN_PARAM, int alignment);
|
||||
void* operator new[](size_t size JKR_HEAP_TOKEN_PARAM, JKRHeap* heap, int alignment);
|
||||
|
||||
void operator delete(void* ptr JKR_HEAP_TOKEN_PARAM) IF_DUSK(noexcept);
|
||||
void operator delete[](void* ptr JKR_HEAP_TOKEN_PARAM) IF_DUSK(noexcept);
|
||||
void operator delete(void* ptr JKR_HEAP_TOKEN_PARAM);
|
||||
void operator delete[](void* ptr JKR_HEAP_TOKEN_PARAM);
|
||||
|
||||
#if TARGET_PC
|
||||
template<typename T>
|
||||
void jkrDelete(T* ptr) IF_DUSK(noexcept) {
|
||||
void jkrDelete(T* ptr) {
|
||||
if (ptr == nullptr) {
|
||||
return;
|
||||
}
|
||||
@@ -298,7 +298,7 @@ void jkrDelete(T* ptr) IF_DUSK(noexcept) {
|
||||
}
|
||||
|
||||
template<>
|
||||
inline void jkrDelete(void* ptr) IF_DUSK(noexcept) {
|
||||
inline void jkrDelete(void* ptr) {
|
||||
if (ptr == nullptr) {
|
||||
return;
|
||||
}
|
||||
@@ -322,7 +322,7 @@ constexpr bool newArgsHasCustomAlignment() {
|
||||
}
|
||||
|
||||
template<typename T, typename... Args>
|
||||
T* jkrNewArray(size_t count, std::in_place_type_t<T>, Args&&... args) IF_DUSK(noexcept) {
|
||||
T* jkrNewArray(size_t count, std::in_place_type_t<T>, Args&&... args) {
|
||||
size_t allocSize = count * sizeof(T);
|
||||
if constexpr (!std::is_trivially_destructible<T>()) {
|
||||
static_assert(
|
||||
@@ -333,10 +333,6 @@ T* jkrNewArray(size_t count, std::in_place_type_t<T>, Args&&... args) IF_DUSK(no
|
||||
}
|
||||
|
||||
void* ptr = operator new(allocSize, JKRHeapToken::Dummy, args...);
|
||||
if (!ptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
T* dataPtr;
|
||||
if constexpr (!std::is_trivially_destructible<T>()) {
|
||||
auto length = static_cast<size_t*>(ptr);
|
||||
@@ -356,7 +352,7 @@ T* jkrNewArray(size_t count, std::in_place_type_t<T>, Args&&... args) IF_DUSK(no
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void jkrDeleteArray(T* pointer) IF_DUSK(noexcept) {
|
||||
void jkrDeleteArray(T* pointer) {
|
||||
if (pointer == nullptr) {
|
||||
return;
|
||||
}
|
||||
@@ -376,7 +372,7 @@ void jkrDeleteArray(T* pointer) IF_DUSK(noexcept) {
|
||||
}
|
||||
|
||||
template<>
|
||||
inline void jkrDeleteArray(void* pointer) IF_DUSK(noexcept) {
|
||||
inline void jkrDeleteArray(void* pointer) {
|
||||
if (pointer == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -61,6 +61,15 @@ public:
|
||||
static JKRSolidHeap* create(u32, JKRHeap*, bool);
|
||||
|
||||
static void* getState_(TState* state) { return getState_buf_(state); }
|
||||
|
||||
#if TARGET_PC
|
||||
void* mVmemBase; // base of VM reservation
|
||||
size_t mVmemCapacity; // total reserved bytes
|
||||
size_t mVmemCommitted; // page-aligned committed bytes so far
|
||||
|
||||
// Commit more pages and extend the free region
|
||||
bool growHeap(u32 needed);
|
||||
#endif
|
||||
};
|
||||
|
||||
inline JKRSolidHeap* JKRCreateSolidHeap(u32 param_0, JKRHeap* heap, bool param_2) {
|
||||
|
||||
@@ -207,11 +207,4 @@ void JPARegistAlphaEnv(JPAEmitterWorkData*, JPABaseParticle*);
|
||||
void JPARegistPrmAlpha(JPAEmitterWorkData*, JPABaseParticle*);
|
||||
void JPARegistPrmAlphaEnv(JPAEmitterWorkData*, JPABaseParticle*);
|
||||
|
||||
#if TARGET_PC
|
||||
void JPAInterpBillboard(JPAEmitterWorkData*, JPABaseParticle*);
|
||||
void JPAInterpRotBillboard(JPAEmitterWorkData*, JPABaseParticle*);
|
||||
void JPAInterpDirection(JPAEmitterWorkData*, JPABaseParticle*);
|
||||
void JPAInterpRotDirection(JPAEmitterWorkData*, JPABaseParticle*);
|
||||
#endif
|
||||
|
||||
#endif /* JPABASESHAPE_H */
|
||||
|
||||
@@ -24,9 +24,6 @@ public:
|
||||
void init_c(JPAEmitterWorkData*, JPABaseParticle*);
|
||||
bool calc_p(JPAEmitterWorkData*);
|
||||
bool calc_c(JPAEmitterWorkData*);
|
||||
#if TARGET_PC
|
||||
void interp(JPAEmitterWorkData*, void const* drawFunc);
|
||||
#endif
|
||||
bool canCreateChild(JPAEmitterWorkData*);
|
||||
f32 getWidth(JPABaseEmitter const*) const;
|
||||
f32 getHeight(JPABaseEmitter const*) const;
|
||||
|
||||
@@ -40,9 +40,6 @@ public:
|
||||
JUTTransparency getTransparency() const { return JUTTransparency(mTransparency); }
|
||||
u16 getNumColors() const { return mNumColors; }
|
||||
ResTLUT* getColorTable() const { return mColorTable; }
|
||||
#if TARGET_PC
|
||||
void dataUploaded();
|
||||
#endif
|
||||
|
||||
private:
|
||||
/* 0x00 */ GXTlutObj mTlutObj;
|
||||
|
||||
@@ -75,7 +75,6 @@ public:
|
||||
s32 getTransparency() const { return mTexInfo->alphaEnabled; }
|
||||
s32 getWidth() const { return mTexInfo->width; }
|
||||
s32 getHeight() const { return mTexInfo->height; }
|
||||
JUTPalette* getPalette() const { return mPalette; }
|
||||
void setCaptureFlag(bool flag) { mFlags &= 2 | flag; }
|
||||
bool getCaptureFlag() const { return mFlags & 1; }
|
||||
bool getEmbPaletteDelFlag() const { return mFlags & 2; }
|
||||
@@ -83,7 +82,7 @@ public:
|
||||
int getTlutName() const { return mTlutName; }
|
||||
bool operator==(const JUTTexture& other) {
|
||||
return mTexInfo == other.mTexInfo
|
||||
&& mPalette == other.mPalette
|
||||
&& field_0x2c == other.field_0x2c
|
||||
&& mWrapS == other.mWrapS
|
||||
&& mWrapT == other.mWrapT
|
||||
&& mMinFilter == other.mMinFilter
|
||||
@@ -101,7 +100,7 @@ private:
|
||||
/* 0x20 */ const ResTIMG* mTexInfo;
|
||||
/* 0x24 */ void* mTexData;
|
||||
/* 0x28 */ JUTPalette* mEmbPalette;
|
||||
/* 0x2C */ JUTPalette* mPalette;
|
||||
/* 0x2C */ JUTPalette* field_0x2c;
|
||||
/* 0x30 */ u8 mWrapS;
|
||||
/* 0x31 */ u8 mWrapT;
|
||||
/* 0x32 */ u8 mMinFilter;
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
#include <cstring>
|
||||
#include <types.h>
|
||||
|
||||
#include "dusk/string.hpp"
|
||||
|
||||
J2DMaterialFactory::J2DMaterialFactory(J2DMaterialBlock const& param_0) {
|
||||
mMaterialNum = param_0.field_0x8;
|
||||
mpMaterialInitData = JSUConvertOffsetToPtr<J2DMaterialInitData>(¶m_0, param_0.field_0xc);
|
||||
@@ -94,7 +92,7 @@ J2DMaterial* J2DMaterialFactory::create(J2DMaterial* param_0, int index, u32 par
|
||||
}
|
||||
if (local_380 == NULL && J2DScreen::getDataManage() != NULL) {
|
||||
char acStack_230[257];
|
||||
SAFE_STRCPY(acStack_230, param_3->getName(texNo));
|
||||
strcpy(acStack_230, param_3->getName(texNo));
|
||||
local_380 = J2DScreen::getDataManage()->get(acStack_230);
|
||||
}
|
||||
}
|
||||
@@ -113,7 +111,7 @@ J2DMaterial* J2DMaterialFactory::create(J2DMaterial* param_0, int index, u32 par
|
||||
}
|
||||
if (local_388 == NULL && J2DScreen::getDataManage() != NULL) {
|
||||
char acStack_334[257];
|
||||
SAFE_STRCPY(acStack_334, param_4->getName(param_0->getTevBlock()->getFontNo()));
|
||||
strcpy(acStack_334, param_4->getName(param_0->getTevBlock()->getFontNo()));
|
||||
local_388 = J2DScreen::getDataManage()->get(acStack_334);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,14 +68,8 @@ void J2DIndTevStage::load(u8 tevStage) {
|
||||
}
|
||||
|
||||
void J2DIndTexMtx::load(u8 indTexMtx) {
|
||||
#ifdef TARGET_PC
|
||||
Mtx23 mtx;
|
||||
mIndTexMtxInfo.mMtx.to_host(mtx);
|
||||
GXSetIndTexMtx((GXIndTexMtxID)(GX_ITM_0 + indTexMtx), mtx, mIndTexMtxInfo.mScaleExp);
|
||||
#else
|
||||
GXSetIndTexMtx((GXIndTexMtxID)(GX_ITM_0 + indTexMtx), mIndTexMtxInfo.mMtx,
|
||||
mIndTexMtxInfo.mScaleExp);
|
||||
#endif
|
||||
}
|
||||
|
||||
void J2DIndTexCoordScale::load(u8 indTexStage) {
|
||||
|
||||
@@ -309,12 +309,8 @@ void J2DTextBox::draw(f32 posX, f32 posY, f32 param_2, J2DTextBoxHBinding hBind)
|
||||
}
|
||||
}
|
||||
|
||||
TEXT_SPAN J2DTextBox::getStringPtr() const {
|
||||
#if TARGET_PC
|
||||
return { mStringPtr, mStringLength };
|
||||
#else
|
||||
char* J2DTextBox::getStringPtr() const {
|
||||
return mStringPtr;
|
||||
#endif
|
||||
}
|
||||
|
||||
s32 J2DTextBox::setString(char const* string, ...) {
|
||||
@@ -334,7 +330,7 @@ s32 J2DTextBox::setString(char const* string, ...) {
|
||||
|
||||
if (mStringPtr) {
|
||||
mStringLength = len + 1;
|
||||
SAFE_STRCPY_BOUNDED(mStringPtr, mStringLength, string);
|
||||
strcpy(mStringPtr, string);
|
||||
}
|
||||
|
||||
va_end(args);
|
||||
|
||||
@@ -556,8 +556,8 @@ void J3DModelLoader::readVertexData(const J3DVertexBlock& block, J3DVertexData&
|
||||
|
||||
if (attr == GX_VA_POS) {
|
||||
// can be a little off due to 0x20 alignment, account for that
|
||||
// u32 expect = ((data.mVtxNum * vertStride) + 0x1F) & ~0x1F;
|
||||
// JUT_ASSERT(1234, expect == addrDiff);
|
||||
u32 expect = ((data.mVtxNum * vertStride) + 0x1F) & ~0x1F;
|
||||
JUT_ASSERT(1234, expect == addrDiff);
|
||||
} else if (attr == GX_VA_NRM) {
|
||||
data.mNrmNum = num;
|
||||
} else if (attr == GX_VA_CLR0) {
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
#include <JSystem/JUtility/JUTAssert.h>
|
||||
#include <cstring>
|
||||
|
||||
#include "dusk/string.hpp"
|
||||
|
||||
u32 JAHVirtualNode::smVirNodeNum;
|
||||
|
||||
void JAHVirtualNode::virtualMessage(JAHControl& control) {
|
||||
@@ -79,7 +77,7 @@ void JAHVirtualNode::setVirNodeName(const char* name) {
|
||||
// clang-format off
|
||||
JUT_ASSERT(141, size<32);
|
||||
// clang-format on
|
||||
SAFE_STRCPY(mName, name);
|
||||
strcpy(mName, name);
|
||||
}
|
||||
|
||||
JAHVirtualNode::JAHVirtualNode(const char* name) : mTree(this) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user