Compare commits

..

52 Commits

Author SHA1 Message Date
Luke Street 8b6f989315 Update aurora 2026-05-24 22:56:06 -06:00
Olivia!! f03bd71612 store config to disk when destroying ui (#1791) 2026-05-24 22:20:32 -06:00
Luke Street 2e1cc7cb26 Save config when hiding controller config window 2026-05-24 22:17:24 -06:00
SuperDude88 498868c17d Invert Air/Swim Axes (#1155)
* Invert Air/Swim Axes

Apparently this is a setting in TPHD, so for parity's sake I'll throw it in here

* Invert Air Controls

Thanks @Abzol for knowing exactly where this is
2026-05-24 22:12:36 -06:00
Loïs 2a3bc722d9 Add in-process crash handler with symbolizable backtrace (#1536) 2026-05-24 22:11:45 -06:00
Ash 326ef70afa feat: more info in player info window (#1641)
* wip: more info in player info window

* wip: 3d speed + vel vec + ui change

* wip: add epona velocity vec

* wip: remove dead code + add format indexing
2026-05-24 22:08:37 -06:00
Luke Street 1f970eb2dc More ZoneScoped 2026-05-24 17:45:04 -06:00
Luke Street 8aaf451708 Update Android SDLActivity 2026-05-24 17:44:54 -06:00
Luke Street a8a2f5c84c Disable OSReport in release builds 2026-05-24 17:44:43 -06:00
Luke Street fa074a2311 Disable STUB_LOG in release 2026-05-24 17:44:05 -06:00
Luke Street 1f1f7e324b Use absl::flat_hash_map in frame_interpolation 2026-05-24 17:43:51 -06:00
Luke Street 8905fbc1eb Downgrade SDL3 for Android 2026-05-24 17:43:39 -06:00
Luke Street c207150ae9 Fix achievement logic startup crash 2026-05-24 13:00:41 -06:00
Luke Street d73b0be801 Update aurora 2026-05-24 12:57:06 -06:00
Irastris 78e1a05aef Various mirror mode fixes (#1725)
* Fix mirror mode stage map scrolling

* Fix Link's arrow rotation on fullscreen map

* Fix fishing in mirror mode

* Fix cucco controls in mirror mode

* Only stick_x is necessary

---------

Co-authored-by: TakaRikka <38417346+TakaRikka@users.noreply.github.com>
Co-authored-by: Luke Street <luke@street.dev>
2026-05-24 12:31:04 -06:00
qwertyquerty 8668474a33 Achievements improvements v2 (#1553)
* make LJA achievement more attainable glitchlessly

* update loach achievement description

* 3 kill rollstab achievement

* update gone fishin description

* gorge skip achievement

* early city achievement

* make goats and snowboarding safety check stage

* fix indomitable requirement, add hero mode achievement

* properly check skybook completion when returned

* prototype ganondorf achievement

* Autospin Annihilation
2026-05-24 12:18:07 -06:00
Pieter-Jan Briers a6376368ee String safety (#1548)
* Array size UB fixes

* Fix ShieldD

* Remove (almost) all unsafe strcpy calls

Bunch of macros. C arrays are easy enough and just need a different call. For various cases where a char* is passed around bare, I've made a TEXT_SPAN macro that can store a length too for bounds checking.

* Move crash handling in safe string operations to separate TU

* strcat safe version

* sprintf made safe too

* Fix compile
2026-05-24 10:43:00 -06:00
Jasper St. Pierre af162bbd0a New Depth of Field implementation (#1773) 2026-05-24 10:41:59 -06:00
Luke Street 0504f1dda7 Uodate aurora 2026-05-24 05:31:15 -06:00
Olivia!! edc4aa0be4 Fixes linux credits crash (#1780)
alpha comparison mID is u16, but indexes into a 256-item table.
this causes MAT3 materials with an alpha comparison index of 0xFF crashes on linux

closes #1073
closes #1531
2026-05-23 21:31:19 -06:00
Olivia!! ac316f6288 fixes empty howl tab near certain actors (#1771)
When howling suns song near actors that arent howl stones, an empty howl tab was shown.
This fixes the issue by duplicating a check for sun's song howling into the relevant code branch.
2026-05-23 20:16:02 -06:00
Irastris 114e6e60bb build.yml revisions (#1744)
* build.yml revisions

* Undo push and PR changes
2026-05-23 20:15:32 -06:00
Reilly Brogan e9a7628218 linux: Fix Wayland window associations (#1718)
* linux: Fix Wayland window associations

`src/m_Do/m_Do_main.cpp` uses `SDL_SetAppMetadata("Dusklight", DUSK_VERSION_STRING, "dev.twilitrealm.dusk")` which results in the Wayland appId getting set to `dev.twilitrealm.dusk`. Wayland compositors associate Wayland windows to desktop files by comparing the window appId against installed desktop files by the name of the desktop files. For a given window with appId `dev.twilitrealm.dusk` it would look for `dev.twilitrealm.dusk.desktop`, and because the desktop file is not named that the compositor is unable to correctly associate the window which results in the default Wayland icon being shown for the window. It also results in windows not being associated with the given launcher if the desktop file is pinned to a task management widget of some kind.

Fix this by renaming the desktop file to `dev.twilitrealm.dusk.desktop`. Also while we're at it we can rename the icons as well to match the desktop file name, which isn't required but is a bit cleaner and will fit various packaging standards better.

Signed-off-by: Reilly Brogan <reilly@reillybrogan.com>

* Use dev.twilitrealm.dusk instead

---------

Signed-off-by: Reilly Brogan <reilly@reillybrogan.com>
2026-05-23 19:56:24 -06:00
Carlos Manuel 533c76f4d6 Add support for changing save location on Android (#1520)
- Enabled the Android UI path for changing the data folder
- Added Android MANAGE_EXTERNAL_STORAGE permission
- Added an Android flow to request “All files access” before opening the folder picker
- Added code path to resume the folder selection flow after returning from Android settings
- Improved the Android write-probe error message to point users at the required permission
2026-05-23 19:43:02 -06:00
SuperDude88 beb4146f33 Rework No Heart Drops (#1448)
- Check the setting once in daItem_c::_daItem_create
2026-05-23 19:41:18 -06:00
Luke Street ce0185adc4 CI: Add ARM64 Windows and Linux builds (#1778)
* ci: Try arm64 Linux/Windows builds

* Update aurora

* Explicitly set CMAKE_SYSTEM_PROCESSOR on Windows

* Update build-appimage.sh for aarch64

* Set Rust_RUSTUP_INSTALL_MISSING_TARGET=ON

* Use CMAKE_SYSTEM_PROCESSOR normalization for jpeg-turbo build too

* MSVC ARM64 support for freeverb
2026-05-23 19:32:50 -06:00
Luke Street db7e2a1e7b Update aurora 2026-05-23 17:00:08 -06:00
Luke Street 7a3e8977f1 Disabled vendored Dawn for macOS 2026-05-23 16:31:24 -06:00
Luke Street e4caf20a7a Update aurora 2026-05-23 16:27:28 -06:00
Luke Street a68f4ae1e6 Update aurora 2026-05-23 16:20:11 -06:00
Luke Street 05393fe7aa Update aurora 2026-05-23 15:52:21 -06:00
Carl 1711251cf5 Android: derive versionName and versionCode from git tag (#1593) 2026-05-23 07:22:24 -06:00
Loïs c804b1f663 Rework nix flake for offline multi-platform builds (#1601)
* Rework flake.nix for offline multi-platform builds (Linux & macOS)

* fix typo + fmt
2026-05-23 07:20:45 -06:00
Irastris c49f0e5c6e Use std::chrono for THP playback pacing (#1757)
* Use std::chrono for THP playback pacing

* Redundant include
2026-05-23 07:18:29 -06:00
Irastris 9655b827f3 Add KI_NUMPADENTER as input for NavCommand::Confirm (#1752) 2026-05-23 00:23:46 -04:00
doop 6a52cdf80e UI/copy tweaks (#1756)
* "Mortal Edge" description nit

"Darkhammer" seems to be the more common rendering of the name.

* Add missing option descriptions

* Tighten spacing for version/disc info on mobile

* Graphics API init failure message nit
2026-05-23 00:23:22 -04:00
TakaRikka ba6ef0d250 Merge pull request #1689 from itssecretnate/map_offset_fix
Fixed mirror mode dungeon map's offset
2026-05-21 00:13:19 -07:00
TakaRikka f7a5d88dfd Merge pull request #1674 from TwilitRealm/poecount
map poe counter option
2026-05-21 00:06:04 -07:00
Nathan Mena 8ac2658f54 fixed dungeon map offset in mirror mode 2026-05-20 15:15:28 -06:00
TakaRikka 0cb93a2a9f Merge branches 'poecount' and 'main' of ssh://github.com/TwilitRealm/dusklight into poecount 2026-05-20 13:24:57 -07:00
JaxonKEKW 716a2b4020 Improve Collection/File Select screens at Widescreen/Ultrawide (#1614)
* Improve Widescreen/Ultrawide Collection/File Select Menus

Re-scale (unstretch) and center elements of the Collection Screen/File Select details screen for Widescreen/Ultrawide

* Fix oversight

Fix default behavior

* Support ultrawide on Collection menu, target PC

support ultrawide instead of reverting to default behavior

wrap logic in target PC ifdefs (both changed functions themselves are still behind them as a whole as well) and use old function behavior otherwise

* Fix icon overshift at ultrawide

Icon shifted too much at ultrawide

Move redundant duplicate line

* Finished Collection/File Select screen changes

Added settings for the scaling mode (GameCube, Wii, Dusklight)

Depending on the setting in the Interface menu (Dusklight preset automatically sets scaling to Dusklight option, Classic preset sets to Gamecube, Wii/all old behavior available as well) Collection and File Select screens get scaled differently

Fixed backdrop behind slots on File Select with Dusklight setting (the Magic Armor background slot seeming too low on all aspects is vanilla behavior)

Fixed Fused Shadow/Mirror size and position with Dusklight setting

All logic is behind TARGET_PC gates (not the logic specifically, but the functions themselves have always been)

Changes  dSelect_cursor_c::refreshAspectScale to take a parameter so the scale of the selection cursor can be reset to default (only ever called in TARGET_PC functions or wrapped in gates)

* Ultrawide oversight

* Update d_file_select.cpp

copy paste oopsie

* Update d_file_select.cpp

im tired, never tested msvc

* Menu Scaling Mode

changed definitions to be more open ended

header additions now in TARGET_PC ifdefs

fixed/added scaling for Save/Option buttons in Collection menu with Dusklight setting, stopped scaling just the text

* Update settings.cpp
2026-05-20 15:55:38 -04:00
TakaRikka 069650295c dmap count fix 2026-05-20 04:06:33 -07:00
TakaRikka 5119135068 dmap poe counter 2026-05-20 04:03:32 -07:00
TakaRikka fa660ebd0f fmap poe counter 2026-05-20 03:19:25 -07:00
TakaRikka 5d6e58eeac Merge pull request #1129 from Krutonium/improvement/toggle_owl_statue_markers
Add ability to toggle off Owl Statue Markers on Map
2026-05-19 16:46:56 -07:00
MelonSpeedruns cd97563d3f Merge branch 'main' into improvement/toggle_owl_statue_markers 2026-05-19 10:10:11 -04:00
TakaRikka 43e8563609 Merge pull request #1615 from PJB3005/26-05-18-charge-bouclier
Fix truncating button name
2026-05-18 18:37:42 -07:00
PJB3005 aa8f905768 Fix truncating button name
Fixes https://github.com/TwilitRealm/dusklight/issues/1549
2026-05-18 21:23:03 +02:00
Krutonium 273af7beb6 Figured it out, compiles now 2026-05-12 19:02:43 -04:00
Krutonium 18cbb584c6 Fix the order of entries
Based on the build error the CI gave, I think this is the issue.
2026-05-12 18:39:18 -04:00
Krutonium 42cded342e Merge branch 'main' into improvement/toggle_owl_statue_markers 2026-05-12 18:22:09 -04:00
Krutonium 696e8e6aa9 Add ability to toggle off Owl Statue Markers on Map 2026-05-12 17:36:34 -04:00
169 changed files with 3488 additions and 1061 deletions
+16 -12
View File
@@ -7,6 +7,10 @@ on:
- '*LICENSE' - '*LICENSE'
pull_request: 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: env:
SCCACHE_GHA_ENABLED: "true" SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache" RUSTC_WRAPPER: "sccache"
@@ -22,13 +26,13 @@ jobs:
matrix: matrix:
include: include:
- name: GCC x86_64 - name: GCC x86_64
runner: ubuntu-latest runner: ubuntu-24.04
preset: gcc preset: gcc
artifact_arch: x86_64 artifact_arch: x86_64
# - name: GCC aarch64 - name: GCC aarch64
# runner: ubuntu-24.04-arm runner: ubuntu-24.04-arm
# preset: gcc preset: gcc
# artifact_arch: aarch64 artifact_arch: aarch64
# - name: Clang x86_64 # - name: Clang x86_64
# runner: ubuntu-latest # runner: ubuntu-latest
# preset: clang # preset: clang
@@ -221,12 +225,12 @@ jobs:
msvc_arch: amd64 msvc_arch: amd64
vcpkg_arch: x64 vcpkg_arch: x64
artifact_arch: x86_64 artifact_arch: x86_64
# - name: MSVC arm64 - name: MSVC arm64
# runner: windows-11-arm runner: windows-latest
# preset: arm64-msvc preset: arm64-msvc
# msvc_arch: arm64 msvc_arch: amd64_arm64
# vcpkg_arch: arm64 vcpkg_arch: arm64
# artifact_arch: arm64 artifact_arch: arm64
# - name: Clang x86_64 # - name: Clang x86_64
# runner: windows-latest # runner: windows-latest
# preset: clang # preset: clang
@@ -255,7 +259,7 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
choco install ninja choco install ninja
vcpkg install freetype:${{matrix.vcpkg_arch}}-windows-static zstd:${{matrix.vcpkg_arch}}-windows-static vcpkg install freetype:${{matrix.vcpkg_arch}}-windows zstd:${{matrix.vcpkg_arch}}-windows
- name: Configure CMake - name: Configure CMake
run: cmake --preset x-windows-ci-${{matrix.preset}} run: cmake --preset x-windows-ci-${{matrix.preset}}
+25
View File
@@ -11,6 +11,7 @@ if (DUSK_VERSION_OVERRIDE)
set(DUSK_WC_DESCRIBE "${DUSK_VERSION_OVERRIDE}") set(DUSK_WC_DESCRIBE "${DUSK_VERSION_OVERRIDE}")
set(DUSK_VERSION_STRING "0.0.0.0") set(DUSK_VERSION_STRING "0.0.0.0")
set(DUSK_SHORT_VERSION_STRING "0.0.0") set(DUSK_SHORT_VERSION_STRING "0.0.0")
set(DUSK_VERSION_CODE "1")
set(DUSK_WC_REVISION "") set(DUSK_WC_REVISION "")
set(DUSK_WC_BRANCH "") set(DUSK_WC_BRANCH "")
set(DUSK_WC_DATE "") set(DUSK_WC_DATE "")
@@ -61,6 +62,9 @@ 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]+)([-+].*)?$")
set(DUSK_SHORT_VERSION_STRING "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}") 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") set(DUSK_VERSION_TWEAK "0")
if (DUSK_WC_DESCRIBE MATCHES "^v[0-9]+\\.[0-9]+\\.[0-9]+-([0-9]+)(-dirty)?$") if (DUSK_WC_DESCRIBE MATCHES "^v[0-9]+\\.[0-9]+\\.[0-9]+-([0-9]+)(-dirty)?$")
set(DUSK_VERSION_TWEAK "${CMAKE_MATCH_1}") set(DUSK_VERSION_TWEAK "${CMAKE_MATCH_1}")
@@ -68,10 +72,19 @@ if (DUSK_WC_DESCRIBE MATCHES "^v([0-9]+)\\.([0-9]+)\\.([0-9]+)([-+].*)?$")
set(DUSK_VERSION_TWEAK "${CMAKE_MATCH_1}") set(DUSK_VERSION_TWEAK "${CMAKE_MATCH_1}")
endif () endif ()
set(DUSK_VERSION_STRING "${DUSK_SHORT_VERSION_STRING}.${DUSK_VERSION_TWEAK}") 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 () else ()
set(DUSK_WC_DESCRIBE "UNKNOWN-VERSION") set(DUSK_WC_DESCRIBE "UNKNOWN-VERSION")
set(DUSK_VERSION_STRING "0.0.0.0") set(DUSK_VERSION_STRING "0.0.0.0")
set(DUSK_SHORT_VERSION_STRING "0.0.0") set(DUSK_SHORT_VERSION_STRING "0.0.0")
set(DUSK_VERSION_CODE "1")
endif () endif ()
endif () endif ()
@@ -79,6 +92,7 @@ endif ()
# Add version information to CI environment variables # Add version information to CI environment variables
if(DEFINED ENV{GITHUB_ENV}) if(DEFINED ENV{GITHUB_ENV})
file(APPEND "$ENV{GITHUB_ENV}" "DUSK_VERSION=${DUSK_WC_DESCRIBE}\n") file(APPEND "$ENV{GITHUB_ENV}" "DUSK_VERSION=${DUSK_WC_DESCRIBE}\n")
file(APPEND "$ENV{GITHUB_ENV}" "DUSK_VERSION_CODE=${DUSK_VERSION_CODE}\n")
endif() endif()
message(STATUS "Dusklight version set to ${DUSK_WC_DESCRIBE}") message(STATUS "Dusklight version set to ${DUSK_WC_DESCRIBE}")
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
@@ -86,6 +100,8 @@ project(dusklight LANGUAGES C CXX VERSION ${DUSK_VERSION_STRING})
if (APPLE) if (APPLE)
enable_language(OBJC OBJCXX) enable_language(OBJC OBJCXX)
endif () 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) if (APPLE AND NOT TVOS AND CMAKE_SYSTEM_NAME STREQUAL tvOS)
# ios.toolchain.cmake hack for SDL # ios.toolchain.cmake hack for SDL
set(TVOS ON) set(TVOS ON)
@@ -154,6 +170,7 @@ if (DUSK_MOVIE_SUPPORT)
endif () endif ()
set(_jpeg_cmake_args set(_jpeg_cmake_args
-DCMAKE_INSTALL_PREFIX=${_jpeg_install_dir} -DCMAKE_INSTALL_PREFIX=${_jpeg_install_dir}
-DCMAKE_PROJECT_INCLUDE=${CMAKE_CURRENT_SOURCE_DIR}/cmake/WindowsTargetProcessor.cmake
-DENABLE_SHARED=OFF -DENABLE_SHARED=OFF
-DWITH_TURBOJPEG=ON -DWITH_TURBOJPEG=ON
-DWITH_JAVA=OFF -DWITH_JAVA=OFF
@@ -338,6 +355,10 @@ endif ()
if (WIN32) if (WIN32)
list(APPEND GAME_LIBS Ws2_32) 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 () endif ()
set(DUSK_HTTP_BACKEND_SOURCE src/dusk/http/no_backend.cpp) set(DUSK_HTTP_BACKEND_SOURCE src/dusk/http/no_backend.cpp)
@@ -474,6 +495,10 @@ if (ANDROID)
target_link_options(dusklight PRIVATE "-Wl,-u,SDL_main") target_link_options(dusklight PRIVATE "-Wl,-u,SDL_main")
endif () endif ()
if (CMAKE_SYSTEM_NAME STREQUAL Linux)
target_link_options(dusklight PRIVATE "-Wl,--build-id=sha1")
endif ()
if (NOT APPLE) if (NOT APPLE)
add_custom_command(TARGET dusklight POST_BUILD add_custom_command(TARGET dusklight POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory COMMAND ${CMAKE_COMMAND} -E copy_directory
+12 -4
View File
@@ -33,7 +33,11 @@
"value": true "value": true
}, },
"DUSK_SENTRY_DSN": "$env{SENTRY_DSN}", "DUSK_SENTRY_DSN": "$env{SENTRY_DSN}",
"DUSK_SENTRY_ENVIRONMENT": "production" "DUSK_SENTRY_ENVIRONMENT": "production",
"Rust_RUSTUP_INSTALL_MISSING_TARGET": {
"type": "BOOL",
"value": true
}
} }
}, },
{ {
@@ -322,7 +326,9 @@
"BUILD_SHARED_LIBS": { "BUILD_SHARED_LIBS": {
"type": "BOOL", "type": "BOOL",
"value": false "value": false
} },
"AURORA_SDL3_VERSION": "3.4.8",
"AURORA_SDL3_REF": "refs/tags/release-3.4.8"
} }
}, },
{ {
@@ -430,7 +436,6 @@
"x-macos-ci" "x-macos-ci"
], ],
"cacheVariables": { "cacheVariables": {
"AURORA_DAWN_PROVIDER": "vendor",
"CMAKE_OSX_ARCHITECTURES": "x86_64", "CMAKE_OSX_ARCHITECTURES": "x86_64",
"Rust_CARGO_TARGET": "x86_64-apple-darwin" "Rust_CARGO_TARGET": "x86_64-apple-darwin"
} }
@@ -490,7 +495,10 @@
"inherits": [ "inherits": [
"x-windows-ci", "x-windows-ci",
"windows-arm64-msvc" "windows-arm64-msvc"
] ],
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": "arm64-windows"
}
} }
], ],
"buildPresets": [ "buildPresets": [
+3 -2
View File
@@ -6,6 +6,7 @@ fi
build_dir="$PWD/build" build_dir="$PWD/build"
linuxdeploy="$build_dir/linuxdeploy-$(uname -m).AppImage" linuxdeploy="$build_dir/linuxdeploy-$(uname -m).AppImage"
lib_dir="/usr/lib/$(uname -m)-linux-gnu"
# Get linuxdeploy # Get linuxdeploy
mkdir -p "$build_dir" mkdir -p "$build_dir"
@@ -19,8 +20,8 @@ for install_path in build/install/*; do
cp -r "$install_path" build/appdir/usr/bin cp -r "$install_path" build/appdir/usr/bin
done done
cp -r platforms/freedesktop/{16x16,32x32,48x48,64x64,128x128,256x256,512x512,1024x1024} build/appdir/usr/share/icons/hicolor cp -r platforms/freedesktop/{16x16,32x32,48x48,64x64,128x128,256x256,512x512,1024x1024} build/appdir/usr/share/icons/hicolor
cp platforms/freedesktop/dusklight.desktop build/appdir/usr/share/applications cp platforms/freedesktop/dev.twilitrealm.dusk.desktop build/appdir/usr/share/applications
cd build/install cd build/install
VERSION="$DUSK_VERSION" NO_STRIP=1 "$linuxdeploy" \ VERSION="$DUSK_VERSION" NO_STRIP=1 "$linuxdeploy" \
-l /usr/lib/x86_64-linux-gnu/libusb-1.0.so --appdir "$build_dir/appdir" --output appimage -l "$lib_dir/libusb-1.0.so" --appdir "$build_dir/appdir" --output appimage
+9
View File
@@ -0,0 +1,9 @@
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 ()
+1 -1
+2
View File
@@ -1420,6 +1420,7 @@ set(DUSK_FILES
src/d/actor/d_a_alink_dusk.cpp src/d/actor/d_a_alink_dusk.cpp
src/dusk/asserts.cpp src/dusk/asserts.cpp
src/dusk/config.cpp src/dusk/config.cpp
src/dusk/crash_handler.cpp
src/dusk/crash_reporting.cpp src/dusk/crash_reporting.cpp
src/dusk/data.cpp src/dusk/data.cpp
src/dusk/data.hpp src/dusk/data.hpp
@@ -1439,6 +1440,7 @@ set(DUSK_FILES
src/dusk/logging.cpp src/dusk/logging.cpp
src/dusk/settings.cpp src/dusk/settings.cpp
src/dusk/speedrun.cpp src/dusk/speedrun.cpp
src/dusk/string.cpp
src/dusk/stubs.cpp src/dusk/stubs.cpp
src/dusk/update_check.cpp src/dusk/update_check.cpp
src/dusk/update_check.hpp src/dusk/update_check.hpp
Generated
+3 -3
View File
@@ -2,11 +2,11 @@
"nodes": { "nodes": {
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1775710090, "lastModified": 1778869304,
"narHash": "sha256-ar3rofg+awPB8QXDaFJhJ2jJhu+KqN/PRCXeyuXR76E=", "narHash": "sha256-30sZNZoA1cqF5JNO9fVX+wgiQYjB7HJqqJ4ztCDeBZE=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "4c1018dae018162ec878d42fec712642d214fdfa", "rev": "d233902339c02a9c334e7e593de68855ad26c4cb",
"type": "github" "type": "github"
}, },
"original": { "original": {
+345 -190
View File
@@ -1,219 +1,374 @@
{ {
inputs = { description = "Dusklight native PC port of the Twilight Princess decompilation";
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
}; inputs.nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
outputs = { self, nixpkgs }:
outputs =
{ self, nixpkgs }:
let let
inherit (nixpkgs) lib;
supportedSystems = [ supportedSystems = [
"x86_64-linux" "x86_64-linux"
"aarch64-linux" "aarch64-linux"
"x86_64-darwin" "x86_64-darwin"
"aarch64-darwin" "aarch64-darwin"
]; ];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems; forAllSystems = lib.genAttrs supportedSystems;
pkgsFor = system: import nixpkgs { inherit system; };
# Dependencies that are not packaged in nixpkgs (used by the Linux package build): dawnVersion = "v20260423.175430";
buildSources = pkgs: { nodVersion = "v2.0.0-alpha.8";
dawn-src = pkgs.fetchzip { versionSuffix = "nix-" + (self.shortRev or self.dirtyShortRev or "dirty");
url = "https://github.com/encounter/dawn-build/releases/download/v20260423.175430/dawn-linux-x86_64.tar.gz";
dawnInfo = {
"x86_64-linux" = {
triple = "linux-x86_64";
hash = "sha256-HXfKTLHtMPwupnFnaflCARtXVPuS/0PoCePXidjE5xs="; hash = "sha256-HXfKTLHtMPwupnFnaflCARtXVPuS/0PoCePXidjE5xs=";
stripRoot = false;
}; };
nod-src = pkgs.fetchzip { "aarch64-linux" = {
url = "https://github.com/encounter/nod/releases/download/v2.0.0-alpha.8/libnod-linux-x86_64.tar.gz"; triple = "linux-aarch64";
hash = "sha256-mUqvLsbsqaZ+HAjMmHYPYO+MgtanGRTw7Gzn5uXR5rE="; hash = "sha256-34yyFpfqBZUwoFXQ41F0AwAU78FaNihOSY0oriwn6B0=";
stripRoot = false;
}; };
# The version of imgui on nixpkgs does not map cleanly. "aarch64-darwin" = {
imgui-src = pkgs.fetchFromGitHub { triple = "darwin-arm64";
owner = "ocornut"; hash = "sha256-eQnzrBp6gjiBek1VYQ9A5W13ClYWrDDKjIqv/7eNTR4=";
repo = "imgui";
rev = "v1.91.9b-docking";
hash = "sha256-mQOJ6jCN+7VopgZ61yzaCnt4R1QLrW7+47xxMhFRHLQ=";
}; };
sqlite-src = pkgs.fetchzip { "x86_64-darwin" = {
url = "https://sqlite.org/2026/sqlite-amalgamation-3510300.zip"; triple = "darwin-x86_64";
hash = "sha256-pNMR8zxaaqfAzQ0AQBOXMct4usdjey1Q0Gnitg06UhM="; hash = "sha256-QGWiGdxiI9kci3NPXH6QFFirxn16851zB/w3jqhIBJ4=";
};
rmlui-src = pkgs.fetchzip {
url = "https://github.com/mikke89/RmlUi/archive/f9b8c9e2935d5df2c7dff2c190d3968e99b0c3dc.tar.gz";
hash = "sha256-g4O/JZUrrcseOz8o2QJRt+2CeuiLnVeuDJc906xvuIg=";
}; };
}; };
# Dusklight Actual (Linux x86_64 only — relies on prebuilt dawn/nod binaries) nodPrebuiltInfo = {
mkDusklight = pkgs: "x86_64-linux" = {
let srcs = buildSources pkgs; triple = "linux-x86_64";
versionSuffix = if self ? shortRev && self.shortRev != null hash = "sha256-mUqvLsbsqaZ+HAjMmHYPYO+MgtanGRTw7Gzn5uXR5rE=";
then "nix-${self.shortRev}" };
else "nix-dirty"; "aarch64-darwin" = {
in triple = "macos-arm64";
pkgs.stdenv.mkDerivation { hash = "sha256-UPy1ywCcv0K6VJOU3uUelJuUdBh3UNaPRlyP5LOBeDw=";
name = "dusklight"; };
src = ./.; };
postUnpack = ''
sed -i '/add_subdirectory(tests)/d' $sourceRoot/extern/aurora/CMakeLists.txt
'';
# Remove last line to re-enable tests
cmakeFlags = [
"-DDUSK_VERSION_OVERRIDE=${versionSuffix}"
"-DFETCHCONTENT_FULLY_DISCONNECTED=ON"
"-DFETCHCONTENT_SOURCE_DIR_CXXOPTS=${pkgs.cxxopts.src}"
"-DFETCHCONTENT_SOURCE_DIR_JSON=${pkgs.nlohmann_json.src}"
"-DFETCHCONTENT_SOURCE_DIR_DAWN_PREBUILT=${srcs.dawn-src}"
"-DFETCHCONTENT_SOURCE_DIR_XXHASH=${pkgs.xxHash.src}"
"-DFETCHCONTENT_SOURCE_DIR_FMT=${pkgs.fmt.src}"
"-DFETCHCONTENT_SOURCE_DIR_TRACY=${pkgs.tracy.src}"
"-DAURORA_SDL3_PROVIDER=system"
"-DFETCHCONTENT_SOURCE_DIR_NOD_PREBUILT=${srcs.nod-src}"
"-DAURORA_NOD_PROVIDER=package"
"-DFETCHCONTENT_SOURCE_DIR_FREETYPE=${pkgs.freetype.src}"
"-DFETCHCONTENT_SOURCE_DIR_ZSTD=${pkgs.zstd.src}"
"-DFETCHCONTENT_SOURCE_DIR_SQLITE3=${srcs.sqlite-src}"
"-DFETCHCONTENT_SOURCE_DIR_IMGUI=${srcs.imgui-src}"
"-DFETCHCONTENT_SOURCE_DIR_RMLUI=${srcs.rmlui-src}"
"-DCMAKE_CROSSCOMPILING=ON" # Tests are not working as I didn't want to work through getting google's test suite working as well. This is the only guard I could find to disable it.
];
installPhase = ''
mkdir -p $out/bin
cp dusklight $out/bin/dusklight
cp -r ./res $out/bin/res
mkdir -p $out/share/applications perSystem =
cp $src/platforms/freedesktop/dusklight.desktop $out/share/applications/dusklight.desktop system:
let
pkgs = import nixpkgs { inherit system; };
inherit (pkgs.stdenv.hostPlatform) isDarwin;
hasNodPrebuilt = nodPrebuiltInfo ? ${system};
for size in 16 32 48 64 128 256 512 1024; do aurora = pkgs.fetchFromGitHub {
install -Dm644 $src/platforms/freedesktop/''${size}x''${size}/apps/dusklight.png \ owner = "encounter";
$out/share/icons/hicolor/''${size}x''${size}/apps/dusklight.png repo = "aurora";
done rev = "10006618ee493f248b8597e4dfa1d2871d76a1d9";
''; hash = "sha256-lY2xuVyB7aPJ9+2wwLRB3F5U/BuPSxdSpegdG+qNd9o=";
nativeBuildInputs = [ };
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.cmake
pkgs.ninja
pkgs.pkg-config pkgs.pkg-config
pkgs.wayland pkgs.git
pkgs.python3
pkgs.python3Packages.markupsafe
pkgs.rustc
pkgs.cargo
pkgs.sccache
]; ];
buildInputs = [
pkgs.libGL # Linux-only system libraries — mirrors the apt deps from .github/workflows/build.yml
pkgs.libX11 # so the cmake presets resolve the same set of headers as CI.
pkgs.libXcursor linuxDevDeps = [
pkgs.libxi # Compilers / linkers
pkgs.libxcb pkgs.clang
pkgs.libxrandr pkgs.lld
pkgs.libxscrnsaver # C/C++ utilities
pkgs.libxtst pkgs.curl
pkgs.libjpeg8 pkgs.openssl
pkgs.libxkbcommon pkgs.zlib
pkgs.libglvnd pkgs.libpng
pkgs.libjpeg_turbo
pkgs.freetype
pkgs.zstd
pkgs.fmt
pkgs.tracy
pkgs.cxxopts pkgs.cxxopts
pkgs.abseil-cpp pkgs.abseil-cpp
pkgs.sdl3 pkgs.sdl3
pkgs.fmt pkgs.ncurses
pkgs.tracy pkgs.libunwind
pkgs.freetype pkgs.libusb1
pkgs.zstd 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;
}; };
# Tooling common to every supported host (Linux and macOS). systems = forAllSystems perSystem;
commonDevTools = pkgs: [ in
pkgs.cmake {
pkgs.ninja packages = lib.mapAttrs (_: s: s.packages) systems;
pkgs.pkg-config devShells = lib.mapAttrs (_: s: s.devShells) systems;
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 = pkgs: [
# 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.
mkDarwinShell = pkgs:
pkgs.mkShellNoCC {
packages = commonDevTools pkgs;
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"
'';
};
mkLinuxShell = pkgs:
pkgs.mkShell {
packages = (commonDevTools pkgs) ++ (linuxDevDeps pkgs);
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>"
'';
};
mkDevShell = pkgs:
if pkgs.stdenv.isDarwin
then mkDarwinShell pkgs
else mkLinuxShell pkgs;
in {
packages.x86_64-linux.default = mkDusklight (pkgsFor "x86_64-linux");
devShells = forAllSystems (system: {
default = mkDevShell (pkgsFor system);
});
}; };
} }
+1
View File
@@ -4564,6 +4564,7 @@ public:
cXyz mIBChainInterpCurrHandRoot; cXyz mIBChainInterpCurrHandRoot;
bool mIBChainInterpPrevValid; bool mIBChainInterpPrevValid;
bool mIBChainInterpCurrValid; bool mIBChainInterpCurrValid;
bool mIsRollstab = false;
#endif #endif
}; // Size: 0x385C }; // Size: 0x385C
+2
View File
@@ -5,6 +5,7 @@
#include <thp.h> #include <thp.h>
#else #else
#include <atomic> #include <atomic>
#include <chrono>
#endif #endif
#include "f_op/f_op_actor.h" #include "f_op/f_op_actor.h"
#include "d/d_drawlist.h" #include "d/d_drawlist.h"
@@ -125,6 +126,7 @@ struct daMP_THPPlayer {
/* 0x0D4 */ s32 curCount; /* 0x0D4 */ s32 curCount;
#if TARGET_PC #if TARGET_PC
/* 0x0D8 */ std::atomic<s32> videoDecodeCount; /* 0x0D8 */ std::atomic<s32> videoDecodeCount;
std::chrono::steady_clock::time_point thpPlaybackClock;
#else #else
/* 0x0D8 */ s32 videoDecodeCount; /* 0x0D8 */ s32 videoDecodeCount;
#endif #endif
+1 -1
View File
@@ -77,7 +77,7 @@ private:
#define PLAYER_CREATE_ANM_HEAP_F(heap, type, fmt, ...) \ #define PLAYER_CREATE_ANM_HEAP_F(heap, type, fmt, ...) \
{ \ { \
char pcah_name_buf[32]; \ char pcah_name_buf[32]; \
sprintf(pcah_name_buf, fmt, ##__VA_ARGS__); \ snprintf(pcah_name_buf, sizeof(pcah_name_buf), fmt, ##__VA_ARGS__); \
(heap).createHeap(type, pcah_name_buf); \ (heap).createHeap(type, pcah_name_buf); \
\ \
} }
+10 -12
View File
@@ -444,8 +444,7 @@ public:
/* 0x1C */ f32 mFovy; /* 0x1C */ f32 mFovy;
/* 0x20 */ f32 mBank; /* 0x20 */ f32 mBank;
/* 0x24 */ fopAc_ac_c* mRelActor; /* 0x24 */ fopAc_ac_c* mRelActor;
/* 0x28 */ char mRelUseMask; /* 0x28 */ char mRelUseMask[4];
/* 0x29 */ char field_0x29;
/* 0x2C */ int mTimer; /* 0x2C */ int mTimer;
/* 0x30 */ bool field_0x30; /* 0x30 */ bool field_0x30;
/* 0x34 */ cXyz mBasePos; /* 0x34 */ cXyz mBasePos;
@@ -526,7 +525,7 @@ public:
/* 0x3C */ fopAc_ac_c* field_0x3c; /* 0x3C */ fopAc_ac_c* field_0x3c;
/* 0x40 */ fopAc_ac_c* field_0x40; /* 0x40 */ fopAc_ac_c* field_0x40;
/* 0x44 */ fpc_ProcID field_0x44; /* 0x44 */ fpc_ProcID field_0x44;
/* 0x48 */ char field_0x48; /* 0x48 */ char field_0x48[4];
/* 0x4C */ int field_0x4c; /* 0x4C */ int field_0x4c;
}; };
@@ -541,11 +540,7 @@ public:
/* 0x3C */ f32 field_0x3c; /* 0x3C */ f32 field_0x3c;
/* 0x40 */ fopAc_ac_c* mRelActor; /* 0x40 */ fopAc_ac_c* mRelActor;
/* 0x44 */ fpc_ProcID mRelActorID; /* 0x44 */ fpc_ProcID mRelActorID;
/* 0x48 */ char mRelUseMask; /* 0x48 */ char mRelUseMask[8];
/* 0x49 */ char field_0x49;
/* 0x4A */ char field_0x4a;
/* 0x4B */ char field_0x4b;
/* 0x4C */ u8 field_0x4c[4];
/* 0x50 */ int mTimer; /* 0x50 */ int mTimer;
/* 0x54 */ int mTransType; /* 0x54 */ int mTransType;
/* 0x58 */ f32 mCushion; /* 0x58 */ f32 mCushion;
@@ -696,8 +691,7 @@ public:
/* 0x24 */ f32* field_0x24; /* 0x24 */ f32* field_0x24;
/* 0x28 */ f32 field_0x28; /* 0x28 */ f32 field_0x28;
/* 0x2C */ fopAc_ac_c* mRelActor; /* 0x2C */ fopAc_ac_c* mRelActor;
/* 0x30 */ char mRelUseMask; /* 0x30 */ char mRelUseMask[4];
/* 0x31 */ char field_0x31;
/* 0x34 */ int mTimer; /* 0x34 */ int mTimer;
/* 0x38 */ int field_0x38; /* 0x38 */ int field_0x38;
/* 0x3C */ int mChoice; /* 0x3C */ int mChoice;
@@ -780,8 +774,7 @@ public:
/* 0xAC */ f32 field_0xac; /* 0xAC */ f32 field_0xac;
/* 0xB0 */ fopAc_ac_c* mRelActor; /* 0xB0 */ fopAc_ac_c* mRelActor;
/* 0xB4 */ fpc_ProcID mRelActorID; /* 0xB4 */ fpc_ProcID mRelActorID;
/* 0xB8 */ char mRelUseMask; /* 0xB8 */ char mRelUseMask[4];
/* 0xB9 */ char field_0xb9;
/* 0xBC */ f32 mCushion; /* 0xBC */ f32 mCushion;
/* 0xC0 */ u32 field_0xc0[6]; /* 0xC0 */ u32 field_0xc0[6];
}; };
@@ -917,7 +910,12 @@ public:
char* getEvStringPntData(char*, char*); char* getEvStringPntData(char*, char*);
char* getEvStringPntData(char*); char* getEvStringPntData(char*);
bool getEvXyzData(cXyz*, char*, cXyz); bool getEvXyzData(cXyz*, char*, cXyz);
#if TARGET_PC
template<size_t N>
bool getEvStringData(char (&)[N], char*, char*);
#else
bool getEvStringData(char*, char*, char*); bool getEvStringData(char*, char*, char*);
#endif
fopAc_ac_c* getEvActor(char*); fopAc_ac_c* getEvActor(char*);
fopAc_ac_c* getEvActor(char*, char*); fopAc_ac_c* getEvActor(char*, char*);
bool pauseEvCamera(); bool pauseEvCamera();
+2 -2
View File
@@ -1851,7 +1851,7 @@ inline u16 dComIfGs_getDeathCount() {
} }
#endif #endif
inline char* dComIfGs_getPlayerName() { inline TEXT_SPAN dComIfGs_getPlayerName() {
return g_dComIfG_gameInfo.info.getPlayer().getPlayerInfo().getPlayerName(); return g_dComIfG_gameInfo.info.getPlayer().getPlayerInfo().getPlayerName();
} }
@@ -1859,7 +1859,7 @@ inline void dComIfGs_setPlayerName(const char* i_name) {
g_dComIfG_gameInfo.info.getPlayer().getPlayerInfo().setPlayerName(i_name); g_dComIfG_gameInfo.info.getPlayer().getPlayerInfo().setPlayerName(i_name);
} }
inline char* dComIfGs_getHorseName() { inline TEXT_SPAN dComIfGs_getHorseName() {
return g_dComIfG_gameInfo.info.getPlayer().getPlayerInfo().getHorseName(); return g_dComIfG_gameInfo.info.getPlayer().getPlayerInfo().getHorseName();
} }
+4 -4
View File
@@ -46,10 +46,10 @@ private:
/* 0x22 */ u8 field_0x22; /* 0x22 */ u8 field_0x22;
/* 0x24 */ CPaneMgrAlpha* mDatBase; /* 0x24 */ CPaneMgrAlpha* mDatBase;
/* 0x28 */ CPaneMgrAlpha* mNoDatBase; /* 0x28 */ CPaneMgrAlpha* mNoDatBase;
/* 0x2C */ char* mPlayerName; /* 0x2C */ TEXT_SPAN mPlayerName;
/* 0x30 */ char* mSaveDate; /* 0x30 */ TEXT_SPAN mSaveDate;
/* 0x34 */ char* mPlayTime; /* 0x34 */ TEXT_SPAN mPlayTime;
/* 0x38 */ char* mSaveStatus; /* 0x38 */ TEXT_SPAN mSaveStatus;
}; };
typedef void (dFile_info_c::*warningFunc)(void); typedef void (dFile_info_c::*warningFunc)(void);
+38 -3
View File
@@ -11,7 +11,42 @@
class dFile_info_c; class dFile_info_c;
class J2DPicture; 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 { class dDlst_FileSel_c : public dDlst_base_c {
public: public:
void draw(); void draw();
@@ -530,7 +565,7 @@ public:
/* 0x0130 */ int field_0x0130; /* 0x0130 */ int field_0x0130;
/* 0x0134 */ int field_0x0134; /* 0x0134 */ int field_0x0134;
/* 0x0138 */ CPaneMgrAlpha* mErrorMsgTxtPane[2]; /* 0x0138 */ CPaneMgrAlpha* mErrorMsgTxtPane[2];
/* 0x0140 */ char* mErrorMsgStringPtr[2]; /* 0x0140 */ TEXT_SPAN mErrorMsgStringPtr[2];
/* 0x0148 */ u8 mErrorTxtDispIdx; /* 0x0148 */ u8 mErrorTxtDispIdx;
/* 0x0149 */ u8 field_0x0149; /* 0x0149 */ u8 field_0x0149;
/* 0x014A */ bool field_0x014a; /* 0x014A */ bool field_0x014a;
@@ -574,7 +609,7 @@ public:
/* 0x020A */ u8 mFadeTimer; /* 0x020A */ u8 mFadeTimer;
/* 0x020B */ u8 field_0x020b; /* 0x020B */ u8 field_0x020b;
/* 0x020C */ CPaneMgrAlpha* mHeaderTxtPane[2]; /* 0x020C */ CPaneMgrAlpha* mHeaderTxtPane[2];
/* 0x0214 */ char* mHeaderStringPtr[2]; /* 0x0214 */ TEXT_SPAN mHeaderStringPtr[2];
/* 0x021C */ u8 mHeaderTxtDispIdx; /* 0x021C */ u8 mHeaderTxtDispIdx;
/* 0x021D */ u8 field_0x021d; /* 0x021D */ u8 field_0x021d;
/* 0x021E */ u8 field_0x021e; /* 0x021E */ u8 field_0x021e;
@@ -591,7 +626,7 @@ public:
/* 0x024B */ u8 field_0x024b; /* 0x024B */ u8 field_0x024b;
/* 0x024C */ u8 field_0x024c; /* 0x024C */ u8 field_0x024c;
/* 0x024B */ u8 field_0x024d[3]; /* 0x024B */ u8 field_0x024d[3];
/* 0x0250 */ char* mModoruStringPtr; /* 0x0250 */ TEXT_SPAN mModoruStringPtr;
/* 0x0254 */ STControl* stick; /* 0x0254 */ STControl* stick;
/* 0x0258 */ u8 mIsDataNew[3]; /* 0x0258 */ u8 mIsDataNew[3];
/* 0x025B */ u8 mIsNoData[3]; /* 0x025B */ u8 mIsNoData[3];
+43
View File
@@ -15,6 +15,49 @@ class dMenu_Fishing_c;
class dMenu_Skill_c; class dMenu_Skill_c;
class dMenu_Insect_c; class dMenu_Insect_c;
class dSelect_cursor_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_Collect2D_c;
class dMenu_Collect2DTop_c : public dDlst_base_c { class dMenu_Collect2DTop_c : public dDlst_base_c {
+5
View File
@@ -183,6 +183,11 @@ public:
/* 0xDD8 */ u8 field_0xdd8; /* 0xDD8 */ u8 field_0xdd8;
/* 0xDD9 */ u8 field_0xdd9; /* 0xDD9 */ u8 field_0xdd9;
/* 0xDDA */ u8 field_0xdda; /* 0xDDA */ u8 field_0xdda;
#if TARGET_PC
J2DTextBox* mpPoeCountPane;
J2DPicture* mpPoeCountIcon;
#endif
}; };
class dMenu_Dmap_c { class dMenu_Dmap_c {
+6
View File
@@ -421,6 +421,12 @@ public:
/* 0xC2 */ u8 mAlphaButtonZ; /* 0xC2 */ u8 mAlphaButtonZ;
/* 0xC3 */ u8 mAlphaAnalogStick; /* 0xC3 */ u8 mAlphaAnalogStick;
/* 0xC4 */ u8 mAlphaDpad; /* 0xC4 */ u8 mAlphaDpad;
#if TARGET_PC
J2DTextBox* mpPoeCountPane;
J2DPicture* mpPoeCountIcon;
u8 mSelectRegionNo;
#endif
}; };
#endif /* D_MENU_D_MENU_FMAP2D_H */ #endif /* D_MENU_D_MENU_FMAP2D_H */
+5
View File
@@ -76,6 +76,11 @@ public:
} }
#endif #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 { struct Stage_c {
// Incomplete class // Incomplete class
+2 -2
View File
@@ -313,7 +313,7 @@ private:
/* 0x00B8 */ int field_0xb8; /* 0x00B8 */ int field_0xb8;
/* 0x00BC */ int field_0xbc; /* 0x00BC */ int field_0xbc;
/* 0x00C0 */ CPaneMgrAlpha* mpErrTxtPane[2]; /* 0x00C0 */ CPaneMgrAlpha* mpErrTxtPane[2];
/* 0x00C8 */ char* mpErrTxt[2]; /* 0x00C8 */ TEXT_SPAN mpErrTxt[2];
/* 0x00D0 */ u8 mErrTxtType; /* 0x00D0 */ u8 mErrTxtType;
/* 0x00D1 */ u8 mErrTxtAnmComplete; /* 0x00D1 */ u8 mErrTxtAnmComplete;
/* 0x00D2 */ u8 field_0xd2; /* 0x00D2 */ u8 field_0xd2;
@@ -344,7 +344,7 @@ private:
/* 0x0160 */ J2DAnmTevRegKey* field_0x160; /* 0x0160 */ J2DAnmTevRegKey* field_0x160;
/* 0x0164 */ int field_0x164; /* 0x0164 */ int field_0x164;
/* 0x0168 */ CPaneMgrAlpha* mpHeaderTxtPane[2]; /* 0x0168 */ CPaneMgrAlpha* mpHeaderTxtPane[2];
/* 0x0170 */ char* mpHeaderTxt[2]; /* 0x0170 */ TEXT_SPAN mpHeaderTxt[2];
/* 0x0178 */ u8 mHeaderTxtType; // 0: Select Menu 1: YesNo Menu /* 0x0178 */ u8 mHeaderTxtType; // 0: Select Menu 1: YesNo Menu
/* 0x0179 */ u8 mHeaderAnmComplete; /* 0x0179 */ u8 mHeaderAnmComplete;
/* 0x017A */ u8 field_0x17a; /* 0x017A */ u8 field_0x17a;
+6 -6
View File
@@ -67,9 +67,9 @@ public:
s16 decFloatingMessageTimer(); s16 decFloatingMessageTimer();
void resetFloatingMessage(); void resetFloatingMessage();
void decMsgKeyWaitTimer(); void decMsgKeyWaitTimer();
void getString(u32 i_stringID, char* o_string, JMSMesgEntry_c* i_msgEntry); void getString(u32 i_stringID, TEXT_SPAN o_string, JMSMesgEntry_c* i_msgEntry);
void getStringKana(u32 i_stringID, char* o_string, JMSMesgEntry_c* i_msgEntry); void getStringKana(u32 i_stringID, TEXT_SPAN o_string, JMSMesgEntry_c* i_msgEntry);
void getStringKanji(u32 i_stringID, char* o_string, JMSMesgEntry_c* i_msgEntry); void getStringKanji(u32 i_stringID, TEXT_SPAN o_string, JMSMesgEntry_c* i_msgEntry);
f32 getStringLength(J2DTextBox* i_textbox, char* i_string); f32 getStringLength(J2DTextBox* i_textbox, char* i_string);
f32 getStringLength(JUTFont* i_font, f32 param_2, f32 param_3, char* i_string); f32 getStringLength(JUTFont* i_font, f32 param_2, f32 param_3, char* i_string);
void onDirectUseItem(int); void onDirectUseItem(int);
@@ -348,15 +348,15 @@ inline CPaneMgr* dMeter2Info_getMeterItemPanePtr(s32 i_idx) {
return g_meter2_info.getMeterItemPanePtr(i_idx); return g_meter2_info.getMeterItemPanePtr(i_idx);
} }
inline void dMeter2Info_getString(u32 i_stringID, char* o_string, JMSMesgEntry_c* i_msgEntry) { inline void dMeter2Info_getString(u32 i_stringID, TEXT_SPAN o_string, JMSMesgEntry_c* i_msgEntry) {
g_meter2_info.getString(i_stringID, o_string, i_msgEntry); g_meter2_info.getString(i_stringID, o_string, i_msgEntry);
} }
inline void dMeter2Info_getStringKanji(u32 i_stringID, char* o_string, JMSMesgEntry_c* i_msgEntry) { inline void dMeter2Info_getStringKanji(u32 i_stringID, TEXT_SPAN o_string, JMSMesgEntry_c* i_msgEntry) {
g_meter2_info.getStringKanji(i_stringID, o_string, i_msgEntry); g_meter2_info.getStringKanji(i_stringID, o_string, i_msgEntry);
} }
inline void dMeter2Info_getStringKana(u32 i_stringID, char* o_string, JMSMesgEntry_c* i_msgEntry) { inline void dMeter2Info_getStringKana(u32 i_stringID, TEXT_SPAN o_string, JMSMesgEntry_c* i_msgEntry) {
g_meter2_info.getStringKana(i_stringID, o_string, i_msgEntry); g_meter2_info.getStringKana(i_stringID, o_string, i_msgEntry);
} }
+2 -1
View File
@@ -1,6 +1,7 @@
#ifndef D_METER_D_METER_BUTTON_H #ifndef D_METER_D_METER_BUTTON_H
#define D_METER_D_METER_BUTTON_H #define D_METER_D_METER_BUTTON_H
#include "global.h"
#include "JSystem/J2DGraph/J2DScreen.h" #include "JSystem/J2DGraph/J2DScreen.h"
#include "JSystem/J2DGraph/J2DTextBox.h" #include "JSystem/J2DGraph/J2DTextBox.h"
#include "d/d_drawlist.h" #include "d/d_drawlist.h"
@@ -194,7 +195,7 @@ public:
/* 0x0FC */ CPaneMgr* field_0x0fc[4]; /* 0x0FC */ CPaneMgr* field_0x0fc[4];
/* 0x10C */ JKRHeap* mpHeap; /* 0x10C */ JKRHeap* mpHeap;
/* 0x110 */ void* mpFishingTex; /* 0x110 */ void* mpFishingTex;
/* 0x114 */ char mButtonText[2][15]; /* 0x114 */ char mButtonText[2][DUSK_IF_ELSE(32, 15)];
/* 0x132 */ u8 field_0x132[0x134 - 0x132]; /* 0x132 */ u8 field_0x132[0x134 - 0x132];
/* 0x134 */ f32 field_0x134; /* 0x134 */ f32 field_0x134;
/* 0x138 */ f32 field_0x138; /* 0x138 */ f32 field_0x138;
+8 -7
View File
@@ -5,6 +5,7 @@
#include "JSystem/JMessage/JMessage.h" #include "JSystem/JMessage/JMessage.h"
#include "SSystem/SComponent/c_xyz.h" #include "SSystem/SComponent/c_xyz.h"
#include "dusk/endian.h" #include "dusk/endian.h"
#include "dusk/string.hpp"
#if REGION_JPN #if REGION_JPN
#define D_MSG_CLASS_PAGE_CNT_MAX 30 #define D_MSG_CLASS_PAGE_CNT_MAX 30
@@ -67,7 +68,7 @@ struct jmessage_tReference : public JMessage::TReference {
void pageSend(); void pageSend();
void selectMessage(); void selectMessage();
void inputNumber(); void inputNumber();
char* getWord(int); TEXT_SPAN getWord(int);
void resetWord(); void resetWord();
void setCharactor(u16); void setCharactor(u16);
void addCharactor(u16); void addCharactor(u16);
@@ -228,11 +229,11 @@ struct jmessage_tReference : public JMessage::TReference {
f32 getSelRubyCharSpace() { return mSelRubyCharSpace; } f32 getSelRubyCharSpace() { return mSelRubyCharSpace; }
f32 getRubySize() { return mRubySize; } f32 getRubySize() { return mRubySize; }
f32 getRubyCharSpace() { return mRubyCharSpace; } f32 getRubyCharSpace() { return mRubyCharSpace; }
char* getSelTextPtr(int idx) { return mSelText[idx]; } TEXT_SPAN getSelTextPtr(int idx) { return mSelText[idx]; }
char* getSelRubyPtr(int idx) { return mSelRuby[idx]; } TEXT_SPAN getSelRubyPtr(int idx) { return mSelRuby[idx]; }
char* getTextPtr() { return mText; } TEXT_SPAN getTextPtr() { return mText; }
char* getTextSPtr() { return mTextS; } TEXT_SPAN getTextSPtr() { return mTextS; }
char* getRubyPtr() { return mRuby; } TEXT_SPAN getRubyPtr() { return mRuby; }
u8 getSelectRubyFlag() { return mSelectRubyFlag; } u8 getSelectRubyFlag() { return mSelectRubyFlag; }
f32 getSelTBoxWidth() { return mSelTBoxWidth; } f32 getSelTBoxWidth() { return mSelTBoxWidth; }
u8 getSelectPos() { return mSelectPos; } u8 getSelectPos() { return mSelectPos; }
@@ -463,7 +464,7 @@ struct jmessage_tRenderingProcessor : public JMessage::TRenderingProcessor {
f32 getLineLength(int); f32 getLineLength(int);
void do_strcat(char*, bool, bool, bool); void do_strcat(char*, bool, bool, bool);
void do_rubyset(void const*, u32); void do_rubyset(void const*, u32);
void do_rubystrcat(char*, char*, f32, f32); void do_rubystrcat(char*, TEXT_SPAN, f32, f32);
void do_name1(); void do_name1();
void do_numset(s16); void do_numset(s16);
void push_word(); void push_word();
+7 -7
View File
@@ -53,8 +53,8 @@ public:
void demoMessageGroupLocal(); void demoMessageGroupLocal();
void endFlowGroupLocal(); void endFlowGroupLocal();
void changeGroupLocal(s16); void changeGroupLocal(s16);
bool getStringLocal(u32, J2DTextBox*, J2DTextBox*, JUTFont*, COutFont_c*, char*, bool getStringLocal(u32, J2DTextBox*, J2DTextBox*, JUTFont*, COutFont_c*, TEXT_SPAN,
char*, char*, s16*); TEXT_SPAN, TEXT_SPAN, s16*);
bool isGetItemMessage(); bool isGetItemMessage();
bool isKanbanMessage(); bool isKanbanMessage();
bool isHowlMessage(); bool isHowlMessage();
@@ -121,7 +121,7 @@ public:
static void endFlowGroup(); static void endFlowGroup();
static void changeGroup(s16); static void changeGroup(s16);
static bool getString(u32, J2DTextBox*, J2DTextBox*, JUTFont*, COutFont_c*, static bool getString(u32, J2DTextBox*, J2DTextBox*, JUTFont*, COutFont_c*,
char*, char*, char*, s16*); TEXT_SPAN, TEXT_SPAN, TEXT_SPAN, s16*);
static void* getMsgDtPtr(); static void* getMsgDtPtr();
static void setProcessID(fpc_ProcID); static void setProcessID(fpc_ProcID);
static msg_class* getActor(); static msg_class* getActor();
@@ -246,12 +246,12 @@ public:
static void setWord(const char* i_word); static void setWord(const char* i_word);
void setWordLocal(const char* i_word) { void setWordLocal(const char* i_word) {
strcpy(mWord, i_word); SAFE_STRCPY(mWord, i_word);
} }
static void setSelectWord(int i_no, const char* i_word); static void setSelectWord(int i_no, const char* i_word);
void setSelectWordLocal(int i_no, const char* i_word) { void setSelectWordLocal(int i_no, const char* i_word) {
strcpy(mSelectWord[i_no], i_word); SAFE_STRCPY(mSelectWord[i_no], i_word);
} }
jmessage_tSequenceProcessor* getSequenceProcessor() { return mpSeqProc; } jmessage_tSequenceProcessor* getSequenceProcessor() { return mpSeqProc; }
@@ -426,8 +426,8 @@ inline void dMsgObject_setTalkActor(fopAc_ac_c* actor) {
} }
inline bool dMsgObject_getString(u32 i_msgId, J2DTextBox* i_tbox, J2DTextBox* i_rubyTbox, inline bool dMsgObject_getString(u32 i_msgId, J2DTextBox* i_tbox, J2DTextBox* i_rubyTbox,
JUTFont* i_font, COutFont_c* i_outFont, char* o_text, JUTFont* i_font, COutFont_c* i_outFont, TEXT_SPAN o_text,
char* o_ruby, char* o_textS, s16* param_8) { TEXT_SPAN o_ruby, TEXT_SPAN o_textS, s16* param_8) {
return dMsgObject_getMsgObjectClass()->getString(i_msgId, i_tbox, i_rubyTbox, i_font, i_outFont, o_text, o_ruby, return dMsgObject_getMsgObjectClass()->getString(i_msgId, i_tbox, i_rubyTbox, i_font, i_outFont, o_text, o_ruby,
o_textS, param_8); o_textS, param_8);
} }
+2 -2
View File
@@ -20,12 +20,12 @@ public:
f32 getStringPageLocal(u32, u8, u8, J2DTextBox*, J2DTextBox*, JUTFont*, f32 getStringPageLocal(u32, u8, u8, J2DTextBox*, J2DTextBox*, JUTFont*,
COutFont_c*, u8); COutFont_c*, u8);
u8 getPageMax(int); u8 getPageMax(int);
f32 getMessageLocal(u32, char*); f32 getMessageLocal(u32, TEXT_SPAN);
virtual f32 getString(u32, J2DTextBox*, J2DTextBox*, JUTFont*, COutFont_c*, u8); virtual f32 getString(u32, J2DTextBox*, J2DTextBox*, JUTFont*, COutFont_c*, u8);
virtual f32 getStringPage(u32, u8, u8, J2DTextBox*, J2DTextBox*, JUTFont*, COutFont_c*, virtual f32 getStringPage(u32, u8, u8, J2DTextBox*, J2DTextBox*, JUTFont*, COutFont_c*,
u8); u8);
virtual f32 getMessage(u32, char*); virtual f32 getMessage(u32, TEXT_SPAN);
virtual void resetStringLocal(J2DTextBox*); virtual void resetStringLocal(J2DTextBox*);
virtual void drawOutFontLocal(J2DTextBox*, f32); virtual void drawOutFontLocal(J2DTextBox*, f32);
virtual void drawFontLocal(J2DTextBox*, u8, f32, f32, f32, f32, u32, u8); virtual void drawFontLocal(J2DTextBox*, u8, f32, f32, f32, f32, u32, u8);
+2 -2
View File
@@ -6,14 +6,14 @@
class dMsgUnit_c { class dMsgUnit_c {
public: public:
dMsgUnit_c(); dMsgUnit_c();
void setTag(int, int, char*, bool); void setTag(int, int, TEXT_SPAN, bool);
virtual ~dMsgUnit_c(); virtual ~dMsgUnit_c();
}; };
extern dMsgUnit_c g_msg_unit; extern dMsgUnit_c g_msg_unit;
inline void dMsgUnit_setTag(int param_0, int param_1, char* param_2) { inline void dMsgUnit_setTag(int param_0, int param_1, TEXT_SPAN param_2) {
g_msg_unit.setTag(param_0, param_1, param_2, true); g_msg_unit.setTag(param_0, param_1, param_2, true);
} }
+3 -3
View File
@@ -127,7 +127,7 @@ public:
u8 isInputEnd() { return mIsInputEnd; } u8 isInputEnd() { return mIsInputEnd; }
char* getInputStrPtr() { return mInputStr; } char* getInputStrPtr() { return mInputStr; }
void hideIcon() { mSelIcon->setAlphaRate(0.0f); } void hideIcon() { mSelIcon->setAlphaRate(0.0f); }
void setNextNameStr(char* i_name) { strcpy(mNextNameStr,i_name); } void setNextNameStr(char* i_name) { SAFE_STRCPY(mNextNameStr,i_name); }
void draw() { _draw(); } void draw() { _draw(); }
private: private:
@@ -140,9 +140,9 @@ private:
/* 0x02C */ J2DAnmTextureSRTKey* mCursorTexKey; /* 0x02C */ J2DAnmTextureSRTKey* mCursorTexKey;
/* 0x030 */ int mCurTexAnmF; /* 0x030 */ int mCurTexAnmF;
/* 0x034 */ CPaneMgrAlpha* mNameCursor[8]; /* 0x034 */ CPaneMgrAlpha* mNameCursor[8];
/* 0x054 */ char* mNameText[8]; /* 0x054 */ TEXT_SPAN mNameText[8];
/* 0x074 */ CPaneMgr* mMojiIcon[65]; /* 0x074 */ CPaneMgr* mMojiIcon[65];
/* 0x178 */ char* mMojiText[65]; /* 0x178 */ TEXT_SPAN mMojiText[65];
/* 0x27C */ J2DPane* mMojiPane; /* 0x27C */ J2DPane* mMojiPane;
/* 0x280 */ J2DPane* mMenuPane; /* 0x280 */ J2DPane* mMenuPane;
/* 0x284 */ CPaneMgr* mMenuIcon[4]; /* 0x284 */ CPaneMgr* mMenuIcon[4];
+9 -5
View File
@@ -488,21 +488,25 @@ public:
} }
#if TARGET_PC #if TARGET_PC
u16 getDeathCount() const { return mDeathCount; } u16 getDeathCount() const { return mDeathCount; }
#endif TEXT_SPAN getPlayerName() const { return const_cast<char(&)[17]>(mPlayerName); }
#else
char* getPlayerName() const { return const_cast<char*>(mPlayerName); } char* getPlayerName() const { return const_cast<char*>(mPlayerName); }
#endif
void setPlayerName(const char* i_name) { void setPlayerName(const char* i_name) {
#if AVOID_UB #if AVOID_UB
strncpy(mPlayerName, i_name, sizeof(mPlayerName) - 1); dusk::SafeStringCopyTruncate(mPlayerName, i_name);
mPlayerName[sizeof(mPlayerName) - 1] = '\0';
#else #else
strcpy(mPlayerName, i_name); strcpy(mPlayerName, i_name);
#endif #endif
} }
#if TARGET_PC
TEXT_SPAN getHorseName() const { return const_cast<char(&)[17]>(mHorseName); }
#else
char* getHorseName() const { return const_cast<char*>(mHorseName); } char* getHorseName() const { return const_cast<char*>(mHorseName); }
#endif
void setHorseName(const char* i_name) { void setHorseName(const char* i_name) {
#if AVOID_UB #if AVOID_UB
strncpy(mHorseName, i_name, sizeof(mHorseName) - 1); dusk::SafeStringCopyTruncate(mHorseName, i_name);
mHorseName[sizeof(mHorseName) - 1] = '\0';
#else #else
strcpy(mHorseName, i_name); strcpy(mHorseName, i_name);
#endif #endif
+1 -1
View File
@@ -51,7 +51,7 @@ public:
f32 getPositionX() const { return mPositionX; } f32 getPositionX() const { return mPositionX; }
f32 getPositionY() const { return mPositionY; } f32 getPositionY() const { return mPositionY; }
void refreshAspectScale(); void refreshAspectScale(f32 param_0);
#endif #endif
void onUpdateFlag() { mUpdateFlag = true; } void onUpdateFlag() { mUpdateFlag = true; }
+1 -1
View File
@@ -1225,7 +1225,7 @@ public:
#endif #endif
} }
static JKRExpHeap* getMemoryBlockHeap(int i_no) { return mMemoryBlock[i_no]; } static JKRExpHeap* getMemoryBlockHeap(int i_no) { return mMemoryBlock[i_no]; }
static char* getDemoArcName() { return mDemoArcName; } static TEXT_SPAN getDemoArcName() { return mDemoArcName; }
static void offNoChangeRoom() { mNoChangeRoom = false; } static void offNoChangeRoom() { mNoChangeRoom = false; }
static void onNoChangeRoom() { mNoChangeRoom = true; } static void onNoChangeRoom() { mNoChangeRoom = true; }
+3 -2
View File
@@ -5,7 +5,7 @@
#include <queue> #include <queue>
#include <string> #include <string>
#include <string_view> #include <string_view>
#include <unordered_set> #include <unordered_map>
#include <vector> #include <vector>
#include "nlohmann/json.hpp" #include "nlohmann/json.hpp"
@@ -47,6 +47,7 @@ public:
// Signals are visible to all achievement checks within the same tick, then cleared. // Signals are visible to all achievement checks within the same tick, then cleared.
void signal(const char* key); void signal(const char* key);
bool hasSignal(const char* key) const; bool hasSignal(const char* key) const;
int signalCount(const char* key) const;
std::vector<Achievement> getAchievements() const; std::vector<Achievement> getAchievements() const;
@@ -62,7 +63,7 @@ private:
void processEntry(Entry& e); void processEntry(Entry& e);
std::vector<Entry> m_entries; std::vector<Entry> m_entries;
std::unordered_set<std::string_view> m_signals; std::unordered_map<std::string_view, int> m_signals;
bool m_loaded = false; bool m_loaded = false;
bool m_dirty = false; bool m_dirty = false;
}; };
+7
View File
@@ -0,0 +1,7 @@
#pragma once
namespace dusk::crash_handler {
void install();
} // namespace dusk::crash_handler
+5
View File
@@ -12,6 +12,7 @@ namespace dusk {
void InitializeFileLogging(const std::filesystem::path& configDir, AuroraLogLevel logLevel); void InitializeFileLogging(const std::filesystem::path& configDir, AuroraLogLevel logLevel);
void ShutdownFileLogging(); void ShutdownFileLogging();
const char* GetLogFilePath(); const char* GetLogFilePath();
int GetLogFileDescriptor();
void SendToStubLog(AuroraLogLevel level, const char* module, const char* message); void SendToStubLog(AuroraLogLevel level, const char* module, const char* message);
} }
@@ -19,7 +20,11 @@ extern bool StubLogEnabled;
extern aurora::Module DuskLog; extern aurora::Module DuskLog;
#ifndef NDEBUG
#define STUB_LOG() DuskLog.debug("{} is a stub", __FUNCTION__) #define STUB_LOG() DuskLog.debug("{} is a stub", __FUNCTION__)
#else
#define STUB_LOG()
#endif
#if TARGET_PC #if TARGET_PC
#define STUB_RET(...) \ #define STUB_RET(...) \
+30 -1
View File
@@ -15,6 +15,12 @@ enum class BloomMode : int {
Dusk = 2, Dusk = 2,
}; };
enum class DepthOfFieldMode : int {
Off = 0,
Classic = 1,
Dusk = 2,
};
enum class Resampler : int { enum class Resampler : int {
Bilinear = 0, Bilinear = 0,
Area = 1, Area = 1,
@@ -45,6 +51,12 @@ enum class FrameInterpMode : u8 {
Unlimited = 2, Unlimited = 2,
}; };
enum class MenuScaling : u8 {
GameCube = 0,
Wii = 1,
Dusklight = 2,
};
namespace config { namespace config {
template <> template <>
struct ConfigEnumRange<BloomMode> { struct ConfigEnumRange<BloomMode> {
@@ -52,6 +64,12 @@ struct ConfigEnumRange<BloomMode> {
static constexpr auto max = BloomMode::Dusk; static constexpr auto max = BloomMode::Dusk;
}; };
template <>
struct ConfigEnumRange<DepthOfFieldMode> {
static constexpr auto min = DepthOfFieldMode::Off;
static constexpr auto max = DepthOfFieldMode::Dusk;
};
template <> template <>
struct ConfigEnumRange<Resampler> { struct ConfigEnumRange<Resampler> {
static constexpr auto min = Resampler::Bilinear; static constexpr auto min = Resampler::Bilinear;
@@ -81,6 +99,12 @@ struct ConfigEnumRange<FrameInterpMode> {
static constexpr auto min = FrameInterpMode::Off; static constexpr auto min = FrameInterpMode::Off;
static constexpr auto max = FrameInterpMode::Unlimited; static constexpr auto max = FrameInterpMode::Unlimited;
}; };
template <>
struct ConfigEnumRange<MenuScaling> {
static constexpr auto min = MenuScaling::GameCube;
static constexpr auto max = MenuScaling::Dusklight;
};
} // namespace config } // namespace config
// Persistent user settings // Persistent user settings
@@ -133,6 +157,7 @@ struct UserSettings {
ConfigVar<bool> instantText; ConfigVar<bool> instantText;
ConfigVar<bool> sunsSong; ConfigVar<bool> sunsSong;
ConfigVar<bool> autoSave; ConfigVar<bool> autoSave;
ConfigVar<bool> enhancedMapMenus;
// Preferences // Preferences
ConfigVar<bool> enableMirrorMode; ConfigVar<bool> enableMirrorMode;
@@ -142,17 +167,18 @@ struct UserSettings {
ConfigVar<bool> enableAchievementToasts; ConfigVar<bool> enableAchievementToasts;
ConfigVar<bool> enableControllerToasts; ConfigVar<bool> enableControllerToasts;
ConfigVar<bool> enableDiscordPresence; ConfigVar<bool> enableDiscordPresence;
ConfigVar<MenuScaling> menuScalingMode;
// Graphics // Graphics
ConfigVar<BloomMode> bloomMode; ConfigVar<BloomMode> bloomMode;
ConfigVar<float> bloomMultiplier; ConfigVar<float> bloomMultiplier;
ConfigVar<DepthOfFieldMode> depthOfFieldMode;
ConfigVar<bool> disableWaterRefraction; ConfigVar<bool> disableWaterRefraction;
ConfigVar<bool> enableTextureReplacements; ConfigVar<bool> enableTextureReplacements;
ConfigVar<FrameInterpMode> enableFrameInterpolation; ConfigVar<FrameInterpMode> enableFrameInterpolation;
ConfigVar<int> internalResolutionScale; ConfigVar<int> internalResolutionScale;
ConfigVar<int> shadowResolutionMultiplier; ConfigVar<int> shadowResolutionMultiplier;
ConfigVar<Resampler> resampler; ConfigVar<Resampler> resampler;
ConfigVar<bool> enableDepthOfField;
ConfigVar<bool> enableMapBackground; ConfigVar<bool> enableMapBackground;
ConfigVar<bool> disableCutscenePillarboxing; ConfigVar<bool> disableCutscenePillarboxing;
@@ -176,6 +202,8 @@ struct UserSettings {
ConfigVar<bool> invertCameraYAxis; ConfigVar<bool> invertCameraYAxis;
ConfigVar<bool> invertFirstPersonXAxis; ConfigVar<bool> invertFirstPersonXAxis;
ConfigVar<bool> invertFirstPersonYAxis; ConfigVar<bool> invertFirstPersonYAxis;
ConfigVar<bool> invertAirSwimX;
ConfigVar<bool> invertAirSwimY;
ConfigVar<float> freeCameraSensitivity; ConfigVar<float> freeCameraSensitivity;
ConfigVar<bool> debugFlyCam; ConfigVar<bool> debugFlyCam;
ConfigVar<bool> debugFlyCamLockEvents; ConfigVar<bool> debugFlyCamLockEvents;
@@ -212,6 +240,7 @@ struct UserSettings {
ConfigVar<bool> liveSplitEnabled; ConfigVar<bool> liveSplitEnabled;
ConfigVar<bool> showSpeedrunRTATimer; ConfigVar<bool> showSpeedrunRTATimer;
ConfigVar<bool> recordingMode; ConfigVar<bool> recordingMode;
ConfigVar<bool> removeQuestMapMarkers;
ConfigVar<bool> showInputViewer; ConfigVar<bool> showInputViewer;
ConfigVar<bool> showInputViewerGyro; ConfigVar<bool> showInputViewerGyro;
} game; } game;
+98 -28
View File
@@ -1,22 +1,55 @@
#ifndef DUSK_STRING_HPP #ifndef DUSK_STRING_HPP
#define DUSK_STRING_HPP #define DUSK_STRING_HPP
#include <cstdarg>
#include "global.h"
#include <cstring>
#include <dolphin/os.h>
namespace dusk { namespace dusk {
inline void strncpyProxy(char* dst, const char* src, size_t count) { struct TextSpan {
#if _MSC_VER char* buffer;
#pragma warning(push) size_t size;
#pragma warning(disable : 4996)
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*
#endif #endif
strncpy(dst, src, count);
#if _MSC_VER void SafeStringCopyTruncate(char* buffer, size_t bufSize, const char* src);
#pragma warning(pop)
#endif
}
/** /**
* Copy a string to a fixed-size array. * Copy a string to a fixed-size array.
@@ -25,13 +58,28 @@ inline void strncpyProxy(char* dst, const char* src, size_t count) {
template <size_t BufSize> template <size_t BufSize>
void SafeStringCopyTruncate(char (&buffer)[BufSize], const char* src) { void SafeStringCopyTruncate(char (&buffer)[BufSize], const char* src) {
static_assert(BufSize > 0, "Target buffer cannot be size zero"); static_assert(BufSize > 0, "Target buffer cannot be size zero");
SafeStringCopyTruncate(buffer, BufSize, src);
}
if (buffer == src) { void SafeStringCopy(char* buffer, size_t bufSize, const char* src);
CRASH("Cannot copy string to same buffer"); void SafeStringCat(char* buffer, size_t bufSize, const char* src);
} int SafeStringVPrintf(char* buffer, size_t bufSize, const char* src, std::va_list args);
strncpyProxy(buffer, src, BufSize); inline void SafeStringCopy(TextSpan dst, const char* src) {
buffer[BufSize - 1] = 0; 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;
} }
/** /**
@@ -41,18 +89,40 @@ void SafeStringCopyTruncate(char (&buffer)[BufSize], const char* src) {
template <size_t BufSize> template <size_t BufSize>
void SafeStringCopy(char (&buffer)[BufSize], const char* src) { void SafeStringCopy(char (&buffer)[BufSize], const char* src) {
static_assert(BufSize > 0, "Target buffer cannot be size zero"); static_assert(BufSize > 0, "Target buffer cannot be size zero");
if (buffer == src) { SafeStringCopy(buffer, BufSize, 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 #endif // DUSK_STRING_HPP
+1 -1
View File
@@ -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_messageSet(u32 i_msgIdx, u32 param_1);
fpc_ProcID fopMsgM_messageSetDemo(u32 i_msgidx); fpc_ProcID fopMsgM_messageSetDemo(u32 i_msgidx);
msg_class* fopMsgM_SearchByID(fpc_ProcID i_id); msg_class* fopMsgM_SearchByID(fpc_ProcID i_id);
char* fopMsgM_messageGet(char* i_stringBuf, u32 i_msgId); TEXT_SPAN fopMsgM_messageGet(TEXT_SPAN 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, 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, f32 param_5, f32 param_6, f32 param_7, f32 param_8,
fopMsgCreateFunc i_createFunc); fopMsgCreateFunc i_createFunc);
@@ -4,6 +4,7 @@
#include "JSystem/J2DGraph/J2DMaterial.h" #include "JSystem/J2DGraph/J2DMaterial.h"
#include "JSystem/J2DGraph/J2DPane.h" #include "JSystem/J2DGraph/J2DPane.h"
#include "dusk/endian.h" #include "dusk/endian.h"
#include "dusk/string.hpp"
class J2DMaterial; class J2DMaterial;
class JUTFont; class JUTFont;
@@ -98,7 +99,8 @@ public:
void initiate(ResFONT const*, char const*, s16, J2DTextBoxHBinding, void initiate(ResFONT const*, char const*, s16, J2DTextBoxHBinding,
J2DTextBoxVBinding); J2DTextBoxVBinding);
void private_readStream(J2DPane*, JSURandomInputStream*, JKRArchive*); void private_readStream(J2DPane*, JSURandomInputStream*, JKRArchive*);
char* getStringPtr() const; TEXT_SPAN getStringPtr() const;
dusk::TextSpan getSpan() const;
s32 setString(s16, char const*, ...); s32 setString(s16, char const*, ...);
s32 setString(char const*, ...); s32 setString(char const*, ...);
@@ -1575,6 +1575,12 @@ struct J3DAlphaComp {
u8 getRef1() const { return mRef1; } u8 getRef1() const { return mRef1; }
void load() const { 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); J3DGDSetAlphaCompare((GXCompare)getComp0(), mRef0, (GXAlphaOp)getOp(), (GXCompare)getComp1(), mRef1);
} }
@@ -8,6 +8,8 @@
#include <cstring> #include <cstring>
#include <types.h> #include <types.h>
#include "dusk/string.hpp"
J2DMaterialFactory::J2DMaterialFactory(J2DMaterialBlock const& param_0) { J2DMaterialFactory::J2DMaterialFactory(J2DMaterialBlock const& param_0) {
mMaterialNum = param_0.field_0x8; mMaterialNum = param_0.field_0x8;
mpMaterialInitData = JSUConvertOffsetToPtr<J2DMaterialInitData>(&param_0, param_0.field_0xc); mpMaterialInitData = JSUConvertOffsetToPtr<J2DMaterialInitData>(&param_0, param_0.field_0xc);
@@ -92,7 +94,7 @@ J2DMaterial* J2DMaterialFactory::create(J2DMaterial* param_0, int index, u32 par
} }
if (local_380 == NULL && J2DScreen::getDataManage() != NULL) { if (local_380 == NULL && J2DScreen::getDataManage() != NULL) {
char acStack_230[257]; char acStack_230[257];
strcpy(acStack_230, param_3->getName(texNo)); SAFE_STRCPY(acStack_230, param_3->getName(texNo));
local_380 = J2DScreen::getDataManage()->get(acStack_230); local_380 = J2DScreen::getDataManage()->get(acStack_230);
} }
} }
@@ -111,7 +113,7 @@ J2DMaterial* J2DMaterialFactory::create(J2DMaterial* param_0, int index, u32 par
} }
if (local_388 == NULL && J2DScreen::getDataManage() != NULL) { if (local_388 == NULL && J2DScreen::getDataManage() != NULL) {
char acStack_334[257]; char acStack_334[257];
strcpy(acStack_334, param_4->getName(param_0->getTevBlock()->getFontNo())); SAFE_STRCPY(acStack_334, param_4->getName(param_0->getTevBlock()->getFontNo()));
local_388 = J2DScreen::getDataManage()->get(acStack_334); local_388 = J2DScreen::getDataManage()->get(acStack_334);
} }
} }
+6 -2
View File
@@ -309,8 +309,12 @@ void J2DTextBox::draw(f32 posX, f32 posY, f32 param_2, J2DTextBoxHBinding hBind)
} }
} }
char* J2DTextBox::getStringPtr() const { TEXT_SPAN J2DTextBox::getStringPtr() const {
#if TARGET_PC
return { mStringPtr, mStringLength };
#else
return mStringPtr; return mStringPtr;
#endif
} }
s32 J2DTextBox::setString(char const* string, ...) { s32 J2DTextBox::setString(char const* string, ...) {
@@ -330,7 +334,7 @@ s32 J2DTextBox::setString(char const* string, ...) {
if (mStringPtr) { if (mStringPtr) {
mStringLength = len + 1; mStringLength = len + 1;
strcpy(mStringPtr, string); SAFE_STRCPY_BOUNDED(mStringPtr, mStringLength, string);
} }
va_end(args); va_end(args);
+3 -1
View File
@@ -2,6 +2,8 @@
#include <JSystem/JUtility/JUTAssert.h> #include <JSystem/JUtility/JUTAssert.h>
#include <cstring> #include <cstring>
#include "dusk/string.hpp"
u32 JAHVirtualNode::smVirNodeNum; u32 JAHVirtualNode::smVirNodeNum;
void JAHVirtualNode::virtualMessage(JAHControl& control) { void JAHVirtualNode::virtualMessage(JAHControl& control) {
@@ -77,7 +79,7 @@ void JAHVirtualNode::setVirNodeName(const char* name) {
// clang-format off // clang-format off
JUT_ASSERT(141, size<32); JUT_ASSERT(141, size<32);
// clang-format on // clang-format on
strcpy(mName, name); SAFE_STRCPY(mName, name);
} }
JAHVirtualNode::JAHVirtualNode(const char* name) : mTree(this) { JAHVirtualNode::JAHVirtualNode(const char* name) : mTree(this) {
+3 -1
View File
@@ -4,7 +4,9 @@
#include "JSystem/JAHostIO/JAHioMessage.h" #include "JSystem/JAHostIO/JAHioMessage.h"
#include "JSystem/JAHostIO/JAHioMgr.h" #include "JSystem/JAHostIO/JAHioMgr.h"
#include "JSystem/JAHostIO/JAHioNode.h" #include "JSystem/JAHostIO/JAHioNode.h"
#include "JSystem/JHostIO/JORServer.h" #include "JSystem/JHostIO/JORServer.h"
#include "dusk/string.hpp"
JAHioNode* JAHioNode::smCurrentNode; JAHioNode* JAHioNode::smCurrentNode;
@@ -32,7 +34,7 @@ void JAHioNode::updateNode() {
void JAHioNode::setNodeName(const char* name) { void JAHioNode::setNodeName(const char* name) {
int size = strlen(name) + 1; int size = strlen(name) + 1;
JUT_ASSERT(51, size < 32); JUT_ASSERT(51, size < 32);
strcpy(mName, name); SAFE_STRCPY(mName, name);
} }
void JAHioNode::genMessage(JORMContext* mctx) { void JAHioNode::genMessage(JORMContext* mctx) {
@@ -9,6 +9,8 @@
#include <os.h> #include <os.h>
#include <stdint.h> #include <stdint.h>
#include "dusk/string.hpp"
JASHeap* JASWaveArcLoader::sAramHeap; JASHeap* JASWaveArcLoader::sAramHeap;
JASHeap* JASWaveArcLoader::getRootHeap() { JASHeap* JASWaveArcLoader::getRootHeap() {
@@ -22,7 +24,7 @@ char JASWaveArcLoader::sCurrentDir[DIR_MAX] = "/AudioRes/Waves/";
void JASWaveArcLoader::setCurrentDir(char const* dir) { void JASWaveArcLoader::setCurrentDir(char const* dir) {
JUT_ASSERT(40, std::strlen(dir) < DIR_MAX - 1); JUT_ASSERT(40, std::strlen(dir) < DIR_MAX - 1);
strcpy(sCurrentDir, dir); SAFE_STRCPY(sCurrentDir, dir);
u32 len = strlen(sCurrentDir); u32 len = strlen(sCurrentDir);
if (sCurrentDir[len - 1] != '/') { if (sCurrentDir[len - 1] != '/') {
JUT_ASSERT(45, len + 1 < DIR_MAX); JUT_ASSERT(45, len + 1 < DIR_MAX);
@@ -170,8 +172,8 @@ void JASWaveArc::setFileName(char const* fileName) {
length = length + strlen(fileName); length = length + strlen(fileName);
char* path = JKR_NEW_ARRAY_ARGS(char, length + 1, JASKernel::getSystemHeap(), -4); char* path = JKR_NEW_ARRAY_ARGS(char, length + 1, JASKernel::getSystemHeap(), -4);
JUT_ASSERT(322, path); JUT_ASSERT(322, path);
strcpy(path, currentDir); SAFE_STRCPY_BOUNDED(path, length + 1, currentDir);
strcat(path, fileName); SAFE_STRCAT_BOUNDED(path, length + 1, fileName);
path[length] = '\0'; path[length] = '\0';
int entryNum = DVDConvertPathToEntrynum(path); int entryNum = DVDConvertPathToEntrynum(path);
JKR_DELETE_ARRAY(path); JKR_DELETE_ARRAY(path);
@@ -8,6 +8,7 @@
#include <cctype> #include <cctype>
#include <cstring> #include <cstring>
#include "dusk/string.hpp"
#include "global.h" #include "global.h"
JKRFileCache* JKRFileCache::mount(const char* path, JKRHeap* heap, const char* param_3) { JKRFileCache* JKRFileCache::mount(const char* path, JKRHeap* heap, const char* param_3) {
+3 -2
View File
@@ -4,10 +4,11 @@
#define MSL_USE_INLINES 1 // needed to inline tolower call. not inlined elsewhere in the repo #define MSL_USE_INLINES 1 // needed to inline tolower call. not inlined elsewhere in the repo
#include <cstring>
#include <cctype> #include <cctype>
#include <cstring>
#include <string> #include <string>
#include "JSystem/JKernel/JKRHeap.h" #include "JSystem/JKernel/JKRHeap.h"
#include "dusk/string.hpp"
#include "global.h" #include "global.h"
JKRFileLoader* JKRFileLoader::sCurrentVolume; JKRFileLoader* JKRFileLoader::sCurrentVolume;
@@ -104,7 +105,7 @@ const char* JKRFileLoader::fetchVolumeName(char* buffer, s32 bufferSize, const c
static char rootPath[2] = "/"; static char rootPath[2] = "/";
if (strcmp(path, "/") == 0) { if (strcmp(path, "/") == 0) {
strcpy(buffer, rootPath); SAFE_STRCPY_BOUNDED(buffer, bufferSize, rootPath);
return rootPath; return rootPath;
} }
+3 -1
View File
@@ -7,6 +7,8 @@
#include "global.h" #include "global.h"
#include <stdint.h> #include <stdint.h>
#include "dusk/string.hpp"
#if TARGET_PC #if TARGET_PC
#include "dusk/os.h" #include "dusk/os.h"
#endif #endif
@@ -274,7 +276,7 @@ void JKRThreadSwitch::draw(JKRThreadName_* thread_name_list, JUTConsole* console
if (!thread_print_name) { if (!thread_print_name) {
char buffer[16]; char buffer[16];
sprintf(buffer, "%d", loadInfo->getId()); SAFE_SPRINTF(buffer, "%d", loadInfo->getId());
thread_print_name = buffer; thread_print_name = buffer;
} }
@@ -76,6 +76,7 @@ void JPARegistAlpha(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
} }
void JPARegistPrmAlpha(JPAEmitterWorkData* work, JPABaseParticle* ptcl) { void JPARegistPrmAlpha(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
ZoneScoped;
JPABaseEmitter* emtr = work->mpEmtr; JPABaseEmitter* emtr = work->mpEmtr;
GXColor prm = ptcl->mPrmClr; GXColor prm = ptcl->mPrmClr;
prm.r = COLOR_MULTI(prm.r, emtr->mGlobalPrmClr.r); prm.r = COLOR_MULTI(prm.r, emtr->mGlobalPrmClr.r);
@@ -87,6 +88,7 @@ void JPARegistPrmAlpha(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
} }
void JPARegistPrmAlphaEnv(JPAEmitterWorkData* work, JPABaseParticle* ptcl) { void JPARegistPrmAlphaEnv(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
ZoneScoped;
JPABaseEmitter* emtr = work->mpEmtr; JPABaseEmitter* emtr = work->mpEmtr;
GXColor prm = ptcl->mPrmClr; GXColor prm = ptcl->mPrmClr;
GXColor env = ptcl->mEnvClr; GXColor env = ptcl->mEnvClr;
@@ -225,6 +227,7 @@ void JPAGenTexCrdMtxPrj(JPAEmitterWorkData* param_0) {
} }
void JPAGenCalcTexCrdMtxAnm(JPAEmitterWorkData* work) { void JPAGenCalcTexCrdMtxAnm(JPAEmitterWorkData* work) {
ZoneScoped;
JPABaseShape* shape = work->mpRes->getBsp(); JPABaseShape* shape = work->mpRes->getBsp();
f32 dVar16 = work->mpEmtr->mTick; f32 dVar16 = work->mpEmtr->mTick;
f32 dVar15 = 0.5f * (1.0f + shape->getTilingS()); f32 dVar15 = 0.5f * (1.0f + shape->getTilingS());
@@ -256,6 +259,7 @@ void JPAGenCalcTexCrdMtxAnm(JPAEmitterWorkData* work) {
} }
void JPALoadCalcTexCrdMtxAnm(JPAEmitterWorkData* work, JPABaseParticle* param_1) { void JPALoadCalcTexCrdMtxAnm(JPAEmitterWorkData* work, JPABaseParticle* param_1) {
ZoneScoped;
JPABaseShape* shape = work->mpRes->getBsp(); JPABaseShape* shape = work->mpRes->getBsp();
f32 dVar16 = param_1->mAge; f32 dVar16 = param_1->mAge;
f32 dVar15 = 0.5f * (1.0f + shape->getTilingS()); f32 dVar15 = 0.5f * (1.0f + shape->getTilingS());
@@ -286,14 +290,17 @@ void JPALoadCalcTexCrdMtxAnm(JPAEmitterWorkData* work, JPABaseParticle* param_1)
} }
void JPALoadTex(JPAEmitterWorkData* work) { void JPALoadTex(JPAEmitterWorkData* work) {
ZoneScoped;
work->mpResMgr->load(work->mpRes->getTexIdx(work->mpRes->getBsp()->getTexIdx()), GX_TEXMAP0); work->mpResMgr->load(work->mpRes->getTexIdx(work->mpRes->getBsp()->getTexIdx()), GX_TEXMAP0);
} }
void JPALoadTexAnm(JPAEmitterWorkData* work) { void JPALoadTexAnm(JPAEmitterWorkData* work) {
ZoneScoped;
work->mpResMgr->load(work->mpRes->getTexIdx(work->mpEmtr->mTexAnmIdx), GX_TEXMAP0); work->mpResMgr->load(work->mpRes->getTexIdx(work->mpEmtr->mTexAnmIdx), GX_TEXMAP0);
} }
void JPALoadTexAnm(JPAEmitterWorkData* work, JPABaseParticle* ptcl) { void JPALoadTexAnm(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
ZoneScoped;
work->mpResMgr->load(work->mpRes->getTexIdx(ptcl->mTexAnmIdx), GX_TEXMAP0); work->mpResMgr->load(work->mpRes->getTexIdx(ptcl->mTexAnmIdx), GX_TEXMAP0);
} }
@@ -446,6 +453,7 @@ void JPADrawBillboard(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
return; return;
} }
ZoneScoped;
JGeometry::TVec3<f32> pos; JGeometry::TVec3<f32> pos;
#if TARGET_PC #if TARGET_PC
Mtx ptclPosMtx; Mtx ptclPosMtx;
@@ -475,6 +483,7 @@ void JPADrawRotBillboard(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
return; return;
} }
ZoneScoped;
if (work->mpRes->getUsrIdx() == 0x89d7) { if (work->mpRes->getUsrIdx() == 0x89d7) {
int a = 0; int a = 0;
} }
@@ -518,6 +527,7 @@ void JPADrawYBillboard(JPAEmitterWorkData* work, JPABaseParticle* param_1) {
return; return;
} }
ZoneScoped;
JGeometry::TVec3<f32> local_48; JGeometry::TVec3<f32> local_48;
MTXMultVec(work->mPosCamMtx, &param_1->mPosition, &local_48); MTXMultVec(work->mPosCamMtx, &param_1->mPosition, &local_48);
Mtx local_38; Mtx local_38;
@@ -542,6 +552,7 @@ void JPADrawRotYBillboard(JPAEmitterWorkData* work, JPABaseParticle* param_1) {
return; return;
} }
ZoneScoped;
JGeometry::TVec3<f32> local_48; JGeometry::TVec3<f32> local_48;
MTXMultVec(work->mPosCamMtx, &param_1->mPosition, &local_48); MTXMultVec(work->mPosCamMtx, &param_1->mPosition, &local_48);
f32 sinRot = JMASSin(param_1->mRotateAngle); f32 sinRot = JMASSin(param_1->mRotateAngle);
@@ -1268,6 +1279,8 @@ void JPADrawStripeX(JPAEmitterWorkData* param_0) {
} }
void JPADrawEmitterCallBackB(JPAEmitterWorkData* work) { void JPADrawEmitterCallBackB(JPAEmitterWorkData* work) {
ZoneScoped;
JPABaseEmitter* emtr = work->mpEmtr; JPABaseEmitter* emtr = work->mpEmtr;
if (emtr->mpEmtrCallBack == NULL) { if (emtr->mpEmtrCallBack == NULL) {
return; return;
@@ -1282,6 +1295,7 @@ void JPADrawParticleCallBack(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
return; return;
} }
ZoneScoped;
emtr->mpPtclCallBack->draw(emtr, ptcl); emtr->mpPtclCallBack->draw(emtr, ptcl);
} }
@@ -6,6 +6,8 @@
#include <gx.h> #include <gx.h>
void JPALoadExTex(JPAEmitterWorkData* work) { void JPALoadExTex(JPAEmitterWorkData* work) {
ZoneScoped;
JPAExTexShape* ets = work->mpRes->getEts(); JPAExTexShape* ets = work->mpRes->getEts();
GXTexCoordID secTexCoordID = GX_TEXCOORD1; GXTexCoordID secTexCoordID = GX_TEXCOORD1;
+6 -5
View File
@@ -1,13 +1,14 @@
#include "JSystem/JSystem.h" // IWYU pragma: keep #include "JSystem/JSystem.h" // IWYU pragma: keep
#include "JSystem/JUtility/JUTConsole.h" #include <cstdio>
#include <vi.h>
#include "JSystem/J2DGraph/J2DOrthoGraph.h" #include "JSystem/J2DGraph/J2DOrthoGraph.h"
#include "JSystem/JKernel/JKRHeap.h" #include "JSystem/JKernel/JKRHeap.h"
#include "JSystem/JUtility/JUTAssert.h" #include "JSystem/JUtility/JUTAssert.h"
#include "JSystem/JUtility/JUTConsole.h"
#include "JSystem/JUtility/JUTDirectPrint.h" #include "JSystem/JUtility/JUTDirectPrint.h"
#include "JSystem/JUtility/JUTVideo.h" #include "JSystem/JUtility/JUTVideo.h"
#include <vi.h> #include "dusk/string.hpp"
#include <cstdio>
#include "global.h" #include "global.h"
JUTConsoleManager* JUTConsoleManager::sManager; JUTConsoleManager* JUTConsoleManager::sManager;
@@ -204,10 +205,10 @@ void JUTConsole::doDraw(JUTConsole::EConsoleType consoleType) const {
mFont->drawString_scale((int)f31, sp94, mFontSizeX, mFontSizeY, spA8, TRUE); mFont->drawString_scale((int)f31, sp94, mFontSizeX, mFontSizeY, spA8, TRUE);
f31 += mFontSizeX * 13.0f; f31 += mFontSizeX * 13.0f;
if (sp88) { if (sp88) {
sprintf(spB8, "ALL"); SAFE_SPRINTF(spB8, "ALL");
} else { } else {
f32 f29 = sp8C / (f32)(sp90 - mHeight); f32 f29 = sp8C / (f32)(sp90 - mHeight);
sprintf(spB8, "%3d%%(%dL)", (int)(100.0 * f29), sp90); SAFE_SPRINTF(spB8, "%3d%%(%dL)", (int)(100.0 * f29), sp90);
} }
mFont->drawString_scale(f31, sp94, mFontSizeX, mFontSizeY, spB8, TRUE); mFont->drawString_scale(f31, sp94, mFontSizeX, mFontSizeY, spB8, TRUE);
} }
+4 -2
View File
@@ -9,6 +9,8 @@
#include <cmath> #include <cmath>
#include <cstdio> #include <cstdio>
#include <cstdlib> #include <cstdlib>
#include "dusk/string.hpp"
#ifdef __REVOLUTION_SDK__ #ifdef __REVOLUTION_SDK__
#include <revolution.h> #include <revolution.h>
#else #else
@@ -845,8 +847,8 @@ bool JUTException::queryMapAddress(char* mapPath, u32 address, s32 section_id, u
bool begin_with_newline) { bool begin_with_newline) {
if (mapPath) { if (mapPath) {
char buffer[80]; char buffer[80];
strcpy(buffer, mapPath); SAFE_STRCPY(buffer, mapPath);
strcat(buffer, ".map"); SAFE_STRCAT(buffer, ".map");
if (queryMapAddress_single(buffer, address, section_id, out_addr, out_size, out_line, if (queryMapAddress_single(buffer, address, section_id, out_addr, out_size, out_line,
line_length, print, begin_with_newline) == true) line_length, print, begin_with_newline) == true)
{ {
+14 -1
View File
@@ -13,20 +13,33 @@ inline denormal_state denormals_enable()
} }
inline void denormals_restore(denormal_state saved) { _mm_setcsr(saved); } inline void denormals_restore(denormal_state saved) { _mm_setcsr(saved); }
#elif defined(__aarch64__) || defined(_M_ARM64) #elif defined(__aarch64__) || defined(_M_ARM64) || defined(_M_ARM64EC)
#include <cstdint> #include <cstdint>
#if defined(_MSC_VER) && !defined(__clang__) && (defined(_M_ARM64) || defined(_M_ARM64EC))
#include <intrin.h>
#endif
using denormal_state = uint64_t; using denormal_state = uint64_t;
inline denormal_state denormals_enable() inline denormal_state denormals_enable()
{ {
#if defined(_MSC_VER) && !defined(__clang__) && (defined(_M_ARM64) || defined(_M_ARM64EC))
denormal_state saved = static_cast<denormal_state>(_ReadStatusReg(ARM64_FPCR));
_WriteStatusReg(ARM64_FPCR, static_cast<__int64>(saved | (1ULL << 24))); // FZ
return saved;
#else
denormal_state saved; denormal_state saved;
asm volatile("mrs %0, fpcr" : "=r"(saved)); asm volatile("mrs %0, fpcr" : "=r"(saved));
asm volatile("msr fpcr, %0" :: "r"(saved | (1ULL << 24))); // FZ asm volatile("msr fpcr, %0" :: "r"(saved | (1ULL << 24))); // FZ
return saved; return saved;
#endif
} }
inline void denormals_restore(denormal_state saved) inline void denormals_restore(denormal_state saved)
{ {
#if defined(_MSC_VER) && !defined(__clang__) && (defined(_M_ARM64) || defined(_M_ARM64EC))
_WriteStatusReg(ARM64_FPCR, static_cast<__int64>(saved));
#else
asm volatile("msr fpcr, %0" :: "r"(saved)); asm volatile("msr fpcr, %0" :: "r"(saved));
#endif
} }
#elif defined(__arm__) || defined(_M_ARM) #elif defined(__arm__) || defined(_M_ARM)
+5 -2
View File
@@ -2,6 +2,9 @@ plugins {
id 'com.android.application' id 'com.android.application'
} }
def versionNameStr = (System.getenv("DUSK_VERSION") ?: "v0.1.0").replaceFirst("^v", "")
def versionCodeInt = (System.getenv("DUSK_VERSION_CODE") ?: "100000").toInteger()
def duskRepoDir = rootProject.projectDir.parentFile.parentFile def duskRepoDir = rootProject.projectDir.parentFile.parentFile
def duskGeneratedAssetsDir = layout.buildDirectory.dir('generated/assets/dusklight').get().asFile def duskGeneratedAssetsDir = layout.buildDirectory.dir('generated/assets/dusklight').get().asFile
def syncDuskAssets = tasks.register('syncDuskAssets', Sync) { def syncDuskAssets = tasks.register('syncDuskAssets', Sync) {
@@ -20,8 +23,8 @@ android {
applicationId 'dev.twilitrealm.dusk' applicationId 'dev.twilitrealm.dusk'
minSdk 26 minSdk 26
targetSdk 36 targetSdk 36
versionCode 1 versionCode versionCodeInt
versionName '0.1.0' versionName versionNameStr
} }
buildTypes { buildTypes {
@@ -11,6 +11,7 @@
<uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
<application <application
android:allowBackup="true" android:allowBackup="true"
@@ -12,6 +12,7 @@ import android.os.Bundle;
import android.os.Environment; import android.os.Environment;
import android.provider.DocumentsContract; import android.provider.DocumentsContract;
import android.provider.OpenableColumns; import android.provider.OpenableColumns;
import android.provider.Settings;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.view.Window; import android.view.Window;
@@ -27,10 +28,12 @@ import java.util.List;
public class DuskActivity extends SDLActivity { public class DuskActivity extends SDLActivity {
private static final String TAG = "DuskActivity"; private static final String TAG = "DuskActivity";
private static final int FOLDER_DIALOG_REQUEST_CODE = 0x4455; private static final int FOLDER_DIALOG_REQUEST_CODE = 0x4455;
private static final int MANAGE_STORAGE_REQUEST_CODE = 0x4456;
private static final String EXTERNAL_STORAGE_AUTHORITY = private static final String EXTERNAL_STORAGE_AUTHORITY =
"com.android.externalstorage.documents"; "com.android.externalstorage.documents";
private long folderDialogUserdata = 0; private long folderDialogUserdata = 0;
private boolean awaitingManageStoragePermission = false;
private static native void nativeFolderDialogResult(long userdata, String path, String error); private static native void nativeFolderDialogResult(long userdata, String path, String error);
@@ -89,6 +92,9 @@ public class DuskActivity extends SDLActivity {
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
hideSystemBars(); hideSystemBars();
if (awaitingManageStoragePermission) {
resumeFolderDialogAfterPermissionGrant();
}
} }
@Override @Override
@@ -171,6 +177,19 @@ public class DuskActivity extends SDLActivity {
} }
folderDialogUserdata = userdata; folderDialogUserdata = userdata;
if (requiresManageStoragePermission() && !hasManageStoragePermission()) {
if (!requestManageStoragePermission()) {
finishFolderDialogWithError("Unable to request Android file access permission");
return false;
}
return true;
}
openFolderDialog();
return true;
}
private void openFolderDialog() {
runOnUiThread(() -> { runOnUiThread(() -> {
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE); Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION |
@@ -185,9 +204,71 @@ public class DuskActivity extends SDLActivity {
finishFolderDialog(Activity.RESULT_CANCELED, null); finishFolderDialog(Activity.RESULT_CANCELED, null);
} }
}); });
}
private boolean requiresManageStoragePermission() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.R;
}
private boolean hasManageStoragePermission() {
return !requiresManageStoragePermission() || Environment.isExternalStorageManager();
}
private boolean requestManageStoragePermission() {
if (!requiresManageStoragePermission()) {
return true;
}
awaitingManageStoragePermission = true;
runOnUiThread(() -> {
if (tryStartManageStorageIntent(
new Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION)
.setData(Uri.parse("package:" + getPackageName()))) ||
tryStartManageStorageIntent(
new Intent(Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION)))
{
return;
}
finishFolderDialogWithError("Unable to request Android file access permission");
});
return true; return true;
} }
private boolean tryStartManageStorageIntent(Intent intent) {
try {
startActivityForResult(intent, MANAGE_STORAGE_REQUEST_CODE);
return true;
} catch (ActivityNotFoundException e) {
Log.w(TAG, "Unable to open all-files access settings.", e);
return false;
}
}
private void resumeFolderDialogAfterPermissionGrant() {
awaitingManageStoragePermission = false;
if (folderDialogUserdata == 0) {
return;
}
if (hasManageStoragePermission()) {
openFolderDialog();
return;
}
finishFolderDialogWithError(
"Allow \"All files access\" for Dusklight before choosing a custom data folder");
}
private void finishFolderDialogWithError(String error) {
long userdata = folderDialogUserdata;
folderDialogUserdata = 0;
awaitingManageStoragePermission = false;
if (userdata != 0) {
nativeFolderDialogResult(userdata, null, error);
}
}
private void finishFolderDialog(int resultCode, Intent data) { private void finishFolderDialog(int resultCode, Intent data) {
long userdata = folderDialogUserdata; long userdata = folderDialogUserdata;
folderDialogUserdata = 0; folderDialogUserdata = 0;
@@ -61,7 +61,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
private static final String TAG = "SDL"; private static final String TAG = "SDL";
private static final int SDL_MAJOR_VERSION = 3; private static final int SDL_MAJOR_VERSION = 3;
private static final int SDL_MINOR_VERSION = 4; private static final int SDL_MINOR_VERSION = 4;
private static final int SDL_MICRO_VERSION = 4; private static final int SDL_MICRO_VERSION = 8;
/* /*
// Display InputType.SOURCE/CLASS of events and devices // Display InputType.SOURCE/CLASS of events and devices
// //
@@ -570,7 +570,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
public static int getNaturalOrientation() { public static int getNaturalOrientation() {
int result = SDL_ORIENTATION_UNKNOWN; int result = SDL_ORIENTATION_UNKNOWN;
Activity activity = (Activity)getContext(); Activity activity = getContext();
if (activity != null) { if (activity != null) {
Configuration config = activity.getResources().getConfiguration(); Configuration config = activity.getResources().getConfiguration();
Display display = activity.getWindowManager().getDefaultDisplay(); Display display = activity.getWindowManager().getDefaultDisplay();
@@ -590,7 +590,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
public static int getCurrentRotation() { public static int getCurrentRotation() {
int result = 0; int result = 0;
Activity activity = (Activity)getContext(); Activity activity = getContext();
if (activity != null) { if (activity != null) {
Display display = activity.getWindowManager().getDefaultDisplay(); Display display = activity.getWindowManager().getDefaultDisplay();
switch (display.getRotation()) { switch (display.getRotation()) {
@@ -1292,7 +1292,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
public static double getDiagonal() public static double getDiagonal()
{ {
DisplayMetrics metrics = new DisplayMetrics(); DisplayMetrics metrics = new DisplayMetrics();
Activity activity = (Activity)getContext(); Activity activity = getContext();
if (activity == null) { if (activity == null) {
return 0.0; return 0.0;
} }
@@ -1940,7 +1940,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
return; return;
} }
Activity activity = (Activity)getContext(); Activity activity = getContext();
if (activity.checkSelfPermission(permission) != PackageManager.PERMISSION_GRANTED) { if (activity.checkSelfPermission(permission) != PackageManager.PERMISSION_GRANTED) {
activity.requestPermissions(new String[]{permission}, requestCode); activity.requestPermissions(new String[]{permission}, requestCode);
} else { } else {

Before

Width:  |  Height:  |  Size: 928 KiB

After

Width:  |  Height:  |  Size: 928 KiB

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Before

Width:  |  Height:  |  Size: 1014 B

After

Width:  |  Height:  |  Size: 1014 B

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 90 KiB

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Before

Width:  |  Height:  |  Size: 279 KiB

After

Width:  |  Height:  |  Size: 279 KiB

Before

Width:  |  Height:  |  Size: 8.7 KiB

After

Width:  |  Height:  |  Size: 8.7 KiB

@@ -3,7 +3,7 @@ Name=Dusklight
GenericName=Dusklight GenericName=Dusklight
Comment=PC port of a classic adventure game Comment=PC port of a classic adventure game
Exec=dusklight Exec=dusklight
Icon=dusklight Icon=dev.twilitrealm.dusk
Terminal=false Terminal=false
Type=Application Type=Application
Categories=Game; Categories=Game;
+2
View File
@@ -447,6 +447,7 @@ body.animate-in .intro-item {
top: auto; top: auto;
text-align: right; text-align: right;
font-size: 16dp; font-size: 16dp;
gap: 8dp;
} }
#disc-status { #disc-status {
@@ -468,6 +469,7 @@ body.animate-in .intro-item {
top: 32dp; top: 32dp;
text-align: right; text-align: right;
font-size: 16dp; font-size: 16dp;
gap: 8dp;
} }
.update { .update {
+1 -1
View File
@@ -183,7 +183,7 @@ bool Z2SoundMgr::startSound(JAISoundID soundID, JAISoundHandle* handle, const JG
return streamMgr_.startSound(soundID, handle, posPtr); return streamMgr_.startSound(soundID, handle, posPtr);
default: default:
char error[64]; char error[64];
sprintf(error, "Unknown Sound-Type id :%08x\n", (u32)soundID); SAFE_SPRINTF(error, "Unknown Sound-Type id :%08x\n", (u32)soundID);
JUT_WARN(277, "%s", error); JUT_WARN(277, "%s", error);
} }
+1
View File
@@ -57,6 +57,7 @@
#include "dusk/settings.h" #include "dusk/settings.h"
#include "res/Object/Alink.h" #include "res/Object/Alink.h"
#include <cstring> #include <cstring>
#include <dusk/string.hpp>
#endif #endif
static int daAlink_Create(fopAc_ac_c* i_this); static int daAlink_Create(fopAc_ac_c* i_this);
+4
View File
@@ -1165,6 +1165,10 @@ int daAlink_c::procCutFinishInit(int i_type) {
const daAlink_cutParamTbl* cutParams = &cutParamTable[i_type]; const daAlink_cutParamTbl* cutParams = &cutParamTable[i_type];
BOOL is_proc_frontRoll = mProcID == PROC_FRONT_ROLL; BOOL is_proc_frontRoll = mProcID == PROC_FRONT_ROLL;
#if TARGET_PC
mIsRollstab = (is_proc_frontRoll != FALSE) && (i_type == CUT_FINISH_PARAM_STAB);
#endif
commonProcInit(PROC_CUT_FINISH); commonProcInit(PROC_CUT_FINISH);
setCutType(cutParams->m_cutType); setCutType(cutParams->m_cutType);
field_0x3198 = cutParams->m_recoilAnmID; field_0x3198 = cutParams->m_recoilAnmID;
+2 -2
View File
@@ -4359,7 +4359,7 @@ void daAlink_c::dungeonReturnWarp() {
s16 angle = dComIfGs_getWarpPlayerAngleY(); s16 angle = dComIfGs_getWarpPlayerAngleY();
s8 room = dComIfGs_getWarpRoomNo(); s8 room = dComIfGs_getWarpRoomNo();
char name[8]; char name[8];
strcpy(name, dComIfGs_getWarpStageName()); SAFE_STRCPY(name, dComIfGs_getWarpStageName());
dComIfGs_setRestartRoom(pos, angle, room); dComIfGs_setRestartRoom(pos, angle, room);
dComIfGp_setNextStage(name, -1, dComIfGs_getRestartRoomNo(), -1, 0.0f, 12, 0, dComIfGp_setNextStage(name, -1, dComIfGs_getRestartRoomNo(), -1, 0.0f, 12, 0,
@@ -4535,7 +4535,7 @@ int daAlink_c::procCoWarpInit(int param_0, int param_1) {
if (checkBossRoom() && fopAcM_GetRoomNo(this) == 50) { if (checkBossRoom() && fopAcM_GetRoomNo(this) == 50) {
char stageName[32]; char stageName[32];
strcpy(stageName, dComIfGp_getStartStageName()); SAFE_STRCPY(stageName, dComIfGp_getStartStageName());
for (int i = 0; i < 32; i++) { for (int i = 0; i < 32; i++) {
if ((s64)stageName[i] == 0) { if ((s64)stageName[i] == 0) {
+2 -2
View File
@@ -216,7 +216,7 @@ void daAlink_c::setSpeedAndAngleSwim() {
if (checkEventRun()) { if (checkEventRun()) {
var_r28 = mMoveAngle; var_r28 = mMoveAngle;
} else { } else {
var_r28 = shape_angle.y + (16384.0f * cM_ssin(mStickAngle)); var_r28 = shape_angle.y + (16384.0f * cM_ssin(mStickAngle) IF_DUSK(* (dusk::getSettings().game.invertAirSwimX ? -1.0f : 1.0f)));
} }
cLib_addCalcAngleS(&shape_angle.y, var_r28, mpHIO->mSwim.m.mUnderwaterTurnRate, mpHIO->mSwim.m.mUnderwaterMaxTurn, mpHIO->mSwim.m.mUnderwaterMinTurn); cLib_addCalcAngleS(&shape_angle.y, var_r28, mpHIO->mSwim.m.mUnderwaterTurnRate, mpHIO->mSwim.m.mUnderwaterMaxTurn, mpHIO->mSwim.m.mUnderwaterMinTurn);
@@ -835,7 +835,7 @@ void daAlink_c::setSwimMoveAnime() {
} else { } else {
s16 var_r24; s16 var_r24;
if (checkInputOnR() && !checkEventRun()) { if (checkInputOnR() && !checkEventRun()) {
var_r24 = 13653.0f * cM_scos(mStickAngle); var_r24 = 13653.0f * cM_scos(mStickAngle) IF_DUSK(* (dusk::getSettings().game.invertAirSwimY ? -1.0f : 1.0f));
} else { } else {
var_r24 = 0; var_r24 = 0;
} }
+6
View File
@@ -4005,7 +4005,13 @@ int daAlink_c::procWolfHowlDemoInit() {
} else if (name == fpcNm_Tag_WaraHowl_e) { } else if (name == fpcNm_Tag_WaraHowl_e) {
mZ2WolfHowlMgr.setCorrectCurve(static_cast<daTagWrHowl_c*>(field_0x27f4)->getTuneId()); mZ2WolfHowlMgr.setCorrectCurve(static_cast<daTagWrHowl_c*>(field_0x27f4)->getTuneId());
} else { } else {
#if TARGET_PC
if (mZ2WolfHowlMgr.getCorrectCurveID() != 9) {
mZ2WolfHowlMgr.setCorrectCurve(-1);
}
#else
mZ2WolfHowlMgr.setCorrectCurve(-1); mZ2WolfHowlMgr.setCorrectCurve(-1);
#endif
} }
} else { } else {
#if TARGET_PC #if TARGET_PC
+4
View File
@@ -2192,6 +2192,9 @@ static void damage_check(b_gnd_class* i_this) {
i_this->mDamageInvulnerabilityTimer = 100; i_this->mDamageInvulnerabilityTimer = 100;
} }
} }
#if TARGET_PC
dusk::AchievementSystem::get().signal("ganondorf_hit");
#endif
} }
cXyz hitmark_size(1.0f, 1.0f, 1.0f); cXyz hitmark_size(1.0f, 1.0f, 1.0f);
@@ -2218,6 +2221,7 @@ static void damage_check(b_gnd_class* i_this) {
i_this->field_0xc7c = 0; i_this->field_0xc7c = 0;
dScnPly_c::setPauseTimer(7); dScnPly_c::setPauseTimer(7);
a_this->health = 100; a_this->health = 100;
dusk::AchievementSystem::get().signal("ganondorf_knocked_down");
} }
break; break;
} }
+16 -15
View File
@@ -5,24 +5,25 @@
#include "d/dolzel_rel.h" // IWYU pragma: keep #include "d/dolzel_rel.h" // IWYU pragma: keep
#include "d/actor/d_a_bg_obj.h"
#include "JSystem/J3DGraphBase/J3DMaterial.h"
#include <cstdio> #include <cstdio>
#include <os.h>
#include <cstring> #include <cstring>
#include <os.h>
#include "JSystem/J3DGraphBase/J3DMaterial.h"
#include "SSystem/SComponent/c_math.h"
#include "d/actor/d_a_bg_obj.h"
#include "d/actor/d_a_set_bgobj.h" #include "d/actor/d_a_set_bgobj.h"
#include "d/d_s_play.h" #include "d/d_s_play.h"
#include "SSystem/SComponent/c_math.h" #include "dusk/string.hpp"
static const char* getBmdName(int param_0, int param_1) { static const char* getBmdName(int param_0, int param_1) {
static char l_bmdName[16]; static char l_bmdName[16];
switch (param_1) { switch (param_1) {
case 0: case 0:
sprintf(l_bmdName, "model%d.bmd", param_0); SAFE_SPRINTF(l_bmdName, "model%d.bmd", param_0);
break; break;
default: default:
sprintf(l_bmdName, "model%d_%d.bmd", param_0, param_1); SAFE_SPRINTF(l_bmdName, "model%d_%d.bmd", param_0, param_1);
break; break;
} }
@@ -34,10 +35,10 @@ static const char* getBtkName(int param_0, int param_1) {
switch (param_1) { switch (param_1) {
case 0: case 0:
sprintf(l_btkName, "model%d.btk", param_0); SAFE_SPRINTF(l_btkName, "model%d.btk", param_0);
break; break;
default: default:
sprintf(l_btkName, "model%d_%d.btk", param_0, param_1); SAFE_SPRINTF(l_btkName, "model%d_%d.btk", param_0, param_1);
break; break;
} }
@@ -49,10 +50,10 @@ static const char* getBrkName(int param_0, int param_1) {
switch (param_1) { switch (param_1) {
case 0: case 0:
sprintf(l_brkName, "model%d.brk", param_0); SAFE_SPRINTF(l_brkName, "model%d.brk", param_0);
break; break;
default: default:
sprintf(l_brkName, "model%d_%d.brk", param_0, param_1); SAFE_SPRINTF(l_brkName, "model%d_%d.brk", param_0, param_1);
break; break;
} }
@@ -62,7 +63,7 @@ static const char* getBrkName(int param_0, int param_1) {
static const char* getDzbName(int param_0) { static const char* getDzbName(int param_0) {
static char l_dzbName[16]; static char l_dzbName[16];
sprintf(l_dzbName, "model%d.dzb", param_0); SAFE_SPRINTF(l_dzbName, "model%d.dzb", param_0);
return l_dzbName; return l_dzbName;
} }
@@ -95,12 +96,12 @@ u8* daBgObj_c::spec_data_c::initTexShareBlock(u8* i_dataPtr) {
u8* dataPos = i_dataPtr + 8; u8* dataPos = i_dataPtr + 8;
for (; i < mTexShareNum; i++) { for (; i < mTexShareNum; i++) {
strcpy(sp48, (char*)dataPos); SAFE_STRCPY(sp48, (char*)dataPos);
int len = strlen((char*)dataPos); int len = strlen((char*)dataPos);
dataPos += len + 1; dataPos += len + 1;
if (*dataPos != 0) { if (*dataPos != 0) {
strcpy(sp8, (char*)dataPos); SAFE_STRCPY(sp8, (char*)dataPos);
dataPos += strlen((char*)dataPos) + 1; dataPos += strlen((char*)dataPos) + 1;
} else if (*dataPos == 0 && dataPos[1] == 1) { } else if (*dataPos == 0 && dataPos[1] == 1) {
dataPos += 2; dataPos += 2;
@@ -646,14 +647,14 @@ void daBgObj_c::doShareTexture() {
u8* spec_res_name = mSpecData.mpTexShareBlock + 8; u8* spec_res_name = mSpecData.mpTexShareBlock + 8;
for (int i = 0; i < mSpecData.mTexShareNum; i++) { for (int i = 0; i < mSpecData.mTexShareNum; i++) {
strcpy(res_name, (char*)spec_res_name); SAFE_STRCPY(res_name, (char*)spec_res_name);
spec_res_name += strlen((char*)spec_res_name) + 1; spec_res_name += strlen((char*)spec_res_name) + 1;
J3DModelData* modelData = J3DModelData* modelData =
(J3DModelData*)dComIfG_getObjectRes(daSetBgObj_c::getArcName(this), res_name); (J3DModelData*)dComIfG_getObjectRes(daSetBgObj_c::getArcName(this), res_name);
if (*spec_res_name != 0) { if (*spec_res_name != 0) {
strcpy(share_res_name, (char*)spec_res_name); SAFE_STRCPY(share_res_name, (char*)spec_res_name);
spec_res_name += strlen((char*)spec_res_name) + 1; spec_res_name += strlen((char*)spec_res_name) + 1;
J3DModelData* shareModelData = J3DModelData* shareModelData =
+1 -1
View File
@@ -51,7 +51,7 @@ static char* l_bmd_base_name = "door-pushDouble_";
char* daDbDoor00_c::getBmdName() { char* daDbDoor00_c::getBmdName() {
static char l_bmdName[32]; static char l_bmdName[32];
sprintf(l_bmdName, "%s%02d.bmd", l_bmd_base_name, door_param2_c::getDoorModel(this)); SAFE_SPRINTF(l_bmdName, "%s%02d.bmd", l_bmd_base_name, door_param2_c::getDoorModel(this));
return l_bmdName; return l_bmdName;
} }
+1 -1
View File
@@ -55,7 +55,7 @@ static char* l_bmd_base_name = "door-knob_";
char* daKnob20_c::getBmd() { char* daKnob20_c::getBmd() {
static char l_bmdName[32]; static char l_bmdName[32];
sprintf(l_bmdName, "%s%02d.bmd", l_bmd_base_name, knob_param_c::getDoorModel(this)); SAFE_SPRINTF(l_bmdName, "%s%02d.bmd", l_bmd_base_name, knob_param_c::getDoorModel(this));
return l_bmdName; return l_bmdName;
} }
+2 -2
View File
@@ -65,10 +65,10 @@ char* daDoor20_c::getBmdName() {
case 10: case 10:
case 12: case 12:
default: default:
sprintf(bmdName, "door-shutter_%02d.bmd", door_param2_c::getDoorModel(this)); SAFE_SPRINTF(bmdName, "door-shutter_%02d.bmd", door_param2_c::getDoorModel(this));
break; break;
case 9: case 9:
sprintf(bmdName, "door-knob_%02d.bmd", door_param2_c::getDoorModel(this)); SAFE_SPRINTF(bmdName, "door-knob_%02d.bmd", door_param2_c::getDoorModel(this));
break; break;
} }
return bmdName; return bmdName;
+2 -2
View File
@@ -94,9 +94,9 @@ const char* daSpiral_c::getBmd(int i_type) {
const char* daSpiral_c::getBmd2(int i_type) { const char* daSpiral_c::getBmd2(int i_type) {
static char bmdName[32]; static char bmdName[32];
if (i_type == daSpiral_TYPE_DOWN_e) { if (i_type == daSpiral_TYPE_DOWN_e) {
sprintf(bmdName, "door-stairSpiralU.bmd"); SAFE_SPRINTF(bmdName, "door-stairSpiralU.bmd");
} else { } else {
sprintf(bmdName, "door-stairSpiralD.bmd"); SAFE_SPRINTF(bmdName, "door-stairSpiralD.bmd");
} }
return bmdName; return bmdName;
+9
View File
@@ -3530,6 +3530,15 @@ void daKago_c::action() {
#endif #endif
mStickY = mDoCPd_c::getStickY(PAD_1); mStickY = mDoCPd_c::getStickY(PAD_1);
#ifdef TARGET_PC
if(dusk::getSettings().game.invertAirSwimX) {
mStickX = -mStickX;
}
if(dusk::getSettings().game.invertAirSwimY) {
mStickY = -mStickY;
}
#endif
u8 prevIsWaterfall = mIsWaterfall; u8 prevIsWaterfall = mIsWaterfall;
mIsWaterfall = FALSE; mIsWaterfall = FALSE;
fpcM_Search(s_waterfall, this); fpcM_Search(s_waterfall, this);
+36 -7
View File
@@ -25,7 +25,10 @@
#include <cmath> #include <cmath>
#include <cstring> #include <cstring>
#if TARGET_PC
#include "dusk/settings.h"
#include "dusk/version.hpp" #include "dusk/version.hpp"
#endif
class dmg_rod_HIO_c : public JORReflexible { class dmg_rod_HIO_c : public JORReflexible {
public: public:
@@ -1137,8 +1140,14 @@ static int lure_standby(dmg_rod_class* i_this) {
dComIfGp_setDoStatusForce(42, 0); dComIfGp_setDoStatusForce(42, 0);
} }
i_this->rod_stick_x = mDoCPd_c::getStickX3D(PAD_1) * mDoCPd_c::getStickX3D(PAD_1); f32 stick_x = mDoCPd_c::getStickX3D(PAD_1);
if (mDoCPd_c::getStickX3D(PAD_1) < 0.0f) { #if TARGET_PC
if (dusk::getSettings().game.enableMirrorMode) {
stick_x = -stick_x;
}
#endif
i_this->rod_stick_x = stick_x * stick_x;
if (stick_x < 0.0f) {
i_this->rod_stick_x *= -1.0f; i_this->rod_stick_x *= -1.0f;
} }
@@ -3671,7 +3680,13 @@ static void uki_standby(dmg_rod_class* i_this) {
cLib_addCalc2(&i_this->field_0x150c, substickX, 0.5f, 0.2f); cLib_addCalc2(&i_this->field_0x150c, substickX, 0.5f, 0.2f);
if (i_this->field_0x1508 > 0.3f && i_this->play_cam_mode < 5) { if (i_this->field_0x1508 > 0.3f && i_this->play_cam_mode < 5) {
ANGLE_ADD(i_this->field_0x1418, (-500.0f + VREG_F(3)) * mDoCPd_c::getStickX3D(PAD_1)); f32 stick_x = mDoCPd_c::getStickX3D(PAD_1);
#if TARGET_PC
if (dusk::getSettings().game.enableMirrorMode) {
stick_x = -stick_x;
}
#endif
ANGLE_ADD(i_this->field_0x1418, (-500.0f + VREG_F(3)) * stick_x);
} }
cMtx_YrotS(*calc_mtx, i_this->field_0x1418); cMtx_YrotS(*calc_mtx, i_this->field_0x1418);
@@ -5043,8 +5058,15 @@ static void play_camera(dmg_rod_class* i_this) {
static f32 old_stick_x = 0.0f; static f32 old_stick_x = 0.0f;
static f32 old_stick_sx = 0.0f; static f32 old_stick_sx = 0.0f;
f32 stick_x = mDoCPd_c::getStickX3D(PAD_1);
#if TARGET_PC
if (dusk::getSettings().game.enableMirrorMode) {
stick_x = -stick_x;
}
#endif
if ( if (
(mDoCPd_c::getStickX3D(PAD_1) >= 0.8f && old_stick_x < 0.8f) || (mDoCPd_c::getStickX3D(PAD_1) <= -0.8f && old_stick_x > -0.8f) (stick_x >= 0.8f && old_stick_x < 0.8f) || (stick_x <= -0.8f && old_stick_x > -0.8f)
#if VERSION != VERSION_SHIELD_DEBUG #if VERSION != VERSION_SHIELD_DEBUG
|| (mDoCPd_c::getSubStickX3D(PAD_1) >= 0.8f && old_stick_sx < 0.8f) || (mDoCPd_c::getSubStickX3D(PAD_1) <= -0.8f && old_stick_sx > -0.8f) || (mDoCPd_c::getSubStickX3D(PAD_1) >= 0.8f && old_stick_sx < 0.8f) || (mDoCPd_c::getSubStickX3D(PAD_1) <= -0.8f && old_stick_sx > -0.8f)
#endif #endif
@@ -5060,7 +5082,7 @@ static void play_camera(dmg_rod_class* i_this) {
} }
if (i_this->play_cam_timer >= 15) { if (i_this->play_cam_timer >= 15) {
if (mDoCPd_c::getStickX3D(PAD_1) >= 0.5f if (stick_x >= 0.5f
#if VERSION != VERSION_SHIELD_DEBUG #if VERSION != VERSION_SHIELD_DEBUG
|| mDoCPd_c::getSubStickX3D(PAD_1) >= 0.5f || mDoCPd_c::getSubStickX3D(PAD_1) >= 0.5f
#endif #endif
@@ -5082,8 +5104,8 @@ static void play_camera(dmg_rod_class* i_this) {
} }
} }
old_stick_x = mDoCPd_c::getStickX3D(PAD_1); old_stick_x = stick_x;
old_stick_sx = mDoCPd_c::getSubStickX(PAD_1); old_stick_sx = mDoCPd_c::getSubStickX3D(PAD_1);
if (i_this->play_cam_timer == 1) { if (i_this->play_cam_timer == 1) {
if (i_this->field_0xf81 == 0) { if (i_this->field_0xf81 == 0) {
@@ -5788,7 +5810,14 @@ static int dmg_rod_Execute(dmg_rod_class* i_this) {
i_this->rod_stick_x = mDoCPd_c::getStickX3D(PAD_1); i_this->rod_stick_x = mDoCPd_c::getStickX3D(PAD_1);
i_this->rod_stick_y = mDoCPd_c::getStickY(PAD_1); i_this->rod_stick_y = mDoCPd_c::getStickY(PAD_1);
#if TARGET_PC
if (dusk::getSettings().game.enableMirrorMode) {
i_this->rod_stick_x = -i_this->rod_stick_x;
}
i_this->rod_substick_x = mDoCPd_c::getSubStickX3D(PAD_1);
#else
i_this->rod_substick_x = mDoCPd_c::getSubStickX(PAD_1); i_this->rod_substick_x = mDoCPd_c::getSubStickX(PAD_1);
#endif
i_this->prev_rod_substick_y = i_this->rod_substick_y; i_this->prev_rod_substick_y = i_this->rod_substick_y;
i_this->rod_substick_y = mDoCPd_c::getSubStickY(PAD_1); i_this->rod_substick_y = mDoCPd_c::getSubStickY(PAD_1);
+22 -10
View File
@@ -26,15 +26,16 @@
#include "f_op/f_op_overlap_mng.h" #include "f_op/f_op_overlap_mng.h"
#include "JSystem/JAudio2/JASCriticalSection.h"
#if TARGET_PC
#include "dusk/gx_helper.h" #include "dusk/gx_helper.h"
#include "dusk/os.h" #include "dusk/os.h"
#include "dusk/layout.hpp" #include "dusk/layout.hpp"
#include "JSystem/JAudio2/JASCriticalSection.h"
#if MOVIE_SUPPORT #if MOVIE_SUPPORT
#include "turbojpeg.h" #include "turbojpeg.h"
#endif #endif
#endif
inline s32 daMP_NEXT_READ_SIZE(daMP_THPReadBuffer* readBuf) { inline s32 daMP_NEXT_READ_SIZE(daMP_THPReadBuffer* readBuf) {
return *(BE(s32)*)readBuf->ptr; return *(BE(s32)*)readBuf->ptr;
@@ -3912,13 +3913,20 @@ static BOOL daMP_ProperTimingForGettingNextFrame() {
return TRUE; return TRUE;
} }
} else { } else {
s32 frameRate = daMP_ActivePlayer.header.frameRate * 100.0f;
#if TARGET_PC #if TARGET_PC
// DUSK HACK: We only fire retrace callbacks *half* as often as the game expects, const f32 fps = daMP_ActivePlayer.header.frameRate;
// because we only run them once per frame, and normally there should be two scans if (fps > 0.0f) {
// per game frame. const f32 elapsed = std::chrono::duration<f32>(
frameRate *= 2; std::chrono::steady_clock::now() - daMP_ActivePlayer.thpPlaybackClock).count();
#endif const s32 desired = static_cast<s32>(elapsed * fps);
if (desired != daMP_ActivePlayer.prevCount) {
daMP_ActivePlayer.prevCount = desired;
daMP_ActivePlayer.curCount = desired;
return TRUE;
}
}
#else
s32 frameRate = daMP_ActivePlayer.header.frameRate * 100.0f;
if (VIGetTvFormat() == VI_PAL) { if (VIGetTvFormat() == VI_PAL) {
daMP_ActivePlayer.curCount = daMP_ActivePlayer.retaceCount * frameRate / 5000; daMP_ActivePlayer.curCount = daMP_ActivePlayer.retaceCount * frameRate / 5000;
} else { } else {
@@ -3929,6 +3937,7 @@ static BOOL daMP_ProperTimingForGettingNextFrame() {
daMP_ActivePlayer.prevCount = daMP_ActivePlayer.curCount; daMP_ActivePlayer.prevCount = daMP_ActivePlayer.curCount;
return TRUE; return TRUE;
} }
#endif
} }
return FALSE; return FALSE;
@@ -4133,6 +4142,9 @@ static BOOL daMP_THPPlayerPlay() {
daMP_ActivePlayer.prevCount = 0; daMP_ActivePlayer.prevCount = 0;
daMP_ActivePlayer.curCount = 0; daMP_ActivePlayer.curCount = 0;
daMP_ActivePlayer.retaceCount = -1; daMP_ActivePlayer.retaceCount = -1;
#if TARGET_PC
daMP_ActivePlayer.thpPlaybackClock = std::chrono::steady_clock::now();
#endif
return TRUE; return TRUE;
} }
@@ -4482,7 +4494,7 @@ int daMP_c::daMP_c_Init() {
JUT_ASSERT(9507, 0 <= movieNo && movieNo <= 99); JUT_ASSERT(9507, 0 <= movieNo && movieNo <= 99);
char path[32]; char path[32];
sprintf(path, "/Movie/demo_movie%02d_%02d.thp", demoNo, movieNo); SAFE_SPRINTF(path, "/Movie/demo_movie%02d_%02d.thp", demoNo, movieNo);
if (!daMP_ActivePlayer_Init(path)) { if (!daMP_ActivePlayer_Init(path)) {
daMP_Fail_alloc = TRUE; daMP_Fail_alloc = TRUE;
+5
View File
@@ -943,6 +943,11 @@ static int ni_play(ni_class* i_this) {
s16 var_r28 = 0x4000; s16 var_r28 = 0x4000;
i_this->mPadMainStickX = mDoCPd_c::getStickX3D(PAD_1); i_this->mPadMainStickX = mDoCPd_c::getStickX3D(PAD_1);
#if TARGET_PC
if (dusk::getSettings().game.enableMirrorMode) {
i_this->mPadMainStickX = -i_this->mPadMainStickX;
}
#endif
i_this->mPadMainStickY = mDoCPd_c::getStickY(PAD_1); i_this->mPadMainStickY = mDoCPd_c::getStickY(PAD_1);
i_this->mPadSubStickY = mDoCPd_c::getSubStickY(PAD_1); i_this->mPadSubStickY = mDoCPd_c::getSubStickY(PAD_1);
i_this->mPadSubStickX = mDoCPd_c::getSubStickX(PAD_1); i_this->mPadSubStickX = mDoCPd_c::getSubStickX(PAD_1);
+4 -2
View File
@@ -15,6 +15,8 @@
#include "Z2AudioLib/Z2Instances.h" #include "Z2AudioLib/Z2Instances.h"
#include <cstring> #include <cstring>
#include "dusk/string.hpp"
static int l_bmdData[4][2] = { static int l_bmdData[4][2] = {
{14, 1}, {26, 2}, {14, 1}, {26, 2},
{25, 2}, {3, 4}, {25, 2}, {3, 4},
@@ -1336,8 +1338,8 @@ int daNpc_Hanjo_c::cutAppearHawker(int param_1) {
home.angle.y += 0x8000; home.angle.y += 0x8000;
setAngle(home.angle.y); setAngle(home.angle.y);
initTalk(0xcf, NULL); initTalk(0xcf, NULL);
strcpy(acStack_98, l_evtList[9].eventName); SAFE_STRCPY(acStack_98, l_evtList[9].eventName);
strcat(acStack_98, "@"); SAFE_STRCAT(acStack_98, "@");
dComIfGp_getEvent()->setSkipZev(this, acStack_98); dComIfGp_getEvent()->setSkipZev(this, acStack_98);
dComIfGp_getEvent()->onSkipFade(); dComIfGp_getEvent()->onSkipFade();
dComIfGp_getVibration().StartShock( 9, 15, cXyz(0.0f, 1.0f, 0.0f)); dComIfGp_getVibration().StartShock( 9, 15, cXyz(0.0f, 1.0f, 0.0f));
+4 -2
View File
@@ -11,6 +11,8 @@
#include "d/actor/d_a_e_ym.h" #include "d/actor/d_a_e_ym.h"
#include <cstring> #include <cstring>
#include "dusk/string.hpp"
enum saru_TW_RES_File_ID { enum saru_TW_RES_File_ID {
/* BMDR */ /* BMDR */
/* 0x4 */ BMDR_SARU_BARA_TW = 0x4, /* 0x4 */ BMDR_SARU_BARA_TW = 0x4,
@@ -956,8 +958,8 @@ int daNpc_Saru_c::cutYmLook(int param_1) {
if (dComIfGp_getEventManager().getIsAddvance(param_1) != 0) { if (dComIfGp_getEventManager().getIsAddvance(param_1) != 0) {
switch (iVar1) { switch (iVar1) {
case 0: case 0:
strcpy(acStack_88, l_evtList[2].eventName); SAFE_STRCPY(acStack_88, l_evtList[2].eventName);
strcat(acStack_88, "@"); SAFE_STRCAT(acStack_88, "@");
dComIfGp_getEvent()->setSkipZev(this, acStack_88); dComIfGp_getEvent()->setSkipZev(this, acStack_88);
dComIfGp_getEvent()->onSkipFade(); dComIfGp_getEvent()->onSkipFade();
field_0xfd9 = 1; field_0xfd9 = 1;
+4 -2
View File
@@ -8,6 +8,8 @@
#include "d/actor/d_a_npc_shop0.h" #include "d/actor/d_a_npc_shop0.h"
#include <cstring> #include <cstring>
#include "dusk/string.hpp"
static int createHeapCallBack(fopAc_ac_c* i_this) { static int createHeapCallBack(fopAc_ac_c* i_this) {
return static_cast<daNpc_Shop0_c*>(i_this)->createHeap(); return static_cast<daNpc_Shop0_c*>(i_this)->createHeap();
} }
@@ -184,8 +186,8 @@ int daNpc_Shop0_c::init() {
static char l_fileName[21]; static char l_fileName[21];
J3DAnmTransform* daNpc_Shop0_c::getTrnsfrmAnmP(int i_fileIndex, char** i_fileName) { J3DAnmTransform* daNpc_Shop0_c::getTrnsfrmAnmP(int i_fileIndex, char** i_fileName) {
strcpy(l_fileName, i_fileName[i_fileIndex]); SAFE_STRCPY(l_fileName, i_fileName[i_fileIndex]);
strcat(l_fileName, ".bck"); SAFE_STRCAT(l_fileName, ".bck");
return (J3DAnmTransform*) dComIfG_getObjectRes(getResName(), l_fileName); return (J3DAnmTransform*) dComIfG_getObjectRes(getResName(), l_fileName);
} }
+4 -2
View File
@@ -9,6 +9,8 @@
#include "d/actor/d_a_demo_item.h" #include "d/actor/d_a_demo_item.h"
#include <cstring> #include <cstring>
#include "dusk/string.hpp"
static daNpc_GetParam1 l_bmdData[3] = { static daNpc_GetParam1 l_bmdData[3] = {
{3, 1}, {3, 1},
{3, 4}, {3, 4},
@@ -1137,8 +1139,8 @@ BOOL daNpc_Yelia_c::cutTakeWoodStatue(int i_staffId) {
mItemId = fpcM_ERROR_PROCESS_ID_e; mItemId = fpcM_ERROR_PROCESS_ID_e;
mEventTimer = timer; mEventTimer = timer;
Z2GetAudioMgr()->muteSceneBgm(90, 0.0f); Z2GetAudioMgr()->muteSceneBgm(90, 0.0f);
strcpy(name, l_evtList[EVENT_TAKE_WOODSTATUE].eventName); SAFE_STRCPY(name, l_evtList[EVENT_TAKE_WOODSTATUE].eventName);
strcat(name, "@"); SAFE_STRCAT(name, "@");
dComIfGp_getEvent()->setSkipZev(this, name); dComIfGp_getEvent()->setSkipZev(this, name);
dComIfGp_getEvent()->onSkipFade(); dComIfGp_getEvent()->onSkipFade();
break; break;
+5 -3
View File
@@ -20,6 +20,8 @@
#include "m_Do/m_Do_ext.h" #include "m_Do/m_Do_ext.h"
#include <cstring> #include <cstring>
#include "dusk/string.hpp"
#if DEBUG #if DEBUG
class daNpc_ykW_HIO_c : public mDoHIO_entry_c { class daNpc_ykW_HIO_c : public mDoHIO_entry_c {
public: public:
@@ -1411,11 +1413,11 @@ int daNpc_ykW_c::cutGoIntoBossRoom(int param_0) {
if (skip != 0 && (prm == 0 || prm == 4)) { if (skip != 0 && (prm == 0 || prm == 4)) {
if (prm == 0) { if (prm == 0) {
strcpy(unkStrBuf1, l_evtList[4].eventName); SAFE_STRCPY(unkStrBuf1, l_evtList[4].eventName);
} else { } else {
strcpy(unkStrBuf1, l_evtList[5].eventName); SAFE_STRCPY(unkStrBuf1, l_evtList[5].eventName);
} }
strcat(unkStrBuf1, "@"); SAFE_STRCAT(unkStrBuf1, "@");
dComIfGp_getEvent()->setSkipZev(this, unkStrBuf1); dComIfGp_getEvent()->setSkipZev(this, unkStrBuf1);
} }
} }
+1 -1
View File
@@ -192,7 +192,7 @@ inline int daObjFlag_c::createHeap() {
tmp = true; tmp = true;
char resName[12]; char resName[12];
sprintf(resName, "flag%02d.bmd", angle); SAFE_SPRINTF(resName, "flag%02d.bmd", angle);
shape_angle.setall(0); shape_angle.setall(0);
current.angle.setall(0); current.angle.setall(0);
+2 -2
View File
@@ -370,7 +370,7 @@ int daObjFlag2_c::createHeap() {
s8 flagNum = (u8)shape_angle.x; s8 flagNum = (u8)shape_angle.x;
if (mFlagValid) { if (mFlagValid) {
char acStack_40[16]; char acStack_40[16];
sprintf(acStack_40, "flag%02d.bti", flagNum); SAFE_SPRINTF(acStack_40, "flag%02d.bti", flagNum);
shape_angle.setall(0); shape_angle.setall(0);
current.angle.setall(0); current.angle.setall(0);
ResTIMG* image = (ResTIMG*)dComIfG_getObjectRes(mFlagName, "flag.bti"); ResTIMG* image = (ResTIMG*)dComIfG_getObjectRes(mFlagName, "flag.bti");
@@ -409,7 +409,7 @@ int daObjFlag2_c::create() {
mFlagValid = false; mFlagValid = false;
} else { } else {
mFlagValid = true; mFlagValid = true;
sprintf(mFlagName, "FlagObj%02d", flagNum); SAFE_SPRINTF(mFlagName, "FlagObj%02d", flagNum);
int rv = dComIfG_resLoad(&mFlagPhase, mFlagName); int rv = dComIfG_resLoad(&mFlagPhase, mFlagName);
if (rv != cPhs_COMPLEATE_e) { if (rv != cPhs_COMPLEATE_e) {
return rv; return rv;
+2 -2
View File
@@ -299,7 +299,7 @@ int daObjFlag3_c::createHeap() {
s8 flagNum = (u8)shape_angle.x; s8 flagNum = (u8)shape_angle.x;
if (mFlagValid) { if (mFlagValid) {
char acStack_40[16]; char acStack_40[16];
sprintf(acStack_40, "flag%02d.bti", flagNum); SAFE_SPRINTF(acStack_40, "flag%02d.bti", flagNum);
shape_angle.setall(0); shape_angle.setall(0);
current.angle.setall(0); current.angle.setall(0);
ResTIMG* image = (ResTIMG*)dComIfG_getObjectRes(mFlagName, "flag.bti"); ResTIMG* image = (ResTIMG*)dComIfG_getObjectRes(mFlagName, "flag.bti");
@@ -486,7 +486,7 @@ int daObjFlag3_c::create() {
mFlagValid = false; mFlagValid = false;
} else { } else {
mFlagValid = true; mFlagValid = true;
sprintf(mFlagName, "FlagObj%02d", flagNum); SAFE_SPRINTF(mFlagName, "FlagObj%02d", flagNum);
int rv = dComIfG_resLoad(&mFlagPhase, mFlagName); int rv = dComIfG_resLoad(&mFlagPhase, mFlagName);
if (rv != cPhs_COMPLEATE_e) { if (rv != cPhs_COMPLEATE_e) {
return rv; return rv;
+4 -3
View File
@@ -5,13 +5,14 @@
#include "d/dolzel_rel.h" // IWYU pragma: keep #include "d/dolzel_rel.h" // IWYU pragma: keep
#include "d/actor/d_a_obj_gra2.h"
#include "d/actor/d_a_npc4.h" #include "d/actor/d_a_npc4.h"
#include "d/actor/d_a_obj_gra2.h"
#include "d/actor/d_a_tag_gra.h" #include "d/actor/d_a_tag_gra.h"
#include "d/d_bg_w.h" #include "d/d_bg_w.h"
#include "d/d_cc_uty.h" #include "d/d_cc_uty.h"
#include "d/d_com_inf_game.h"
#include "d/d_com_inf_actor.h" #include "d/d_com_inf_actor.h"
#include "d/d_com_inf_game.h"
#include "dusk/string.hpp"
#if DEBUG #if DEBUG
#include "d/d_debug_viewer.h" #include "d/d_debug_viewer.h"
#endif #endif
@@ -539,7 +540,7 @@ const char* daObj_GrA_c::getResName() {
u8 daObj_GrA_c::getMode() { u8 daObj_GrA_c::getMode() {
u32 uVar1 = fopAcM_GetParam(this) >> 28 & 3; u32 uVar1 = fopAcM_GetParam(this) >> 28 & 3;
strcpy(field_0x744, "Obj_grA"); SAFE_STRCPY(field_0x744, "Obj_grA");
switch (uVar1) { switch (uVar1) {
case 1: case 1:
+5
View File
@@ -268,6 +268,11 @@ int daItem_c::_daItem_create() {
} }
m_itemNo = daItem_prm::getItemNo(this); m_itemNo = daItem_prm::getItemNo(this);
#if TARGET_PC
if (dusk::getSettings().game.noHeartDrops && isHeart(m_itemNo)) {
return cPhs_ERROR_e;
}
#endif
BOOL flag = dItem_data::chkFlag(m_itemNo, 2); BOOL flag = dItem_data::chkFlag(m_itemNo, 2);
#if DEBUG #if DEBUG
+8 -6
View File
@@ -8,6 +8,8 @@
#include "d/actor/d_a_tag_kmsg.h" #include "d/actor/d_a_tag_kmsg.h"
#include <types.h> #include <types.h>
#include <cstring> #include <cstring>
#include "dusk/string.hpp"
#include "f_op/f_op_actor_mng.h" #include "f_op/f_op_actor_mng.h"
#include "f_op/f_op_msg.h" #include "f_op/f_op_msg.h"
@@ -1364,8 +1366,8 @@ int daObj_Sekizoa_c::cutStart(int i_staffIdx) {
daObj_SMTile_c* actor_4 = (daObj_SMTile_c*)mActorMngrs[4].getActorP(); daObj_SMTile_c* actor_4 = (daObj_SMTile_c*)mActorMngrs[4].getActorP();
actor_4->reset(); actor_4->reset();
dComIfGp_getEvent()->setPt2(actor_4); dComIfGp_getEvent()->setPt2(actor_4);
strcpy(acStack_90, l_evtList[2].eventName); SAFE_STRCPY(acStack_90, l_evtList[2].eventName);
strcat(acStack_90, "@"); SAFE_STRCAT(acStack_90, "@");
dComIfGp_getEvent()->setSkipZev(this, acStack_90); dComIfGp_getEvent()->setSkipZev(this, acStack_90);
dComIfGp_getEvent()->onSkipFade(); dComIfGp_getEvent()->onSkipFade();
if (daNpcT_getPlayerInfoFromPlayerList(1, fopAcM_GetRoomNo(this), &c_stack_9c, if (daNpcT_getPlayerInfoFromPlayerList(1, fopAcM_GetRoomNo(this), &c_stack_9c,
@@ -1856,8 +1858,8 @@ int daObj_Sekizoa_c::cutGoal(int i_staffIdx) {
switch (prm) { switch (prm) {
case 0: case 0:
if (mType == TYPE_0) { if (mType == TYPE_0) {
strcpy(acStack_9c, l_evtList[6].eventName); SAFE_STRCPY(acStack_9c, l_evtList[6].eventName);
strcat(acStack_9c, "@"); SAFE_STRCAT(acStack_9c, "@");
dComIfGp_getEvent()->setSkipZev(this, acStack_9c); dComIfGp_getEvent()->setSkipZev(this, acStack_9c);
dComIfGp_getEvent()->onSkipFade(); dComIfGp_getEvent()->onSkipFade();
} }
@@ -2222,8 +2224,8 @@ int daObj_Sekizoa_c::cutExtinction(int i_staffIdx) {
cStack_b0 += actor_0->current.pos; cStack_b0 += actor_0->current.pos;
daPy_getPlayerActorClass()->setPlayerPosAndAngle(&cStack_b0, daPy_getPlayerActorClass()->setPlayerPosAndAngle(&cStack_b0,
actor_0->shape_angle.y - -0x8000, 0); actor_0->shape_angle.y - -0x8000, 0);
strcpy(acStack_a4, l_evtList[9].eventName); SAFE_STRCPY(acStack_a4, l_evtList[9].eventName);
strcat(acStack_a4, "@"); SAFE_STRCAT(acStack_a4, "@");
dComIfGp_getEvent()->setSkipZev(actor_0, acStack_a4); dComIfGp_getEvent()->setSkipZev(actor_0, acStack_a4);
dComIfGp_getEvent()->onSkipFade(); dComIfGp_getEvent()->onSkipFade();
actor_0->pullMasterSword(); actor_0->pullMasterSword();
+1 -1
View File
@@ -26,7 +26,7 @@ int daSetBgObj_c::CreateInit() {
int daSetBgObj_c::create() { int daSetBgObj_c::create() {
fopAcM_ct(this, daSetBgObj_c); fopAcM_ct(this, daSetBgObj_c);
sprintf(mArcName, "%s", getArcName(this)); SAFE_SPRINTF(mArcName, "%s", getArcName(this));
int phase = dComIfG_resLoad(&mPhase, mArcName); int phase = dComIfG_resLoad(&mPhase, mArcName);
if (phase == cPhs_COMPLEATE_e) { if (phase == cPhs_COMPLEATE_e) {
+3 -1
View File
@@ -8,6 +8,8 @@
#include "f_op/f_op_actor_mng.h" #include "f_op/f_op_actor_mng.h"
#include <cstring> #include <cstring>
#include "dusk/string.hpp"
static char* l_evtNameList[] = { static char* l_evtNameList[] = {
NULL, NULL,
"JUMP_DEMOSTAGE", "JUMP_DEMOSTAGE",
@@ -26,7 +28,7 @@ int daTag_Evt_c::create() {
cPhs_Step phase = dComIfG_resLoad(&mPhase, l_resFileName); cPhs_Step phase = dComIfG_resLoad(&mPhase, l_resFileName);
if (phase == cPhs_COMPLEATE_e) { if (phase == cPhs_COMPLEATE_e) {
eventInfo.setArchiveName(l_resFileName); eventInfo.setArchiveName(l_resFileName);
strcpy(field_0x568, "TagEvt"); SAFE_STRCPY(field_0x568, "TagEvt");
getParam(); getParam();
field_0x572 = -1; field_0x572 = -1;
} }
+3 -1
View File
@@ -11,6 +11,8 @@
#include "d/d_debug_viewer.h" #include "d/d_debug_viewer.h"
#include <cstring> #include <cstring>
#include "dusk/string.hpp"
static int createHeapCallBack(fopAc_ac_c* i_this) { static int createHeapCallBack(fopAc_ac_c* i_this) {
daTag_Msg_c* msg = (daTag_Msg_c*)i_this; daTag_Msg_c* msg = (daTag_Msg_c*)i_this;
return msg->createHeap(); return msg->createHeap();
@@ -219,7 +221,7 @@ void daTag_Msg_c::getParam() {
scale.x *= 100.0f; scale.x *= 100.0f;
scale.y *= 100.0f; scale.y *= 100.0f;
strcpy(mStaffName, "Tag_ms"); SAFE_STRCPY(mStaffName, "Tag_ms");
} }
char* daTag_Msg_c::mEvtCutTBL[2] = { char* daTag_Msg_c::mEvtCutTBL[2] = {
+1 -1
View File
@@ -250,7 +250,7 @@ void daTitle_c::loadWait_proc() {
text[i]->setFont(mpFont); text[i]->setFont(mpFont);
text[i]->setString(0x80, ""); text[i]->setString(0x80, "");
char* msg = text[i]->getStringPtr(); TEXT_SPAN msg = text[i]->getStringPtr();
fopMsgM_messageGet(msg, 100); fopMsgM_messageGet(msg, 100);
} }
+6 -4
View File
@@ -8,6 +8,8 @@
#include "JSystem/JKernel/JKRSolidHeap.h" #include "JSystem/JKernel/JKRSolidHeap.h"
#include <cstring> #include <cstring>
#include "dusk/string.hpp"
void dBgp_c::material_c::draw() { void dBgp_c::material_c::draw() {
material_c* material = this; material_c* material = this;
do { do {
@@ -255,7 +257,7 @@ void dBgp_c::share_c::reset() {
const char* dBgp_c::share_c::getArcName() { const char* dBgp_c::share_c::getArcName() {
static char arcName[8]; static char arcName[8];
sprintf(arcName, "@mt%04x", mId); SAFE_SPRINTF(arcName, "@mt%04x", mId);
return arcName; return arcName;
} }
@@ -430,7 +432,7 @@ dBgp_c::packet_c::packet_c() {
void dBgp_c::create(s8 i_roomNo, void* i_data) { void dBgp_c::create(s8 i_roomNo, void* i_data) {
mPointer = i_data; mPointer = i_data;
mPacket.setRoomNo(i_roomNo); mPacket.setRoomNo(i_roomNo);
strcpy(mArcName, dComIfG_getRoomArcName(i_roomNo)); SAFE_STRCPY(mArcName, dComIfG_getRoomArcName(i_roomNo));
if (mPointer != NULL) { if (mPointer != NULL) {
JKRExpHeap* block = dStage_roomControl_c::getMemoryBlock(i_roomNo); JKRExpHeap* block = dStage_roomControl_c::getMemoryBlock(i_roomNo);
@@ -457,7 +459,7 @@ void dBgp_c::create(s8 i_roomNo, void* i_data) {
unit_group_class* unitGroup = mapUnit->groups; unit_group_class* unitGroup = mapUnit->groups;
for (int i = 0; i < mapUnit->num; i++) { for (int i = 0; i < mapUnit->num; i++) {
char resName[16]; char resName[16];
sprintf(resName, "bp%04d.dzb", i); SAFE_SPRINTF(resName, "bp%04d.dzb", i);
cBgD_t* dzb = (cBgD_t*)dComIfG_getStageRes(mArcName, resName); cBgD_t* dzb = (cBgD_t*)dComIfG_getStageRes(mArcName, resName);
if (dzb != NULL) { if (dzb != NULL) {
@@ -534,7 +536,7 @@ int dBgp_c::remove() {
const char* dBgp_c::getArcName(u16 i_id, u16 i_arg) { const char* dBgp_c::getArcName(u16 i_id, u16 i_arg) {
static char arcName[8]; static char arcName[8];
sprintf(arcName, "@%03x%03x", i_id, i_arg); SAFE_SPRINTF(arcName, "@%03x%03x", i_id, i_arg);
return arcName; return arcName;
} }
+5
View File
@@ -16,6 +16,7 @@
#if TARGET_PC #if TARGET_PC
#include "dusk/achievements.h" #include "dusk/achievements.h"
#include "dusk/settings.h" #include "dusk/settings.h"
#include "d/actor/d_a_alink.h"
#endif #endif
static int plCutLRC[58] = { static int plCutLRC[58] = {
@@ -448,6 +449,10 @@ fopAc_ac_c* cc_at_check(fopAc_ac_c* i_enemy, dCcU_AtInfo* i_AtInfo) {
#if TARGET_PC #if TARGET_PC
if (fopAcM_GetGroup(i_enemy) == fopAc_ENEMY_e) { if (fopAcM_GetGroup(i_enemy) == fopAc_ENEMY_e) {
dusk::AchievementSystem::get().signal("enemy_killed"); dusk::AchievementSystem::get().signal("enemy_killed");
const auto* link = static_cast<const daAlink_c*>(daPy_getPlayerActorClass());
if (link != nullptr && link->mProcID == daAlink_c::PROC_CUT_FINISH && link->mIsRollstab) {
dusk::AchievementSystem::get().signal("rollstab_kill");
}
} }
#endif #endif
} }
+4 -2
View File
@@ -26,6 +26,8 @@
#include <cstdio> #include <cstdio>
#include <cstring> #include <cstring>
#include "dusk/string.hpp"
void dComIfG_play_c::ct() { void dComIfG_play_c::ct() {
mWindowNum = 0; mWindowNum = 0;
mParticle = NULL; mParticle = NULL;
@@ -2649,7 +2651,7 @@ static void dComIfGs_setWarpItemData(int param_0, char const* i_stage, cXyz i_po
void dComIfG_play_c::setWarpItemData(char const* i_stage, cXyz i_pos, s16 i_angle, s8 i_roomNo, void dComIfG_play_c::setWarpItemData(char const* i_stage, cXyz i_pos, s16 i_angle, s8 i_roomNo,
u8 param_4, u8 param_5) { u8 param_4, u8 param_5) {
strcpy(mItemInfo.mWarpItemData.mWarpItemStage, i_stage); SAFE_STRCPY(mItemInfo.mWarpItemData.mWarpItemStage, i_stage);
mItemInfo.mWarpItemData.mWarpItemPos.set(i_pos); mItemInfo.mWarpItemData.mWarpItemPos.set(i_pos);
mItemInfo.mWarpItemData.mWarpItemAngle = i_angle; mItemInfo.mWarpItemData.mWarpItemAngle = i_angle;
mItemInfo.mWarpItemData.mWarpItemRoom = i_roomNo; mItemInfo.mWarpItemData.mWarpItemRoom = i_roomNo;
@@ -2736,7 +2738,7 @@ void* dComIfG_getOldStageRes(char const* i_resName) {
char* dComIfG_getRoomArcName(int i_roomNo) { char* dComIfG_getRoomArcName(int i_roomNo) {
static char buf[32]; static char buf[32];
sprintf(buf, "R%02d_00", i_roomNo); SAFE_SPRINTF(buf, "R%02d_00", i_roomNo);
return buf; return buf;
} }

Some files were not shown because too many files have changed in this diff Show More