mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-08-28 07:38:29 -04:00
Compare commits
509 Commits
tphd
..
randomizer
| Author | SHA1 | Date | |
|---|---|---|---|
| 07a4d1ec6c | |||
| 56bede561c | |||
| e5b9af9c53 | |||
| 320acda383 | |||
| 3ccfe81914 | |||
| 8220f2b8e9 | |||
| ce2d37df68 | |||
| 687307b4c1 | |||
| 4b0a58b8f2 | |||
| f16290d1e0 | |||
| e9a84c2fb5 | |||
| c1d34d7b68 | |||
| d12cf18ce1 | |||
| 1643474573 | |||
| 3d06c6607c | |||
| 1d275f4ead | |||
| 957dbe976e | |||
| ba994a4e65 | |||
| 21e75bac1c | |||
| 9b087aadda | |||
| 1aa81ff907 | |||
| 21a7823045 | |||
| a245876f7f | |||
| 1c59d124dc | |||
| 7766739df1 | |||
| 0b23015ddb | |||
| 9537df2ee7 | |||
| 9e6dd59e49 | |||
| fa34335a09 | |||
| a4c619ad58 | |||
| cf0c1c3160 | |||
| 6be65a461d | |||
| bb1c1447d0 | |||
| dce6b4c666 | |||
| 9756612b35 | |||
| 49f27acb2b | |||
| d1ea637d22 | |||
| 591c38e871 | |||
| a5bc71795e | |||
| 26d0725c76 | |||
| 1b3b493fbf | |||
| f62a70f9d0 | |||
| ec2173db9f | |||
| 563944d4a3 | |||
| b8f69e82dd | |||
| 830b560933 | |||
| 6592871fa2 | |||
| e57c952deb | |||
| 4239cea3d5 | |||
| 9bd34a0d02 | |||
| cce67c1809 | |||
| 6bf0dfd92a | |||
| 4d8fcfa551 | |||
| a3de85fb4b | |||
| 08e0645ef8 | |||
| f20cf3c24e | |||
| b2dfdf4158 | |||
| 99689258a2 | |||
| 08345d01ed | |||
| 56d47d475f | |||
| 8a92efbe0d | |||
| 1790ad6faf | |||
| e39c139b97 | |||
| 54b3545736 | |||
| 2428ca2efe | |||
| 05d9cf0402 | |||
| 2651640ee0 | |||
| f8c5a8988b | |||
| 544964c1a5 | |||
| 7bd3e9cafd | |||
| 8999c4c9c5 | |||
| 917def4732 | |||
| 0516282bb6 | |||
| d855efe513 | |||
| 28733f5c15 | |||
| b2ac2d6600 | |||
| 68bebfad3a | |||
| a0f5b250b4 | |||
| cb70f2c3b3 | |||
| 5851954ca1 | |||
| c65f0bb0ac | |||
| 038254db48 | |||
| c1997b3d68 | |||
| 474a7dce00 | |||
| 382f33d021 | |||
| b743a762b4 | |||
| 302abd6b65 | |||
| 3f6ae4324b | |||
| dccded964b | |||
| ea09dd73c6 | |||
| c426b52a15 | |||
| 41e0a81c39 | |||
| 5b6f2f6e91 | |||
| bbea07ba9e | |||
| 0f0dca5514 | |||
| 3fb86dbac8 | |||
| 7e367c1e15 | |||
| 46e81963e2 | |||
| 4f1d4cde3d | |||
| 45c8fa9f19 | |||
| 87635d3cf7 | |||
| e5324c7562 | |||
| 03593def22 | |||
| 2ae5518c81 | |||
| bc45bf27c2 | |||
| 7d2c9776ea | |||
| fbf4fcc50c | |||
| 1868d698f5 | |||
| d858626be1 | |||
| f00ad8e0ea | |||
| 7b521aef02 | |||
| 4721b8da50 | |||
| b06af0e057 | |||
| 518dea482e | |||
| daf2f18369 | |||
| 9307d8abde | |||
| b3dbf2c71b | |||
| 4bb5f320c3 | |||
| f1357f09ed | |||
| e3eb63f158 | |||
| 47c0a399e1 | |||
| dfdd5250bd | |||
| ba7211126c | |||
| ef607434dd | |||
| f12838ea3b | |||
| dc88e11115 | |||
| e671ed748b | |||
| 98633a5cb6 | |||
| 6c1aeb0d0a | |||
| a2d41bcfba | |||
| 96ed5c671b | |||
| de12d277d0 | |||
| 3b8ec9efa6 | |||
| 39b079ddb9 | |||
| e2790d922a | |||
| afed2c1774 | |||
| 46a67c658c | |||
| 351afd6686 | |||
| 485374abba | |||
| 8ecd848307 | |||
| c4a13c8c10 | |||
| 313e9be99d | |||
| d79088ba05 | |||
| 3aa7abe73f | |||
| 8e38f27602 | |||
| 7543db2222 | |||
| 32e553e38d | |||
| 089a947c30 | |||
| 83a5ccce92 | |||
| 48de086d65 | |||
| 5a61b912bb | |||
| 4e92b22c5d | |||
| ede9697dae | |||
| 580b772c3c | |||
| 143b548102 | |||
| 15742c71f3 | |||
| 40f753e18b | |||
| 65f4048a41 | |||
| e78a198adf | |||
| 75d86ab296 | |||
| 62e48984bf | |||
| deb213d07a | |||
| 484c5e8bf3 | |||
| bb67fc991d | |||
| 7326a619da | |||
| 4ce5800a33 | |||
| 66a8af31b3 | |||
| 85fe76b5be | |||
| ffa1fd5da4 | |||
| 3d2c5633cd | |||
| 08ce522edb | |||
| ab007b4c44 | |||
| 2cf2442dc8 | |||
| 7354bfc163 | |||
| 7bca56ea80 | |||
| 42eb9ef518 | |||
| be4a1d8838 | |||
| fd523a7e4d | |||
| 650b56beee | |||
| 1e3f097e63 | |||
| 9fd5678ae4 | |||
| dcf6268444 | |||
| 1f4370af85 | |||
| ed458dc2b3 | |||
| 7cebc42266 | |||
| 0d819b215d | |||
| 8113fc3088 | |||
| 78bc0216fb | |||
| b74603c883 | |||
| 9e8b451462 | |||
| d25695be0e | |||
| ba9dc8e9ba | |||
| ddb9816158 | |||
| 33e19f58e0 | |||
| ece92765c9 | |||
| c2dea2ab8f | |||
| e0dea86134 | |||
| 8409c2ab9f | |||
| 3eb4181b9c | |||
| 0d33d44e75 | |||
| 6ea50f33e4 | |||
| 769b8f02c8 | |||
| d77da3fba3 | |||
| ea0c697afa | |||
| 6321bcf0d8 | |||
| 1e7e9b3513 | |||
| 63e7fb4187 | |||
| 453accc674 | |||
| a565601849 | |||
| e92a3b4a90 | |||
| 141ddafdc8 | |||
| 007561874d | |||
| b167124a70 | |||
| 879c68f8a3 | |||
| ccaee02c2e | |||
| ff498af6e8 | |||
| 9c3420bcc7 | |||
| 23a6719e99 | |||
| 95c1a93332 | |||
| 63a91bffde | |||
| d33b3c16e1 | |||
| 33e2ffbb6e | |||
| 491a73f517 | |||
| 54efc49bd8 | |||
| f6eaa64156 | |||
| ed1f21f333 | |||
| 0a0f1e9a04 | |||
| 64720ef0e0 | |||
| b213ae2faa | |||
| d7e0c240d0 | |||
| 56de23e2e6 | |||
| 0862408ee8 | |||
| b2b74e5c4d | |||
| 39da278394 | |||
| ec2f2753a2 | |||
| 89a0702d2b | |||
| 9d94e9684f | |||
| f8d01ae6d2 | |||
| 9f400543c2 | |||
| 3861bf5506 | |||
| 5c745735d7 | |||
| 886fb7f2db | |||
| 01d0d12af0 | |||
| c0f882845d | |||
| 7225fb25dc | |||
| 5ab46c604b | |||
| f3b29d97d0 | |||
| 9447f4e89b | |||
| 7db5386885 | |||
| 9c1617d423 | |||
| 4c4e3e4b10 | |||
| 4db50d2843 | |||
| ba5a59eee2 | |||
| 5e69c7bdce | |||
| 04d9640eff | |||
| 83480110fd | |||
| 5038068905 | |||
| 7388213715 | |||
| 0e1e64fe7d | |||
| f48a3be466 | |||
| 61835c05ba | |||
| 762a597eba | |||
| 69283fc611 | |||
| b0efe464c0 | |||
| a6fda86ebf | |||
| 4b363dab06 | |||
| 77ae5fd0b3 | |||
| 2890a663f3 | |||
| f263a33db2 | |||
| 99ee9c2f48 | |||
| 1cfb22fdd9 | |||
| bf85d511a8 | |||
| dc9dce2cd7 | |||
| 8333ae35a8 | |||
| ced018794f | |||
| bfb715e11a | |||
| 9e9f36e484 | |||
| 38031e2545 | |||
| 2dea7375ef | |||
| 48bfcec0a3 | |||
| 7a4c23fa33 | |||
| 0014be0e82 | |||
| 870bd6476c | |||
| 96d9b5e7b1 | |||
| 09a73d5828 | |||
| e14d1f1f68 | |||
| 9f6c39754b | |||
| eda9991e6a | |||
| 95e699fb63 | |||
| 618d5b5733 | |||
| 2ececa3206 | |||
| 4fddaba76b | |||
| 045df82445 | |||
| b3833be529 | |||
| f45aa6040e | |||
| 25b273a726 | |||
| 3e99420527 | |||
| f6e526b187 | |||
| 23567fba42 | |||
| 255a55d4c8 | |||
| d7ca855d9a | |||
| e8318e2eb3 | |||
| f4992aa378 | |||
| 97388be8e5 | |||
| dbad1a4832 | |||
| 40949474a1 | |||
| 1166b58447 | |||
| 2c7cfa8951 | |||
| 89621dbff5 | |||
| 18f688e4b3 | |||
| 354d9b2fde | |||
| bc7faadc02 | |||
| c265207c92 | |||
| 05678f1ddc | |||
| cf015c4219 | |||
| a11427a48f | |||
| c87d7e3875 | |||
| 75f6337985 | |||
| 71f33021cc | |||
| 5b52f13f4b | |||
| 0a8cbc8f08 | |||
| 28e907aafd | |||
| 7018796b93 | |||
| b28e21fa18 | |||
| afc53ce1b2 | |||
| 4b0564779f | |||
| dc5fd98cfd | |||
| e2c51ec45c | |||
| 38640354b0 | |||
| 0393fdad6d | |||
| 5fc0340603 | |||
| 99652c01ed | |||
| 580d50ab05 | |||
| cfa680f2d8 | |||
| e4e438e1ba | |||
| 4ec1a0e52c | |||
| f251a3497d | |||
| 05734d9e93 | |||
| 30e4291f14 | |||
| 88770b90ab | |||
| 5a22ce6321 | |||
| 62b30d2dad | |||
| 5a5004793a | |||
| d0cb0c001a | |||
| 7a246941f8 | |||
| c3ad0abd37 | |||
| 91d6ec1f26 | |||
| a863ea253e | |||
| f5789aaebd | |||
| 438fd2fe71 | |||
| 040094115b | |||
| d4bc2daa89 | |||
| 622920d8c0 | |||
| 2b9dd50a8d | |||
| ff44cdfd3c | |||
| 3b0cc4c712 | |||
| 71d73a9db4 | |||
| 4ef7511336 | |||
| 9b34fd8f8f | |||
| a5cc64c2fe | |||
| ce88c237a3 | |||
| cee8101b37 | |||
| 409663711b | |||
| decf925e5d | |||
| cbead7bbb0 | |||
| 05e5023354 | |||
| 3126605cd6 | |||
| 0b932c1993 | |||
| 5ed72f4af2 | |||
| 1a3aac4d05 | |||
| 573414dc83 | |||
| 7132655d42 | |||
| 318bf293ca | |||
| 3149f929c1 | |||
| 8acdbf03bf | |||
| 11a632511f | |||
| 33941d8ede | |||
| 01d217acb5 | |||
| 7c331fdb2c | |||
| f7d3cf32fd | |||
| 95ceb1241b | |||
| 5c9ff2f5fa | |||
| 6b5e251037 | |||
| 4905718024 | |||
| 00929789a1 | |||
| 8e3306f87f | |||
| 8ea4b7747d | |||
| 02852eb586 | |||
| 7d9d398844 | |||
| dfe6d10c07 | |||
| 80f4284e82 | |||
| c7c9b664e8 | |||
| e2de904f8a | |||
| 1f593812c8 | |||
| d3d0016d16 | |||
| b7adbde0d5 | |||
| 94bfb8c9e3 | |||
| 8949a3a8ee | |||
| 80b0d11319 | |||
| 49e8058f4e | |||
| fccce91ea5 | |||
| 8b117c8ed3 | |||
| e77fe61596 | |||
| 0da8b4c6dc | |||
| 726999c476 | |||
| f774cc689c | |||
| 498db43c62 | |||
| 89f1c6c71f | |||
| c801cb2a84 | |||
| f069be5789 | |||
| b4722177ca | |||
| a36695a240 | |||
| 148a3d23eb | |||
| e7e5363c0c | |||
| 93cc3bd2ce | |||
| 52a53b64dc | |||
| fa473d48a9 | |||
| 8774cfa31b | |||
| 8270ec3050 | |||
| 6113df21e0 | |||
| dbdb4daa58 | |||
| dd04da230f | |||
| 7606998ba6 | |||
| 0f0c10d26a | |||
| 88dd4a2aae | |||
| cc75af7cce | |||
| 7520998aca | |||
| ab28ae36e3 | |||
| 88826bd5f8 | |||
| 39a9dd4029 | |||
| 23fe55fdca | |||
| a31e388b3a | |||
| 3e241da2a4 | |||
| ce80d83c00 | |||
| f62fb69a4d | |||
| 782bf4e0b3 | |||
| 727066e54e | |||
| f13ecbaec7 | |||
| be390c3645 | |||
| fdfe379824 | |||
| da2cb85aa1 | |||
| 2b4598821b | |||
| 4cd911a114 | |||
| 5484cd69b5 | |||
| 1ff9421cea | |||
| c0e83af35e | |||
| 2c6d0b11dd | |||
| bab1cda97a | |||
| da24b6a1e2 | |||
| 2bb05b0248 | |||
| 96d82c5fc2 | |||
| 5175795814 | |||
| 049758431c | |||
| 762f103991 | |||
| 66aeeb8857 | |||
| d3a9c52ec5 | |||
| dea93938e6 | |||
| 890a42b3ee | |||
| 38f591c521 | |||
| 14ec080a23 | |||
| 48da572df0 | |||
| 0cb77802be | |||
| dacfe11d95 | |||
| cc58b41901 | |||
| 04a2417f02 | |||
| 9e74ffd9be | |||
| dec4045e25 | |||
| 4daf410cce | |||
| cf604b5fb0 | |||
| 8738e5b122 | |||
| 38bea19a7b | |||
| bf70de83f1 | |||
| f478751080 | |||
| a18ce4e6dd | |||
| e77bc5c9e5 | |||
| 7e39274da2 | |||
| 4ad05a3445 | |||
| 4e25db0f20 | |||
| 98b492bd89 | |||
| 461d59984f | |||
| 796a67f207 | |||
| 2d4247f10e | |||
| d4028fefa8 | |||
| 7e5726c255 | |||
| 1873330e61 | |||
| 9c9316466b | |||
| 123c809e14 | |||
| 8172e672de | |||
| 4d1771649a | |||
| c91925f243 | |||
| 87116b871b | |||
| 3547c57de0 | |||
| 2d8a60aa75 | |||
| dd773bc261 | |||
| 535c2f53c1 | |||
| c8cde246a9 | |||
| bc66d96d8b | |||
| 6c55f42ce2 | |||
| 679044f33d | |||
| ac53fdbbff | |||
| 0b78547ba1 | |||
| 0ebab8bad3 | |||
| ab7d3a5e03 | |||
| 2f79bbe067 | |||
| b8b5b7197c | |||
| 554a461c95 | |||
| 1efb6c4a80 | |||
| 377d6a0d25 | |||
| 72bed7a1ba |
@@ -76,7 +76,7 @@ jobs:
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: dusklight-${{env.APP_VERSION}}-linux-${{matrix.preset}}-${{matrix.artifact_arch}}
|
||||
name: dusklight-${{env.DUSK_VERSION}}-linux-${{matrix.preset}}-${{matrix.artifact_arch}}
|
||||
path: |
|
||||
build/install/Dusklight-*.AppImage
|
||||
build/install/debug.tar.*
|
||||
@@ -145,7 +145,7 @@ jobs:
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: dusklight-${{env.APP_VERSION}}-${{matrix.artifact_name}}
|
||||
name: dusklight-${{env.DUSK_VERSION}}-${{matrix.artifact_name}}
|
||||
path: |
|
||||
build/install/Dusklight.app
|
||||
build/install/debug.tar.*
|
||||
@@ -221,7 +221,7 @@ jobs:
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: dusklight-${{env.APP_VERSION}}-android-${{matrix.artifact_arch}}
|
||||
name: dusklight-${{env.DUSK_VERSION}}-android-${{matrix.artifact_arch}}
|
||||
path: upload/
|
||||
|
||||
build-windows:
|
||||
@@ -283,7 +283,7 @@ jobs:
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: dusklight-${{env.APP_VERSION}}-win32-msvc-${{matrix.artifact_arch}}
|
||||
name: dusklight-${{env.DUSK_VERSION}}-win32-msvc-${{matrix.artifact_arch}}
|
||||
path: |
|
||||
build/install/*.exe
|
||||
build/install/*.dll
|
||||
|
||||
+1
-4
@@ -1,6 +1,3 @@
|
||||
[submodule "extern/aurora"]
|
||||
path = extern/aurora
|
||||
url = https://github.com/Lurs/aurora.git
|
||||
[submodule "extern/borealis"]
|
||||
path = extern/borealis
|
||||
url = https://github.com/encounter/borealis.git
|
||||
url = https://github.com/encounter/aurora.git
|
||||
|
||||
+148
-15
@@ -5,11 +5,10 @@ if (NOT CMAKE_BUILD_TYPE)
|
||||
"Build type options: Debug Release RelWithDebInfo MinSizeRel" FORCE)
|
||||
endif ()
|
||||
|
||||
include(extern/borealis/cmake/DetectVersion.cmake)
|
||||
borealis_detect_version()
|
||||
include(cmake/DetectVersion.cmake)
|
||||
detect_version()
|
||||
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
|
||||
project(dusklight LANGUAGES C CXX VERSION ${BOREALIS_APP_VERSION})
|
||||
|
||||
project(dusklight LANGUAGES C CXX VERSION ${DUSK_VERSION_STRING})
|
||||
if (APPLE)
|
||||
enable_language(OBJC OBJCXX)
|
||||
endif ()
|
||||
@@ -33,7 +32,6 @@ set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
||||
set(CMAKE_COLOR_DIAGNOSTICS ON)
|
||||
|
||||
# Folder-based instead of target-based organization
|
||||
# in Visual Studio and Xcode generators
|
||||
@@ -76,8 +74,6 @@ set(AURORA_ENABLE_RMLUI ON CACHE BOOL "Enable RmlUi UI support" FORCE)
|
||||
add_subdirectory(extern/aurora EXCLUDE_FROM_ALL)
|
||||
target_compile_definitions(aurora_mtx PRIVATE MTX_USE_PS=1)
|
||||
|
||||
add_subdirectory(extern/borealis EXCLUDE_FROM_ALL)
|
||||
|
||||
add_subdirectory(libs/freeverb)
|
||||
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
@@ -89,6 +85,8 @@ endif ()
|
||||
option(DUSK_BUILD_WARNINGS "Enable compiler warnings (off by default)")
|
||||
option(DUSK_SELECTED_OPT "If on, selected parts of the project will be compiled with optimizations on Debug, intending to make the game run at 30 FPS. Note for MSVC: you will need to remove '/RTC1' from your debug flags in CMake.")
|
||||
option(DUSK_MOVIE_SUPPORT "If on, compile against libjpeg-turbo to enable THP file decoding" ON)
|
||||
option(DUSK_ENABLE_UPDATE_CHECKER "Enable update checking support" ON)
|
||||
option(DUSK_ENABLE_SENTRY_NATIVE "Enable sentry-native crash reporting support" OFF)
|
||||
option(DUSK_PACKAGE_INSTALL "Install Dusklight with a Linux-native file structure" OFF)
|
||||
option(DUSK_GFX_DEBUG_GROUPS "Report debug groups to the native graphics API" ${DUSK_GFX_DEBUG_GROUPS_DEFAULT})
|
||||
option(DUSK_ENABLE_CODE_MODS "Enable code mods" OFF)
|
||||
@@ -152,7 +150,6 @@ if (DUSK_MOVIE_SUPPORT)
|
||||
-DENABLE_SHARED=OFF
|
||||
-DWITH_TURBOJPEG=ON
|
||||
-DWITH_JAVA=OFF
|
||||
-DCMAKE_INSTALL_LIBDIR=lib
|
||||
)
|
||||
if (CMAKE_TOOLCHAIN_FILE)
|
||||
get_filename_component(_jpeg_toolchain_file "${CMAKE_TOOLCHAIN_FILE}" ABSOLUTE BASE_DIR "${CMAKE_SOURCE_DIR}")
|
||||
@@ -237,6 +234,18 @@ endif ()
|
||||
include(FetchContent)
|
||||
|
||||
# Declare all dependencies first so CMake can download them in parallel
|
||||
message(STATUS "dusklight: Fetching cxxopts")
|
||||
FetchContent_Declare(cxxopts
|
||||
URL https://github.com/jarro2783/cxxopts/archive/refs/tags/v3.3.1.tar.gz
|
||||
URL_HASH SHA256=3bfc70542c521d4b55a46429d808178916a579b28d048bd8c727ee76c39e2072
|
||||
DOWNLOAD_EXTRACT_TIMESTAMP FALSE
|
||||
)
|
||||
message(STATUS "dusklight: Fetching nlohmann/json")
|
||||
FetchContent_Declare(json
|
||||
URL https://github.com/nlohmann/json/releases/download/v3.12.0/json.tar.xz
|
||||
URL_HASH SHA256=42f6e95cad6ec532fd372391373363b62a14af6d771056dbfc86160e6dfff7aa
|
||||
DOWNLOAD_EXTRACT_TIMESTAMP FALSE
|
||||
)
|
||||
message(STATUS "dusklight: Fetching miniz")
|
||||
FetchContent_Declare(miniz
|
||||
URL https://github.com/richgel999/miniz/releases/download/3.0.2/miniz-3.0.2.zip
|
||||
@@ -244,7 +253,7 @@ FetchContent_Declare(miniz
|
||||
EXCLUDE_FROM_ALL
|
||||
)
|
||||
|
||||
set(_fetch_content_deps miniz)
|
||||
set(_fetch_content_deps cxxopts json miniz)
|
||||
if (DUSK_HAS_FUNCHOOK)
|
||||
message(STATUS "dusklight: Fetching funchook")
|
||||
# cmake/PatchFunchook.cmake patches funchook's cmake/capstone.cmake.in to inject a
|
||||
@@ -279,12 +288,40 @@ if (DUSK_HAS_FUNCHOOK)
|
||||
endif ()
|
||||
FetchContent_MakeAvailable(${_fetch_content_deps})
|
||||
|
||||
if (DUSK_ENABLE_SENTRY_NATIVE)
|
||||
message(STATUS "dusklight: Fetching sentry-native")
|
||||
set(SENTRY_BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
|
||||
set(SENTRY_BACKEND crashpad CACHE STRING "" FORCE)
|
||||
if (WIN32)
|
||||
set(SENTRY_TRANSPORT winhttp CACHE STRING "" FORCE)
|
||||
endif ()
|
||||
set(SENTRY_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
||||
set(SENTRY_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
||||
set(SENTRY_BUILD_BENCHMARKS OFF CACHE BOOL "" FORCE)
|
||||
FetchContent_Declare(sentry_native
|
||||
GIT_REPOSITORY https://github.com/getsentry/sentry-native.git
|
||||
GIT_TAG 0.13.6
|
||||
GIT_SHALLOW TRUE
|
||||
GIT_PROGRESS TRUE
|
||||
GIT_SUBMODULES_RECURSE TRUE
|
||||
)
|
||||
if (NOT sentry_native_POPULATED)
|
||||
FetchContent_Populate(sentry_native)
|
||||
set(_skip_install_rules ${CMAKE_SKIP_INSTALL_RULES})
|
||||
set(CMAKE_SKIP_INSTALL_RULES ON)
|
||||
add_subdirectory(${sentry_native_SOURCE_DIR} ${sentry_native_BINARY_DIR} EXCLUDE_FROM_ALL)
|
||||
set(CMAKE_SKIP_INSTALL_RULES ${_skip_install_rules})
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# Use signed char on ARM to match the original game (and x86)
|
||||
string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" _arch)
|
||||
if(_arch MATCHES "^(arm|aarch64)" AND CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "GNU")
|
||||
add_compile_options(-fsigned-char)
|
||||
endif()
|
||||
|
||||
configure_version_header()
|
||||
|
||||
include(files.cmake)
|
||||
|
||||
# TODO: version handling for res includes
|
||||
@@ -297,23 +334,67 @@ set(DUSK_PRODUCT_NAME "Dusklight")
|
||||
set(DUSK_COPYRIGHT "Copyright (C) Twilit Realm contributors")
|
||||
|
||||
source_group("dolzel" FILES ${DOLZEL_FILES} ${Z2AUDIOLIB_FILES} ${REL_FILES})
|
||||
source_group("dusklight" FILES ${DUSK_FILES})
|
||||
source_group("dusklight" FILES ${DUSK_FILES} ${DUSK_HTTP_BACKEND_FILES})
|
||||
|
||||
include(cmake/GameABIConfig.cmake)
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
set(GAME_COMPILE_DEFS DUSK_BUILDING_GAME=1)
|
||||
set(GAME_LIBS aurora::core aurora::gx aurora::gd aurora::si aurora::vi aurora::pad aurora::mtx aurora::os aurora::dvd
|
||||
aurora::card borealis::cli borealis::crash borealis::data borealis::disc borealis::discord borealis::file_select borealis::log borealis::presentation borealis::sentry borealis::update freeverb cxxopts::cxxopts absl::flat_hash_map nlohmann_json::nlohmann_json TracyClient fmt::fmt
|
||||
Threads::Threads zstd::libzstd dusklight_game_headers ZLIB::ZLIB)
|
||||
aurora::card freeverb cxxopts::cxxopts absl::flat_hash_map nlohmann_json::nlohmann_json TracyClient fmt::fmt
|
||||
Threads::Threads zstd::libzstd dusklight_game_headers)
|
||||
if (DUSK_HAS_FUNCHOOK)
|
||||
list(APPEND GAME_LIBS funchook-static)
|
||||
endif ()
|
||||
|
||||
if (DUSK_ENABLE_SENTRY_NATIVE)
|
||||
list(APPEND GAME_LIBS sentry)
|
||||
list(APPEND GAME_COMPILE_DEFS DUSK_ENABLE_SENTRY_NATIVE=1 SENTRY_BUILD_STATIC=1)
|
||||
endif ()
|
||||
|
||||
if (WIN32)
|
||||
list(APPEND GAME_LIBS Ws2_32)
|
||||
if (CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||
list(APPEND GAME_LIBS dbghelp)
|
||||
list(APPEND GAME_COMPILE_DEFS DUSK_CRASH_DBGHELP=1)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
set(DUSK_HTTP_BACKEND_SOURCE src/dusk/http/no_backend.cpp)
|
||||
if (DUSK_ENABLE_UPDATE_CHECKER)
|
||||
list(APPEND GAME_COMPILE_DEFS DUSK_ENABLE_UPDATE_CHECKER=1)
|
||||
if (WIN32)
|
||||
set(DUSK_HTTP_BACKEND_SOURCE src/dusk/http/winhttp.cpp)
|
||||
list(APPEND GAME_LIBS winhttp)
|
||||
list(APPEND GAME_COMPILE_DEFS DUSK_HTTP_BACKEND_WINHTTP=1)
|
||||
message(STATUS "dusklight: Enabled update checker (WinHTTP)")
|
||||
elseif (ANDROID)
|
||||
set(DUSK_HTTP_BACKEND_SOURCE src/dusk/http/android.cpp)
|
||||
list(APPEND GAME_COMPILE_DEFS DUSK_HTTP_BACKEND_ANDROID=1)
|
||||
message(STATUS "dusklight: Enabled update checker (Android)")
|
||||
elseif (APPLE)
|
||||
find_library(FOUNDATION_FRAMEWORK Foundation REQUIRED)
|
||||
set(DUSK_HTTP_BACKEND_SOURCE src/dusk/http/url_session.mm)
|
||||
set_source_files_properties(src/dusk/http/url_session.mm PROPERTIES COMPILE_FLAGS -fobjc-arc)
|
||||
list(APPEND GAME_LIBS ${FOUNDATION_FRAMEWORK})
|
||||
list(APPEND GAME_COMPILE_DEFS DUSK_HTTP_BACKEND_URLSESSION=1)
|
||||
message(STATUS "dusklight: Enabled update checker (NSURLSession)")
|
||||
elseif (CMAKE_SYSTEM_NAME STREQUAL Linux)
|
||||
find_package(CURL QUIET OPTIONAL_COMPONENTS HTTPS SSL)
|
||||
if (CURL_FOUND AND CURL_HTTPS_FOUND AND CURL_SSL_FOUND)
|
||||
set(DUSK_HTTP_BACKEND_SOURCE src/dusk/http/curl.cpp)
|
||||
list(APPEND GAME_LIBS CURL::libcurl)
|
||||
list(APPEND GAME_COMPILE_DEFS DUSK_HTTP_BACKEND_LIBCURL=1)
|
||||
message(STATUS "dusklight: Enabled update checker (libcurl)")
|
||||
else ()
|
||||
message(STATUS "dusklight: Disabled update checker (libcurl + HTTPS/SSL not found)")
|
||||
endif ()
|
||||
else ()
|
||||
message(STATUS "dusklight: Disabled update checker (unsupported platform)")
|
||||
endif ()
|
||||
endif ()
|
||||
list(APPEND DUSK_FILES ${DUSK_HTTP_BACKEND_SOURCE})
|
||||
|
||||
if (DUSK_MOVIE_SUPPORT)
|
||||
if (TARGET libjpeg-turbo::turbojpeg-static)
|
||||
list(APPEND GAME_LIBS libjpeg-turbo::turbojpeg-static)
|
||||
@@ -323,6 +404,17 @@ if (DUSK_MOVIE_SUPPORT)
|
||||
list(APPEND GAME_COMPILE_DEFS MOVIE_SUPPORT=1)
|
||||
endif ()
|
||||
|
||||
include(src/dusk/randomizer/randomizer.cmake)
|
||||
|
||||
set(DUSK_ENABLE_DISCORD_DEFAULT ON)
|
||||
if (DEFINED DUSK_ENABLE_DISCORD_RPC AND NOT DEFINED DUSK_ENABLE_DISCORD)
|
||||
set(DUSK_ENABLE_DISCORD_DEFAULT ${DUSK_ENABLE_DISCORD_RPC})
|
||||
endif ()
|
||||
option(DUSK_ENABLE_DISCORD "Enable Discord Rich Presence support" ${DUSK_ENABLE_DISCORD_DEFAULT})
|
||||
if (DUSK_ENABLE_DISCORD AND NOT ANDROID AND NOT IOS AND NOT TVOS)
|
||||
list(APPEND GAME_COMPILE_DEFS DUSK_DISCORD=1)
|
||||
endif ()
|
||||
|
||||
if (DUSK_ENABLE_CODE_MODS)
|
||||
list(APPEND GAME_COMPILE_DEFS DUSK_CODE_MODS=1)
|
||||
endif ()
|
||||
@@ -387,14 +479,32 @@ endif ()
|
||||
set(DUSK_FILES src/dusk/main.cpp ${GAME_BASE_FILES} ${GAME_DEBUG_FILES} ${miniz_SOURCE_DIR}/miniz.c)
|
||||
if(ANDROID)
|
||||
add_library(dusklight SHARED ${DUSK_FILES})
|
||||
set_target_properties(dusklight PROPERTIES OUTPUT_NAME main)
|
||||
else ()
|
||||
add_executable(dusklight ${DUSK_FILES})
|
||||
endif ()
|
||||
borealis_configure_android_application(dusklight)
|
||||
if (ENABLE_ASAN)
|
||||
target_sources(dusklight PRIVATE src/dusk/asan_options.c)
|
||||
endif ()
|
||||
|
||||
# Add embedded data to target
|
||||
|
||||
file(GLOB_RECURSE RANDOMIZER_DATA "src/dusk/randomizer/generator/data/*")
|
||||
file(GLOB_RECURSE RANDOMIZER_ASSETS "src/dusk/randomizer/assets/*")
|
||||
list(APPEND RANDOMIZER_DATA ${RANDOMIZER_ASSETS})
|
||||
set(RANDO_ROOT_DATA_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
foreach (RANDOMIZER_FILE IN LISTS RANDOMIZER_DATA)
|
||||
file(RELATIVE_PATH REL_PATH ${RANDO_ROOT_DATA_DIR} ${RANDOMIZER_FILE})
|
||||
if(REL_PATH MATCHES "^src/dusk/randomizer/generator/data/tests")
|
||||
message(STATUS "Skipping Embed: ${REL_PATH}")
|
||||
continue()
|
||||
endif ()
|
||||
|
||||
message(STATUS "Embedding File: ${REL_PATH}")
|
||||
b_embed(dusklight ${REL_PATH})
|
||||
endforeach ()
|
||||
|
||||
target_compile_definitions(dusklight PRIVATE ${GAME_COMPILE_DEFS})
|
||||
target_include_directories(dusklight PRIVATE ${miniz_SOURCE_DIR})
|
||||
target_link_libraries(dusklight PRIVATE aurora::main ${GAME_LIBS} ${JSYSTEM_LINK_LIBRARIES})
|
||||
@@ -468,9 +578,17 @@ if (TARGET crashpad_handler)
|
||||
)
|
||||
endif ()
|
||||
|
||||
if (ANDROID)
|
||||
# SDLActivity loads SDL_main via dlsym on Android. Since aurora::main is a static
|
||||
# archive, force an undefined reference so the linker keeps the SDL_main object.
|
||||
target_link_options(dusklight PRIVATE "-Wl,-u,SDL_main")
|
||||
endif ()
|
||||
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL Linux)
|
||||
target_link_options(dusklight PRIVATE "-Wl,--build-id=sha1")
|
||||
target_link_libraries(dusklight PRIVATE dl)
|
||||
elseif (ANDROID)
|
||||
target_link_options(dusklight PRIVATE "-Wl,--build-id=sha1")
|
||||
endif ()
|
||||
|
||||
if (NOT APPLE)
|
||||
@@ -552,8 +670,8 @@ if (APPLE)
|
||||
MACOSX_BUNDLE TRUE
|
||||
MACOSX_BUNDLE_BUNDLE_NAME ${DUSK_BUNDLE_NAME}
|
||||
MACOSX_BUNDLE_GUI_IDENTIFIER ${DUSK_BUNDLE_IDENTIFIER}
|
||||
MACOSX_BUNDLE_BUNDLE_VERSION ${BOREALIS_APP_VERSION}
|
||||
MACOSX_BUNDLE_SHORT_VERSION_STRING ${BOREALIS_APP_SHORT_VERSION}
|
||||
MACOSX_BUNDLE_BUNDLE_VERSION ${DUSK_VERSION_STRING}
|
||||
MACOSX_BUNDLE_SHORT_VERSION_STRING ${DUSK_SHORT_VERSION_STRING}
|
||||
MACOSX_BUNDLE_INFO_PLIST ${DUSK_INFO_PLIST}
|
||||
OUTPUT_NAME Dusklight
|
||||
XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "YES"
|
||||
@@ -586,6 +704,21 @@ if (APPLE)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
find_library(APPKIT_FRAMEWORK AppKit REQUIRED)
|
||||
target_sources(dusklight PRIVATE src/dusk/file_select_macos.mm)
|
||||
set_source_files_properties(src/dusk/file_select_macos.mm PROPERTIES COMPILE_FLAGS -fobjc-arc)
|
||||
target_link_libraries(dusklight PRIVATE ${APPKIT_FRAMEWORK})
|
||||
endif ()
|
||||
|
||||
if (IOS)
|
||||
find_library(UIKIT_FRAMEWORK UIKit REQUIRED)
|
||||
find_library(UNIFORM_TYPE_IDENTIFIERS_FRAMEWORK UniformTypeIdentifiers REQUIRED)
|
||||
target_sources(dusklight PRIVATE src/dusk/ios/FileSelectDialog.m)
|
||||
set_source_files_properties(src/dusk/ios/FileSelectDialog.m PROPERTIES COMPILE_FLAGS -fobjc-arc)
|
||||
target_link_libraries(dusklight PRIVATE ${UIKIT_FRAMEWORK} ${UNIFORM_TYPE_IDENTIFIERS_FRAMEWORK})
|
||||
endif ()
|
||||
|
||||
include(extern/aurora/cmake/AuroraCopyRuntimeDLLs.cmake)
|
||||
aurora_copy_runtime_dlls(dusklight)
|
||||
|
||||
|
||||
+4
-4
@@ -28,12 +28,12 @@
|
||||
"cacheVariables": {
|
||||
"CMAKE_C_COMPILER_LAUNCHER": "sccache",
|
||||
"CMAKE_CXX_COMPILER_LAUNCHER": "sccache",
|
||||
"BOREALIS_ENABLE_SENTRY": {
|
||||
"DUSK_ENABLE_SENTRY_NATIVE": {
|
||||
"type": "BOOL",
|
||||
"value": true
|
||||
},
|
||||
"BOREALIS_SENTRY_DSN": "$env{SENTRY_DSN}",
|
||||
"BOREALIS_SENTRY_ENVIRONMENT": "production",
|
||||
"DUSK_SENTRY_DSN": "$env{SENTRY_DSN}",
|
||||
"DUSK_SENTRY_ENVIRONMENT": "production",
|
||||
"Rust_RUSTUP_INSTALL_MISSING_TARGET": {
|
||||
"type": "BOOL",
|
||||
"value": true
|
||||
@@ -448,7 +448,7 @@
|
||||
"ci"
|
||||
],
|
||||
"cacheVariables": {
|
||||
"BOREALIS_ENABLE_SENTRY": {
|
||||
"DUSK_ENABLE_SENTRY_NATIVE": {
|
||||
"type": "BOOL",
|
||||
"value": false
|
||||
}
|
||||
|
||||
@@ -23,5 +23,5 @@ cp -r platforms/freedesktop/{16x16,32x32,48x48,64x64,128x128,256x256,512x512,102
|
||||
cp platforms/freedesktop/dev.twilitrealm.dusk.desktop build/appdir/usr/share/applications
|
||||
|
||||
cd build/install
|
||||
VERSION="$APP_VERSION" NO_STRIP=1 "$linuxdeploy" \
|
||||
VERSION="$DUSK_VERSION" NO_STRIP=1 "$linuxdeploy" \
|
||||
-l "$lib_dir/libusb-1.0.so" --appdir "$build_dir/appdir" --output appimage
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
# Version detection shared by the main build and the mod SDK (sdk/CMakeLists.txt)
|
||||
include_guard(GLOBAL)
|
||||
|
||||
get_filename_component(_DUSK_VERSION_ROOT "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE)
|
||||
|
||||
set(DUSK_SENTRY_DSN "" CACHE STRING "Sentry DSN")
|
||||
set(DUSK_SENTRY_ENVIRONMENT "development" CACHE STRING "Sentry environment")
|
||||
|
||||
set(DUSK_VERSION_OVERRIDE "" CACHE STRING "Override version string (skips git detection and format validation)")
|
||||
|
||||
macro(detect_version)
|
||||
if (DUSK_VERSION_OVERRIDE)
|
||||
set(DUSK_WC_DESCRIBE "${DUSK_VERSION_OVERRIDE}")
|
||||
set(DUSK_VERSION_STRING "0.0.0.0")
|
||||
set(DUSK_SHORT_VERSION_STRING "0.0.0")
|
||||
set(DUSK_VERSION_CODE "1")
|
||||
set(DUSK_WC_REVISION "")
|
||||
set(DUSK_WC_BRANCH "")
|
||||
set(DUSK_WC_DATE "")
|
||||
message(STATUS "Dusklight version overridden to ${DUSK_WC_DESCRIBE}")
|
||||
else ()
|
||||
# obtain revision info from git
|
||||
find_package(Git)
|
||||
if (GIT_FOUND)
|
||||
# make sure version information gets re-run when the current Git HEAD changes
|
||||
execute_process(WORKING_DIRECTORY ${_DUSK_VERSION_ROOT} COMMAND ${GIT_EXECUTABLE} rev-parse --git-path HEAD
|
||||
OUTPUT_VARIABLE dusk_git_head_filename
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
get_filename_component(dusk_git_head_filename "${dusk_git_head_filename}" ABSOLUTE BASE_DIR "${_DUSK_VERSION_ROOT}")
|
||||
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${dusk_git_head_filename}")
|
||||
|
||||
execute_process(WORKING_DIRECTORY ${_DUSK_VERSION_ROOT} COMMAND ${GIT_EXECUTABLE} rev-parse --symbolic-full-name HEAD
|
||||
OUTPUT_VARIABLE dusk_git_head_symbolic
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
execute_process(WORKING_DIRECTORY ${_DUSK_VERSION_ROOT}
|
||||
COMMAND ${GIT_EXECUTABLE} rev-parse --git-path ${dusk_git_head_symbolic}
|
||||
OUTPUT_VARIABLE dusk_git_head_symbolic_filename
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
get_filename_component(dusk_git_head_symbolic_filename "${dusk_git_head_symbolic_filename}" ABSOLUTE BASE_DIR "${_DUSK_VERSION_ROOT}")
|
||||
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${dusk_git_head_symbolic_filename}")
|
||||
|
||||
# defines DUSK_WC_REVISION
|
||||
execute_process(WORKING_DIRECTORY ${_DUSK_VERSION_ROOT} COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
|
||||
OUTPUT_VARIABLE DUSK_WC_REVISION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
# defines DUSK_WC_DESCRIBE
|
||||
execute_process(WORKING_DIRECTORY ${_DUSK_VERSION_ROOT} COMMAND ${GIT_EXECUTABLE} describe --tags --long --dirty --match "v*"
|
||||
OUTPUT_VARIABLE DUSK_WC_DESCRIBE
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
# remove the git hash, then collapse a clean "-0" suffix only
|
||||
string(REGEX REPLACE "-[^-]+(-dirty|)$" "\\1" DUSK_WC_DESCRIBE "${DUSK_WC_DESCRIBE}")
|
||||
string(REGEX REPLACE "-0$" "" DUSK_WC_DESCRIBE "${DUSK_WC_DESCRIBE}")
|
||||
|
||||
# defines DUSK_WC_BRANCH
|
||||
execute_process(WORKING_DIRECTORY ${_DUSK_VERSION_ROOT} COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
|
||||
OUTPUT_VARIABLE DUSK_WC_BRANCH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
# defines DUSK_WC_DATE
|
||||
execute_process(WORKING_DIRECTORY ${_DUSK_VERSION_ROOT} COMMAND ${GIT_EXECUTABLE} log -1 --format=%ad
|
||||
OUTPUT_VARIABLE DUSK_WC_DATE
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
else ()
|
||||
message(STATUS "Unable to find git, commit information will not be available")
|
||||
endif ()
|
||||
|
||||
if (DUSK_WC_DESCRIBE MATCHES "^v([0-9]+)\\.([0-9]+)\\.([0-9]+)([-+].*)?$")
|
||||
set(DUSK_SHORT_VERSION_STRING "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}")
|
||||
set(_ver_major ${CMAKE_MATCH_1})
|
||||
set(_ver_minor ${CMAKE_MATCH_2})
|
||||
set(_ver_patch ${CMAKE_MATCH_3})
|
||||
set(DUSK_VERSION_TWEAK "0")
|
||||
if (DUSK_WC_DESCRIBE MATCHES "^v[0-9]+\\.[0-9]+\\.[0-9]+-([0-9]+)(-dirty)?$")
|
||||
set(DUSK_VERSION_TWEAK "${CMAKE_MATCH_1}")
|
||||
elseif (DUSK_WC_DESCRIBE MATCHES "^v[0-9]+\\.[0-9]+\\.[0-9]+-[0-9A-Za-z.-]+-([0-9]+)(-dirty)?$")
|
||||
set(DUSK_VERSION_TWEAK "${CMAKE_MATCH_1}")
|
||||
endif ()
|
||||
set(DUSK_VERSION_STRING "${DUSK_SHORT_VERSION_STRING}.${DUSK_VERSION_TWEAK}")
|
||||
if (DUSK_VERSION_TWEAK GREATER 999)
|
||||
set(_tweak 999)
|
||||
else ()
|
||||
set(_tweak ${DUSK_VERSION_TWEAK})
|
||||
endif ()
|
||||
# encoding: major*1e7 + minor*1e5 + patch*1e3 + tweak; collision-free for major<210, minor<100, patch<100, tweak<=999
|
||||
math(EXPR DUSK_VERSION_CODE
|
||||
"${_ver_major} * 10000000 + ${_ver_minor} * 100000 + ${_ver_patch} * 1000 + ${_tweak}")
|
||||
else ()
|
||||
set(DUSK_WC_DESCRIBE "UNKNOWN-VERSION")
|
||||
set(DUSK_VERSION_STRING "0.0.0.0")
|
||||
set(DUSK_SHORT_VERSION_STRING "0.0.0")
|
||||
set(DUSK_VERSION_CODE "1")
|
||||
endif ()
|
||||
|
||||
endif ()
|
||||
|
||||
# Add version information to CI environment variables
|
||||
if (DEFINED ENV{GITHUB_ENV})
|
||||
file(APPEND "$ENV{GITHUB_ENV}" "DUSK_VERSION=${DUSK_WC_DESCRIBE}\n")
|
||||
file(APPEND "$ENV{GITHUB_ENV}" "DUSK_VERSION_CODE=${DUSK_VERSION_CODE}\n")
|
||||
endif ()
|
||||
message(STATUS "Dusklight version set to ${DUSK_WC_DESCRIBE}")
|
||||
endmacro()
|
||||
|
||||
# Sets PLATFORM_NAME and configures version.h into the caller's binary dir.
|
||||
macro(configure_version_header)
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL Windows)
|
||||
set(PLATFORM_NAME win32)
|
||||
elseif (CMAKE_SYSTEM_NAME STREQUAL Darwin)
|
||||
if (IOS)
|
||||
set(PLATFORM_NAME ios)
|
||||
elseif (TVOS)
|
||||
set(PLATFORM_NAME tvos)
|
||||
else ()
|
||||
set(PLATFORM_NAME macos)
|
||||
endif ()
|
||||
else ()
|
||||
string(TOLOWER CMAKE_SYSTEM_NAME PLATFORM_NAME)
|
||||
endif ()
|
||||
|
||||
configure_file(${_DUSK_VERSION_ROOT}/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h)
|
||||
endmacro()
|
||||
@@ -4,7 +4,7 @@ include_guard(GLOBAL)
|
||||
get_filename_component(_game_root "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE)
|
||||
|
||||
# PARTIAL_DEBUG makes debug and release share one struct/vtable ABI so a mod binary loads into either
|
||||
set(_game_compile_defs TARGET_PC=1 WIDESCREEN_SUPPORT=1 AVOID_UB=1 VERSION=0 MTX_USE_PS=1 PARTIAL_DEBUG=1 DUSK_TPHD=1)
|
||||
set(_game_compile_defs TARGET_PC=1 WIDESCREEN_SUPPORT=1 AVOID_UB=1 VERSION=0 MTX_USE_PS=1 PARTIAL_DEBUG=1)
|
||||
if (ANDROID)
|
||||
list(APPEND _game_compile_defs TARGET_ANDROID=1)
|
||||
endif ()
|
||||
|
||||
+8
-68
@@ -209,8 +209,8 @@ if (svc_resource->load(mod_ctx, "config.txt", &buf) == MOD_OK) {
|
||||
}
|
||||
```
|
||||
|
||||
Missing files return `MOD_UNAVAILABLE`. Always `free` what you `load`. The bundle is read-only; use
|
||||
`HostService::data_dir` for persistent storage.
|
||||
Missing files return `MOD_UNAVAILABLE`. Always `free` what you `load`. Note that the bundle is read-only; for writable
|
||||
storage, use the directory from `svc_host->mod_dir(mod_ctx)`.
|
||||
|
||||
### HostService (`mods/svc/host.h`)
|
||||
|
||||
@@ -219,17 +219,9 @@ Mod metadata and runtime interaction with the loader:
|
||||
```cpp
|
||||
IMPORT_SERVICE(HostService, svc_host);
|
||||
|
||||
// Temporary mod data directory, wiped on startup
|
||||
const char* cacheDir = svc_host->mod_dir(mod_ctx);
|
||||
|
||||
// Persistent mod data directory
|
||||
const char* dataDir = nullptr;
|
||||
if (svc_host->data_dir(mod_ctx, &dataDir) == MOD_OK) {
|
||||
// ...
|
||||
}
|
||||
|
||||
// Report an error and disable the mod
|
||||
svc_host->fail(mod_ctx, MOD_ERROR, "something unrecoverable happened");
|
||||
const char* id = svc_host->mod_id(mod_ctx);
|
||||
const char* dir = svc_host->mod_dir(mod_ctx); // writable per-mod directory
|
||||
svc_host->fail(mod_ctx, MOD_ERROR, "something unrecoverable happened"); // disables the mod
|
||||
```
|
||||
|
||||
`get_service`/`publish_service` provide dynamic service lookup; see [Exporting Services](#exporting-services).
|
||||
@@ -381,55 +373,6 @@ buffer contract as `get_blob`. Pass a `NULL` buffer to either read function to q
|
||||
are cleared. Observers are removed automatically when the mod is detached, so the output handle is only needed for
|
||||
manual unregistration. Save callbacks run on the game thread.
|
||||
|
||||
### StageService (`mods/svc/stage.h`)
|
||||
|
||||
Allows making changes to a stage's "stage info" (contents of .dzs/.dzr files).
|
||||
(Currently only supports editing actor nodes.)
|
||||
|
||||
```cpp
|
||||
IMPORT_SERVICE(StageService, svc_stage);
|
||||
|
||||
stage_actor_data_class record = {
|
||||
"carry00",
|
||||
0xFF000000,
|
||||
cXyz(0.0f, 0.0f, 0.0f),
|
||||
csXyz(0, 0, 0),
|
||||
0,
|
||||
};
|
||||
|
||||
StageActorHandle handle{};
|
||||
svc_stage->patch_actor(mod_ctx, "F_SP102", 0, -1, record_crc, &record, sizeof(record), &handle);
|
||||
```
|
||||
|
||||
```
|
||||
StageActorHandle handle{};
|
||||
svc_stage->delete_actor(mod_ctx, "F_SP102", 0, -1, record_crc, &handle);
|
||||
```
|
||||
|
||||
Patch or remove actors from the original actor list as the room loads.
|
||||
Given records must be of either `stage_actor_data_class` or `stage_tgsc_data_class` types.
|
||||
`record_crc` is the CRC-32 of the unmodified original record used to identify the record to replace or remove.
|
||||
|
||||
```
|
||||
stage_actor_data_class record = {
|
||||
"carry00",
|
||||
0xFF000000,
|
||||
cXyz(0.0f, 0.0f, 0.0f),
|
||||
csXyz(0, 0, 0),
|
||||
0,
|
||||
};
|
||||
|
||||
StageActorHandle handle{};
|
||||
svc_stage->add_actor(mod_ctx, "F_SP102", 0, -1, &record, sizeof(record), &handle);
|
||||
```
|
||||
|
||||
Add a new actor to the actor list as the room loads.
|
||||
Given records must be of either `stage_actor_data_class` or `stage_tgsc_data_class` types.
|
||||
|
||||
Stage names may contain up to 8 characters. For patches and deletions, room `0xff` and layer `-1` match any room or
|
||||
layer; additions require a specific room. Edits are removed when the mod is detached. If multiple mods edit the same
|
||||
record, the later-loaded mod wins.
|
||||
|
||||
### UiService (`mods/svc/ui.h`)
|
||||
|
||||
Integrate seamlessly with Dusklight's UI system: add controls and buttons to your mod's detail pane in the Mods window,
|
||||
@@ -633,9 +576,6 @@ if (svc_camera->get_camera(mod_ctx, game_view, &camera) == MOD_OK) {
|
||||
first in-game frame. Projection matrices match the renderer's WebGPU clip convention and renderer depth convention
|
||||
(reversed-Z by default).
|
||||
|
||||
Camera operators allow overriding the main camera. When an operator callback returns true, its values replace the camera
|
||||
state for the current frame. Register and unregister using `register_camera_operator` / `unregister_camera_operator`.
|
||||
|
||||
---
|
||||
|
||||
## Hooking Game Functions
|
||||
@@ -938,6 +878,6 @@ const char* nativeDir = svc_host->native_dir(mod_ctx); // read-only
|
||||
```
|
||||
|
||||
Libraries loaded explicitly by the mod remain its responsibility: stop their threads and unload them during
|
||||
`mod_shutdown`. Do not write into `native_dir`; use `data_dir` for persistent storage or `mod_dir` for temporary
|
||||
(session) storage. Native library namespaces are process-wide on some platforms, so two mods cannot safely assume that
|
||||
incompatible libraries with the same filename will remain isolated.
|
||||
`mod_shutdown`. Do not write into `native_dir`; use `mod_dir` for writable state. Native library namespaces are
|
||||
process-wide on some platforms, so two mods cannot safely assume that incompatible libraries with the same filename
|
||||
will remain isolated.
|
||||
|
||||
Vendored
+1
-1
Submodule extern/aurora updated: 8bb7159d3e...6c4c27f9e8
Vendored
-1
Submodule extern/borealis deleted from 6fd955e7e6
+162
-14
@@ -1421,21 +1421,30 @@ set(DUSK_FILES
|
||||
src/dusk/achievements.cpp
|
||||
src/dusk/action_bindings.cpp
|
||||
src/dusk/action_bindings.h
|
||||
src/dusk/android_frame_rate.cpp
|
||||
src/dusk/android_frame_rate.hpp
|
||||
src/dusk/asserts.cpp
|
||||
src/dusk/autosave.cpp
|
||||
src/dusk/config.cpp
|
||||
src/dusk/config.hpp
|
||||
src/dusk/crash_handler.cpp
|
||||
src/dusk/crash_reporting.cpp
|
||||
src/dusk/data.cpp
|
||||
src/dusk/data.hpp
|
||||
src/dusk/discord.cpp
|
||||
src/dusk/discord.hpp
|
||||
src/dusk/discord_presence.cpp
|
||||
src/dusk/dvd_asset.cpp
|
||||
src/dusk/dvd_asset.hpp
|
||||
src/dusk/extras.c
|
||||
src/dusk/file_select.cpp
|
||||
src/dusk/file_select.hpp
|
||||
src/dusk/frame_interpolation.cpp
|
||||
src/dusk/game_clock.cpp
|
||||
src/dusk/gamepad_color.cpp
|
||||
src/dusk/globals.cpp
|
||||
src/dusk/gyro.cpp
|
||||
src/dusk/http/http.hpp
|
||||
src/dusk/imgui/ImGuiActorSpawner.cpp
|
||||
src/dusk/imgui/ImGuiBloomWindow.cpp
|
||||
src/dusk/imgui/ImGuiBloomWindow.hpp
|
||||
@@ -1449,6 +1458,8 @@ set(DUSK_FILES
|
||||
src/dusk/imgui/ImGuiHeapOverlay.cpp
|
||||
src/dusk/imgui/ImGuiMenuTools.cpp
|
||||
src/dusk/imgui/ImGuiMenuTools.hpp
|
||||
src/dusk/imgui/ImGuiMenuRandomizer.cpp
|
||||
src/dusk/imgui/ImGuiMenuRandomizer.hpp
|
||||
src/dusk/imgui/ImGuiProcessOverlay.cpp
|
||||
src/dusk/imgui/ImGuiSaveEditor.cpp
|
||||
src/dusk/imgui/ImGuiStateShare.cpp
|
||||
@@ -1495,11 +1506,7 @@ set(DUSK_FILES
|
||||
src/dusk/mods/svc/window.hpp
|
||||
src/dusk/mods/svc/save.cpp
|
||||
src/dusk/mods/svc/save.hpp
|
||||
src/dusk/mods/svc/stage.cpp
|
||||
src/dusk/mods/svc/stage.hpp
|
||||
src/dusk/mouse.cpp
|
||||
src/dusk/presentation.cpp
|
||||
src/dusk/presentation.hpp
|
||||
src/dusk/scope_guard.hpp
|
||||
src/dusk/settings.cpp
|
||||
src/dusk/speedrun.cpp
|
||||
@@ -1517,6 +1524,8 @@ set(DUSK_FILES
|
||||
src/dusk/ui/component.hpp
|
||||
src/dusk/ui/controller_config.cpp
|
||||
src/dusk/ui/controller_config.hpp
|
||||
src/dusk/ui/cosmetics.hpp
|
||||
src/dusk/ui/cosmetics.cpp
|
||||
src/dusk/ui/controls.hpp
|
||||
src/dusk/ui/document.cpp
|
||||
src/dusk/ui/document.hpp
|
||||
@@ -1575,20 +1584,159 @@ set(DUSK_FILES
|
||||
src/dusk/ui/warp.hpp
|
||||
src/dusk/ui/window.cpp
|
||||
src/dusk/ui/window.hpp
|
||||
src/dusk/ui/rando_config.cpp
|
||||
src/dusk/ui/rando_config.hpp
|
||||
src/dusk/ui/rando_seed_generation.cpp
|
||||
src/dusk/ui/rando_seed_generation.hpp
|
||||
src/dusk/achievements.cpp
|
||||
src/dusk/iso_validate.cpp
|
||||
src/dusk/livesplit.cpp
|
||||
src/dusk/OSContext.cpp
|
||||
src/dusk/OSReport.cpp
|
||||
src/dusk/OSThread.cpp
|
||||
src/dusk/OSMutex.cpp
|
||||
src/dusk/mods/log_buffer.cpp
|
||||
src/dusk/mods/log_buffer.hpp
|
||||
src/dusk/mods/manifest.cpp
|
||||
src/dusk/mods/manifest.hpp
|
||||
src/dusk/mods/loader/bundle_disk.cpp
|
||||
src/dusk/mods/loader/bundle_zip.cpp
|
||||
src/dusk/mods/loader/context.cpp
|
||||
src/dusk/mods/loader/depgraph.cpp
|
||||
src/dusk/mods/loader/depgraph.hpp
|
||||
src/dusk/mods/loader/loader.cpp
|
||||
src/dusk/mods/loader/loader.hpp
|
||||
src/dusk/mods/loader/native_module.cpp
|
||||
src/dusk/mods/loader/native_module.hpp
|
||||
src/dusk/mods/svc/camera.cpp
|
||||
src/dusk/mods/svc/config.cpp
|
||||
src/dusk/mods/svc/config.hpp
|
||||
src/dusk/mods/svc/game.cpp
|
||||
src/dusk/mods/svc/gfx.cpp
|
||||
src/dusk/mods/svc/hook.cpp
|
||||
src/dusk/mods/svc/host.cpp
|
||||
src/dusk/mods/svc/log.cpp
|
||||
src/dusk/mods/svc/overlay.cpp
|
||||
src/dusk/mods/svc/resource.cpp
|
||||
src/dusk/mods/svc/texture.cpp
|
||||
src/dusk/mods/svc/ui.cpp
|
||||
src/dusk/mods/svc/ui.hpp
|
||||
src/dusk/mods/svc/registry.cpp
|
||||
src/dusk/mods/svc/registry.hpp
|
||||
src/dusk/discord.cpp
|
||||
src/dusk/discord.hpp
|
||||
src/dusk/discord_presence.cpp
|
||||
src/dusk/version.cpp
|
||||
src/dusk/action_bindings.cpp
|
||||
src/dusk/update_check.cpp
|
||||
src/dusk/update_check.hpp
|
||||
src/dusk/version.cpp
|
||||
src/dusk/cosmetics/color_utils.hpp
|
||||
src/dusk/cosmetics/color_utils.cpp
|
||||
src/dusk/cosmetics/midna_hair_color.hpp
|
||||
src/dusk/cosmetics/midna_hair_color.cpp
|
||||
src/dusk/cosmetics/texture_utils.hpp
|
||||
src/dusk/cosmetics/texture_utils.cpp
|
||||
# Randomizer files
|
||||
src/dusk/randomizer/game/custom_flow_ids.hpp
|
||||
src/dusk/randomizer/game/flags.cpp
|
||||
src/dusk/randomizer/game/flags.h
|
||||
src/dusk/randomizer/game/messages.cpp
|
||||
src/dusk/randomizer/game/messages.hpp
|
||||
src/dusk/randomizer/game/stages.cpp
|
||||
src/dusk/randomizer/game/stages.h
|
||||
src/dusk/randomizer/game/tools.cpp
|
||||
src/dusk/randomizer/game/tools.h
|
||||
src/dusk/randomizer/game/verify_item_functions.cpp
|
||||
src/dusk/randomizer/game/verify_item_functions.h
|
||||
src/dusk/randomizer/game/randomizer_context.cpp
|
||||
src/dusk/randomizer/game/randomizer_context.hpp
|
||||
src/dusk/randomizer/generator/logic/area.cpp
|
||||
src/dusk/randomizer/generator/logic/area.hpp
|
||||
src/dusk/randomizer/generator/logic/dungeon.cpp
|
||||
src/dusk/randomizer/generator/logic/dungeon.hpp
|
||||
src/dusk/randomizer/generator/logic/entrance.cpp
|
||||
src/dusk/randomizer/generator/logic/entrance.hpp
|
||||
src/dusk/randomizer/generator/logic/entrance_shuffle.cpp
|
||||
src/dusk/randomizer/generator/logic/entrance_shuffle.hpp
|
||||
src/dusk/randomizer/generator/logic/fill.cpp
|
||||
src/dusk/randomizer/generator/logic/fill.hpp
|
||||
src/dusk/randomizer/generator/logic/flatten/bits.cpp
|
||||
src/dusk/randomizer/generator/logic/flatten/bits.hpp
|
||||
src/dusk/randomizer/generator/logic/flatten/flatten.cpp
|
||||
src/dusk/randomizer/generator/logic/flatten/flatten.hpp
|
||||
src/dusk/randomizer/generator/logic/flatten/simplify_algebraic.cpp
|
||||
src/dusk/randomizer/generator/logic/flatten/simplify_algebraic.hpp
|
||||
src/dusk/randomizer/generator/logic/hint_types.hpp
|
||||
src/dusk/randomizer/generator/logic/hints.cpp
|
||||
src/dusk/randomizer/generator/logic/hints.hpp
|
||||
src/dusk/randomizer/generator/logic/item.cpp
|
||||
src/dusk/randomizer/generator/logic/item.hpp
|
||||
src/dusk/randomizer/generator/logic/item_pool.cpp
|
||||
src/dusk/randomizer/generator/logic/item_pool.hpp
|
||||
src/dusk/randomizer/generator/logic/location.cpp
|
||||
src/dusk/randomizer/generator/logic/location.hpp
|
||||
src/dusk/randomizer/generator/logic/plandomizer.cpp
|
||||
src/dusk/randomizer/generator/logic/plandomizer.hpp
|
||||
src/dusk/randomizer/generator/logic/requirement.cpp
|
||||
src/dusk/randomizer/generator/logic/requirement.hpp
|
||||
src/dusk/randomizer/generator/logic/search.cpp
|
||||
src/dusk/randomizer/generator/logic/search.hpp
|
||||
src/dusk/randomizer/generator/logic/spoiler_log.cpp
|
||||
src/dusk/randomizer/generator/logic/spoiler_log.hpp
|
||||
src/dusk/randomizer/generator/logic/world.cpp
|
||||
src/dusk/randomizer/generator/logic/world.hpp
|
||||
src/dusk/randomizer/generator/randomizer.cpp
|
||||
src/dusk/randomizer/generator/randomizer.hpp
|
||||
src/dusk/randomizer/generator/seedgen/config.cpp
|
||||
src/dusk/randomizer/generator/seedgen/config.hpp
|
||||
src/dusk/randomizer/generator/seedgen/packed_bits.hpp
|
||||
src/dusk/randomizer/generator/seedgen/seed.cpp
|
||||
src/dusk/randomizer/generator/seedgen/seed.hpp
|
||||
src/dusk/randomizer/generator/seedgen/settings.cpp
|
||||
src/dusk/randomizer/generator/seedgen/settings.hpp
|
||||
src/dusk/randomizer/generator/test/test.cpp
|
||||
src/dusk/randomizer/generator/test/test.hpp
|
||||
src/dusk/randomizer/generator/utility/base64pp.hpp
|
||||
src/dusk/randomizer/generator/utility/color.cpp
|
||||
src/dusk/randomizer/generator/utility/color.hpp
|
||||
src/dusk/randomizer/generator/utility/crc32.hpp
|
||||
src/dusk/randomizer/generator/utility/common.cpp
|
||||
src/dusk/randomizer/generator/utility/common.hpp
|
||||
src/dusk/randomizer/generator/utility/container.hpp
|
||||
src/dusk/randomizer/generator/utility/endian.cpp
|
||||
src/dusk/randomizer/generator/utility/endian.hpp
|
||||
src/dusk/randomizer/generator/utility/exception.hpp
|
||||
src/dusk/randomizer/generator/utility/file.cpp
|
||||
src/dusk/randomizer/generator/utility/file.hpp
|
||||
src/dusk/randomizer/generator/utility/general.hpp
|
||||
src/dusk/randomizer/generator/utility/log.cpp
|
||||
src/dusk/randomizer/generator/utility/log.hpp
|
||||
src/dusk/randomizer/generator/utility/math.hpp
|
||||
src/dusk/randomizer/generator/utility/path.cpp
|
||||
src/dusk/randomizer/generator/utility/path.hpp
|
||||
src/dusk/randomizer/generator/utility/platform.cpp
|
||||
src/dusk/randomizer/generator/utility/platform.hpp
|
||||
src/dusk/randomizer/generator/utility/random.cpp
|
||||
src/dusk/randomizer/generator/utility/random.hpp
|
||||
src/dusk/randomizer/generator/utility/string.cpp
|
||||
src/dusk/randomizer/generator/utility/string.hpp
|
||||
src/dusk/randomizer/generator/utility/text.cpp
|
||||
src/dusk/randomizer/generator/utility/text.hpp
|
||||
src/dusk/randomizer/generator/utility/thread_local.hpp
|
||||
src/dusk/randomizer/generator/utility/time.cpp
|
||||
src/dusk/randomizer/generator/utility/time.hpp
|
||||
src/dusk/randomizer/generator/utility/yaml.hpp
|
||||
src/dusk/utilities.cpp
|
||||
src/helpers/batch.cpp
|
||||
src/helpers/endian.cpp
|
||||
src/helpers/offset_ptr.cpp
|
||||
src/helpers/string.cpp
|
||||
src/dusk/tphd/TphdPack.hpp
|
||||
src/dusk/tphd/TphdPack.cpp
|
||||
src/dusk/tphd/GtxParser.hpp
|
||||
src/dusk/tphd/GtxParser.cpp
|
||||
src/dusk/tphd/AddrLib.hpp
|
||||
src/dusk/tphd/AddrLib.cpp
|
||||
src/dusk/tphd/HdAssetLayer.hpp
|
||||
src/dusk/tphd/HdAssetLayer.cpp
|
||||
src/dusk/tphd/LosTable.hpp
|
||||
src/dusk/tphd/LosTable.cpp
|
||||
)
|
||||
|
||||
set(DUSK_HTTP_BACKEND_FILES
|
||||
src/dusk/http/no_backend.cpp
|
||||
src/dusk/http/curl.cpp
|
||||
src/dusk/http/winhttp.cpp
|
||||
src/dusk/http/url_session.mm
|
||||
)
|
||||
|
||||
@@ -228,7 +228,7 @@
|
||||
ninjaFlags = [ "dusklight" ];
|
||||
|
||||
cmakeFlags = [
|
||||
"-DBOREALIS_APP_VERSION_OVERRIDE=${versionSuffix}"
|
||||
"-DDUSK_VERSION_OVERRIDE=${versionSuffix}"
|
||||
"-DFETCHCONTENT_FULLY_DISCONNECTED=ON"
|
||||
"-DAURORA_DAWN_PROVIDER=package"
|
||||
"-DAURORA_DAWN_LINKAGE=static"
|
||||
|
||||
@@ -46,6 +46,11 @@ public:
|
||||
s32 getSeLoadStatus(u32 wave) { return getWaveLoadStatus(wave, 0); }
|
||||
s32 getBgmLoadStatus(u32 wave) { return getWaveLoadStatus(wave, 1); }
|
||||
u8 getDemoSeWaveNum() { return loadedDemoWave; }
|
||||
#if TARGET_PC
|
||||
u8 getLoadedSeWave_1() { return loadedSeWave_1;}
|
||||
u8 getLoadedSeWave_2() { return loadedSeWave_2;}
|
||||
#endif
|
||||
|
||||
|
||||
private:
|
||||
/* 0x00 */ JAISoundID BGM_ID;
|
||||
@@ -158,10 +163,6 @@ enum Z2Scene {
|
||||
/* 0x4E */ Z2SCENE_GROTTO_ROCK_2,
|
||||
/* 0x4F */ Z2SCENE_GROTTO_POND,
|
||||
/* 0x50 */ Z2SCENE_FARON_WOODS_CAVE,
|
||||
|
||||
#if TARGET_PC
|
||||
/* 0x51 */ Z2SCENE_CAVE_OF_SHADOWS,
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif /* Z2SCENEMGR_H */
|
||||
|
||||
@@ -3913,6 +3913,16 @@ public:
|
||||
|
||||
static u32 getOtherHeapSize() { return 0xF0A60; }
|
||||
|
||||
#if TARGET_PC
|
||||
u16 getEventId() { return mMsgFlow.getEventId(); }
|
||||
|
||||
bool checkSwimming() {return checkModeFlg(MODE_SWIMMING);}
|
||||
|
||||
BE<short>** getDomeLockChromaTable() {
|
||||
return &field_0x0724->mAnmCRegDataR;
|
||||
}
|
||||
#endif
|
||||
|
||||
static DUSK_GAME_DATA daAlink_BckData const m_mainBckShield[20];
|
||||
static DUSK_GAME_DATA daAlink_BckData const m_mainBckSword[5];
|
||||
static DUSK_GAME_DATA daAlink_BckData const m_mainBckFishing[28];
|
||||
@@ -4560,8 +4570,6 @@ public:
|
||||
|
||||
void onIronBallChainInterpCallback();
|
||||
|
||||
f32 mLosStickValue;
|
||||
|
||||
static const int IRON_BALL_CHAIN_COUNT = 102;
|
||||
cXyz mIBChainInterpPrevPos[IRON_BALL_CHAIN_COUNT];
|
||||
cXyz mIBChainInterpCurrPos[IRON_BALL_CHAIN_COUNT];
|
||||
@@ -6393,7 +6401,8 @@ public:
|
||||
|
||||
class daAlinkHIO_huLight_c0 {
|
||||
public:
|
||||
static DUSK_GAME_DATA daAlinkHIO_huLight_c1 const m;
|
||||
static DUSK_GAME_DATA daAlinkHIO_huLight_c1 IF_NOT_DUSK(const) m;
|
||||
IF_DUSK(static DUSK_GAME_DATA daAlinkHIO_huLight_c1 const original;)
|
||||
};
|
||||
|
||||
class daAlinkHIO_wlLight_c1 {
|
||||
@@ -6467,7 +6476,8 @@ public:
|
||||
|
||||
class daAlinkHIO_kandelaar_c0 {
|
||||
public:
|
||||
static DUSK_GAME_DATA daAlinkHIO_kandelaar_c1 const m;
|
||||
static DUSK_GAME_DATA daAlinkHIO_kandelaar_c1 IF_NOT_DUSK(const) m;
|
||||
IF_DUSK(static DUSK_GAME_DATA daAlinkHIO_kandelaar_c1 const original;)
|
||||
};
|
||||
|
||||
class daAlinkHIO_kandelaar_c : public daAlinkHIO_data_c {
|
||||
|
||||
@@ -18,24 +18,16 @@ public:
|
||||
TGXTexObj& getTexObj() { return mTexObj; }
|
||||
cXyz* getQuad() { return mQuad; }
|
||||
|
||||
#if TARGET_PC
|
||||
// TP HD reflects across N floor quads (F_SP117 room 2 uses 6); GC uses 1.
|
||||
static const int MAX_QUADS = 6;
|
||||
#endif
|
||||
|
||||
/* 0x010 */ TGXTexObj mTexObj;
|
||||
/* 0x030 */ u8 mModelCount;
|
||||
/* 0x034 */ J3DModel* mModels[0x40];
|
||||
/* 0x134 */ cXyz mQuad[DUSK_IF_ELSE(MAX_QUADS*4, 4)];
|
||||
/* 0x134 */ cXyz mQuad[4];
|
||||
/* 0x164 */ cXyz mMinVal;
|
||||
/* 0x170 */ cXyz mMaxVal;
|
||||
/* 0x17C */ cXyz mViewScale;
|
||||
#if TARGET_PC
|
||||
bool mbReset = false;
|
||||
bool mbHadEntry = false;
|
||||
cXyz mQuadBoxMin[MAX_QUADS];
|
||||
cXyz mQuadBoxMax[MAX_QUADS];
|
||||
int mQuadCount = 1;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -120,7 +120,10 @@ public:
|
||||
BOOL chkAction(actionFunc action) { return action == mAction; }
|
||||
|
||||
static DUSK_GAME_DATA eventFunc mEvtSeqList[1];
|
||||
|
||||
#if TARGET_PC
|
||||
// Keep track of last given bug for rando
|
||||
static DUSK_GAME_DATA u8 mGivenInsectId;
|
||||
#endif
|
||||
private:
|
||||
/* 0xB48 */ Z2Creature mSound;
|
||||
/* 0xBD8 */ J3DModel* mpUmbrellaModel;
|
||||
|
||||
@@ -142,12 +142,12 @@ namespace daObjSwpush {
|
||||
int Mthd_Execute();
|
||||
int Mthd_Draw();
|
||||
|
||||
static DUSK_GAME_DATA s16 const M_bmd[DUSK_IF_ELSE(4, 3)];
|
||||
static DUSK_GAME_DATA s16 const M_dzb[DUSK_IF_ELSE(4, 3)];
|
||||
static DUSK_GAME_DATA u32 const M_heap_size[DUSK_IF_ELSE(4, 3)];
|
||||
static DUSK_GAME_DATA s16 const M_bmd[3];
|
||||
static DUSK_GAME_DATA s16 const M_dzb[3];
|
||||
static DUSK_GAME_DATA u32 const M_heap_size[3];
|
||||
static DUSK_GAME_DATA Hio_c::Attr_c const M_attr[5];
|
||||
static DUSK_GAME_DATA u8 const M_op_vtx[4];
|
||||
static DUSK_GAME_DATA DUSK_CONST char* M_arcname[DUSK_IF_ELSE(4, 3)];
|
||||
static DUSK_GAME_DATA DUSK_CONST char* M_arcname[3];
|
||||
|
||||
/* 0x568 */ request_of_phase_process_class mPhase;
|
||||
/* 0x570 */ dBgWSv* mpBgW;
|
||||
|
||||
@@ -64,6 +64,9 @@ public:
|
||||
virtual int Delete();
|
||||
virtual BOOL checkSmallTbox() { return true; }
|
||||
|
||||
#if TARGET_PC
|
||||
u8 getTboxNo() { return fopAcM_GetParamBit(this, 16, 8);}
|
||||
#endif
|
||||
u8 getModelType() { return fopAcM_GetParamBit(this, 8, 4); }
|
||||
u8 getItemNo() { return fopAcM_GetParamBit(this, 0, 8); }
|
||||
|
||||
|
||||
@@ -114,6 +114,10 @@ public:
|
||||
|
||||
bool checkBoomWindTgTimer() { return mBoomWindTgTimer == 0; }
|
||||
|
||||
#if TARGET_PC
|
||||
void setRandomizerItem(bool setFoolishItemModel = false);
|
||||
#endif
|
||||
|
||||
static DUSK_GAME_DATA procFunc mFuncPtr[];
|
||||
static DUSK_GAME_DATA const dCcD_SrcCyl m_cyl_src;
|
||||
static DUSK_GAME_DATA s32 m_timer_max;
|
||||
|
||||
@@ -7,4 +7,9 @@ class fopAc_ac_c;
|
||||
int CheckFieldItemCreateHeap(fopAc_ac_c* actor);
|
||||
int CheckItemCreateHeap(fopAc_ac_c* i_this);
|
||||
|
||||
#if TARGET_PC
|
||||
// Used for foolish items in rando. Foolish item model id is saved to home.angle.z
|
||||
#define M_ITEMNO_MODEL_ITEM_ID (IF_DUSK(randomizer_IsActive() && m_itemNo == dItemNo_Randomizer_FOOLISH_ITEM_e && home.angle.z != 0 ? home.angle.z :) m_itemNo)
|
||||
#endif
|
||||
|
||||
#endif /* D_A_D_A_ITEMBASE_STATIC_H */
|
||||
|
||||
@@ -74,7 +74,17 @@ public:
|
||||
s16 getAngleY() const { return mAngleY; }
|
||||
void setAngleY(s16 angle) { mAngleY = angle;}
|
||||
|
||||
#if TARGET_PC
|
||||
BOOL isRandomized() const;
|
||||
#endif
|
||||
|
||||
static DUSK_GAME_DATA ResourceData const mData[23];
|
||||
#if TARGET_PC
|
||||
static DUSK_GAME_DATA ResourceData mRandoData[23];
|
||||
#define M_SHOP_DATA (isRandomized() ? mRandoData : mData)
|
||||
#else
|
||||
#define M_SHOP_DATA mData
|
||||
#endif
|
||||
static DUSK_GAME_DATA f32 const m_cullfar_max;
|
||||
|
||||
enum {
|
||||
|
||||
@@ -474,6 +474,9 @@ public:
|
||||
s8 getNextStageRoomNo() { return mNextStage.getRoomNo(); }
|
||||
s8 getNextStageLayer() { return mNextStage.getLayer(); }
|
||||
BOOL isEnableNextStage() { return mNextStage.isEnable(); }
|
||||
#if TARGET_PC
|
||||
void setEnableNextStage() { return mNextStage.setEnable(); }
|
||||
#endif
|
||||
void offEnableNextStage() { mNextStage.offEnable(); }
|
||||
s8 getNextStageWipe() { return mNextStage.getWipe(); }
|
||||
u8 getNextStageWipeSpeed() { return mNextStage.getWipeSpeed(); }
|
||||
@@ -1276,6 +1279,10 @@ int dComIfGd_setShadow(u32 param_0, s8 param_1, J3DModel* param_2, cXyz* param_3
|
||||
f32 param_5, f32 param_6, f32 param_7, cBgS_PolyInfo& param_8,
|
||||
dKy_tevstr_c* param_9, s16 param_10, f32 param_11, TGXTexObj* param_12);
|
||||
|
||||
#if TARGET_PC
|
||||
void dComIfGs_setupRandomizerSave();
|
||||
#endif
|
||||
|
||||
inline dSv_info_c* dComIfGs_getSaveInfo() {
|
||||
return &g_dComIfG_gameInfo.info;
|
||||
}
|
||||
@@ -1336,9 +1343,13 @@ inline u8 dComIfGs_getSelectEquipShield() {
|
||||
return g_dComIfG_gameInfo.info.getPlayer().getPlayerStatusA().getSelectEquip(COLLECT_SHIELD);
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
u8 dComIfGs_getCollectSmell();
|
||||
#else
|
||||
inline u8 dComIfGs_getCollectSmell() {
|
||||
return g_dComIfG_gameInfo.info.getPlayer().getPlayerStatusA().getSelectEquip(COLLECT_SMELL);
|
||||
}
|
||||
#endif
|
||||
|
||||
inline void dComIfGs_setCollectSmell(u8 smell) {
|
||||
g_dComIfG_gameInfo.info.getPlayer().getPlayerStatusA().setSelectEquip(COLLECT_SMELL, smell);
|
||||
@@ -1428,6 +1439,12 @@ inline BOOL dComIfGs_isDarkClearLV(int i_no) {
|
||||
return g_dComIfG_gameInfo.info.getPlayer().getPlayerStatusB().isDarkClearLV(i_no);
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
inline u8 dComIfGs_getDarkClearLV() {
|
||||
return g_dComIfG_gameInfo.info.getPlayer().getPlayerStatusB().getDarkClearLV();
|
||||
}
|
||||
#endif
|
||||
|
||||
inline void dComIfGs_onTransformLV(int i_no) {
|
||||
g_dComIfG_gameInfo.info.getPlayer().getPlayerStatusB().onTransformLV(i_no);
|
||||
}
|
||||
@@ -1505,6 +1522,12 @@ inline void dComIfGs_onRegionBit(int i_region) {
|
||||
g_dComIfG_gameInfo.info.getPlayer().getPlayerFieldLastStayInfo().onRegionBit(i_region);
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
inline void dComIfGs_setRegionBit(u8 i_region) {
|
||||
g_dComIfG_gameInfo.info.getPlayer().getPlayerFieldLastStayInfo().setRegionBit(i_region);
|
||||
}
|
||||
#endif
|
||||
|
||||
inline void dComIfGs_setPlayerFieldLastStayInfo(const char* i_stage, cXyz& i_pos, s16 i_angle,
|
||||
s8 i_point, u8 i_region) {
|
||||
g_dComIfG_gameInfo.info.getPlayer().getPlayerFieldLastStayInfo().set(i_stage, i_pos, i_angle,
|
||||
@@ -1656,6 +1679,16 @@ inline void dComIfGs_setPachinkoNum(u8 i_num) {
|
||||
g_dComIfG_gameInfo.info.getPlayer().getItemRecord().setPachinkoNum(i_num);
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
inline u8 dComIfGs_getAncientDocumentNum() {
|
||||
return g_dComIfG_gameInfo.info.getPlayer().getItemRecord().getAncientDocumentNum();
|
||||
}
|
||||
|
||||
inline void dComIfGs_setAncientDocumentNum(u8 i_num) {
|
||||
g_dComIfG_gameInfo.info.getPlayer().getItemRecord().setAncientDocumentNum(i_num);
|
||||
}
|
||||
#endif
|
||||
|
||||
inline u8 dComIfGs_getPachinkoMax() {
|
||||
return 50;
|
||||
}
|
||||
@@ -1828,7 +1861,16 @@ inline u8 dComIfGs_getGetNumber(int i_no) {
|
||||
inline void dComIfGs_setGetNumber(int i_no, u8 i_value) {
|
||||
g_dComIfG_gameInfo.info.getPlayer().getLetterInfo().setGetNumber(i_no, i_value);
|
||||
}
|
||||
#if TARGET_PC
|
||||
// For rando
|
||||
inline void dComIfGs_setAllLetterGet() {
|
||||
g_dComIfG_gameInfo.info.getPlayer().getLetterInfo().setAllLetterGet();
|
||||
}
|
||||
|
||||
inline void dComIfGs_setAllLetterRead() {
|
||||
g_dComIfG_gameInfo.info.getPlayer().getLetterInfo().setAllLetterRead();
|
||||
}
|
||||
#endif
|
||||
inline void dComIfGs_addFishNum(u8 param_0) {
|
||||
g_dComIfG_gameInfo.info.getPlayer().getFishingInfo().addFishCount(param_0);
|
||||
}
|
||||
@@ -1944,6 +1986,16 @@ inline u8 dComIfGs_getPalLanguage() {
|
||||
return g_dComIfG_gameInfo.info.getPlayer().getConfig().getPalLanguage();
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
// Kinda hacky, but will do for now
|
||||
inline void dComIfGs_onRegionFlag(int i_stageNo, int i_no) {
|
||||
auto regionFlags = reinterpret_cast<u8*>(&g_dComIfG_gameInfo.info.getSavedata().getSave(i_stageNo).getBit());
|
||||
const int offset = i_no / 8;
|
||||
const int shift = i_no % 8;
|
||||
regionFlags[offset] |= (0x80 >> shift);
|
||||
}
|
||||
#endif
|
||||
|
||||
inline BOOL dComIfGs_isSaveTbox(int i_stageNo, int i_no) {
|
||||
return g_dComIfG_gameInfo.info.getSavedata().getSave(i_stageNo).getBit().isTbox(i_no);
|
||||
}
|
||||
@@ -2028,6 +2080,10 @@ inline void dComIfGs_setKeyNum(u8 i_keyNum) {
|
||||
g_dComIfG_gameInfo.info.getMemory().getBit().setKeyNum(i_keyNum);
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
u8 dComIfGs_getKeyNum(int i_stageNo);
|
||||
#endif
|
||||
|
||||
inline void dComIfGs_onDungeonItemMap() {
|
||||
g_dComIfG_gameInfo.info.getMemory().getBit().onDungeonItemMap();
|
||||
}
|
||||
@@ -2460,6 +2516,12 @@ inline s8 dComIfGp_getStartStageRoomNo() {
|
||||
return g_dComIfG_gameInfo.play.getStartStageRoomNo();
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
inline s8 dComIfGp_getLayerNo() {
|
||||
return g_dComIfG_gameInfo.play.getLayerNo(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
inline s8 dComIfGp_getStartStageLayer() {
|
||||
return g_dComIfG_gameInfo.play.getStartStageLayer();
|
||||
}
|
||||
@@ -2504,6 +2566,12 @@ inline void dComIfGp_offEnableNextStage() {
|
||||
g_dComIfG_gameInfo.play.offEnableNextStage();
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
inline void dComIfGp_setEnableNextStage() {
|
||||
g_dComIfG_gameInfo.play.setEnableNextStage();
|
||||
}
|
||||
#endif
|
||||
|
||||
inline s8 dComIfGp_getNextStageWipe() {
|
||||
return g_dComIfG_gameInfo.play.getNextStageWipe();
|
||||
}
|
||||
|
||||
@@ -27,11 +27,6 @@ public:
|
||||
void setSaveDate(dSv_save_c*);
|
||||
void setPlayTime(dSv_save_c*);
|
||||
void modeWait();
|
||||
|
||||
#if TARGET_PC
|
||||
void fileSelectWide();
|
||||
#endif
|
||||
|
||||
void modeMove();
|
||||
void _draw();
|
||||
|
||||
|
||||
@@ -203,6 +203,9 @@ public:
|
||||
DATASELPROC_DATA_SELECT_MOVE_ANIME,
|
||||
DATASELPROC_SELECT_DATA_OPEN_MOVE,
|
||||
DATASELPROC_SELECT_DATA_NAME_MOVE,
|
||||
#if TARGET_PC
|
||||
DATASELPROC_SELECT_DATA_PLAY_MOVE, // Select between vanilla or randomizer play
|
||||
#endif
|
||||
DATASELPROC_SELECT_DATA_OPENERASE_MOVE,
|
||||
DATASELPROC_MENU_SELECT,
|
||||
DATASELPROC_MENU_SELECT_MOVE_ANM,
|
||||
@@ -331,6 +334,9 @@ public:
|
||||
void makeRecInfo(u8);
|
||||
void selectDataOpenMove();
|
||||
void selectDataNameMove();
|
||||
#if TARGET_PC
|
||||
void selectDataPlayTypeMove();
|
||||
#endif
|
||||
void selectDataOpenEraseMove();
|
||||
void menuSelect();
|
||||
void menuSelectStart();
|
||||
@@ -732,7 +738,12 @@ public:
|
||||
/* 0x2378 */ J2DPicture* mpFadePict;
|
||||
#endif
|
||||
#ifdef TARGET_PC
|
||||
dDlst_FileSelFade_c mFadeDlst;
|
||||
struct mDusk {
|
||||
dDlst_FileSelFade_c mFadeDlst;
|
||||
bool mStartNameAnm;
|
||||
bool mBackToFileSelect;
|
||||
int mPendingRmlCloseFrames{0};
|
||||
} mDusk;
|
||||
#endif
|
||||
|
||||
#if PLATFORM_WII || PLATFORM_SHIELD
|
||||
@@ -743,7 +754,7 @@ public:
|
||||
};
|
||||
|
||||
#ifdef TARGET_PC
|
||||
STATIC_ASSERT(sizeof(dFile_select_c) == 0x237C + sizeof(dDlst_FileSelFade_c));
|
||||
STATIC_ASSERT(sizeof(dFile_select_c) == 0x237C + sizeof(dFile_select_c::mDusk));
|
||||
#else
|
||||
STATIC_ASSERT(sizeof(dFile_select_c) == 0x237C);
|
||||
#endif
|
||||
|
||||
+134
-4
@@ -32,6 +32,11 @@ void item_func_ARROW_20();
|
||||
void item_func_ARROW_30();
|
||||
void item_func_ARROW_1();
|
||||
void item_func_PACHINKO_SHOT();
|
||||
#if TARGET_PC
|
||||
void item_func_FOOLISH_ITEM();
|
||||
void item_func_ORDON_PORTAL();
|
||||
void item_func_SOUTH_FARON_PORTAL();
|
||||
#endif
|
||||
void item_func_WATER_BOMB_5();
|
||||
void item_func_WATER_BOMB_10();
|
||||
void item_func_WATER_BOMB_20();
|
||||
@@ -65,6 +70,12 @@ void item_func_DUNGEON_EXIT_2();
|
||||
void item_func_WALLET_LV1();
|
||||
void item_func_WALLET_LV2();
|
||||
void item_func_WALLET_LV3();
|
||||
#if TARGET_PC
|
||||
void item_func_UPPER_ZORAS_RIVER_PORTAL();
|
||||
void item_func_CASTLE_TOWN_PORTAL();
|
||||
void item_func_GERUDO_DESERT_PORTAL();
|
||||
void item_func_NORTH_FARON_PORTAL();
|
||||
#endif
|
||||
void item_func_ZORAS_JEWEL();
|
||||
void item_func_HAWK_EYE();
|
||||
void item_func_WOOD_STICK();
|
||||
@@ -81,13 +92,23 @@ void item_func_LIGHT_SWORD();
|
||||
void item_func_FISHING_ROD_1();
|
||||
void item_func_PACHINKO();
|
||||
void item_func_COPY_ROD_2();
|
||||
#if TARGET_PC
|
||||
void item_func_KAKARIKO_GORGE_PORTAL();
|
||||
void item_func_KAKARIKO_VILLAGE_PORTAL();
|
||||
#endif
|
||||
void item_func_BOMB_BAG_LV2();
|
||||
void item_func_BOMB_BAG_LV1();
|
||||
void item_func_BOMB_IN_BAG();
|
||||
#if TARGET_PC
|
||||
void item_func_DEATH_MOUNTAIN_PORTAL();
|
||||
#endif
|
||||
void item_func_LIGHT_ARROW();
|
||||
void item_func_ARROW_LV1();
|
||||
void item_func_ARROW_LV2();
|
||||
void item_func_ARROW_LV3();
|
||||
#if TARGET_PC
|
||||
void item_func_ZORAS_DOMAIN_PORTAL();
|
||||
#endif
|
||||
void item_func_LURE_ROD();
|
||||
void item_func_BOMB_ARROW();
|
||||
void item_func_HAWK_ARROW();
|
||||
@@ -133,8 +154,33 @@ void item_func_BILL();
|
||||
void item_func_WOOD_STATUE();
|
||||
void item_func_IRIAS_PENDANT();
|
||||
void item_func_HORSE_FLUTE();
|
||||
#if TARGET_PC
|
||||
void item_func_FOREST_SMALL_KEY();
|
||||
void item_func_MINES_SMALL_KEY();
|
||||
void item_func_LAKEBED_SMALL_KEY();
|
||||
void item_func_ARBITERS_SMALL_KEY();
|
||||
void item_func_SNOWPEAK_SMALL_KEY();
|
||||
void item_func_TEMPLE_OF_TIME_SMALL_KEY();
|
||||
void item_func_CITY_SMALL_KEY();
|
||||
void item_func_PALACE_SMALL_KEY();
|
||||
void item_func_HYRULE_SMALL_KEY();
|
||||
void item_func_CAMP_SMALL_KEY();
|
||||
void item_func_LAKE_HYLIA_PORTAL();
|
||||
#endif
|
||||
void item_func_RAFRELS_MEMO();
|
||||
void item_func_ASHS_SCRIBBLING();
|
||||
#if TARGET_PC
|
||||
void item_func_FOREST_BOSS_KEY();
|
||||
void item_func_LAKEBED_BOSS_KEY();
|
||||
void item_func_ARBITERS_BOSS_KEY();
|
||||
void item_func_TEMPLE_OF_TIME_BOSS_KEY();
|
||||
void item_func_CITY_BOSS_KEY();
|
||||
void item_func_PALACE_BOSS_KEY();
|
||||
void item_func_HYRULE_BOSS_KEY();
|
||||
void item_func_FOREST_COMPASS();
|
||||
void item_func_MINES_COMPASS();
|
||||
void item_func_LAKEBED_COMPASS();
|
||||
#endif
|
||||
void item_func_CHUCHU_YELLOW2();
|
||||
void item_func_OIL_BOTTLE3();
|
||||
void item_func_SHOP_BEE_CHILD();
|
||||
@@ -147,12 +193,34 @@ void item_func_FILLED_CONTAINER();
|
||||
void item_func_MIRROR_PIECE_2();
|
||||
void item_func_MIRROR_PIECE_3();
|
||||
void item_func_MIRROR_PIECE_4();
|
||||
#if TARGET_PC
|
||||
void item_func_ARBITERS_COMPASS();
|
||||
void item_func_SNOWPEAK_COMPASS();
|
||||
void item_func_TEMPLE_OF_TIME_COMPASS();
|
||||
void item_func_CITY_COMPASS();
|
||||
void item_func_PALACE_COMPASS();
|
||||
void item_func_HYRULE_COMPASS();
|
||||
void item_func_MIRROR_CHAMBER_PORTAL();
|
||||
void item_func_SNOWPEAK_PORTAL();
|
||||
#endif
|
||||
void item_func_SMELL_YELIA_POUCH();
|
||||
void item_func_SMELL_PUMPKIN();
|
||||
void item_func_SMELL_POH();
|
||||
void item_func_SMELL_FISH();
|
||||
void item_func_SMELL_CHILDREN();
|
||||
void item_func_SMELL_MEDICINE();
|
||||
#if TARGET_PC
|
||||
void item_func_FOREST_MAP();
|
||||
void item_func_MINES_MAP();
|
||||
void item_func_LAKEBED_MAP();
|
||||
void item_func_ARBITERS_MAP();
|
||||
void item_func_SNOWPEAK_MAP();
|
||||
void item_func_TEMPLE_OF_TIME_MAP();
|
||||
void item_func_CITY_MAP();
|
||||
void item_func_PALACE_MAP();
|
||||
void item_func_HYRULE_MAP();
|
||||
void item_func_SACRED_GROVE_PORTAL();
|
||||
#endif
|
||||
void item_func_M_BEETLE();
|
||||
void item_func_F_BEETLE();
|
||||
void item_func_M_BUTTERFLY();
|
||||
@@ -177,7 +245,23 @@ void item_func_M_ANT();
|
||||
void item_func_F_ANT();
|
||||
void item_func_M_MAYFLY();
|
||||
void item_func_F_MAYFLY();
|
||||
#if TARGET_PC
|
||||
void item_func_FUSED_SHADOW_1();
|
||||
void item_func_FUSED_SHADOW_2();
|
||||
void item_func_FUSED_SHADOW_3();
|
||||
void item_func_MIRROR_PIECE_1();
|
||||
#endif
|
||||
void item_func_POU_SPIRIT();
|
||||
#if TARGET_PC
|
||||
void item_func_ENDING_BLOW();
|
||||
void item_func_SHIELD_ATTACK();
|
||||
void item_func_BACK_SLICE();
|
||||
void item_func_HELM_SPLITTER();
|
||||
void item_func_MORTAL_DRAW();
|
||||
void item_func_JUMP_STRIKE();
|
||||
void item_func_GREAT_SPIN();
|
||||
void item_func_ELDIN_BRIDGE_PORTAL();
|
||||
#endif
|
||||
void item_func_ANCIENT_DOCUMENT();
|
||||
void item_func_AIR_LETTER();
|
||||
void item_func_ANCIENT_DOCUMENT2();
|
||||
@@ -221,6 +305,10 @@ int item_getcheck_func_ARROW_20();
|
||||
int item_getcheck_func_ARROW_30();
|
||||
int item_getcheck_func_ARROW_1();
|
||||
int item_getcheck_func_PACHINKO_SHOT();
|
||||
#if TARGET_PC
|
||||
int item_getcheck_func_ORDON_PORTAL();
|
||||
int item_getcheck_func_SOUTH_FARON_PORTAL();
|
||||
#endif
|
||||
int item_getcheck_func_WATER_BOMB_5();
|
||||
int item_getcheck_func_WATER_BOMB_10();
|
||||
int item_getcheck_func_WATER_BOMB_20();
|
||||
@@ -254,6 +342,12 @@ int item_getcheck_func_DUNGEON_EXIT_2();
|
||||
int item_getcheck_func_WALLET_LV1();
|
||||
int item_getcheck_func_WALLET_LV2();
|
||||
int item_getcheck_func_WALLET_LV3();
|
||||
#if TARGET_PC
|
||||
int item_getcheck_func_UPPER_ZORAS_RIVER_PORTAL();
|
||||
int item_getcheck_func_CASTLE_TOWN_PORTAL();
|
||||
int item_getcheck_func_GERUDO_DESERT_PORTAL();
|
||||
int item_getcheck_func_NORTH_FARON_PORTAL();
|
||||
#endif
|
||||
int item_getcheck_func_ZORAS_JEWEL();
|
||||
int item_getcheck_func_HAWK_EYE();
|
||||
int item_getcheck_func_WOOD_STICK();
|
||||
@@ -270,13 +364,23 @@ int item_getcheck_func_LIGHT_SWORD();
|
||||
int item_getcheck_func_FISHING_ROD_1();
|
||||
int item_getcheck_func_PACHINKO();
|
||||
int item_getcheck_func_COPY_ROD_2();
|
||||
#if TARGET_PC
|
||||
int item_getcheck_func_KAKARIKO_GORGE_PORTAL();
|
||||
int item_getcheck_func_KAKARIKO_VILLAGE_PORTAL();
|
||||
#endif
|
||||
int item_getcheck_func_BOMB_BAG_LV2();
|
||||
int item_getcheck_func_BOMB_BAG_LV1();
|
||||
int item_getcheck_func_BOMB_IN_BAG();
|
||||
#if TARGET_PC
|
||||
int item_getcheck_func_DEATH_MOUNTAIN_PORTAL();
|
||||
#endif
|
||||
int item_getcheck_func_LIGHT_ARROW();
|
||||
int item_getcheck_func_ARROW_LV1();
|
||||
int item_getcheck_func_ARROW_LV2();
|
||||
int item_getcheck_func_ARROW_LV3();
|
||||
#if TARGET_PC
|
||||
int item_getcheck_func_ZORAS_DOMAIN_PORTAL();
|
||||
#endif
|
||||
int item_getcheck_func_LURE_ROD();
|
||||
int item_getcheck_func_BOMB_ARROW();
|
||||
int item_getcheck_func_HAWK_ARROW();
|
||||
@@ -322,6 +426,10 @@ int item_getcheck_func_BILL();
|
||||
int item_getcheck_func_WOOD_STATUE();
|
||||
int item_getcheck_func_IRIAS_PENDANT();
|
||||
int item_getcheck_func_HORSE_FLUTE();
|
||||
#if TARGET_PC
|
||||
int item_getcheck_func_CAMP_SMALL_KEY();
|
||||
int item_getcheck_func_LAKE_HYLIA_PORTAL();
|
||||
#endif
|
||||
int item_getcheck_func_RAFRELS_MEMO();
|
||||
int item_getcheck_func_ASHS_SCRIBBLING();
|
||||
int item_getcheck_func_CHUCHU_YELLOW2();
|
||||
@@ -336,12 +444,19 @@ int item_getcheck_func_FILLED_CONTAINER();
|
||||
int item_getcheck_func_MIRROR_PIECE_2();
|
||||
int item_getcheck_func_MIRROR_PIECE_3();
|
||||
int item_getcheck_func_MIRROR_PIECE_4();
|
||||
#if TARGET_PC
|
||||
int item_getcheck_func_MIRROR_CHAMBER_PORTAL();
|
||||
int item_getcheck_func_SNOWPEAK_PORTAL();
|
||||
#endif
|
||||
int item_getcheck_func_SMELL_YELIA_POUCH();
|
||||
int item_getcheck_func_SMELL_PUMPKIN();
|
||||
int item_getcheck_func_SMELL_POH();
|
||||
int item_getcheck_func_SMELL_FISH();
|
||||
int item_getcheck_func_SMELL_CHILDREN();
|
||||
int item_getcheck_func_SMELL_MEDICINE();
|
||||
#if TARGET_PC
|
||||
int item_getcheck_func_SACRED_GROVE_PORTAL();
|
||||
#endif
|
||||
int item_getcheck_func_M_BEETLE();
|
||||
int item_getcheck_func_F_BEETLE();
|
||||
int item_getcheck_func_M_BUTTERFLY();
|
||||
@@ -366,7 +481,23 @@ int item_getcheck_func_M_ANT();
|
||||
int item_getcheck_func_F_ANT();
|
||||
int item_getcheck_func_M_MAYFLY();
|
||||
int item_getcheck_func_F_MAYFLY();
|
||||
#if TARGET_PC
|
||||
int item_getcheck_func_FUSED_SHADOW_1();
|
||||
int item_getcheck_func_FUSED_SHADOW_2();
|
||||
int item_getcheck_func_FUSED_SHADOW_3();
|
||||
int item_getcheck_func_MIRROR_PIECE_1();
|
||||
#endif
|
||||
int item_getcheck_func_POU_SPIRIT();
|
||||
#if TARGET_PC
|
||||
int item_getcheck_func_ENDING_BLOW();
|
||||
int item_getcheck_func_SHIELD_ATTACK();
|
||||
int item_getcheck_func_BACK_SLICE();
|
||||
int item_getcheck_func_HELM_SPLITTER();
|
||||
int item_getcheck_func_MORTAL_DRAW();
|
||||
int item_getcheck_func_JUMP_STRIKE();
|
||||
int item_getcheck_func_GREAT_SPIN();
|
||||
int item_getcheck_func_ELDIN_BRIDGE_PORTAL();
|
||||
#endif
|
||||
int item_getcheck_func_ANCIENT_DOCUMENT();
|
||||
int item_getcheck_func_AIR_LETTER();
|
||||
int item_getcheck_func_ANCIENT_DOCUMENT2();
|
||||
@@ -395,13 +526,12 @@ int checkItemGet(u8, int);
|
||||
BOOL isHeart(u8 item_no);
|
||||
int isBomb(u8);
|
||||
int isArrow(u8);
|
||||
#if TARGET_PC
|
||||
int isRupee(u8);
|
||||
#endif
|
||||
int addBombCount(u8, u8);
|
||||
BOOL isBottleItem(u8 item_no);
|
||||
u8 check_itemno(int i_itemNo);
|
||||
BOOL isInsect(u8 i_itemNo);
|
||||
|
||||
#if TARGET_PC
|
||||
void item_func_WALLET_LV4();
|
||||
#endif
|
||||
|
||||
#endif /* D_D_ITEM_H */
|
||||
|
||||
+323
-7
@@ -35,7 +35,65 @@ struct dItem_fieldItemResource {
|
||||
/* 0xC */ u16 mHeapSize;
|
||||
}; // Size: 0x10
|
||||
|
||||
#if TARGET_PC
|
||||
// Delcared helper functions since we can't include dComIfg_isRandomizer here
|
||||
dItem_itemResource* dItem_data_getItemResource();
|
||||
dItem_fieldItemResource* dItem_data_getFieldItemResource();
|
||||
dItem_itemInfo* dItem_data_getItemInfo();
|
||||
#endif
|
||||
|
||||
struct dItem_data {
|
||||
#if TARGET_PC
|
||||
static const char* getArcName(u8 index) { return dItem_data_getItemResource()[index].mArcName; }
|
||||
|
||||
static s16 getBtpName(u8 index) { return dItem_data_getItemResource()[index].mBtpName; }
|
||||
|
||||
static s16 getBrkName(u8 index) { return dItem_data_getItemResource()[index].mBrkName; }
|
||||
|
||||
static s16 getBxaName(u8 index) { return -1; }
|
||||
|
||||
static s16 getBckName(u8 index) { return dItem_data_getItemResource()[index].mBckName; }
|
||||
|
||||
static s16 getBpkName(u8 index) { return -1; }
|
||||
|
||||
static s16 getBtkName(u8 index) { return dItem_data_getItemResource()[index].mBtkName; }
|
||||
|
||||
static s16 getBmdName(u8 index) { return dItem_data_getItemResource()[index].mBmdName; }
|
||||
|
||||
static s8 getTevFrm(u8 index) { return dItem_data_getItemResource()[index].mTevFrm; }
|
||||
|
||||
static s8 getBtpFrm(u8 index) { return dItem_data_getItemResource()[index].mBtpFrm; }
|
||||
|
||||
static s16 getTexture(u8 index) { return dItem_data_getItemResource()[index].mTexture; }
|
||||
|
||||
static u8 getTexScale (u8 index) { return dItem_data_getItemResource()[index].mTexScale; }
|
||||
|
||||
static const char* getFieldArc(u8 index) { return dItem_data_getFieldItemResource()[index].mFieldArc; }
|
||||
|
||||
static s16 getItemBmdName(u8 index) { return dItem_data_getFieldItemResource()[index].mItemBmdName; }
|
||||
|
||||
static s16 getItemBtkName(u8 index) { return -1; }
|
||||
|
||||
static s16 getItemBpkName(u8 index) { return -1; }
|
||||
|
||||
static s16 getItemBckName(u8 index) { return dItem_data_getFieldItemResource()[index].mItemBckName; }
|
||||
|
||||
static s16 getItemBxaName(u8 index) { return -1; }
|
||||
|
||||
static s16 getItemBrkName(u8 index) { return dItem_data_getFieldItemResource()[index].mItemBrkName; }
|
||||
|
||||
static s16 getItemBtpName(u8 index) { return -1; }
|
||||
|
||||
static BOOL chkFlag(u8 index, int flag) { return dItem_data_getItemInfo()[index].mFlag & flag; }
|
||||
|
||||
static u8 getShadowSize(u8 index) { return dItem_data_getItemInfo()[index].mShadowSize; }
|
||||
|
||||
static const u8 getH(u8 index) { return dItem_data_getItemInfo()[index].mH; }
|
||||
|
||||
static const u8 getR(u8 index) { return dItem_data_getItemInfo()[index].mR; }
|
||||
|
||||
static u16 getFieldHeapSize(u8 index) { return dItem_data_getFieldItemResource()[index].mHeapSize; }
|
||||
#else
|
||||
static const char* getArcName(u8 index) { return item_resource[index].mArcName; }
|
||||
|
||||
static s16 getBtpName(u8 index) { return item_resource[index].mBtpName; }
|
||||
@@ -58,11 +116,7 @@ struct dItem_data {
|
||||
|
||||
static s16 getTexture(u8 index) { return item_resource[index].mTexture; }
|
||||
|
||||
#if TARGET_PC
|
||||
static u8 getTexScale(u8 index);
|
||||
#else
|
||||
static u8 getTexScale(u8 index) { return item_resource[index].mTexScale; }
|
||||
#endif
|
||||
static u8 getTexScale (u8 index) { return item_resource[index].mTexScale; }
|
||||
|
||||
static const char* getFieldArc(u8 index) { return field_item_res[index].mFieldArc; }
|
||||
|
||||
@@ -89,10 +143,16 @@ struct dItem_data {
|
||||
static const u8 getR(u8 index) { return item_info[index].mR; }
|
||||
|
||||
static u16 getFieldHeapSize(u8 index) { return field_item_res[index].mHeapSize; }
|
||||
#endif
|
||||
|
||||
static DUSK_GAME_DATA dItem_itemResource item_resource[255];
|
||||
static DUSK_GAME_DATA dItem_fieldItemResource field_item_res[255];
|
||||
static DUSK_GAME_DATA dItem_itemInfo item_info[255];
|
||||
#if TARGET_PC
|
||||
static DUSK_GAME_DATA dItem_itemResource item_resource_randomizer[255];
|
||||
static DUSK_GAME_DATA dItem_fieldItemResource field_item_res_randomizer[255];
|
||||
static DUSK_GAME_DATA dItem_itemInfo item_info_randomizer[255];
|
||||
#endif
|
||||
};
|
||||
|
||||
enum {
|
||||
@@ -355,9 +415,265 @@ enum {
|
||||
};
|
||||
|
||||
#if TARGET_PC
|
||||
// HD item mappings
|
||||
// Randomizer item ids. Mostly the same, but we use most unused
|
||||
// entries for custom portals and keys
|
||||
enum {
|
||||
dItemNo_WALLET_LV4_e = 0xDA,
|
||||
/* 0x00 */ dItemNo_Randomizer_HEART_e,
|
||||
/* 0x01 */ dItemNo_Randomizer_GREEN_RUPEE_e,
|
||||
/* 0x02 */ dItemNo_Randomizer_BLUE_RUPEE_e,
|
||||
/* 0x03 */ dItemNo_Randomizer_YELLOW_RUPEE_e,
|
||||
/* 0x04 */ dItemNo_Randomizer_RED_RUPEE_e,
|
||||
/* 0x05 */ dItemNo_Randomizer_PURPLE_RUPEE_e,
|
||||
/* 0x06 */ dItemNo_Randomizer_ORANGE_RUPEE_e,
|
||||
/* 0x07 */ dItemNo_Randomizer_SILVER_RUPEE_e,
|
||||
/* 0x08 */ dItemNo_Randomizer_S_MAGIC_e,
|
||||
/* 0x09 */ dItemNo_Randomizer_L_MAGIC_e,
|
||||
/* 0x0A */ dItemNo_Randomizer_BOMB_5_e,
|
||||
/* 0x0B */ dItemNo_Randomizer_BOMB_10_e,
|
||||
/* 0x0C */ dItemNo_Randomizer_BOMB_20_e,
|
||||
/* 0x0D */ dItemNo_Randomizer_BOMB_30_e,
|
||||
/* 0x0E */ dItemNo_Randomizer_ARROW_10_e,
|
||||
/* 0x0F */ dItemNo_Randomizer_ARROW_20_e,
|
||||
/* 0x10 */ dItemNo_Randomizer_ARROW_30_e,
|
||||
/* 0x11 */ dItemNo_Randomizer_ARROW_1_e,
|
||||
/* 0x12 */ dItemNo_Randomizer_PACHINKO_SHOT_e,
|
||||
/* 0x13 */ dItemNo_Randomizer_FOOLISH_ITEM_e,
|
||||
/* 0x14 */ dItemNo_Randomizer_ORDON_PORTAL_e,
|
||||
/* 0x15 */ dItemNo_Randomizer_SOUTH_FARON_PORTAL_e,
|
||||
/* 0x16 */ dItemNo_Randomizer_WATER_BOMB_5_e,
|
||||
/* 0x17 */ dItemNo_Randomizer_WATER_BOMB_10_e,
|
||||
/* 0x18 */ dItemNo_Randomizer_WATER_BOMB_20_e,
|
||||
/* 0x19 */ dItemNo_Randomizer_WATER_BOMB_30_e,
|
||||
/* 0x1A */ dItemNo_Randomizer_BOMB_INSECT_5_e,
|
||||
/* 0x1B */ dItemNo_Randomizer_BOMB_INSECT_10_e,
|
||||
/* 0x1C */ dItemNo_Randomizer_BOMB_INSECT_20_e,
|
||||
/* 0x1D */ dItemNo_Randomizer_BOMB_INSECT_30_e,
|
||||
/* 0x1E */ dItemNo_Randomizer_RECOVERY_FAILY_e,
|
||||
/* 0x1F */ dItemNo_Randomizer_TRIPLE_HEART_e,
|
||||
/* 0x20 */ dItemNo_Randomizer_SMALL_KEY_e,
|
||||
/* 0x21 */ dItemNo_Randomizer_KAKERA_HEART_e,
|
||||
/* 0x22 */ dItemNo_Randomizer_UTAWA_HEART_e,
|
||||
/* 0x23 */ dItemNo_Randomizer_MAP_e,
|
||||
/* 0x24 */ dItemNo_Randomizer_COMPUS_e,
|
||||
/* 0x25 */ dItemNo_Randomizer_DUNGEON_EXIT_e,
|
||||
/* 0x26 */ dItemNo_Randomizer_BOSS_KEY_e,
|
||||
/* 0x27 */ dItemNo_Randomizer_DUNGEON_BACK_e,
|
||||
/* 0x28 */ dItemNo_Randomizer_SWORD_e,
|
||||
/* 0x29 */ dItemNo_Randomizer_MASTER_SWORD_e,
|
||||
/* 0x2A */ dItemNo_Randomizer_WOOD_SHIELD_e,
|
||||
/* 0x2B */ dItemNo_Randomizer_SHIELD_e,
|
||||
/* 0x2C */ dItemNo_Randomizer_HYLIA_SHIELD_e,
|
||||
/* 0x2D */ dItemNo_Randomizer_TKS_LETTER_e,
|
||||
/* 0x2E */ dItemNo_Randomizer_WEAR_CASUAL_e,
|
||||
/* 0x2F */ dItemNo_Randomizer_WEAR_KOKIRI_e,
|
||||
/* 0x30 */ dItemNo_Randomizer_ARMOR_e,
|
||||
/* 0x31 */ dItemNo_Randomizer_WEAR_ZORA_e,
|
||||
/* 0x32 */ dItemNo_Randomizer_MAGIC_LV1_e,
|
||||
/* 0x33 */ dItemNo_Randomizer_DUNGEON_EXIT_2_e,
|
||||
/* 0x34 */ dItemNo_Randomizer_WALLET_LV1_e,
|
||||
/* 0x35 */ dItemNo_Randomizer_WALLET_LV2_e,
|
||||
/* 0x36 */ dItemNo_Randomizer_WALLET_LV3_e,
|
||||
/* 0x37 */ dItemNo_Randomizer_NOENTRY_55_e,
|
||||
/* 0x38 */ dItemNo_Randomizer_NOENTRY_56_e,
|
||||
/* 0x39 */ dItemNo_Randomizer_UPPER_ZORAS_RIVER_PORTAL_e,
|
||||
/* 0x3A */ dItemNo_Randomizer_CASTLE_TOWN_PORTAL_e,
|
||||
/* 0x3B */ dItemNo_Randomizer_GERUDO_DESERT_PORTAL_e,
|
||||
/* 0x3C */ dItemNo_Randomizer_NORTH_FARON_PORTAL_e,
|
||||
/* 0x3D */ dItemNo_Randomizer_ZORAS_JEWEL_e,
|
||||
/* 0x3E */ dItemNo_Randomizer_HAWK_EYE_e,
|
||||
/* 0x3F */ dItemNo_Randomizer_WOOD_STICK_e,
|
||||
/* 0x40 */ dItemNo_Randomizer_BOOMERANG_e,
|
||||
/* 0x41 */ dItemNo_Randomizer_SPINNER_e,
|
||||
/* 0x42 */ dItemNo_Randomizer_IRONBALL_e,
|
||||
/* 0x43 */ dItemNo_Randomizer_BOW_e,
|
||||
/* 0x44 */ dItemNo_Randomizer_HOOKSHOT_e,
|
||||
/* 0x45 */ dItemNo_Randomizer_HVY_BOOTS_e,
|
||||
/* 0x46 */ dItemNo_Randomizer_COPY_ROD_e,
|
||||
/* 0x47 */ dItemNo_Randomizer_W_HOOKSHOT_e,
|
||||
/* 0x48 */ dItemNo_Randomizer_KANTERA_e,
|
||||
/* 0x49 */ dItemNo_Randomizer_LIGHT_SWORD_e,
|
||||
/* 0x4A */ dItemNo_Randomizer_FISHING_ROD_1_e,
|
||||
/* 0x4B */ dItemNo_Randomizer_PACHINKO_e,
|
||||
/* 0x4C */ dItemNo_Randomizer_COPY_ROD_2_e,
|
||||
/* 0x4D */ dItemNo_Randomizer_KAKARIKO_GORGE_PORTAL_e,
|
||||
/* 0x4E */ dItemNo_Randomizer_KAKARIKO_VILLAGE_PORTAL_e,
|
||||
/* 0x4F */ dItemNo_Randomizer_BOMB_BAG_LV2_e,
|
||||
/* 0x50 */ dItemNo_Randomizer_BOMB_BAG_LV1_e,
|
||||
/* 0x51 */ dItemNo_Randomizer_BOMB_IN_BAG_e,
|
||||
/* 0x52 */ dItemNo_Randomizer_DEATH_MOUNTAIN_PORTAL_e,
|
||||
/* 0x53 */ dItemNo_Randomizer_LIGHT_ARROW_e,
|
||||
/* 0x54 */ dItemNo_Randomizer_ARROW_LV1_e,
|
||||
/* 0x55 */ dItemNo_Randomizer_ARROW_LV2_e,
|
||||
/* 0x56 */ dItemNo_Randomizer_ARROW_LV3_e,
|
||||
/* 0x57 */ dItemNo_Randomizer_ZORAS_DOMAIN_PORTAL_e,
|
||||
/* 0x58 */ dItemNo_Randomizer_LURE_ROD_e,
|
||||
/* 0x59 */ dItemNo_Randomizer_BOMB_ARROW_e,
|
||||
/* 0x5A */ dItemNo_Randomizer_HAWK_ARROW_e,
|
||||
/* 0x5B */ dItemNo_Randomizer_BEE_ROD_e,
|
||||
/* 0x5C */ dItemNo_Randomizer_JEWEL_ROD_e,
|
||||
/* 0x5D */ dItemNo_Randomizer_WORM_ROD_e,
|
||||
/* 0x5E */ dItemNo_Randomizer_JEWEL_BEE_ROD_e,
|
||||
/* 0x5F */ dItemNo_Randomizer_JEWEL_WORM_ROD_e,
|
||||
/* 0x60 */ dItemNo_Randomizer_EMPTY_BOTTLE_e,
|
||||
/* 0x61 */ dItemNo_Randomizer_RED_BOTTLE_e,
|
||||
/* 0x62 */ dItemNo_Randomizer_GREEN_BOTTLE_e,
|
||||
/* 0x63 */ dItemNo_Randomizer_BLUE_BOTTLE_e,
|
||||
/* 0x64 */ dItemNo_Randomizer_MILK_BOTTLE_e,
|
||||
/* 0x65 */ dItemNo_Randomizer_HALF_MILK_BOTTLE_e,
|
||||
/* 0x66 */ dItemNo_Randomizer_OIL_BOTTLE_e,
|
||||
/* 0x67 */ dItemNo_Randomizer_WATER_BOTTLE_e,
|
||||
/* 0x68 */ dItemNo_Randomizer_OIL_BOTTLE_2_e,
|
||||
/* 0x69 */ dItemNo_Randomizer_RED_BOTTLE_2_e,
|
||||
/* 0x6A */ dItemNo_Randomizer_UGLY_SOUP_e,
|
||||
/* 0x6B */ dItemNo_Randomizer_HOT_SPRING_e,
|
||||
/* 0x6C */ dItemNo_Randomizer_FAIRY_e,
|
||||
/* 0x6D */ dItemNo_Randomizer_HOT_SPRING_2_e,
|
||||
/* 0x6E */ dItemNo_Randomizer_OIL2_e,
|
||||
/* 0x6F */ dItemNo_Randomizer_OIL_e,
|
||||
/* 0x70 */ dItemNo_Randomizer_NORMAL_BOMB_e,
|
||||
/* 0x71 */ dItemNo_Randomizer_WATER_BOMB_e,
|
||||
/* 0x72 */ dItemNo_Randomizer_POKE_BOMB_e,
|
||||
/* 0x73 */ dItemNo_Randomizer_FAIRY_DROP_e,
|
||||
/* 0x74 */ dItemNo_Randomizer_WORM_e,
|
||||
/* 0x75 */ dItemNo_Randomizer_DROP_BOTTLE_e,
|
||||
/* 0x76 */ dItemNo_Randomizer_BEE_CHILD_e,
|
||||
/* 0x77 */ dItemNo_Randomizer_CHUCHU_RARE_e,
|
||||
/* 0x78 */ dItemNo_Randomizer_CHUCHU_RED_e,
|
||||
/* 0x79 */ dItemNo_Randomizer_CHUCHU_BLUE_e,
|
||||
/* 0x7A */ dItemNo_Randomizer_CHUCHU_GREEN_e,
|
||||
/* 0x7B */ dItemNo_Randomizer_CHUCHU_YELLOW_e,
|
||||
/* 0x7C */ dItemNo_Randomizer_CHUCHU_PURPLE_e,
|
||||
/* 0x7D */ dItemNo_Randomizer_LV1_SOUP_e,
|
||||
/* 0x7E */ dItemNo_Randomizer_LV2_SOUP_e,
|
||||
/* 0x7F */ dItemNo_Randomizer_LV3_SOUP_e,
|
||||
/* 0x80 */ dItemNo_Randomizer_LETTER_e,
|
||||
/* 0x81 */ dItemNo_Randomizer_BILL_e,
|
||||
/* 0x82 */ dItemNo_Randomizer_WOOD_STATUE_e,
|
||||
/* 0x83 */ dItemNo_Randomizer_IRIAS_PENDANT_e,
|
||||
/* 0x84 */ dItemNo_Randomizer_HORSE_FLUTE_e,
|
||||
/* 0x85 */ dItemNo_Randomizer_FOREST_SMALL_KEY_e,
|
||||
/* 0x86 */ dItemNo_Randomizer_MINES_SMALL_KEY_e,
|
||||
/* 0x87 */ dItemNo_Randomizer_LAKEBED_SMALL_KEY_e,
|
||||
/* 0x88 */ dItemNo_Randomizer_ARBITERS_SMALL_KEY_e,
|
||||
/* 0x89 */ dItemNo_Randomizer_SNOWPEAK_SMALL_KEY_e,
|
||||
/* 0x8A */ dItemNo_Randomizer_TEMPLE_OF_TIME_SMALL_KEY_e,
|
||||
/* 0x8B */ dItemNo_Randomizer_CITY_SMALL_KEY_e,
|
||||
/* 0x8C */ dItemNo_Randomizer_PALACE_SMALL_KEY_e,
|
||||
/* 0x8D */ dItemNo_Randomizer_HYRULE_SMALL_KEY_e,
|
||||
/* 0x8E */ dItemNo_Randomizer_CAMP_SMALL_KEY_e,
|
||||
/* 0x8F */ dItemNo_Randomizer_LAKE_HYLIA_PORTAL_e,
|
||||
/* 0x90 */ dItemNo_Randomizer_RAFRELS_MEMO_e,
|
||||
/* 0x91 */ dItemNo_Randomizer_ASHS_SCRIBBLING_e,
|
||||
/* 0x92 */ dItemNo_Randomizer_FOREST_BOSS_KEY_e,
|
||||
/* 0x93 */ dItemNo_Randomizer_LAKEBED_BOSS_KEY_e,
|
||||
/* 0x94 */ dItemNo_Randomizer_ARBITERS_BOSS_KEY_e,
|
||||
/* 0x95 */ dItemNo_Randomizer_TEMPLE_OF_TIME_BOSS_KEY_e,
|
||||
/* 0x96 */ dItemNo_Randomizer_CITY_BOSS_KEY_e,
|
||||
/* 0x97 */ dItemNo_Randomizer_PALACE_BOSS_KEY_e,
|
||||
/* 0x98 */ dItemNo_Randomizer_HYRULE_BOSS_KEY_e,
|
||||
/* 0x99 */ dItemNo_Randomizer_FOREST_COMPASS_e,
|
||||
/* 0x9A */ dItemNo_Randomizer_MINES_COMPASS_e,
|
||||
/* 0x9B */ dItemNo_Randomizer_LAKEBED_COMPASS_e,
|
||||
/* 0x9C */ dItemNo_Randomizer_CHUCHU_YELLOW2_e,
|
||||
/* 0x9D */ dItemNo_Randomizer_OIL_BOTTLE3_e,
|
||||
/* 0x9E */ dItemNo_Randomizer_SHOP_BEE_CHILD_e,
|
||||
/* 0x9F */ dItemNo_Randomizer_CHUCHU_BLACK_e,
|
||||
/* 0xA0 */ dItemNo_Randomizer_LIGHT_DROP_e,
|
||||
/* 0xA1 */ dItemNo_Randomizer_DROP_CONTAINER_e,
|
||||
/* 0xA2 */ dItemNo_Randomizer_DROP_CONTAINER02_e,
|
||||
/* 0xA3 */ dItemNo_Randomizer_DROP_CONTAINER03_e,
|
||||
/* 0xA4 */ dItemNo_Randomizer_FILLED_CONTAINER_e,
|
||||
/* 0xA5 */ dItemNo_Randomizer_MIRROR_PIECE_2_e,
|
||||
/* 0xA6 */ dItemNo_Randomizer_MIRROR_PIECE_3_e,
|
||||
/* 0xA7 */ dItemNo_Randomizer_MIRROR_PIECE_4_e,
|
||||
/* 0xA8 */ dItemNo_Randomizer_ARBITERS_COMPASS_e,
|
||||
/* 0xA9 */ dItemNo_Randomizer_SNOWPEAK_COMPASS_e,
|
||||
/* 0xAA */ dItemNo_Randomizer_TEMPLE_OF_TIME_COMPASS_e,
|
||||
/* 0xAB */ dItemNo_Randomizer_CITY_COMPASS_e,
|
||||
/* 0xAC */ dItemNo_Randomizer_PALACE_COMPASS_e,
|
||||
/* 0xAD */ dItemNo_Randomizer_HYRULE_COMPASS_e,
|
||||
/* 0xAE */ dItemNo_Randomizer_MIRROR_CHAMBER_PORTAL_e,
|
||||
/* 0xAF */ dItemNo_Randomizer_SNOWPEAK_PORTAL_e,
|
||||
/* 0xB0 */ dItemNo_Randomizer_SMELL_YELIA_POUCH_e,
|
||||
/* 0xB1 */ dItemNo_Randomizer_SMELL_PUMPKIN_e,
|
||||
/* 0xB2 */ dItemNo_Randomizer_SMELL_POH_e,
|
||||
/* 0xB3 */ dItemNo_Randomizer_SMELL_FISH_e,
|
||||
/* 0xB4 */ dItemNo_Randomizer_SMELL_CHILDREN_e,
|
||||
/* 0xB5 */ dItemNo_Randomizer_SMELL_MEDICINE_e,
|
||||
/* 0xB6 */ dItemNo_Randomizer_FOREST_MAP_e,
|
||||
/* 0xB7 */ dItemNo_Randomizer_MINES_MAP_e,
|
||||
/* 0xB8 */ dItemNo_Randomizer_LAKEBED_MAP_e,
|
||||
/* 0xB9 */ dItemNo_Randomizer_ARBITERS_MAP_e,
|
||||
/* 0xBA */ dItemNo_Randomizer_SNOWPEAK_MAP_e,
|
||||
/* 0xBB */ dItemNo_Randomizer_TEMPLE_OF_TIME_MAP_e,
|
||||
/* 0xBC */ dItemNo_Randomizer_CITY_MAP_e,
|
||||
/* 0xBD */ dItemNo_Randomizer_PALACE_MAP_e,
|
||||
/* 0xBE */ dItemNo_Randomizer_HYRULE_MAP_e,
|
||||
/* 0xBF */ dItemNo_Randomizer_SACRED_GROVE_PORTAL_e,
|
||||
/* 0xC0 */ dItemNo_Randomizer_M_BEETLE_e,
|
||||
/* 0xC1 */ dItemNo_Randomizer_F_BEETLE_e,
|
||||
/* 0xC2 */ dItemNo_Randomizer_M_BUTTERFLY_e,
|
||||
/* 0xC3 */ dItemNo_Randomizer_F_BUTTERFLY_e,
|
||||
/* 0xC4 */ dItemNo_Randomizer_M_STAG_BEETLE_e,
|
||||
/* 0xC5 */ dItemNo_Randomizer_F_STAG_BEETLE_e,
|
||||
/* 0xC6 */ dItemNo_Randomizer_M_GRASSHOPPER_e,
|
||||
/* 0xC7 */ dItemNo_Randomizer_F_GRASSHOPPER_e,
|
||||
/* 0xC8 */ dItemNo_Randomizer_M_NANAFUSHI_e,
|
||||
/* 0xC9 */ dItemNo_Randomizer_F_NANAFUSHI_e,
|
||||
/* 0xCA */ dItemNo_Randomizer_M_DANGOMUSHI_e,
|
||||
/* 0xCB */ dItemNo_Randomizer_F_DANGOMUSHI_e,
|
||||
/* 0xCC */ dItemNo_Randomizer_M_MANTIS_e,
|
||||
/* 0xCD */ dItemNo_Randomizer_F_MANTIS_e,
|
||||
/* 0xCE */ dItemNo_Randomizer_M_LADYBUG_e,
|
||||
/* 0xCF */ dItemNo_Randomizer_F_LADYBUG_e,
|
||||
/* 0xD0 */ dItemNo_Randomizer_M_SNAIL_e,
|
||||
/* 0xD1 */ dItemNo_Randomizer_F_SNAIL_e,
|
||||
/* 0xD2 */ dItemNo_Randomizer_M_DRAGONFLY_e,
|
||||
/* 0xD3 */ dItemNo_Randomizer_F_DRAGONFLY_e,
|
||||
/* 0xD4 */ dItemNo_Randomizer_M_ANT_e,
|
||||
/* 0xD5 */ dItemNo_Randomizer_F_ANT_e,
|
||||
/* 0xD6 */ dItemNo_Randomizer_M_MAYFLY_e,
|
||||
/* 0xD7 */ dItemNo_Randomizer_F_MAYFLY_e,
|
||||
/* 0xD8 */ dItemNo_Randomizer_FUSED_SHADOW_1_e,
|
||||
/* 0xD9 */ dItemNo_Randomizer_FUSED_SHADOW_2_e,
|
||||
/* 0xDA */ dItemNo_Randomizer_FUSED_SHADOW_3_e,
|
||||
/* 0xDB */ dItemNo_Randomizer_MIRROR_PIECE_1_e,
|
||||
/* 0xDC */ dItemNo_Randomizer_NOENTRY_220_e,
|
||||
/* 0xDD */ dItemNo_Randomizer_NOENTRY_221_e,
|
||||
/* 0xDE */ dItemNo_Randomizer_NOENTRY_222_e,
|
||||
/* 0xDF */ dItemNo_Randomizer_NOENTRY_223_e,
|
||||
/* 0xE0 */ dItemNo_Randomizer_POU_SPIRIT_e,
|
||||
/* 0xE1 */ dItemNo_Randomizer_ENDING_BLOW_e,
|
||||
/* 0xE2 */ dItemNo_Randomizer_SHIELD_ATTACK_e,
|
||||
/* 0xE3 */ dItemNo_Randomizer_BACK_SLICE_e,
|
||||
/* 0xE4 */ dItemNo_Randomizer_HELM_SPLITTER_e,
|
||||
/* 0xE5 */ dItemNo_Randomizer_MORTAL_DRAW_e,
|
||||
/* 0xE6 */ dItemNo_Randomizer_JUMP_STRIKE_e,
|
||||
/* 0xE7 */ dItemNo_Randomizer_GREAT_SPIN_e,
|
||||
/* 0xE8 */ dItemNo_Randomizer_ELDIN_BRIDGE_PORTAL_e,
|
||||
/* 0xE9 */ dItemNo_Randomizer_ANCIENT_DOCUMENT_e,
|
||||
/* 0xEA */ dItemNo_Randomizer_AIR_LETTER_e,
|
||||
/* 0xEB */ dItemNo_Randomizer_ANCIENT_DOCUMENT2_e,
|
||||
/* 0xEC */ dItemNo_Randomizer_LV7_DUNGEON_EXIT_e,
|
||||
/* 0xED */ dItemNo_Randomizer_LINKS_SAVINGS_e,
|
||||
/* 0xEE */ dItemNo_Randomizer_SMALL_KEY2_e,
|
||||
/* 0xEF */ dItemNo_Randomizer_POU_FIRE1_e,
|
||||
/* 0xF0 */ dItemNo_Randomizer_POU_FIRE2_e,
|
||||
/* 0xF1 */ dItemNo_Randomizer_POU_FIRE3_e,
|
||||
/* 0xF2 */ dItemNo_Randomizer_POU_FIRE4_e,
|
||||
/* 0xF3 */ dItemNo_Randomizer_BOSSRIDER_KEY_e,
|
||||
/* 0xF4 */ dItemNo_Randomizer_TOMATO_PUREE_e,
|
||||
/* 0xF5 */ dItemNo_Randomizer_TASTE_e,
|
||||
/* 0xF6 */ dItemNo_Randomizer_LV5_BOSS_KEY_e,
|
||||
/* 0xF7 */ dItemNo_Randomizer_SURFBOARD_e,
|
||||
/* 0xF8 */ dItemNo_Randomizer_KANTERA2_e,
|
||||
/* 0xF9 */ dItemNo_Randomizer_L2_KEY_PIECES1_e,
|
||||
/* 0xFA */ dItemNo_Randomizer_L2_KEY_PIECES2_e,
|
||||
/* 0xFB */ dItemNo_Randomizer_L2_KEY_PIECES3_e,
|
||||
/* 0xFC */ dItemNo_Randomizer_KEY_OF_CARAVAN_e,
|
||||
/* 0xFD */ dItemNo_Randomizer_LV2_BOSS_KEY_e,
|
||||
/* 0xFE */ dItemNo_Randomizer_KEY_OF_FILONE_e,
|
||||
/* 0xFF */ dItemNo_Randomizer_NONE_e,
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
return &mpTypeGroupData[i_typeGroupNo];
|
||||
}
|
||||
|
||||
/* 0x0 */ fmpTresTypeGroupDataList_c mpTypeGroupData[DUSK_IF_ELSE(35, 17)];
|
||||
/* 0x0 */ fmpTresTypeGroupDataList_c mpTypeGroupData[17];
|
||||
};
|
||||
|
||||
class dMenu_Fmap_data_c {
|
||||
|
||||
@@ -75,6 +75,7 @@ public:
|
||||
bool dpdMove();
|
||||
u8 openExplain(u8);
|
||||
#if TARGET_PC
|
||||
void updateSlotImage(u8 slot);
|
||||
bool pointerMove();
|
||||
#endif
|
||||
|
||||
@@ -219,6 +220,7 @@ private:
|
||||
bool mCursorInterpCurrAngular;
|
||||
bool mCursorInterpInit;
|
||||
bool mPointerTouchPressHoveredCurrent;
|
||||
J2DPicture* mDpadIcon;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -129,7 +129,9 @@ public:
|
||||
bool getPlayerSubject();
|
||||
bool isBButtonShow(bool);
|
||||
s16 getButtonTimer();
|
||||
|
||||
#if TARGET_PC
|
||||
f32 getZButtonAlpha() { return mButtonZAlpha;}
|
||||
#endif
|
||||
virtual ~dMeter2Draw_c();
|
||||
|
||||
J2DScreen* getMainScreenPtr() { return mpScreen; }
|
||||
|
||||
@@ -41,6 +41,26 @@ public:
|
||||
/* 0x12 */ BE(u16) unk_0x12;
|
||||
};
|
||||
|
||||
#if TARGET_PC
|
||||
// Default attributes for custom text ids
|
||||
static JMSMesgEntry_c defaultJMSMesgEntry{
|
||||
.string_offset = 0,
|
||||
.message_id = 0,
|
||||
.event_label_id = 0,
|
||||
.se_speaker = 0x24,
|
||||
.fuki_kind = 0x00,
|
||||
.output_type = 0x00,
|
||||
.fuki_pos_type = 0x00,
|
||||
.unk_0xc = 0xFF,
|
||||
.unk_0xd = 0x00,
|
||||
.se_mood = 0x00,
|
||||
.camera_id = 0x00,
|
||||
.base_anm_id = 0x02,
|
||||
.face_anm_id = 0x03,
|
||||
.unk_0x12 = 0x0400,
|
||||
};
|
||||
#endif
|
||||
|
||||
class JMSMesgInfo_c {
|
||||
public:
|
||||
/* 0x00 */ bmg_section_t header; // section header
|
||||
@@ -48,6 +68,9 @@ public:
|
||||
/* 0x0A */ BE(u16) entry_size; // size of an entry
|
||||
/* 0x0C */ u8 padding[4]; // padding
|
||||
/* 0x10 */ JMSMesgEntry_c entries[0];
|
||||
#if TARGET_PC
|
||||
JMSMesgEntry_c& getEntry(u16 index);
|
||||
#endif
|
||||
};
|
||||
|
||||
class COutFont_c;
|
||||
|
||||
+22
-6
@@ -58,6 +58,9 @@ public:
|
||||
int checkEventRender(int*, int*, int*, int*);
|
||||
void remove();
|
||||
u16 getEventId(int*);
|
||||
#if TARGET_PC
|
||||
u16 getEventId();
|
||||
#endif
|
||||
u32 getMsgNo();
|
||||
u32 getNowMsgNo();
|
||||
msg_class* getMsg();
|
||||
@@ -128,6 +131,11 @@ public:
|
||||
u16 query051(mesg_flow_node_branch*, fopAc_ac_c*, int);
|
||||
u16 query052(mesg_flow_node_branch*, fopAc_ac_c*, int);
|
||||
u16 query053(mesg_flow_node_branch*, fopAc_ac_c*, int);
|
||||
#if TARGET_PC
|
||||
u16 query054(mesg_flow_node_branch*, fopAc_ac_c*, int);
|
||||
u16 query055(mesg_flow_node_branch*, fopAc_ac_c*, int);
|
||||
u16 query056(mesg_flow_node_branch*, fopAc_ac_c*, int);
|
||||
#endif
|
||||
int event000(mesg_flow_node_event*, fopAc_ac_c*);
|
||||
int event001(mesg_flow_node_event*, fopAc_ac_c*);
|
||||
int event002(mesg_flow_node_event*, fopAc_ac_c*);
|
||||
@@ -171,14 +179,13 @@ public:
|
||||
int event040(mesg_flow_node_event*, fopAc_ac_c*);
|
||||
int event041(mesg_flow_node_event*, fopAc_ac_c*);
|
||||
int event042(mesg_flow_node_event*, fopAc_ac_c*);
|
||||
|
||||
#if TARGET_PC
|
||||
// HD additions
|
||||
u16 query054(mesg_flow_node_branch*, fopAc_ac_c*, int);
|
||||
u16 query055(mesg_flow_node_branch*, fopAc_ac_c*, int);
|
||||
// events for rando
|
||||
int event043(mesg_flow_node_event*, fopAc_ac_c*);
|
||||
int event044(mesg_flow_node_event*, fopAc_ac_c*);
|
||||
int event045(mesg_flow_node_event*, fopAc_ac_c*);
|
||||
int event046(mesg_flow_node_event*, fopAc_ac_c*);
|
||||
int event047(mesg_flow_node_event*, fopAc_ac_c*);
|
||||
#endif
|
||||
|
||||
void initWord(fopAc_ac_c*, const char*, u8, int, fopAc_ac_c**);
|
||||
@@ -194,8 +201,17 @@ public:
|
||||
void setMsg(u32 msg) { mMsg = msg; }
|
||||
bool checkEndFlow() { return (u32)field_0x26 == 1; }
|
||||
|
||||
static DUSK_GAME_DATA queryFunc mQueryList[DUSK_IF_ELSE(55, 53)];
|
||||
static DUSK_GAME_DATA eventFunc mEventList[DUSK_IF_ELSE(46, 43)];
|
||||
static DUSK_GAME_DATA queryFunc mQueryList[DUSK_IF_ELSE(56, 53)];
|
||||
static DUSK_GAME_DATA eventFunc mEventList[DUSK_IF_ELSE(48, 43)];
|
||||
|
||||
#if TARGET_PC
|
||||
// patch funcs for rando
|
||||
u32 getKeyForIndex(u16 nodeIdx);
|
||||
void randoPatchNodeType(u8& type, u16 nodeIdx);
|
||||
void randoPatchMessageNode(mesg_flow_node*& message_node, u16 nodeIdx);
|
||||
void randoPatchBranchNode(mesg_flow_node_branch*& branch_node, u16 nodeIdx);
|
||||
void randoPatchEventNode(mesg_flow_node_event*& event_node, u16 nodeIdx);
|
||||
#endif
|
||||
|
||||
private:
|
||||
/* 0x04 */ u8* mFlow_p;
|
||||
|
||||
@@ -199,6 +199,9 @@ public:
|
||||
void setTime(f32 i_time) { mTime = i_time; }
|
||||
u16 getDate() const { return mDate; }
|
||||
void setDate(u16 i_date) { mDate = i_date; }
|
||||
#if TARGET_PC
|
||||
u8 getDarkClearLV() const { return mDarkClearLevelFlag; }
|
||||
#endif
|
||||
|
||||
/* 0x00 */ BE(OSTime) mDateIpl;
|
||||
/* 0x08 */ u8 mTransformLevelFlag;
|
||||
@@ -272,6 +275,9 @@ public:
|
||||
bool isFieldDataExistFlag() const { return mFieldDataExistFlag ? true : false; }
|
||||
void offFieldDataExistFlag() { mFieldDataExistFlag = false; }
|
||||
void onFieldDataExistFlag() { mFieldDataExistFlag = true; }
|
||||
#if TARGET_PC
|
||||
void setRegionBit(u8 region) { mRegion |= region;}
|
||||
#endif
|
||||
|
||||
#if TARGET_PC
|
||||
/* 0x00 */ BE(Vec) mPos;
|
||||
@@ -376,12 +382,21 @@ public:
|
||||
void setArrowNum(u8 i_num) { mArrowNum = i_num; }
|
||||
u8 getPachinkoNum() const { return mPachinkoNum; }
|
||||
void setPachinkoNum(u8 i_num) { mPachinkoNum = i_num; }
|
||||
#if TARGET_PC
|
||||
u8 getAncientDocumentNum() const { return mAncientDocumentNum; }
|
||||
void setAncientDocumentNum(u8 i_num) { mAncientDocumentNum = i_num; }
|
||||
#endif
|
||||
|
||||
/* 0x0 */ u8 mArrowNum;
|
||||
/* 0x1 */ u8 mBombNum[3];
|
||||
/* 0x4 */ u8 mBottleNum[4];
|
||||
/* 0x8 */ u8 mPachinkoNum;
|
||||
#if TARGET_PC
|
||||
/* 0x9 */ u8 mAncientDocumentNum; // Custom Field for Randomizer
|
||||
/* 0x9 */ u8 unk5[2];
|
||||
#else
|
||||
/* 0x9 */ u8 unk5[3];
|
||||
#endif
|
||||
}; // Size: 0xC
|
||||
|
||||
class dSv_player_item_max_c {
|
||||
@@ -413,7 +428,11 @@ public:
|
||||
u8 getPohNum() const { return mPohNum; }
|
||||
|
||||
void addPohNum() {
|
||||
#if TARGET_PC
|
||||
if (mPohNum < 0x3D) {
|
||||
#else
|
||||
if (mPohNum < 0xFF) {
|
||||
#endif
|
||||
mPohNum++;
|
||||
}
|
||||
}
|
||||
@@ -458,6 +477,11 @@ public:
|
||||
int isLetterReadFlag(int i_no) const;
|
||||
u8 getGetNumber(int i_no) { return mGetNumber[i_no]; }
|
||||
void setGetNumber(int i_no, u8 i_value) { mGetNumber[i_no] = i_value; }
|
||||
#if TARGET_PC
|
||||
// For rando
|
||||
void setAllLetterGet() { mLetterGetFlags[0] |= 0xFFFF;}
|
||||
void setAllLetterRead() { mLetterReadFlags[0] |= 0xFFFF;}
|
||||
#endif
|
||||
|
||||
/* 0x00 */ BE(u32) mLetterGetFlags[2];
|
||||
/* 0x08 */ BE(u32) mLetterReadFlags[2];
|
||||
@@ -664,10 +688,14 @@ public:
|
||||
void onDungeonItemBossKey() { onDungeonItem(BOSS_KEY); }
|
||||
void offDungeonItemBossKey() { offDungeonItem(BOSS_KEY); }
|
||||
s32 isDungeonItemBossKey() const { return isDungeonItem(BOSS_KEY); }
|
||||
#if TARGET_PC
|
||||
void onStageBossEnemy();
|
||||
#else
|
||||
void onStageBossEnemy() {
|
||||
onDungeonItem(STAGE_BOSS_ENEMY);
|
||||
onDungeonItem(OOCCOO_NOTE);
|
||||
}
|
||||
#endif
|
||||
void offStageBossEnemy() { offDungeonItem(STAGE_BOSS_ENEMY); }
|
||||
s32 isStageBossEnemy() const { return isDungeonItem(STAGE_BOSS_ENEMY); }
|
||||
void onStageLife() { onDungeonItem(STAGE_LIFE); }
|
||||
@@ -948,6 +976,7 @@ public:
|
||||
/* 0x8 */ s8 m_no;
|
||||
};
|
||||
|
||||
|
||||
class dSv_info_c {
|
||||
public:
|
||||
void init();
|
||||
|
||||
+3
-5
@@ -1292,6 +1292,9 @@ public:
|
||||
void set(const char*, s8, s16, s8, s8, u8);
|
||||
void offEnable() { enabled = 0; }
|
||||
BOOL isEnable() const { return enabled; }
|
||||
#if TARGET_PC
|
||||
void setEnable() { enabled |= 0x1; }
|
||||
#endif
|
||||
s8 getWipe() const { return wipe; }
|
||||
u8 getWipeSpeed() const { return wipe_speed; }
|
||||
dStage_startStage_c* getStartStage() { return this; }
|
||||
@@ -1416,11 +1419,6 @@ dStage_KeepDoorInfo* dStage_GetKeepDoorInfo();
|
||||
dStage_KeepDoorInfo* dStage_GetRoomKeepDoorInfo();
|
||||
void dStage_dt_c_fieldMapLoader(void* i_data, dStage_dt_c* i_stage);
|
||||
|
||||
#if TARGET_PC
|
||||
// TP HD Cave of Shadows (D_SB11): reveal the los next-floor when a descent gate opens.
|
||||
void dStage_showLOSNextFloor(int fromRoom);
|
||||
#endif
|
||||
|
||||
#if DEBUG
|
||||
void dStage_DebugDisp();
|
||||
#endif
|
||||
|
||||
@@ -394,4 +394,7 @@ inline int mDoAud_monsSeStart(u32 i_soundId, const Vec* i_pos, u32 i_actorId, u3
|
||||
0);
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
mDoAud_zelAudio_c& mDoAud_getZelAudio();
|
||||
#endif
|
||||
#endif /* M_DO_M_DO_AUDIO_H */
|
||||
|
||||
@@ -67,6 +67,10 @@ public:
|
||||
|
||||
JKRMemArchive* getArchive() const { return mArchive; }
|
||||
JKRHeap* getHeap() const { return mHeap; }
|
||||
#if TARGET_PC
|
||||
s32 getEntryNumber() const { return mEntryNumber; }
|
||||
#endif
|
||||
|
||||
|
||||
private:
|
||||
/* 0x14 */ u8 mMountDirection;
|
||||
@@ -130,8 +134,8 @@ private:
|
||||
}; // Size = 0x28
|
||||
|
||||
struct mDoDvdThdStack {
|
||||
ATTRIBUTE_ALIGN(16) u8 stack[4096];
|
||||
};
|
||||
u8 stack[4096];
|
||||
} ATTRIBUTE_ALIGN(16);
|
||||
|
||||
struct mDoDvdThd {
|
||||
static s32 main(void*);
|
||||
|
||||
@@ -154,6 +154,18 @@ public:
|
||||
return (J2DTextBoxHBinding)((mFlags >> 2) & 3);
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
void setVBinding(J2DTextBoxVBinding vBinding) {
|
||||
mFlags &= 0b1100;
|
||||
mFlags |= (vBinding & 3);
|
||||
}
|
||||
|
||||
void setHBinding(J2DTextBoxHBinding hBinding) {
|
||||
mFlags &= 0b0011;
|
||||
mFlags |= ((hBinding & 3) << 2);
|
||||
}
|
||||
#endif
|
||||
|
||||
JUtility::TColor getCharColor() { return mCharColor; }
|
||||
JUtility::TColor getGradColor() { return mGradientColor; }
|
||||
u16 getStringAllocByte() const { return mStringLength; }
|
||||
|
||||
@@ -1761,16 +1761,6 @@ public:
|
||||
virtual ~J3DIndBlockNull() {}
|
||||
};
|
||||
|
||||
#ifdef DUSK_TPHD
|
||||
struct PolygonOffset {
|
||||
BE(f32) mFrontOffset;
|
||||
BE(f32) mFrontScale;
|
||||
BE(f32) mBackOffset;
|
||||
BE(f32) mBackScale;
|
||||
BE(f32) mClamp;
|
||||
};
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-j3d
|
||||
*
|
||||
@@ -1803,10 +1793,6 @@ public:
|
||||
virtual void setDither(u8 const*) {}
|
||||
virtual void setDither(u8) {}
|
||||
virtual u8 getDither() const { return 0; }
|
||||
#ifdef DUSK_TPHD
|
||||
virtual void setPolygonOffset(const PolygonOffset&) {}
|
||||
virtual PolygonOffset* getPolygonOffset() { return NULL; }
|
||||
#endif
|
||||
virtual u32 getFogOffset() const { return 0; }
|
||||
virtual void setFogOffset(u32) {}
|
||||
virtual ~J3DPEBlock() {}
|
||||
@@ -1970,25 +1956,12 @@ public:
|
||||
virtual void setFogOffset(u32 fogOffset) { mFogOffset = fogOffset; }
|
||||
virtual ~J3DPEBlockFull() {}
|
||||
|
||||
#ifdef DUSK_TPHD
|
||||
virtual void setPolygonOffset(const PolygonOffset& offset) {
|
||||
mPolygonOffset = offset;
|
||||
}
|
||||
|
||||
virtual PolygonOffset* getPolygonOffset() {
|
||||
return &mPolygonOffset;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* 0x04 */ J3DFog mFog;
|
||||
/* 0x30 */ J3DAlphaComp mAlphaComp;
|
||||
/* 0x34 */ J3DBlend mBlend;
|
||||
/* 0x38 */ J3DZMode mZMode;
|
||||
/* 0x3A */ u8 mZCompLoc;
|
||||
/* 0x3B */ u8 mDither;
|
||||
#ifdef DUSK_TPHD
|
||||
PolygonOffset mPolygonOffset;
|
||||
#endif
|
||||
/* 0x3C */ u32 mFogOffset;
|
||||
}; // Size: 0x40
|
||||
|
||||
|
||||
@@ -46,13 +46,6 @@ struct J3DMaterialInitData {
|
||||
/* 0x14A */ BE(u16) mNBTScaleIdx;
|
||||
}; // size 0x14C
|
||||
|
||||
|
||||
#ifdef DUSK_TPHD
|
||||
struct J3DMaterialInitData_MAT4 : public J3DMaterialInitData {
|
||||
/* 0x14C */ BE(u16) mPolygonOffsetIdx;
|
||||
}; // size 0x14E
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-j3d
|
||||
*
|
||||
@@ -150,29 +143,10 @@ public:
|
||||
J3DNBTScale newNBTScale(int) const;
|
||||
|
||||
u16 getMaterialID(int idx) const { return mpMaterialID[idx]; }
|
||||
#ifdef DUSK_TPHD
|
||||
u8 getMaterialMode(int idx) const { return getMatInitData(idx)->mMaterialMode; }
|
||||
#else
|
||||
u8 getMaterialMode(int idx) const { return mpMaterialInitData[mpMaterialID[idx]].mMaterialMode; }
|
||||
#endif
|
||||
|
||||
#if DUSK_TPHD
|
||||
const PolygonOffset newPolygonOffset(int) const;
|
||||
|
||||
J3DMaterialInitData* getMatInitData(int idx) const {
|
||||
static const u32 sInitDataSizes[] = {0, 0, 0x138, 0x14C, 0x14E};
|
||||
|
||||
return (J3DMaterialInitData*)((u8*)mpMaterialInitData + sInitDataSizes[mBlockType] * getMaterialID(idx));
|
||||
}
|
||||
|
||||
u16 mBlockType;
|
||||
#endif
|
||||
/* 0x00 */ u16 mMaterialNum;
|
||||
#if DUSK_TPHD
|
||||
/* 0x04 */ void* mpMaterialInitData;
|
||||
#else
|
||||
/* 0x04 */ J3DMaterialInitData* mpMaterialInitData;
|
||||
#endif
|
||||
/* 0x08 */ BE(u16)* mpMaterialID;
|
||||
/* 0x0C */ J3DIndInitData* mpIndInitData;
|
||||
/* 0x10 */ GXColor* mpMatColor;
|
||||
@@ -201,9 +175,6 @@ public:
|
||||
/* 0x6C */ u8* mpZCompLoc;
|
||||
/* 0x70 */ u8* mpDither;
|
||||
/* 0x74 */ J3DNBTScaleInfo* mpNBTScaleInfo;
|
||||
#ifdef DUSK_TPHD
|
||||
PolygonOffset* mpPolygonOffsets;
|
||||
#endif
|
||||
/* 0x78 */ J3DDisplayListInit* mpDisplayListInit;
|
||||
/* 0x7C */ J3DPatchingInfo* mpPatchingInfo;
|
||||
/* 0x80 */ J3DCurrentMtxInfo* mpCurrentMtxInfo;
|
||||
|
||||
@@ -169,12 +169,6 @@ struct J3DMaterialBlock_v21 : public J3DModelBlock {
|
||||
/* 0x74 */ OFFSET_PTR_V0 mpNBTScaleInfo;
|
||||
};
|
||||
|
||||
#ifdef DUSK_TPHD
|
||||
struct J3DMaterialBlock_MAT4 : public J3DMaterialBlock {
|
||||
/* 0x84 */ OFFSET_PTR_V0 mpPolygonOffsets;
|
||||
};
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-j3d
|
||||
*
|
||||
|
||||
@@ -7,9 +7,6 @@
|
||||
#include "JSystem/J3DGraphBase/J3DMaterial.h"
|
||||
#include "JSystem/JMath/JMath.h"
|
||||
#include "m_Do/m_Do_mtx.h"
|
||||
#if TARGET_PC
|
||||
#include "dusk/settings.h"
|
||||
#endif
|
||||
|
||||
void J3DMtxCalcJ3DSysInitBasic::init(Vec const& scale, Mtx const& mtx) {
|
||||
J3DSys::mCurrentS = scale;
|
||||
@@ -181,23 +178,7 @@ void J3DJoint::entryIn() {
|
||||
matPacket->setMaterialAnmID(mesh->getMaterialAnm());
|
||||
matPacket->setShapePacket(shapePacket);
|
||||
bool isDrawModeOpaTexEdge = mesh->isDrawModeOpaTexEdge() == FALSE;
|
||||
#if TARGET_PC
|
||||
// TP HD J3DJoint::entryIn (FUN_02b57690):
|
||||
J3DDrawBuffer* drawBuffer = j3dSys.getDrawBuffer(isDrawModeOpaTexEdge);
|
||||
u8 r24;
|
||||
if (dusk::tphd_active() && (mesh->mMaterialID & 0x80000000) != 0 &&
|
||||
(mesh->getMaterialMode() & 0x20) != 0 &&
|
||||
drawBuffer->getSortMode() == J3DDrawBufSortMode_Mat)
|
||||
{
|
||||
matPacket->drawClear();
|
||||
shapePacket->drawClear();
|
||||
r24 = drawBuffer->entryImm(matPacket, 1);
|
||||
} else {
|
||||
r24 = matPacket->entry(drawBuffer);
|
||||
}
|
||||
#else
|
||||
u8 r24 = matPacket->entry(j3dSys.getDrawBuffer(isDrawModeOpaTexEdge));
|
||||
#endif
|
||||
if (r24) {
|
||||
j3dSys.setMatPacket(matPacket);
|
||||
J3DDrawBuffer::entryNum++;
|
||||
|
||||
@@ -230,13 +230,6 @@ void J3DMatPacket::draw() {
|
||||
#endif
|
||||
packet->getShape()->loadPreDrawSetting();
|
||||
|
||||
#if DUSK_TPHD
|
||||
{
|
||||
const auto* offs = mpMaterial->getPEBlock()->getPolygonOffset();
|
||||
GX2SetPolygonOffset(offs->mFrontOffset, offs->mFrontScale, offs->mBackOffset, offs->mBackScale, offs->mClamp);
|
||||
}
|
||||
#endif
|
||||
|
||||
while (packet != NULL) {
|
||||
if (packet->getDisplayListObj() != NULL) {
|
||||
packet->getDisplayListObj()->callDL();
|
||||
|
||||
@@ -23,9 +23,9 @@ DUSK_GAME_DATA Vec J3DSys::mParentS;
|
||||
DUSK_GAME_DATA J3DTexCoordScaleInfo J3DSys::sTexCoordScaleTable[8];
|
||||
|
||||
#if TARGET_PC // Original game bug, array is too small.
|
||||
ATTRIBUTE_ALIGN(32) static u8 NullTexData[0x20] = {0};
|
||||
static u8 NullTexData[0x20] ATTRIBUTE_ALIGN(32) = {0};
|
||||
#else
|
||||
ATTRIBUTE_ALIGN(32) static u8 NullTexData[0x10] = {0};
|
||||
static u8 NullTexData[0x10] ATTRIBUTE_ALIGN(32) = {0};
|
||||
#endif
|
||||
|
||||
static Mtx j3dIdentityMtx = {
|
||||
|
||||
@@ -12,9 +12,6 @@
|
||||
#include "dusk/logging.h"
|
||||
|
||||
J3DMaterialFactory::J3DMaterialFactory(J3DMaterialBlock const& i_block) {
|
||||
#ifdef DUSK_TPHD
|
||||
mBlockType = (i_block.mBlockType & 0xFF) - 0x30; // get number at last byte of block name
|
||||
#endif
|
||||
mMaterialNum = i_block.mMaterialNum;
|
||||
mpMaterialInitData = JSUConvertOffsetToPtr<J3DMaterialInitData>(&i_block, i_block.mpMaterialInitData);
|
||||
mpMaterialID = JSUConvertOffsetToPtr<BE(u16)>(&i_block, i_block.mpMaterialID);
|
||||
@@ -49,11 +46,6 @@ J3DMaterialFactory::J3DMaterialFactory(J3DMaterialBlock const& i_block) {
|
||||
mpZCompLoc = JSUConvertOffsetToPtr<u8>(&i_block, i_block.mpZCompLoc);
|
||||
mpDither = JSUConvertOffsetToPtr<u8>(&i_block, i_block.mpDither);
|
||||
mpNBTScaleInfo = JSUConvertOffsetToPtr<J3DNBTScaleInfo>(&i_block, i_block.mpNBTScaleInfo);
|
||||
#ifdef DUSK_TPHD
|
||||
if(mBlockType >= 4) {
|
||||
mpPolygonOffsets = JSUConvertOffsetToPtr<PolygonOffset>(&i_block, reinterpret_cast<const J3DMaterialBlock_MAT4&>(i_block).mpPolygonOffsets);
|
||||
}
|
||||
#endif
|
||||
mpDisplayListInit = NULL;
|
||||
mpPatchingInfo = NULL;
|
||||
mpCurrentMtxInfo = NULL;
|
||||
@@ -82,11 +74,7 @@ u16 J3DMaterialFactory::countUniqueMaterials() {
|
||||
}
|
||||
|
||||
u32 J3DMaterialFactory::countTexGens(int i_idx) const {
|
||||
#ifdef DUSK_TPHD
|
||||
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
|
||||
#else
|
||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
#endif
|
||||
if (mtl_init_data->mTexGenNumIdx != 0xff) {
|
||||
return mpTexGenNum[mtl_init_data->mTexGenNumIdx];
|
||||
}
|
||||
@@ -94,11 +82,7 @@ u32 J3DMaterialFactory::countTexGens(int i_idx) const {
|
||||
}
|
||||
|
||||
u32 J3DMaterialFactory::countStages(int i_idx) const {
|
||||
#ifdef DUSK_TPHD
|
||||
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
|
||||
#else
|
||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
#endif
|
||||
u32 count1 = 0;
|
||||
u32 count2 = 0;
|
||||
if (mtl_init_data->mTevStageNumIdx != 0xff) {
|
||||
@@ -173,9 +157,6 @@ J3DMaterial* J3DMaterialFactory::createNormalMaterial(J3DMaterial* i_material, i
|
||||
i_material->mPEBlock->setZMode(newZMode(i_idx));
|
||||
i_material->mPEBlock->setZCompLoc(newZCompLoc(i_idx));
|
||||
i_material->mPEBlock->setDither(newDither(i_idx));
|
||||
#ifdef DUSK_TPHD
|
||||
i_material->mPEBlock->setPolygonOffset(newPolygonOffset(i_idx));
|
||||
#endif
|
||||
i_material->mTevBlock->setTevStageNum(newTevStageNum(i_idx));
|
||||
for (u8 i = 0; i < tex_num; i++) {
|
||||
i_material->mTevBlock->setTexNo(i, newTexNo(i_idx, i));
|
||||
@@ -184,11 +165,7 @@ J3DMaterial* J3DMaterialFactory::createNormalMaterial(J3DMaterial* i_material, i
|
||||
i_material->mTevBlock->setTevOrder(i, newTevOrder(i_idx, i));
|
||||
}
|
||||
for (u8 i = 0; i < tev_stage_num_max; i++) {
|
||||
#ifdef DUSK_TPHD
|
||||
J3DMaterialInitData* material_init_data = getMatInitData(i_idx);
|
||||
#else
|
||||
J3DMaterialInitData* material_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
#endif
|
||||
i_material->mTevBlock->setTevStage(i, newTevStage(i_idx, i));
|
||||
if (material_init_data->mTevSwapModeIdx[i] != 0xffff) {
|
||||
i_material->mTevBlock->getTevStage(i)->setTexSel(
|
||||
@@ -223,11 +200,7 @@ J3DMaterial* J3DMaterialFactory::createNormalMaterial(J3DMaterial* i_material, i
|
||||
for (u8 i = 0; i < 8; i++) {
|
||||
i_material->mTexGenBlock->setTexMtx(i, newTexMtx(i_idx, i));
|
||||
}
|
||||
#ifdef DUSK_TPHD
|
||||
J3DMaterialInitData* material_init_data = getMatInitData(i_idx);
|
||||
#else
|
||||
J3DMaterialInitData* material_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
#endif
|
||||
J3DMaterialInitData* material_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
for (u8 i = 0; i < tev_stage_num_max; i++) {
|
||||
if (material_init_data->mTevKColorSel[i] != 0xff) {
|
||||
i_material->mTevBlock->setTevKColorSel(i, material_init_data->mTevKColorSel[i]);
|
||||
@@ -300,11 +273,7 @@ J3DMaterial* J3DMaterialFactory::createPatchedMaterial(J3DMaterial* i_material,
|
||||
i_material->mTevBlock->setTevColor(i, newTevColor(i_idx, i));
|
||||
}
|
||||
for (u8 i = 0; i < tev_stage_num; i++) {
|
||||
#ifdef DUSK_TPHD
|
||||
J3DMaterialInitData* material_init_data = getMatInitData(i_idx);
|
||||
#else
|
||||
J3DMaterialInitData* material_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
#endif
|
||||
i_material->mTevBlock->setTevStage(i, newTevStage(i_idx, i));
|
||||
if (material_init_data->mTevSwapModeIdx[i] != 0xffff) {
|
||||
i_material->mTevBlock->getTevStage(i)->setTexSel(
|
||||
@@ -313,11 +282,7 @@ J3DMaterial* J3DMaterialFactory::createPatchedMaterial(J3DMaterial* i_material,
|
||||
mpTevSwapModeInfo[material_init_data->mTevSwapModeIdx[i]].mRasSel);
|
||||
}
|
||||
}
|
||||
#ifdef DUSK_TPHD
|
||||
J3DMaterialInitData* init_data = getMatInitData(i_idx);
|
||||
#else
|
||||
J3DMaterialInitData* init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
#endif
|
||||
J3DMaterialInitData* init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
for (u8 i = 0; i < tev_stage_num; i++) {
|
||||
if (init_data->mTevKColorSel[i] != 0xff) {
|
||||
i_material->mTevBlock->setTevKColorSel(i, init_data->mTevKColorSel[i]);
|
||||
@@ -458,11 +423,7 @@ u32 J3DMaterialFactory::calcSizeNormalMaterial(J3DMaterial* i_material, int i_id
|
||||
size += J3DMaterial::calcSizeTevBlock((u16)tev_stage_num_max);
|
||||
size += J3DMaterial::calcSizeIndBlock(ind_flag);
|
||||
size += J3DMaterial::calcSizePEBlock(pe_flag, getMaterialMode(i_idx));
|
||||
#ifdef DUSK_TPHD
|
||||
J3DMaterialInitData* init_data = getMatInitData(i_idx);
|
||||
#else
|
||||
J3DMaterialInitData* init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
#endif
|
||||
for (u32 i = 0; i < 8; i++) {
|
||||
if (init_data->mTexMtxIdx[i] != 0xffff) {
|
||||
size += sizeof(J3DTexMtx);
|
||||
@@ -483,11 +444,7 @@ u32 J3DMaterialFactory::calcSizePatchedMaterial(J3DMaterial* i_material, int i_i
|
||||
size += sizeof(J3DTevBlockPatched);
|
||||
size += J3DMaterial::calcSizeIndBlock(ind_flag);
|
||||
size += J3DMaterial::calcSizePEBlock(0x10000000, getMaterialMode(i_idx));
|
||||
#ifdef DUSK_TPHD
|
||||
J3DMaterialInitData* init_data = getMatInitData(i_idx);
|
||||
#else
|
||||
J3DMaterialInitData* init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
#endif
|
||||
for (u32 i = 0; i < 8; i++) {
|
||||
if (init_data->mTexMtxIdx[i] != 0xffff) {
|
||||
size += sizeof(J3DTexMtx);
|
||||
@@ -517,11 +474,7 @@ J3DGXColor J3DMaterialFactory::newMatColor(int i_idx, int i_no) const {
|
||||
#else
|
||||
J3DGXColor dflt = GXColor{0xff, 0xff, 0xff, 0xff};
|
||||
#endif
|
||||
#ifdef DUSK_TPHD
|
||||
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
|
||||
#else
|
||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
#endif
|
||||
if (mtl_init_data->mMatColorIdx[i_no] != 0xffff) {
|
||||
return (GXColor) mpMatColor[mtl_init_data->mMatColorIdx[i_no]];
|
||||
} else {
|
||||
@@ -530,11 +483,7 @@ J3DGXColor J3DMaterialFactory::newMatColor(int i_idx, int i_no) const {
|
||||
}
|
||||
|
||||
const u8 J3DMaterialFactory::newColorChanNum(int i_idx) const {
|
||||
#ifdef DUSK_TPHD
|
||||
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
|
||||
#else
|
||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
#endif
|
||||
if (mtl_init_data->mColorChanNumIdx != 0xff) {
|
||||
return mpColorChanNum[mtl_init_data->mColorChanNumIdx];
|
||||
} else {
|
||||
@@ -544,11 +493,7 @@ const u8 J3DMaterialFactory::newColorChanNum(int i_idx) const {
|
||||
|
||||
J3DColorChan J3DMaterialFactory::newColorChan(int i_idx, int i_no) const {
|
||||
u32 r29 = 0;
|
||||
#ifdef DUSK_TPHD
|
||||
J3DMaterialInitData* init_data = getMatInitData(i_idx);
|
||||
#else
|
||||
J3DMaterialInitData* init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
#endif
|
||||
if (init_data->mColorChanIdx[i_no] != 0xffff) {
|
||||
return J3DColorChan(mpColorChanInfo[init_data->mColorChanIdx[i_no]]);
|
||||
} else {
|
||||
@@ -562,11 +507,7 @@ J3DGXColor J3DMaterialFactory::newAmbColor(int i_idx, int i_no) const {
|
||||
#else
|
||||
J3DGXColor dflt = GXColor{0x32, 0x32, 0x32, 0x32};
|
||||
#endif
|
||||
#ifdef DUSK_TPHD
|
||||
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
|
||||
#else
|
||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
#endif
|
||||
if (mtl_init_data->mAmbColorIdx[i_no] != 0xffff) {
|
||||
return (GXColor) mpAmbColor[mtl_init_data->mAmbColorIdx[i_no]];
|
||||
} else {
|
||||
@@ -576,11 +517,7 @@ J3DGXColor J3DMaterialFactory::newAmbColor(int i_idx, int i_no) const {
|
||||
|
||||
u32 J3DMaterialFactory::newTexGenNum(int i_idx) const {
|
||||
u32 r30 = 0;
|
||||
#ifdef DUSK_TPHD
|
||||
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
|
||||
#else
|
||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
#endif
|
||||
if (mtl_init_data->mTexGenNumIdx != 0xff) {
|
||||
return mpTexGenNum[mtl_init_data->mTexGenNumIdx];
|
||||
} else {
|
||||
@@ -589,11 +526,7 @@ u32 J3DMaterialFactory::newTexGenNum(int i_idx) const {
|
||||
}
|
||||
|
||||
J3DTexCoord J3DMaterialFactory::newTexCoord(int i_idx, int i_no) const {
|
||||
#ifdef DUSK_TPHD
|
||||
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
|
||||
#else
|
||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
#endif
|
||||
if (mtl_init_data->mTexCoordIdx[i_no] != 0xffff) {
|
||||
return J3DTexCoord(mpTexCoordInfo[mtl_init_data->mTexCoordIdx[i_no]]);
|
||||
} else {
|
||||
@@ -603,11 +536,7 @@ J3DTexCoord J3DMaterialFactory::newTexCoord(int i_idx, int i_no) const {
|
||||
|
||||
J3DTexMtx* J3DMaterialFactory::newTexMtx(int i_idx, int i_no) const {
|
||||
J3DTexMtx* tex_mtx = NULL;
|
||||
#ifdef DUSK_TPHD
|
||||
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
|
||||
#else
|
||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
#endif
|
||||
if (mtl_init_data->mTexMtxIdx[i_no] != 0xffff) {
|
||||
#if TARGET_LITTLE_ENDIAN
|
||||
auto tex_mtx_info = mpTexMtxInfo[mtl_init_data->mTexMtxIdx[i_no]];
|
||||
@@ -629,11 +558,7 @@ J3DTexMtx* J3DMaterialFactory::newTexMtx(int i_idx, int i_no) const {
|
||||
|
||||
u8 J3DMaterialFactory::newCullMode(int i_idx) const {
|
||||
u32 r30 = 0;
|
||||
#ifdef DUSK_TPHD
|
||||
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
|
||||
#else
|
||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
#endif
|
||||
if (mtl_init_data->mCullModeIdx != 0xff) {
|
||||
return mpCullMode[mtl_init_data->mCullModeIdx];
|
||||
} else {
|
||||
@@ -642,11 +567,7 @@ u8 J3DMaterialFactory::newCullMode(int i_idx) const {
|
||||
}
|
||||
|
||||
u16 J3DMaterialFactory::newTexNo(int i_idx, int i_no) const {
|
||||
#ifdef DUSK_TPHD
|
||||
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
|
||||
#else
|
||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
#endif
|
||||
if (mtl_init_data->mTexNoIdx[i_no] != 0xffff) {
|
||||
return mpTexNo[mtl_init_data->mTexNoIdx[i_no]];
|
||||
} else {
|
||||
@@ -655,11 +576,7 @@ u16 J3DMaterialFactory::newTexNo(int i_idx, int i_no) const {
|
||||
}
|
||||
|
||||
J3DTevOrder J3DMaterialFactory::newTevOrder(int i_idx, int i_no) const {
|
||||
#ifdef DUSK_TPHD
|
||||
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
|
||||
#else
|
||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
#endif
|
||||
if (mtl_init_data->mTevOrderIdx[i_no] != 0xffff) {
|
||||
return J3DTevOrder(mpTevOrderInfo[mtl_init_data->mTevOrderIdx[i_no]]);
|
||||
} else {
|
||||
@@ -670,11 +587,7 @@ J3DTevOrder J3DMaterialFactory::newTevOrder(int i_idx, int i_no) const {
|
||||
J3DGXColorS10 J3DMaterialFactory::newTevColor(int i_idx, int i_no) const {
|
||||
GXColorS10 _dflt = {0, 0, 0, 0};
|
||||
J3DGXColorS10 dflt = _dflt;
|
||||
#ifdef DUSK_TPHD
|
||||
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
|
||||
#else
|
||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
#endif
|
||||
if (mtl_init_data->mTevColorIdx[i_no] != 0xffff) {
|
||||
return (GXColorS10) mpTevColor[mtl_init_data->mTevColorIdx[i_no]];
|
||||
} else {
|
||||
@@ -688,11 +601,7 @@ J3DGXColor J3DMaterialFactory::newTevKColor(int i_idx, int i_no) const {
|
||||
#else
|
||||
J3DGXColor dflt = GXColor{0xff, 0xff, 0xff, 0xff};
|
||||
#endif
|
||||
#ifdef DUSK_TPHD
|
||||
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
|
||||
#else
|
||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
#endif
|
||||
if (mtl_init_data->mTevKColorIdx[i_no] != 0xffff) {
|
||||
return (GXColor) mpTevKColor[mtl_init_data->mTevKColorIdx[i_no]];
|
||||
} else {
|
||||
@@ -701,11 +610,7 @@ J3DGXColor J3DMaterialFactory::newTevKColor(int i_idx, int i_no) const {
|
||||
}
|
||||
|
||||
const u8 J3DMaterialFactory::newTevStageNum(int i_idx) const {
|
||||
#ifdef DUSK_TPHD
|
||||
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
|
||||
#else
|
||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
#endif
|
||||
if (mtl_init_data->mTevStageNumIdx != 0xff) {
|
||||
return mpTevStageNum[mtl_init_data->mTevStageNumIdx];
|
||||
} else {
|
||||
@@ -714,11 +619,7 @@ const u8 J3DMaterialFactory::newTevStageNum(int i_idx) const {
|
||||
}
|
||||
|
||||
J3DTevStage J3DMaterialFactory::newTevStage(int i_idx, int i_no) const {
|
||||
#ifdef DUSK_TPHD
|
||||
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
|
||||
#else
|
||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
#endif
|
||||
if (mtl_init_data->mTevStageIdx[i_no] != 0xffff) {
|
||||
return J3DTevStage(mpTevStageInfo[mtl_init_data->mTevStageIdx[i_no]]);
|
||||
} else {
|
||||
@@ -727,11 +628,7 @@ J3DTevStage J3DMaterialFactory::newTevStage(int i_idx, int i_no) const {
|
||||
}
|
||||
|
||||
J3DTevSwapModeTable J3DMaterialFactory::newTevSwapModeTable(int i_idx, int i_no) const {
|
||||
#ifdef DUSK_TPHD
|
||||
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
|
||||
#else
|
||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
#endif
|
||||
if (mtl_init_data->mTevSwapModeTableIdx[i_no] != 0xffff) {
|
||||
return J3DTevSwapModeTable(mpTevSwapModeTableInfo[mtl_init_data->mTevSwapModeTableIdx[i_no]]);
|
||||
} else {
|
||||
@@ -792,11 +689,7 @@ J3DIndTexCoordScale J3DMaterialFactory::newIndTexCoordScale(int i_idx, int i_no)
|
||||
|
||||
J3DFog J3DMaterialFactory::newFog(int i_idx) const {
|
||||
J3DFog fog;
|
||||
#ifdef DUSK_TPHD
|
||||
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
|
||||
#else
|
||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
#endif
|
||||
if (mtl_init_data->mFogIdx != 0xffff) {
|
||||
#if TARGET_LITTLE_ENDIAN
|
||||
J3DFogInfo fogInfo = mpFogInfo[mtl_init_data->mFogIdx];
|
||||
@@ -816,11 +709,7 @@ J3DFog J3DMaterialFactory::newFog(int i_idx) const {
|
||||
}
|
||||
|
||||
J3DAlphaComp J3DMaterialFactory::newAlphaComp(int i_idx) const {
|
||||
#ifdef DUSK_TPHD
|
||||
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
|
||||
#else
|
||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
#endif
|
||||
if (mtl_init_data->mAlphaCompIdx != 0xffff) {
|
||||
return J3DAlphaComp(mpAlphaCompInfo[mtl_init_data->mAlphaCompIdx]);
|
||||
} else {
|
||||
@@ -829,11 +718,7 @@ J3DAlphaComp J3DMaterialFactory::newAlphaComp(int i_idx) const {
|
||||
}
|
||||
|
||||
J3DBlend J3DMaterialFactory::newBlend(int i_idx) const {
|
||||
#ifdef DUSK_TPHD
|
||||
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
|
||||
#else
|
||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
#endif
|
||||
if (mtl_init_data->mBlendIdx != 0xffff) {
|
||||
return J3DBlend(mpBlendInfo[mtl_init_data->mBlendIdx]);
|
||||
} else {
|
||||
@@ -843,11 +728,7 @@ J3DBlend J3DMaterialFactory::newBlend(int i_idx) const {
|
||||
|
||||
J3DZMode J3DMaterialFactory::newZMode(int i_idx) const {
|
||||
u32 r29 = 0;
|
||||
#ifdef DUSK_TPHD
|
||||
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
|
||||
#else
|
||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
#endif
|
||||
if (mtl_init_data->mZModeIdx != 0xff) {
|
||||
return J3DZMode(mpZModeInfo[mtl_init_data->mZModeIdx]);
|
||||
} else {
|
||||
@@ -856,11 +737,7 @@ J3DZMode J3DMaterialFactory::newZMode(int i_idx) const {
|
||||
}
|
||||
|
||||
const u8 J3DMaterialFactory::newZCompLoc(int i_idx) const {
|
||||
#ifdef DUSK_TPHD
|
||||
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
|
||||
#else
|
||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
#endif
|
||||
if (mtl_init_data->mZCompLocIdx != 0xff){
|
||||
return mpZCompLoc[mtl_init_data->mZCompLocIdx];
|
||||
} else {
|
||||
@@ -869,11 +746,7 @@ const u8 J3DMaterialFactory::newZCompLoc(int i_idx) const {
|
||||
}
|
||||
|
||||
const u8 J3DMaterialFactory::newDither(int i_idx) const {
|
||||
#ifdef DUSK_TPHD
|
||||
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
|
||||
#else
|
||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
#endif
|
||||
if (mtl_init_data->mDitherIdx != 0xff){
|
||||
return mpDither[mtl_init_data->mDitherIdx];
|
||||
} else {
|
||||
@@ -881,24 +754,9 @@ const u8 J3DMaterialFactory::newDither(int i_idx) const {
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DUSK_TPHD
|
||||
const PolygonOffset J3DMaterialFactory::newPolygonOffset(int i_idx) const {
|
||||
J3DMaterialInitData_MAT4* mtl_init_data = (J3DMaterialInitData_MAT4*)getMatInitData(i_idx);
|
||||
if (mBlockType >= 4 && mtl_init_data->mPolygonOffsetIdx != 0xffff){
|
||||
return mpPolygonOffsets[mtl_init_data->mPolygonOffsetIdx];
|
||||
} else {
|
||||
return PolygonOffset{0.0f, 0.0f, 0.0f, 0.0f, 0.0f};
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
J3DNBTScale J3DMaterialFactory::newNBTScale(int i_idx) const {
|
||||
J3DNBTScale dflt(j3dDefaultNBTScaleInfo);
|
||||
#ifdef DUSK_TPHD
|
||||
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
|
||||
#else
|
||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
#endif
|
||||
if (mtl_init_data->mNBTScaleIdx != 0xffff) {
|
||||
return J3DNBTScale(mpNBTScaleInfo[mtl_init_data->mNBTScaleIdx]);
|
||||
} else {
|
||||
|
||||
@@ -103,9 +103,6 @@ J3DModelData* J3DModelLoader::load(void const* i_data, u32 i_flags) {
|
||||
readJoint((J3DJointBlock*)block);
|
||||
break;
|
||||
case 'MAT3':
|
||||
#if DUSK_TPHD
|
||||
case 'MAT4':
|
||||
#endif
|
||||
readMaterial((J3DMaterialBlock*)block, (s32)i_flags);
|
||||
break;
|
||||
case 'MAT2':
|
||||
@@ -150,9 +147,6 @@ J3DMaterialTable* J3DModelLoader::loadMaterialTable(void const* i_data) {
|
||||
for (u32 block_no = 0; block_no < data->mBlockNum; block_no++) {
|
||||
switch (block->mBlockType) {
|
||||
case 'MAT3':
|
||||
#if DUSK_TPHD
|
||||
case 'MAT4':
|
||||
#endif
|
||||
readMaterialTable((J3DMaterialBlock*)block, flags);
|
||||
break;
|
||||
case 'MAT2':
|
||||
@@ -218,9 +212,6 @@ J3DModelData* J3DModelLoader::loadBinaryDisplayList(void const* i_data, u32 i_fl
|
||||
modifyMaterial(i_flags);
|
||||
break;
|
||||
case 'MAT3':
|
||||
#if DUSK_TPHD
|
||||
case 'MAT4':
|
||||
#endif
|
||||
flags = 0x50100000;
|
||||
flags |= (i_flags & 0x3000000);
|
||||
mpMaterialBlock = (J3DMaterialBlock*)block;
|
||||
@@ -317,22 +308,8 @@ static GXVtxAttrFmtList getFmt(GXVtxAttrFmtList* i_fmtList, GXAttr i_attr) {
|
||||
return *i_fmtList;
|
||||
}
|
||||
}
|
||||
#if DUSK_TPHD
|
||||
// HD BMDs occasionally have vertex arrays without a format entry. Mirror
|
||||
// the GC runtime: fall back to J3DSys::initGX defaults.
|
||||
GXVtxAttrFmtList def{};
|
||||
def.attr = i_attr;
|
||||
def.frac = 0;
|
||||
if (i_attr == GX_VA_POS) { def.cnt = GX_POS_XYZ; def.type = GX_F32; }
|
||||
else if (i_attr == GX_VA_NRM) { def.cnt = GX_NRM_XYZ; def.type = GX_F32; }
|
||||
else if (i_attr == GX_VA_NBT) { def.cnt = GX_NRM_NBT; def.type = GX_F32; }
|
||||
else if (i_attr >= GX_VA_CLR0 &&
|
||||
i_attr <= GX_VA_CLR1) { def.cnt = GX_CLR_RGBA; def.type = GX_RGBA8; }
|
||||
else { def.cnt = GX_TEX_ST; def.type = GX_F32; }
|
||||
return def;
|
||||
#else
|
||||
|
||||
OSPanic(__FILE__, __LINE__, "Unable to find vertex attribute format!");
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ u16 J3DModelLoader::countMaterialNum(const void* stream) {
|
||||
const J3DModelBlock* block = header->mBlocks;
|
||||
for (int i = 0; i < header->mBlockNum; i++)
|
||||
{
|
||||
if (block->mBlockType == 'MAT3' || block->mBlockType == 'MAT4') {
|
||||
if (block->mBlockType == 'MAT3') {
|
||||
const J3DMaterialBlock* materialBlock = (const J3DMaterialBlock*)block;
|
||||
return materialBlock->mMaterialNum;
|
||||
}
|
||||
@@ -45,7 +45,6 @@ u32 J3DModelLoader::calcLoadSize(void const* stream, u32 flags_) {
|
||||
size += calcSizeJoint((const J3DJointBlock*)nextBlock);
|
||||
break;
|
||||
case 'MAT3':
|
||||
case 'MAT4':
|
||||
size += calcSizeMaterial((const J3DMaterialBlock*)nextBlock, flags);
|
||||
break;
|
||||
case 'SHP1':
|
||||
@@ -87,7 +86,6 @@ u32 J3DModelLoader::calcLoadMaterialTableSize(const void* stream) {
|
||||
for (u32 i = 0; i < header->mBlockNum; i++) {
|
||||
switch (nextBlock->mBlockType) {
|
||||
case 'MAT3':
|
||||
case 'MAT4':
|
||||
size += calcSizeMaterialTable((const J3DMaterialBlock*)nextBlock, flags);
|
||||
break;
|
||||
case 'TEX1':
|
||||
@@ -137,8 +135,7 @@ u32 J3DModelLoader::calcLoadBinaryDisplayListSize(const void* stream, u32 flags)
|
||||
case 'MDL3':
|
||||
size += calcSizeMaterialDL((const J3DMaterialDLBlock*)nextBlock, flags);
|
||||
break;
|
||||
case 'MAT3':
|
||||
case 'MAT4': {
|
||||
case 'MAT3': {
|
||||
u32 flags2 = (J3DMLF_21 | J3DMLF_Material_PE_Full | J3DMLF_Material_Color_LightOn);
|
||||
flags2 |= (u32)flags & (J3DMLF_Material_UseIndirect | J3DMLF_26);
|
||||
mpMaterialBlock = (const J3DMaterialBlock*)nextBlock;
|
||||
|
||||
@@ -99,14 +99,14 @@ void JASDsp::invalChannelAll() {
|
||||
DCInvalidateRange(CH_BUF, sizeof(TChannel) * DSP_CHANNELS);
|
||||
}
|
||||
|
||||
ATTRIBUTE_ALIGN(32) DUSK_GAME_DATA u8 const JASDsp::DSPADPCM_FILTER[64] = {
|
||||
DUSK_GAME_DATA u8 const ATTRIBUTE_ALIGN(32) JASDsp::DSPADPCM_FILTER[64] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x04, 0x00, 0x04, 0x00,
|
||||
0x10, 0x00, 0xF8, 0x00, 0x0E, 0x00, 0xFA, 0x00, 0x0C, 0x00, 0xFC, 0x00, 0x12, 0x00, 0xF6, 0x00,
|
||||
0x10, 0x68, 0xF7, 0x38, 0x12, 0xC0, 0xF7, 0x04, 0x14, 0x00, 0xF4, 0x00, 0x08, 0x00, 0xF8, 0x00,
|
||||
0x04, 0x00, 0xFC, 0x00, 0xFC, 0x00, 0x04, 0x00, 0xFC, 0x00, 0x00, 0x00, 0xF8, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
ATTRIBUTE_ALIGN(32) DUSK_GAME_DATA u32 const JASDsp::DSPRES_FILTER[320] = {
|
||||
DUSK_GAME_DATA u32 const ATTRIBUTE_ALIGN(32) JASDsp::DSPRES_FILTER[320] = {
|
||||
0x0C3966AD,
|
||||
0x0D46FFDF,
|
||||
0x0B396696,
|
||||
|
||||
@@ -25,7 +25,7 @@ void DspHandShake(void*) {
|
||||
Dsp_Running_Start();
|
||||
}
|
||||
|
||||
ATTRIBUTE_ALIGN(32) static u8 jdsp[7936] = {
|
||||
static u8 jdsp[7936] ATTRIBUTE_ALIGN(32) = {
|
||||
0x02, 0x9F, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x02, 0xFF, 0x00, 0x00, 0x02, 0xFF, 0x00, 0x00,
|
||||
0x02, 0xFF, 0x00, 0x00, 0x02, 0xFF, 0x00, 0x00, 0x02, 0xFF, 0x00, 0x00, 0x02, 0x9F, 0x06, 0xA5,
|
||||
0x02, 0x9F, 0x00, 0x4E, 0x12, 0x05, 0x02, 0xBF, 0x00, 0x57, 0x81, 0x00, 0x00, 0x9F, 0x10, 0x00,
|
||||
@@ -524,9 +524,9 @@ ATTRIBUTE_ALIGN(32) static u8 jdsp[7936] = {
|
||||
0x80, 0x01, 0x02, 0xBF, 0x00, 0xF4, 0x02, 0xDF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
ATTRIBUTE_ALIGN(32) static DSPTaskInfo audio_task;
|
||||
static DSPTaskInfo audio_task ATTRIBUTE_ALIGN(32);
|
||||
|
||||
ATTRIBUTE_ALIGN(32) static u8 AUDIO_YIELD_BUFFER[8192];
|
||||
static u8 AUDIO_YIELD_BUFFER[8192] ATTRIBUTE_ALIGN(32);
|
||||
|
||||
void DspBoot(void (*requestCallback)(void*)) {
|
||||
DspInitWork();
|
||||
|
||||
@@ -452,13 +452,13 @@ static void dummy() {
|
||||
JUTXfb::getManager()->setDisplayingXfbIndex(0);
|
||||
}
|
||||
|
||||
ATTRIBUTE_ALIGN(32) static Mtx e_mtx = {
|
||||
static Mtx e_mtx ATTRIBUTE_ALIGN(32) = {
|
||||
{1.0f, 0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 1.0f, 0.0f, 0.0f},
|
||||
{0.0f, 0.0f, 1.0f, 0.0f},
|
||||
};
|
||||
|
||||
ATTRIBUTE_ALIGN(32) static u8 clear_z_TX[64] = {
|
||||
static u8 clear_z_TX[64] ATTRIBUTE_ALIGN(32) = {
|
||||
0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
|
||||
0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
|
||||
@@ -11,11 +11,6 @@
|
||||
#include <cstring>
|
||||
#include "os_report.h"
|
||||
|
||||
#if DUSK_TPHD
|
||||
#include "dusk/settings.h"
|
||||
#include "dusk/tphd/HdAssetLayer.hpp"
|
||||
#endif
|
||||
|
||||
JKRAramArchive::JKRAramArchive() {}
|
||||
|
||||
JKRAramArchive::JKRAramArchive(s32 entryNumber, JKRArchive::EMountDirection mountDirection)
|
||||
@@ -222,13 +217,6 @@ void* JKRAramArchive::fetchResource(SDIFileEntry* pEntry, u32* pOutSize) {
|
||||
if (compression == COMPRESSION_YAZ0) {
|
||||
this->setExpandSize(pEntry, *pOutSize);
|
||||
}
|
||||
#if DUSK_TPHD
|
||||
// ARAM mounts bypass register_mounted_hd_archive; hook the fresh per-file buffer here.
|
||||
if (dusk::tphd_active() && mStringTable != NULL) {
|
||||
dusk::tphd::register_copied_hd_resource(
|
||||
mEntryNum, mStringTable + pEntry->getNameOffset(), outBuf, *pOutSize);
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
if (compression == COMPRESSION_YAZ0) {
|
||||
*pOutSize = this->getExpandSize(pEntry);
|
||||
|
||||
@@ -9,24 +9,6 @@
|
||||
#include "JSystem/JKernel/JKRMemArchive.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
|
||||
#if DUSK_TPHD
|
||||
#include "dusk/tphd/HdAssetLayer.hpp"
|
||||
|
||||
namespace {
|
||||
void register_copied_hd_resource(
|
||||
JKRArchive* archive, JKRArchive::SDIFileEntry* fileEntry, void* buffer, u32 resourceSize) {
|
||||
if (archive == NULL || fileEntry == NULL || buffer == NULL || resourceSize == 0 ||
|
||||
archive->mStringTable == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
dusk::tphd::register_copied_hd_resource(archive->mEntryNum,
|
||||
archive->mStringTable + fileEntry->getNameOffset(), buffer, resourceSize);
|
||||
}
|
||||
} // namespace
|
||||
#endif
|
||||
|
||||
JKRArchive* JKRArchive::check_mount_already(s32 entryNum, JKRHeap* heap) {
|
||||
if (heap == NULL) {
|
||||
heap = JKRGetCurrentHeap();
|
||||
@@ -214,9 +196,6 @@ u32 JKRArchive::readResource(void* buffer, u32 bufferSize, u32 type, const char*
|
||||
if (fileEntry) {
|
||||
u32 resourceSize;
|
||||
fetchResource(buffer, bufferSize, fileEntry, &resourceSize);
|
||||
#if DUSK_TPHD
|
||||
register_copied_hd_resource(this, fileEntry, buffer, resourceSize);
|
||||
#endif
|
||||
return resourceSize;
|
||||
}
|
||||
|
||||
@@ -235,9 +214,6 @@ u32 JKRArchive::readResource(void* buffer, u32 bufferSize, const char* path) {
|
||||
if (fileEntry) {
|
||||
u32 resourceSize;
|
||||
fetchResource(buffer, bufferSize, fileEntry, &resourceSize);
|
||||
#if DUSK_TPHD
|
||||
register_copied_hd_resource(this, fileEntry, buffer, resourceSize);
|
||||
#endif
|
||||
return resourceSize;
|
||||
}
|
||||
|
||||
@@ -250,9 +226,6 @@ u32 JKRArchive::readIdxResource(void* buffer, u32 bufferSize, u32 index) {
|
||||
if (fileEntry) {
|
||||
u32 resourceSize;
|
||||
fetchResource(buffer, bufferSize, fileEntry, &resourceSize);
|
||||
#if DUSK_TPHD
|
||||
register_copied_hd_resource(this, fileEntry, buffer, resourceSize);
|
||||
#endif
|
||||
return resourceSize;
|
||||
}
|
||||
|
||||
@@ -265,9 +238,6 @@ u32 JKRArchive::readResource(void* buffer, u32 bufferSize, u16 id) {
|
||||
if (fileEntry) {
|
||||
u32 resourceSize;
|
||||
fetchResource(buffer, bufferSize, fileEntry, &resourceSize);
|
||||
#if DUSK_TPHD
|
||||
register_copied_hd_resource(this, fileEntry, buffer, resourceSize);
|
||||
#endif
|
||||
return resourceSize;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,10 +10,6 @@
|
||||
#include <stdint.h>
|
||||
#include "os_report.h"
|
||||
|
||||
#if DUSK_TPHD
|
||||
#include "dusk/tphd/HdAssetLayer.hpp"
|
||||
#endif
|
||||
|
||||
JKRMemArchive::JKRMemArchive(s32 entryNum, JKRArchive::EMountDirection mountDirection)
|
||||
: JKRArchive(entryNum, MOUNT_MEM) {
|
||||
mIsMounted = false;
|
||||
@@ -71,13 +67,8 @@ bool JKRMemArchive::open(s32 entryNum, JKRArchive::EMountDirection mountDirectio
|
||||
mIsOpen = false;
|
||||
mMountDirection = mountDirection;
|
||||
|
||||
#ifdef TARGET_PC
|
||||
u32 loadedSize = 0;
|
||||
#endif
|
||||
if (mMountDirection == JKRArchive::MOUNT_DIRECTION_HEAD) {
|
||||
#ifndef TARGET_PC
|
||||
u32 loadedSize;
|
||||
#endif
|
||||
mArcHeader = (SArcHeader *)JKRDvdToMainRam(
|
||||
entryNum, NULL, EXPAND_SWITCH_UNKNOWN1, 0, mHeap, JKRDvdRipper::ALLOC_DIRECTION_FORWARD,
|
||||
0, (int *)&mCompression, &loadedSize);
|
||||
@@ -86,9 +77,7 @@ bool JKRMemArchive::open(s32 entryNum, JKRArchive::EMountDirection mountDirectio
|
||||
}
|
||||
}
|
||||
else {
|
||||
#ifndef TARGET_PC
|
||||
u32 loadedSize;
|
||||
#endif
|
||||
mArcHeader = (SArcHeader *)JKRDvdToMainRam(
|
||||
entryNum, NULL, EXPAND_SWITCH_UNKNOWN1, 0, mHeap,
|
||||
JKRDvdRipper::ALLOC_DIRECTION_BACKWARD, 0, (int *)&mCompression, &loadedSize);
|
||||
@@ -101,9 +90,6 @@ bool JKRMemArchive::open(s32 entryNum, JKRArchive::EMountDirection mountDirectio
|
||||
mMountMode = UNKNOWN_MOUNT_MODE;
|
||||
}
|
||||
else {
|
||||
#if DUSK_TPHD
|
||||
dusk::tphd::register_mounted_hd_archive(entryNum, mArcHeader, loadedSize);
|
||||
#endif
|
||||
JUT_ASSERT(438, mArcHeader->signature == 'RARC');
|
||||
mArcInfoBlock = (SArcDataInfo *)((u8 *)mArcHeader + mArcHeader->header_length);
|
||||
mNodes = (SDIDirEntry *)((u8 *)&mArcInfoBlock->num_nodes + mArcInfoBlock->node_offset);
|
||||
|
||||
@@ -16,10 +16,10 @@ inline f64 getConst2() {
|
||||
return 9.765625E-4;
|
||||
}
|
||||
|
||||
ATTRIBUTE_ALIGN(32) DUSK_GAME_DATA TSinCosTable<13, f32> sincosTable_;
|
||||
DUSK_GAME_DATA TSinCosTable<13, f32> sincosTable_ ATTRIBUTE_ALIGN(32);
|
||||
|
||||
ATTRIBUTE_ALIGN(32) DUSK_GAME_DATA TAtanTable<1024, f32> atanTable_;
|
||||
DUSK_GAME_DATA TAtanTable<1024, f32> atanTable_ ATTRIBUTE_ALIGN(32);
|
||||
|
||||
ATTRIBUTE_ALIGN(32) DUSK_GAME_DATA TAsinAcosTable<1024, f32> asinAcosTable_;
|
||||
DUSK_GAME_DATA TAsinAcosTable<1024, f32> asinAcosTable_ ATTRIBUTE_ALIGN(32);
|
||||
|
||||
} // namespace JMath
|
||||
|
||||
@@ -7,6 +7,11 @@
|
||||
|
||||
#include "JSystem/JMessage/control.h"
|
||||
|
||||
#if TARGET_PC
|
||||
#include "dusk/randomizer/game/custom_flow_ids.hpp"
|
||||
#include "dusk/randomizer/game/messages.hpp"
|
||||
#endif
|
||||
|
||||
JMessage::TControl::TControl()
|
||||
: pSequenceProcessor_(NULL),
|
||||
pRenderingProcessor_(NULL),
|
||||
@@ -71,6 +76,12 @@ int JMessage::TControl::setMessageID(u32 uMsgID, u32 param_1, bool* pbValid) {
|
||||
|
||||
u32 uCode = pProcessor->toMessageCode_messageID(uMsgID, param_1, pbValid);
|
||||
if (uCode == 0xFFFFFFFF) {
|
||||
#if TARGET_PC
|
||||
// If this is a custom text id
|
||||
if (uMsgID >= BASE_CUSTOM_MSG_AND_FLOW_ID)
|
||||
uCode = CUSTOM_BMG_GROUP << 16 | uMsgID;
|
||||
else // return 0
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -80,6 +91,16 @@ int JMessage::TControl::setMessageID(u32 uMsgID, u32 param_1, bool* pbValid) {
|
||||
bool JMessage::TControl::setMessageCode_inSequence_(JMessage::TProcessor const* pProcessor, u16 u16GroupID, u16 u16Index) {
|
||||
pEntry_ = pProcessor->getMessageEntry_messageCode(u16GroupID, u16Index);
|
||||
if (pEntry_ == NULL) {
|
||||
#if TARGET_PC
|
||||
if (HandleCustomText(this, u16Index)) {
|
||||
uMessageGroupID_ = u16GroupID;
|
||||
uMessageID_ = u16Index;
|
||||
pResourceCache_ = pProcessor->getResourceCache();
|
||||
pMessageText_current_ = pMessageText_begin_;
|
||||
oStack_renderingProcessor_.clear();
|
||||
return true;
|
||||
} else
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -90,6 +111,10 @@ bool JMessage::TControl::setMessageCode_inSequence_(JMessage::TProcessor const*
|
||||
JUT_ASSERT(155, pResourceCache_!=NULL);
|
||||
|
||||
pMessageText_begin_ = pResourceCache_->getMessageText_messageEntry(pEntry_);
|
||||
#if TARGET_PC
|
||||
// Feels kinda hacky to have to hijack this deep into JSystem, but works for now
|
||||
HandleTextOverrides(this, pProcessor, uMessageGroupID_, uMessageID_);
|
||||
#endif
|
||||
pMessageText_current_ = pMessageText_begin_;
|
||||
oStack_renderingProcessor_.clear();
|
||||
return true;
|
||||
|
||||
@@ -46,7 +46,7 @@ JPAResource::JPAResource() {
|
||||
mUsrIdx = fldNum = keyNum = texNum = mpCalcEmitterFuncListNum = mpDrawEmitterFuncListNum = mpDrawEmitterChildFuncListNum = mpCalcParticleFuncListNum = mpDrawParticleFuncListNum = mpCalcParticleChildFuncListNum = mpDrawParticleChildFuncListNum = 0;
|
||||
}
|
||||
|
||||
ATTRIBUTE_ALIGN(32) static u8 jpa_pos[324] = {
|
||||
static u8 jpa_pos[324] ATTRIBUTE_ALIGN(32) = {
|
||||
0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x32, 0xCE, 0x00, 0x00, 0xCE, 0x00, 0xE7, 0x00, 0x00, 0x19,
|
||||
0x00, 0x00, 0x19, 0xCE, 0x00, 0xE7, 0xCE, 0x00, 0xCE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xCE,
|
||||
0x00, 0xCE, 0xCE, 0x00, 0x00, 0x19, 0x00, 0x32, 0x19, 0x00, 0x32, 0xE7, 0x00, 0x00, 0xE7, 0x00,
|
||||
@@ -70,7 +70,7 @@ ATTRIBUTE_ALIGN(32) static u8 jpa_pos[324] = {
|
||||
0x00, 0x00, 0x00, 0xCE,
|
||||
};
|
||||
|
||||
ATTRIBUTE_ALIGN(32) static u8 jpa_crd[32] = {
|
||||
static u8 jpa_crd[32] ATTRIBUTE_ALIGN(32) = {
|
||||
0x00, 0x00, 0x01, 0x00, 0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x02, 0x00, 0x02, 0x01, 0x00, 0x01,
|
||||
0x00, 0x00, 0x01, 0x00, 0x01, 0x02, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x02, 0x02, 0x00, 0x02,
|
||||
};
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#endif
|
||||
#include "global.h"
|
||||
|
||||
ATTRIBUTE_ALIGN(32) DUSK_GAME_DATA u8 const JUTResFONT_Ascfont_fix12[] = {
|
||||
DUSK_GAME_DATA u8 const JUTResFONT_Ascfont_fix12[] ATTRIBUTE_ALIGN(32) = {
|
||||
0x46, 0x4F, 0x4E, 0x54, 0x62, 0x66, 0x6E, 0x31, 0x00, 0x00, 0x41, 0x60, 0x00, 0x00, 0x00, 0x04,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x49, 0x4E, 0x46, 0x31, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C,
|
||||
|
||||
@@ -136,7 +136,7 @@ void TRK__read_aram(__REGISTER int c, __REGISTER u32 p2, void* p3) {
|
||||
}
|
||||
|
||||
void TRK__write_aram(__REGISTER int c, __REGISTER u32 p2, void* p3) {
|
||||
ATTRIBUTE_ALIGN(32) u8 buff[32];
|
||||
u8 buff[32] ATTRIBUTE_ALIGN(32);
|
||||
u32 err;
|
||||
__REGISTER int count = c;
|
||||
__REGISTER u32 bf;
|
||||
|
||||
@@ -85,7 +85,7 @@ DSError TRKDoSupportMask(TRKBuffer*) {
|
||||
}
|
||||
|
||||
DSError TRKDoReadMemory(TRKBuffer* buffer) {
|
||||
ATTRIBUTE_ALIGN(32) u8 buf[0x820];
|
||||
u8 buf[0x820] ATTRIBUTE_ALIGN(32);
|
||||
size_t tempLength;
|
||||
int result;
|
||||
int replyErr;
|
||||
@@ -158,7 +158,7 @@ DSError TRKDoReadMemory(TRKBuffer* buffer) {
|
||||
}
|
||||
|
||||
DSError TRKDoWriteMemory(TRKBuffer* b) {
|
||||
ATTRIBUTE_ALIGN(32) u8 buf[0x820];
|
||||
u8 buf[0x820] ATTRIBUTE_ALIGN(32);
|
||||
size_t tempLength;
|
||||
int options;
|
||||
int result;
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
#include "__ax.h"
|
||||
|
||||
ATTRIBUTE_ALIGN(32) static s32 __AXBufferAuxA[3][480];
|
||||
ATTRIBUTE_ALIGN(32) static s32 __AXBufferAuxB[3][480];
|
||||
static s32 __AXBufferAuxA[3][480] ATTRIBUTE_ALIGN(32);
|
||||
static s32 __AXBufferAuxB[3][480] ATTRIBUTE_ALIGN(32);
|
||||
|
||||
static void (* __AXCallbackAuxA)(void*, void*);
|
||||
static void (* __AXCallbackAuxB)(void*, void*);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "__ax.h"
|
||||
|
||||
ATTRIBUTE_ALIGN(32) static AXSPB __AXStudio;
|
||||
static AXSPB __AXStudio ATTRIBUTE_ALIGN(32);
|
||||
|
||||
static s32 __AXSpbAL;
|
||||
static s32 __AXSpbAR;
|
||||
|
||||
@@ -35,9 +35,9 @@ static u32 __AXAuxMixCycles[32] = {
|
||||
0x000009E2, 0x00000E97
|
||||
};
|
||||
|
||||
ATTRIBUTE_ALIGN(32) static AXPB __AXPB[AX_MAX_VOICES];
|
||||
ATTRIBUTE_ALIGN(32) static AXPBITDBUFFER __AXITD[AX_MAX_VOICES];
|
||||
ATTRIBUTE_ALIGN(32) static AXPBU __AXUpdates[AX_MAX_VOICES];
|
||||
static AXPB __AXPB[AX_MAX_VOICES] ATTRIBUTE_ALIGN(32);
|
||||
static AXPBITDBUFFER __AXITD[AX_MAX_VOICES] ATTRIBUTE_ALIGN(32);
|
||||
static AXPBU __AXUpdates[AX_MAX_VOICES] ATTRIBUTE_ALIGN(32);
|
||||
static AXVPB __AXVPB[AX_MAX_VOICES];
|
||||
|
||||
static u32 __AXMaxDspCycles;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
u16 axDspSlaveLength = (AX_DSP_SLAVE_LENGTH * 2);
|
||||
|
||||
ATTRIBUTE_ALIGN(32) u16 axDspSlave[AX_DSP_SLAVE_LENGTH] = {
|
||||
u16 axDspSlave[AX_DSP_SLAVE_LENGTH] ATTRIBUTE_ALIGN(32) = {
|
||||
0x0000, 0x0000, 0x029F, 0x0E88, 0x029F, 0x0E97,
|
||||
0x029F, 0x0EB3, 0x029F, 0x0ED3, 0x029F, 0x0ED9,
|
||||
0x029F, 0x0F0B, 0x029F, 0x0F11, 0x1302, 0x1303,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "__card.h"
|
||||
|
||||
ATTRIBUTE_ALIGN(DOLPHIN_ALIGNMENT) static u8 CardData[352] = {
|
||||
static u8 CardData[352] ATTRIBUTE_ALIGN(DOLPHIN_ALIGNMENT) = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x02, 0xFF, 0x00, 0x21, 0x13, 0x06, 0x12, 0x03, 0x12, 0x04,
|
||||
0x13, 0x05, 0x00, 0x92, 0x00, 0xFF, 0x00, 0x88, 0xFF, 0xFF, 0x00, 0x89, 0xFF, 0xFF, 0x00, 0x8A, 0xFF, 0xFF, 0x00,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <dolphin/demo.h>
|
||||
#include "sdk_math.h"
|
||||
|
||||
ATTRIBUTE_ALIGN(32) static s16 __AVX_internal_buffer[3200];
|
||||
static s16 __AVX_internal_buffer[3200] ATTRIBUTE_ALIGN(32);
|
||||
|
||||
static void (*__AVX_save_isr)(void);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <dolphin/dolphin.h>
|
||||
#include <dolphin/demo.h>
|
||||
|
||||
ATTRIBUTE_ALIGN(32) u32 DEMOFontBitmap[768] = {
|
||||
u32 DEMOFontBitmap[768] ATTRIBUTE_ALIGN(32) = {
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
|
||||
@@ -43,7 +43,7 @@ void* __piReg;
|
||||
GXBool __GXinBegin;
|
||||
#endif
|
||||
|
||||
ATTRIBUTE_ALIGN(32) static u16 DefaultTexData[] = {
|
||||
static u16 DefaultTexData[] ATTRIBUTE_ALIGN(32) = {
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
};
|
||||
|
||||
@@ -7,11 +7,11 @@ const char* __MCCVersion = "<< Dolphin SDK - MCC\tdebug build: Apr 5 2004 03:57
|
||||
const char* __MCCVersion = "<< Dolphin SDK - MCC\trelease build: Apr 5 2004 04:15:49 (0x2301) >>";
|
||||
#endif
|
||||
|
||||
ATTRIBUTE_ALIGN(32) static MCC_ChannelInfo gChannelInfo[16];
|
||||
ATTRIBUTE_ALIGN(32) static char gStreamWork[32];
|
||||
ATTRIBUTE_ALIGN(32) static char m_szAdapterMode[32];
|
||||
ATTRIBUTE_ALIGN(32) static char m_szInitCode[32];
|
||||
ATTRIBUTE_ALIGN(32) static MCC_Info channelInfo[16];
|
||||
static MCC_ChannelInfo gChannelInfo[16] ATTRIBUTE_ALIGN(32);
|
||||
static char gStreamWork[32] ATTRIBUTE_ALIGN(32);
|
||||
static char m_szAdapterMode[32] ATTRIBUTE_ALIGN(32);
|
||||
static char m_szInitCode[32] ATTRIBUTE_ALIGN(32);
|
||||
static MCC_Info channelInfo[16] ATTRIBUTE_ALIGN(32);
|
||||
|
||||
volatile static BOOL gIsChannelinfoDirty = TRUE;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "__os.h"
|
||||
|
||||
ATTRIBUTE_ALIGN(DOLPHIN_ALIGNMENT) static SramControl Scb;
|
||||
static SramControl Scb ATTRIBUTE_ALIGN(DOLPHIN_ALIGNMENT);
|
||||
|
||||
// prototypes
|
||||
static int GetRTC(u32* rtc);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "__card.h"
|
||||
|
||||
ATTRIBUTE_ALIGN(DOLPHIN_ALIGNMENT) static u8 CardData[352] = {
|
||||
static u8 CardData[352] ATTRIBUTE_ALIGN(DOLPHIN_ALIGNMENT) = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x02, 0xFF, 0x00, 0x21, 0x13, 0x06, 0x12, 0x03, 0x12, 0x04,
|
||||
0x13, 0x05, 0x00, 0x92, 0x00, 0xFF, 0x00, 0x88, 0xFF, 0xFF, 0x00, 0x89, 0xFF, 0xFF, 0x00, 0x8A, 0xFF, 0xFF, 0x00,
|
||||
|
||||
@@ -44,7 +44,7 @@ static u32 LastError;
|
||||
static BOOL ResetRequired;
|
||||
static u32 MotorState;
|
||||
static volatile OSTime LastResetEnd;
|
||||
ATTRIBUTE_ALIGN(32) static u32 __DVDNumTmdBytes;
|
||||
static u32 __DVDNumTmdBytes ATTRIBUTE_ALIGN(32);
|
||||
static DVDGameTOC* GameToc;
|
||||
static DVDPartitionInfo* PartInfo;
|
||||
static DVDPartitionInfo* BootGameInfo;
|
||||
@@ -80,10 +80,10 @@ static DVDCommandBlock DummyCommandBlock;
|
||||
static OSAlarm ResetAlarm;
|
||||
static OSAlarm CoverAlarm;
|
||||
|
||||
ATTRIBUTE_ALIGN(32) static u8 __DVDGameTocBuffer[OSRoundUp32B(sizeof(DVDGameTOC) * 4)];
|
||||
ATTRIBUTE_ALIGN(32) static u8 __DVDPartInfoBuffer[OSRoundUp32B(sizeof(DVDPartitionInfo) * 4)];
|
||||
ATTRIBUTE_ALIGN(32) static u8 __DVDTmdBuffer[OSRoundUp32B(sizeof(ESTitleMeta))];
|
||||
ATTRIBUTE_ALIGN(32) static u8 __DVDTicketViewBuffer[OSRoundUp32B(sizeof(ESTicketView))];
|
||||
static u8 __DVDGameTocBuffer[OSRoundUp32B(sizeof(DVDGameTOC) * 4)] ATTRIBUTE_ALIGN(32);
|
||||
static u8 __DVDPartInfoBuffer[OSRoundUp32B(sizeof(DVDPartitionInfo) * 4)] ATTRIBUTE_ALIGN(32);
|
||||
static u8 __DVDTmdBuffer[OSRoundUp32B(sizeof(ESTitleMeta))] ATTRIBUTE_ALIGN(32);
|
||||
static u8 __DVDTicketViewBuffer[OSRoundUp32B(sizeof(ESTicketView))] ATTRIBUTE_ALIGN(32);
|
||||
|
||||
static OSAlarm FatalAlarm;
|
||||
DVDCommandBlock __DVDStopMotorCommandBlock;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "__os.h"
|
||||
#include "__dvd.h"
|
||||
|
||||
ATTRIBUTE_ALIGN(32) static u8 CheckBuffer[32];
|
||||
static u8 CheckBuffer[32] ATTRIBUTE_ALIGN(32);
|
||||
|
||||
static volatile BOOL lowDone = TRUE;
|
||||
static volatile u32 lowIntType = 0;
|
||||
|
||||
@@ -8,15 +8,15 @@ static volatile u8 requestInProgress = FALSE;
|
||||
static u8 breakRequested;
|
||||
static u8 callbackInProgress;
|
||||
|
||||
ATTRIBUTE_ALIGN(32) static u32 registerBuf[8];
|
||||
ATTRIBUTE_ALIGN(32) static u32 statusRegister[8];
|
||||
ATTRIBUTE_ALIGN(32) static u32 controlRegister[8];
|
||||
ATTRIBUTE_ALIGN(32) static s32 lastTicketError[8];
|
||||
static u32 registerBuf[8] ATTRIBUTE_ALIGN(32);
|
||||
static u32 statusRegister[8] ATTRIBUTE_ALIGN(32);
|
||||
static u32 controlRegister[8] ATTRIBUTE_ALIGN(32);
|
||||
static s32 lastTicketError[8] ATTRIBUTE_ALIGN(32);
|
||||
|
||||
static u32 readLength;
|
||||
static u32 spinUpValue;
|
||||
|
||||
ATTRIBUTE_ALIGN(32) static diRegVals_t diRegValCache;
|
||||
static diRegVals_t diRegValCache ATTRIBUTE_ALIGN(32);
|
||||
|
||||
static u8 DVDLowInitCalled = FALSE;
|
||||
|
||||
@@ -42,8 +42,8 @@ typedef struct dvdContext {
|
||||
|
||||
static int freeDvdContext = 0;
|
||||
static u8 dvdContextsInited = FALSE;
|
||||
ATTRIBUTE_ALIGN(32) static dvdContext_t dvdContexts[4];
|
||||
ATTRIBUTE_ALIGN(32) static IOSIoVector ioVec[10];
|
||||
static dvdContext_t dvdContexts[4] ATTRIBUTE_ALIGN(32);
|
||||
static IOSIoVector ioVec[10] ATTRIBUTE_ALIGN(32);
|
||||
|
||||
static void* ddrAllocAligned32(const int size) {
|
||||
void* low, *high;
|
||||
|
||||
@@ -11,8 +11,8 @@ static NANDCommandBlock NandCb;
|
||||
static NANDFileInfo NandInfo;
|
||||
static DVDCBCallback Callback;
|
||||
static u32 NextOffset;
|
||||
ATTRIBUTE_ALIGN(32) DVDErrorInfo __ErrorInfo;
|
||||
ATTRIBUTE_ALIGN(32) DVDErrorInfo __FirstErrorInfo;
|
||||
DVDErrorInfo __ErrorInfo ATTRIBUTE_ALIGN(32);
|
||||
DVDErrorInfo __FirstErrorInfo ATTRIBUTE_ALIGN(32);
|
||||
|
||||
void cbForNandClose(s32 result, NANDCommandBlock* block) {
|
||||
if (Callback) {
|
||||
|
||||
@@ -33,7 +33,7 @@ s32 ESP_CloseLib(void) {
|
||||
|
||||
s32 ESP_LaunchTitle(u64 titleID, ESTicketView* pTicketView) {
|
||||
s32 ret = 0;
|
||||
ATTRIBUTE_ALIGN(32) u8 buf[256];
|
||||
u8 buf[256] ATTRIBUTE_ALIGN(32);
|
||||
IOSIoVector* vec = (IOSIoVector*)(buf + 208);
|
||||
u64* id = (u64*)buf;
|
||||
|
||||
@@ -63,7 +63,7 @@ out:
|
||||
|
||||
s32 ESP_GetTicketViews(ESTitleId titleId, ESTicketView* ticketViewList, u32* ticketViewCnt) {
|
||||
s32 rv = 0;
|
||||
ATTRIBUTE_ALIGN(32) u8 __esBuf[256];
|
||||
u8 __esBuf[256] ATTRIBUTE_ALIGN(32);
|
||||
IOSIoVector* v = (IOSIoVector*)(__esBuf + 256 - 6 * sizeof(IOSIoVector));
|
||||
ESTitleId* p1 = (ESTitleId*)__esBuf;
|
||||
u32* p2 = (u32*)(__esBuf + 32);
|
||||
@@ -111,7 +111,7 @@ out:
|
||||
|
||||
s32 ESP_DiGetTicketView(const void* ticket, ESTicketView* ticketView) {
|
||||
s32 rv = 0;
|
||||
ATTRIBUTE_ALIGN(32) u8 __esBuf[256];
|
||||
u8 __esBuf[256] ATTRIBUTE_ALIGN(32);
|
||||
IOSIoVector* v = (IOSIoVector*)(__esBuf + 256 - 6 * sizeof(IOSIoVector));
|
||||
|
||||
if (__esFd < 0 || ticketView == NULL) {
|
||||
@@ -142,7 +142,7 @@ out:
|
||||
|
||||
s32 ESP_DiGetTmd(ESTitleMeta* tmd, u32* tmdSize) {
|
||||
s32 rv = 0;
|
||||
ATTRIBUTE_ALIGN(32) u8 __esBuf[256];
|
||||
u8 __esBuf[256] ATTRIBUTE_ALIGN(32);
|
||||
IOSIoVector* v = (IOSIoVector*)(__esBuf + 256 - 6 * sizeof(IOSIoVector));
|
||||
u32* p1 = (u32*)__esBuf;
|
||||
|
||||
@@ -184,7 +184,7 @@ out:
|
||||
|
||||
s32 ESP_GetTmdView(ESTitleId titleId, ESTmdView* tmdView, u32* size) {
|
||||
s32 rv = 0;
|
||||
ATTRIBUTE_ALIGN(32) u8 __esBuf[256];
|
||||
u8 __esBuf[256] ATTRIBUTE_ALIGN(32);
|
||||
IOSIoVector* v = (IOSIoVector*)(__esBuf + 256 - 6 * sizeof(IOSIoVector));
|
||||
ESTitleId* p1 = (ESTitleId*)__esBuf;
|
||||
u32* p2 = (u32*)(__esBuf + 32);
|
||||
@@ -233,7 +233,7 @@ out:
|
||||
|
||||
s32 ESP_GetDataDir(ESTitleId titleId, char* dataDir) {
|
||||
s32 rv = 0;
|
||||
ATTRIBUTE_ALIGN(32) u8 __esBuf[256];
|
||||
u8 __esBuf[256] ATTRIBUTE_ALIGN(32);
|
||||
IOSIoVector* v = (IOSIoVector*)(__esBuf + 256 - 6 * sizeof(IOSIoVector));
|
||||
ESTitleId* p1 = (ESTitleId*)__esBuf;
|
||||
|
||||
@@ -260,7 +260,7 @@ out:
|
||||
|
||||
s32 ESP_GetTitleId(ESTitleId* titleId) {
|
||||
s32 rv = 0;
|
||||
ATTRIBUTE_ALIGN(32) u8 __esBuf[256];
|
||||
u8 __esBuf[256] ATTRIBUTE_ALIGN(32);
|
||||
IOSIoVector* v = (IOSIoVector*)(__esBuf + 256 - 6 * sizeof(IOSIoVector));
|
||||
|
||||
if (__esFd < 0 || titleId == NULL) {
|
||||
@@ -283,7 +283,7 @@ out:
|
||||
|
||||
s32 ESP_GetConsumption(ESTicketId ticketId, ESLpEntry* entries, u32* nEntries) {
|
||||
s32 rv = 0;
|
||||
ATTRIBUTE_ALIGN(32) u8 __esBuf[256];
|
||||
u8 __esBuf[256] ATTRIBUTE_ALIGN(32);
|
||||
IOSIoVector* v = (IOSIoVector*)(__esBuf + 256 - 6 * sizeof(IOSIoVector));
|
||||
ESTicketId* p1 = (ESTicketId*)__esBuf;
|
||||
u32* p2 = (u32*)(__esBuf + 32);
|
||||
|
||||
@@ -25,7 +25,7 @@ typedef struct isfs_GetUsage {
|
||||
} isfs_GetUsage;
|
||||
|
||||
typedef struct __isfsCtxt {
|
||||
ATTRIBUTE_ALIGN(32) u8 ioBuf[ROUNDUP(256)];
|
||||
u8 ioBuf[ROUNDUP(256)] ATTRIBUTE_ALIGN(32);
|
||||
ISFSCallback cb;
|
||||
void* ctxt;
|
||||
u32 func;
|
||||
|
||||
@@ -49,7 +49,7 @@ volatile void* __piReg;
|
||||
GXBool __GXinBegin;
|
||||
#endif
|
||||
|
||||
ATTRIBUTE_ALIGN(32) static u16 DefaultTexData[] = {
|
||||
static u16 DefaultTexData[] ATTRIBUTE_ALIGN(32) = {
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
};
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace nw4hbm {
|
||||
|
||||
private:
|
||||
/* 0x00 (base) */
|
||||
/* 0xD4 */ ATTRIBUTE_ALIGN(4) ut::Color mVtxColors[VERTEXCOLOR_MAX];
|
||||
/* 0xD4 */ ut::Color mVtxColors[VERTEXCOLOR_MAX] ATTRIBUTE_ALIGN(4);
|
||||
/* 0xE4 */ detail::TexCoordAry mTexCoordAry;
|
||||
};
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace nw4hbm {
|
||||
public:
|
||||
/* 0x14 */ ut::LinkListNode mLinkNode;
|
||||
|
||||
ATTRIBUTE_ALIGN(32) static u8 mMramBuf[LOAD_BUFFER_SIZE];
|
||||
static u8 mMramBuf[LOAD_BUFFER_SIZE] ATTRIBUTE_ALIGN(32);
|
||||
};
|
||||
typedef ut::LinkList<LoadCommand, offsetof(LoadCommand, mLinkNode)> LoadCommandList;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ static u32 __relnchFl = 0;
|
||||
|
||||
typedef struct IOSRpcRequest {
|
||||
IOSResourceRequest request;
|
||||
ATTRIBUTE_ALIGN(32) IOSIpcCb cb; // I am assuming this is aligned due to where cbArg is stored, and I see nothing between cb and callback_arg?
|
||||
IOSIpcCb cb ATTRIBUTE_ALIGN(32); // I am assuming this is aligned due to where cbArg is stored, and I see nothing between cb and callback_arg?
|
||||
void* callback_arg;
|
||||
u32 relaunch_flag;
|
||||
OSThreadQueue thread_queue;
|
||||
@@ -37,7 +37,7 @@ static IOSRpcRequest* __relnchRpcSave = 0;
|
||||
|
||||
#define ROUNDUP(sz) (((u32)(sz) + (IPC_BUF_CNT / 2 - 1)) & ~(u32)(IPC_BUF_CNT / 2 - 1))
|
||||
|
||||
ATTRIBUTE_ALIGN(32) static u8 __rpcBuf[ROUNDUP(sizeof(IOSRpcRequest))];
|
||||
static u8 __rpcBuf[ROUNDUP(sizeof(IOSRpcRequest))] ATTRIBUTE_ALIGN(32);
|
||||
|
||||
static struct {
|
||||
u32 rcount;
|
||||
|
||||
@@ -33,8 +33,8 @@ enum LibState {
|
||||
};
|
||||
|
||||
static enum LibState s_libState = STATE_NOT_INITIALIZED;
|
||||
ATTRIBUTE_ALIGN(32) static char s_currentDir[64] = "/";
|
||||
ATTRIBUTE_ALIGN(32) static char s_homeDir[64] = "";
|
||||
static char s_currentDir[64] ATTRIBUTE_ALIGN(32) = "/";
|
||||
static char s_homeDir[64] ATTRIBUTE_ALIGN(32) = "";
|
||||
|
||||
static BOOL nandOnShutdown(BOOL final, u32 event);
|
||||
void nandConvertPath(char* abspath, const char* wd, const char* relpath);
|
||||
@@ -262,7 +262,7 @@ s32 nandConvertErrorCode(const ISFSError err) {
|
||||
for (; i < sizeof(ERRMAP) / 4; i = i + 2) {
|
||||
if (ERRMAP[i] == err) {
|
||||
if (err == ISFS_ERROR_ECC_CRIT || err == ISFS_ERROR_HMAC || err == ISFS_ERROR_UNKNOWN || err == IOS_ERROR_UNKNOWN || err == IOS_ERROR_ECC_CRIT) {
|
||||
ATTRIBUTE_ALIGN(64) char buf[128];
|
||||
char buf[128] ATTRIBUTE_ALIGN(64);
|
||||
sprintf(buf, "ISFS error code: %d", err);
|
||||
NANDLoggingAddMessageAsync(nandLoggingCallback, err, buf);
|
||||
}
|
||||
@@ -279,7 +279,7 @@ s32 nandConvertErrorCode(const ISFSError err) {
|
||||
|
||||
OSReport("CAUTION! Unexpected error code [%d] was found.\n", err);
|
||||
{
|
||||
ATTRIBUTE_ALIGN(64) char buf[128];
|
||||
char buf[128] ATTRIBUTE_ALIGN(64);
|
||||
sprintf(buf, "ISFS unexpected error code: %d", err);
|
||||
NANDLoggingAddMessageAsync(nandLoggingCallback, err, buf);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
static IOSFd s_fd = -255;
|
||||
static IOSError s_err = ISFS_ERROR_UNKNOWN;
|
||||
static int s_stage;
|
||||
ATTRIBUTE_ALIGN(64) static char s_message[256];
|
||||
static char s_message[256] ATTRIBUTE_ALIGN(64);
|
||||
static NANDLoggingCallback s_callback = 0;
|
||||
|
||||
static void asyncRoutine(ISFSError, void*);
|
||||
@@ -70,8 +70,8 @@ static void callbackRoutine(BOOL result) {
|
||||
|
||||
static void asyncRoutine(ISFSError result, void *ctxt) {
|
||||
ISFSError ret = ISFS_ERROR_UNKNOWN;
|
||||
ATTRIBUTE_ALIGN(64) static char s_rBuf[256];
|
||||
ATTRIBUTE_ALIGN(64) static char s_wBuf[256];
|
||||
static char s_rBuf[256] ATTRIBUTE_ALIGN(64);
|
||||
static char s_wBuf[256] ATTRIBUTE_ALIGN(64);
|
||||
++s_stage;
|
||||
|
||||
if (s_stage == 2) {
|
||||
|
||||
@@ -293,7 +293,7 @@ s32 NANDMove(const char* path, const char* destDir) {
|
||||
}
|
||||
|
||||
static ISFSError nandGetFileStatus(IOSFd fd, u32* length, u32* pos) {
|
||||
ATTRIBUTE_ALIGN(32) ISFSFileStats fstat;
|
||||
ISFSFileStats fstat ATTRIBUTE_ALIGN(32);
|
||||
ISFSError result = ISFS_GetFileStats(fd, &fstat);
|
||||
if (result == ISFS_ERROR_OK) {
|
||||
if (length) {
|
||||
|
||||
@@ -8,7 +8,7 @@ void __OSRelaunchTitle(u32 resetCode) {
|
||||
s32 rc = 0;
|
||||
u32 ticketCnt = 1;
|
||||
ESTicketView* tik = NULL;
|
||||
ATTRIBUTE_ALIGN(32) ESTitleId titleId;
|
||||
ESTitleId titleId ATTRIBUTE_ALIGN(32);
|
||||
__OSPlayTimeType type = OSPLAYTIME_PERMANENT;
|
||||
u32 remain = 0;
|
||||
u8* bi2 = NULL;
|
||||
|
||||
@@ -85,7 +85,7 @@ NWC24Err NWC24iSynchronizeRtcCounter(BOOL param_0) {
|
||||
}
|
||||
|
||||
NWC24Err NWC24SuspendScheduler(void) {
|
||||
ATTRIBUTE_ALIGN(32) static u8 susResult[0x20];
|
||||
static u8 susResult[0x20] ATTRIBUTE_ALIGN(32);
|
||||
NWC24Err rt = NWC24_OK;
|
||||
NWC24Err closeRt = NWC24_OK;
|
||||
IOSFd fd;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include <revolution/nand.h>
|
||||
|
||||
static BOOL PlayRecordGet = FALSE;
|
||||
ATTRIBUTE_ALIGN(32) static OSPlayRecord PlayRecord;
|
||||
static OSPlayRecord PlayRecord ATTRIBUTE_ALIGN(32);
|
||||
static NANDFileInfo FileInfo;
|
||||
static NANDCommandBlock Block;
|
||||
static s32 PlayRecordState = 9;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include "__os.h"
|
||||
|
||||
ATTRIBUTE_ALIGN(32) OSAlarm __OSExpireAlarm;
|
||||
OSAlarm __OSExpireAlarm ATTRIBUTE_ALIGN(32);
|
||||
OSTime __OSExpireTime;
|
||||
OSPlayTimeCallbackFunc __OSExpireCallback;
|
||||
BOOL __OSExpireSetExpiredFlag;
|
||||
@@ -103,7 +103,7 @@ BOOL __OSWriteExpiredFlag(void) {
|
||||
s32 rv = 0;
|
||||
NANDFileInfo nInfo;
|
||||
BOOL openNInfo = FALSE;
|
||||
ATTRIBUTE_ALIGN(32) u8 titleId[32];
|
||||
u8 titleId[32] ATTRIBUTE_ALIGN(32);
|
||||
|
||||
rv = NANDPrivateCreate("/shared2/expired", 63, 0);
|
||||
|
||||
@@ -162,7 +162,7 @@ BOOL __OSWriteExpiredFlagIfSet(void) {
|
||||
void* __OSPlayTimeRebootThread(void* args) {
|
||||
BOOL enabled;
|
||||
u32 frames, fadeShift = 1;
|
||||
ATTRIBUTE_ALIGN(32) __OSExpireAIFadeStruct aiFade;
|
||||
__OSExpireAIFadeStruct aiFade ATTRIBUTE_ALIGN(32);
|
||||
|
||||
__OSExpireAIFade = &aiFade;
|
||||
memset(__OSExpireAIFade, 0, sizeof(__OSExpireAIFadeStruct));
|
||||
@@ -227,9 +227,9 @@ out:
|
||||
s32 __OSGetPlayTime(ESTicketView* ticket, __OSPlayTimeType* type, u32* playTime) {
|
||||
s32 rv;
|
||||
u32 i;
|
||||
ATTRIBUTE_ALIGN(32) ESLpEntry lpEntry[8];
|
||||
ESLpEntry lpEntry[8] ATTRIBUTE_ALIGN(32);
|
||||
u32 numCc = 0, seenOther = 0;
|
||||
ATTRIBUTE_ALIGN(32) ESTicketView ticketAligned;
|
||||
ESTicketView ticketAligned ATTRIBUTE_ALIGN(32);
|
||||
|
||||
ASSERTLINE(601, ticket && type && playTime);
|
||||
|
||||
@@ -288,7 +288,7 @@ out:
|
||||
|
||||
s32 __OSGetPlayTimeCurrent(__OSPlayTimeType* type, u32* playTime) {
|
||||
s32 rv;
|
||||
ATTRIBUTE_ALIGN(32) ESTicketView ticket;
|
||||
ESTicketView ticket ATTRIBUTE_ALIGN(32);
|
||||
|
||||
ASSERTLINE(676, type && playTime);
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "__os.h"
|
||||
|
||||
ATTRIBUTE_ALIGN(DOLPHIN_ALIGNMENT) static SramControl Scb;
|
||||
static SramControl Scb ATTRIBUTE_ALIGN(DOLPHIN_ALIGNMENT);
|
||||
|
||||
// prototypes
|
||||
static int GetRTC(u32* rtc);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include <revolution/nand.h>
|
||||
#include <cstring>
|
||||
|
||||
ATTRIBUTE_ALIGN(32) static OSStateFlags StateFlags;
|
||||
static OSStateFlags StateFlags ATTRIBUTE_ALIGN(32);
|
||||
|
||||
static u32 CheckSum(OSStateFlags* flags) {
|
||||
u32* ptr, i, sum;
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
|
||||
#include <revolution/private/iosrestypes.h>
|
||||
|
||||
ATTRIBUTE_ALIGN(32) static u32 StmImInBuf[8];
|
||||
ATTRIBUTE_ALIGN(32) static u32 StmImOutBuf[8];
|
||||
static u32 StmImInBuf[8] ATTRIBUTE_ALIGN(32);
|
||||
static u32 StmImOutBuf[8] ATTRIBUTE_ALIGN(32);
|
||||
|
||||
ATTRIBUTE_ALIGN(32) static u32 StmVdInBuf[8];
|
||||
ATTRIBUTE_ALIGN(32) static u32 StmVdOutBuf[8];
|
||||
static u32 StmVdInBuf[8] ATTRIBUTE_ALIGN(32);
|
||||
static u32 StmVdOutBuf[8] ATTRIBUTE_ALIGN(32);
|
||||
|
||||
ATTRIBUTE_ALIGN(32) static u32 StmEhInBuf[8];
|
||||
ATTRIBUTE_ALIGN(32) static u32 StmEhOutBuf[8];
|
||||
static u32 StmEhInBuf[8] ATTRIBUTE_ALIGN(32);
|
||||
static u32 StmEhOutBuf[8] ATTRIBUTE_ALIGN(32);
|
||||
|
||||
static OSResetCallback ResetCallback;
|
||||
static OSPowerCallback PowerCallback;
|
||||
|
||||
@@ -873,4 +873,4 @@ void* OSGetThreadSpecific(s32 index) {
|
||||
|
||||
#include "global.h"
|
||||
extern u8 Debug_BBA_804516D0;
|
||||
ATTRIBUTE_ALIGN(8) u8 Debug_BBA_804516D0;
|
||||
u8 Debug_BBA_804516D0 ATTRIBUTE_ALIGN(8);
|
||||
|
||||
@@ -75,8 +75,8 @@ static const char ConfDirName[] = "/shared2/sys";
|
||||
static const char ConfFileName[] = "/shared2/sys/SYSCONF";
|
||||
static const char ProductInfoFileName[] = "/title/00000001/00000002/data/setting.txt";
|
||||
|
||||
ATTRIBUTE_ALIGN(32) static u8 ConfBuf[0x4000];
|
||||
ATTRIBUTE_ALIGN(32) static u8 ConfBufForFlush[0x4000];
|
||||
static u8 ConfBuf[0x4000] ATTRIBUTE_ALIGN(32);
|
||||
static u8 ConfBufForFlush[0x4000] ATTRIBUTE_ALIGN(32);
|
||||
|
||||
static u8 Initialized;
|
||||
static u8 DirtyFlag;
|
||||
|
||||
@@ -262,7 +262,7 @@ void WPADiManageHandler(OSAlarm*, OSContext*) {
|
||||
BTA_HhGetAclQueueInfo();
|
||||
}
|
||||
|
||||
ATTRIBUTE_ALIGN(32) u8 __WPADiManageHandlerStack[4096];
|
||||
u8 __WPADiManageHandlerStack[4096] ATTRIBUTE_ALIGN(32);
|
||||
|
||||
void WPADiManageHandler0(OSAlarm* alarm, OSContext* context) {
|
||||
OSSwitchFiberEx((u32)alarm, (u32)context, 0, 0, (u32)WPADiManageHandler, (u32)(__WPADiManageHandlerStack + sizeof(__WPADiManageHandlerStack)));
|
||||
|
||||
@@ -41,7 +41,7 @@ WUDControlBlock _wcb;
|
||||
WUDDevInfo _work;
|
||||
static WUDDiscResp _discResp;
|
||||
SCBtDeviceInfoArray _scArray;
|
||||
ATTRIBUTE_ALIGN(32) u8 __WUDHandlerStack[0x1000];
|
||||
u8 __WUDHandlerStack[0x1000] ATTRIBUTE_ALIGN(32);
|
||||
|
||||
extern u8 _scFlush;
|
||||
|
||||
|
||||
+14
-12
@@ -1,6 +1,6 @@
|
||||
# Android Shell
|
||||
|
||||
This directory contains Dusklight's Android shell built on top of Borealis.
|
||||
This directory contains a minimal SDLActivity-based Android app wrapper for Dusklight.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
@@ -25,19 +25,24 @@ cmake --build --preset android-arm64
|
||||
|
||||
This build produces `build/android-arm64/libmain.so`
|
||||
|
||||
## Refresh SDL Java Shim (Optional)
|
||||
|
||||
If you update SDL and want to refresh the embedded Java shim files:
|
||||
|
||||
```bash
|
||||
./android/scripts/sync-sdl-java.sh
|
||||
```
|
||||
|
||||
## Build APK
|
||||
|
||||
```bash
|
||||
cd platforms/android
|
||||
cd android
|
||||
./gradlew :app:assembleDebug
|
||||
```
|
||||
|
||||
Output APK:
|
||||
|
||||
- `app/build/outputs/apk/debug/app-arm64-v8a-debug.apk`
|
||||
|
||||
Aurora needs a hardware-backed graphics adapter. If an AVD has GPU
|
||||
acceleration disabled, launch it with `-gpu host`.
|
||||
- `android/app/build/outputs/apk/debug/app-debug.apk`
|
||||
|
||||
## Launch With Runtime Args (adb)
|
||||
|
||||
@@ -45,13 +50,10 @@ You can pass command-line args through the activity intent:
|
||||
|
||||
```bash
|
||||
adb shell am start -n dev.twilitrealm.dusk/.DuskActivity \
|
||||
--es borealis_args "--backend vulkan"
|
||||
--es dusk_args "--backend vulkan"
|
||||
```
|
||||
|
||||
Supported extras:
|
||||
|
||||
- `borealis_args`: single shell-like argument string
|
||||
- `borealis_argv`: string-array argv
|
||||
|
||||
The legacy `dusk_args` and `dusk_argv` names remain accepted during the shell
|
||||
transition.
|
||||
- `dusk_args`: single shell-like argument string
|
||||
- `dusk_argv`: string-array argv
|
||||
|
||||
@@ -2,32 +2,163 @@ plugins {
|
||||
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 borealisDir = new File(duskRepoDir, 'extern/borealis')
|
||||
def androidNativeBuildDir = new File(duskRepoDir, 'build/android-arm64')
|
||||
def nativeLibrary = new File(androidNativeBuildDir, 'libmain.so')
|
||||
def stageStripValue = providers.gradleProperty('ANDROID_STAGE_STRIP')
|
||||
.orElse(providers.gradleProperty('androidStageStrip'))
|
||||
.orElse(providers.environmentVariable('ANDROID_STAGE_STRIP'))
|
||||
.orElse('1')
|
||||
def androidHome = {
|
||||
def sdkPath = System.getenv('ANDROID_HOME')
|
||||
if (!sdkPath) {
|
||||
throw new GradleException('ANDROID_HOME is not available')
|
||||
}
|
||||
def sdkDir = new File(sdkPath)
|
||||
if (!sdkDir.isDirectory()) {
|
||||
throw new GradleException("ANDROID_HOME points to a missing directory: ${sdkDir}")
|
||||
}
|
||||
sdkDir
|
||||
}.memoize()
|
||||
|
||||
ext.borealisAndroid = [
|
||||
borealisDir: borealisDir,
|
||||
propertiesFile: new File(duskRepoDir, 'build/android-arm64/borealis-android.properties'),
|
||||
namespace: 'dev.twilitrealm.dusk',
|
||||
applicationId: 'dev.twilitrealm.dusk',
|
||||
abis: ['arm64-v8a'],
|
||||
assets: [
|
||||
[
|
||||
from: new File(duskRepoDir, 'res'),
|
||||
into: 'res',
|
||||
excludes: ['**/.DS_Store']
|
||||
],
|
||||
[
|
||||
from: new File(duskRepoDir, 'build/android-arm64/bundled_mods'),
|
||||
into: 'mods',
|
||||
includes: ['*.dusk']
|
||||
]
|
||||
],
|
||||
proguardRules: file('proguard-rules.pro')
|
||||
]
|
||||
def androidNdkVersion = {
|
||||
def ndkVersion = System.getenv('ANDROID_NDK_VERSION')
|
||||
if (!ndkVersion) {
|
||||
throw new GradleException('ANDROID_NDK_VERSION is not available')
|
||||
}
|
||||
ndkVersion
|
||||
}.memoize()
|
||||
|
||||
apply from: new File(borealisDir, 'platforms/android/gradle/borealis-application.gradle')
|
||||
def androidNdkDir = {
|
||||
def ndkDir = new File(androidHome(), "ndk/${androidNdkVersion()}")
|
||||
if (!new File(ndkDir, 'build/cmake/android.toolchain.cmake').isFile()) {
|
||||
throw new GradleException(
|
||||
"Android NDK ${androidNdkVersion()} is missing or invalid at ${ndkDir}"
|
||||
)
|
||||
}
|
||||
ndkDir
|
||||
}.memoize()
|
||||
|
||||
def llvmPrebuiltDir = {
|
||||
def prebuiltRoot = new File(androidNdkDir(), 'toolchains/llvm/prebuilt')
|
||||
def prebuiltDir = (prebuiltRoot.listFiles()?.findAll { it.isDirectory() } ?: [])
|
||||
.sort { it.name }
|
||||
.find { candidate ->
|
||||
new File(
|
||||
candidate,
|
||||
'sysroot/usr/lib/aarch64-linux-android/libc++_shared.so'
|
||||
).isFile()
|
||||
}
|
||||
if (!prebuiltDir) {
|
||||
throw new GradleException("Cannot find NDK libc++_shared.so under ${prebuiltRoot}")
|
||||
}
|
||||
prebuiltDir
|
||||
}.memoize()
|
||||
|
||||
def stlLibrary = {
|
||||
def library = new File(
|
||||
llvmPrebuiltDir(),
|
||||
'sysroot/usr/lib/aarch64-linux-android/libc++_shared.so'
|
||||
)
|
||||
if (!library.isFile()) {
|
||||
throw new GradleException("libc++_shared.so is missing")
|
||||
}
|
||||
library
|
||||
}.memoize()
|
||||
|
||||
def stagedJniLibsDir = layout.buildDirectory.dir('generated/jniLibs/dusklight')
|
||||
|
||||
def stageJniLibs = tasks.register('stageJniLibs', Sync) {
|
||||
group = 'build'
|
||||
from(nativeLibrary) {
|
||||
rename { 'libmain.so' }
|
||||
into 'arm64-v8a'
|
||||
}
|
||||
from(providers.provider { stlLibrary() }) {
|
||||
rename { 'libc++_shared.so' }
|
||||
into 'arm64-v8a'
|
||||
}
|
||||
into(stagedJniLibsDir)
|
||||
|
||||
doFirst {
|
||||
if (!nativeLibrary.isFile()) {
|
||||
throw new GradleException("Native library is missing")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def duskGeneratedAssetsDir = layout.buildDirectory.dir('generated/assets/dusklight')
|
||||
def syncDuskAssets = tasks.register('syncDuskAssets', Sync) {
|
||||
from(new File(duskRepoDir, 'res')) {
|
||||
into 'res'
|
||||
exclude '**/.DS_Store'
|
||||
}
|
||||
from(new File(androidNativeBuildDir, 'bundled_mods')) {
|
||||
into 'mods'
|
||||
include '*.dusk'
|
||||
}
|
||||
into(duskGeneratedAssetsDir)
|
||||
}
|
||||
|
||||
android {
|
||||
namespace 'dev.twilitrealm.dusk'
|
||||
compileSdk 36
|
||||
ndkVersion androidNdkVersion()
|
||||
|
||||
defaultConfig {
|
||||
applicationId 'dev.twilitrealm.dusk'
|
||||
minSdk 26
|
||||
targetSdk 36
|
||||
versionCode versionCodeInt
|
||||
versionName versionNameStr
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
minifyEnabled false
|
||||
}
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
jniLibs.srcDirs = [stagedJniLibsDir]
|
||||
assets.srcDirs = [duskGeneratedAssetsDir]
|
||||
}
|
||||
}
|
||||
|
||||
packaging {
|
||||
jniLibs {
|
||||
if (stageStripValue.get() == '0') {
|
||||
keepDebugSymbols += '**/libmain.so'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
splits {
|
||||
abi {
|
||||
enable true
|
||||
reset()
|
||||
include 'arm64-v8a'
|
||||
universalApk false
|
||||
}
|
||||
}
|
||||
|
||||
lint {
|
||||
abortOnError false
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
}
|
||||
|
||||
tasks.named('preBuild').configure {
|
||||
dependsOn(stageJniLibs, syncDuskAssets)
|
||||
}
|
||||
|
||||
+4
-1
@@ -1 +1,4 @@
|
||||
-keep class dev.twilitrealm.dusk.DuskActivity { *; }
|
||||
# Keep SDL activity and related JNI bridge methods.
|
||||
-keep class org.libsdl.app.** { *; }
|
||||
-keep class dev.twilitrealm.dusk.DuskHttpClient { *; }
|
||||
-keep class dev.twilitrealm.dusk.DuskHttpClient$Response { *; }
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
android:resource="@xml/game_mode_config" />
|
||||
|
||||
<provider
|
||||
android:name="dev.encounter.borealis.BorealisDocumentsProvider"
|
||||
android:authorities="${applicationId}.documents"
|
||||
android:name="dev.twilitrealm.dusk.DuskDocumentsProvider"
|
||||
android:authorities="dev.twilitrealm.dusk.documents"
|
||||
android:exported="true"
|
||||
android:grantUriPermissions="true"
|
||||
android:permission="android.permission.MANAGE_DOCUMENTS">
|
||||
|
||||
@@ -1,23 +1,102 @@
|
||||
package dev.twilitrealm.dusk;
|
||||
|
||||
import android.app.ActionBar;
|
||||
import android.app.Activity;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.ClipData;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.provider.DocumentsContract;
|
||||
import android.provider.OpenableColumns;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import android.view.Display;
|
||||
import android.view.Surface;
|
||||
import android.view.SurfaceHolder;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowInsets;
|
||||
import android.view.WindowInsetsController;
|
||||
|
||||
import dev.encounter.borealis.BorealisActivity;
|
||||
import org.libsdl.app.SDLActivity;
|
||||
import org.libsdl.app.SDLSurface;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DuskActivity extends BorealisActivity {
|
||||
public class DuskActivity extends SDLActivity {
|
||||
private static final String TAG = "DuskActivity";
|
||||
private static final float DEFAULT_SURFACE_FRAME_RATE = 60.0f;
|
||||
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 =
|
||||
"com.android.externalstorage.documents";
|
||||
|
||||
private long folderDialogUserdata = 0;
|
||||
private boolean awaitingManageStoragePermission = false;
|
||||
|
||||
private static native void nativeFolderDialogResult(long userdata, String path, String error);
|
||||
|
||||
private static String[] splitArgs(String raw) {
|
||||
List<String> out = new ArrayList<>();
|
||||
StringBuilder current = new StringBuilder();
|
||||
boolean inSingle = false;
|
||||
boolean inDouble = false;
|
||||
boolean escaped = false;
|
||||
|
||||
for (int i = 0; i < raw.length(); ++i) {
|
||||
char c = raw.charAt(i);
|
||||
if (escaped) {
|
||||
current.append(c);
|
||||
escaped = false;
|
||||
continue;
|
||||
}
|
||||
if (c == '\\' && !inSingle) {
|
||||
escaped = true;
|
||||
continue;
|
||||
}
|
||||
if (c == '"' && !inSingle) {
|
||||
inDouble = !inDouble;
|
||||
continue;
|
||||
}
|
||||
if (c == '\'' && !inDouble) {
|
||||
inSingle = !inSingle;
|
||||
continue;
|
||||
}
|
||||
if (!inSingle && !inDouble && Character.isWhitespace(c)) {
|
||||
if (current.length() > 0) {
|
||||
out.add(current.toString());
|
||||
current.setLength(0);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
current.append(c);
|
||||
}
|
||||
|
||||
if (escaped) {
|
||||
current.append('\\');
|
||||
}
|
||||
if (current.length() > 0) {
|
||||
out.add(current.toString());
|
||||
}
|
||||
return out.toArray(new String[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
extractBundledMods();
|
||||
super.onCreate(savedInstanceState);
|
||||
hideSystemBars();
|
||||
}
|
||||
|
||||
// Bundled mod packages ship as APK assets, which the native loader cannot read directly;
|
||||
@@ -65,22 +144,458 @@ public class DuskActivity extends BorealisActivity {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String[] getArguments() {
|
||||
String[] arguments = super.getArguments();
|
||||
if (arguments.length > 0) {
|
||||
return arguments;
|
||||
}
|
||||
|
||||
Intent intent = getIntent();
|
||||
if (intent == null) {
|
||||
return arguments;
|
||||
}
|
||||
String[] argv = intent.getStringArrayExtra("dusk_argv");
|
||||
if (argv != null && argv.length > 0) {
|
||||
return argv;
|
||||
}
|
||||
String rawArgs = intent.getStringExtra("dusk_args");
|
||||
return rawArgs == null ? arguments : splitArguments(rawArgs.trim());
|
||||
protected SDLSurface createSDLSurface(Context context) {
|
||||
return new DuskSurface(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
hideSystemBars();
|
||||
if (awaitingManageStoragePermission) {
|
||||
resumeFolderDialogAfterPermissionGrant();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWindowFocusChanged(boolean hasFocus) {
|
||||
super.onWindowFocusChanged(hasFocus);
|
||||
if (hasFocus) {
|
||||
hideSystemBars();
|
||||
}
|
||||
}
|
||||
|
||||
private void hideSystemBars() {
|
||||
Window window = getWindow();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
window.setDecorFitsSystemWindows(false);
|
||||
WindowInsetsController ctrl = window.getDecorView().getWindowInsetsController();
|
||||
if (ctrl != null) {
|
||||
ctrl.setSystemBarsBehavior(
|
||||
WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE);
|
||||
ctrl.hide(WindowInsets.Type.systemBars());
|
||||
}
|
||||
} else {
|
||||
View decorView = window.getDecorView();
|
||||
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN |
|
||||
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
|
||||
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY |
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
|
||||
decorView.setSystemUiVisibility(uiOptions);
|
||||
ActionBar actionBar = getActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String[] getLibraries() {
|
||||
// SDL3 is statically linked into libmain.so in this build.
|
||||
return new String[] {
|
||||
"main"
|
||||
};
|
||||
}
|
||||
|
||||
public void setPreferredSurfaceFrameRate(float frameRate) {
|
||||
runOnUiThread(() -> {
|
||||
if (mSurface instanceof DuskSurface) {
|
||||
((DuskSurface)mSurface).setPreferredFrameRate(frameRate);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static final class DuskSurface extends SDLSurface {
|
||||
private float preferredFrameRate = DEFAULT_SURFACE_FRAME_RATE;
|
||||
|
||||
DuskSurface(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
|
||||
super.surfaceChanged(holder, format, width, height);
|
||||
setTargetFrameRate(holder);
|
||||
}
|
||||
|
||||
void setPreferredFrameRate(float frameRate) {
|
||||
preferredFrameRate = frameRate;
|
||||
setTargetFrameRate(getHolder());
|
||||
}
|
||||
|
||||
private void setTargetFrameRate(SurfaceHolder holder) {
|
||||
if (!mIsSurfaceReady || Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
|
||||
return;
|
||||
}
|
||||
|
||||
Surface surface = holder != null ? holder.getSurface() : getHolder().getSurface();
|
||||
if (surface == null || !surface.isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
float targetFrameRate = getMaxSupportedFrameRate();
|
||||
if (preferredFrameRate > 0.0f) {
|
||||
targetFrameRate = preferredFrameRate;
|
||||
}
|
||||
if (targetFrameRate <= 0.0f) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
surface.setFrameRate(
|
||||
targetFrameRate, Surface.FRAME_RATE_COMPATIBILITY_DEFAULT);
|
||||
Log.v(TAG, "Requested surface frame rate " + targetFrameRate + " fps");
|
||||
} catch (RuntimeException e) {
|
||||
Log.w(TAG, "Failed to request surface frame rate", e);
|
||||
}
|
||||
}
|
||||
|
||||
private float getMaxSupportedFrameRate() {
|
||||
if (mDisplay == null) {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
float maxFrameRate = mDisplay.getRefreshRate();
|
||||
Display.Mode[] modes = mDisplay.getSupportedModes();
|
||||
if (modes == null) {
|
||||
return maxFrameRate;
|
||||
}
|
||||
|
||||
for (Display.Mode mode : modes) {
|
||||
maxFrameRate = Math.max(maxFrameRate, mode.getRefreshRate());
|
||||
}
|
||||
return maxFrameRate;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String[] getArguments() {
|
||||
Intent intent = getIntent();
|
||||
if (intent != null) {
|
||||
String[] argv = intent.getStringArrayExtra("dusk_argv");
|
||||
if (argv != null && argv.length > 0) {
|
||||
return argv;
|
||||
}
|
||||
|
||||
String rawArgs = intent.getStringExtra("dusk_args");
|
||||
if (rawArgs != null) {
|
||||
String trimmed = rawArgs.trim();
|
||||
if (!trimmed.isEmpty()) {
|
||||
return splitArgs(trimmed);
|
||||
}
|
||||
}
|
||||
}
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
if (resultCode == RESULT_OK) {
|
||||
persistUriPermissions(data);
|
||||
}
|
||||
if (requestCode == FOLDER_DIALOG_REQUEST_CODE) {
|
||||
finishFolderDialog(resultCode, data);
|
||||
return;
|
||||
}
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
|
||||
public boolean showFolderDialog(long userdata) {
|
||||
if (userdata == 0 || folderDialogUserdata != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
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(() -> {
|
||||
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
|
||||
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION |
|
||||
Intent.FLAG_GRANT_WRITE_URI_PERMISSION |
|
||||
Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION |
|
||||
Intent.FLAG_GRANT_PREFIX_URI_PERMISSION);
|
||||
|
||||
try {
|
||||
startActivityForResult(intent, FOLDER_DIALOG_REQUEST_CODE);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
Log.w(TAG, "Unable to open folder dialog.", e);
|
||||
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;
|
||||
}
|
||||
|
||||
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) {
|
||||
long userdata = folderDialogUserdata;
|
||||
folderDialogUserdata = 0;
|
||||
if (userdata == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (resultCode == RESULT_OK && data != null && data.getData() != null) {
|
||||
String path = getRealPathForUri(data.getData());
|
||||
if (path != null && !path.isEmpty()) {
|
||||
nativeFolderDialogResult(userdata, path, null);
|
||||
} else {
|
||||
nativeFolderDialogResult(
|
||||
userdata, null, "Selected folder is not available as a filesystem path");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
nativeFolderDialogResult(userdata, null, null);
|
||||
}
|
||||
|
||||
private String getRealPathForUri(Uri uri) {
|
||||
if (uri == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String scheme = uri.getScheme();
|
||||
if ("file".equals(scheme)) {
|
||||
return uri.getPath();
|
||||
}
|
||||
|
||||
if (!"content".equals(scheme) ||
|
||||
!EXTERNAL_STORAGE_AUTHORITY.equals(uri.getAuthority()) ||
|
||||
Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
return getExternalStoragePathForDocumentId(getExternalStorageDocumentId(uri));
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.w(TAG, "Unable to resolve URI: " + uri, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static String getExternalStorageDocumentId(Uri uri) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && isTreeDocumentUri(uri)) {
|
||||
return DocumentsContract.getTreeDocumentId(uri);
|
||||
}
|
||||
|
||||
return DocumentsContract.getDocumentId(uri);
|
||||
}
|
||||
|
||||
private static boolean isTreeDocumentUri(Uri uri) {
|
||||
List<String> segments = uri.getPathSegments();
|
||||
return segments.size() >= 2 && "tree".equals(segments.get(0));
|
||||
}
|
||||
|
||||
private String getExternalStoragePathForDocumentId(String documentId) {
|
||||
if (documentId == null || documentId.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
if (documentId.startsWith("raw:")) {
|
||||
return documentId.substring("raw:".length());
|
||||
}
|
||||
|
||||
String[] parts = documentId.split(":", 2);
|
||||
String volumeId = parts[0];
|
||||
String relativePath = parts.length > 1 ? parts[1] : "";
|
||||
|
||||
File root = getExternalStorageRoot(volumeId);
|
||||
if (root == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return relativePath.isEmpty()
|
||||
? root.getAbsolutePath()
|
||||
: new File(root, relativePath).getAbsolutePath();
|
||||
}
|
||||
|
||||
private File getExternalStorageRoot(String volumeId) {
|
||||
if ("primary".equalsIgnoreCase(volumeId)) {
|
||||
return Environment.getExternalStorageDirectory();
|
||||
}
|
||||
if ("home".equalsIgnoreCase(volumeId)) {
|
||||
return new File(
|
||||
Environment.getExternalStorageDirectory(), Environment.DIRECTORY_DOCUMENTS);
|
||||
}
|
||||
|
||||
File[] externalFilesDirs = getExternalFilesDirs(null);
|
||||
if (externalFilesDirs != null) {
|
||||
for (File externalFilesDir : externalFilesDirs) {
|
||||
File root = getStorageRootForExternalFilesDir(externalFilesDir);
|
||||
if (root != null && volumeId.equalsIgnoreCase(root.getName())) {
|
||||
return root;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File fallback = new File("/storage", volumeId);
|
||||
return fallback.exists() ? fallback : null;
|
||||
}
|
||||
|
||||
private File getStorageRootForExternalFilesDir(File externalFilesDir) {
|
||||
if (externalFilesDir == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String path = externalFilesDir.getAbsolutePath();
|
||||
int androidDir = path.indexOf("/Android/");
|
||||
if (androidDir <= 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new File(path.substring(0, androidDir));
|
||||
}
|
||||
|
||||
private void persistUriPermissions(Intent data) {
|
||||
if (data == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
int permissionFlags =
|
||||
data.getFlags() & (Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
|
||||
if (permissionFlags == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Uri uri = data.getData();
|
||||
if (uri != null) {
|
||||
persistUriPermission(uri, permissionFlags);
|
||||
}
|
||||
|
||||
ClipData clipData = data.getClipData();
|
||||
if (clipData == null) {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < clipData.getItemCount(); ++i) {
|
||||
Uri itemUri = clipData.getItemAt(i).getUri();
|
||||
if (itemUri != null) {
|
||||
persistUriPermission(itemUri, permissionFlags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void persistUriPermission(Uri uri, int permissionFlags) {
|
||||
if ((permissionFlags & Intent.FLAG_GRANT_READ_URI_PERMISSION) != 0) {
|
||||
persistUriPermission(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION, "read");
|
||||
}
|
||||
if ((permissionFlags & Intent.FLAG_GRANT_WRITE_URI_PERMISSION) != 0) {
|
||||
persistUriPermission(uri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION, "write");
|
||||
}
|
||||
}
|
||||
|
||||
private void persistUriPermission(Uri uri, int permissionFlag, String permissionName) {
|
||||
try {
|
||||
getContentResolver().takePersistableUriPermission(uri, permissionFlag);
|
||||
} catch (SecurityException | IllegalArgumentException e) {
|
||||
Log.w(TAG, "Unable to persist " + permissionName + " URI permission for " + uri, e);
|
||||
}
|
||||
}
|
||||
|
||||
public String getDisplayNameForUri(String uriString) {
|
||||
if (uriString == null || uriString.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
Uri uri = Uri.parse(uriString);
|
||||
if ("content".equals(uri.getScheme())) {
|
||||
try (Cursor cursor = getContentResolver().query(
|
||||
uri, new String[] { OpenableColumns.DISPLAY_NAME }, null, null, null))
|
||||
{
|
||||
if (cursor != null && cursor.moveToFirst()) {
|
||||
int displayNameColumn = cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME);
|
||||
if (displayNameColumn >= 0) {
|
||||
String displayName = cursor.getString(displayNameColumn);
|
||||
if (displayName != null && !displayName.isEmpty()) {
|
||||
return displayName;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (SecurityException | IllegalArgumentException e) {
|
||||
Log.w(TAG, "Unable to query display name for " + uri, e);
|
||||
}
|
||||
} else if ("file".equals(uri.getScheme())) {
|
||||
String path = uri.getPath();
|
||||
if (path != null && !path.isEmpty()) {
|
||||
String name = new File(path).getName();
|
||||
if (!name.isEmpty()) {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String lastSegment = uri.getLastPathSegment();
|
||||
return lastSegment != null ? lastSegment : "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,467 @@
|
||||
package dev.twilitrealm.dusk;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.content.res.AssetFileDescriptor;
|
||||
import android.database.Cursor;
|
||||
import android.database.MatrixCursor;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.CancellationSignal;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import android.provider.DocumentsContract;
|
||||
import android.provider.DocumentsContract.Document;
|
||||
import android.provider.DocumentsContract.Root;
|
||||
import android.provider.DocumentsProvider;
|
||||
import android.webkit.MimeTypeMap;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
public class DuskDocumentsProvider extends DocumentsProvider {
|
||||
public static final String AUTHORITY = "dev.twilitrealm.dusk.documents";
|
||||
|
||||
private static final String ROOT_ID = "dusk";
|
||||
private static final String ROOT_DOCUMENT_ID = "root";
|
||||
private static final String LOCATION_DESCRIPTOR_NAME = "data_location.json";
|
||||
private static final String DIRECTORY_MIME_TYPE = Document.MIME_TYPE_DIR;
|
||||
|
||||
private static final String[] DEFAULT_ROOT_PROJECTION = new String[] {
|
||||
Root.COLUMN_ROOT_ID,
|
||||
Root.COLUMN_FLAGS,
|
||||
Root.COLUMN_TITLE,
|
||||
Root.COLUMN_DOCUMENT_ID,
|
||||
Root.COLUMN_ICON,
|
||||
Root.COLUMN_AVAILABLE_BYTES,
|
||||
Root.COLUMN_SUMMARY
|
||||
};
|
||||
|
||||
private static final String[] DEFAULT_DOCUMENT_PROJECTION = new String[] {
|
||||
Document.COLUMN_DOCUMENT_ID,
|
||||
Document.COLUMN_DISPLAY_NAME,
|
||||
Document.COLUMN_FLAGS,
|
||||
Document.COLUMN_MIME_TYPE,
|
||||
Document.COLUMN_LAST_MODIFIED,
|
||||
Document.COLUMN_SIZE
|
||||
};
|
||||
|
||||
@Override
|
||||
public boolean onCreate() {
|
||||
if (!isCustomDataPathEnabled()) {
|
||||
ensureUserDirectories();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cursor queryRoots(String[] projection) throws FileNotFoundException {
|
||||
final MatrixCursor result = new MatrixCursor(resolveRootProjection(projection));
|
||||
if (isCustomDataPathEnabled()) {
|
||||
return result;
|
||||
}
|
||||
|
||||
final File root = getRootDirectory();
|
||||
final MatrixCursor.RowBuilder row = result.newRow();
|
||||
|
||||
row.add(Root.COLUMN_ROOT_ID, ROOT_ID);
|
||||
row.add(Root.COLUMN_FLAGS,
|
||||
Root.FLAG_LOCAL_ONLY |
|
||||
Root.FLAG_SUPPORTS_CREATE |
|
||||
Root.FLAG_SUPPORTS_IS_CHILD);
|
||||
row.add(Root.COLUMN_TITLE, getContext().getString(R.string.app_name));
|
||||
row.add(Root.COLUMN_DOCUMENT_ID, ROOT_DOCUMENT_ID);
|
||||
row.add(Root.COLUMN_ICON, R.mipmap.icon);
|
||||
row.add(Root.COLUMN_AVAILABLE_BYTES, root.getFreeSpace());
|
||||
row.add(Root.COLUMN_SUMMARY, getContext().getString(R.string.documents_provider_summary));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cursor queryDocument(String documentId, String[] projection) throws FileNotFoundException {
|
||||
final MatrixCursor result = new MatrixCursor(resolveDocumentProjection(projection));
|
||||
includeDocument(result, documentId, getFileForDocumentId(documentId));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cursor queryChildDocuments(String parentDocumentId, String[] projection, String sortOrder)
|
||||
throws FileNotFoundException
|
||||
{
|
||||
return queryChildDocumentsInternal(parentDocumentId, projection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cursor queryChildDocuments(String parentDocumentId, String[] projection, Bundle queryArgs)
|
||||
throws FileNotFoundException
|
||||
{
|
||||
return queryChildDocumentsInternal(parentDocumentId, projection);
|
||||
}
|
||||
|
||||
private Cursor queryChildDocumentsInternal(String parentDocumentId, String[] projection)
|
||||
throws FileNotFoundException
|
||||
{
|
||||
final MatrixCursor result = new MatrixCursor(resolveDocumentProjection(projection));
|
||||
final File parent = getFileForDocumentId(parentDocumentId);
|
||||
final File[] files = parent.listFiles();
|
||||
result.setNotificationUri(getContext().getContentResolver(), getChildDocumentsUri(parentDocumentId));
|
||||
|
||||
if (files == null) {
|
||||
return result;
|
||||
}
|
||||
|
||||
for (File file : files) {
|
||||
includeDocument(result, getDocumentIdForFile(file), file);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isChildDocument(String parentDocumentId, String documentId) {
|
||||
try {
|
||||
final File parent = getFileForDocumentId(parentDocumentId);
|
||||
final File child = getFileForDocumentId(documentId);
|
||||
return isInside(parent, child);
|
||||
} catch (FileNotFoundException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createDocument(String parentDocumentId, String mimeType, String displayName)
|
||||
throws FileNotFoundException
|
||||
{
|
||||
final File parent = getFileForDocumentId(parentDocumentId);
|
||||
if (!parent.isDirectory()) {
|
||||
throw new FileNotFoundException("Parent is not a directory: " + parentDocumentId);
|
||||
}
|
||||
|
||||
final String safeDisplayName = sanitizeDisplayName(displayName);
|
||||
final File file = buildUniqueFile(parent, safeDisplayName);
|
||||
final boolean created;
|
||||
if (DIRECTORY_MIME_TYPE.equals(mimeType)) {
|
||||
created = file.mkdir();
|
||||
} else {
|
||||
try {
|
||||
created = file.createNewFile();
|
||||
} catch (IOException e) {
|
||||
throw asFileNotFound("Unable to create document", e);
|
||||
}
|
||||
}
|
||||
|
||||
if (!created) {
|
||||
throw new FileNotFoundException("Unable to create document: " + displayName);
|
||||
}
|
||||
|
||||
notifyChildrenChanged(parentDocumentId);
|
||||
return getDocumentIdForFile(file);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String renameDocument(String documentId, String displayName) throws FileNotFoundException {
|
||||
final File file = getFileForDocumentId(documentId);
|
||||
if (ROOT_DOCUMENT_ID.equals(documentId)) {
|
||||
throw new FileNotFoundException("Cannot rename root document");
|
||||
}
|
||||
|
||||
final File target = buildUniqueFile(file.getParentFile(), sanitizeDisplayName(displayName));
|
||||
final String parentDocumentId = getDocumentIdForFile(file.getParentFile());
|
||||
if (!file.renameTo(target)) {
|
||||
throw new FileNotFoundException("Unable to rename document: " + documentId);
|
||||
}
|
||||
notifyDocumentChanged(documentId);
|
||||
notifyDocumentChanged(getDocumentIdForFile(target));
|
||||
notifyChildrenChanged(parentDocumentId);
|
||||
return getDocumentIdForFile(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDocument(String documentId) throws FileNotFoundException {
|
||||
if (ROOT_DOCUMENT_ID.equals(documentId)) {
|
||||
throw new FileNotFoundException("Cannot delete root document");
|
||||
}
|
||||
|
||||
final File file = getFileForDocumentId(documentId);
|
||||
final String parentDocumentId = getDocumentIdForFile(file.getParentFile());
|
||||
deleteRecursively(file);
|
||||
notifyDocumentChanged(documentId);
|
||||
notifyChildrenChanged(parentDocumentId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParcelFileDescriptor openDocument(String documentId, String mode, CancellationSignal signal)
|
||||
throws FileNotFoundException
|
||||
{
|
||||
return ParcelFileDescriptor.open(getFileForDocumentId(documentId), modeToParcelMode(mode));
|
||||
}
|
||||
|
||||
@Override
|
||||
public AssetFileDescriptor openDocumentThumbnail(String documentId, android.graphics.Point sizeHint,
|
||||
CancellationSignal signal) throws FileNotFoundException
|
||||
{
|
||||
throw new FileNotFoundException("Thumbnails are not supported");
|
||||
}
|
||||
|
||||
private void includeDocument(MatrixCursor result, String documentId, File file) throws FileNotFoundException {
|
||||
final MatrixCursor.RowBuilder row = result.newRow();
|
||||
final boolean isDirectory = file.isDirectory();
|
||||
final String displayName = ROOT_DOCUMENT_ID.equals(documentId)
|
||||
? getContext().getString(R.string.documents_provider_root_name)
|
||||
: file.getName();
|
||||
|
||||
int flags = Document.FLAG_SUPPORTS_DELETE | Document.FLAG_SUPPORTS_RENAME;
|
||||
if (isDirectory) {
|
||||
flags |= Document.FLAG_DIR_SUPPORTS_CREATE;
|
||||
} else if (file.canWrite()) {
|
||||
flags |= Document.FLAG_SUPPORTS_WRITE;
|
||||
}
|
||||
if (ROOT_DOCUMENT_ID.equals(documentId)) {
|
||||
flags &= ~(Document.FLAG_SUPPORTS_DELETE | Document.FLAG_SUPPORTS_RENAME);
|
||||
}
|
||||
|
||||
row.add(Document.COLUMN_DOCUMENT_ID, documentId);
|
||||
row.add(Document.COLUMN_DISPLAY_NAME, displayName);
|
||||
row.add(Document.COLUMN_FLAGS, flags);
|
||||
row.add(Document.COLUMN_MIME_TYPE, isDirectory ? DIRECTORY_MIME_TYPE : getMimeType(file));
|
||||
row.add(Document.COLUMN_LAST_MODIFIED, file.lastModified());
|
||||
row.add(Document.COLUMN_SIZE, isDirectory ? null : file.length());
|
||||
}
|
||||
|
||||
private File getRootDirectory() throws FileNotFoundException {
|
||||
if (isCustomDataPathEnabled()) {
|
||||
throw new FileNotFoundException(
|
||||
"Dusk DocumentsProvider is disabled while a custom data path is configured");
|
||||
}
|
||||
|
||||
final File root = getContext().getFilesDir();
|
||||
if (root == null) {
|
||||
throw new FileNotFoundException("Dusklight files directory is unavailable");
|
||||
}
|
||||
return root;
|
||||
}
|
||||
|
||||
private File getFileForDocumentId(String documentId) throws FileNotFoundException {
|
||||
final File root = getRootDirectory();
|
||||
if (ROOT_DOCUMENT_ID.equals(documentId)) {
|
||||
return root;
|
||||
}
|
||||
if (!documentId.startsWith(ROOT_DOCUMENT_ID + "/")) {
|
||||
throw new FileNotFoundException("Invalid document id: " + documentId);
|
||||
}
|
||||
|
||||
final String relativePath = documentId.substring(ROOT_DOCUMENT_ID.length() + 1);
|
||||
final File file = new File(root, relativePath);
|
||||
if (!isInside(root, file)) {
|
||||
throw new FileNotFoundException("Document escapes Dusklight files directory: " + documentId);
|
||||
}
|
||||
if (!file.exists()) {
|
||||
throw new FileNotFoundException("Document does not exist: " + documentId);
|
||||
}
|
||||
return file;
|
||||
}
|
||||
|
||||
private String getDocumentIdForFile(File file) throws FileNotFoundException {
|
||||
final File root = getRootDirectory();
|
||||
if (sameFile(root, file)) {
|
||||
return ROOT_DOCUMENT_ID;
|
||||
}
|
||||
if (!isInside(root, file)) {
|
||||
throw new FileNotFoundException("File escapes Dusklight files directory: " + file);
|
||||
}
|
||||
|
||||
final String rootPath = canonicalPath(root);
|
||||
final String filePath = canonicalPath(file);
|
||||
return ROOT_DOCUMENT_ID + "/" + filePath.substring(rootPath.length() + 1);
|
||||
}
|
||||
|
||||
private void ensureUserDirectories() {
|
||||
final File root = getContext().getFilesDir();
|
||||
if (root == null) {
|
||||
return;
|
||||
}
|
||||
new File(root, "texture_replacements").mkdirs();
|
||||
new File(root, "USA/Card A").mkdirs();
|
||||
new File(root, "EUR/Card A").mkdirs();
|
||||
}
|
||||
|
||||
private boolean isCustomDataPathEnabled() {
|
||||
if (getContext() == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final File filesDir = getContext().getFilesDir();
|
||||
if (filesDir == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final File descriptor = new File(filesDir, LOCATION_DESCRIPTOR_NAME);
|
||||
if (!descriptor.isFile()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
final JSONObject json = new JSONObject(readText(descriptor));
|
||||
return "custom".equals(json.optString("mode", "default"));
|
||||
} catch (IOException | JSONException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static String readText(File file) throws IOException {
|
||||
try (FileInputStream input = new FileInputStream(file);
|
||||
ByteArrayOutputStream output = new ByteArrayOutputStream())
|
||||
{
|
||||
byte[] buffer = new byte[4096];
|
||||
int bytesRead;
|
||||
while ((bytesRead = input.read(buffer)) != -1) {
|
||||
output.write(buffer, 0, bytesRead);
|
||||
}
|
||||
return output.toString(StandardCharsets.UTF_8.name());
|
||||
}
|
||||
}
|
||||
|
||||
private static String[] resolveRootProjection(String[] projection) {
|
||||
return projection != null ? projection : DEFAULT_ROOT_PROJECTION;
|
||||
}
|
||||
|
||||
private static String[] resolveDocumentProjection(String[] projection) {
|
||||
return projection != null ? projection : DEFAULT_DOCUMENT_PROJECTION;
|
||||
}
|
||||
|
||||
private static String sanitizeDisplayName(String displayName) throws FileNotFoundException {
|
||||
if (displayName == null) {
|
||||
throw new FileNotFoundException("Document name is empty");
|
||||
}
|
||||
|
||||
final String sanitized = displayName.trim();
|
||||
if (sanitized.isEmpty() || ".".equals(sanitized) || "..".equals(sanitized) ||
|
||||
sanitized.contains("/") || sanitized.contains("\\"))
|
||||
{
|
||||
throw new FileNotFoundException("Invalid document name: " + displayName);
|
||||
}
|
||||
return sanitized;
|
||||
}
|
||||
|
||||
private static File buildUniqueFile(File parent, String displayName) {
|
||||
File file = new File(parent, displayName);
|
||||
if (!file.exists()) {
|
||||
return file;
|
||||
}
|
||||
|
||||
final int dot = displayName.lastIndexOf('.');
|
||||
final String baseName = dot > 0 ? displayName.substring(0, dot) : displayName;
|
||||
final String extension = dot > 0 ? displayName.substring(dot) : "";
|
||||
for (int i = 1; i < 100; ++i) {
|
||||
file = new File(parent, baseName + " (" + i + ")" + extension);
|
||||
if (!file.exists()) {
|
||||
return file;
|
||||
}
|
||||
}
|
||||
return new File(parent, baseName + " (" + System.currentTimeMillis() + ")" + extension);
|
||||
}
|
||||
|
||||
private static int modeToParcelMode(String mode) {
|
||||
if ("r".equals(mode)) {
|
||||
return ParcelFileDescriptor.MODE_READ_ONLY;
|
||||
}
|
||||
if ("w".equals(mode) || "wt".equals(mode)) {
|
||||
return ParcelFileDescriptor.MODE_WRITE_ONLY |
|
||||
ParcelFileDescriptor.MODE_CREATE |
|
||||
ParcelFileDescriptor.MODE_TRUNCATE;
|
||||
}
|
||||
if ("wa".equals(mode)) {
|
||||
return ParcelFileDescriptor.MODE_WRITE_ONLY |
|
||||
ParcelFileDescriptor.MODE_CREATE |
|
||||
ParcelFileDescriptor.MODE_APPEND;
|
||||
}
|
||||
if ("rw".equals(mode)) {
|
||||
return ParcelFileDescriptor.MODE_READ_WRITE |
|
||||
ParcelFileDescriptor.MODE_CREATE;
|
||||
}
|
||||
if ("rwt".equals(mode)) {
|
||||
return ParcelFileDescriptor.MODE_READ_WRITE |
|
||||
ParcelFileDescriptor.MODE_CREATE |
|
||||
ParcelFileDescriptor.MODE_TRUNCATE;
|
||||
}
|
||||
return ParcelFileDescriptor.MODE_READ_ONLY;
|
||||
}
|
||||
|
||||
private static String getMimeType(File file) {
|
||||
final int dot = file.getName().lastIndexOf('.');
|
||||
if (dot >= 0) {
|
||||
final String extension = file.getName().substring(dot + 1).toLowerCase();
|
||||
final String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension);
|
||||
if (mimeType != null) {
|
||||
return mimeType;
|
||||
}
|
||||
}
|
||||
return "application/octet-stream";
|
||||
}
|
||||
|
||||
private Uri getChildDocumentsUri(String parentDocumentId) {
|
||||
return DocumentsContract.buildChildDocumentsUri(AUTHORITY, parentDocumentId);
|
||||
}
|
||||
|
||||
private void notifyChildrenChanged(String parentDocumentId) {
|
||||
final ContentResolver resolver = getContext().getContentResolver();
|
||||
resolver.notifyChange(getChildDocumentsUri(parentDocumentId), null, false);
|
||||
}
|
||||
|
||||
private void notifyDocumentChanged(String documentId) {
|
||||
final ContentResolver resolver = getContext().getContentResolver();
|
||||
resolver.notifyChange(DocumentsContract.buildDocumentUri(AUTHORITY, documentId), null, false);
|
||||
}
|
||||
|
||||
private static void deleteRecursively(File file) throws FileNotFoundException {
|
||||
if (file.isDirectory()) {
|
||||
final File[] children = file.listFiles();
|
||||
if (children != null) {
|
||||
for (File child : children) {
|
||||
deleteRecursively(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!file.delete()) {
|
||||
throw new FileNotFoundException("Unable to delete document: " + file);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isInside(File parent, File child) {
|
||||
try {
|
||||
final String parentPath = canonicalPath(parent);
|
||||
final String childPath = canonicalPath(child);
|
||||
return childPath.equals(parentPath) || childPath.startsWith(parentPath + File.separator);
|
||||
} catch (FileNotFoundException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean sameFile(File a, File b) {
|
||||
try {
|
||||
return canonicalPath(a).equals(canonicalPath(b));
|
||||
} catch (FileNotFoundException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static String canonicalPath(File file) throws FileNotFoundException {
|
||||
try {
|
||||
return file.getCanonicalPath();
|
||||
} catch (IOException e) {
|
||||
throw asFileNotFound("Unable to resolve path", e);
|
||||
}
|
||||
}
|
||||
|
||||
private static FileNotFoundException asFileNotFound(String message, IOException cause) {
|
||||
final FileNotFoundException exception = new FileNotFoundException(message + ": " + cause.getMessage());
|
||||
exception.initCause(cause);
|
||||
return exception;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,237 @@
|
||||
package dev.twilitrealm.dusk;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
|
||||
public final class DuskHttpClient {
|
||||
public static final int ERROR_NONE = 0;
|
||||
public static final int ERROR_INVALID_URL = 1;
|
||||
public static final int ERROR_UNSUPPORTED_SCHEME = 2;
|
||||
public static final int ERROR_TIMEOUT = 3;
|
||||
public static final int ERROR_TOO_LARGE = 4;
|
||||
public static final int ERROR_NETWORK = 5;
|
||||
|
||||
private static final int MAX_REDIRECTS = 5;
|
||||
|
||||
public static final class Response {
|
||||
public int error;
|
||||
public String message;
|
||||
public int statusCode;
|
||||
public String[] headerNames;
|
||||
public String[] headerValues;
|
||||
public byte[] body;
|
||||
|
||||
Response(int error, String message, int statusCode, String[] headerNames,
|
||||
String[] headerValues, byte[] body) {
|
||||
this.error = error;
|
||||
this.message = message;
|
||||
this.statusCode = statusCode;
|
||||
this.headerNames = headerNames != null ? headerNames : new String[0];
|
||||
this.headerValues = headerValues != null ? headerValues : new String[0];
|
||||
this.body = body != null ? body : new byte[0];
|
||||
}
|
||||
}
|
||||
|
||||
private DuskHttpClient() {
|
||||
}
|
||||
|
||||
public static Response get(String url, String[] headerNames, String[] headerValues,
|
||||
int timeoutMs, long maxBodyBytes) {
|
||||
if (url == null || url.isEmpty()) {
|
||||
return fail(ERROR_INVALID_URL, "URL is empty");
|
||||
}
|
||||
|
||||
try {
|
||||
URL currentUrl = new URL(url);
|
||||
if (!isHttps(currentUrl)) {
|
||||
return fail(ERROR_UNSUPPORTED_SCHEME, "Only https:// URLs are supported");
|
||||
}
|
||||
|
||||
for (int redirect = 0; redirect <= MAX_REDIRECTS; ++redirect) {
|
||||
HttpsURLConnection connection =
|
||||
(HttpsURLConnection) currentUrl.openConnection();
|
||||
try {
|
||||
connection.setRequestMethod("GET");
|
||||
connection.setConnectTimeout(timeoutMs);
|
||||
connection.setReadTimeout(timeoutMs);
|
||||
connection.setUseCaches(false);
|
||||
connection.setInstanceFollowRedirects(false);
|
||||
applyHeaders(connection, headerNames, headerValues);
|
||||
|
||||
int statusCode = connection.getResponseCode();
|
||||
if (isRedirect(statusCode)) {
|
||||
String location = connection.getHeaderField("Location");
|
||||
if (location == null || location.isEmpty()) {
|
||||
return fail(ERROR_NETWORK, "Redirect response did not include Location",
|
||||
statusCode, connection, new byte[0]);
|
||||
}
|
||||
|
||||
URL nextUrl = new URL(currentUrl, location);
|
||||
if (!isHttps(nextUrl)) {
|
||||
return fail(ERROR_UNSUPPORTED_SCHEME,
|
||||
"Only https:// redirects are supported", statusCode,
|
||||
connection, new byte[0]);
|
||||
}
|
||||
currentUrl = nextUrl;
|
||||
continue;
|
||||
}
|
||||
|
||||
byte[] body = readBody(connection, statusCode, maxBodyBytes);
|
||||
return success(statusCode, connection, body);
|
||||
} catch (ResponseTooLargeException e) {
|
||||
return fail(ERROR_TOO_LARGE, "Response body exceeded the configured limit",
|
||||
safeStatusCode(connection), connection, e.partialBody);
|
||||
} finally {
|
||||
connection.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
return fail(ERROR_NETWORK, "Too many redirects");
|
||||
} catch (MalformedURLException e) {
|
||||
return fail(ERROR_INVALID_URL, "Failed to parse URL");
|
||||
} catch (SocketTimeoutException e) {
|
||||
return fail(ERROR_TIMEOUT, "Request timed out");
|
||||
} catch (IOException e) {
|
||||
String message = e.getMessage();
|
||||
return fail(ERROR_NETWORK, message != null ? message : e.toString());
|
||||
} catch (ClassCastException e) {
|
||||
return fail(ERROR_UNSUPPORTED_SCHEME, "Only https:// URLs are supported");
|
||||
}
|
||||
}
|
||||
|
||||
private static void applyHeaders(HttpsURLConnection connection, String[] names,
|
||||
String[] values) {
|
||||
if (names == null || values == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
int count = Math.min(names.length, values.length);
|
||||
for (int i = 0; i < count; ++i) {
|
||||
if (names[i] != null && values[i] != null) {
|
||||
connection.setRequestProperty(names[i], values[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isHttps(URL url) {
|
||||
return "https".equalsIgnoreCase(url.getProtocol());
|
||||
}
|
||||
|
||||
private static boolean isRedirect(int statusCode) {
|
||||
return statusCode == HttpURLConnection.HTTP_MOVED_PERM ||
|
||||
statusCode == HttpURLConnection.HTTP_MOVED_TEMP ||
|
||||
statusCode == HttpURLConnection.HTTP_SEE_OTHER ||
|
||||
statusCode == 307 ||
|
||||
statusCode == 308;
|
||||
}
|
||||
|
||||
private static byte[] readBody(HttpsURLConnection connection, int statusCode,
|
||||
long maxBodyBytes) throws IOException,
|
||||
ResponseTooLargeException {
|
||||
InputStream stream = statusCode >= HttpURLConnection.HTTP_BAD_REQUEST ?
|
||||
connection.getErrorStream() : connection.getInputStream();
|
||||
if (stream == null) {
|
||||
return new byte[0];
|
||||
}
|
||||
|
||||
try (InputStream bodyStream = stream;
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream()) {
|
||||
byte[] buffer = new byte[8192];
|
||||
long total = 0;
|
||||
while (true) {
|
||||
int read = bodyStream.read(buffer);
|
||||
if (read < 0) {
|
||||
return out.toByteArray();
|
||||
}
|
||||
if (read == 0) {
|
||||
continue;
|
||||
}
|
||||
if (read > maxBodyBytes || total > maxBodyBytes - read) {
|
||||
throw new ResponseTooLargeException(out.toByteArray());
|
||||
}
|
||||
out.write(buffer, 0, read);
|
||||
total += read;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static int safeStatusCode(HttpsURLConnection connection) {
|
||||
try {
|
||||
return connection.getResponseCode();
|
||||
} catch (IOException e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
private static Response success(int statusCode, HttpsURLConnection connection, byte[] body) {
|
||||
HeaderLists headers = readHeaders(connection);
|
||||
return new Response(ERROR_NONE, "", statusCode, headers.names, headers.values, body);
|
||||
}
|
||||
|
||||
private static Response fail(int error, String message) {
|
||||
return new Response(error, message, 0, null, null, null);
|
||||
}
|
||||
|
||||
private static Response fail(int error, String message, int statusCode,
|
||||
HttpsURLConnection connection, byte[] body) {
|
||||
HeaderLists headers = readHeaders(connection);
|
||||
return new Response(error, message, statusCode, headers.names, headers.values, body);
|
||||
}
|
||||
|
||||
private static HeaderLists readHeaders(HttpsURLConnection connection) {
|
||||
List<String> names = new ArrayList<>();
|
||||
List<String> values = new ArrayList<>();
|
||||
|
||||
Map<String, List<String>> headerFields = connection.getHeaderFields();
|
||||
if (headerFields == null) {
|
||||
return new HeaderLists(new String[0], new String[0]);
|
||||
}
|
||||
|
||||
for (Map.Entry<String, List<String>> entry : headerFields.entrySet()) {
|
||||
String name = entry.getKey();
|
||||
if (name == null) {
|
||||
continue;
|
||||
}
|
||||
List<String> entryValues = entry.getValue();
|
||||
if (entryValues == null || entryValues.isEmpty()) {
|
||||
names.add(name);
|
||||
values.add("");
|
||||
continue;
|
||||
}
|
||||
for (String value : entryValues) {
|
||||
names.add(name);
|
||||
values.add(value != null ? value : "");
|
||||
}
|
||||
}
|
||||
|
||||
return new HeaderLists(names.toArray(new String[0]), values.toArray(new String[0]));
|
||||
}
|
||||
|
||||
private static final class HeaderLists {
|
||||
final String[] names;
|
||||
final String[] values;
|
||||
|
||||
HeaderLists(String[] names, String[] values) {
|
||||
this.names = names;
|
||||
this.values = values;
|
||||
}
|
||||
}
|
||||
|
||||
private static final class ResponseTooLargeException extends Exception {
|
||||
final byte[] partialBody;
|
||||
|
||||
ResponseTooLargeException(byte[] partialBody) {
|
||||
this.partialBody = partialBody;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package org.libsdl.app;
|
||||
|
||||
import android.hardware.usb.UsbDevice;
|
||||
|
||||
interface HIDDevice
|
||||
{
|
||||
public int getId();
|
||||
public int getVendorId();
|
||||
public int getProductId();
|
||||
public String getSerialNumber();
|
||||
public int getVersion();
|
||||
public String getManufacturerName();
|
||||
public String getProductName();
|
||||
public UsbDevice getDevice();
|
||||
public boolean open();
|
||||
public int writeReport(byte[] report, boolean feature);
|
||||
public boolean readReport(byte[] report, boolean feature);
|
||||
public void setFrozen(boolean frozen);
|
||||
public void close();
|
||||
public void shutdown();
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user