mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-07-04 11:19:58 -04:00
Compare commits
32 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ad9bb06a29 | |||
| 871fc75514 | |||
| e641044535 | |||
| c0429110db | |||
| bd8b3aafeb | |||
| 9c001114f7 | |||
| 34c55700a2 | |||
| a99c8096d5 | |||
| 0b93dd9698 | |||
| be771e1a83 | |||
| e0de71b5b4 | |||
| 010a4b5094 | |||
| a71bd56058 | |||
| 63a86a456f | |||
| 6304866b38 | |||
| 54dbf20480 | |||
| f11d4b14d9 | |||
| 31298f24ba | |||
| 8ae35dc9ea | |||
| 9abb6bafd1 | |||
| 81c0c6f4d3 | |||
| 41fe3a85a2 | |||
| 307f626c57 | |||
| cd0b8b3172 | |||
| 8e55961e3c | |||
| fd204062f7 | |||
| 89b8debe51 | |||
| c498bf8fb8 | |||
| 290f592098 | |||
| 9a80f3a08a | |||
| 41e128c582 | |||
| aa23ae244f |
@@ -52,7 +52,7 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get -y install ninja-build clang lld mold openssl libcurl4-openssl-dev \
|
sudo apt-get -y install ninja-build clang lld openssl libcurl4-openssl-dev \
|
||||||
zlib1g-dev libglu1-mesa-dev libdbus-1-dev libvulkan-dev libxi-dev libxrandr-dev libasound2-dev \
|
zlib1g-dev libglu1-mesa-dev libdbus-1-dev libvulkan-dev libxi-dev libxrandr-dev libasound2-dev \
|
||||||
libpulse-dev libudev-dev libpng-dev libncurses5-dev libx11-xcb-dev libfreetype-dev \
|
libpulse-dev libudev-dev libpng-dev libncurses5-dev libx11-xcb-dev libfreetype-dev \
|
||||||
libxinerama-dev libxcursor-dev python3-markupsafe libgtk-3-dev libssl-dev \
|
libxinerama-dev libxcursor-dev python3-markupsafe libgtk-3-dev libssl-dev \
|
||||||
|
|||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
[submodule "extern/aurora"]
|
[submodule "extern/aurora"]
|
||||||
path = extern/aurora
|
path = extern/aurora
|
||||||
url = https://github.com/encounter/aurora.git
|
url = https://github.com/Lurs/aurora.git
|
||||||
|
|||||||
+15
-64
@@ -126,57 +126,28 @@ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
|||||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||||
set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "_cmake")
|
set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "_cmake")
|
||||||
|
|
||||||
option(ENABLE_ASAN "Enable AddressSanitizer" OFF)
|
|
||||||
if (ENABLE_ASAN)
|
|
||||||
if (CMAKE_C_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC" AND
|
|
||||||
CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")
|
|
||||||
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/fsanitize=address>)
|
|
||||||
add_link_options(/fsanitize=address /INCREMENTAL:NO)
|
|
||||||
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "ProgramDatabase")
|
|
||||||
foreach (_lang C CXX)
|
|
||||||
foreach (_rtc_flag /RTC1 /RTCc /RTCs /RTCu)
|
|
||||||
string(REPLACE "${_rtc_flag}" "" CMAKE_${_lang}_FLAGS_DEBUG "${CMAKE_${_lang}_FLAGS_DEBUG}")
|
|
||||||
endforeach ()
|
|
||||||
endforeach ()
|
|
||||||
elseif (CMAKE_C_COMPILER_FRONTEND_VARIANT STREQUAL "GNU" AND
|
|
||||||
CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "GNU")
|
|
||||||
add_compile_options(
|
|
||||||
$<$<COMPILE_LANGUAGE:C,CXX,OBJC,OBJCXX>:-fsanitize=address>
|
|
||||||
$<$<COMPILE_LANGUAGE:C,CXX,OBJC,OBJCXX>:-fno-omit-frame-pointer>
|
|
||||||
)
|
|
||||||
add_link_options(-fsanitize=address)
|
|
||||||
else ()
|
|
||||||
message(FATAL_ERROR "ENABLE_ASAN requires GNU-like or MSVC-like C/C++ compiler frontends")
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
add_compile_definitions(NDEBUG_SANITIZER) # Avoids absl issue with SwissTable debug code
|
|
||||||
message(STATUS "dusklight: Enabled AddressSanitizer")
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
if (CMAKE_SYSTEM_NAME STREQUAL Linux)
|
if (CMAKE_SYSTEM_NAME STREQUAL Linux)
|
||||||
set(DAWN_USE_WAYLAND ON CACHE BOOL "Enable support for Wayland surface" FORCE)
|
set(DAWN_USE_WAYLAND ON CACHE BOOL "Enable support for Wayland surface" FORCE)
|
||||||
endif ()
|
endif ()
|
||||||
set(AURORA_ENABLE_DVD ON CACHE BOOL "Enable DVD API support" FORCE)
|
set(AURORA_ENABLE_DVD ON CACHE BOOL "Enable DVD API support" FORCE)
|
||||||
set(AURORA_ENABLE_CARD ON CACHE BOOL "Enable CARD API support" FORCE)
|
set(AURORA_ENABLE_CARD ON CACHE BOOL "Enable CARD API support" FORCE)
|
||||||
set(AURORA_ENABLE_RMLUI ON CACHE BOOL "Enable RmlUi UI support" FORCE)
|
set(AURORA_ENABLE_RMLUI ON CACHE BOOL "Enable RmlUi UI support" FORCE)
|
||||||
|
# Force Freetype (pulled by aurora/RmlUi) to use its bundled mini-zlib.
|
||||||
|
# Otherwise its find_package(ZLIB) latches onto our FetchContent'd shared zlib,
|
||||||
|
# duplicating inflate*/inflateInit2_ symbols against zlibstatic.
|
||||||
|
set(FT_DISABLE_ZLIB TRUE CACHE BOOL "" FORCE)
|
||||||
add_subdirectory(extern/aurora EXCLUDE_FROM_ALL)
|
add_subdirectory(extern/aurora EXCLUDE_FROM_ALL)
|
||||||
target_compile_definitions(aurora_mtx PRIVATE MTX_USE_PS=1)
|
target_compile_definitions(aurora_mtx PRIVATE MTX_USE_PS=1)
|
||||||
|
|
||||||
add_subdirectory(libs/freeverb)
|
add_subdirectory(libs/freeverb)
|
||||||
|
|
||||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
||||||
set(DUSK_GFX_DEBUG_GROUPS_DEFAULT ON)
|
|
||||||
else ()
|
|
||||||
set(DUSK_GFX_DEBUG_GROUPS_DEFAULT OFF)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
option(DUSK_BUILD_WARNINGS "Enable compiler warnings (off by default)")
|
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_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_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_UPDATE_CHECKER "Enable update checking support" ON)
|
||||||
|
option(DUSK_TPHD "Enable TPHD asset support" ON)
|
||||||
|
|
||||||
option(DUSK_ENABLE_SENTRY_NATIVE "Enable sentry-native crash reporting support" OFF)
|
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})
|
|
||||||
set(DUSK_SENTRY_DSN "" CACHE STRING "Sentry DSN")
|
set(DUSK_SENTRY_DSN "" CACHE STRING "Sentry DSN")
|
||||||
set(DUSK_SENTRY_ENVIRONMENT "development" CACHE STRING "Sentry environment")
|
set(DUSK_SENTRY_ENVIRONMENT "development" CACHE STRING "Sentry environment")
|
||||||
|
|
||||||
@@ -224,8 +195,6 @@ if (DUSK_MOVIE_SUPPORT)
|
|||||||
CMAKE_MSVC_RUNTIME_LIBRARY
|
CMAKE_MSVC_RUNTIME_LIBRARY
|
||||||
CMAKE_MSVC_DEBUG_INFORMATION_FORMAT
|
CMAKE_MSVC_DEBUG_INFORMATION_FORMAT
|
||||||
CMAKE_OSX_ARCHITECTURES
|
CMAKE_OSX_ARCHITECTURES
|
||||||
CMAKE_OSX_DEPLOYMENT_TARGET
|
|
||||||
CMAKE_OSX_SYSROOT
|
|
||||||
DEPLOYMENT_TARGET
|
DEPLOYMENT_TARGET
|
||||||
ENABLE_ARC
|
ENABLE_ARC
|
||||||
ENABLE_BITCODE
|
ENABLE_BITCODE
|
||||||
@@ -291,13 +260,13 @@ message(STATUS "dusklight: Fetching cxxopts")
|
|||||||
FetchContent_Declare(cxxopts
|
FetchContent_Declare(cxxopts
|
||||||
URL https://github.com/jarro2783/cxxopts/archive/refs/tags/v3.3.1.tar.gz
|
URL https://github.com/jarro2783/cxxopts/archive/refs/tags/v3.3.1.tar.gz
|
||||||
URL_HASH SHA256=3bfc70542c521d4b55a46429d808178916a579b28d048bd8c727ee76c39e2072
|
URL_HASH SHA256=3bfc70542c521d4b55a46429d808178916a579b28d048bd8c727ee76c39e2072
|
||||||
DOWNLOAD_EXTRACT_TIMESTAMP FALSE
|
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
|
||||||
)
|
)
|
||||||
message(STATUS "dusklight: Fetching nlohmann/json")
|
message(STATUS "dusklight: Fetching nlohmann/json")
|
||||||
FetchContent_Declare(json
|
FetchContent_Declare(json
|
||||||
URL https://github.com/nlohmann/json/releases/download/v3.12.0/json.tar.xz
|
URL https://github.com/nlohmann/json/releases/download/v3.12.0/json.tar.xz
|
||||||
URL_HASH SHA256=42f6e95cad6ec532fd372391373363b62a14af6d771056dbfc86160e6dfff7aa
|
URL_HASH SHA256=42f6e95cad6ec532fd372391373363b62a14af6d771056dbfc86160e6dfff7aa
|
||||||
DOWNLOAD_EXTRACT_TIMESTAMP FALSE
|
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
|
||||||
)
|
)
|
||||||
FetchContent_MakeAvailable(cxxopts json)
|
FetchContent_MakeAvailable(cxxopts json)
|
||||||
|
|
||||||
@@ -364,6 +333,9 @@ source_group("dolzel" FILES ${DOLZEL_FILES} ${Z2AUDIOLIB_FILES} ${REL_FILES})
|
|||||||
source_group("dusklight" FILES ${DUSK_FILES} ${DUSK_HTTP_BACKEND_FILES})
|
source_group("dusklight" FILES ${DUSK_FILES} ${DUSK_HTTP_BACKEND_FILES})
|
||||||
|
|
||||||
set(GAME_COMPILE_DEFS TARGET_PC WIDESCREEN_SUPPORT=1 AVOID_UB=1 VERSION=0 MTX_USE_PS=1)
|
set(GAME_COMPILE_DEFS TARGET_PC WIDESCREEN_SUPPORT=1 AVOID_UB=1 VERSION=0 MTX_USE_PS=1)
|
||||||
|
if (DUSK_TPHD)
|
||||||
|
list(APPEND GAME_COMPILE_DEFS DUSK_TPHD=1)
|
||||||
|
endif ()
|
||||||
|
|
||||||
set(GAME_INCLUDE_DIRS
|
set(GAME_INCLUDE_DIRS
|
||||||
include
|
include
|
||||||
@@ -378,7 +350,7 @@ set(GAME_INCLUDE_DIRS
|
|||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
set(GAME_LIBS aurora::core aurora::gx aurora::gd aurora::si aurora::vi aurora::pad aurora::mtx aurora::os aurora::dvd
|
set(GAME_LIBS aurora::core aurora::gx aurora::gd aurora::si aurora::vi aurora::pad aurora::mtx aurora::os aurora::dvd
|
||||||
aurora::card freeverb cxxopts::cxxopts absl::flat_hash_map nlohmann_json::nlohmann_json TracyClient fmt::fmt
|
aurora::card freeverb cxxopts::cxxopts absl::flat_hash_map nlohmann_json::nlohmann_json TracyClient fmt::fmt
|
||||||
Threads::Threads zstd::libzstd)
|
Threads::Threads libzstd_static ZLIB::ZLIB)
|
||||||
|
|
||||||
if (DUSK_ENABLE_SENTRY_NATIVE)
|
if (DUSK_ENABLE_SENTRY_NATIVE)
|
||||||
list(APPEND GAME_LIBS sentry)
|
list(APPEND GAME_LIBS sentry)
|
||||||
@@ -450,16 +422,6 @@ if(ANDROID)
|
|||||||
list(APPEND GAME_COMPILE_DEFS TARGET_ANDROID=1)
|
list(APPEND GAME_COMPILE_DEFS TARGET_ANDROID=1)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (DUSK_PACKAGE_INSTALL)
|
|
||||||
include(GNUInstallDirs)
|
|
||||||
list(APPEND GAME_COMPILE_DEFS DUSK_ASSET_DIR="${CMAKE_INSTALL_FULL_DATADIR}/dusklight/")
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
if (DUSK_GFX_DEBUG_GROUPS)
|
|
||||||
list(APPEND GAME_COMPILE_DEFS DUSK_GFX_DEBUG_GROUPS=1)
|
|
||||||
target_compile_definitions(aurora_gx PRIVATE AURORA_GFX_DEBUG_GROUPS)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
# game_debug is for game code files that we know work when compiled with DEBUG=1
|
# game_debug is for game code files that we know work when compiled with DEBUG=1
|
||||||
# Of course, if building a release build, this distinction is irrelevant
|
# Of course, if building a release build, this distinction is irrelevant
|
||||||
set(GAME_DEBUG_FILES
|
set(GAME_DEBUG_FILES
|
||||||
@@ -516,9 +478,6 @@ if(ANDROID)
|
|||||||
else ()
|
else ()
|
||||||
add_executable(dusklight ${DUSK_FILES})
|
add_executable(dusklight ${DUSK_FILES})
|
||||||
endif ()
|
endif ()
|
||||||
if (ENABLE_ASAN)
|
|
||||||
target_sources(dusklight PRIVATE src/dusk/asan_options.c)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
target_compile_definitions(dusklight PRIVATE ${GAME_COMPILE_DEFS})
|
target_compile_definitions(dusklight PRIVATE ${GAME_COMPILE_DEFS})
|
||||||
target_include_directories(dusklight PRIVATE ${GAME_INCLUDE_DIRS})
|
target_include_directories(dusklight PRIVATE ${GAME_INCLUDE_DIRS})
|
||||||
@@ -681,20 +640,12 @@ set(EXTRA_TARGETS "")
|
|||||||
if (TARGET crashpad_handler)
|
if (TARGET crashpad_handler)
|
||||||
list(APPEND EXTRA_TARGETS crashpad_handler)
|
list(APPEND EXTRA_TARGETS crashpad_handler)
|
||||||
endif ()
|
endif ()
|
||||||
if (DUSK_PACKAGE_INSTALL)
|
install(TARGETS ${BINARY_TARGETS} ${EXTRA_TARGETS} DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||||
install(TARGETS ${BINARY_TARGETS} ${EXTRA_TARGETS} DESTINATION ${CMAKE_INSTALL_BINDIR})
|
|
||||||
else()
|
|
||||||
install(TARGETS ${BINARY_TARGETS} ${EXTRA_TARGETS} DESTINATION ${CMAKE_INSTALL_PREFIX})
|
|
||||||
endif()
|
|
||||||
aurora_install_runtime_dlls(dusklight ${CMAKE_INSTALL_PREFIX})
|
aurora_install_runtime_dlls(dusklight ${CMAKE_INSTALL_PREFIX})
|
||||||
if (NOT APPLE)
|
if (NOT APPLE)
|
||||||
if (DUSK_PACKAGE_INSTALL)
|
install(DIRECTORY ${CMAKE_SOURCE_DIR}/res DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||||
install(DIRECTORY ${CMAKE_SOURCE_DIR}/res DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/dusklight)
|
|
||||||
else()
|
|
||||||
install(DIRECTORY ${CMAKE_SOURCE_DIR}/res DESTINATION ${CMAKE_INSTALL_PREFIX})
|
|
||||||
endif()
|
|
||||||
endif ()
|
endif ()
|
||||||
if (CMAKE_BUILD_TYPE STREQUAL Debug OR CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo AND NOT DUSK_PACKAGE_INSTALL)
|
if (CMAKE_BUILD_TYPE STREQUAL Debug OR CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo)
|
||||||
set(DEBUG_FILES_LIST "")
|
set(DEBUG_FILES_LIST "")
|
||||||
foreach (target IN LISTS BINARY_TARGETS EXTRA_TARGETS)
|
foreach (target IN LISTS BINARY_TARGETS EXTRA_TARGETS)
|
||||||
get_target_output_name(${target} output_name)
|
get_target_output_name(${target} output_name)
|
||||||
|
|||||||
+21
-116
@@ -19,19 +19,7 @@
|
|||||||
"hidden": true,
|
"hidden": true,
|
||||||
"cacheVariables": {
|
"cacheVariables": {
|
||||||
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
|
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
|
||||||
"CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreadedDLL"
|
"CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreaded"
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "release",
|
|
||||||
"hidden": true,
|
|
||||||
"cacheVariables": {
|
|
||||||
"CMAKE_BUILD_TYPE": "Release",
|
|
||||||
"CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreadedDLL",
|
|
||||||
"CMAKE_INTERPROCEDURAL_OPTIMIZATION": {
|
|
||||||
"type": "BOOL",
|
|
||||||
"value": true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -52,26 +40,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "asan",
|
|
||||||
"hidden": true,
|
|
||||||
"cacheVariables": {
|
|
||||||
"ENABLE_ASAN": {
|
|
||||||
"type": "BOOL",
|
|
||||||
"value": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "linux-default",
|
"name": "linux-default",
|
||||||
"displayName": "Linux (default)",
|
"displayName": "Linux (default)",
|
||||||
"generator": "Ninja",
|
"generator": "Ninja",
|
||||||
"binaryDir": "${sourceDir}/build/${presetName}",
|
"binaryDir": "${sourceDir}/build/${presetName}",
|
||||||
"cacheVariables": {
|
"cacheVariables": {
|
||||||
"BUILD_SHARED_LIBS": {
|
|
||||||
"type": "BOOL",
|
|
||||||
"value": false
|
|
||||||
},
|
|
||||||
"CMAKE_INSTALL_PREFIX": "${sourceDir}/build/install"
|
"CMAKE_INSTALL_PREFIX": "${sourceDir}/build/install"
|
||||||
},
|
},
|
||||||
"vendor": {
|
"vendor": {
|
||||||
@@ -93,15 +67,6 @@
|
|||||||
"linux-default"
|
"linux-default"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "linux-default-debug-asan",
|
|
||||||
"displayName": "Linux (default) Debug ASan",
|
|
||||||
"inherits": [
|
|
||||||
"debug",
|
|
||||||
"linux-default",
|
|
||||||
"asan"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "linux-default-relwithdebinfo",
|
"name": "linux-default-relwithdebinfo",
|
||||||
"displayName": "Linux (default) RelWithDebInfo",
|
"displayName": "Linux (default) RelWithDebInfo",
|
||||||
@@ -129,15 +94,6 @@
|
|||||||
"linux-clang"
|
"linux-clang"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "linux-clang-debug-asan",
|
|
||||||
"displayName": "Linux (Clang) Debug ASan",
|
|
||||||
"inherits": [
|
|
||||||
"debug",
|
|
||||||
"linux-clang",
|
|
||||||
"asan"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "linux-clang-relwithdebinfo",
|
"name": "linux-clang-relwithdebinfo",
|
||||||
"displayName": "Linux (Clang) RelWithDebInfo",
|
"displayName": "Linux (Clang) RelWithDebInfo",
|
||||||
@@ -158,11 +114,7 @@
|
|||||||
"cacheVariables": {
|
"cacheVariables": {
|
||||||
"CMAKE_C_COMPILER": "cl",
|
"CMAKE_C_COMPILER": "cl",
|
||||||
"CMAKE_CXX_COMPILER": "cl",
|
"CMAKE_CXX_COMPILER": "cl",
|
||||||
"CMAKE_INSTALL_PREFIX": "${sourceDir}/build/install",
|
"CMAKE_INSTALL_PREFIX": "${sourceDir}/build/install"
|
||||||
"CMAKE_DISABLE_FIND_PACKAGE_PkgConfig": {
|
|
||||||
"type": "BOOL",
|
|
||||||
"value": true
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"vendor": {
|
"vendor": {
|
||||||
"microsoft.com/VisualStudioSettings/CMake/1.0": {
|
"microsoft.com/VisualStudioSettings/CMake/1.0": {
|
||||||
@@ -180,15 +132,6 @@
|
|||||||
"windows-msvc"
|
"windows-msvc"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "windows-msvc-debug-asan",
|
|
||||||
"displayName": "Windows (MSVC) Debug ASan",
|
|
||||||
"inherits": [
|
|
||||||
"debug",
|
|
||||||
"windows-msvc",
|
|
||||||
"asan"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "windows-msvc-relwithdebinfo",
|
"name": "windows-msvc-relwithdebinfo",
|
||||||
"displayName": "Windows (MSVC) RelWithDebInfo",
|
"displayName": "Windows (MSVC) RelWithDebInfo",
|
||||||
@@ -258,10 +201,6 @@
|
|||||||
"generator": "Ninja",
|
"generator": "Ninja",
|
||||||
"binaryDir": "${sourceDir}/build/${presetName}",
|
"binaryDir": "${sourceDir}/build/${presetName}",
|
||||||
"cacheVariables": {
|
"cacheVariables": {
|
||||||
"BUILD_SHARED_LIBS": {
|
|
||||||
"type": "BOOL",
|
|
||||||
"value": false
|
|
||||||
},
|
|
||||||
"CMAKE_INSTALL_PREFIX": "${sourceDir}/build/install"
|
"CMAKE_INSTALL_PREFIX": "${sourceDir}/build/install"
|
||||||
},
|
},
|
||||||
"vendor": {
|
"vendor": {
|
||||||
@@ -280,15 +219,6 @@
|
|||||||
"macos-default"
|
"macos-default"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "macos-default-debug-asan",
|
|
||||||
"displayName": "macOS (default) Debug ASan",
|
|
||||||
"inherits": [
|
|
||||||
"debug",
|
|
||||||
"macos-default",
|
|
||||||
"asan"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "macos-default-relwithdebinfo",
|
"name": "macos-default-relwithdebinfo",
|
||||||
"displayName": "macOS (default) RelWithDebInfo",
|
"displayName": "macOS (default) RelWithDebInfo",
|
||||||
@@ -354,21 +284,24 @@
|
|||||||
"type": "BOOL",
|
"type": "BOOL",
|
||||||
"value": false
|
"value": false
|
||||||
},
|
},
|
||||||
"ENABLE_ARC": {
|
|
||||||
"type": "BOOL",
|
|
||||||
"value": false
|
|
||||||
},
|
|
||||||
"Rust_CARGO_TARGET": "aarch64-apple-tvos",
|
"Rust_CARGO_TARGET": "aarch64-apple-tvos",
|
||||||
"Rust_TOOLCHAIN": "nightly",
|
"Rust_TOOLCHAIN": "nightly",
|
||||||
"BUILD_SHARED_LIBS": {
|
"BUILD_SHARED_LIBS": {
|
||||||
"type": "BOOL",
|
"type": "BOOL",
|
||||||
"value": false
|
"value": false
|
||||||
},
|
},
|
||||||
"CMAKE_DISABLE_FIND_PACKAGE_PkgConfig": {
|
"CMAKE_DISABLE_FIND_PACKAGE_BZip2": {
|
||||||
"type": "BOOL",
|
"type": "BOOL",
|
||||||
"value": true
|
"value": true
|
||||||
},
|
},
|
||||||
"CMAKE_IGNORE_PREFIX_PATH": "/opt/homebrew"
|
"CMAKE_DISABLE_FIND_PACKAGE_LibLZMA": {
|
||||||
|
"type": "BOOL",
|
||||||
|
"value": true
|
||||||
|
},
|
||||||
|
"CMAKE_DISABLE_FIND_PACKAGE_zstd": {
|
||||||
|
"type": "BOOL",
|
||||||
|
"value": true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"vendor": {
|
"vendor": {
|
||||||
"microsoft.com/VisualStudioSettings/CMake/1.0": {
|
"microsoft.com/VisualStudioSettings/CMake/1.0": {
|
||||||
@@ -394,14 +327,8 @@
|
|||||||
"type": "BOOL",
|
"type": "BOOL",
|
||||||
"value": false
|
"value": false
|
||||||
},
|
},
|
||||||
"CMAKE_DISABLE_FIND_PACKAGE_PkgConfig": {
|
"AURORA_SDL3_VERSION": "3.4.8",
|
||||||
"type": "BOOL",
|
"AURORA_SDL3_REF": "refs/tags/release-3.4.8"
|
||||||
"value": true
|
|
||||||
},
|
|
||||||
"CMAKE_DISABLE_FIND_PACKAGE_zstd": {
|
|
||||||
"type": "BOOL",
|
|
||||||
"value": true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -429,8 +356,7 @@
|
|||||||
"hidden": true,
|
"hidden": true,
|
||||||
"inherits": [
|
"inherits": [
|
||||||
"android-base",
|
"android-base",
|
||||||
"ci",
|
"ci"
|
||||||
"release"
|
|
||||||
],
|
],
|
||||||
"cacheVariables": {
|
"cacheVariables": {
|
||||||
"DUSK_ENABLE_SENTRY_NATIVE": {
|
"DUSK_ENABLE_SENTRY_NATIVE": {
|
||||||
@@ -458,8 +384,7 @@
|
|||||||
"ci"
|
"ci"
|
||||||
],
|
],
|
||||||
"cacheVariables": {
|
"cacheVariables": {
|
||||||
"AURORA_SDL3_PROVIDER": "vendor",
|
"AURORA_SDL3_PROVIDER": "vendor"
|
||||||
"CMAKE_LINKER_TYPE": "MOLD"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -488,8 +413,12 @@
|
|||||||
"type": "BOOL",
|
"type": "BOOL",
|
||||||
"value": true
|
"value": true
|
||||||
},
|
},
|
||||||
"CMAKE_OSX_DEPLOYMENT_TARGET": "12.0",
|
"CMAKE_OSX_DEPLOYMENT_TARGET": "11.0",
|
||||||
"CMAKE_IGNORE_PREFIX_PATH": "/opt/homebrew"
|
"CMAKE_IGNORE_PREFIX_PATH": "/opt/homebrew",
|
||||||
|
"BUILD_SHARED_LIBS": {
|
||||||
|
"type": "BOOL",
|
||||||
|
"value": false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -579,12 +508,6 @@
|
|||||||
"description": "Linux (default) debug build",
|
"description": "Linux (default) debug build",
|
||||||
"displayName": "Linux (default) Debug"
|
"displayName": "Linux (default) Debug"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "linux-default-debug-asan",
|
|
||||||
"configurePreset": "linux-default-debug-asan",
|
|
||||||
"description": "Linux (default) debug build with AddressSanitizer",
|
|
||||||
"displayName": "Linux (default) Debug ASan"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "linux-default-relwithdebinfo",
|
"name": "linux-default-relwithdebinfo",
|
||||||
"configurePreset": "linux-default-relwithdebinfo",
|
"configurePreset": "linux-default-relwithdebinfo",
|
||||||
@@ -597,12 +520,6 @@
|
|||||||
"description": "Linux (Clang) debug build",
|
"description": "Linux (Clang) debug build",
|
||||||
"displayName": "Linux (Clang) Debug"
|
"displayName": "Linux (Clang) Debug"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "linux-clang-debug-asan",
|
|
||||||
"configurePreset": "linux-clang-debug-asan",
|
|
||||||
"description": "Linux (Clang) debug build with AddressSanitizer",
|
|
||||||
"displayName": "Linux (Clang) Debug ASan"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "linux-clang-relwithdebinfo",
|
"name": "linux-clang-relwithdebinfo",
|
||||||
"configurePreset": "linux-clang-relwithdebinfo",
|
"configurePreset": "linux-clang-relwithdebinfo",
|
||||||
@@ -615,12 +532,6 @@
|
|||||||
"description": "macOS debug build",
|
"description": "macOS debug build",
|
||||||
"displayName": "macOS Debug"
|
"displayName": "macOS Debug"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "macos-default-debug-asan",
|
|
||||||
"configurePreset": "macos-default-debug-asan",
|
|
||||||
"description": "macOS debug build with AddressSanitizer",
|
|
||||||
"displayName": "macOS Debug ASan"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "macos-default-relwithdebinfo",
|
"name": "macos-default-relwithdebinfo",
|
||||||
"configurePreset": "macos-default-relwithdebinfo",
|
"configurePreset": "macos-default-relwithdebinfo",
|
||||||
@@ -678,12 +589,6 @@
|
|||||||
"description": "Windows (MSVC) debug build",
|
"description": "Windows (MSVC) debug build",
|
||||||
"displayName": "Windows (MSVC) Debug"
|
"displayName": "Windows (MSVC) Debug"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "windows-msvc-debug-asan",
|
|
||||||
"configurePreset": "windows-msvc-debug-asan",
|
|
||||||
"description": "Windows (MSVC) debug build with AddressSanitizer",
|
|
||||||
"displayName": "Windows (MSVC) Debug ASan"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "windows-msvc-relwithdebinfo",
|
"name": "windows-msvc-relwithdebinfo",
|
||||||
"configurePreset": "windows-msvc-relwithdebinfo",
|
"configurePreset": "windows-msvc-relwithdebinfo",
|
||||||
|
|||||||
@@ -20,17 +20,31 @@ It aims to be as accurate as possible to the original while also providing new o
|
|||||||
> Dusklight does *not* provide any copyrighted assets. You must provide your own copy of the original game.
|
> Dusklight does *not* provide any copyrighted assets. You must provide your own copy of the original game.
|
||||||
|
|
||||||
> [!IMPORTANT]
|
> [!IMPORTANT]
|
||||||
> At a minimum, Dusklight requires a GPU with support for D3D12, Vulkan 1.1+, or Metal. For older devices, best-effort support is provided for D3D11 and OpenGL ES (Android), but will not achieve full accuracy or performance. Your experience with specific hardware, operating systems, and drivers may vary.
|
> At a minimum, Dusklight requires a GPU with support for either D3D12, Vulkan, or Metal. Your experience with specific hardware, operating systems, and drivers may vary. In particular, older Intel iGPUs have a high likelihood of incompatibility. We are also aware of a number of issues on devices with Adreno GPUs and are working to resolve them.
|
||||||
|
|
||||||
### 1. Dump your game
|
### 1. Dump your game
|
||||||
|
|
||||||
You must dump your own copy of the game. Please see [this article](https://wiki.dolphin-emu.org/index.php?title=Ripping_Games) for instructions. After dumping, you can use a program like [Dolphin](https://dolphin-emu.org/) or [nodtool](https://github.com/encounter/nod/releases) to convert the `.iso` to `.rvz` to save space.
|
You must dump your own copy of the game, please see [this article](https://wiki.dolphin-emu.org/index.php?title=Ripping_Games) for instructions. After dumping, you can use a program like [Dolphin](https://dolphin-emu.org/) or [nodtool](https://github.com/encounter/nod/releases) to convert the `.iso` to a `.rvz` to save space.
|
||||||
|
|
||||||
Currently, only the GameCube USA and EUR releases are supported. Support for other versions of the game is planned in the future.
|
Currently, only the GameCube USA and EUR releases are supported. Support for other versions of the game is planned in the future.
|
||||||
|
|
||||||
### 2. Install Dusklight
|
### 2. Download [Dusklight](https://github.com/TwilitRealm/dusklight/releases)
|
||||||
|
|
||||||
Visit the [official installation guide](https://twilitrealm.dev/install/) for full instructions.
|
### 3. Setup the game
|
||||||
|
**Windows / macOS / Linux**
|
||||||
|
- Extract the .zip file
|
||||||
|
- Launch Dusklight
|
||||||
|
- Press **Select Disc Image** and provide the path to your supported game dump
|
||||||
|
- Press **Play**!
|
||||||
|
|
||||||
|
**iOS**
|
||||||
|
- Follow the [iOS setup guide](docs/ios-install-altstore.md)
|
||||||
|
|
||||||
|
**Android**
|
||||||
|
- Install the Dusklight APK
|
||||||
|
- Launch Dusklight
|
||||||
|
- Press **Select Disc Image** and provide the path to your supported game dump
|
||||||
|
- Press **Play**!
|
||||||
|
|
||||||
# Building
|
# Building
|
||||||
|
|
||||||
|
|||||||
@@ -180,7 +180,6 @@ cmake --build --preset macos-default-relwithdebinfo
|
|||||||
Alternate presets available:
|
Alternate presets available:
|
||||||
|
|
||||||
* `macos-default-debug`: Clang, Debug
|
* `macos-default-debug`: Clang, Debug
|
||||||
* `macos-default-debug-asan`: Clang, Debug, AddressSanitizer
|
|
||||||
|
|
||||||
**ninja (Linux)**
|
**ninja (Linux)**
|
||||||
|
|
||||||
@@ -192,10 +191,8 @@ cmake --build --preset linux-default-relwithdebinfo
|
|||||||
Alternate presets available:
|
Alternate presets available:
|
||||||
|
|
||||||
* `linux-default-debug`: GCC, Debug
|
* `linux-default-debug`: GCC, Debug
|
||||||
* `linux-default-debug-asan`: GCC, Debug, AddressSanitizer
|
|
||||||
* `linux-clang-relwithdebinfo`: Clang, RelWithDebInfo
|
* `linux-clang-relwithdebinfo`: Clang, RelWithDebInfo
|
||||||
* `linux-clang-debug`: Clang, Debug
|
* `linux-clang-debug`: Clang, Debug
|
||||||
* `linux-clang-debug-asan`: Clang, Debug, AddressSanitizer
|
|
||||||
|
|
||||||
**ninja (Windows)**
|
**ninja (Windows)**
|
||||||
|
|
||||||
@@ -207,7 +204,6 @@ cmake --build --preset windows-msvc-relwithdebinfo
|
|||||||
Alternate presets available:
|
Alternate presets available:
|
||||||
|
|
||||||
* `windows-msvc-debug`: MSVC, Debug
|
* `windows-msvc-debug`: MSVC, Debug
|
||||||
* `windows-msvc-debug-asan`: MSVC, Debug, AddressSanitizer
|
|
||||||
* `windows-clang-relwithdebinfo`: Clang-cl, RelWithDebInfo
|
* `windows-clang-relwithdebinfo`: Clang-cl, RelWithDebInfo
|
||||||
* `windows-clang-debug`: Clang-cl, Debug
|
* `windows-clang-debug`: Clang-cl, Debug
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
-1
Submodule extern/aurora updated: 9087a409da...f00825d9f5
+12
-19
@@ -246,6 +246,18 @@ set(DOLZEL_FILES
|
|||||||
if(DEBUG)
|
if(DEBUG)
|
||||||
list(APPEND DOLZEL_FILES src/d/d_event_debug.cpp)
|
list(APPEND DOLZEL_FILES src/d/d_event_debug.cpp)
|
||||||
endif(DEBUG)
|
endif(DEBUG)
|
||||||
|
if (DUSK_TPHD)
|
||||||
|
list(APPEND DOLZEL_FILES
|
||||||
|
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
|
||||||
|
)
|
||||||
|
endif(DUSK_TPHD)
|
||||||
|
|
||||||
set(Z2AUDIOLIB_FILES
|
set(Z2AUDIOLIB_FILES
|
||||||
src/Z2AudioLib/Z2Calc.cpp
|
src/Z2AudioLib/Z2Calc.cpp
|
||||||
@@ -1418,11 +1430,7 @@ set(DUSK_FILES
|
|||||||
include/dusk/scope_guard.hpp
|
include/dusk/scope_guard.hpp
|
||||||
src/dusk/dvd_asset.cpp
|
src/dusk/dvd_asset.cpp
|
||||||
src/d/actor/d_a_alink_dusk.cpp
|
src/d/actor/d_a_alink_dusk.cpp
|
||||||
src/dusk/android_frame_rate.hpp
|
|
||||||
src/dusk/android_frame_rate.cpp
|
|
||||||
src/dusk/asserts.cpp
|
src/dusk/asserts.cpp
|
||||||
src/dusk/batch.cpp
|
|
||||||
src/dusk/batch.hpp
|
|
||||||
src/dusk/config.cpp
|
src/dusk/config.cpp
|
||||||
src/dusk/crash_handler.cpp
|
src/dusk/crash_handler.cpp
|
||||||
src/dusk/crash_reporting.cpp
|
src/dusk/crash_reporting.cpp
|
||||||
@@ -1436,9 +1444,6 @@ set(DUSK_FILES
|
|||||||
src/dusk/game_clock.cpp
|
src/dusk/game_clock.cpp
|
||||||
src/dusk/globals.cpp
|
src/dusk/globals.cpp
|
||||||
src/dusk/gyro.cpp
|
src/dusk/gyro.cpp
|
||||||
include/dusk/menu_pointer.h
|
|
||||||
src/dusk/menu_pointer.cpp
|
|
||||||
src/dusk/mouse.cpp
|
|
||||||
src/dusk/gamepad_color.cpp
|
src/dusk/gamepad_color.cpp
|
||||||
src/dusk/autosave.cpp
|
src/dusk/autosave.cpp
|
||||||
src/dusk/http/http.hpp
|
src/dusk/http/http.hpp
|
||||||
@@ -1449,9 +1454,6 @@ set(DUSK_FILES
|
|||||||
src/dusk/speedrun.cpp
|
src/dusk/speedrun.cpp
|
||||||
src/dusk/string.cpp
|
src/dusk/string.cpp
|
||||||
src/dusk/stubs.cpp
|
src/dusk/stubs.cpp
|
||||||
include/dusk/texture_replacements.hpp
|
|
||||||
src/dusk/texture_replacements.cpp
|
|
||||||
src/dusk/touch_camera.cpp
|
|
||||||
src/dusk/update_check.cpp
|
src/dusk/update_check.cpp
|
||||||
src/dusk/update_check.hpp
|
src/dusk/update_check.hpp
|
||||||
#src/dusk/m_Do_ext_dusk.cpp
|
#src/dusk/m_Do_ext_dusk.cpp
|
||||||
@@ -1481,7 +1483,6 @@ set(DUSK_FILES
|
|||||||
src/dusk/ui/button.hpp
|
src/dusk/ui/button.hpp
|
||||||
src/dusk/ui/component.cpp
|
src/dusk/ui/component.cpp
|
||||||
src/dusk/ui/component.hpp
|
src/dusk/ui/component.hpp
|
||||||
src/dusk/ui/controls.hpp
|
|
||||||
src/dusk/ui/controller_config.cpp
|
src/dusk/ui/controller_config.cpp
|
||||||
src/dusk/ui/controller_config.hpp
|
src/dusk/ui/controller_config.hpp
|
||||||
src/dusk/ui/document.cpp
|
src/dusk/ui/document.cpp
|
||||||
@@ -1494,8 +1495,6 @@ set(DUSK_FILES
|
|||||||
src/dusk/ui/graphics_tuner.hpp
|
src/dusk/ui/graphics_tuner.hpp
|
||||||
src/dusk/ui/input.cpp
|
src/dusk/ui/input.cpp
|
||||||
src/dusk/ui/input.hpp
|
src/dusk/ui/input.hpp
|
||||||
src/dusk/ui/icon_provider.cpp
|
|
||||||
src/dusk/ui/icon_provider.hpp
|
|
||||||
src/dusk/ui/modal.cpp
|
src/dusk/ui/modal.cpp
|
||||||
src/dusk/ui/modal.hpp
|
src/dusk/ui/modal.hpp
|
||||||
src/dusk/ui/nav_types.hpp
|
src/dusk/ui/nav_types.hpp
|
||||||
@@ -1521,12 +1520,6 @@ set(DUSK_FILES
|
|||||||
src/dusk/ui/string_button.hpp
|
src/dusk/ui/string_button.hpp
|
||||||
src/dusk/ui/tab_bar.cpp
|
src/dusk/ui/tab_bar.cpp
|
||||||
src/dusk/ui/tab_bar.hpp
|
src/dusk/ui/tab_bar.hpp
|
||||||
src/dusk/ui/touch_controls_common.cpp
|
|
||||||
src/dusk/ui/touch_controls_common.hpp
|
|
||||||
src/dusk/ui/touch_controls.cpp
|
|
||||||
src/dusk/ui/touch_controls.hpp
|
|
||||||
src/dusk/ui/touch_controls_editor.cpp
|
|
||||||
src/dusk/ui/touch_controls_editor.hpp
|
|
||||||
src/dusk/ui/ui.cpp
|
src/dusk/ui/ui.cpp
|
||||||
src/dusk/ui/ui.hpp
|
src/dusk/ui/ui.hpp
|
||||||
src/dusk/ui/warp.cpp
|
src/dusk/ui/warp.cpp
|
||||||
|
|||||||
@@ -1,32 +0,0 @@
|
|||||||
From f69d29614644f9963f5cb3f828b58575d60a1c5a Mon Sep 17 00:00:00 2001
|
|
||||||
From: Joshua Trees <gh@jtrees.io>
|
|
||||||
Date: Thu, 4 Jun 2026 01:04:04 +0100
|
|
||||||
Subject: [PATCH] fix cmake paths
|
|
||||||
|
|
||||||
---
|
|
||||||
cmake/nodConfig.cmake.in | 6 +++---
|
|
||||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/cmake/nodConfig.cmake.in b/cmake/nodConfig.cmake.in
|
|
||||||
index 0969382..2a24a88 100644
|
|
||||||
--- a/cmake/nodConfig.cmake.in
|
|
||||||
+++ b/cmake/nodConfig.cmake.in
|
|
||||||
@@ -1,12 +1,12 @@
|
|
||||||
@PACKAGE_INIT@
|
|
||||||
|
|
||||||
-set(_nod_libdir "${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_LIBDIR@")
|
|
||||||
-set(_nod_incdir "${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_INCLUDEDIR@")
|
|
||||||
+set(_nod_libdir "@CMAKE_INSTALL_FULL_LIBDIR@")
|
|
||||||
+set(_nod_incdir "@CMAKE_INSTALL_FULL_INCLUDEDIR@")
|
|
||||||
|
|
||||||
if (NOT TARGET nod::nod_shared AND NOT TARGET nod::nod_static)
|
|
||||||
# Shared library
|
|
||||||
if (WIN32)
|
|
||||||
- set(_nod_dll "${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_BINDIR@/${CMAKE_SHARED_LIBRARY_PREFIX}nod${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
|
||||||
+ set(_nod_dll "@CMAKE_INSTALL_FULL_BINDIR@/${CMAKE_SHARED_LIBRARY_PREFIX}nod${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
|
||||||
set(_nod_implib "${_nod_libdir}/${CMAKE_IMPORT_LIBRARY_PREFIX}nod${CMAKE_IMPORT_LIBRARY_SUFFIX}")
|
|
||||||
if (EXISTS "${_nod_dll}")
|
|
||||||
add_library(nod::nod_shared SHARED IMPORTED)
|
|
||||||
--
|
|
||||||
2.53.0
|
|
||||||
|
|
||||||
@@ -16,37 +16,37 @@
|
|||||||
];
|
];
|
||||||
forAllSystems = lib.genAttrs supportedSystems;
|
forAllSystems = lib.genAttrs supportedSystems;
|
||||||
|
|
||||||
dawnVersion = "v20260618.032059";
|
dawnVersion = "v20260423.175430";
|
||||||
nodVersion = "v2.0.0-alpha.10";
|
nodVersion = "v2.0.0-alpha.8";
|
||||||
versionSuffix = "nix-" + (self.shortRev or self.dirtyShortRev or "dirty");
|
versionSuffix = "nix-" + (self.shortRev or self.dirtyShortRev or "dirty");
|
||||||
|
|
||||||
dawnInfo = {
|
dawnInfo = {
|
||||||
"x86_64-linux" = {
|
"x86_64-linux" = {
|
||||||
triple = "linux-x86_64";
|
triple = "linux-x86_64";
|
||||||
hash = "sha256-GFSd573b+VQx/VmFdNQgWDd0V9ayQlcw0Zuopke12ak=";
|
hash = "sha256-HXfKTLHtMPwupnFnaflCARtXVPuS/0PoCePXidjE5xs=";
|
||||||
};
|
};
|
||||||
"aarch64-linux" = {
|
"aarch64-linux" = {
|
||||||
triple = "linux-aarch64";
|
triple = "linux-aarch64";
|
||||||
hash = "sha256-ZaoP7BAjBMnfAv2/AMRi3FNH2ZtyqASCSFyU/oB2Mzg=";
|
hash = "sha256-34yyFpfqBZUwoFXQ41F0AwAU78FaNihOSY0oriwn6B0=";
|
||||||
};
|
};
|
||||||
"aarch64-darwin" = {
|
"aarch64-darwin" = {
|
||||||
triple = "darwin-arm64";
|
triple = "darwin-arm64";
|
||||||
hash = "sha256-HT+qtlLaSHyoXPrUcXgcTGa877X5YfzbxRD4bJb7i1Y=";
|
hash = "sha256-eQnzrBp6gjiBek1VYQ9A5W13ClYWrDDKjIqv/7eNTR4=";
|
||||||
};
|
};
|
||||||
"x86_64-darwin" = {
|
"x86_64-darwin" = {
|
||||||
triple = "darwin-x86_64";
|
triple = "darwin-x86_64";
|
||||||
hash = "sha256-cUNaCbA7rlKSukDVKGaVEVw0Zt1+mSbaHbmUCMvMVWc=";
|
hash = "sha256-QGWiGdxiI9kci3NPXH6QFFirxn16851zB/w3jqhIBJ4=";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
nodPrebuiltInfo = {
|
nodPrebuiltInfo = {
|
||||||
"x86_64-linux" = {
|
"x86_64-linux" = {
|
||||||
triple = "linux-x86_64";
|
triple = "linux-x86_64";
|
||||||
hash = "sha256-FVQWECVA2gWdc+n5OQ/Tvwn8z0qdgjSd1WlFt5HKOec=";
|
hash = "sha256-mUqvLsbsqaZ+HAjMmHYPYO+MgtanGRTw7Gzn5uXR5rE=";
|
||||||
};
|
};
|
||||||
"aarch64-darwin" = {
|
"aarch64-darwin" = {
|
||||||
triple = "macos-arm64";
|
triple = "macos-arm64";
|
||||||
hash = "sha256-8ZEejxksVgShNKUVRCBYaLOp9x/qOC9pAeVrElQUGUk=";
|
hash = "sha256-UPy1ywCcv0K6VJOU3uUelJuUdBh3UNaPRlyP5LOBeDw=";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -57,25 +57,15 @@
|
|||||||
inherit (pkgs.stdenv.hostPlatform) isDarwin;
|
inherit (pkgs.stdenv.hostPlatform) isDarwin;
|
||||||
hasNodPrebuilt = nodPrebuiltInfo ? ${system};
|
hasNodPrebuilt = nodPrebuiltInfo ? ${system};
|
||||||
|
|
||||||
aurora = builtins.pathExists "${self}/extern/aurora/CMakeLists.txt";
|
aurora = pkgs.fetchFromGitHub {
|
||||||
needSubmodules = ''
|
owner = "encounter";
|
||||||
dusklight: The aurora submodule is not vendored. Add submodules=1 to build.
|
repo = "aurora";
|
||||||
|
rev = "10006618ee493f248b8597e4dfa1d2871d76a1d9";
|
||||||
As a flake input:
|
hash = "sha256-lY2xuVyB7aPJ9+2wwLRB3F5U/BuPSxdSpegdG+qNd9o=";
|
||||||
|
};
|
||||||
dusklight.url = "git+https://github.com/TwilitRealm/dusklight?ref=main&submodules=1";
|
|
||||||
|
|
||||||
nix command:
|
|
||||||
|
|
||||||
nix run 'git+https://github.com/TwilitRealm/dusklight?submodules=1'
|
|
||||||
|
|
||||||
Local checkout:
|
|
||||||
|
|
||||||
nix run '.?submodules=1#dusklight'
|
|
||||||
'';
|
|
||||||
|
|
||||||
dawn = pkgs.fetchzip {
|
dawn = pkgs.fetchzip {
|
||||||
url = "https://github.com/encounter/dawn/releases/download/${dawnVersion}/dawn-${dawnInfo.${system}.triple}.tar.gz";
|
url = "https://github.com/encounter/dawn-build/releases/download/${dawnVersion}/dawn-${dawnInfo.${system}.triple}.tar.gz";
|
||||||
hash = dawnInfo.${system}.hash;
|
hash = dawnInfo.${system}.hash;
|
||||||
stripRoot = false;
|
stripRoot = false;
|
||||||
};
|
};
|
||||||
@@ -94,9 +84,8 @@
|
|||||||
owner = "encounter";
|
owner = "encounter";
|
||||||
repo = "nod";
|
repo = "nod";
|
||||||
rev = nodVersion;
|
rev = nodVersion;
|
||||||
hash = "sha256-r8qDlOVxv5iKiFjJQrcBuL9HVoOM3yEjRVnQIMqaICs=";
|
hash = "sha256-+zrtVzjo0+X/6uMcNUn1+FaSR+jOhrcQSDNBFjw0NDs=";
|
||||||
};
|
};
|
||||||
patches = [ ./fix-cmake-paths.patch ];
|
|
||||||
cargoDeps = pkgs.rustPlatform.importCargoLock {
|
cargoDeps = pkgs.rustPlatform.importCargoLock {
|
||||||
lockFile = "${finalAttrs.src}/Cargo.lock";
|
lockFile = "${finalAttrs.src}/Cargo.lock";
|
||||||
};
|
};
|
||||||
@@ -138,15 +127,15 @@
|
|||||||
NOD_PREBUILT = nod;
|
NOD_PREBUILT = nod;
|
||||||
CXXOPTS = pkgs.cxxopts.src;
|
CXXOPTS = pkgs.cxxopts.src;
|
||||||
JSON = pkgs.nlohmann_json.src;
|
JSON = pkgs.nlohmann_json.src;
|
||||||
XXHASH = pkgs.xxhash.src;
|
XXHASH = pkgs.xxHash.src;
|
||||||
ZSTD = pkgs.zstd.src;
|
ZSTD = pkgs.zstd.src;
|
||||||
FMT = pkgs.fetchzip {
|
FMT = pkgs.fetchzip {
|
||||||
url = "https://github.com/fmtlib/fmt/archive/refs/tags/12.1.0.tar.gz";
|
url = "https://github.com/fmtlib/fmt/archive/refs/tags/11.1.4.tar.gz";
|
||||||
hash = "sha256-ZmI1Dv0ZabPlxa02OpERI47jp7zFfjpeWCy1WyuPYZ0=";
|
hash = "sha256-sUbxlYi/Aupaox3JjWFqXIjcaQa0LFjclQAOleT+FRA=";
|
||||||
};
|
};
|
||||||
TRACY = pkgs.fetchzip {
|
TRACY = pkgs.fetchzip {
|
||||||
url = "https://github.com/wolfpld/tracy/archive/6789e7d6f9a65ec98926b602097a33a9676d2606.tar.gz";
|
url = "https://github.com/wolfpld/tracy/archive/a64b9a20294d59421a2f57aeca3c6383d8c48169.tar.gz";
|
||||||
hash = "sha256-Xxyd7G/mnXEPpN+ehmwl0AkAhS3CwObpJNDgcqbdUJg=";
|
hash = "sha256-hbNGOsGeyGSvCJ2No8RkwOib1lX2on3vNZSzyVkZdXw=";
|
||||||
};
|
};
|
||||||
IMGUI = pkgs.fetchFromGitHub {
|
IMGUI = pkgs.fetchFromGitHub {
|
||||||
owner = "ocornut";
|
owner = "ocornut";
|
||||||
@@ -164,126 +153,119 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
dusklight =
|
dusklight = pkgs.stdenv.mkDerivation {
|
||||||
if !aurora then
|
pname = "dusklight";
|
||||||
throw needSubmodules
|
version = versionSuffix;
|
||||||
else
|
src = ./.;
|
||||||
pkgs.stdenv.mkDerivation {
|
|
||||||
pname = "dusklight";
|
|
||||||
version = versionSuffix;
|
|
||||||
src = ./.;
|
|
||||||
|
|
||||||
postUnpack = ''
|
postUnpack = ''
|
||||||
chmod -R u+w "$sourceRoot"
|
chmod -R u+w "$sourceRoot"
|
||||||
substituteInPlace "$sourceRoot/extern/aurora/CMakeLists.txt" \
|
rm -rf "$sourceRoot/extern/aurora"
|
||||||
--replace-warn "add_subdirectory(tests)" ""
|
mkdir -p "$sourceRoot/extern"
|
||||||
|
cp -r ${aurora} "$sourceRoot/extern/aurora"
|
||||||
|
chmod -R u+w "$sourceRoot/extern/aurora"
|
||||||
|
substituteInPlace "$sourceRoot/extern/aurora/CMakeLists.txt" \
|
||||||
|
--replace-warn "add_subdirectory(tests)" ""
|
||||||
|
'';
|
||||||
|
|
||||||
|
nativeBuildInputs = [
|
||||||
|
pkgs.cmake
|
||||||
|
pkgs.ninja
|
||||||
|
pkgs.pkg-config
|
||||||
|
pkgs.python3
|
||||||
|
pkgs.python3Packages.markupsafe
|
||||||
|
]
|
||||||
|
++ lib.optionals (!isDarwin) [ pkgs.autoPatchelfHook ];
|
||||||
|
|
||||||
|
buildInputs = [
|
||||||
|
pkgs.sdl3
|
||||||
|
pkgs.freetype
|
||||||
|
pkgs.zstd
|
||||||
|
pkgs.cxxopts
|
||||||
|
pkgs.nlohmann_json
|
||||||
|
pkgs.xxHash
|
||||||
|
pkgs.abseil-cpp
|
||||||
|
pkgs.zlib
|
||||||
|
pkgs.libpng
|
||||||
|
pkgs.libjpeg_turbo
|
||||||
|
pkgs.curl
|
||||||
|
pkgs.openssl
|
||||||
|
]
|
||||||
|
++ lib.optionals isDarwin [
|
||||||
|
pkgs.apple-sdk_15
|
||||||
|
pkgs.libiconv
|
||||||
|
]
|
||||||
|
++ lib.optionals (!isDarwin) [
|
||||||
|
pkgs.libGL
|
||||||
|
pkgs.libGLU
|
||||||
|
pkgs.libglvnd
|
||||||
|
pkgs.vulkan-loader
|
||||||
|
pkgs.libX11
|
||||||
|
pkgs.libxcb
|
||||||
|
pkgs.libXcursor
|
||||||
|
pkgs.libxi
|
||||||
|
pkgs.libxrandr
|
||||||
|
pkgs.libxscrnsaver
|
||||||
|
pkgs.libxtst
|
||||||
|
pkgs.libxinerama
|
||||||
|
pkgs.libxkbcommon
|
||||||
|
pkgs.wayland
|
||||||
|
pkgs.libdecor
|
||||||
|
pkgs.alsa-lib
|
||||||
|
pkgs.libpulseaudio
|
||||||
|
pkgs.pipewire
|
||||||
|
pkgs.dbus
|
||||||
|
pkgs.udev
|
||||||
|
pkgs.libusb1
|
||||||
|
pkgs.libunwind
|
||||||
|
pkgs.gtk3
|
||||||
|
];
|
||||||
|
|
||||||
|
cmakeBuildType = "RelWithDebInfo";
|
||||||
|
ninjaFlags = [ "dusklight" ];
|
||||||
|
|
||||||
|
cmakeFlags = [
|
||||||
|
"-DDUSK_VERSION_OVERRIDE=${versionSuffix}"
|
||||||
|
"-DFETCHCONTENT_FULLY_DISCONNECTED=ON"
|
||||||
|
"-DAURORA_DAWN_PROVIDER=package"
|
||||||
|
"-DAURORA_DAWN_LINKAGE=static"
|
||||||
|
"-DAURORA_NOD_PROVIDER=package"
|
||||||
|
"-DAURORA_NOD_LINKAGE=static"
|
||||||
|
"-DAURORA_SDL3_PROVIDER=system"
|
||||||
|
]
|
||||||
|
++ lib.mapAttrsToList (key: src: "-DFETCHCONTENT_SOURCE_DIR_${key}=${src}") fetchContentDirs;
|
||||||
|
|
||||||
|
installPhase =
|
||||||
|
if isDarwin then
|
||||||
|
''
|
||||||
|
runHook preInstall
|
||||||
|
mkdir -p "$out/Applications"
|
||||||
|
cp -r Dusklight.app "$out/Applications/Dusklight.app"
|
||||||
|
runHook postInstall
|
||||||
|
''
|
||||||
|
else
|
||||||
|
''
|
||||||
|
runHook preInstall
|
||||||
|
install -Dm755 dusklight "$out/bin/dusklight"
|
||||||
|
cp -r "$src/res" "$out/bin/res"
|
||||||
|
install -Dm644 "$src/platforms/freedesktop/dev.twilitrealm.dusk.desktop" \
|
||||||
|
"$out/share/applications/dev.twilitrealm.dusk.desktop"
|
||||||
|
for size in 16 32 48 64 128 256 512 1024; do
|
||||||
|
install -Dm644 "$src/platforms/freedesktop/''${size}x''${size}/apps/dev.twilitrealm.dusk.png" \
|
||||||
|
"$out/share/icons/hicolor/''${size}x''${size}/apps/dev.twilitrealm.dusk.png"
|
||||||
|
done
|
||||||
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
nativeBuildInputs = [
|
dontStrip = true;
|
||||||
pkgs.cmake
|
|
||||||
pkgs.ninja
|
|
||||||
pkgs.pkg-config
|
|
||||||
pkgs.python3
|
|
||||||
pkgs.python3Packages.markupsafe
|
|
||||||
]
|
|
||||||
++ lib.optionals (!isDarwin) [ pkgs.autoPatchelfHook ];
|
|
||||||
|
|
||||||
buildInputs = [
|
meta = {
|
||||||
pkgs.sdl3
|
description = "Dusklight — native PC port of the Twilight Princess decompilation";
|
||||||
pkgs.freetype
|
homepage = "https://github.com/zeldaret/tp";
|
||||||
pkgs.zstd
|
platforms = supportedSystems;
|
||||||
pkgs.cxxopts
|
mainProgram = "dusklight";
|
||||||
pkgs.nlohmann_json
|
};
|
||||||
pkgs.xxhash
|
};
|
||||||
pkgs.abseil-cpp
|
|
||||||
pkgs.zlib
|
|
||||||
pkgs.libpng
|
|
||||||
pkgs.libjpeg_turbo
|
|
||||||
pkgs.curl
|
|
||||||
pkgs.openssl
|
|
||||||
]
|
|
||||||
++ lib.optionals isDarwin [
|
|
||||||
pkgs.apple-sdk_15
|
|
||||||
pkgs.libiconv
|
|
||||||
]
|
|
||||||
++ lib.optionals (!isDarwin) [
|
|
||||||
pkgs.libGL
|
|
||||||
pkgs.libGLU
|
|
||||||
pkgs.libglvnd
|
|
||||||
pkgs.vulkan-loader
|
|
||||||
pkgs.libX11
|
|
||||||
pkgs.libxcb
|
|
||||||
pkgs.libXcursor
|
|
||||||
pkgs.libxi
|
|
||||||
pkgs.libxrandr
|
|
||||||
pkgs.libxscrnsaver
|
|
||||||
pkgs.libxtst
|
|
||||||
pkgs.libxinerama
|
|
||||||
pkgs.libxkbcommon
|
|
||||||
pkgs.wayland
|
|
||||||
pkgs.libdecor
|
|
||||||
pkgs.alsa-lib
|
|
||||||
pkgs.libpulseaudio
|
|
||||||
pkgs.pipewire
|
|
||||||
pkgs.dbus
|
|
||||||
pkgs.udev
|
|
||||||
pkgs.libusb1
|
|
||||||
pkgs.libunwind
|
|
||||||
pkgs.gtk3
|
|
||||||
nod
|
|
||||||
];
|
|
||||||
|
|
||||||
cmakeBuildType = "RelWithDebInfo";
|
|
||||||
ninjaFlags = [ "dusklight" ];
|
|
||||||
|
|
||||||
cmakeFlags = [
|
|
||||||
"-DDUSK_VERSION_OVERRIDE=${versionSuffix}"
|
|
||||||
"-DFETCHCONTENT_FULLY_DISCONNECTED=ON"
|
|
||||||
"-DAURORA_DAWN_PROVIDER=package"
|
|
||||||
"-DAURORA_DAWN_LINKAGE=static"
|
|
||||||
"-DAURORA_NOD_PROVIDER=system"
|
|
||||||
"-DAURORA_SDL3_PROVIDER=system"
|
|
||||||
"-DBUILD_SHARED_LIBS=OFF"
|
|
||||||
]
|
|
||||||
++ lib.mapAttrsToList (key: src: "-DFETCHCONTENT_SOURCE_DIR_${key}=${src}") fetchContentDirs;
|
|
||||||
|
|
||||||
installPhase =
|
|
||||||
if isDarwin then
|
|
||||||
''
|
|
||||||
runHook preInstall
|
|
||||||
mkdir -p "$out/Applications"
|
|
||||||
cp -r Dusklight.app "$out/Applications/Dusklight.app"
|
|
||||||
runHook postInstall
|
|
||||||
''
|
|
||||||
else
|
|
||||||
''
|
|
||||||
runHook preInstall
|
|
||||||
install -Dm755 dusklight "$out/bin/dusklight"
|
|
||||||
cp -r "$src/res" "$out/bin/res"
|
|
||||||
install -Dm644 "$src/platforms/freedesktop/dev.twilitrealm.dusk.desktop" \
|
|
||||||
"$out/share/applications/dev.twilitrealm.dusk.desktop"
|
|
||||||
for size in 16 32 48 64 128 256 512 1024; do
|
|
||||||
install -Dm644 "$src/platforms/freedesktop/''${size}x''${size}/apps/dev.twilitrealm.dusk.png" \
|
|
||||||
"$out/share/icons/hicolor/''${size}x''${size}/apps/dev.twilitrealm.dusk.png"
|
|
||||||
done
|
|
||||||
runHook postInstall
|
|
||||||
'';
|
|
||||||
|
|
||||||
postFixup = lib.optionalString (!isDarwin) ''
|
|
||||||
patchelf \
|
|
||||||
--add-needed "${pkgs.vulkan-loader}/lib/libvulkan.so" \
|
|
||||||
$out/bin/dusklight
|
|
||||||
'';
|
|
||||||
|
|
||||||
dontStrip = true;
|
|
||||||
|
|
||||||
meta = {
|
|
||||||
description = "Dusklight — native PC port of the Twilight Princess decompilation";
|
|
||||||
homepage = "https://github.com/zeldaret/tp";
|
|
||||||
platforms = supportedSystems;
|
|
||||||
mainProgram = "dusklight";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# Tooling common to every supported host (Linux and macOS).
|
# Tooling common to every supported host (Linux and macOS).
|
||||||
commonDevTools = [
|
commonDevTools = [
|
||||||
|
|||||||
@@ -88,10 +88,6 @@ public:
|
|||||||
/* 0x02C */ cXyz field_0x2c;
|
/* 0x02C */ cXyz field_0x2c;
|
||||||
/* 0x038 */ cXyz field_0x38[60];
|
/* 0x038 */ cXyz field_0x38[60];
|
||||||
/* 0x308 */ cXyz field_0x308[60];
|
/* 0x308 */ cXyz field_0x308[60];
|
||||||
#if TARGET_PC
|
|
||||||
TGXTexObj mBlurTexObj;
|
|
||||||
ResTIMG* mpCachedBlurTex = nullptr;
|
|
||||||
#endif
|
|
||||||
}; // Size = 0x5D8
|
}; // Size = 0x5D8
|
||||||
|
|
||||||
class dAlink_bottleWaterPcallBack_c : public JPAParticleCallBack {
|
class dAlink_bottleWaterPcallBack_c : public JPAParticleCallBack {
|
||||||
@@ -4555,8 +4551,7 @@ public:
|
|||||||
#if TARGET_PC
|
#if TARGET_PC
|
||||||
void handleWolfHowl();
|
void handleWolfHowl();
|
||||||
void handleQuickTransform();
|
void handleQuickTransform();
|
||||||
bool checkAimContext();
|
bool checkGyroAimContext();
|
||||||
bool checkAimInputContext();
|
|
||||||
|
|
||||||
void onIronBallChainInterpCallback();
|
void onIronBallChainInterpCallback();
|
||||||
|
|
||||||
@@ -4569,18 +4564,6 @@ public:
|
|||||||
cXyz mIBChainInterpCurrHandRoot;
|
cXyz mIBChainInterpCurrHandRoot;
|
||||||
bool mIBChainInterpPrevValid;
|
bool mIBChainInterpPrevValid;
|
||||||
bool mIBChainInterpCurrValid;
|
bool mIBChainInterpCurrValid;
|
||||||
|
|
||||||
cXyz mHsChainInterpPrevTop;
|
|
||||||
cXyz mHsChainInterpCurrTop;
|
|
||||||
cXyz mHsChainInterpPrevRoot;
|
|
||||||
cXyz mHsChainInterpCurrRoot;
|
|
||||||
cXyz mHsChainInterpPrevSubRoot;
|
|
||||||
cXyz mHsChainInterpCurrSubRoot;
|
|
||||||
cXyz mHsChainInterpPrevSubTop;
|
|
||||||
cXyz mHsChainInterpCurrSubTop;
|
|
||||||
bool mHsChainInterpPrevValid;
|
|
||||||
bool mHsChainInterpCurrValid;
|
|
||||||
|
|
||||||
bool mIsRollstab = false;
|
bool mIsRollstab = false;
|
||||||
#endif
|
#endif
|
||||||
}; // Size: 0x385C
|
}; // Size: 0x385C
|
||||||
|
|||||||
@@ -88,14 +88,9 @@ public:
|
|||||||
/* 0x396A */ u8 field_0x396A[0x399E - 0x396A];
|
/* 0x396A */ u8 field_0x396A[0x399E - 0x396A];
|
||||||
/* 0x399E */ s16 field_0x399e;
|
/* 0x399E */ s16 field_0x399e;
|
||||||
/* 0x39A0 */ u8 field_0x39A0[0x39A4 - 0x39A0];
|
/* 0x39A0 */ u8 field_0x39A0[0x39A4 - 0x39A0];
|
||||||
#if TARGET_PC
|
|
||||||
/* 0x39A4 */ cM_rnd_c mMantRng;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
#if TARGET_PC
|
|
||||||
STATIC_ASSERT(sizeof(mant_class) == 0x39ac);
|
|
||||||
#else
|
|
||||||
STATIC_ASSERT(sizeof(mant_class) == 0x39a4);
|
STATIC_ASSERT(sizeof(mant_class) == 0x39a4);
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* D_A_MANT_H */
|
#endif /* D_A_MANT_H */
|
||||||
|
|||||||
@@ -299,13 +299,8 @@ public:
|
|||||||
/* 0x168C */ u8 field_0x168c;
|
/* 0x168C */ u8 field_0x168c;
|
||||||
/* 0x168D */ u8 field_0x168d;
|
/* 0x168D */ u8 field_0x168d;
|
||||||
/* 0x168E */ u8 HIOInit;
|
/* 0x168E */ u8 HIOInit;
|
||||||
|
|
||||||
#if TARGET_PC
|
|
||||||
cXyz mLineInterpPrev[MG_ROD_LURE_LINE_LEN];
|
|
||||||
cXyz mLineInterpCurr[MG_ROD_LURE_LINE_LEN];
|
|
||||||
bool mLineInterpPrevValid;
|
|
||||||
bool mLineInterpCurrValid;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
STATIC_ASSERT(sizeof(dmg_rod_class) == 0x1690);
|
||||||
|
|
||||||
#endif /* D_A_MG_ROD_H */
|
#endif /* D_A_MG_ROD_H */
|
||||||
|
|||||||
@@ -66,18 +66,9 @@ public:
|
|||||||
/* 0x2CA7 */ s8 hide_lock;
|
/* 0x2CA7 */ s8 hide_lock;
|
||||||
/* 0x2CA8 */ cXyz field_0x2ca8;
|
/* 0x2CA8 */ cXyz field_0x2ca8;
|
||||||
/* 0x2CB4 */ u8 field_0x2cb4;
|
/* 0x2CB4 */ u8 field_0x2cb4;
|
||||||
|
|
||||||
#if TARGET_PC
|
|
||||||
Mtx mChainInterpPrev[6][16];
|
|
||||||
Mtx mChainInterpCurr[6][16];
|
|
||||||
bool mChainInterpPrevValid;
|
|
||||||
bool mChainInterpCurrValid;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#if !TARGET_PC
|
|
||||||
STATIC_ASSERT(sizeof(obj_keyhole_class) == 0x2CB8);
|
STATIC_ASSERT(sizeof(obj_keyhole_class) == 0x2CB8);
|
||||||
#endif
|
|
||||||
|
|
||||||
class daObj_Keyhole_HIO_c : public JORReflexible {
|
class daObj_Keyhole_HIO_c : public JORReflexible {
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -50,10 +50,6 @@ public:
|
|||||||
/* 0x14 */ Mtx mProjMtx;
|
/* 0x14 */ Mtx mProjMtx;
|
||||||
/* 0x44 */ ResTIMG* mpImg;
|
/* 0x44 */ ResTIMG* mpImg;
|
||||||
/* 0x48 */ u8* mpData;
|
/* 0x48 */ u8* mpData;
|
||||||
#if TARGET_PC
|
|
||||||
TGXTexObj mTexObj;
|
|
||||||
ResTIMG* mpCachedImg = nullptr;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class daPy_boomerangMove_c {
|
class daPy_boomerangMove_c {
|
||||||
|
|||||||
@@ -4,10 +4,6 @@
|
|||||||
#include "JSystem/J3DGraphBase/J3DPacket.h"
|
#include "JSystem/J3DGraphBase/J3DPacket.h"
|
||||||
#include "SSystem/SComponent/c_xyz.h"
|
#include "SSystem/SComponent/c_xyz.h"
|
||||||
|
|
||||||
#if TARGET_PC
|
|
||||||
#include "dusk/batch.hpp"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class cCcD_Obj;
|
class cCcD_Obj;
|
||||||
class dCcMassS_HitInf;
|
class dCcMassS_HitInf;
|
||||||
class fopAc_ac_c;
|
class fopAc_ac_c;
|
||||||
@@ -111,12 +107,6 @@ public:
|
|||||||
#if TARGET_PC
|
#if TARGET_PC
|
||||||
TGXTexObj mTexObj_l_J_Ohana00_64TEX;
|
TGXTexObj mTexObj_l_J_Ohana00_64TEX;
|
||||||
TGXTexObj mTexObj_l_J_Ohana01_64128_0419TEX;
|
TGXTexObj mTexObj_l_J_Ohana01_64128_0419TEX;
|
||||||
|
|
||||||
dusk::batch::LeafTemplate mTplHana00; // l_J_hana00DL
|
|
||||||
dusk::batch::LeafTemplate mTplHana00Cut; // l_J_hana00_cDL
|
|
||||||
dusk::batch::LeafTemplate mTplHana01; // l_J_hana01DL
|
|
||||||
dusk::batch::LeafTemplate mTplHana01Cut00; // l_J_hana01_c_00DL
|
|
||||||
dusk::batch::LeafTemplate mTplHana01Cut; // l_J_hana01_c_01DL
|
|
||||||
#endif
|
#endif
|
||||||
}; // Size: 0x12A54
|
}; // Size: 0x12A54
|
||||||
|
|
||||||
|
|||||||
@@ -4,10 +4,6 @@
|
|||||||
#include "JSystem/J3DGraphBase/J3DPacket.h"
|
#include "JSystem/J3DGraphBase/J3DPacket.h"
|
||||||
#include "SSystem/SComponent/c_xyz.h"
|
#include "SSystem/SComponent/c_xyz.h"
|
||||||
|
|
||||||
#if TARGET_PC
|
|
||||||
#include "../../../src/dusk/batch.hpp"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class cCcD_Obj;
|
class cCcD_Obj;
|
||||||
class csXyz;
|
class csXyz;
|
||||||
class dCcMassS_HitInf;
|
class dCcMassS_HitInf;
|
||||||
@@ -114,10 +110,6 @@ public:
|
|||||||
#if TARGET_PC
|
#if TARGET_PC
|
||||||
TGXTexObj mTexObj_l_M_Hijiki00TEX;
|
TGXTexObj mTexObj_l_M_Hijiki00TEX;
|
||||||
TGXTexObj mTexObj_l_M_kusa05_RGBATEX;
|
TGXTexObj mTexObj_l_M_kusa05_RGBATEX;
|
||||||
|
|
||||||
dusk::batch::LeafTemplate mTplKusa9q; // l_M_Kusa_9qDL
|
|
||||||
dusk::batch::LeafTemplate mTplKusa9qCut; // l_M_Kusa_9q_cDL
|
|
||||||
dusk::batch::LeafTemplate mTplTengusa; // l_M_TenGusaDL
|
|
||||||
#endif
|
#endif
|
||||||
}; // Size: 0x1D718
|
}; // Size: 0x1D718
|
||||||
|
|
||||||
|
|||||||
@@ -1037,7 +1037,6 @@ public:
|
|||||||
bool test1Camera(s32);
|
bool test1Camera(s32);
|
||||||
bool test2Camera(s32);
|
bool test2Camera(s32);
|
||||||
#if TARGET_PC
|
#if TARGET_PC
|
||||||
static bool isAimActive();
|
|
||||||
bool freeCamera();
|
bool freeCamera();
|
||||||
bool executeDebugFlyCam();
|
bool executeDebugFlyCam();
|
||||||
void deactivateDebugFlyCam();
|
void deactivateDebugFlyCam();
|
||||||
|
|||||||
@@ -287,11 +287,6 @@ public:
|
|||||||
MEMCARDCHECKPROC_ERR_YESNO_CURSOR_MOVE_ANM,
|
MEMCARDCHECKPROC_ERR_YESNO_CURSOR_MOVE_ANM,
|
||||||
MEMCARDCHECKPROC_SAVEDATA_CLEAR,
|
MEMCARDCHECKPROC_SAVEDATA_CLEAR,
|
||||||
|
|
||||||
#if TARGET_PC
|
|
||||||
MEMCARDCHECKPROC_AUTO_MAKE_GAMEFILE,
|
|
||||||
MEMCARDCHECKPROC_AUTO_MAKE_GAMEFILE_ERR_WAIT,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if PLATFORM_WII || PLATFORM_SHIELD
|
#if PLATFORM_WII || PLATFORM_SHIELD
|
||||||
MEMCARDCHECKPROC_NAND_STAT_CHECK,
|
MEMCARDCHECKPROC_NAND_STAT_CHECK,
|
||||||
MEMCARDCHECKPROC_GAMEFILE_INIT_SEL,
|
MEMCARDCHECKPROC_GAMEFILE_INIT_SEL,
|
||||||
@@ -416,10 +411,6 @@ public:
|
|||||||
bool yesnoWakuAlpahAnm(u8);
|
bool yesnoWakuAlpahAnm(u8);
|
||||||
#if TARGET_PC
|
#if TARGET_PC
|
||||||
void fileSelectWide();
|
void fileSelectWide();
|
||||||
bool pointerDataSelect();
|
|
||||||
bool pointerMenuSelect();
|
|
||||||
bool pointerCopyDataToSelect();
|
|
||||||
bool pointerYesNoSelect(bool errorSelect);
|
|
||||||
#endif
|
#endif
|
||||||
void _draw();
|
void _draw();
|
||||||
void errorMoveAnmInitSet(int, int);
|
void errorMoveAnmInitSet(int, int);
|
||||||
@@ -454,10 +445,6 @@ public:
|
|||||||
void MemCardMakeGameFile();
|
void MemCardMakeGameFile();
|
||||||
void MemCardMakeGameFileWait();
|
void MemCardMakeGameFileWait();
|
||||||
void MemCardMakeGameFileCheck();
|
void MemCardMakeGameFileCheck();
|
||||||
#if TARGET_PC
|
|
||||||
void MemCardAutoMakeGameFile();
|
|
||||||
void MemCardAutoMakeGameFileErrWait();
|
|
||||||
#endif
|
|
||||||
void MemCardMsgWindowInitOpen();
|
void MemCardMsgWindowInitOpen();
|
||||||
void MemCardMsgWindowOpen();
|
void MemCardMsgWindowOpen();
|
||||||
void MemCardMsgWindowClose();
|
void MemCardMsgWindowClose();
|
||||||
|
|||||||
@@ -198,7 +198,6 @@ struct HOUSI_EFF {
|
|||||||
/* 0x4C */ u16 field_0x4c;
|
/* 0x4C */ u16 field_0x4c;
|
||||||
}; // Size: 0x50
|
}; // Size: 0x50
|
||||||
|
|
||||||
// Housi is the rising square particles in Twilight
|
|
||||||
class dKankyo_housi_Packet : public J3DPacket {
|
class dKankyo_housi_Packet : public J3DPacket {
|
||||||
public:
|
public:
|
||||||
virtual void draw();
|
virtual void draw();
|
||||||
@@ -209,7 +208,7 @@ public:
|
|||||||
/* 0x0020 */ HOUSI_EFF mHousiEff[300];
|
/* 0x0020 */ HOUSI_EFF mHousiEff[300];
|
||||||
/* 0x5DE0 */ u8 field_0x5de0[8];
|
/* 0x5DE0 */ u8 field_0x5de0[8];
|
||||||
/* 0x5DE8 */ f32 field_0x5de8;
|
/* 0x5DE8 */ f32 field_0x5de8;
|
||||||
/* 0x5DEC */ s16 mHousiCount;
|
/* 0x5DEC */ s16 field_0x5dec;
|
||||||
}; // Size: 0x5DF0
|
}; // Size: 0x5DF0
|
||||||
|
|
||||||
struct CLOUD_EFF {
|
struct CLOUD_EFF {
|
||||||
|
|||||||
@@ -157,9 +157,6 @@ public:
|
|||||||
int getDispType() const;
|
int getDispType() const;
|
||||||
void _move(f32, f32, int, f32);
|
void _move(f32, f32, int, f32);
|
||||||
void _draw();
|
void _draw();
|
||||||
#if TARGET_PC
|
|
||||||
bool refreshTextureSize();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
virtual ~dMap_c() {
|
virtual ~dMap_c() {
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
|||||||
@@ -74,8 +74,6 @@ public:
|
|||||||
|
|
||||||
#if TARGET_PC
|
#if TARGET_PC
|
||||||
void menuCollectWide();
|
void menuCollectWide();
|
||||||
bool pointerWait();
|
|
||||||
void pointerActivateCurrent();
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void _create();
|
void _create();
|
||||||
|
|||||||
@@ -51,10 +51,6 @@ public:
|
|||||||
void setBButtonString(u16);
|
void setBButtonString(u16);
|
||||||
void setHIO(bool);
|
void setHIO(bool);
|
||||||
|
|
||||||
#if TARGET_PC
|
|
||||||
bool pointerWait();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
virtual void draw() { _draw(); }
|
virtual void draw() { _draw(); }
|
||||||
virtual ~dMenu_Insect_c();
|
virtual ~dMenu_Insect_c();
|
||||||
|
|
||||||
|
|||||||
@@ -55,10 +55,6 @@ public:
|
|||||||
u8 getLetterNum();
|
u8 getLetterNum();
|
||||||
void setHIO(bool);
|
void setHIO(bool);
|
||||||
|
|
||||||
#if TARGET_PC
|
|
||||||
bool pointerWait();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
virtual void draw() { _draw(); }
|
virtual void draw() { _draw(); }
|
||||||
virtual ~dMenu_Letter_c();
|
virtual ~dMenu_Letter_c();
|
||||||
|
|
||||||
|
|||||||
@@ -80,9 +80,6 @@ public:
|
|||||||
void setBButtonString(u16);
|
void setBButtonString(u16);
|
||||||
bool isRumbleSupported();
|
bool isRumbleSupported();
|
||||||
bool dpdMenuMove();
|
bool dpdMenuMove();
|
||||||
#if TARGET_PC
|
|
||||||
bool pointerConfirmSelect();
|
|
||||||
#endif
|
|
||||||
void paneResize(u64);
|
void paneResize(u64);
|
||||||
void initialize();
|
void initialize();
|
||||||
void yesnoMenuMoveAnmInitSet(int, int);
|
void yesnoMenuMoveAnmInitSet(int, int);
|
||||||
|
|||||||
@@ -74,9 +74,6 @@ public:
|
|||||||
void clacEllipsePlotAverage(int, f32, f32);
|
void clacEllipsePlotAverage(int, f32, f32);
|
||||||
bool dpdMove();
|
bool dpdMove();
|
||||||
u8 openExplain(u8);
|
u8 openExplain(u8);
|
||||||
#if TARGET_PC
|
|
||||||
bool pointerMove();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
virtual void draw() { _draw(); }
|
virtual void draw() { _draw(); }
|
||||||
virtual ~dMenu_Ring_c();
|
virtual ~dMenu_Ring_c();
|
||||||
@@ -218,7 +215,6 @@ private:
|
|||||||
bool mCursorInterpPrevAngular;
|
bool mCursorInterpPrevAngular;
|
||||||
bool mCursorInterpCurrAngular;
|
bool mCursorInterpCurrAngular;
|
||||||
bool mCursorInterpInit;
|
bool mCursorInterpInit;
|
||||||
bool mPointerTouchPressHoveredCurrent;
|
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -266,8 +266,6 @@ public:
|
|||||||
|
|
||||||
#if TARGET_PC
|
#if TARGET_PC
|
||||||
void menuSaveWide();
|
void menuSaveWide();
|
||||||
bool pointerSaveSelect();
|
|
||||||
bool pointerYesNoSelect(bool errorSelect, u8 errParam = 0, u8 soundParam = 0);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void _draw2();
|
void _draw2();
|
||||||
|
|||||||
@@ -49,10 +49,6 @@ public:
|
|||||||
u8 getSkillNum();
|
u8 getSkillNum();
|
||||||
void setHIO(bool);
|
void setHIO(bool);
|
||||||
|
|
||||||
#if TARGET_PC
|
|
||||||
bool pointerWait();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
virtual void draw() { _draw(); }
|
virtual void draw() { _draw(); }
|
||||||
virtual ~dMenu_Skill_c();
|
virtual ~dMenu_Skill_c();
|
||||||
|
|
||||||
|
|||||||
@@ -360,12 +360,7 @@ inline void dMsgObject_demoMessageGroup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline bool dMsgObject_isTalkNowCheck() {
|
inline bool dMsgObject_isTalkNowCheck() {
|
||||||
#if TARGET_PC
|
|
||||||
dMsgObject_c* msgObject = dMsgObject_getMsgObjectClass();
|
|
||||||
return msgObject != NULL && msgObject->getStatus() != 1;
|
|
||||||
#else
|
|
||||||
return dMsgObject_getMsgObjectClass()->getStatus() == 1 ? false : true;
|
return dMsgObject_getMsgObjectClass()->getStatus() == 1 ? false : true;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool dMsgObject_isKillMessageFlag() {
|
inline bool dMsgObject_isKillMessageFlag() {
|
||||||
@@ -502,12 +497,7 @@ inline void dMsgObject_onMsgSend() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline bool dMsgObject_isFukidashiCheck() {
|
inline bool dMsgObject_isFukidashiCheck() {
|
||||||
#if TARGET_PC
|
|
||||||
dMsgObject_c* msgObject = dMsgObject_getMsgObjectClass();
|
|
||||||
return msgObject != NULL && msgObject->getScrnDrawPtr() != NULL;
|
|
||||||
#else
|
|
||||||
return dMsgObject_getMsgObjectClass()->getScrnDrawPtr() == NULL ? false : true;
|
return dMsgObject_getMsgObjectClass()->getScrnDrawPtr() == NULL ? false : true;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void* dMsgObject_getTalkHeap() {
|
inline void* dMsgObject_getTalkHeap() {
|
||||||
|
|||||||
@@ -49,10 +49,6 @@ public:
|
|||||||
void selectScale();
|
void selectScale();
|
||||||
void selectTrans();
|
void selectTrans();
|
||||||
void selectAnimeTransform(int);
|
void selectAnimeTransform(int);
|
||||||
#if TARGET_PC
|
|
||||||
bool pointerMove();
|
|
||||||
bool consumePointerClick();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void setOffsetX(f32 i_offsetX) { mOffsetX = i_offsetX; }
|
void setOffsetX(f32 i_offsetX) { mOffsetX = i_offsetX; }
|
||||||
bool isAnimeUpdate(int param_0) { return (field_0x114 & (u8)(1 << param_0)) ? TRUE : FALSE; }
|
bool isAnimeUpdate(int param_0) { return (field_0x114 & (u8)(1 << param_0)) ? TRUE : FALSE; }
|
||||||
|
|||||||
@@ -9,8 +9,6 @@ namespace dusk {
|
|||||||
enum class ActionBinds {
|
enum class ActionBinds {
|
||||||
FIRST_PERSON_CAMERA,
|
FIRST_PERSON_CAMERA,
|
||||||
CALL_MIDNA,
|
CALL_MIDNA,
|
||||||
OPEN_MAP_SCREEN,
|
|
||||||
TOGGLE_MINIMAP,
|
|
||||||
OPEN_DUSKLIGHT_MENU,
|
OPEN_DUSKLIGHT_MENU,
|
||||||
TURBO_SPEED_BUTTON,
|
TURBO_SPEED_BUTTON,
|
||||||
COUNT,
|
COUNT,
|
||||||
@@ -34,12 +32,6 @@ bool isActionBound(ActionBinds action, u32 port);
|
|||||||
|
|
||||||
void updateActionBindings();
|
void updateActionBindings();
|
||||||
|
|
||||||
void setVirtualActionBind(ActionBinds action, u32 port, bool pressed, bool available = true);
|
|
||||||
|
|
||||||
void clearVirtualActionBind(ActionBinds action, u32 port);
|
|
||||||
|
|
||||||
void clearAllVirtualActionBinds();
|
|
||||||
|
|
||||||
bool getActionBindTrig(ActionBinds action, u32 port);
|
bool getActionBindTrig(ActionBinds action, u32 port);
|
||||||
|
|
||||||
bool getActionBindHold(ActionBinds action, u32 port);
|
bool getActionBindHold(ActionBinds action, u32 port);
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
#include "dolphin/types.h"
|
#include "dolphin/types.h"
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <limits>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -140,16 +139,11 @@ concept ConfigValueInteger =
|
|||||||
|| std::is_same_v<T, s64>
|
|| std::is_same_v<T, s64>
|
||||||
|| std::is_same_v<T, u64>;
|
|| std::is_same_v<T, u64>;
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
struct ConfigValueTraits {
|
|
||||||
static constexpr bool enabled = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Concept that defines the legal set of types that can be used for CVar values.
|
* \brief Concept that defines the legal set of types that can be used for CVar values.
|
||||||
*
|
*
|
||||||
* Valid types cannot be cv-qualified and must be basic primitive types (int, float, bool),
|
* Valid types cannot be cv-qualified and must be basic primitive types (int, float, bool),
|
||||||
* strings, enums of the basic primitives, or explicitly-enabled structured settings.
|
* strings, or enums of the basic primitives.
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
concept ConfigValue =
|
concept ConfigValue =
|
||||||
@@ -160,8 +154,7 @@ concept ConfigValue =
|
|||||||
|| std::is_same_v<T, f32>
|
|| std::is_same_v<T, f32>
|
||||||
|| std::is_same_v<T, f64>
|
|| std::is_same_v<T, f64>
|
||||||
|| std::is_same_v<T, std::string>
|
|| std::is_same_v<T, std::string>
|
||||||
|| (std::is_enum_v<T> && ConfigValueInteger<std::underlying_type_t<T>>)
|
|| (std::is_enum_v<T> && ConfigValueInteger<std::underlying_type_t<T>>));
|
||||||
|| ConfigValueTraits<T>::enabled);
|
|
||||||
|
|
||||||
template <ConfigValue T>
|
template <ConfigValue T>
|
||||||
const ConfigImplBase* GetConfigImpl();
|
const ConfigImplBase* GetConfigImpl();
|
||||||
|
|||||||
@@ -7,16 +7,12 @@
|
|||||||
#include <dolphin/gx/GXExtra.h>
|
#include <dolphin/gx/GXExtra.h>
|
||||||
#include "tracy/Tracy.hpp"
|
#include "tracy/Tracy.hpp"
|
||||||
|
|
||||||
#if DUSK_GFX_DEBUG_GROUPS
|
|
||||||
#define GX_DEBUG_GROUP(name, ...) \
|
#define GX_DEBUG_GROUP(name, ...) \
|
||||||
do { \
|
do { \
|
||||||
GXPushDebugGroup(#name); \
|
GXPushDebugGroup(#name); \
|
||||||
name(__VA_ARGS__); \
|
name(__VA_ARGS__); \
|
||||||
GXPopDebugGroup(); \
|
GXPopDebugGroup(); \
|
||||||
} while (0)
|
} while (0)
|
||||||
#else
|
|
||||||
#define GX_DEBUG_GROUP(name, ...) name(__VA_ARGS__)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef TARGET_PC
|
#ifdef TARGET_PC
|
||||||
class GXTexObjRAII : public GXTexObj {
|
class GXTexObjRAII : public GXTexObj {
|
||||||
@@ -43,37 +39,16 @@ public:
|
|||||||
static_assert(sizeof(GXTexObjRAII) == sizeof(GXTexObj),
|
static_assert(sizeof(GXTexObjRAII) == sizeof(GXTexObj),
|
||||||
"GXTexObjRAII should have the same size as GXTexObj");
|
"GXTexObjRAII should have the same size as GXTexObj");
|
||||||
typedef GXTexObjRAII TGXTexObj;
|
typedef GXTexObjRAII TGXTexObj;
|
||||||
|
|
||||||
class GXTlutObjRAII : public GXTlutObj {
|
|
||||||
public:
|
|
||||||
GXTlutObjRAII() : GXTlutObj() {}
|
|
||||||
~GXTlutObjRAII() { GXDestroyTlutObj(this); }
|
|
||||||
|
|
||||||
void reset() { GXDestroyTlutObj(this); }
|
|
||||||
|
|
||||||
GXTlutObjRAII(const GXTlutObjRAII&) = delete;
|
|
||||||
GXTlutObjRAII& operator=(const GXTlutObjRAII&) = delete;
|
|
||||||
GXTlutObjRAII(GXTlutObjRAII&&) = delete;
|
|
||||||
GXTlutObjRAII& operator=(GXTlutObjRAII&&) = delete;
|
|
||||||
};
|
|
||||||
static_assert(sizeof(GXTlutObjRAII) == sizeof(GXTlutObj),
|
|
||||||
"GXTlutObjRAII should have the same size as GXTlutObj");
|
|
||||||
typedef GXTlutObjRAII TGXTlutObj;
|
|
||||||
#else
|
#else
|
||||||
typedef GXTexObj TGXTexObj;
|
typedef GXTexObj TGXTexObj;
|
||||||
typedef GXTlutObj TGXTlutObj;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct GXScopedDebugGroup {
|
struct GXScopedDebugGroup {
|
||||||
explicit GXScopedDebugGroup(const char* text) {
|
explicit GXScopedDebugGroup(const char* text) {
|
||||||
#if DUSK_GFX_DEBUG_GROUPS
|
|
||||||
GXPushDebugGroup(text);
|
GXPushDebugGroup(text);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
~GXScopedDebugGroup() {
|
~GXScopedDebugGroup() {
|
||||||
#if DUSK_GFX_DEBUG_GROUPS
|
|
||||||
GXPopDebugGroup();
|
GXPopDebugGroup();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+4
-1
@@ -1,4 +1,5 @@
|
|||||||
#pragma once
|
#ifndef DUSK_GYRO_H
|
||||||
|
#define DUSK_GYRO_H
|
||||||
|
|
||||||
namespace dusk::gyro {
|
namespace dusk::gyro {
|
||||||
void read(float dt);
|
void read(float dt);
|
||||||
@@ -13,3 +14,5 @@ bool get_sensor_keep_alive();
|
|||||||
void set_sensor_keep_alive(bool value);
|
void set_sensor_keep_alive(bool value);
|
||||||
bool rollgoal_gyro_enabled();
|
bool rollgoal_gyro_enabled();
|
||||||
} // namespace dusk::gyro
|
} // namespace dusk::gyro
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -1,65 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "dolphin/types.h"
|
|
||||||
|
|
||||||
class CPaneMgr;
|
|
||||||
|
|
||||||
namespace dusk::menu_pointer {
|
|
||||||
|
|
||||||
using TargetId = u16;
|
|
||||||
constexpr TargetId InvalidTarget = 0xffff;
|
|
||||||
|
|
||||||
enum class Context {
|
|
||||||
None,
|
|
||||||
FileSelect,
|
|
||||||
Save,
|
|
||||||
ItemWheel,
|
|
||||||
Collection,
|
|
||||||
Options,
|
|
||||||
Dialog,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class Phase {
|
|
||||||
Move,
|
|
||||||
Press,
|
|
||||||
Release,
|
|
||||||
Cancel,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct State {
|
|
||||||
f32 x = 0.0f;
|
|
||||||
f32 y = 0.0f;
|
|
||||||
bool valid = false;
|
|
||||||
bool down = false;
|
|
||||||
bool pressed = false;
|
|
||||||
bool released = false;
|
|
||||||
bool clicked = false;
|
|
||||||
bool touch = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
void begin_game_frame() noexcept;
|
|
||||||
void end_game_frame() noexcept;
|
|
||||||
void begin_context(Context context) noexcept;
|
|
||||||
bool handle_fallthrough_pointer(f32 x, f32 y, Phase phase, bool touch, s32 mouseButton = -1) noexcept;
|
|
||||||
|
|
||||||
bool active() noexcept;
|
|
||||||
bool enabled() noexcept;
|
|
||||||
bool mouse_capture_active() noexcept;
|
|
||||||
const State& state() noexcept;
|
|
||||||
void set_hover_target(TargetId target) noexcept;
|
|
||||||
bool consume_click() noexcept;
|
|
||||||
bool peek_click() noexcept;
|
|
||||||
void set_dialog_choice(u8 choice, bool clicked) noexcept;
|
|
||||||
bool get_dialog_choice(u8& choice) noexcept;
|
|
||||||
bool consume_dialog_click(u8& choice) noexcept;
|
|
||||||
void defer_activation(Context context, TargetId target) noexcept;
|
|
||||||
bool consume_deferred_activation(Context context, TargetId target) noexcept;
|
|
||||||
void clear_deferred_activation(Context context) noexcept;
|
|
||||||
u32 suppressed_pad_buttons(u32 port) noexcept;
|
|
||||||
void finish_pad_suppression_read(u32 port) noexcept;
|
|
||||||
|
|
||||||
bool hit_rect(f32 left, f32 top, f32 right, f32 bottom, f32 padding = 0.0f) noexcept;
|
|
||||||
bool hit_pane(CPaneMgr* pane, f32 padding = 0.0f) noexcept;
|
|
||||||
bool hit_pane(J2DPane* pane, f32 padding = 0.0f) noexcept;
|
|
||||||
|
|
||||||
} // namespace dusk::menu_pointer
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <SDL3/SDL_events.h>
|
|
||||||
|
|
||||||
namespace dusk::mouse {
|
|
||||||
void read();
|
|
||||||
void get_aim_deltas(float& out_yaw, float& out_pitch);
|
|
||||||
void get_camera_deltas(float& out_yaw, float& out_pitch);
|
|
||||||
void handle_event(const SDL_Event& event) noexcept;
|
|
||||||
void on_focus_lost();
|
|
||||||
void on_focus_gained();
|
|
||||||
} // namespace dusk::mouse
|
|
||||||
+25
-53
@@ -1,9 +1,9 @@
|
|||||||
#pragma once
|
#ifndef DUSK_CONFIG_H
|
||||||
|
#define DUSK_CONFIG_H
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
#include "dusk/config_var.hpp"
|
#include "dusk/config_var.hpp"
|
||||||
#include "dusk/ui/controls.hpp"
|
|
||||||
|
|
||||||
namespace dusk {
|
namespace dusk {
|
||||||
|
|
||||||
@@ -40,32 +40,23 @@ enum class DiscVerificationState : u8 {
|
|||||||
HashMismatch,
|
HashMismatch,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class GyroMode : u8 {
|
||||||
|
Sensor = 0,
|
||||||
|
Mouse = 1,
|
||||||
|
};
|
||||||
|
|
||||||
enum class FrameInterpMode : u8 {
|
enum class FrameInterpMode : u8 {
|
||||||
Off = 0,
|
Off = 0,
|
||||||
Capped = 1,
|
Capped = 1,
|
||||||
Unlimited = 2,
|
Unlimited = 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class TouchTargeting : u8 {
|
|
||||||
Hybrid = 0,
|
|
||||||
Hold = 1,
|
|
||||||
Switch = 2,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class MenuScaling : u8 {
|
enum class MenuScaling : u8 {
|
||||||
GameCube = 0,
|
GameCube = 0,
|
||||||
Wii = 1,
|
Wii = 1,
|
||||||
Dusklight = 2,
|
Dusklight = 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class MagicArmorMode : u8 {
|
|
||||||
NORMAL = 0,
|
|
||||||
ON_DAMAGE = 1,
|
|
||||||
DOUBLE_DEFENSE = 2,
|
|
||||||
INVINCIBLE = 3,
|
|
||||||
COSMETIC = 4,
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace config {
|
namespace config {
|
||||||
template <>
|
template <>
|
||||||
struct ConfigEnumRange<BloomMode> {
|
struct ConfigEnumRange<BloomMode> {
|
||||||
@@ -97,34 +88,23 @@ struct ConfigEnumRange<DiscVerificationState> {
|
|||||||
static constexpr auto max = DiscVerificationState::HashMismatch;
|
static constexpr auto max = DiscVerificationState::HashMismatch;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct ConfigEnumRange<GyroMode> {
|
||||||
|
static constexpr auto min = GyroMode::Sensor;
|
||||||
|
static constexpr auto max = GyroMode::Mouse;
|
||||||
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct ConfigEnumRange<FrameInterpMode> {
|
struct ConfigEnumRange<FrameInterpMode> {
|
||||||
static constexpr auto min = FrameInterpMode::Off;
|
static constexpr auto min = FrameInterpMode::Off;
|
||||||
static constexpr auto max = FrameInterpMode::Unlimited;
|
static constexpr auto max = FrameInterpMode::Unlimited;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ConfigEnumRange<TouchTargeting> {
|
|
||||||
static constexpr auto min = TouchTargeting::Hybrid;
|
|
||||||
static constexpr auto max = TouchTargeting::Switch;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct ConfigEnumRange<MenuScaling> {
|
struct ConfigEnumRange<MenuScaling> {
|
||||||
static constexpr auto min = MenuScaling::GameCube;
|
static constexpr auto min = MenuScaling::GameCube;
|
||||||
static constexpr auto max = MenuScaling::Dusklight;
|
static constexpr auto max = MenuScaling::Dusklight;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ConfigEnumRange<MagicArmorMode> {
|
|
||||||
static constexpr auto min = MagicArmorMode::NORMAL;
|
|
||||||
static constexpr auto max = MagicArmorMode::COSMETIC;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ConfigValueTraits<ui::ControlLayout> {
|
|
||||||
static constexpr bool enabled = true;
|
|
||||||
};
|
|
||||||
} // namespace config
|
} // namespace config
|
||||||
|
|
||||||
// Persistent user settings
|
// Persistent user settings
|
||||||
@@ -140,9 +120,6 @@ struct UserSettings {
|
|||||||
ConfigVar<bool> enableFpsOverlay;
|
ConfigVar<bool> enableFpsOverlay;
|
||||||
ConfigVar<int> fpsOverlayCorner;
|
ConfigVar<int> fpsOverlayCorner;
|
||||||
ConfigVar<int> maxFrameRate;
|
ConfigVar<int> maxFrameRate;
|
||||||
ConfigVar<bool> rememberWindowSize;
|
|
||||||
ConfigVar<int> lastWindowWidth;
|
|
||||||
ConfigVar<int> lastWindowHeight;
|
|
||||||
} video;
|
} video;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
@@ -176,7 +153,6 @@ struct UserSettings {
|
|||||||
ConfigVar<bool> noMissClimbing;
|
ConfigVar<bool> noMissClimbing;
|
||||||
ConfigVar<bool> fastTears;
|
ConfigVar<bool> fastTears;
|
||||||
ConfigVar<bool> no2ndFishForCat;
|
ConfigVar<bool> no2ndFishForCat;
|
||||||
ConfigVar<bool> buttonFishing;
|
|
||||||
ConfigVar<bool> instantSaves;
|
ConfigVar<bool> instantSaves;
|
||||||
ConfigVar<bool> instantText;
|
ConfigVar<bool> instantText;
|
||||||
ConfigVar<bool> sunsSong;
|
ConfigVar<bool> sunsSong;
|
||||||
@@ -186,7 +162,6 @@ struct UserSettings {
|
|||||||
// Preferences
|
// Preferences
|
||||||
ConfigVar<bool> enableMirrorMode;
|
ConfigVar<bool> enableMirrorMode;
|
||||||
ConfigVar<bool> minimalHUD;
|
ConfigVar<bool> minimalHUD;
|
||||||
ConfigVar<float> hudScale;
|
|
||||||
ConfigVar<bool> pauseOnFocusLost;
|
ConfigVar<bool> pauseOnFocusLost;
|
||||||
ConfigVar<bool> enableLinkDollRotation;
|
ConfigVar<bool> enableLinkDollRotation;
|
||||||
ConfigVar<bool> enableAchievementToasts;
|
ConfigVar<bool> enableAchievementToasts;
|
||||||
@@ -212,6 +187,7 @@ struct UserSettings {
|
|||||||
ConfigVar<bool> midnasLamentNonStop;
|
ConfigVar<bool> midnasLamentNonStop;
|
||||||
|
|
||||||
// Input
|
// Input
|
||||||
|
ConfigVar<GyroMode> gyroMode;
|
||||||
ConfigVar<bool> enableGyroAim;
|
ConfigVar<bool> enableGyroAim;
|
||||||
ConfigVar<bool> enableGyroRollgoal;
|
ConfigVar<bool> enableGyroRollgoal;
|
||||||
ConfigVar<float> gyroSensitivityX;
|
ConfigVar<float> gyroSensitivityX;
|
||||||
@@ -221,16 +197,7 @@ struct UserSettings {
|
|||||||
ConfigVar<float> gyroDeadband;
|
ConfigVar<float> gyroDeadband;
|
||||||
ConfigVar<bool> gyroInvertPitch;
|
ConfigVar<bool> gyroInvertPitch;
|
||||||
ConfigVar<bool> gyroInvertYaw;
|
ConfigVar<bool> gyroInvertYaw;
|
||||||
ConfigVar<bool> enableMouseCamera;
|
|
||||||
ConfigVar<bool> enableMouseAim;
|
|
||||||
ConfigVar<float> mouseAimSensitivity;
|
|
||||||
ConfigVar<float> mouseCameraSensitivity;
|
|
||||||
ConfigVar<bool> invertMouseY;
|
|
||||||
ConfigVar<bool> freeCamera;
|
ConfigVar<bool> freeCamera;
|
||||||
ConfigVar<bool> enableTouchControls;
|
|
||||||
ConfigVar<TouchTargeting> touchTargeting;
|
|
||||||
ConfigVar<bool> enableMenuPointer;
|
|
||||||
ConfigVar<ui::ControlLayout> touchControlsLayout;
|
|
||||||
ConfigVar<bool> invertCameraXAxis;
|
ConfigVar<bool> invertCameraXAxis;
|
||||||
ConfigVar<bool> invertCameraYAxis;
|
ConfigVar<bool> invertCameraYAxis;
|
||||||
ConfigVar<bool> invertFirstPersonXAxis;
|
ConfigVar<bool> invertFirstPersonXAxis;
|
||||||
@@ -239,8 +206,6 @@ struct UserSettings {
|
|||||||
ConfigVar<bool> invertAirSwimY;
|
ConfigVar<bool> invertAirSwimY;
|
||||||
ConfigVar<float> freeCameraXSensitivity;
|
ConfigVar<float> freeCameraXSensitivity;
|
||||||
ConfigVar<float> freeCameraYSensitivity;
|
ConfigVar<float> freeCameraYSensitivity;
|
||||||
ConfigVar<float> touchCameraXSensitivity;
|
|
||||||
ConfigVar<float> touchCameraYSensitivity;
|
|
||||||
ConfigVar<bool> debugFlyCam;
|
ConfigVar<bool> debugFlyCam;
|
||||||
ConfigVar<bool> debugFlyCamLockEvents;
|
ConfigVar<bool> debugFlyCamLockEvents;
|
||||||
ConfigVar<bool> allowBackgroundInput;
|
ConfigVar<bool> allowBackgroundInput;
|
||||||
@@ -263,8 +228,9 @@ struct UserSettings {
|
|||||||
ConfigVar<bool> canTransformAnywhere;
|
ConfigVar<bool> canTransformAnywhere;
|
||||||
ConfigVar<bool> fastRoll;
|
ConfigVar<bool> fastRoll;
|
||||||
ConfigVar<bool> fastSpinner;
|
ConfigVar<bool> fastSpinner;
|
||||||
ConfigVar<MagicArmorMode> armorRupeeDrain;
|
ConfigVar<bool> freeMagicArmor;
|
||||||
ConfigVar<bool> invincibleEnemies;
|
ConfigVar<bool> invincibleEnemies;
|
||||||
|
ConfigVar<bool> transformWithoutShadowCrystal;
|
||||||
|
|
||||||
// Technical
|
// Technical
|
||||||
ConfigVar<bool> restoreWiiGlitches;
|
ConfigVar<bool> restoreWiiGlitches;
|
||||||
@@ -286,8 +252,12 @@ struct UserSettings {
|
|||||||
struct {
|
struct {
|
||||||
ConfigVar<std::string> isoPath;
|
ConfigVar<std::string> isoPath;
|
||||||
ConfigVar<DiscVerificationState> isoVerification;
|
ConfigVar<DiscVerificationState> isoVerification;
|
||||||
|
#if DUSK_TPHD
|
||||||
|
ConfigVar<std::string> hdContentPath;
|
||||||
|
#endif
|
||||||
ConfigVar<std::string> graphicsBackend;
|
ConfigVar<std::string> graphicsBackend;
|
||||||
ConfigVar<bool> skipPreLaunchUI;
|
ConfigVar<bool> skipPreLaunchUI;
|
||||||
|
ConfigVar<bool> showPipelineCompilation;
|
||||||
ConfigVar<bool> wasPresetChosen;
|
ConfigVar<bool> wasPresetChosen;
|
||||||
ConfigVar<bool> checkForUpdates;
|
ConfigVar<bool> checkForUpdates;
|
||||||
ConfigVar<int> cardFileType;
|
ConfigVar<int> cardFileType;
|
||||||
@@ -298,8 +268,6 @@ struct UserSettings {
|
|||||||
struct {
|
struct {
|
||||||
std::array<ActionBindConfigVar, 4> firstPersonCamera;
|
std::array<ActionBindConfigVar, 4> firstPersonCamera;
|
||||||
std::array<ActionBindConfigVar, 4> callMidna;
|
std::array<ActionBindConfigVar, 4> callMidna;
|
||||||
std::array<ActionBindConfigVar, 4> openMapScreen;
|
|
||||||
std::array<ActionBindConfigVar, 4> toggleMinimap;
|
|
||||||
std::array<ActionBindConfigVar, 4> openDusklightMenu;
|
std::array<ActionBindConfigVar, 4> openDusklightMenu;
|
||||||
std::array<ActionBindConfigVar, 4> turboSpeedButton;
|
std::array<ActionBindConfigVar, 4> turboSpeedButton;
|
||||||
} actionBindings;
|
} actionBindings;
|
||||||
@@ -307,6 +275,8 @@ struct UserSettings {
|
|||||||
|
|
||||||
UserSettings& getSettings();
|
UserSettings& getSettings();
|
||||||
|
|
||||||
|
bool tphd_active();
|
||||||
|
|
||||||
void registerSettings();
|
void registerSettings();
|
||||||
|
|
||||||
// Transient settings
|
// Transient settings
|
||||||
@@ -331,4 +301,6 @@ struct TransientSettings {
|
|||||||
|
|
||||||
TransientSettings& getTransientSettings();
|
TransientSettings& getTransientSettings();
|
||||||
|
|
||||||
} // namespace dusk
|
}
|
||||||
|
|
||||||
|
#endif // DUSK_CONFIG_H
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
#ifndef DUSK_TEXTURE_REPLACEMENTS_HPP
|
|
||||||
#define DUSK_TEXTURE_REPLACEMENTS_HPP
|
|
||||||
|
|
||||||
namespace dusk::texture_replacements {
|
|
||||||
|
|
||||||
void reload();
|
|
||||||
void set_enabled(bool enabled);
|
|
||||||
void shutdown();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
namespace dusk::touch_camera {
|
|
||||||
|
|
||||||
constexpr float YAW_DEGREES_PER_DP = 0.34f;
|
|
||||||
constexpr float PITCH_DEGREES_PER_DP = 0.22f;
|
|
||||||
|
|
||||||
void add_delta(float yaw_dp, float pitch_dp) noexcept;
|
|
||||||
bool consume_delta(float& yaw_dp, float& pitch_dp) noexcept;
|
|
||||||
void clear() noexcept;
|
|
||||||
|
|
||||||
} // namespace dusk::touch_camera
|
|
||||||
@@ -44,7 +44,7 @@ struct mDoLib_clipper {
|
|||||||
|
|
||||||
void mDoLib_project(Vec* src, Vec* dst);
|
void mDoLib_project(Vec* src, Vec* dst);
|
||||||
u32 mDoLib_setResTimgObj(ResTIMG const* res, TGXTexObj* o_texObj, u32 tlut_name,
|
u32 mDoLib_setResTimgObj(ResTIMG const* res, TGXTexObj* o_texObj, u32 tlut_name,
|
||||||
TGXTlutObj* o_tlutObj);
|
GXTlutObj* o_tlutObj);
|
||||||
void mDoLib_pos2camera(Vec* src, Vec* dst);
|
void mDoLib_pos2camera(Vec* src, Vec* dst);
|
||||||
|
|
||||||
#if PLATFORM_WII
|
#if PLATFORM_WII
|
||||||
|
|||||||
+16
-41
@@ -952,70 +952,45 @@ if(DEFINED APPLE_TARGET_TRIPLE)
|
|||||||
set(APPLE_TARGET_TRIPLE_FLAG "-target ${APPLE_TARGET_TRIPLE}")
|
set(APPLE_TARGET_TRIPLE_FLAG "-target ${APPLE_TARGET_TRIPLE}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
function(ios_toolchain_set_cached_flags variable description)
|
|
||||||
set(clean_flags "${${variable}}")
|
|
||||||
foreach(toolchain_flag IN LISTS ARGN)
|
|
||||||
if(NOT "${toolchain_flag}" STREQUAL "")
|
|
||||||
string(REPLACE "${toolchain_flag}" "" clean_flags "${clean_flags}")
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
string(REGEX REPLACE "[ \t]+" " " clean_flags "${clean_flags}")
|
|
||||||
string(STRIP "${clean_flags}" clean_flags)
|
|
||||||
|
|
||||||
set(final_flags "")
|
|
||||||
foreach(toolchain_flag IN LISTS ARGN)
|
|
||||||
if(NOT "${toolchain_flag}" STREQUAL "")
|
|
||||||
string(APPEND final_flags " ${toolchain_flag}")
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
if(NOT "${clean_flags}" STREQUAL "")
|
|
||||||
string(APPEND final_flags " ${clean_flags}")
|
|
||||||
endif()
|
|
||||||
string(REGEX REPLACE "[ \t]+" " " final_flags "${final_flags}")
|
|
||||||
string(STRIP "${final_flags}" final_flags)
|
|
||||||
|
|
||||||
set(${variable} "${final_flags}" CACHE INTERNAL "${description}")
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
#Check if Xcode generator is used since that will handle these flags automagically
|
#Check if Xcode generator is used since that will handle these flags automagically
|
||||||
if(CMAKE_GENERATOR MATCHES "Xcode")
|
if(CMAKE_GENERATOR MATCHES "Xcode")
|
||||||
message(STATUS "Not setting any manual command-line buildflags, since Xcode is selected as the generator. Modifying the Xcode build-settings directly instead.")
|
message(STATUS "Not setting any manual command-line buildflags, since Xcode is selected as the generator. Modifying the Xcode build-settings directly instead.")
|
||||||
else()
|
else()
|
||||||
ios_toolchain_set_cached_flags(CMAKE_C_FLAGS "Flags used by the compiler during all C build types."
|
set(CMAKE_C_FLAGS "${C_TARGET_FLAGS} ${APPLE_TARGET_TRIPLE_FLAG} ${SDK_NAME_VERSION_FLAGS} ${OBJC_LEGACY_VARS} ${BITCODE} ${VISIBILITY} ${CMAKE_C_FLAGS}" CACHE INTERNAL
|
||||||
"${C_TARGET_FLAGS}" "${APPLE_TARGET_TRIPLE_FLAG}" "${SDK_NAME_VERSION_FLAGS}" "${OBJC_LEGACY_VARS}" "${BITCODE}" "${VISIBILITY}")
|
"Flags used by the compiler during all C build types.")
|
||||||
set(CMAKE_C_FLAGS_DEBUG "-O0 -g ${CMAKE_C_FLAGS_DEBUG}")
|
set(CMAKE_C_FLAGS_DEBUG "-O0 -g ${CMAKE_C_FLAGS_DEBUG}")
|
||||||
set(CMAKE_C_FLAGS_MINSIZEREL "-DNDEBUG -Os ${CMAKE_C_FLAGS_MINSIZEREL}")
|
set(CMAKE_C_FLAGS_MINSIZEREL "-DNDEBUG -Os ${CMAKE_C_FLAGS_MINSIZEREL}")
|
||||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-DNDEBUG -O2 -g ${CMAKE_C_FLAGS_RELWITHDEBINFO}")
|
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-DNDEBUG -O2 -g ${CMAKE_C_FLAGS_RELWITHDEBINFO}")
|
||||||
set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -O3 ${CMAKE_C_FLAGS_RELEASE}")
|
set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -O3 ${CMAKE_C_FLAGS_RELEASE}")
|
||||||
ios_toolchain_set_cached_flags(CMAKE_CXX_FLAGS "Flags used by the compiler during all CXX build types."
|
set(CMAKE_CXX_FLAGS "${C_TARGET_FLAGS} ${APPLE_TARGET_TRIPLE_FLAG} ${SDK_NAME_VERSION_FLAGS} ${OBJC_LEGACY_VARS} ${BITCODE} ${VISIBILITY} ${CMAKE_CXX_FLAGS}" CACHE INTERNAL
|
||||||
"${C_TARGET_FLAGS}" "${APPLE_TARGET_TRIPLE_FLAG}" "${SDK_NAME_VERSION_FLAGS}" "${OBJC_LEGACY_VARS}" "${BITCODE}" "${VISIBILITY}")
|
"Flags used by the compiler during all CXX build types.")
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g ${CMAKE_CXX_FLAGS_DEBUG}")
|
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g ${CMAKE_CXX_FLAGS_DEBUG}")
|
||||||
set(CMAKE_CXX_FLAGS_MINSIZEREL "-DNDEBUG -Os ${CMAKE_CXX_FLAGS_MINSIZEREL}")
|
set(CMAKE_CXX_FLAGS_MINSIZEREL "-DNDEBUG -Os ${CMAKE_CXX_FLAGS_MINSIZEREL}")
|
||||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-DNDEBUG -O2 -g ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-DNDEBUG -O2 -g ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O3 ${CMAKE_CXX_FLAGS_RELEASE}")
|
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O3 ${CMAKE_CXX_FLAGS_RELEASE}")
|
||||||
if(NAMED_LANGUAGE_SUPPORT_INT)
|
if(NAMED_LANGUAGE_SUPPORT_INT)
|
||||||
ios_toolchain_set_cached_flags(CMAKE_OBJC_FLAGS "Flags used by the compiler during all OBJC build types."
|
set(CMAKE_OBJC_FLAGS "${C_TARGET_FLAGS} ${APPLE_TARGET_TRIPLE_FLAG} ${SDK_NAME_VERSION_FLAGS} ${BITCODE} ${VISIBILITY} ${FOBJC_ARC} ${OBJC_VARS} ${CMAKE_OBJC_FLAGS}" CACHE INTERNAL
|
||||||
"${C_TARGET_FLAGS}" "${APPLE_TARGET_TRIPLE_FLAG}" "${SDK_NAME_VERSION_FLAGS}" "${BITCODE}" "${VISIBILITY}" "${FOBJC_ARC}" "${OBJC_VARS}")
|
"Flags used by the compiler during all OBJC build types.")
|
||||||
set(CMAKE_OBJC_FLAGS_DEBUG "-O0 -g ${CMAKE_OBJC_FLAGS_DEBUG}")
|
set(CMAKE_OBJC_FLAGS_DEBUG "-O0 -g ${CMAKE_OBJC_FLAGS_DEBUG}")
|
||||||
set(CMAKE_OBJC_FLAGS_MINSIZEREL "-DNDEBUG -Os ${CMAKE_OBJC_FLAGS_MINSIZEREL}")
|
set(CMAKE_OBJC_FLAGS_MINSIZEREL "-DNDEBUG -Os ${CMAKE_OBJC_FLAGS_MINSIZEREL}")
|
||||||
set(CMAKE_OBJC_FLAGS_RELWITHDEBINFO "-DNDEBUG -O2 -g ${CMAKE_OBJC_FLAGS_RELWITHDEBINFO}")
|
set(CMAKE_OBJC_FLAGS_RELWITHDEBINFO "-DNDEBUG -O2 -g ${CMAKE_OBJC_FLAGS_RELWITHDEBINFO}")
|
||||||
set(CMAKE_OBJC_FLAGS_RELEASE "-DNDEBUG -O3 ${CMAKE_OBJC_FLAGS_RELEASE}")
|
set(CMAKE_OBJC_FLAGS_RELEASE "-DNDEBUG -O3 ${CMAKE_OBJC_FLAGS_RELEASE}")
|
||||||
ios_toolchain_set_cached_flags(CMAKE_OBJCXX_FLAGS "Flags used by the compiler during all OBJCXX build types."
|
set(CMAKE_OBJCXX_FLAGS "${C_TARGET_FLAGS} ${APPLE_TARGET_TRIPLE_FLAG} ${SDK_NAME_VERSION_FLAGS} ${BITCODE} ${VISIBILITY} ${FOBJC_ARC} ${OBJC_VARS} ${CMAKE_OBJCXX_FLAGS}" CACHE INTERNAL
|
||||||
"${C_TARGET_FLAGS}" "${APPLE_TARGET_TRIPLE_FLAG}" "${SDK_NAME_VERSION_FLAGS}" "${BITCODE}" "${VISIBILITY}" "${FOBJC_ARC}" "${OBJC_VARS}")
|
"Flags used by the compiler during all OBJCXX build types.")
|
||||||
set(CMAKE_OBJCXX_FLAGS_DEBUG "-O0 -g ${CMAKE_OBJCXX_FLAGS_DEBUG}")
|
set(CMAKE_OBJCXX_FLAGS_DEBUG "-O0 -g ${CMAKE_OBJCXX_FLAGS_DEBUG}")
|
||||||
set(CMAKE_OBJCXX_FLAGS_MINSIZEREL "-DNDEBUG -Os ${CMAKE_OBJCXX_FLAGS_MINSIZEREL}")
|
set(CMAKE_OBJCXX_FLAGS_MINSIZEREL "-DNDEBUG -Os ${CMAKE_OBJCXX_FLAGS_MINSIZEREL}")
|
||||||
set(CMAKE_OBJCXX_FLAGS_RELWITHDEBINFO "-DNDEBUG -O2 -g ${CMAKE_OBJCXX_FLAGS_RELWITHDEBINFO}")
|
set(CMAKE_OBJCXX_FLAGS_RELWITHDEBINFO "-DNDEBUG -O2 -g ${CMAKE_OBJCXX_FLAGS_RELWITHDEBINFO}")
|
||||||
set(CMAKE_OBJCXX_FLAGS_RELEASE "-DNDEBUG -O3 ${CMAKE_OBJCXX_FLAGS_RELEASE}")
|
set(CMAKE_OBJCXX_FLAGS_RELEASE "-DNDEBUG -O3 ${CMAKE_OBJCXX_FLAGS_RELEASE}")
|
||||||
endif()
|
endif()
|
||||||
ios_toolchain_set_cached_flags(CMAKE_C_LINK_FLAGS "Flags used by the compiler for all C link types."
|
set(CMAKE_C_LINK_FLAGS "${C_TARGET_FLAGS} ${SDK_NAME_VERSION_FLAGS} -Wl,-search_paths_first ${CMAKE_C_LINK_FLAGS}" CACHE INTERNAL
|
||||||
"${C_TARGET_FLAGS}" "${SDK_NAME_VERSION_FLAGS}" "-Wl,-search_paths_first")
|
"Flags used by the compiler for all C link types.")
|
||||||
ios_toolchain_set_cached_flags(CMAKE_CXX_LINK_FLAGS "Flags used by the compiler for all CXX link types."
|
set(CMAKE_CXX_LINK_FLAGS "${C_TARGET_FLAGS} ${SDK_NAME_VERSION_FLAGS} -Wl,-search_paths_first ${CMAKE_CXX_LINK_FLAGS}" CACHE INTERNAL
|
||||||
"${C_TARGET_FLAGS}" "${SDK_NAME_VERSION_FLAGS}" "-Wl,-search_paths_first")
|
"Flags used by the compiler for all CXX link types.")
|
||||||
if(NAMED_LANGUAGE_SUPPORT_INT)
|
if(NAMED_LANGUAGE_SUPPORT_INT)
|
||||||
ios_toolchain_set_cached_flags(CMAKE_OBJC_LINK_FLAGS "Flags used by the compiler for all OBJC link types."
|
set(CMAKE_OBJC_LINK_FLAGS "${C_TARGET_FLAGS} ${SDK_NAME_VERSION_FLAGS} -Wl,-search_paths_first ${CMAKE_OBJC_LINK_FLAGS}" CACHE INTERNAL
|
||||||
"${C_TARGET_FLAGS}" "${SDK_NAME_VERSION_FLAGS}" "-Wl,-search_paths_first")
|
"Flags used by the compiler for all OBJC link types.")
|
||||||
ios_toolchain_set_cached_flags(CMAKE_OBJCXX_LINK_FLAGS "Flags used by the compiler for all OBJCXX link types."
|
set(CMAKE_OBJCXX_LINK_FLAGS "${C_TARGET_FLAGS} ${SDK_NAME_VERSION_FLAGS} -Wl,-search_paths_first ${CMAKE_OBJCXX_LINK_FLAGS}" CACHE INTERNAL
|
||||||
"${C_TARGET_FLAGS}" "${SDK_NAME_VERSION_FLAGS}" "-Wl,-search_paths_first")
|
"Flags used by the compiler for all OBJCXX link types.")
|
||||||
endif()
|
endif()
|
||||||
set(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS} -x assembler-with-cpp" CACHE INTERNAL
|
set(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS} -x assembler-with-cpp" CACHE INTERNAL
|
||||||
"Flags used by the compiler for all ASM build types.")
|
"Flags used by the compiler for all ASM build types.")
|
||||||
|
|||||||
@@ -212,9 +212,6 @@ public:
|
|||||||
void setCornerColor(JUtility::TColor c0) {
|
void setCornerColor(JUtility::TColor c0) {
|
||||||
setCornerColor(c0, c0, c0, c0);
|
setCornerColor(c0, c0, c0, c0);
|
||||||
}
|
}
|
||||||
#if TARGET_PC
|
|
||||||
JUtility::TColor corner(size_t index) const { return mCornerColor[index]; }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/* 0x100 */ JUTTexture* mTexture[2];
|
/* 0x100 */ JUTTexture* mTexture[2];
|
||||||
|
|||||||
@@ -1761,6 +1761,16 @@ public:
|
|||||||
virtual ~J3DIndBlockNull() {}
|
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
|
* @ingroup jsystem-j3d
|
||||||
*
|
*
|
||||||
@@ -1793,6 +1803,10 @@ public:
|
|||||||
virtual void setDither(u8 const*) {}
|
virtual void setDither(u8 const*) {}
|
||||||
virtual void setDither(u8) {}
|
virtual void setDither(u8) {}
|
||||||
virtual u8 getDither() const { return 0; }
|
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 u32 getFogOffset() const { return 0; }
|
||||||
virtual void setFogOffset(u32) {}
|
virtual void setFogOffset(u32) {}
|
||||||
virtual ~J3DPEBlock() {}
|
virtual ~J3DPEBlock() {}
|
||||||
@@ -1956,12 +1970,25 @@ public:
|
|||||||
virtual void setFogOffset(u32 fogOffset) { mFogOffset = fogOffset; }
|
virtual void setFogOffset(u32 fogOffset) { mFogOffset = fogOffset; }
|
||||||
virtual ~J3DPEBlockFull() {}
|
virtual ~J3DPEBlockFull() {}
|
||||||
|
|
||||||
|
#ifdef DUSK_TPHD
|
||||||
|
virtual void setPolygonOffset(const PolygonOffset& offset) {
|
||||||
|
mPolygonOffset = offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual PolygonOffset* getPolygonOffset() {
|
||||||
|
return &mPolygonOffset;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* 0x04 */ J3DFog mFog;
|
/* 0x04 */ J3DFog mFog;
|
||||||
/* 0x30 */ J3DAlphaComp mAlphaComp;
|
/* 0x30 */ J3DAlphaComp mAlphaComp;
|
||||||
/* 0x34 */ J3DBlend mBlend;
|
/* 0x34 */ J3DBlend mBlend;
|
||||||
/* 0x38 */ J3DZMode mZMode;
|
/* 0x38 */ J3DZMode mZMode;
|
||||||
/* 0x3A */ u8 mZCompLoc;
|
/* 0x3A */ u8 mZCompLoc;
|
||||||
/* 0x3B */ u8 mDither;
|
/* 0x3B */ u8 mDither;
|
||||||
|
#ifdef DUSK_TPHD
|
||||||
|
PolygonOffset mPolygonOffset;
|
||||||
|
#endif
|
||||||
/* 0x3C */ u32 mFogOffset;
|
/* 0x3C */ u32 mFogOffset;
|
||||||
}; // Size: 0x40
|
}; // Size: 0x40
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#ifndef J3DSHAPEDRAW_H
|
#ifndef J3DSHAPEDRAW_H
|
||||||
#define J3DSHAPEDRAW_H
|
#define J3DSHAPEDRAW_H
|
||||||
|
|
||||||
#include <gx.h>
|
|
||||||
#include <types.h>
|
#include <types.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -13,9 +12,6 @@ public:
|
|||||||
u32 countVertex(u32);
|
u32 countVertex(u32);
|
||||||
void addTexMtxIndexInDL(u32, u32, u32);
|
void addTexMtxIndexInDL(u32, u32, u32);
|
||||||
J3DShapeDraw(u8 const*, u32);
|
J3DShapeDraw(u8 const*, u32);
|
||||||
#if TARGET_PC
|
|
||||||
J3DShapeDraw(u8 const*, u32, const GXVtxDescList*);
|
|
||||||
#endif
|
|
||||||
void draw() const;
|
void draw() const;
|
||||||
|
|
||||||
virtual ~J3DShapeDraw();
|
virtual ~J3DShapeDraw();
|
||||||
|
|||||||
@@ -46,6 +46,13 @@ struct J3DMaterialInitData {
|
|||||||
/* 0x14A */ BE(u16) mNBTScaleIdx;
|
/* 0x14A */ BE(u16) mNBTScaleIdx;
|
||||||
}; // size 0x14C
|
}; // size 0x14C
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DUSK_TPHD
|
||||||
|
struct J3DMaterialInitData_MAT4 : public J3DMaterialInitData {
|
||||||
|
/* 0x14C */ BE(u16) mPolygonOffsetIdx;
|
||||||
|
}; // size 0x14E
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ingroup jsystem-j3d
|
* @ingroup jsystem-j3d
|
||||||
*
|
*
|
||||||
@@ -143,10 +150,29 @@ public:
|
|||||||
J3DNBTScale newNBTScale(int) const;
|
J3DNBTScale newNBTScale(int) const;
|
||||||
|
|
||||||
u16 getMaterialID(int idx) const { return mpMaterialID[idx]; }
|
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; }
|
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;
|
/* 0x00 */ u16 mMaterialNum;
|
||||||
|
#if DUSK_TPHD
|
||||||
|
/* 0x04 */ void* mpMaterialInitData;
|
||||||
|
#else
|
||||||
/* 0x04 */ J3DMaterialInitData* mpMaterialInitData;
|
/* 0x04 */ J3DMaterialInitData* mpMaterialInitData;
|
||||||
|
#endif
|
||||||
/* 0x08 */ BE(u16)* mpMaterialID;
|
/* 0x08 */ BE(u16)* mpMaterialID;
|
||||||
/* 0x0C */ J3DIndInitData* mpIndInitData;
|
/* 0x0C */ J3DIndInitData* mpIndInitData;
|
||||||
/* 0x10 */ GXColor* mpMatColor;
|
/* 0x10 */ GXColor* mpMatColor;
|
||||||
@@ -175,6 +201,9 @@ public:
|
|||||||
/* 0x6C */ u8* mpZCompLoc;
|
/* 0x6C */ u8* mpZCompLoc;
|
||||||
/* 0x70 */ u8* mpDither;
|
/* 0x70 */ u8* mpDither;
|
||||||
/* 0x74 */ J3DNBTScaleInfo* mpNBTScaleInfo;
|
/* 0x74 */ J3DNBTScaleInfo* mpNBTScaleInfo;
|
||||||
|
#ifdef DUSK_TPHD
|
||||||
|
PolygonOffset* mpPolygonOffsets;
|
||||||
|
#endif
|
||||||
/* 0x78 */ J3DDisplayListInit* mpDisplayListInit;
|
/* 0x78 */ J3DDisplayListInit* mpDisplayListInit;
|
||||||
/* 0x7C */ J3DPatchingInfo* mpPatchingInfo;
|
/* 0x7C */ J3DPatchingInfo* mpPatchingInfo;
|
||||||
/* 0x80 */ J3DCurrentMtxInfo* mpCurrentMtxInfo;
|
/* 0x80 */ J3DCurrentMtxInfo* mpCurrentMtxInfo;
|
||||||
|
|||||||
@@ -169,6 +169,12 @@ struct J3DMaterialBlock_v21 : public J3DModelBlock {
|
|||||||
/* 0x74 */ OFFSET_PTR_V0 mpNBTScaleInfo;
|
/* 0x74 */ OFFSET_PTR_V0 mpNBTScaleInfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef DUSK_TPHD
|
||||||
|
struct J3DMaterialBlock_MAT4 : public J3DMaterialBlock {
|
||||||
|
/* 0x84 */ OFFSET_PTR_V0 mpPolygonOffsets;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ingroup jsystem-j3d
|
* @ingroup jsystem-j3d
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -3,20 +3,6 @@
|
|||||||
|
|
||||||
#include <gx.h>
|
#include <gx.h>
|
||||||
|
|
||||||
#if TARGET_PC
|
|
||||||
#include <mtx.h>
|
|
||||||
|
|
||||||
struct ParticleDrawCtx {
|
|
||||||
bool batch; // off = immediate mode
|
|
||||||
bool useTexMtx; // UVs transformed by texMtx
|
|
||||||
bool useClr0; // prm color in GX_VA_CLR0
|
|
||||||
bool useClr1; // env color in GX_VA_CLR1
|
|
||||||
Mtx texMtx;
|
|
||||||
GXColor clr0;
|
|
||||||
GXColor clr1;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct JPAEmitterWorkData;
|
struct JPAEmitterWorkData;
|
||||||
class JPABaseParticle;
|
class JPABaseParticle;
|
||||||
class JKRHeap;
|
class JKRHeap;
|
||||||
@@ -89,9 +75,6 @@ public:
|
|||||||
|
|
||||||
const GXTevColorArg* getTevColorArg() const { return st_ca[(pBsd->mFlags >> 0x0F) & 0x07]; }
|
const GXTevColorArg* getTevColorArg() const { return st_ca[(pBsd->mFlags >> 0x0F) & 0x07]; }
|
||||||
const GXTevAlphaArg* getTevAlphaArg() const { return st_aa[(pBsd->mFlags >> 0x12) & 0x01]; }
|
const GXTevAlphaArg* getTevAlphaArg() const { return st_aa[(pBsd->mFlags >> 0x12) & 0x01]; }
|
||||||
#if TARGET_PC
|
|
||||||
u32 getTevColorArgSel() const { return (pBsd->mFlags >> 0x0F) & 0x07; }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
u32 getType() const { return (pBsd->mFlags >> 0) & 0x0F; }
|
u32 getType() const { return (pBsd->mFlags >> 0) & 0x0F; }
|
||||||
u32 getDirType() const { return (pBsd->mFlags >> 4) & 0x07; }
|
u32 getDirType() const { return (pBsd->mFlags >> 4) & 0x07; }
|
||||||
@@ -203,34 +186,26 @@ void JPARegistPrm(JPAEmitterWorkData*);
|
|||||||
void JPARegistEnv(JPAEmitterWorkData*);
|
void JPARegistEnv(JPAEmitterWorkData*);
|
||||||
void JPARegistPrmEnv(JPAEmitterWorkData*);
|
void JPARegistPrmEnv(JPAEmitterWorkData*);
|
||||||
|
|
||||||
#if TARGET_PC
|
void JPADrawPoint(JPAEmitterWorkData*, JPABaseParticle*);
|
||||||
#define JPA_DRAW_PARTICLE_ARGS JPAEmitterWorkData*, JPABaseParticle*, ParticleDrawCtx*
|
void JPADrawLine(JPAEmitterWorkData*, JPABaseParticle*);
|
||||||
#else
|
void JPADrawRotBillboard(JPAEmitterWorkData*, JPABaseParticle*);
|
||||||
#define JPA_DRAW_PARTICLE_ARGS JPAEmitterWorkData*, JPABaseParticle*
|
void JPADrawBillboard(JPAEmitterWorkData*, JPABaseParticle*);
|
||||||
#endif
|
void JPADrawRotDirection(JPAEmitterWorkData*, JPABaseParticle*);
|
||||||
|
void JPADrawDirection(JPAEmitterWorkData*, JPABaseParticle*);
|
||||||
void JPADrawPoint(JPA_DRAW_PARTICLE_ARGS);
|
void JPADrawRotation(JPAEmitterWorkData*, JPABaseParticle*);
|
||||||
void JPADrawLine(JPA_DRAW_PARTICLE_ARGS);
|
void JPADrawDBillboard(JPAEmitterWorkData*, JPABaseParticle*);
|
||||||
void JPADrawRotBillboard(JPA_DRAW_PARTICLE_ARGS);
|
void JPADrawRotYBillboard(JPAEmitterWorkData*, JPABaseParticle*);
|
||||||
void JPADrawBillboard(JPA_DRAW_PARTICLE_ARGS);
|
void JPADrawYBillboard(JPAEmitterWorkData*, JPABaseParticle*);
|
||||||
void JPADrawRotDirection(JPA_DRAW_PARTICLE_ARGS);
|
void JPADrawParticleCallBack(JPAEmitterWorkData*, JPABaseParticle*);
|
||||||
void JPADrawDirection(JPA_DRAW_PARTICLE_ARGS);
|
void JPALoadTexAnm(JPAEmitterWorkData*, JPABaseParticle*);
|
||||||
void JPADrawRotation(JPA_DRAW_PARTICLE_ARGS);
|
void JPASetPointSize(JPAEmitterWorkData*, JPABaseParticle*);
|
||||||
void JPADrawDBillboard(JPA_DRAW_PARTICLE_ARGS);
|
void JPASetLineWidth(JPAEmitterWorkData*, JPABaseParticle*);
|
||||||
void JPADrawRotYBillboard(JPA_DRAW_PARTICLE_ARGS);
|
void JPALoadCalcTexCrdMtxAnm(JPAEmitterWorkData*, JPABaseParticle*);
|
||||||
void JPADrawYBillboard(JPA_DRAW_PARTICLE_ARGS);
|
void JPARegistAlpha(JPAEmitterWorkData*, JPABaseParticle*);
|
||||||
void JPADrawParticleCallBack(JPA_DRAW_PARTICLE_ARGS);
|
void JPARegistEnv(JPAEmitterWorkData*, JPABaseParticle*);
|
||||||
void JPALoadTexAnm(JPA_DRAW_PARTICLE_ARGS);
|
void JPARegistAlphaEnv(JPAEmitterWorkData*, JPABaseParticle*);
|
||||||
void JPASetPointSize(JPA_DRAW_PARTICLE_ARGS);
|
void JPARegistPrmAlpha(JPAEmitterWorkData*, JPABaseParticle*);
|
||||||
void JPASetLineWidth(JPA_DRAW_PARTICLE_ARGS);
|
void JPARegistPrmAlphaEnv(JPAEmitterWorkData*, JPABaseParticle*);
|
||||||
void JPALoadCalcTexCrdMtxAnm(JPA_DRAW_PARTICLE_ARGS);
|
|
||||||
void JPARegistAlpha(JPA_DRAW_PARTICLE_ARGS);
|
|
||||||
void JPARegistEnv(JPA_DRAW_PARTICLE_ARGS);
|
|
||||||
void JPARegistAlphaEnv(JPA_DRAW_PARTICLE_ARGS);
|
|
||||||
void JPARegistPrmAlpha(JPA_DRAW_PARTICLE_ARGS);
|
|
||||||
void JPARegistPrmAlphaEnv(JPA_DRAW_PARTICLE_ARGS);
|
|
||||||
|
|
||||||
#undef JPA_DRAW_PARTICLE_ARGS
|
|
||||||
|
|
||||||
#if TARGET_PC
|
#if TARGET_PC
|
||||||
void JPAInterpBillboard(JPAEmitterWorkData*, JPABaseParticle*);
|
void JPAInterpBillboard(JPAEmitterWorkData*, JPABaseParticle*);
|
||||||
|
|||||||
@@ -17,10 +17,6 @@ class JPADynamicsBlock;
|
|||||||
class JPAFieldBlock;
|
class JPAFieldBlock;
|
||||||
class JPAKeyBlock;
|
class JPAKeyBlock;
|
||||||
|
|
||||||
#if TARGET_PC
|
|
||||||
struct ParticleDrawCtx;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ingroup jsystem-jparticle
|
* @ingroup jsystem-jparticle
|
||||||
*
|
*
|
||||||
@@ -54,19 +50,13 @@ public:
|
|||||||
public:
|
public:
|
||||||
typedef void (*EmitterFunc)(JPAEmitterWorkData*);
|
typedef void (*EmitterFunc)(JPAEmitterWorkData*);
|
||||||
typedef void (*ParticleFunc)(JPAEmitterWorkData*, JPABaseParticle*);
|
typedef void (*ParticleFunc)(JPAEmitterWorkData*, JPABaseParticle*);
|
||||||
#if TARGET_PC
|
|
||||||
typedef void (*DrawParticleFunc)(JPAEmitterWorkData*, JPABaseParticle*,
|
|
||||||
ParticleDrawCtx*);
|
|
||||||
#else
|
|
||||||
typedef ParticleFunc DrawParticleFunc;
|
|
||||||
#endif
|
|
||||||
/* 0x00 */ EmitterFunc* mpCalcEmitterFuncList;
|
/* 0x00 */ EmitterFunc* mpCalcEmitterFuncList;
|
||||||
/* 0x04 */ EmitterFunc* mpDrawEmitterFuncList;
|
/* 0x04 */ EmitterFunc* mpDrawEmitterFuncList;
|
||||||
/* 0x08 */ EmitterFunc* mpDrawEmitterChildFuncList;
|
/* 0x08 */ EmitterFunc* mpDrawEmitterChildFuncList;
|
||||||
/* 0x0C */ ParticleFunc* mpCalcParticleFuncList;
|
/* 0x0C */ ParticleFunc* mpCalcParticleFuncList;
|
||||||
/* 0x10 */ DrawParticleFunc* mpDrawParticleFuncList;
|
/* 0x10 */ ParticleFunc* mpDrawParticleFuncList;
|
||||||
/* 0x14 */ ParticleFunc* mpCalcParticleChildFuncList;
|
/* 0x14 */ ParticleFunc* mpCalcParticleChildFuncList;
|
||||||
/* 0x18 */ DrawParticleFunc* mpDrawParticleChildFuncList;
|
/* 0x18 */ ParticleFunc* mpDrawParticleChildFuncList;
|
||||||
|
|
||||||
/* 0x1C */ JPABaseShape* pBsp;
|
/* 0x1C */ JPABaseShape* pBsp;
|
||||||
/* 0x20 */ JPAExtraShape* pEsp;
|
/* 0x20 */ JPAExtraShape* pEsp;
|
||||||
@@ -87,20 +77,6 @@ public:
|
|||||||
/* 0x45 */ u8 mpDrawParticleFuncListNum;
|
/* 0x45 */ u8 mpDrawParticleFuncListNum;
|
||||||
/* 0x46 */ u8 mpCalcParticleChildFuncListNum;
|
/* 0x46 */ u8 mpCalcParticleChildFuncListNum;
|
||||||
/* 0x47 */ u8 mpDrawParticleChildFuncListNum;
|
/* 0x47 */ u8 mpDrawParticleChildFuncListNum;
|
||||||
|
|
||||||
#if TARGET_PC
|
|
||||||
struct BatchInfo {
|
|
||||||
f32 vtxPos[8][3];
|
|
||||||
f32 vtxUv[8][2];
|
|
||||||
u8 vtxCount; // 4 (quad) or 8 (cross)
|
|
||||||
bool supported; // draw func list contains only batchable funcs
|
|
||||||
bool hasPtclColor; // per-particle JPARegist* func is present
|
|
||||||
bool hasPtclTexMtx; // JPALoadCalcTexCrdMtxAnm is present
|
|
||||||
};
|
|
||||||
BatchInfo mBatchInfo;
|
|
||||||
|
|
||||||
void initBatchInfo();
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* JPARESOURCE_H */
|
#endif /* JPARESOURCE_H */
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
#include "JSystem/J2DGraph/J2DGrafContext.h"
|
#include "JSystem/J2DGraph/J2DGrafContext.h"
|
||||||
#include <gx.h>
|
#include <gx.h>
|
||||||
|
|
||||||
#include <tracy/Tracy.hpp>
|
|
||||||
|
|
||||||
J2DGrafContext::J2DGrafContext(f32 x, f32 y, f32 width, f32 height)
|
J2DGrafContext::J2DGrafContext(f32 x, f32 y, f32 width, f32 height)
|
||||||
: mBounds(x, y, x + width, y + height), mScissorBounds(x, y, x + width, y + height) {
|
: mBounds(x, y, x + width, y + height), mScissorBounds(x, y, x + width, y + height) {
|
||||||
if (x < 0.0f || y < 0.0f) {
|
if (x < 0.0f || y < 0.0f) {
|
||||||
@@ -139,7 +137,6 @@ void J2DGrafContext::setLineWidth(u8 lineWidth) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void J2DGrafContext::fillBox(JGeometry::TBox2<f32> const& box) {
|
void J2DGrafContext::fillBox(JGeometry::TBox2<f32> const& box) {
|
||||||
ZoneScoped;
|
|
||||||
GXSetBlendMode((GXBlendMode)mBoxPart.mType, (GXBlendFactor)mBoxPart.mSrcFactor,
|
GXSetBlendMode((GXBlendMode)mBoxPart.mType, (GXBlendFactor)mBoxPart.mSrcFactor,
|
||||||
(GXBlendFactor)mBoxPart.mDstFactor, GX_LO_SET);
|
(GXBlendFactor)mBoxPart.mDstFactor, GX_LO_SET);
|
||||||
GXLoadPosMtxImm(mPosMtx, 0);
|
GXLoadPosMtxImm(mPosMtx, 0);
|
||||||
@@ -158,7 +155,6 @@ void J2DGrafContext::fillBox(JGeometry::TBox2<f32> const& box) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void J2DGrafContext::drawFrame(JGeometry::TBox2<f32> const& box) {
|
void J2DGrafContext::drawFrame(JGeometry::TBox2<f32> const& box) {
|
||||||
ZoneScoped;
|
|
||||||
GXSetBlendMode((GXBlendMode)mBoxPart.mType, (GXBlendFactor)mBoxPart.mSrcFactor,
|
GXSetBlendMode((GXBlendMode)mBoxPart.mType, (GXBlendFactor)mBoxPart.mSrcFactor,
|
||||||
(GXBlendFactor)mBoxPart.mDstFactor, GX_LO_SET);
|
(GXBlendFactor)mBoxPart.mDstFactor, GX_LO_SET);
|
||||||
GXLoadPosMtxImm(mPosMtx, 0);
|
GXLoadPosMtxImm(mPosMtx, 0);
|
||||||
@@ -179,7 +175,6 @@ void J2DGrafContext::drawFrame(JGeometry::TBox2<f32> const& box) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void J2DGrafContext::line(JGeometry::TVec2<f32> start, JGeometry::TVec2<f32> end) {
|
void J2DGrafContext::line(JGeometry::TVec2<f32> start, JGeometry::TVec2<f32> end) {
|
||||||
ZoneScoped;
|
|
||||||
GXSetBlendMode((GXBlendMode)mLinePart.mType, (GXBlendFactor)mLinePart.mSrcFactor,
|
GXSetBlendMode((GXBlendMode)mLinePart.mType, (GXBlendFactor)mLinePart.mSrcFactor,
|
||||||
(GXBlendFactor)mLinePart.mDstFactor, GX_LO_SET);
|
(GXBlendFactor)mLinePart.mDstFactor, GX_LO_SET);
|
||||||
GXLoadPosMtxImm(mPosMtx, 0);
|
GXLoadPosMtxImm(mPosMtx, 0);
|
||||||
|
|||||||
@@ -542,11 +542,8 @@ void J3DModel::viewCalc() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TARGET_PC
|
#ifdef TARGET_PC
|
||||||
Mtx* drawMtx = getDrawMtxPtr();
|
for (u16 i = 0; i < mModelData->getDrawMtxNum(); ++i) {
|
||||||
if (drawMtx != J3DMtxBuffer::sNoUseDrawMtxPtr) {
|
dusk::frame_interp::record_final_mtx(getDrawMtxPtr()[i]);
|
||||||
for (u16 i = 0; i < mModelData->getDrawMtxNum(); ++i) {
|
|
||||||
dusk::frame_interp::record_final_mtx(drawMtx[i]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -222,6 +222,9 @@ void J3DMatPacket::draw() {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
PolygonOffset* temp = mpMaterial->getPEBlock()->getPolygonOffset();
|
||||||
|
GX2SetPolygonOffset(temp->mFrontOffset, temp->mFrontScale, temp->mBackOffset, temp->mBackScale, temp->mClamp);
|
||||||
|
|
||||||
callDL();
|
callDL();
|
||||||
|
|
||||||
J3DShapePacket* packet = getShapePacket();
|
J3DShapePacket* packet = getShapePacket();
|
||||||
@@ -230,6 +233,8 @@ void J3DMatPacket::draw() {
|
|||||||
#endif
|
#endif
|
||||||
packet->getShape()->loadPreDrawSetting();
|
packet->getShape()->loadPreDrawSetting();
|
||||||
|
|
||||||
|
// TODO: MAT4 sets polygon offset here in HD
|
||||||
|
|
||||||
while (packet != NULL) {
|
while (packet != NULL) {
|
||||||
if (packet->getDisplayListObj() != NULL) {
|
if (packet->getDisplayListObj() != NULL) {
|
||||||
packet->getDisplayListObj()->callDL();
|
packet->getDisplayListObj()->callDL();
|
||||||
|
|||||||
@@ -136,8 +136,8 @@ void J3DLoadCPCmd(u8 addr, u32 val) {
|
|||||||
#if TARGET_PC
|
#if TARGET_PC
|
||||||
static void J3DLoadArrayBasePtr(GXAttr attr, void* data, u32 size, bool le) {
|
static void J3DLoadArrayBasePtr(GXAttr attr, void* data, u32 size, bool le) {
|
||||||
u32 idx = (attr == GX_VA_NBT) ? 1 : (attr - GX_VA_POS);
|
u32 idx = (attr == GX_VA_NBT) ? 1 : (attr - GX_VA_POS);
|
||||||
GXCmd1u8(GX_AURORA);
|
GXCmd1u8(GX_LOAD_AURORA);
|
||||||
GXCmd1u16(GX_AURORA_LOAD_ARRAYBASE | idx);
|
GXCmd1u16(GX_LOAD_AURORA_ARRAYBASE | idx);
|
||||||
GXCmd1u64((u64)data);
|
GXCmd1u64((u64)data);
|
||||||
GXCmd1u32(size);
|
GXCmd1u32(size);
|
||||||
GXCmd1u8(le ? 1 : 0);
|
GXCmd1u8(le ? 1 : 0);
|
||||||
|
|||||||
@@ -1,47 +1,15 @@
|
|||||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||||
|
|
||||||
#include <cstring>
|
|
||||||
#include <gx.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include "JSystem/J3DGraphBase/J3DShapeDraw.h"
|
#include "JSystem/J3DGraphBase/J3DShapeDraw.h"
|
||||||
#include "JSystem/JKernel/JKRHeap.h"
|
#include "JSystem/JKernel/JKRHeap.h"
|
||||||
|
#include <cstring>
|
||||||
#if TARGET_PC
|
#include <stdint.h>
|
||||||
#include <aurora/dl.hpp>
|
#include <gx.h>
|
||||||
#include <tracy/Tracy.hpp>
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
void set_display_list_copy(void*& displayList, u32& displayListSize, const u8* data, u32 size) {
|
|
||||||
const u32 alignedSize = ALIGN_NEXT(size, 0x20);
|
|
||||||
u8* newDL = JKR_NEW_ARRAY_ARGS(u8, alignedSize, 0x20);
|
|
||||||
if (size != 0) {
|
|
||||||
std::memcpy(newDL, data, size);
|
|
||||||
}
|
|
||||||
for (u32 i = size; i < alignedSize; i++) {
|
|
||||||
newDL[i] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
displayList = newDL;
|
|
||||||
displayListSize = alignedSize;
|
|
||||||
DCStoreRange(newDL, displayListSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
#endif
|
|
||||||
|
|
||||||
u32 J3DShapeDraw::countVertex(u32 stride) {
|
u32 J3DShapeDraw::countVertex(u32 stride) {
|
||||||
u32 count = 0;
|
u32 count = 0;
|
||||||
u8* dlStart = (u8*)getDisplayList();
|
u8* dlStart = (u8*)getDisplayList();
|
||||||
|
|
||||||
#if TARGET_PC
|
|
||||||
aurora::gx::dl::Reader reader{dlStart, getDisplayListSize(), static_cast<u8>(stride)};
|
|
||||||
while (const auto cmd = reader.next()) {
|
|
||||||
if (cmd->kind != aurora::gx::dl::Command::Kind::Passthrough) {
|
|
||||||
count += cmd->draw.vtxCount;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
for (u8* dl = dlStart; (dl - dlStart) < getDisplayListSize();) {
|
for (u8* dl = dlStart; (dl - dlStart) < getDisplayListSize();) {
|
||||||
u8 cmd = *(u8*)dl;
|
u8 cmd = *(u8*)dl;
|
||||||
dl++;
|
dl++;
|
||||||
@@ -52,58 +20,10 @@ u32 J3DShapeDraw::countVertex(u32 stride) {
|
|||||||
count += vtxNum;
|
count += vtxNum;
|
||||||
dl = (u8*)dl + stride * vtxNum;
|
dl = (u8*)dl + stride * vtxNum;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TARGET_PC
|
|
||||||
void J3DShapeDraw::addTexMtxIndexInDL(u32 stride, u32 attrOffs, u32 valueBase) {
|
|
||||||
u32 byteNum = countVertex(stride);
|
|
||||||
u32 oldSize = mDisplayListSize;
|
|
||||||
u32 newSize = ALIGN_NEXT(oldSize + byteNum, 0x20);
|
|
||||||
u8* newDLStart = JKR_NEW_ARRAY_ARGS(u8, newSize, 0x20);
|
|
||||||
u8* oldDLStart = (u8*)mDisplayList;
|
|
||||||
u8* newDL = newDLStart;
|
|
||||||
|
|
||||||
aurora::gx::dl::Reader reader{oldDLStart, mDisplayListSize, static_cast<u8>(stride)};
|
|
||||||
while (const auto cmd = reader.next()) {
|
|
||||||
if (cmd->kind == aurora::gx::dl::Command::Kind::Passthrough) {
|
|
||||||
std::memcpy(newDL, cmd->data, cmd->size);
|
|
||||||
newDL += cmd->size;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto& draw = cmd->draw;
|
|
||||||
const u32 headerSize = draw.vertices - cmd->data;
|
|
||||||
std::memcpy(newDL, cmd->data, headerSize);
|
|
||||||
newDL += headerSize;
|
|
||||||
|
|
||||||
for (u32 i = 0; i < draw.vtxCount; i++) {
|
|
||||||
const u8* oldVtx = draw.vertices + stride * i;
|
|
||||||
u8 pnmtxidx = oldVtx[0];
|
|
||||||
std::memcpy(newDL, oldVtx, attrOffs);
|
|
||||||
newDL += attrOffs;
|
|
||||||
*newDL++ = valueBase + pnmtxidx;
|
|
||||||
std::memcpy(newDL, oldVtx + attrOffs, stride - attrOffs);
|
|
||||||
newDL += stride - attrOffs;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (reader.failed()) {
|
|
||||||
// preserve the remainder untouched
|
|
||||||
std::memcpy(newDL, oldDLStart + reader.pos(), mDisplayListSize - reader.pos());
|
|
||||||
newDL += mDisplayListSize - reader.pos();
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 realSize = ALIGN_NEXT((uintptr_t)newDL - (uintptr_t)newDLStart, 0x20);
|
|
||||||
for (; (newDL - newDLStart) < newSize; newDL++)
|
|
||||||
*newDL = 0;
|
|
||||||
|
|
||||||
mDisplayListSize = realSize;
|
|
||||||
mDisplayList = newDLStart;
|
|
||||||
DCStoreRange(newDLStart, mDisplayListSize);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
void J3DShapeDraw::addTexMtxIndexInDL(u32 stride, u32 attrOffs, u32 valueBase) {
|
void J3DShapeDraw::addTexMtxIndexInDL(u32 stride, u32 attrOffs, u32 valueBase) {
|
||||||
u32 byteNum = countVertex(stride);
|
u32 byteNum = countVertex(stride);
|
||||||
u32 oldSize = mDisplayListSize;
|
u32 oldSize = mDisplayListSize;
|
||||||
@@ -149,30 +69,13 @@ void J3DShapeDraw::addTexMtxIndexInDL(u32 stride, u32 attrOffs, u32 valueBase) {
|
|||||||
mDisplayList = newDLStart;
|
mDisplayList = newDLStart;
|
||||||
DCStoreRange(newDLStart, mDisplayListSize);
|
DCStoreRange(newDLStart, mDisplayListSize);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
J3DShapeDraw::J3DShapeDraw(const u8* displayList, u32 displayListSize) {
|
J3DShapeDraw::J3DShapeDraw(const u8* displayList, u32 displayListSize) {
|
||||||
#if TARGET_PC
|
|
||||||
set_display_list_copy(mDisplayList, mDisplayListSize, displayList, displayListSize);
|
|
||||||
#else
|
|
||||||
mDisplayList = (void*)displayList;
|
mDisplayList = (void*)displayList;
|
||||||
mDisplayListSize = displayListSize;
|
mDisplayListSize = displayListSize;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TARGET_PC
|
|
||||||
J3DShapeDraw::J3DShapeDraw(
|
|
||||||
const u8* displayList, u32 displayListSize, const GXVtxDescList* vtxDesc) {
|
|
||||||
if (const auto optimized = aurora::gx::dl::optimize(displayList, displayListSize, vtxDesc)) {
|
|
||||||
set_display_list_copy(mDisplayList, mDisplayListSize, optimized->data(), optimized->size());
|
|
||||||
} else {
|
|
||||||
set_display_list_copy(mDisplayList, mDisplayListSize, displayList, displayListSize);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void J3DShapeDraw::draw() const {
|
void J3DShapeDraw::draw() const {
|
||||||
ZoneScoped;
|
|
||||||
GXCallDisplayList(mDisplayList, mDisplayListSize);
|
GXCallDisplayList(mDisplayList, mDisplayListSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,9 @@
|
|||||||
#include "dusk/logging.h"
|
#include "dusk/logging.h"
|
||||||
|
|
||||||
J3DMaterialFactory::J3DMaterialFactory(J3DMaterialBlock const& i_block) {
|
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;
|
mMaterialNum = i_block.mMaterialNum;
|
||||||
mpMaterialInitData = JSUConvertOffsetToPtr<J3DMaterialInitData>(&i_block, i_block.mpMaterialInitData);
|
mpMaterialInitData = JSUConvertOffsetToPtr<J3DMaterialInitData>(&i_block, i_block.mpMaterialInitData);
|
||||||
mpMaterialID = JSUConvertOffsetToPtr<BE(u16)>(&i_block, i_block.mpMaterialID);
|
mpMaterialID = JSUConvertOffsetToPtr<BE(u16)>(&i_block, i_block.mpMaterialID);
|
||||||
@@ -46,6 +49,11 @@ J3DMaterialFactory::J3DMaterialFactory(J3DMaterialBlock const& i_block) {
|
|||||||
mpZCompLoc = JSUConvertOffsetToPtr<u8>(&i_block, i_block.mpZCompLoc);
|
mpZCompLoc = JSUConvertOffsetToPtr<u8>(&i_block, i_block.mpZCompLoc);
|
||||||
mpDither = JSUConvertOffsetToPtr<u8>(&i_block, i_block.mpDither);
|
mpDither = JSUConvertOffsetToPtr<u8>(&i_block, i_block.mpDither);
|
||||||
mpNBTScaleInfo = JSUConvertOffsetToPtr<J3DNBTScaleInfo>(&i_block, i_block.mpNBTScaleInfo);
|
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;
|
mpDisplayListInit = NULL;
|
||||||
mpPatchingInfo = NULL;
|
mpPatchingInfo = NULL;
|
||||||
mpCurrentMtxInfo = NULL;
|
mpCurrentMtxInfo = NULL;
|
||||||
@@ -74,7 +82,11 @@ u16 J3DMaterialFactory::countUniqueMaterials() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
u32 J3DMaterialFactory::countTexGens(int i_idx) const {
|
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]];
|
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||||
|
#endif
|
||||||
if (mtl_init_data->mTexGenNumIdx != 0xff) {
|
if (mtl_init_data->mTexGenNumIdx != 0xff) {
|
||||||
return mpTexGenNum[mtl_init_data->mTexGenNumIdx];
|
return mpTexGenNum[mtl_init_data->mTexGenNumIdx];
|
||||||
}
|
}
|
||||||
@@ -82,7 +94,11 @@ u32 J3DMaterialFactory::countTexGens(int i_idx) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
u32 J3DMaterialFactory::countStages(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]];
|
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||||
|
#endif
|
||||||
u32 count1 = 0;
|
u32 count1 = 0;
|
||||||
u32 count2 = 0;
|
u32 count2 = 0;
|
||||||
if (mtl_init_data->mTevStageNumIdx != 0xff) {
|
if (mtl_init_data->mTevStageNumIdx != 0xff) {
|
||||||
@@ -157,6 +173,9 @@ J3DMaterial* J3DMaterialFactory::createNormalMaterial(J3DMaterial* i_material, i
|
|||||||
i_material->mPEBlock->setZMode(newZMode(i_idx));
|
i_material->mPEBlock->setZMode(newZMode(i_idx));
|
||||||
i_material->mPEBlock->setZCompLoc(newZCompLoc(i_idx));
|
i_material->mPEBlock->setZCompLoc(newZCompLoc(i_idx));
|
||||||
i_material->mPEBlock->setDither(newDither(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));
|
i_material->mTevBlock->setTevStageNum(newTevStageNum(i_idx));
|
||||||
for (u8 i = 0; i < tex_num; i++) {
|
for (u8 i = 0; i < tex_num; i++) {
|
||||||
i_material->mTevBlock->setTexNo(i, newTexNo(i_idx, i));
|
i_material->mTevBlock->setTexNo(i, newTexNo(i_idx, i));
|
||||||
@@ -165,7 +184,11 @@ J3DMaterial* J3DMaterialFactory::createNormalMaterial(J3DMaterial* i_material, i
|
|||||||
i_material->mTevBlock->setTevOrder(i, newTevOrder(i_idx, i));
|
i_material->mTevBlock->setTevOrder(i, newTevOrder(i_idx, i));
|
||||||
}
|
}
|
||||||
for (u8 i = 0; i < tev_stage_num_max; 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]];
|
J3DMaterialInitData* material_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||||
|
#endif
|
||||||
i_material->mTevBlock->setTevStage(i, newTevStage(i_idx, i));
|
i_material->mTevBlock->setTevStage(i, newTevStage(i_idx, i));
|
||||||
if (material_init_data->mTevSwapModeIdx[i] != 0xffff) {
|
if (material_init_data->mTevSwapModeIdx[i] != 0xffff) {
|
||||||
i_material->mTevBlock->getTevStage(i)->setTexSel(
|
i_material->mTevBlock->getTevStage(i)->setTexSel(
|
||||||
@@ -200,7 +223,11 @@ J3DMaterial* J3DMaterialFactory::createNormalMaterial(J3DMaterial* i_material, i
|
|||||||
for (u8 i = 0; i < 8; i++) {
|
for (u8 i = 0; i < 8; i++) {
|
||||||
i_material->mTexGenBlock->setTexMtx(i, newTexMtx(i_idx, i));
|
i_material->mTexGenBlock->setTexMtx(i, newTexMtx(i_idx, i));
|
||||||
}
|
}
|
||||||
J3DMaterialInitData* material_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
#ifdef DUSK_TPHD
|
||||||
|
J3DMaterialInitData* material_init_data = getMatInitData(i_idx);
|
||||||
|
#else
|
||||||
|
J3DMaterialInitData* material_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||||
|
#endif
|
||||||
for (u8 i = 0; i < tev_stage_num_max; i++) {
|
for (u8 i = 0; i < tev_stage_num_max; i++) {
|
||||||
if (material_init_data->mTevKColorSel[i] != 0xff) {
|
if (material_init_data->mTevKColorSel[i] != 0xff) {
|
||||||
i_material->mTevBlock->setTevKColorSel(i, material_init_data->mTevKColorSel[i]);
|
i_material->mTevBlock->setTevKColorSel(i, material_init_data->mTevKColorSel[i]);
|
||||||
@@ -273,7 +300,11 @@ J3DMaterial* J3DMaterialFactory::createPatchedMaterial(J3DMaterial* i_material,
|
|||||||
i_material->mTevBlock->setTevColor(i, newTevColor(i_idx, i));
|
i_material->mTevBlock->setTevColor(i, newTevColor(i_idx, i));
|
||||||
}
|
}
|
||||||
for (u8 i = 0; i < tev_stage_num; 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]];
|
J3DMaterialInitData* material_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||||
|
#endif
|
||||||
i_material->mTevBlock->setTevStage(i, newTevStage(i_idx, i));
|
i_material->mTevBlock->setTevStage(i, newTevStage(i_idx, i));
|
||||||
if (material_init_data->mTevSwapModeIdx[i] != 0xffff) {
|
if (material_init_data->mTevSwapModeIdx[i] != 0xffff) {
|
||||||
i_material->mTevBlock->getTevStage(i)->setTexSel(
|
i_material->mTevBlock->getTevStage(i)->setTexSel(
|
||||||
@@ -282,7 +313,11 @@ J3DMaterial* J3DMaterialFactory::createPatchedMaterial(J3DMaterial* i_material,
|
|||||||
mpTevSwapModeInfo[material_init_data->mTevSwapModeIdx[i]].mRasSel);
|
mpTevSwapModeInfo[material_init_data->mTevSwapModeIdx[i]].mRasSel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
J3DMaterialInitData* init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
#ifdef DUSK_TPHD
|
||||||
|
J3DMaterialInitData* init_data = getMatInitData(i_idx);
|
||||||
|
#else
|
||||||
|
J3DMaterialInitData* init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||||
|
#endif
|
||||||
for (u8 i = 0; i < tev_stage_num; i++) {
|
for (u8 i = 0; i < tev_stage_num; i++) {
|
||||||
if (init_data->mTevKColorSel[i] != 0xff) {
|
if (init_data->mTevKColorSel[i] != 0xff) {
|
||||||
i_material->mTevBlock->setTevKColorSel(i, init_data->mTevKColorSel[i]);
|
i_material->mTevBlock->setTevKColorSel(i, init_data->mTevKColorSel[i]);
|
||||||
@@ -423,7 +458,11 @@ u32 J3DMaterialFactory::calcSizeNormalMaterial(J3DMaterial* i_material, int i_id
|
|||||||
size += J3DMaterial::calcSizeTevBlock((u16)tev_stage_num_max);
|
size += J3DMaterial::calcSizeTevBlock((u16)tev_stage_num_max);
|
||||||
size += J3DMaterial::calcSizeIndBlock(ind_flag);
|
size += J3DMaterial::calcSizeIndBlock(ind_flag);
|
||||||
size += J3DMaterial::calcSizePEBlock(pe_flag, getMaterialMode(i_idx));
|
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]];
|
J3DMaterialInitData* init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||||
|
#endif
|
||||||
for (u32 i = 0; i < 8; i++) {
|
for (u32 i = 0; i < 8; i++) {
|
||||||
if (init_data->mTexMtxIdx[i] != 0xffff) {
|
if (init_data->mTexMtxIdx[i] != 0xffff) {
|
||||||
size += sizeof(J3DTexMtx);
|
size += sizeof(J3DTexMtx);
|
||||||
@@ -444,7 +483,11 @@ u32 J3DMaterialFactory::calcSizePatchedMaterial(J3DMaterial* i_material, int i_i
|
|||||||
size += sizeof(J3DTevBlockPatched);
|
size += sizeof(J3DTevBlockPatched);
|
||||||
size += J3DMaterial::calcSizeIndBlock(ind_flag);
|
size += J3DMaterial::calcSizeIndBlock(ind_flag);
|
||||||
size += J3DMaterial::calcSizePEBlock(0x10000000, getMaterialMode(i_idx));
|
size += J3DMaterial::calcSizePEBlock(0x10000000, getMaterialMode(i_idx));
|
||||||
|
#ifdef DUSK_TPHD
|
||||||
|
J3DMaterialInitData* init_data = getMatInitData(i_idx);
|
||||||
|
#else
|
||||||
J3DMaterialInitData* init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
J3DMaterialInitData* init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||||
|
#endif
|
||||||
for (u32 i = 0; i < 8; i++) {
|
for (u32 i = 0; i < 8; i++) {
|
||||||
if (init_data->mTexMtxIdx[i] != 0xffff) {
|
if (init_data->mTexMtxIdx[i] != 0xffff) {
|
||||||
size += sizeof(J3DTexMtx);
|
size += sizeof(J3DTexMtx);
|
||||||
@@ -474,7 +517,11 @@ J3DGXColor J3DMaterialFactory::newMatColor(int i_idx, int i_no) const {
|
|||||||
#else
|
#else
|
||||||
J3DGXColor dflt = GXColor{0xff, 0xff, 0xff, 0xff};
|
J3DGXColor dflt = GXColor{0xff, 0xff, 0xff, 0xff};
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef DUSK_TPHD
|
||||||
|
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
|
||||||
|
#else
|
||||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||||
|
#endif
|
||||||
if (mtl_init_data->mMatColorIdx[i_no] != 0xffff) {
|
if (mtl_init_data->mMatColorIdx[i_no] != 0xffff) {
|
||||||
return (GXColor) mpMatColor[mtl_init_data->mMatColorIdx[i_no]];
|
return (GXColor) mpMatColor[mtl_init_data->mMatColorIdx[i_no]];
|
||||||
} else {
|
} else {
|
||||||
@@ -483,7 +530,11 @@ J3DGXColor J3DMaterialFactory::newMatColor(int i_idx, int i_no) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const u8 J3DMaterialFactory::newColorChanNum(int i_idx) 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]];
|
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||||
|
#endif
|
||||||
if (mtl_init_data->mColorChanNumIdx != 0xff) {
|
if (mtl_init_data->mColorChanNumIdx != 0xff) {
|
||||||
return mpColorChanNum[mtl_init_data->mColorChanNumIdx];
|
return mpColorChanNum[mtl_init_data->mColorChanNumIdx];
|
||||||
} else {
|
} else {
|
||||||
@@ -493,7 +544,11 @@ const u8 J3DMaterialFactory::newColorChanNum(int i_idx) const {
|
|||||||
|
|
||||||
J3DColorChan J3DMaterialFactory::newColorChan(int i_idx, int i_no) const {
|
J3DColorChan J3DMaterialFactory::newColorChan(int i_idx, int i_no) const {
|
||||||
u32 r29 = 0;
|
u32 r29 = 0;
|
||||||
|
#ifdef DUSK_TPHD
|
||||||
|
J3DMaterialInitData* init_data = getMatInitData(i_idx);
|
||||||
|
#else
|
||||||
J3DMaterialInitData* init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
J3DMaterialInitData* init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||||
|
#endif
|
||||||
if (init_data->mColorChanIdx[i_no] != 0xffff) {
|
if (init_data->mColorChanIdx[i_no] != 0xffff) {
|
||||||
return J3DColorChan(mpColorChanInfo[init_data->mColorChanIdx[i_no]]);
|
return J3DColorChan(mpColorChanInfo[init_data->mColorChanIdx[i_no]]);
|
||||||
} else {
|
} else {
|
||||||
@@ -507,7 +562,11 @@ J3DGXColor J3DMaterialFactory::newAmbColor(int i_idx, int i_no) const {
|
|||||||
#else
|
#else
|
||||||
J3DGXColor dflt = GXColor{0x32, 0x32, 0x32, 0x32};
|
J3DGXColor dflt = GXColor{0x32, 0x32, 0x32, 0x32};
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef DUSK_TPHD
|
||||||
|
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
|
||||||
|
#else
|
||||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||||
|
#endif
|
||||||
if (mtl_init_data->mAmbColorIdx[i_no] != 0xffff) {
|
if (mtl_init_data->mAmbColorIdx[i_no] != 0xffff) {
|
||||||
return (GXColor) mpAmbColor[mtl_init_data->mAmbColorIdx[i_no]];
|
return (GXColor) mpAmbColor[mtl_init_data->mAmbColorIdx[i_no]];
|
||||||
} else {
|
} else {
|
||||||
@@ -517,7 +576,11 @@ J3DGXColor J3DMaterialFactory::newAmbColor(int i_idx, int i_no) const {
|
|||||||
|
|
||||||
u32 J3DMaterialFactory::newTexGenNum(int i_idx) const {
|
u32 J3DMaterialFactory::newTexGenNum(int i_idx) const {
|
||||||
u32 r30 = 0;
|
u32 r30 = 0;
|
||||||
|
#ifdef DUSK_TPHD
|
||||||
|
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
|
||||||
|
#else
|
||||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||||
|
#endif
|
||||||
if (mtl_init_data->mTexGenNumIdx != 0xff) {
|
if (mtl_init_data->mTexGenNumIdx != 0xff) {
|
||||||
return mpTexGenNum[mtl_init_data->mTexGenNumIdx];
|
return mpTexGenNum[mtl_init_data->mTexGenNumIdx];
|
||||||
} else {
|
} else {
|
||||||
@@ -526,7 +589,11 @@ u32 J3DMaterialFactory::newTexGenNum(int i_idx) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
J3DTexCoord J3DMaterialFactory::newTexCoord(int i_idx, int i_no) 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]];
|
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||||
|
#endif
|
||||||
if (mtl_init_data->mTexCoordIdx[i_no] != 0xffff) {
|
if (mtl_init_data->mTexCoordIdx[i_no] != 0xffff) {
|
||||||
return J3DTexCoord(mpTexCoordInfo[mtl_init_data->mTexCoordIdx[i_no]]);
|
return J3DTexCoord(mpTexCoordInfo[mtl_init_data->mTexCoordIdx[i_no]]);
|
||||||
} else {
|
} else {
|
||||||
@@ -536,7 +603,11 @@ J3DTexCoord J3DMaterialFactory::newTexCoord(int i_idx, int i_no) const {
|
|||||||
|
|
||||||
J3DTexMtx* J3DMaterialFactory::newTexMtx(int i_idx, int i_no) const {
|
J3DTexMtx* J3DMaterialFactory::newTexMtx(int i_idx, int i_no) const {
|
||||||
J3DTexMtx* tex_mtx = NULL;
|
J3DTexMtx* tex_mtx = NULL;
|
||||||
|
#ifdef DUSK_TPHD
|
||||||
|
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
|
||||||
|
#else
|
||||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||||
|
#endif
|
||||||
if (mtl_init_data->mTexMtxIdx[i_no] != 0xffff) {
|
if (mtl_init_data->mTexMtxIdx[i_no] != 0xffff) {
|
||||||
#if TARGET_LITTLE_ENDIAN
|
#if TARGET_LITTLE_ENDIAN
|
||||||
auto tex_mtx_info = mpTexMtxInfo[mtl_init_data->mTexMtxIdx[i_no]];
|
auto tex_mtx_info = mpTexMtxInfo[mtl_init_data->mTexMtxIdx[i_no]];
|
||||||
@@ -558,7 +629,11 @@ J3DTexMtx* J3DMaterialFactory::newTexMtx(int i_idx, int i_no) const {
|
|||||||
|
|
||||||
u8 J3DMaterialFactory::newCullMode(int i_idx) const {
|
u8 J3DMaterialFactory::newCullMode(int i_idx) const {
|
||||||
u32 r30 = 0;
|
u32 r30 = 0;
|
||||||
|
#ifdef DUSK_TPHD
|
||||||
|
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
|
||||||
|
#else
|
||||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||||
|
#endif
|
||||||
if (mtl_init_data->mCullModeIdx != 0xff) {
|
if (mtl_init_data->mCullModeIdx != 0xff) {
|
||||||
return mpCullMode[mtl_init_data->mCullModeIdx];
|
return mpCullMode[mtl_init_data->mCullModeIdx];
|
||||||
} else {
|
} else {
|
||||||
@@ -567,7 +642,11 @@ u8 J3DMaterialFactory::newCullMode(int i_idx) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
u16 J3DMaterialFactory::newTexNo(int i_idx, int i_no) 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]];
|
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||||
|
#endif
|
||||||
if (mtl_init_data->mTexNoIdx[i_no] != 0xffff) {
|
if (mtl_init_data->mTexNoIdx[i_no] != 0xffff) {
|
||||||
return mpTexNo[mtl_init_data->mTexNoIdx[i_no]];
|
return mpTexNo[mtl_init_data->mTexNoIdx[i_no]];
|
||||||
} else {
|
} else {
|
||||||
@@ -576,7 +655,11 @@ u16 J3DMaterialFactory::newTexNo(int i_idx, int i_no) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
J3DTevOrder J3DMaterialFactory::newTevOrder(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]];
|
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||||
|
#endif
|
||||||
if (mtl_init_data->mTevOrderIdx[i_no] != 0xffff) {
|
if (mtl_init_data->mTevOrderIdx[i_no] != 0xffff) {
|
||||||
return J3DTevOrder(mpTevOrderInfo[mtl_init_data->mTevOrderIdx[i_no]]);
|
return J3DTevOrder(mpTevOrderInfo[mtl_init_data->mTevOrderIdx[i_no]]);
|
||||||
} else {
|
} else {
|
||||||
@@ -587,7 +670,11 @@ J3DTevOrder J3DMaterialFactory::newTevOrder(int i_idx, int i_no) const {
|
|||||||
J3DGXColorS10 J3DMaterialFactory::newTevColor(int i_idx, int i_no) const {
|
J3DGXColorS10 J3DMaterialFactory::newTevColor(int i_idx, int i_no) const {
|
||||||
GXColorS10 _dflt = {0, 0, 0, 0};
|
GXColorS10 _dflt = {0, 0, 0, 0};
|
||||||
J3DGXColorS10 dflt = _dflt;
|
J3DGXColorS10 dflt = _dflt;
|
||||||
|
#ifdef DUSK_TPHD
|
||||||
|
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
|
||||||
|
#else
|
||||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||||
|
#endif
|
||||||
if (mtl_init_data->mTevColorIdx[i_no] != 0xffff) {
|
if (mtl_init_data->mTevColorIdx[i_no] != 0xffff) {
|
||||||
return (GXColorS10) mpTevColor[mtl_init_data->mTevColorIdx[i_no]];
|
return (GXColorS10) mpTevColor[mtl_init_data->mTevColorIdx[i_no]];
|
||||||
} else {
|
} else {
|
||||||
@@ -601,7 +688,11 @@ J3DGXColor J3DMaterialFactory::newTevKColor(int i_idx, int i_no) const {
|
|||||||
#else
|
#else
|
||||||
J3DGXColor dflt = GXColor{0xff, 0xff, 0xff, 0xff};
|
J3DGXColor dflt = GXColor{0xff, 0xff, 0xff, 0xff};
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef DUSK_TPHD
|
||||||
|
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
|
||||||
|
#else
|
||||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||||
|
#endif
|
||||||
if (mtl_init_data->mTevKColorIdx[i_no] != 0xffff) {
|
if (mtl_init_data->mTevKColorIdx[i_no] != 0xffff) {
|
||||||
return (GXColor) mpTevKColor[mtl_init_data->mTevKColorIdx[i_no]];
|
return (GXColor) mpTevKColor[mtl_init_data->mTevKColorIdx[i_no]];
|
||||||
} else {
|
} else {
|
||||||
@@ -610,7 +701,11 @@ J3DGXColor J3DMaterialFactory::newTevKColor(int i_idx, int i_no) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const u8 J3DMaterialFactory::newTevStageNum(int i_idx) 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]];
|
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||||
|
#endif
|
||||||
if (mtl_init_data->mTevStageNumIdx != 0xff) {
|
if (mtl_init_data->mTevStageNumIdx != 0xff) {
|
||||||
return mpTevStageNum[mtl_init_data->mTevStageNumIdx];
|
return mpTevStageNum[mtl_init_data->mTevStageNumIdx];
|
||||||
} else {
|
} else {
|
||||||
@@ -619,7 +714,11 @@ const u8 J3DMaterialFactory::newTevStageNum(int i_idx) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
J3DTevStage J3DMaterialFactory::newTevStage(int i_idx, int i_no) 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]];
|
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||||
|
#endif
|
||||||
if (mtl_init_data->mTevStageIdx[i_no] != 0xffff) {
|
if (mtl_init_data->mTevStageIdx[i_no] != 0xffff) {
|
||||||
return J3DTevStage(mpTevStageInfo[mtl_init_data->mTevStageIdx[i_no]]);
|
return J3DTevStage(mpTevStageInfo[mtl_init_data->mTevStageIdx[i_no]]);
|
||||||
} else {
|
} else {
|
||||||
@@ -628,7 +727,11 @@ J3DTevStage J3DMaterialFactory::newTevStage(int i_idx, int i_no) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
J3DTevSwapModeTable J3DMaterialFactory::newTevSwapModeTable(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]];
|
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||||
|
#endif
|
||||||
if (mtl_init_data->mTevSwapModeTableIdx[i_no] != 0xffff) {
|
if (mtl_init_data->mTevSwapModeTableIdx[i_no] != 0xffff) {
|
||||||
return J3DTevSwapModeTable(mpTevSwapModeTableInfo[mtl_init_data->mTevSwapModeTableIdx[i_no]]);
|
return J3DTevSwapModeTable(mpTevSwapModeTableInfo[mtl_init_data->mTevSwapModeTableIdx[i_no]]);
|
||||||
} else {
|
} else {
|
||||||
@@ -689,7 +792,11 @@ J3DIndTexCoordScale J3DMaterialFactory::newIndTexCoordScale(int i_idx, int i_no)
|
|||||||
|
|
||||||
J3DFog J3DMaterialFactory::newFog(int i_idx) const {
|
J3DFog J3DMaterialFactory::newFog(int i_idx) const {
|
||||||
J3DFog fog;
|
J3DFog fog;
|
||||||
|
#ifdef DUSK_TPHD
|
||||||
|
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
|
||||||
|
#else
|
||||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||||
|
#endif
|
||||||
if (mtl_init_data->mFogIdx != 0xffff) {
|
if (mtl_init_data->mFogIdx != 0xffff) {
|
||||||
#if TARGET_LITTLE_ENDIAN
|
#if TARGET_LITTLE_ENDIAN
|
||||||
J3DFogInfo fogInfo = mpFogInfo[mtl_init_data->mFogIdx];
|
J3DFogInfo fogInfo = mpFogInfo[mtl_init_data->mFogIdx];
|
||||||
@@ -709,7 +816,11 @@ J3DFog J3DMaterialFactory::newFog(int i_idx) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
J3DAlphaComp J3DMaterialFactory::newAlphaComp(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]];
|
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||||
|
#endif
|
||||||
if (mtl_init_data->mAlphaCompIdx != 0xffff) {
|
if (mtl_init_data->mAlphaCompIdx != 0xffff) {
|
||||||
return J3DAlphaComp(mpAlphaCompInfo[mtl_init_data->mAlphaCompIdx]);
|
return J3DAlphaComp(mpAlphaCompInfo[mtl_init_data->mAlphaCompIdx]);
|
||||||
} else {
|
} else {
|
||||||
@@ -718,7 +829,11 @@ J3DAlphaComp J3DMaterialFactory::newAlphaComp(int i_idx) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
J3DBlend J3DMaterialFactory::newBlend(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]];
|
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||||
|
#endif
|
||||||
if (mtl_init_data->mBlendIdx != 0xffff) {
|
if (mtl_init_data->mBlendIdx != 0xffff) {
|
||||||
return J3DBlend(mpBlendInfo[mtl_init_data->mBlendIdx]);
|
return J3DBlend(mpBlendInfo[mtl_init_data->mBlendIdx]);
|
||||||
} else {
|
} else {
|
||||||
@@ -728,7 +843,11 @@ J3DBlend J3DMaterialFactory::newBlend(int i_idx) const {
|
|||||||
|
|
||||||
J3DZMode J3DMaterialFactory::newZMode(int i_idx) const {
|
J3DZMode J3DMaterialFactory::newZMode(int i_idx) const {
|
||||||
u32 r29 = 0;
|
u32 r29 = 0;
|
||||||
|
#ifdef DUSK_TPHD
|
||||||
|
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
|
||||||
|
#else
|
||||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||||
|
#endif
|
||||||
if (mtl_init_data->mZModeIdx != 0xff) {
|
if (mtl_init_data->mZModeIdx != 0xff) {
|
||||||
return J3DZMode(mpZModeInfo[mtl_init_data->mZModeIdx]);
|
return J3DZMode(mpZModeInfo[mtl_init_data->mZModeIdx]);
|
||||||
} else {
|
} else {
|
||||||
@@ -737,7 +856,11 @@ J3DZMode J3DMaterialFactory::newZMode(int i_idx) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const u8 J3DMaterialFactory::newZCompLoc(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]];
|
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||||
|
#endif
|
||||||
if (mtl_init_data->mZCompLocIdx != 0xff){
|
if (mtl_init_data->mZCompLocIdx != 0xff){
|
||||||
return mpZCompLoc[mtl_init_data->mZCompLocIdx];
|
return mpZCompLoc[mtl_init_data->mZCompLocIdx];
|
||||||
} else {
|
} else {
|
||||||
@@ -746,7 +869,11 @@ const u8 J3DMaterialFactory::newZCompLoc(int i_idx) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const u8 J3DMaterialFactory::newDither(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]];
|
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||||
|
#endif
|
||||||
if (mtl_init_data->mDitherIdx != 0xff){
|
if (mtl_init_data->mDitherIdx != 0xff){
|
||||||
return mpDither[mtl_init_data->mDitherIdx];
|
return mpDither[mtl_init_data->mDitherIdx];
|
||||||
} else {
|
} else {
|
||||||
@@ -754,9 +881,24 @@ 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 J3DMaterialFactory::newNBTScale(int i_idx) const {
|
||||||
J3DNBTScale dflt(j3dDefaultNBTScaleInfo);
|
J3DNBTScale dflt(j3dDefaultNBTScaleInfo);
|
||||||
|
#ifdef DUSK_TPHD
|
||||||
|
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
|
||||||
|
#else
|
||||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||||
|
#endif
|
||||||
if (mtl_init_data->mNBTScaleIdx != 0xffff) {
|
if (mtl_init_data->mNBTScaleIdx != 0xffff) {
|
||||||
return J3DNBTScale(mpNBTScaleInfo[mtl_init_data->mNBTScaleIdx]);
|
return J3DNBTScale(mpNBTScaleInfo[mtl_init_data->mNBTScaleIdx]);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -103,6 +103,9 @@ J3DModelData* J3DModelLoader::load(void const* i_data, u32 i_flags) {
|
|||||||
readJoint((J3DJointBlock*)block);
|
readJoint((J3DJointBlock*)block);
|
||||||
break;
|
break;
|
||||||
case 'MAT3':
|
case 'MAT3':
|
||||||
|
#if DUSK_TPHD
|
||||||
|
case 'MAT4':
|
||||||
|
#endif
|
||||||
readMaterial((J3DMaterialBlock*)block, (s32)i_flags);
|
readMaterial((J3DMaterialBlock*)block, (s32)i_flags);
|
||||||
break;
|
break;
|
||||||
case 'MAT2':
|
case 'MAT2':
|
||||||
@@ -147,6 +150,9 @@ J3DMaterialTable* J3DModelLoader::loadMaterialTable(void const* i_data) {
|
|||||||
for (u32 block_no = 0; block_no < data->mBlockNum; block_no++) {
|
for (u32 block_no = 0; block_no < data->mBlockNum; block_no++) {
|
||||||
switch (block->mBlockType) {
|
switch (block->mBlockType) {
|
||||||
case 'MAT3':
|
case 'MAT3':
|
||||||
|
#if DUSK_TPHD
|
||||||
|
case 'MAT4':
|
||||||
|
#endif
|
||||||
readMaterialTable((J3DMaterialBlock*)block, flags);
|
readMaterialTable((J3DMaterialBlock*)block, flags);
|
||||||
break;
|
break;
|
||||||
case 'MAT2':
|
case 'MAT2':
|
||||||
@@ -212,6 +218,9 @@ J3DModelData* J3DModelLoader::loadBinaryDisplayList(void const* i_data, u32 i_fl
|
|||||||
modifyMaterial(i_flags);
|
modifyMaterial(i_flags);
|
||||||
break;
|
break;
|
||||||
case 'MAT3':
|
case 'MAT3':
|
||||||
|
#if DUSK_TPHD
|
||||||
|
case 'MAT4':
|
||||||
|
#endif
|
||||||
flags = 0x50100000;
|
flags = 0x50100000;
|
||||||
flags |= (i_flags & 0x3000000);
|
flags |= (i_flags & 0x3000000);
|
||||||
mpMaterialBlock = (J3DMaterialBlock*)block;
|
mpMaterialBlock = (J3DMaterialBlock*)block;
|
||||||
@@ -308,8 +317,22 @@ static GXVtxAttrFmtList getFmt(GXVtxAttrFmtList* i_fmtList, GXAttr i_attr) {
|
|||||||
return *i_fmtList;
|
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!");
|
OSPanic(__FILE__, __LINE__, "Unable to find vertex attribute format!");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ u16 J3DModelLoader::countMaterialNum(const void* stream) {
|
|||||||
const J3DModelBlock* block = header->mBlocks;
|
const J3DModelBlock* block = header->mBlocks;
|
||||||
for (int i = 0; i < header->mBlockNum; i++)
|
for (int i = 0; i < header->mBlockNum; i++)
|
||||||
{
|
{
|
||||||
if (block->mBlockType == 'MAT3') {
|
if (block->mBlockType == 'MAT3' || block->mBlockType == 'MAT4') {
|
||||||
const J3DMaterialBlock* materialBlock = (const J3DMaterialBlock*)block;
|
const J3DMaterialBlock* materialBlock = (const J3DMaterialBlock*)block;
|
||||||
return materialBlock->mMaterialNum;
|
return materialBlock->mMaterialNum;
|
||||||
}
|
}
|
||||||
@@ -45,6 +45,7 @@ u32 J3DModelLoader::calcLoadSize(void const* stream, u32 flags_) {
|
|||||||
size += calcSizeJoint((const J3DJointBlock*)nextBlock);
|
size += calcSizeJoint((const J3DJointBlock*)nextBlock);
|
||||||
break;
|
break;
|
||||||
case 'MAT3':
|
case 'MAT3':
|
||||||
|
case 'MAT4':
|
||||||
size += calcSizeMaterial((const J3DMaterialBlock*)nextBlock, flags);
|
size += calcSizeMaterial((const J3DMaterialBlock*)nextBlock, flags);
|
||||||
break;
|
break;
|
||||||
case 'SHP1':
|
case 'SHP1':
|
||||||
@@ -86,6 +87,7 @@ u32 J3DModelLoader::calcLoadMaterialTableSize(const void* stream) {
|
|||||||
for (u32 i = 0; i < header->mBlockNum; i++) {
|
for (u32 i = 0; i < header->mBlockNum; i++) {
|
||||||
switch (nextBlock->mBlockType) {
|
switch (nextBlock->mBlockType) {
|
||||||
case 'MAT3':
|
case 'MAT3':
|
||||||
|
case 'MAT4':
|
||||||
size += calcSizeMaterialTable((const J3DMaterialBlock*)nextBlock, flags);
|
size += calcSizeMaterialTable((const J3DMaterialBlock*)nextBlock, flags);
|
||||||
break;
|
break;
|
||||||
case 'TEX1':
|
case 'TEX1':
|
||||||
@@ -135,7 +137,8 @@ u32 J3DModelLoader::calcLoadBinaryDisplayListSize(const void* stream, u32 flags)
|
|||||||
case 'MDL3':
|
case 'MDL3':
|
||||||
size += calcSizeMaterialDL((const J3DMaterialDLBlock*)nextBlock, flags);
|
size += calcSizeMaterialDL((const J3DMaterialDLBlock*)nextBlock, flags);
|
||||||
break;
|
break;
|
||||||
case 'MAT3': {
|
case 'MAT3':
|
||||||
|
case 'MAT4': {
|
||||||
u32 flags2 = (J3DMLF_21 | J3DMLF_Material_PE_Full | J3DMLF_Material_Color_LightOn);
|
u32 flags2 = (J3DMLF_21 | J3DMLF_Material_PE_Full | J3DMLF_Material_Color_LightOn);
|
||||||
flags2 |= (u32)flags & (J3DMLF_Material_UseIndirect | J3DMLF_26);
|
flags2 |= (u32)flags & (J3DMLF_Material_UseIndirect | J3DMLF_26);
|
||||||
mpMaterialBlock = (const J3DMaterialBlock*)nextBlock;
|
mpMaterialBlock = (const J3DMaterialBlock*)nextBlock;
|
||||||
|
|||||||
@@ -132,12 +132,7 @@ J3DShapeDraw* J3DShapeFactory::newShapeDraw(int shapeNo, int mtxGroupNo) const {
|
|||||||
const J3DShapeInitData& shapeInitData = mShapeInitData[mIndexTable[shapeNo]];
|
const J3DShapeInitData& shapeInitData = mShapeInitData[mIndexTable[shapeNo]];
|
||||||
const J3DShapeDrawInitData& drawInitData =
|
const J3DShapeDrawInitData& drawInitData =
|
||||||
(&mDrawInitData[shapeInitData.mDrawInitDataIndex])[mtxGroupNo];
|
(&mDrawInitData[shapeInitData.mDrawInitDataIndex])[mtxGroupNo];
|
||||||
#if TARGET_PC
|
|
||||||
shapeDraw = JKR_NEW J3DShapeDraw(&mDisplayListData[drawInitData.mDisplayListIndex], drawInitData.mDisplayListSize,
|
|
||||||
getVtxDescList(shapeNo));
|
|
||||||
#else
|
|
||||||
shapeDraw = JKR_NEW J3DShapeDraw(&mDisplayListData[drawInitData.mDisplayListIndex], drawInitData.mDisplayListSize);
|
shapeDraw = JKR_NEW J3DShapeDraw(&mDisplayListData[drawInitData.mDisplayListIndex], drawInitData.mDisplayListSize);
|
||||||
#endif
|
|
||||||
J3D_ASSERT_ALLOCMEM(193, shapeDraw);
|
J3D_ASSERT_ALLOCMEM(193, shapeDraw);
|
||||||
return shapeDraw;
|
return shapeDraw;
|
||||||
}
|
}
|
||||||
@@ -159,7 +154,7 @@ s32 J3DShapeFactory::calcSize(int shapeNo, u32 flag) {
|
|||||||
|
|
||||||
for (u32 i = 0; i < mtxGroupNo; i++) {
|
for (u32 i = 0; i < mtxGroupNo; i++) {
|
||||||
size += calcSizeShapeMtx(flag, shapeNo, i);
|
size += calcSizeShapeMtx(flag, shapeNo, i);
|
||||||
size += sizeof(J3DShapeDraw);
|
size += 0x0C;
|
||||||
}
|
}
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
|
|||||||
@@ -9,6 +9,10 @@
|
|||||||
#include "JSystem/JKernel/JKRMemArchive.h"
|
#include "JSystem/JKernel/JKRMemArchive.h"
|
||||||
#include "JSystem/JUtility/JUTAssert.h"
|
#include "JSystem/JUtility/JUTAssert.h"
|
||||||
|
|
||||||
|
#if TARGET_PC && DUSK_TPHD
|
||||||
|
#include "dusk/tphd/HdAssetLayer.hpp"
|
||||||
|
#endif
|
||||||
|
|
||||||
JKRArchive* JKRArchive::check_mount_already(s32 entryNum, JKRHeap* heap) {
|
JKRArchive* JKRArchive::check_mount_already(s32 entryNum, JKRHeap* heap) {
|
||||||
if (heap == NULL) {
|
if (heap == NULL) {
|
||||||
heap = JKRGetCurrentHeap();
|
heap = JKRGetCurrentHeap();
|
||||||
@@ -29,6 +33,15 @@ JKRArchive* JKRArchive::check_mount_already(s32 entryNum, JKRHeap* heap) {
|
|||||||
|
|
||||||
JKRArchive* JKRArchive::mount(const char* path, EMountMode mountMode, JKRHeap* heap,
|
JKRArchive* JKRArchive::mount(const char* path, EMountMode mountMode, JKRHeap* heap,
|
||||||
EMountDirection mountDirection) {
|
EMountDirection mountDirection) {
|
||||||
|
#if TARGET_PC && DUSK_TPHD
|
||||||
|
// TPHD arc redirect.
|
||||||
|
if (path != NULL) {
|
||||||
|
if (auto hdBuf = dusk::tphd::tryLoadHdArchive(path)) {
|
||||||
|
return mount((*hdBuf)->data(), heap, mountDirection);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
s32 entryNum = DVDConvertPathToEntrynum(path);
|
s32 entryNum = DVDConvertPathToEntrynum(path);
|
||||||
if (entryNum < 0)
|
if (entryNum < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@@ -10,10 +10,23 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "os_report.h"
|
#include "os_report.h"
|
||||||
|
|
||||||
|
#if DUSK_TPHD
|
||||||
|
#include "dusk/tphd/HdAssetLayer.hpp"
|
||||||
|
#endif
|
||||||
|
|
||||||
JKRMemArchive::JKRMemArchive(s32 entryNum, JKRArchive::EMountDirection mountDirection)
|
JKRMemArchive::JKRMemArchive(s32 entryNum, JKRArchive::EMountDirection mountDirection)
|
||||||
: JKRArchive(entryNum, MOUNT_MEM) {
|
: JKRArchive(entryNum, MOUNT_MEM) {
|
||||||
mIsMounted = false;
|
mIsMounted = false;
|
||||||
mMountDirection = mountDirection;
|
mMountDirection = mountDirection;
|
||||||
|
#if DUSK_TPHD
|
||||||
|
// TPHD arc redirect by entrynum.
|
||||||
|
if (const auto* hd = dusk::tphd::getHdBytesForEntryNum(entryNum)) {
|
||||||
|
if (!open(const_cast<u8*>(hd->data()), static_cast<u32>(hd->size()),
|
||||||
|
JKRMEMBREAK_FLAG_UNKNOWN0)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
if (!open(entryNum, mMountDirection)) {
|
if (!open(entryNum, mMountDirection)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,33 +14,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "tracy/Tracy.hpp"
|
#include "tracy/Tracy.hpp"
|
||||||
|
|
||||||
#if TARGET_PC
|
|
||||||
#define JPA_DRAW_CTX_PARAM , ParticleDrawCtx* ctx
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
GXColor emitter_prm_color(JPAEmitterWorkData* work) {
|
|
||||||
JPABaseEmitter* emtr = work->mpEmtr;
|
|
||||||
GXColor prm = emtr->mPrmClr;
|
|
||||||
prm.r = COLOR_MULTI(prm.r, emtr->mGlobalPrmClr.r);
|
|
||||||
prm.g = COLOR_MULTI(prm.g, emtr->mGlobalPrmClr.g);
|
|
||||||
prm.b = COLOR_MULTI(prm.b, emtr->mGlobalPrmClr.b);
|
|
||||||
prm.a = COLOR_MULTI(prm.a, emtr->mGlobalPrmClr.a);
|
|
||||||
return prm;
|
|
||||||
}
|
|
||||||
|
|
||||||
GXColor emitter_env_color(JPAEmitterWorkData* work) {
|
|
||||||
JPABaseEmitter* emtr = work->mpEmtr;
|
|
||||||
GXColor env = emtr->mEnvClr;
|
|
||||||
env.r = COLOR_MULTI(env.r, emtr->mGlobalEnvClr.r);
|
|
||||||
env.g = COLOR_MULTI(env.g, emtr->mGlobalEnvClr.g);
|
|
||||||
env.b = COLOR_MULTI(env.b, emtr->mGlobalEnvClr.b);
|
|
||||||
return env;
|
|
||||||
}
|
|
||||||
} // namespace
|
|
||||||
#else
|
|
||||||
#define JPA_DRAW_CTX_PARAM
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void JPASetPointSize(JPAEmitterWorkData* work) {
|
void JPASetPointSize(JPAEmitterWorkData* work) {
|
||||||
GXSetPointSize((u8)(25.0f * work->mGlobalPtclScl.x), GX_TO_ONE);
|
GXSetPointSize((u8)(25.0f * work->mGlobalPtclScl.x), GX_TO_ONE);
|
||||||
}
|
}
|
||||||
@@ -49,16 +22,15 @@ void JPASetLineWidth(JPAEmitterWorkData* work) {
|
|||||||
GXSetLineWidth((u8)(25.0f * work->mGlobalPtclScl.x), GX_TO_ONE);
|
GXSetLineWidth((u8)(25.0f * work->mGlobalPtclScl.x), GX_TO_ONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JPASetPointSize(JPAEmitterWorkData* work, JPABaseParticle* ptcl JPA_DRAW_CTX_PARAM) {
|
void JPASetPointSize(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
||||||
GXSetPointSize((u8)(ptcl->mParticleScaleX * (25.0f * work->mGlobalPtclScl.x)), GX_TO_ONE);
|
GXSetPointSize((u8)(ptcl->mParticleScaleX * (25.0f * work->mGlobalPtclScl.x)), GX_TO_ONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JPASetLineWidth(JPAEmitterWorkData* work, JPABaseParticle* ptcl JPA_DRAW_CTX_PARAM) {
|
void JPASetLineWidth(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
||||||
GXSetLineWidth((u8)(ptcl->mParticleScaleX * (25.0f * work->mGlobalPtclScl.x)), GX_TO_ONE);
|
GXSetLineWidth((u8)(ptcl->mParticleScaleX * (25.0f * work->mGlobalPtclScl.x)), GX_TO_ONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JPARegistPrm(JPAEmitterWorkData* work) {
|
void JPARegistPrm(JPAEmitterWorkData* work) {
|
||||||
ZoneScoped;
|
|
||||||
JPABaseEmitter* emtr = work->mpEmtr;
|
JPABaseEmitter* emtr = work->mpEmtr;
|
||||||
GXColor prm = emtr->mPrmClr;
|
GXColor prm = emtr->mPrmClr;
|
||||||
prm.r = COLOR_MULTI(prm.r, emtr->mGlobalPrmClr.r);
|
prm.r = COLOR_MULTI(prm.r, emtr->mGlobalPrmClr.r);
|
||||||
@@ -69,7 +41,6 @@ void JPARegistPrm(JPAEmitterWorkData* work) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void JPARegistEnv(JPAEmitterWorkData* work) {
|
void JPARegistEnv(JPAEmitterWorkData* work) {
|
||||||
ZoneScoped;
|
|
||||||
JPABaseEmitter* emtr = work->mpEmtr;
|
JPABaseEmitter* emtr = work->mpEmtr;
|
||||||
GXColor env = emtr->mEnvClr;
|
GXColor env = emtr->mEnvClr;
|
||||||
env.r = COLOR_MULTI(env.r, emtr->mGlobalEnvClr.r);
|
env.r = COLOR_MULTI(env.r, emtr->mGlobalEnvClr.r);
|
||||||
@@ -79,7 +50,6 @@ void JPARegistEnv(JPAEmitterWorkData* work) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void JPARegistPrmEnv(JPAEmitterWorkData* work) {
|
void JPARegistPrmEnv(JPAEmitterWorkData* work) {
|
||||||
ZoneScoped;
|
|
||||||
JPABaseEmitter* emtr = work->mpEmtr;
|
JPABaseEmitter* emtr = work->mpEmtr;
|
||||||
GXColor prm = emtr->mPrmClr;
|
GXColor prm = emtr->mPrmClr;
|
||||||
GXColor env = emtr->mEnvClr;
|
GXColor env = emtr->mEnvClr;
|
||||||
@@ -94,8 +64,7 @@ void JPARegistPrmEnv(JPAEmitterWorkData* work) {
|
|||||||
GXSetTevColor(GX_TEVREG1, env);
|
GXSetTevColor(GX_TEVREG1, env);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JPARegistAlpha(JPAEmitterWorkData* work, JPABaseParticle* ptcl JPA_DRAW_CTX_PARAM) {
|
void JPARegistAlpha(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
||||||
ZoneScoped;
|
|
||||||
JPABaseEmitter* emtr = work->mpEmtr;
|
JPABaseEmitter* emtr = work->mpEmtr;
|
||||||
GXColor prm = emtr->mPrmClr;
|
GXColor prm = emtr->mPrmClr;
|
||||||
prm.r = COLOR_MULTI(prm.r, emtr->mGlobalPrmClr.r);
|
prm.r = COLOR_MULTI(prm.r, emtr->mGlobalPrmClr.r);
|
||||||
@@ -103,19 +72,10 @@ void JPARegistAlpha(JPAEmitterWorkData* work, JPABaseParticle* ptcl JPA_DRAW_CTX
|
|||||||
prm.b = COLOR_MULTI(prm.b, emtr->mGlobalPrmClr.b);
|
prm.b = COLOR_MULTI(prm.b, emtr->mGlobalPrmClr.b);
|
||||||
prm.a = COLOR_MULTI(prm.a, emtr->mGlobalPrmClr.a);
|
prm.a = COLOR_MULTI(prm.a, emtr->mGlobalPrmClr.a);
|
||||||
prm.a = COLOR_MULTI(prm.a, ptcl->mPrmColorAlphaAnm);
|
prm.a = COLOR_MULTI(prm.a, ptcl->mPrmColorAlphaAnm);
|
||||||
#if TARGET_PC
|
|
||||||
if (ctx->batch) {
|
|
||||||
ctx->clr0 = prm;
|
|
||||||
if (ctx->useClr1) {
|
|
||||||
ctx->clr1 = emitter_env_color(work);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
GXSetTevColor(GX_TEVREG0, prm);
|
GXSetTevColor(GX_TEVREG0, prm);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JPARegistPrmAlpha(JPAEmitterWorkData* work, JPABaseParticle* ptcl JPA_DRAW_CTX_PARAM) {
|
void JPARegistPrmAlpha(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
||||||
ZoneScoped;
|
ZoneScoped;
|
||||||
JPABaseEmitter* emtr = work->mpEmtr;
|
JPABaseEmitter* emtr = work->mpEmtr;
|
||||||
GXColor prm = ptcl->mPrmClr;
|
GXColor prm = ptcl->mPrmClr;
|
||||||
@@ -124,19 +84,10 @@ void JPARegistPrmAlpha(JPAEmitterWorkData* work, JPABaseParticle* ptcl JPA_DRAW_
|
|||||||
prm.b = COLOR_MULTI(prm.b, emtr->mGlobalPrmClr.b);
|
prm.b = COLOR_MULTI(prm.b, emtr->mGlobalPrmClr.b);
|
||||||
prm.a = COLOR_MULTI(prm.a, emtr->mGlobalPrmClr.a);
|
prm.a = COLOR_MULTI(prm.a, emtr->mGlobalPrmClr.a);
|
||||||
prm.a = COLOR_MULTI(prm.a, ptcl->mPrmColorAlphaAnm);
|
prm.a = COLOR_MULTI(prm.a, ptcl->mPrmColorAlphaAnm);
|
||||||
#if TARGET_PC
|
|
||||||
if (ctx->batch) {
|
|
||||||
ctx->clr0 = prm;
|
|
||||||
if (ctx->useClr1) {
|
|
||||||
ctx->clr1 = emitter_env_color(work);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
GXSetTevColor(GX_TEVREG0, prm);
|
GXSetTevColor(GX_TEVREG0, prm);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JPARegistPrmAlphaEnv(JPAEmitterWorkData* work, JPABaseParticle* ptcl JPA_DRAW_CTX_PARAM) {
|
void JPARegistPrmAlphaEnv(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
||||||
ZoneScoped;
|
ZoneScoped;
|
||||||
JPABaseEmitter* emtr = work->mpEmtr;
|
JPABaseEmitter* emtr = work->mpEmtr;
|
||||||
GXColor prm = ptcl->mPrmClr;
|
GXColor prm = ptcl->mPrmClr;
|
||||||
@@ -149,19 +100,11 @@ void JPARegistPrmAlphaEnv(JPAEmitterWorkData* work, JPABaseParticle* ptcl JPA_DR
|
|||||||
env.r = COLOR_MULTI(env.r, emtr->mGlobalEnvClr.r);
|
env.r = COLOR_MULTI(env.r, emtr->mGlobalEnvClr.r);
|
||||||
env.g = COLOR_MULTI(env.g, emtr->mGlobalEnvClr.g);
|
env.g = COLOR_MULTI(env.g, emtr->mGlobalEnvClr.g);
|
||||||
env.b = COLOR_MULTI(env.b, emtr->mGlobalEnvClr.b);
|
env.b = COLOR_MULTI(env.b, emtr->mGlobalEnvClr.b);
|
||||||
#if TARGET_PC
|
|
||||||
if (ctx->batch) {
|
|
||||||
ctx->clr0 = prm;
|
|
||||||
ctx->clr1 = env;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
GXSetTevColor(GX_TEVREG0, prm);
|
GXSetTevColor(GX_TEVREG0, prm);
|
||||||
GXSetTevColor(GX_TEVREG1, env);
|
GXSetTevColor(GX_TEVREG1, env);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JPARegistAlphaEnv(JPAEmitterWorkData* work, JPABaseParticle* ptcl JPA_DRAW_CTX_PARAM) {
|
void JPARegistAlphaEnv(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
||||||
ZoneScoped;
|
|
||||||
JPABaseEmitter* emtr = work->mpEmtr;
|
JPABaseEmitter* emtr = work->mpEmtr;
|
||||||
GXColor prm = emtr->mPrmClr;
|
GXColor prm = emtr->mPrmClr;
|
||||||
GXColor env = ptcl->mEnvClr;
|
GXColor env = ptcl->mEnvClr;
|
||||||
@@ -173,31 +116,16 @@ void JPARegistAlphaEnv(JPAEmitterWorkData* work, JPABaseParticle* ptcl JPA_DRAW_
|
|||||||
env.r = COLOR_MULTI(env.r, emtr->mGlobalEnvClr.r);
|
env.r = COLOR_MULTI(env.r, emtr->mGlobalEnvClr.r);
|
||||||
env.g = COLOR_MULTI(env.g, emtr->mGlobalEnvClr.g);
|
env.g = COLOR_MULTI(env.g, emtr->mGlobalEnvClr.g);
|
||||||
env.b = COLOR_MULTI(env.b, emtr->mGlobalEnvClr.b);
|
env.b = COLOR_MULTI(env.b, emtr->mGlobalEnvClr.b);
|
||||||
#if TARGET_PC
|
|
||||||
if (ctx->batch) {
|
|
||||||
ctx->clr0 = prm;
|
|
||||||
ctx->clr1 = env;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
GXSetTevColor(GX_TEVREG0, prm);
|
GXSetTevColor(GX_TEVREG0, prm);
|
||||||
GXSetTevColor(GX_TEVREG1, env);
|
GXSetTevColor(GX_TEVREG1, env);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JPARegistEnv(JPAEmitterWorkData* work, JPABaseParticle* ptcl JPA_DRAW_CTX_PARAM) {
|
void JPARegistEnv(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
||||||
ZoneScoped;
|
|
||||||
JPABaseEmitter* emtr = work->mpEmtr;
|
JPABaseEmitter* emtr = work->mpEmtr;
|
||||||
GXColor env = ptcl->mEnvClr;
|
GXColor env = ptcl->mEnvClr;
|
||||||
env.r = COLOR_MULTI(env.r, emtr->mGlobalEnvClr.r);
|
env.r = COLOR_MULTI(env.r, emtr->mGlobalEnvClr.r);
|
||||||
env.g = COLOR_MULTI(env.g, emtr->mGlobalEnvClr.g);
|
env.g = COLOR_MULTI(env.g, emtr->mGlobalEnvClr.g);
|
||||||
env.b = COLOR_MULTI(env.b, emtr->mGlobalEnvClr.b);
|
env.b = COLOR_MULTI(env.b, emtr->mGlobalEnvClr.b);
|
||||||
#if TARGET_PC
|
|
||||||
if (ctx->batch) {
|
|
||||||
ctx->clr0 = emitter_prm_color(work);
|
|
||||||
ctx->clr1 = env;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
GXSetTevColor(GX_TEVREG1, env);
|
GXSetTevColor(GX_TEVREG1, env);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -330,7 +258,7 @@ void JPAGenCalcTexCrdMtxAnm(JPAEmitterWorkData* work) {
|
|||||||
GXSetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_TEXMTX0);
|
GXSetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_TEXMTX0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JPALoadCalcTexCrdMtxAnm(JPAEmitterWorkData* work, JPABaseParticle* param_1 JPA_DRAW_CTX_PARAM) {
|
void JPALoadCalcTexCrdMtxAnm(JPAEmitterWorkData* work, JPABaseParticle* param_1) {
|
||||||
ZoneScoped;
|
ZoneScoped;
|
||||||
JPABaseShape* shape = work->mpRes->getBsp();
|
JPABaseShape* shape = work->mpRes->getBsp();
|
||||||
f32 dVar16 = param_1->mAge;
|
f32 dVar16 = param_1->mAge;
|
||||||
@@ -358,12 +286,6 @@ void JPALoadCalcTexCrdMtxAnm(JPAEmitterWorkData* work, JPABaseParticle* param_1
|
|||||||
local_108[2][1] = 0.0f;
|
local_108[2][1] = 0.0f;
|
||||||
local_108[2][2] = 1.0f;
|
local_108[2][2] = 1.0f;
|
||||||
local_108[2][3] = 0.0f;
|
local_108[2][3] = 0.0f;
|
||||||
#if TARGET_PC
|
|
||||||
if (ctx->batch) {
|
|
||||||
MTXCopy(local_108, ctx->texMtx);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
GXLoadTexMtxImm(local_108, 0x1e, GX_MTX2x4);
|
GXLoadTexMtxImm(local_108, 0x1e, GX_MTX2x4);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -377,7 +299,7 @@ void JPALoadTexAnm(JPAEmitterWorkData* work) {
|
|||||||
work->mpResMgr->load(work->mpRes->getTexIdx(work->mpEmtr->mTexAnmIdx), GX_TEXMAP0);
|
work->mpResMgr->load(work->mpRes->getTexIdx(work->mpEmtr->mTexAnmIdx), GX_TEXMAP0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JPALoadTexAnm(JPAEmitterWorkData* work, JPABaseParticle* ptcl JPA_DRAW_CTX_PARAM) {
|
void JPALoadTexAnm(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
||||||
ZoneScoped;
|
ZoneScoped;
|
||||||
work->mpResMgr->load(work->mpRes->getTexIdx(ptcl->mTexAnmIdx), GX_TEXMAP0);
|
work->mpResMgr->load(work->mpRes->getTexIdx(ptcl->mTexAnmIdx), GX_TEXMAP0);
|
||||||
}
|
}
|
||||||
@@ -507,47 +429,6 @@ static projectionFunc p_prj[3] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#if TARGET_PC
|
#if TARGET_PC
|
||||||
static void emit_batch_quad(JPAEmitterWorkData* work, const ParticleDrawCtx* ctx,
|
|
||||||
const Mtx posMtx) {
|
|
||||||
const JPAResource::BatchInfo& info = work->mpRes->mBatchInfo;
|
|
||||||
|
|
||||||
for (int i = 0; i < info.vtxCount; i++) {
|
|
||||||
Vec localPos = {info.vtxPos[i][0], info.vtxPos[i][1], info.vtxPos[i][2]};
|
|
||||||
Vec drawPos;
|
|
||||||
MTXMultVec(posMtx, &localPos, &drawPos);
|
|
||||||
|
|
||||||
f32 texS = info.vtxUv[i][0];
|
|
||||||
f32 texT = info.vtxUv[i][1];
|
|
||||||
if (ctx->useTexMtx) {
|
|
||||||
f32 srcS = texS;
|
|
||||||
f32 srcT = texT;
|
|
||||||
texS = ctx->texMtx[0][0] * srcS + ctx->texMtx[0][1] * srcT + ctx->texMtx[0][3];
|
|
||||||
texT = ctx->texMtx[1][0] * srcS + ctx->texMtx[1][1] * srcT + ctx->texMtx[1][3];
|
|
||||||
}
|
|
||||||
|
|
||||||
GXPosition3f32(drawPos.x, drawPos.y, drawPos.z);
|
|
||||||
if (ctx->useClr0) {
|
|
||||||
GXColor4u8(ctx->clr0.r, ctx->clr0.g, ctx->clr0.b, ctx->clr0.a);
|
|
||||||
}
|
|
||||||
if (ctx->useClr1) {
|
|
||||||
GXColor4u8(ctx->clr1.r, ctx->clr1.g, ctx->clr1.b, ctx->clr1.a);
|
|
||||||
}
|
|
||||||
GXTexCoord2f32(texS, texT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void submit_particle_quad(
|
|
||||||
JPAEmitterWorkData* work, ParticleDrawCtx* ctx, const Mtx posMtx, const u8* dl, u32 dlSize) {
|
|
||||||
if (ctx->batch) {
|
|
||||||
emit_batch_quad(work, ctx, posMtx);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
GXLoadPosMtxImm(posMtx, GX_PNMTX0);
|
|
||||||
p_prj[work->mPrjType](work, posMtx);
|
|
||||||
GXCallDisplayList(dl, dlSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
void JPAInterpBillboard(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
void JPAInterpBillboard(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
||||||
Mtx ptclPosMtx;
|
Mtx ptclPosMtx;
|
||||||
MTXTrans(ptclPosMtx, ptcl->mPosition.x, ptcl->mPosition.y, ptcl->mPosition.z);
|
MTXTrans(ptclPosMtx, ptcl->mPosition.x, ptcl->mPosition.y, ptcl->mPosition.z);
|
||||||
@@ -567,7 +448,7 @@ void JPAInterpRotBillboard(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void JPADrawBillboard(JPAEmitterWorkData* work, JPABaseParticle* ptcl JPA_DRAW_CTX_PARAM) {
|
void JPADrawBillboard(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
||||||
if (ptcl->checkStatus(JPAPtclStts_Invisible)) {
|
if (ptcl->checkStatus(JPAPtclStts_Invisible)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -592,16 +473,12 @@ void JPADrawBillboard(JPAEmitterWorkData* work, JPABaseParticle* ptcl JPA_DRAW_C
|
|||||||
posMtx[2][2] = 1.0f;
|
posMtx[2][2] = 1.0f;
|
||||||
posMtx[2][3] = pos.z;
|
posMtx[2][3] = pos.z;
|
||||||
posMtx[0][1] = posMtx[0][2] = posMtx[1][0] = posMtx[1][2] = posMtx[2][0] = posMtx[2][1] = 0.0f;
|
posMtx[0][1] = posMtx[0][2] = posMtx[1][0] = posMtx[1][2] = posMtx[2][0] = posMtx[2][1] = 0.0f;
|
||||||
#if TARGET_PC
|
|
||||||
submit_particle_quad(work, ctx, posMtx, jpa_dl, sizeof(jpa_dl));
|
|
||||||
#else
|
|
||||||
GXLoadPosMtxImm(posMtx, GX_PNMTX0);
|
GXLoadPosMtxImm(posMtx, GX_PNMTX0);
|
||||||
p_prj[work->mPrjType](work, posMtx);
|
p_prj[work->mPrjType](work, posMtx);
|
||||||
GXCallDisplayList(jpa_dl, sizeof(jpa_dl));
|
GXCallDisplayList(jpa_dl, sizeof(jpa_dl));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void JPADrawRotBillboard(JPAEmitterWorkData* work, JPABaseParticle* ptcl JPA_DRAW_CTX_PARAM) {
|
void JPADrawRotBillboard(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
||||||
if (ptcl->checkStatus(JPAPtclStts_Invisible)) {
|
if (ptcl->checkStatus(JPAPtclStts_Invisible)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -640,16 +517,12 @@ void JPADrawRotBillboard(JPAEmitterWorkData* work, JPABaseParticle* ptcl JPA_DRA
|
|||||||
posMtx[2][2] = 1.0f;
|
posMtx[2][2] = 1.0f;
|
||||||
posMtx[2][3] = pos.z;
|
posMtx[2][3] = pos.z;
|
||||||
posMtx[0][2] = posMtx[1][2] = posMtx[2][0] = posMtx[2][1] = 0.0f;
|
posMtx[0][2] = posMtx[1][2] = posMtx[2][0] = posMtx[2][1] = 0.0f;
|
||||||
#if TARGET_PC
|
|
||||||
submit_particle_quad(work, ctx, posMtx, jpa_dl, sizeof(jpa_dl));
|
|
||||||
#else
|
|
||||||
GXLoadPosMtxImm(posMtx, GX_PNMTX0);
|
GXLoadPosMtxImm(posMtx, GX_PNMTX0);
|
||||||
p_prj[work->mPrjType](work, posMtx);
|
p_prj[work->mPrjType](work, posMtx);
|
||||||
GXCallDisplayList(jpa_dl, sizeof(jpa_dl));
|
GXCallDisplayList(jpa_dl, sizeof(jpa_dl));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void JPADrawYBillboard(JPAEmitterWorkData* work, JPABaseParticle* param_1 JPA_DRAW_CTX_PARAM) {
|
void JPADrawYBillboard(JPAEmitterWorkData* work, JPABaseParticle* param_1) {
|
||||||
if (param_1->checkStatus(JPAPtclStts_Invisible)) {
|
if (param_1->checkStatus(JPAPtclStts_Invisible)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -669,16 +542,12 @@ void JPADrawYBillboard(JPAEmitterWorkData* work, JPABaseParticle* param_1 JPA_DR
|
|||||||
local_38[2][2] = work->mYBBCamMtx[2][2];
|
local_38[2][2] = work->mYBBCamMtx[2][2];
|
||||||
local_38[2][3] = local_48.z;
|
local_38[2][3] = local_48.z;
|
||||||
local_38[0][1] = local_38[0][2] = local_38[1][0] = local_38[2][0] = 0.0f;
|
local_38[0][1] = local_38[0][2] = local_38[1][0] = local_38[2][0] = 0.0f;
|
||||||
#if TARGET_PC
|
|
||||||
submit_particle_quad(work, ctx, local_38, jpa_dl, sizeof(jpa_dl));
|
|
||||||
#else
|
|
||||||
GXLoadPosMtxImm(local_38, GX_PNMTX0);
|
GXLoadPosMtxImm(local_38, GX_PNMTX0);
|
||||||
p_prj[work->mPrjType](work, local_38);
|
p_prj[work->mPrjType](work, local_38);
|
||||||
GXCallDisplayList(jpa_dl, sizeof(jpa_dl));
|
GXCallDisplayList(jpa_dl, sizeof(jpa_dl));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void JPADrawRotYBillboard(JPAEmitterWorkData* work, JPABaseParticle* param_1 JPA_DRAW_CTX_PARAM) {
|
void JPADrawRotYBillboard(JPAEmitterWorkData* work, JPABaseParticle* param_1) {
|
||||||
if (param_1->checkStatus(JPAPtclStts_Invisible)) {
|
if (param_1->checkStatus(JPAPtclStts_Invisible)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -707,13 +576,9 @@ void JPADrawRotYBillboard(JPAEmitterWorkData* work, JPABaseParticle* param_1 JPA
|
|||||||
local_38[2][1] = local_94 * fVar1;
|
local_38[2][1] = local_94 * fVar1;
|
||||||
local_38[2][2] = local_90;
|
local_38[2][2] = local_90;
|
||||||
local_38[2][3] = local_48.z;
|
local_38[2][3] = local_48.z;
|
||||||
#if TARGET_PC
|
|
||||||
submit_particle_quad(work, ctx, local_38, jpa_dl, sizeof(jpa_dl));
|
|
||||||
#else
|
|
||||||
GXLoadPosMtxImm(local_38, GX_PNMTX0);
|
GXLoadPosMtxImm(local_38, GX_PNMTX0);
|
||||||
p_prj[work->mPrjType](work, local_38);
|
p_prj[work->mPrjType](work, local_38);
|
||||||
GXCallDisplayList(jpa_dl, sizeof(jpa_dl));
|
GXCallDisplayList(jpa_dl, sizeof(jpa_dl));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void dirTypeVel(JPAEmitterWorkData const* work, JPABaseParticle const* param_1,
|
void dirTypeVel(JPAEmitterWorkData const* work, JPABaseParticle const* param_1,
|
||||||
@@ -876,88 +741,6 @@ static u8* p_dl[2] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#if TARGET_PC
|
#if TARGET_PC
|
||||||
static bool make_direction_mtx(JPAEmitterWorkData* work, JPABaseParticle* ptcl, Mtx posMtx) {
|
|
||||||
JGeometry::TVec3<f32> axisY;
|
|
||||||
JGeometry::TVec3<f32> axisZ;
|
|
||||||
JGeometry::TVec3<f32> baseAxis(ptcl->mBaseAxis);
|
|
||||||
p_direction[work->mDirType](work, ptcl, &axisY);
|
|
||||||
if (axisY.isZero()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
axisY.normalize();
|
|
||||||
axisZ.cross(baseAxis, axisY);
|
|
||||||
if (axisZ.isZero()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
axisZ.normalize();
|
|
||||||
baseAxis.cross(axisY, axisZ);
|
|
||||||
baseAxis.normalize();
|
|
||||||
ptcl->mBaseAxis.set(baseAxis);
|
|
||||||
|
|
||||||
f32 scaleX = work->mGlobalPtclScl.x * ptcl->mParticleScaleX;
|
|
||||||
f32 scaleY = work->mGlobalPtclScl.y * ptcl->mParticleScaleY;
|
|
||||||
posMtx[0][0] = baseAxis.x;
|
|
||||||
posMtx[0][1] = axisY.x;
|
|
||||||
posMtx[0][2] = axisZ.x;
|
|
||||||
posMtx[0][3] = ptcl->mPosition.x;
|
|
||||||
posMtx[1][0] = baseAxis.y;
|
|
||||||
posMtx[1][1] = axisY.y;
|
|
||||||
posMtx[1][2] = axisZ.y;
|
|
||||||
posMtx[1][3] = ptcl->mPosition.y;
|
|
||||||
posMtx[2][0] = baseAxis.z;
|
|
||||||
posMtx[2][1] = axisY.z;
|
|
||||||
posMtx[2][2] = axisZ.z;
|
|
||||||
posMtx[2][3] = ptcl->mPosition.z;
|
|
||||||
p_plane[work->mPlaneType](posMtx, scaleX, scaleY);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool make_rot_direction_mtx(JPAEmitterWorkData* work, JPABaseParticle* ptcl, Mtx posMtx) {
|
|
||||||
f32 sinRot = JMASSin(ptcl->mRotateAngle);
|
|
||||||
f32 cosRot = JMASCos(ptcl->mRotateAngle);
|
|
||||||
JGeometry::TVec3<f32> axisY;
|
|
||||||
JGeometry::TVec3<f32> axisZ;
|
|
||||||
JGeometry::TVec3<f32> baseAxis(ptcl->mBaseAxis);
|
|
||||||
p_direction[work->mDirType](work, ptcl, &axisY);
|
|
||||||
if (axisY.isZero()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
axisY.normalize();
|
|
||||||
axisZ.cross(baseAxis, axisY);
|
|
||||||
if (axisZ.isZero()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
axisZ.normalize();
|
|
||||||
baseAxis.cross(axisY, axisZ);
|
|
||||||
baseAxis.normalize();
|
|
||||||
ptcl->mBaseAxis.set(baseAxis);
|
|
||||||
|
|
||||||
f32 scaleX = work->mGlobalPtclScl.x * ptcl->mParticleScaleX;
|
|
||||||
f32 scaleY = work->mGlobalPtclScl.y * ptcl->mParticleScaleY;
|
|
||||||
Mtx rotMtx;
|
|
||||||
Mtx dirMtx;
|
|
||||||
p_rot[work->mRotType](sinRot, cosRot, rotMtx);
|
|
||||||
p_plane[work->mPlaneType](rotMtx, scaleX, scaleY);
|
|
||||||
dirMtx[0][0] = baseAxis.x;
|
|
||||||
dirMtx[0][1] = axisY.x;
|
|
||||||
dirMtx[0][2] = axisZ.x;
|
|
||||||
dirMtx[0][3] = ptcl->mPosition.x;
|
|
||||||
dirMtx[1][0] = baseAxis.y;
|
|
||||||
dirMtx[1][1] = axisY.y;
|
|
||||||
dirMtx[1][2] = axisZ.y;
|
|
||||||
dirMtx[1][3] = ptcl->mPosition.y;
|
|
||||||
dirMtx[2][0] = baseAxis.z;
|
|
||||||
dirMtx[2][1] = axisY.z;
|
|
||||||
dirMtx[2][2] = axisZ.z;
|
|
||||||
dirMtx[2][3] = ptcl->mPosition.z;
|
|
||||||
MTXConcat(dirMtx, rotMtx, posMtx);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void JPAInterpDirection(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
void JPAInterpDirection(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
||||||
JGeometry::TVec3<f32> axisY;
|
JGeometry::TVec3<f32> axisY;
|
||||||
JGeometry::TVec3<f32> axisZ;
|
JGeometry::TVec3<f32> axisZ;
|
||||||
@@ -1040,7 +823,7 @@ void JPAInterpRotDirection(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void JPADrawDirection(JPAEmitterWorkData* work, JPABaseParticle* ptcl JPA_DRAW_CTX_PARAM) {
|
void JPADrawDirection(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
||||||
if (ptcl->checkStatus(JPAPtclStts_Invisible)) {
|
if (ptcl->checkStatus(JPAPtclStts_Invisible)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1049,12 +832,8 @@ void JPADrawDirection(JPAEmitterWorkData* work, JPABaseParticle* ptcl JPA_DRAW_C
|
|||||||
|
|
||||||
Mtx posMtx;
|
Mtx posMtx;
|
||||||
#if TARGET_PC
|
#if TARGET_PC
|
||||||
if (!dusk::frame_interp::lookup_replacement(ptcl, posMtx) &&
|
if (!dusk::frame_interp::lookup_replacement(ptcl, posMtx))
|
||||||
!make_direction_mtx(work, ptcl, posMtx))
|
#endif
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
{
|
{
|
||||||
JGeometry::TVec3<f32> axisY;
|
JGeometry::TVec3<f32> axisY;
|
||||||
JGeometry::TVec3<f32> axisZ;
|
JGeometry::TVec3<f32> axisZ;
|
||||||
@@ -1090,19 +869,14 @@ void JPADrawDirection(JPAEmitterWorkData* work, JPABaseParticle* ptcl JPA_DRAW_C
|
|||||||
posMtx[2][3] = ptcl->mPosition.z;
|
posMtx[2][3] = ptcl->mPosition.z;
|
||||||
p_plane[work->mPlaneType](posMtx, scaleX, scaleY);
|
p_plane[work->mPlaneType](posMtx, scaleX, scaleY);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
MTXConcat(work->mPosCamMtx, posMtx, posMtx);
|
MTXConcat(work->mPosCamMtx, posMtx, posMtx);
|
||||||
#if TARGET_PC
|
|
||||||
submit_particle_quad(work, ctx, posMtx, p_dl[work->mDLType], sizeof(jpa_dl));
|
|
||||||
#else
|
|
||||||
GXLoadPosMtxImm(posMtx, GX_PNMTX0);
|
GXLoadPosMtxImm(posMtx, GX_PNMTX0);
|
||||||
p_prj[work->mPrjType](work, posMtx);
|
p_prj[work->mPrjType](work, posMtx);
|
||||||
GXCallDisplayList(p_dl[work->mDLType], sizeof(jpa_dl));
|
GXCallDisplayList(p_dl[work->mDLType], sizeof(jpa_dl));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void JPADrawRotDirection(JPAEmitterWorkData* work, JPABaseParticle* ptcl JPA_DRAW_CTX_PARAM) {
|
void JPADrawRotDirection(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
||||||
if (ptcl->checkStatus(JPAPtclStts_Invisible)) {
|
if (ptcl->checkStatus(JPAPtclStts_Invisible)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1112,12 +886,8 @@ void JPADrawRotDirection(JPAEmitterWorkData* work, JPABaseParticle* ptcl JPA_DRA
|
|||||||
Mtx mtx1;
|
Mtx mtx1;
|
||||||
Mtx mtx2;
|
Mtx mtx2;
|
||||||
#if TARGET_PC
|
#if TARGET_PC
|
||||||
if (!dusk::frame_interp::lookup_replacement(ptcl, mtx1) &&
|
if (!dusk::frame_interp::lookup_replacement(ptcl, mtx1))
|
||||||
!make_rot_direction_mtx(work, ptcl, mtx1))
|
#endif
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
{
|
{
|
||||||
f32 sinRot = JMASSin(ptcl->mRotateAngle);
|
f32 sinRot = JMASSin(ptcl->mRotateAngle);
|
||||||
f32 cosRot = JMASCos(ptcl->mRotateAngle);
|
f32 cosRot = JMASCos(ptcl->mRotateAngle);
|
||||||
@@ -1157,18 +927,13 @@ void JPADrawRotDirection(JPAEmitterWorkData* work, JPABaseParticle* ptcl JPA_DRA
|
|||||||
mtx2[2][3] = ptcl->mPosition.z;
|
mtx2[2][3] = ptcl->mPosition.z;
|
||||||
MTXConcat(mtx2, mtx1, mtx1);
|
MTXConcat(mtx2, mtx1, mtx1);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
MTXConcat(work->mPosCamMtx, mtx1, mtx2);
|
MTXConcat(work->mPosCamMtx, mtx1, mtx2);
|
||||||
#if TARGET_PC
|
|
||||||
submit_particle_quad(work, ctx, mtx2, p_dl[work->mDLType], sizeof(jpa_dl));
|
|
||||||
#else
|
|
||||||
GXLoadPosMtxImm(mtx2, GX_PNMTX0);
|
GXLoadPosMtxImm(mtx2, GX_PNMTX0);
|
||||||
p_prj[work->mPrjType](work, mtx2);
|
p_prj[work->mPrjType](work, mtx2);
|
||||||
GXCallDisplayList(p_dl[work->mDLType], sizeof(jpa_dl));
|
GXCallDisplayList(p_dl[work->mDLType], sizeof(jpa_dl));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void JPADrawDBillboard(JPAEmitterWorkData* param_0, JPABaseParticle* param_1 JPA_DRAW_CTX_PARAM) {
|
void JPADrawDBillboard(JPAEmitterWorkData* param_0, JPABaseParticle* param_1) {
|
||||||
if (param_1->checkStatus(JPAPtclStts_Invisible)) {
|
if (param_1->checkStatus(JPAPtclStts_Invisible)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1205,7 +970,7 @@ void JPADrawDBillboard(JPAEmitterWorkData* param_0, JPABaseParticle* param_1 JPA
|
|||||||
GXCallDisplayList(jpa_dl, sizeof(jpa_dl));
|
GXCallDisplayList(jpa_dl, sizeof(jpa_dl));
|
||||||
}
|
}
|
||||||
|
|
||||||
void JPADrawRotation(JPAEmitterWorkData* param_0, JPABaseParticle* param_1 JPA_DRAW_CTX_PARAM) {
|
void JPADrawRotation(JPAEmitterWorkData* param_0, JPABaseParticle* param_1) {
|
||||||
if (param_1->checkStatus(JPAPtclStts_Invisible)) {
|
if (param_1->checkStatus(JPAPtclStts_Invisible)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1223,16 +988,12 @@ void JPADrawRotation(JPAEmitterWorkData* param_0, JPABaseParticle* param_1 JPA_D
|
|||||||
auStack_88[1][3] = param_1->mPosition.y;
|
auStack_88[1][3] = param_1->mPosition.y;
|
||||||
auStack_88[2][3] = param_1->mPosition.z;
|
auStack_88[2][3] = param_1->mPosition.z;
|
||||||
MTXConcat(param_0->mPosCamMtx, auStack_88, auStack_88);
|
MTXConcat(param_0->mPosCamMtx, auStack_88, auStack_88);
|
||||||
#if TARGET_PC
|
|
||||||
submit_particle_quad(param_0, ctx, auStack_88, p_dl[param_0->mDLType], sizeof(jpa_dl));
|
|
||||||
#else
|
|
||||||
GXLoadPosMtxImm(auStack_88, 0);
|
GXLoadPosMtxImm(auStack_88, 0);
|
||||||
p_prj[param_0->mPrjType](param_0, auStack_88);
|
p_prj[param_0->mPrjType](param_0, auStack_88);
|
||||||
GXCallDisplayList(p_dl[param_0->mDLType], sizeof(jpa_dl));
|
GXCallDisplayList(p_dl[param_0->mDLType], sizeof(jpa_dl));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void JPADrawPoint(JPAEmitterWorkData* work, JPABaseParticle* ptcl JPA_DRAW_CTX_PARAM) {
|
void JPADrawPoint(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
||||||
if (ptcl->checkStatus(JPAPtclStts_Invisible)) {
|
if (ptcl->checkStatus(JPAPtclStts_Invisible)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1249,7 +1010,7 @@ void JPADrawPoint(JPAEmitterWorkData* work, JPABaseParticle* ptcl JPA_DRAW_CTX_P
|
|||||||
GXSetVtxDesc(GX_VA_TEX0, GX_INDEX8);
|
GXSetVtxDesc(GX_VA_TEX0, GX_INDEX8);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JPADrawLine(JPAEmitterWorkData* param_0, JPABaseParticle* param_1 JPA_DRAW_CTX_PARAM) {
|
void JPADrawLine(JPAEmitterWorkData* param_0, JPABaseParticle* param_1) {
|
||||||
if (param_1->checkStatus(JPAPtclStts_Invisible)) {
|
if (param_1->checkStatus(JPAPtclStts_Invisible)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1325,7 +1086,7 @@ void JPADrawStripe(JPAEmitterWorkData* param_0) {
|
|||||||
GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
|
GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
|
||||||
GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT);
|
GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT);
|
||||||
GXBegin(GX_TRIANGLESTRIP, GX_VTXFMT1, ptcl_num << 1);
|
GXBegin(GX_TRIANGLESTRIP, GX_VTXFMT1, ptcl_num << 1);
|
||||||
for (JPANode<JPABaseParticle>* node = startNode; node != param_0->mpAlivePtcl->getEnd();
|
for (JPANode<JPABaseParticle>* node = startNode; node != param_0->mpAlivePtcl->getEnd();
|
||||||
node = node_func(node), coord += step) {
|
node = node_func(node), coord += step) {
|
||||||
param_0->mpCurNode = node;
|
param_0->mpCurNode = node;
|
||||||
JPABaseParticle* particle = node->getObject();
|
JPABaseParticle* particle = node->getObject();
|
||||||
@@ -1350,7 +1111,7 @@ void JPADrawStripe(JPAEmitterWorkData* param_0) {
|
|||||||
}
|
}
|
||||||
particle->mBaseAxis.cross(local_f8, local_104);
|
particle->mBaseAxis.cross(local_f8, local_104);
|
||||||
particle->mBaseAxis.normalize();
|
particle->mBaseAxis.normalize();
|
||||||
|
|
||||||
local_c8[0][0] = local_104.x;
|
local_c8[0][0] = local_104.x;
|
||||||
local_c8[0][1] = local_f8.x;
|
local_c8[0][1] = local_f8.x;
|
||||||
local_c8[0][2] = particle->mBaseAxis.x;
|
local_c8[0][2] = particle->mBaseAxis.x;
|
||||||
@@ -1416,7 +1177,7 @@ void JPADrawStripeX(JPAEmitterWorkData* param_0) {
|
|||||||
GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
|
GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
|
||||||
GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT);
|
GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT);
|
||||||
GXBegin(GX_TRIANGLESTRIP, GX_VTXFMT1, ptcl_num << 1);
|
GXBegin(GX_TRIANGLESTRIP, GX_VTXFMT1, ptcl_num << 1);
|
||||||
for (JPANode<JPABaseParticle>* node = startNode; node != param_0->mpAlivePtcl->getEnd();
|
for (JPANode<JPABaseParticle>* node = startNode; node != param_0->mpAlivePtcl->getEnd();
|
||||||
node = node_func(node), coord += step) {
|
node = node_func(node), coord += step) {
|
||||||
param_0->mpCurNode = node;
|
param_0->mpCurNode = node;
|
||||||
JPABaseParticle* particle = node->getObject();
|
JPABaseParticle* particle = node->getObject();
|
||||||
@@ -1441,7 +1202,7 @@ void JPADrawStripeX(JPAEmitterWorkData* param_0) {
|
|||||||
}
|
}
|
||||||
particle->mBaseAxis.cross(local_c0, local_cc);
|
particle->mBaseAxis.cross(local_c0, local_cc);
|
||||||
particle->mBaseAxis.normalize();
|
particle->mBaseAxis.normalize();
|
||||||
|
|
||||||
local_90[0][0] = local_cc.x;
|
local_90[0][0] = local_cc.x;
|
||||||
local_90[0][1] = local_c0.x;
|
local_90[0][1] = local_c0.x;
|
||||||
local_90[0][2] = particle->mBaseAxis.x;
|
local_90[0][2] = particle->mBaseAxis.x;
|
||||||
@@ -1466,7 +1227,7 @@ void JPADrawStripeX(JPAEmitterWorkData* param_0) {
|
|||||||
|
|
||||||
coord = start_coord;
|
coord = start_coord;
|
||||||
GXBegin(GX_TRIANGLESTRIP, GX_VTXFMT1, ptcl_num << 1);
|
GXBegin(GX_TRIANGLESTRIP, GX_VTXFMT1, ptcl_num << 1);
|
||||||
for (JPANode<JPABaseParticle>* node = startNode; node != param_0->mpAlivePtcl->getEnd();
|
for (JPANode<JPABaseParticle>* node = startNode; node != param_0->mpAlivePtcl->getEnd();
|
||||||
node = node_func(node), coord += step) {
|
node = node_func(node), coord += step) {
|
||||||
param_0->mpCurNode = node;
|
param_0->mpCurNode = node;
|
||||||
JPABaseParticle* particle = node->getObject();
|
JPABaseParticle* particle = node->getObject();
|
||||||
@@ -1491,7 +1252,7 @@ void JPADrawStripeX(JPAEmitterWorkData* param_0) {
|
|||||||
}
|
}
|
||||||
particle->mBaseAxis.cross(local_c0, local_cc);
|
particle->mBaseAxis.cross(local_c0, local_cc);
|
||||||
particle->mBaseAxis.normalize();
|
particle->mBaseAxis.normalize();
|
||||||
|
|
||||||
local_90[0][0] = local_cc.x;
|
local_90[0][0] = local_cc.x;
|
||||||
local_90[0][1] = local_c0.x;
|
local_90[0][1] = local_c0.x;
|
||||||
local_90[0][2] = particle->mBaseAxis.x;
|
local_90[0][2] = particle->mBaseAxis.x;
|
||||||
@@ -1528,7 +1289,7 @@ void JPADrawEmitterCallBackB(JPAEmitterWorkData* work) {
|
|||||||
emtr->mpEmtrCallBack->draw(emtr);
|
emtr->mpEmtrCallBack->draw(emtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JPADrawParticleCallBack(JPAEmitterWorkData* work, JPABaseParticle* ptcl JPA_DRAW_CTX_PARAM) {
|
void JPADrawParticleCallBack(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
||||||
JPABaseEmitter* emtr = work->mpEmtr;
|
JPABaseEmitter* emtr = work->mpEmtr;
|
||||||
if (emtr->mpPtclCallBack == NULL) {
|
if (emtr->mpPtclCallBack == NULL) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -206,7 +206,8 @@ void JPABaseParticle::init_c(JPAEmitterWorkData* work, JPABaseParticle* parent)
|
|||||||
|
|
||||||
#if TARGET_PC
|
#if TARGET_PC
|
||||||
void JPABaseParticle::interp(JPAEmitterWorkData* work, void const* drawFunc) {
|
void JPABaseParticle::interp(JPAEmitterWorkData* work, void const* drawFunc) {
|
||||||
if (!dusk::frame_interp::is_enabled())
|
static bool enable = false;
|
||||||
|
if (!enable)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// don't interpolate the first frame
|
// don't interpolate the first frame
|
||||||
|
|||||||
@@ -18,21 +18,9 @@
|
|||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "tracy/Tracy.hpp"
|
#include "tracy/Tracy.hpp"
|
||||||
|
|
||||||
#if TARGET_PC
|
|
||||||
#define JPA_DRAW_CTX_ARG , &ctx
|
|
||||||
#else
|
|
||||||
#define JPA_DRAW_CTX_ARG
|
|
||||||
#endif
|
|
||||||
|
|
||||||
JPAResource::JPAResource() {
|
JPAResource::JPAResource() {
|
||||||
mpCalcEmitterFuncList = mpDrawEmitterFuncList = mpDrawEmitterChildFuncList = NULL;
|
mpCalcEmitterFuncList = mpDrawEmitterFuncList = mpDrawEmitterChildFuncList = NULL;
|
||||||
#if TARGET_PC
|
|
||||||
mpCalcParticleFuncList = mpCalcParticleChildFuncList = NULL;
|
|
||||||
mpDrawParticleFuncList = mpDrawParticleChildFuncList = NULL;
|
|
||||||
mBatchInfo = {};
|
|
||||||
#else
|
|
||||||
mpCalcParticleFuncList = mpDrawParticleFuncList = mpCalcParticleChildFuncList = mpDrawParticleChildFuncList = NULL;
|
mpCalcParticleFuncList = mpDrawParticleFuncList = mpCalcParticleChildFuncList = mpDrawParticleChildFuncList = NULL;
|
||||||
#endif
|
|
||||||
pBsp = NULL;
|
pBsp = NULL;
|
||||||
pEsp = NULL;
|
pEsp = NULL;
|
||||||
pCsp = NULL;
|
pCsp = NULL;
|
||||||
@@ -73,60 +61,6 @@ static u8 jpa_crd[32] ATTRIBUTE_ALIGN(32) = {
|
|||||||
0x00, 0x00, 0x01, 0x00, 0x01, 0x02, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x02, 0x02, 0x00, 0x02,
|
0x00, 0x00, 0x01, 0x00, 0x01, 0x02, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x02, 0x02, 0x00, 0x02,
|
||||||
};
|
};
|
||||||
|
|
||||||
#if TARGET_PC
|
|
||||||
void JPAResource::initBatchInfo() {
|
|
||||||
mBatchInfo = {};
|
|
||||||
|
|
||||||
bool hasDrawFunc = false;
|
|
||||||
for (int i = 0; i < mpDrawParticleFuncListNum; i++) {
|
|
||||||
DrawParticleFunc func = mpDrawParticleFuncList[i];
|
|
||||||
if (func == JPADrawBillboard || func == JPADrawRotBillboard ||
|
|
||||||
func == JPADrawYBillboard || func == JPADrawRotYBillboard ||
|
|
||||||
func == JPADrawDirection || func == JPADrawRotDirection || func == JPADrawRotation)
|
|
||||||
{
|
|
||||||
hasDrawFunc = true;
|
|
||||||
} else if (func == JPADrawParticleCallBack) {
|
|
||||||
// Batchable only for emitters without a particle callback; checked per draw
|
|
||||||
} else if (func == JPALoadCalcTexCrdMtxAnm) {
|
|
||||||
mBatchInfo.hasPtclTexMtx = true;
|
|
||||||
} else if (func == JPARegistAlpha || func == JPARegistPrmAlpha ||
|
|
||||||
func == JPARegistPrmAlphaEnv || func == JPARegistAlphaEnv ||
|
|
||||||
func == static_cast<DrawParticleFunc>(JPARegistEnv)) // overloaded
|
|
||||||
{
|
|
||||||
mBatchInfo.hasPtclColor = true;
|
|
||||||
} else {
|
|
||||||
// JPADrawPoint, JPADrawLine, JPADrawDBillboard, JPALoadTexAnm,
|
|
||||||
// JPASetPointSize, JPASetLineWidth
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!hasDrawFunc) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Template array offsets, same math as setPTev
|
|
||||||
int base_plane_type = (pBsp->getType() == 3 || pBsp->getType() == 7) ?
|
|
||||||
pBsp->getBasePlaneType() : 0;
|
|
||||||
int center_offset = pEsp != nullptr ? (pEsp->getScaleCenterX() + 3 * pEsp->getScaleCenterY()) * 0xC : 0x30;
|
|
||||||
const s8* pos = reinterpret_cast<const s8*>(jpa_pos) + center_offset + base_plane_type * 0x6C;
|
|
||||||
const s8* crd = reinterpret_cast<const s8*>(jpa_crd) + (pBsp->getTilingS() + 2 * pBsp->getTilingT()) * 8;
|
|
||||||
|
|
||||||
bool cross = pBsp->getType() == 4 || pBsp->getType() == 8;
|
|
||||||
mBatchInfo.vtxCount = cross ? 8 : 4;
|
|
||||||
for (int i = 0; i < mBatchInfo.vtxCount; i++) {
|
|
||||||
int posIdx = i < 4 ? i : 72 + (i - 4);
|
|
||||||
int crdIdx = i & 3;
|
|
||||||
mBatchInfo.vtxPos[i][0] = pos[posIdx * 3 + 0];
|
|
||||||
mBatchInfo.vtxPos[i][1] = pos[posIdx * 3 + 1];
|
|
||||||
mBatchInfo.vtxPos[i][2] = pos[posIdx * 3 + 2];
|
|
||||||
mBatchInfo.vtxUv[i][0] = crd[crdIdx * 2 + 0];
|
|
||||||
mBatchInfo.vtxUv[i][1] = crd[crdIdx * 2 + 1];
|
|
||||||
}
|
|
||||||
|
|
||||||
mBatchInfo.supported = true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void JPAResource::init(JKRHeap* heap) {
|
void JPAResource::init(JKRHeap* heap) {
|
||||||
BOOL is_glbl_clr_anm = pBsp->isGlblClrAnm();
|
BOOL is_glbl_clr_anm = pBsp->isGlblClrAnm();
|
||||||
BOOL is_glbl_tex_anm = pBsp->isGlblTexAnm();
|
BOOL is_glbl_tex_anm = pBsp->isGlblTexAnm();
|
||||||
@@ -591,10 +525,7 @@ void JPAResource::init(JKRHeap* heap) {
|
|||||||
|
|
||||||
if (mpDrawParticleFuncListNum != 0) {
|
if (mpDrawParticleFuncListNum != 0) {
|
||||||
mpDrawParticleFuncList =
|
mpDrawParticleFuncList =
|
||||||
(DrawParticleFunc*)JKRAllocFromHeap(
|
(ParticleFunc*)JKRAllocFromHeap(heap, mpDrawParticleFuncListNum * sizeof(ParticleFunc), alignof(ParticleFunc));
|
||||||
heap,
|
|
||||||
mpDrawParticleFuncListNum * sizeof(DrawParticleFunc),
|
|
||||||
alignof(DrawParticleFunc));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func_no = 0;
|
func_no = 0;
|
||||||
@@ -704,10 +635,7 @@ void JPAResource::init(JKRHeap* heap) {
|
|||||||
|
|
||||||
if (mpDrawParticleChildFuncListNum != 0) {
|
if (mpDrawParticleChildFuncListNum != 0) {
|
||||||
mpDrawParticleChildFuncList =
|
mpDrawParticleChildFuncList =
|
||||||
(DrawParticleFunc*)JKRAllocFromHeap(
|
(ParticleFunc*)JKRAllocFromHeap(heap, mpDrawParticleChildFuncListNum * sizeof(ParticleFunc), sizeof(EmitterFunc));
|
||||||
heap,
|
|
||||||
mpDrawParticleChildFuncListNum * sizeof(DrawParticleFunc),
|
|
||||||
alignof(DrawParticleFunc));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func_no = 0;
|
func_no = 0;
|
||||||
@@ -771,10 +699,6 @@ void JPAResource::init(JKRHeap* heap) {
|
|||||||
mpDrawParticleChildFuncList[func_no] = &JPARegistPrmAlphaEnv;
|
mpDrawParticleChildFuncList[func_no] = &JPARegistPrmAlphaEnv;
|
||||||
func_no++;
|
func_no++;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TARGET_PC
|
|
||||||
initBatchInfo();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JPAResource::calc(JPAEmitterWorkData* work, JPABaseEmitter* emtr) {
|
bool JPAResource::calc(JPAEmitterWorkData* work, JPABaseEmitter* emtr) {
|
||||||
@@ -837,15 +761,6 @@ bool JPAResource::calc(JPAEmitterWorkData* work, JPABaseEmitter* emtr) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TARGET_PC
|
|
||||||
if (((pBsp && pBsp->getDirType() == 3) || (pCsp && pCsp->getDirType() == 3)) &&
|
|
||||||
dusk::frame_interp::is_enabled())
|
|
||||||
{
|
|
||||||
// ensure mGlobalEmtrDir is valid
|
|
||||||
calcWorkData_d(work);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
JPANode<JPABaseParticle>* next = NULL;
|
JPANode<JPABaseParticle>* next = NULL;
|
||||||
for (JPANode<JPABaseParticle>* node = emtr->mAlivePtclBase.getFirst(); node != emtr->mAlivePtclBase.getEnd(); node = next) {
|
for (JPANode<JPABaseParticle>* node = emtr->mAlivePtclBase.getFirst(); node != emtr->mAlivePtclBase.getEnd(); node = next) {
|
||||||
next = node->getNext();
|
next = node->getNext();
|
||||||
@@ -884,183 +799,6 @@ void JPAResource::draw(JPAEmitterWorkData* work, JPABaseEmitter* emtr) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TARGET_PC
|
|
||||||
static GXTevAlphaArg to_vtx_alpha_arg(GXTevAlphaArg arg) {
|
|
||||||
return arg == GX_CA_A0 ? GX_CA_RASA : arg;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void batch_set_tev_op(GXTevStageID stage) {
|
|
||||||
GXSetTevColorOp(stage, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV);
|
|
||||||
GXSetTevAlphaOp(stage, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void batch_setup_tev(JPAEmitterWorkData* work, bool useClr1) {
|
|
||||||
JPABaseShape* shape = work->mpRes->getBsp();
|
|
||||||
JPAExTexShape* ets = work->mpRes->getEts();
|
|
||||||
bool useIndirect = ets != nullptr && ets->isUseIndirect();
|
|
||||||
|
|
||||||
// JPAEmitterManager::draw configures both channels to pass vertex color through
|
|
||||||
GXSetNumChans(useClr1 ? 2 : 1);
|
|
||||||
|
|
||||||
const GXTevAlphaArg* alphaArg = shape->getTevAlphaArg();
|
|
||||||
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0);
|
|
||||||
GXSetTevAlphaIn(GX_TEVSTAGE0, to_vtx_alpha_arg(alphaArg[0]), to_vtx_alpha_arg(alphaArg[1]),
|
|
||||||
to_vtx_alpha_arg(alphaArg[2]), to_vtx_alpha_arg(alphaArg[3]));
|
|
||||||
batch_set_tev_op(GX_TEVSTAGE0);
|
|
||||||
if (!useIndirect) {
|
|
||||||
GXSetTevDirect(GX_TEVSTAGE0);
|
|
||||||
}
|
|
||||||
GXTevStageID nextStage = GX_TEVSTAGE1;
|
|
||||||
|
|
||||||
switch (shape->getTevColorArgSel()) {
|
|
||||||
case 0: // TEXC
|
|
||||||
GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_TEXC, GX_CC_ONE, GX_CC_ZERO);
|
|
||||||
break;
|
|
||||||
case 1: // C0 * TEXC
|
|
||||||
GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_RASC, GX_CC_TEXC, GX_CC_ZERO);
|
|
||||||
break;
|
|
||||||
case 2: // lerp(C0, 1, TEXC)
|
|
||||||
GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_RASC, GX_CC_ONE, GX_CC_TEXC, GX_CC_ZERO);
|
|
||||||
break;
|
|
||||||
case 3: // lerp(C1, C0, TEXC) = C0 * TEXC (stage 0) + C1 * (1 - TEXC) (stage 1)
|
|
||||||
GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_RASC, GX_CC_TEXC, GX_CC_ZERO);
|
|
||||||
GXSetTevOrder(nextStage, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR1A1);
|
|
||||||
GXSetTevColorIn(nextStage, GX_CC_RASC, GX_CC_ZERO, GX_CC_TEXC, GX_CC_CPREV);
|
|
||||||
GXSetTevAlphaIn(nextStage, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_APREV);
|
|
||||||
batch_set_tev_op(nextStage);
|
|
||||||
GXSetTevDirect(nextStage);
|
|
||||||
nextStage = static_cast<GXTevStageID>(nextStage + 1);
|
|
||||||
break;
|
|
||||||
case 4: // TEXC * C0 + C1: C0 * TEXC (stage 0), + C1 (stage 1)
|
|
||||||
GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_RASC, GX_CC_TEXC, GX_CC_ZERO);
|
|
||||||
GXSetTevOrder(nextStage, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR1A1);
|
|
||||||
GXSetTevColorIn(nextStage, GX_CC_CPREV, GX_CC_ZERO, GX_CC_ZERO, GX_CC_RASC);
|
|
||||||
GXSetTevAlphaIn(nextStage, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_APREV);
|
|
||||||
batch_set_tev_op(nextStage);
|
|
||||||
GXSetTevDirect(nextStage);
|
|
||||||
nextStage = static_cast<GXTevStageID>(nextStage + 1);
|
|
||||||
break;
|
|
||||||
case 5: // C0
|
|
||||||
GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, GX_CC_RASC);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ets != nullptr && ets->isUseSecTex()) {
|
|
||||||
// Mirrors setPTev's secondary texture stage, at the next free stage
|
|
||||||
GXTexCoordID texCoord = useIndirect ? GX_TEXCOORD2 : GX_TEXCOORD1;
|
|
||||||
GXSetTevOrder(nextStage, texCoord, GX_TEXMAP3, GX_COLOR_NULL);
|
|
||||||
GXSetTevColorIn(nextStage, GX_CC_ZERO, GX_CC_TEXC, GX_CC_CPREV, GX_CC_ZERO);
|
|
||||||
GXSetTevAlphaIn(nextStage, GX_CA_ZERO, GX_CA_TEXA, GX_CA_APREV, GX_CA_ZERO);
|
|
||||||
batch_set_tev_op(nextStage);
|
|
||||||
GXSetTevDirect(nextStage);
|
|
||||||
nextStage = static_cast<GXTevStageID>(nextStage + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
GXSetNumTevStages(nextStage);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void batch_setup_vtx_desc(bool useClr0, bool useClr1) {
|
|
||||||
static Mtx identityMtx = {
|
|
||||||
{1.0f, 0.0f, 0.0f, 0.0f},
|
|
||||||
{0.0f, 1.0f, 0.0f, 0.0f},
|
|
||||||
{0.0f, 0.0f, 1.0f, 0.0f},
|
|
||||||
};
|
|
||||||
|
|
||||||
GXLoadPosMtxImm(identityMtx, GX_PNMTX0);
|
|
||||||
GXSetCurrentMtx(GX_PNMTX0);
|
|
||||||
GXClearVtxDesc();
|
|
||||||
GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
|
|
||||||
if (useClr0) {
|
|
||||||
GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT);
|
|
||||||
}
|
|
||||||
if (useClr1) {
|
|
||||||
GXSetVtxDesc(GX_VA_CLR1, GX_DIRECT);
|
|
||||||
}
|
|
||||||
GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT);
|
|
||||||
GXSetVtxAttrFmt(GX_VTXFMT1, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
|
|
||||||
if (useClr0) {
|
|
||||||
GXSetVtxAttrFmt(GX_VTXFMT1, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0);
|
|
||||||
}
|
|
||||||
if (useClr1) {
|
|
||||||
GXSetVtxAttrFmt(GX_VTXFMT1, GX_VA_CLR1, GX_CLR_RGBA, GX_RGBA8, 0);
|
|
||||||
}
|
|
||||||
GXSetVtxAttrFmt(GX_VTXFMT1, GX_VA_TEX0, GX_TEX_ST, GX_F32, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void batch_restore_gx(JPAEmitterWorkData* work, bool changedTev, bool changedTexMtx) {
|
|
||||||
GXClearVtxDesc();
|
|
||||||
GXSetVtxDesc(GX_VA_POS, GX_INDEX8);
|
|
||||||
GXSetVtxDesc(GX_VA_TEX0, GX_INDEX8);
|
|
||||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_S8, 0);
|
|
||||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_S8, 0);
|
|
||||||
GXSetVtxAttrFmt(GX_VTXFMT1, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
|
|
||||||
GXSetVtxAttrFmt(GX_VTXFMT1, GX_VA_TEX0, GX_TEX_ST, GX_F32, 0);
|
|
||||||
GXSetCurrentMtx(GX_PNMTX0);
|
|
||||||
|
|
||||||
if (changedTexMtx) {
|
|
||||||
GXSetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_TEXMTX0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (changedTev) {
|
|
||||||
GXSetNumChans(0);
|
|
||||||
work->mpRes->getBsp()->setGX(work);
|
|
||||||
work->mpRes->setPTev();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool draw_particle_batch(JPAEmitterWorkData* work) {
|
|
||||||
ZoneScoped;
|
|
||||||
|
|
||||||
JPAResource* res = work->mpRes;
|
|
||||||
const JPAResource::BatchInfo& info = res->mBatchInfo;
|
|
||||||
if (!info.supported || work->mPrjType != 0 || work->mpEmtr->mpPtclCallBack != nullptr) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool useClr0 = false;
|
|
||||||
bool useClr1 = false;
|
|
||||||
if (info.hasPtclColor) {
|
|
||||||
u32 colorSel = res->getBsp()->getTevColorArgSel();
|
|
||||||
if (colorSel >= 6) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
useClr0 = true;
|
|
||||||
useClr1 = colorSel == 3 || colorSel == 4;
|
|
||||||
batch_setup_tev(work, useClr1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (info.hasPtclTexMtx) {
|
|
||||||
// UVs are CPU-transformed; drop the texgen
|
|
||||||
GXSetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY);
|
|
||||||
}
|
|
||||||
|
|
||||||
batch_setup_vtx_desc(useClr0, useClr1);
|
|
||||||
|
|
||||||
ParticleDrawCtx ctx{};
|
|
||||||
ctx.batch = true;
|
|
||||||
ctx.useTexMtx = info.hasPtclTexMtx;
|
|
||||||
ctx.useClr0 = useClr0;
|
|
||||||
ctx.useClr1 = useClr1;
|
|
||||||
|
|
||||||
bool fwdAhead = res->getBsp()->isDrawFwdAhead();
|
|
||||||
JPANode<JPABaseParticle>* node = fwdAhead ? work->mpEmtr->mAlivePtclBase.getLast() :
|
|
||||||
work->mpEmtr->mAlivePtclBase.getFirst();
|
|
||||||
|
|
||||||
GXBegin(GX_QUADS, GX_VTXFMT1, GX_AUTO);
|
|
||||||
while (node != work->mpEmtr->mAlivePtclBase.getEnd()) {
|
|
||||||
work->mpCurNode = node;
|
|
||||||
for (int i = res->mpDrawParticleFuncListNum - 1; i >= 0; i--) {
|
|
||||||
(*res->mpDrawParticleFuncList[i])(work, node->getObject(), &ctx);
|
|
||||||
}
|
|
||||||
node = fwdAhead ? node->getPrev() : node->getNext();
|
|
||||||
}
|
|
||||||
GXEnd();
|
|
||||||
|
|
||||||
batch_restore_gx(work, useClr0, info.hasPtclTexMtx);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void JPAResource::drawP(JPAEmitterWorkData* work) {
|
void JPAResource::drawP(JPAEmitterWorkData* work) {
|
||||||
ZoneScoped;
|
ZoneScoped;
|
||||||
work->mpEmtr->clearStatus(0x80);
|
work->mpEmtr->clearStatus(0x80);
|
||||||
@@ -1095,25 +833,13 @@ void JPAResource::drawP(JPAEmitterWorkData* work) {
|
|||||||
(*mpDrawEmitterFuncList[i])(work);
|
(*mpDrawEmitterFuncList[i])(work);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TARGET_PC
|
|
||||||
if (draw_particle_batch(work)) {
|
|
||||||
GXSetMisc(GX_MT_XF_FLUSH, 0);
|
|
||||||
if (work->mpEmtr->mpEmtrCallBack != nullptr) {
|
|
||||||
work->mpEmtr->mpEmtrCallBack->drawAfter(work->mpEmtr);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ParticleDrawCtx ctx{}; // immediate mode
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (pBsp->isDrawFwdAhead()) {
|
if (pBsp->isDrawFwdAhead()) {
|
||||||
JPANode<JPABaseParticle>* node = work->mpEmtr->mAlivePtclBase.getLast();
|
JPANode<JPABaseParticle>* node = work->mpEmtr->mAlivePtclBase.getLast();
|
||||||
for (; node != work->mpEmtr->mAlivePtclBase.getEnd(); node = node->getPrev()) {
|
for (; node != work->mpEmtr->mAlivePtclBase.getEnd(); node = node->getPrev()) {
|
||||||
work->mpCurNode = node;
|
work->mpCurNode = node;
|
||||||
if (mpDrawParticleFuncList != NULL) {
|
if (mpDrawParticleFuncList != NULL) {
|
||||||
for (int i = mpDrawParticleFuncListNum - 1; i >= 0; i--) {
|
for (int i = mpDrawParticleFuncListNum - 1; i >= 0; i--) {
|
||||||
(*mpDrawParticleFuncList[i])(work, node->getObject() JPA_DRAW_CTX_ARG);
|
(*mpDrawParticleFuncList[i])(work, node->getObject());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1123,7 +849,7 @@ void JPAResource::drawP(JPAEmitterWorkData* work) {
|
|||||||
work->mpCurNode = node;
|
work->mpCurNode = node;
|
||||||
if (mpDrawParticleFuncList != NULL) {
|
if (mpDrawParticleFuncList != NULL) {
|
||||||
for (int i = mpDrawParticleFuncListNum - 1; i >= 0; i--) {
|
for (int i = mpDrawParticleFuncListNum - 1; i >= 0; i--) {
|
||||||
(*mpDrawParticleFuncList[i])(work, node->getObject() JPA_DRAW_CTX_ARG);
|
(*mpDrawParticleFuncList[i])(work, node->getObject());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1170,17 +896,13 @@ void JPAResource::drawC(JPAEmitterWorkData* work) {
|
|||||||
(*mpDrawEmitterChildFuncList[i])(work);
|
(*mpDrawEmitterChildFuncList[i])(work);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TARGET_PC
|
|
||||||
ParticleDrawCtx ctx{}; // immediate mode
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (pBsp->isDrawFwdAhead()) {
|
if (pBsp->isDrawFwdAhead()) {
|
||||||
JPANode<JPABaseParticle>* node = work->mpEmtr->mAlivePtclChld.getLast();
|
JPANode<JPABaseParticle>* node = work->mpEmtr->mAlivePtclChld.getLast();
|
||||||
for (; node != work->mpEmtr->mAlivePtclChld.getEnd(); node = node->getPrev()) {
|
for (; node != work->mpEmtr->mAlivePtclChld.getEnd(); node = node->getPrev()) {
|
||||||
work->mpCurNode = node;
|
work->mpCurNode = node;
|
||||||
if (mpDrawParticleChildFuncList != NULL) {
|
if (mpDrawParticleChildFuncList != NULL) {
|
||||||
for (int i = mpDrawParticleChildFuncListNum - 1; i >= 0; i--) {
|
for (int i = mpDrawParticleChildFuncListNum - 1; i >= 0; i--) {
|
||||||
(*mpDrawParticleChildFuncList[i])(work, node->getObject() JPA_DRAW_CTX_ARG);
|
(*mpDrawParticleChildFuncList[i])(work, node->getObject());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1190,7 +912,7 @@ void JPAResource::drawC(JPAEmitterWorkData* work) {
|
|||||||
work->mpCurNode = node;
|
work->mpCurNode = node;
|
||||||
if (mpDrawParticleChildFuncList != NULL) {
|
if (mpDrawParticleChildFuncList != NULL) {
|
||||||
for (int i = mpDrawParticleChildFuncListNum - 1; i >= 0; i--) {
|
for (int i = mpDrawParticleChildFuncListNum - 1; i >= 0; i--) {
|
||||||
(*mpDrawParticleChildFuncList[i])(work, node->getObject() JPA_DRAW_CTX_ARG);
|
(*mpDrawParticleChildFuncList[i])(work, node->getObject());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -249,7 +249,6 @@ f32 JUTResFont::drawChar_scale(f32 pos_x, f32 pos_y, f32 scale_x, f32 scale_y, i
|
|||||||
f32 x2;
|
f32 x2;
|
||||||
f32 y1;
|
f32 y1;
|
||||||
|
|
||||||
ZoneScoped;
|
|
||||||
JUT_ASSERT(378, mValid);
|
JUT_ASSERT(378, mValid);
|
||||||
JUTFont::TWidth width;
|
JUTFont::TWidth width;
|
||||||
loadFont(str_int, GX_TEXMAP0, &width FONT_DRAW_CTX_ARG);
|
loadFont(str_int, GX_TEXMAP0, &width FONT_DRAW_CTX_ARG);
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import android.app.ActionBar;
|
|||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.ActivityNotFoundException;
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.ClipData;
|
import android.content.ClipData;
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
@@ -15,16 +14,12 @@ import android.provider.DocumentsContract;
|
|||||||
import android.provider.OpenableColumns;
|
import android.provider.OpenableColumns;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Display;
|
|
||||||
import android.view.Surface;
|
|
||||||
import android.view.SurfaceHolder;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.WindowInsets;
|
import android.view.WindowInsets;
|
||||||
import android.view.WindowInsetsController;
|
import android.view.WindowInsetsController;
|
||||||
|
|
||||||
import org.libsdl.app.SDLActivity;
|
import org.libsdl.app.SDLActivity;
|
||||||
import org.libsdl.app.SDLSurface;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -32,7 +27,6 @@ import java.util.List;
|
|||||||
|
|
||||||
public class DuskActivity extends SDLActivity {
|
public class DuskActivity extends SDLActivity {
|
||||||
private static final String TAG = "DuskActivity";
|
private static final String TAG = "DuskActivity";
|
||||||
private static final float DEFAULT_SURFACE_FRAME_RATE = 60.0f;
|
|
||||||
private static final int FOLDER_DIALOG_REQUEST_CODE = 0x4455;
|
private static final int FOLDER_DIALOG_REQUEST_CODE = 0x4455;
|
||||||
private static final int MANAGE_STORAGE_REQUEST_CODE = 0x4456;
|
private static final int MANAGE_STORAGE_REQUEST_CODE = 0x4456;
|
||||||
private static final String EXTERNAL_STORAGE_AUTHORITY =
|
private static final String EXTERNAL_STORAGE_AUTHORITY =
|
||||||
@@ -94,11 +88,6 @@ public class DuskActivity extends SDLActivity {
|
|||||||
hideSystemBars();
|
hideSystemBars();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected SDLSurface createSDLSurface(Context context) {
|
|
||||||
return new DuskSurface(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
@@ -150,77 +139,6 @@ public class DuskActivity extends SDLActivity {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
@Override
|
||||||
protected String[] getArguments() {
|
protected String[] getArguments() {
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
|
|||||||
+35
-209
@@ -19,13 +19,9 @@ import android.os.*;
|
|||||||
|
|
||||||
import java.lang.Runnable;
|
import java.lang.Runnable;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
|
|
||||||
class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDevice {
|
class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDevice {
|
||||||
|
|
||||||
private static final String TAG = "hidapi";
|
private static final String TAG = "hidapi";
|
||||||
@@ -37,19 +33,10 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
|
|||||||
private boolean mIsConnected = false;
|
private boolean mIsConnected = false;
|
||||||
private boolean mIsChromebook = false;
|
private boolean mIsChromebook = false;
|
||||||
private boolean mIsReconnecting = false;
|
private boolean mIsReconnecting = false;
|
||||||
private boolean mHasEnabledNotifications = false;
|
|
||||||
private boolean mHasSeenInputUpdate = false;
|
|
||||||
private boolean mFrozen = false;
|
private boolean mFrozen = false;
|
||||||
private LinkedList<GattOperation> mOperations;
|
private LinkedList<GattOperation> mOperations;
|
||||||
GattOperation mCurrentOperation = null;
|
GattOperation mCurrentOperation = null;
|
||||||
private Handler mHandler;
|
private Handler mHandler;
|
||||||
private int mProductId = -1;
|
|
||||||
private int mReportId = 0;
|
|
||||||
private UUID mInputCharacteristic;
|
|
||||||
|
|
||||||
private static final int D0G_BLE2_PID = 0x1106;
|
|
||||||
private static final int TRITON_BLE_PID = 0x1303;
|
|
||||||
|
|
||||||
|
|
||||||
private static final int TRANSPORT_AUTO = 0;
|
private static final int TRANSPORT_AUTO = 0;
|
||||||
private static final int TRANSPORT_BREDR = 1;
|
private static final int TRANSPORT_BREDR = 1;
|
||||||
@@ -58,14 +45,10 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
|
|||||||
private static final int CHROMEBOOK_CONNECTION_CHECK_INTERVAL = 10000;
|
private static final int CHROMEBOOK_CONNECTION_CHECK_INTERVAL = 10000;
|
||||||
|
|
||||||
static final UUID steamControllerService = UUID.fromString("100F6C32-1735-4313-B402-38567131E5F3");
|
static final UUID steamControllerService = UUID.fromString("100F6C32-1735-4313-B402-38567131E5F3");
|
||||||
static final UUID inputCharacteristicD0G = UUID.fromString("100F6C33-1735-4313-B402-38567131E5F3");
|
static final UUID inputCharacteristic = UUID.fromString("100F6C33-1735-4313-B402-38567131E5F3");
|
||||||
static final UUID inputCharacteristicTriton_0x45 = UUID.fromString("100F6C7A-1735-4313-B402-38567131E5F3");
|
|
||||||
static final UUID inputCharacteristicTriton_0x47 = UUID.fromString("100F6C7C-1735-4313-B402-38567131E5F3");
|
|
||||||
static final UUID reportCharacteristic = UUID.fromString("100F6C34-1735-4313-B402-38567131E5F3");
|
static final UUID reportCharacteristic = UUID.fromString("100F6C34-1735-4313-B402-38567131E5F3");
|
||||||
static private final byte[] enterValveMode = new byte[] { (byte)0xC0, (byte)0x87, 0x03, 0x08, 0x07, 0x00 };
|
static private final byte[] enterValveMode = new byte[] { (byte)0xC0, (byte)0x87, 0x03, 0x08, 0x07, 0x00 };
|
||||||
|
|
||||||
private HashMap<Integer, BluetoothGattCharacteristic> mOutputReportChars = new HashMap<Integer, BluetoothGattCharacteristic>();
|
|
||||||
|
|
||||||
static class GattOperation {
|
static class GattOperation {
|
||||||
private enum Operation {
|
private enum Operation {
|
||||||
CHR_READ,
|
CHR_READ,
|
||||||
@@ -78,7 +61,6 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
|
|||||||
byte[] mValue;
|
byte[] mValue;
|
||||||
BluetoothGatt mGatt;
|
BluetoothGatt mGatt;
|
||||||
boolean mResult = true;
|
boolean mResult = true;
|
||||||
int mDelayMs = 0;
|
|
||||||
|
|
||||||
private GattOperation(BluetoothGatt gatt, GattOperation.Operation operation, UUID uuid) {
|
private GattOperation(BluetoothGatt gatt, GattOperation.Operation operation, UUID uuid) {
|
||||||
mGatt = gatt;
|
mGatt = gatt;
|
||||||
@@ -86,13 +68,6 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
|
|||||||
mUuid = uuid;
|
mUuid = uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
private GattOperation(BluetoothGatt gatt, GattOperation.Operation operation, UUID uuid, int delayMs) {
|
|
||||||
mGatt = gatt;
|
|
||||||
mOp = operation;
|
|
||||||
mUuid = uuid;
|
|
||||||
mDelayMs = delayMs;
|
|
||||||
}
|
|
||||||
|
|
||||||
private GattOperation(BluetoothGatt gatt, GattOperation.Operation operation, UUID uuid, byte[] value) {
|
private GattOperation(BluetoothGatt gatt, GattOperation.Operation operation, UUID uuid, byte[] value) {
|
||||||
mGatt = gatt;
|
mGatt = gatt;
|
||||||
mOp = operation;
|
mOp = operation;
|
||||||
@@ -100,14 +75,6 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
|
|||||||
mValue = value;
|
mValue = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private GattOperation(BluetoothGatt gatt, GattOperation.Operation operation, UUID uuid, byte[] value, int delayMs) {
|
|
||||||
mGatt = gatt;
|
|
||||||
mOp = operation;
|
|
||||||
mUuid = uuid;
|
|
||||||
mValue = value;
|
|
||||||
mDelayMs = delayMs;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
// This is executed in main thread
|
// This is executed in main thread
|
||||||
BluetoothGattCharacteristic chr;
|
BluetoothGattCharacteristic chr;
|
||||||
@@ -169,8 +136,6 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
|
|||||||
return mResult;
|
return mResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getDelayMs() { return mDelayMs; }
|
|
||||||
|
|
||||||
private BluetoothGattCharacteristic getCharacteristic(UUID uuid) {
|
private BluetoothGattCharacteristic getCharacteristic(UUID uuid) {
|
||||||
BluetoothGattService valveService = mGatt.getService(steamControllerService);
|
BluetoothGattService valveService = mGatt.getService(steamControllerService);
|
||||||
if (valveService == null)
|
if (valveService == null)
|
||||||
@@ -189,10 +154,6 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
|
|||||||
static public GattOperation enableNotification(BluetoothGatt gatt, UUID uuid) {
|
static public GattOperation enableNotification(BluetoothGatt gatt, UUID uuid) {
|
||||||
return new GattOperation(gatt, Operation.ENABLE_NOTIFICATION, uuid);
|
return new GattOperation(gatt, Operation.ENABLE_NOTIFICATION, uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
static public GattOperation enableNotification(BluetoothGatt gatt, UUID uuid, int delayMs) {
|
|
||||||
return new GattOperation(gatt, Operation.ENABLE_NOTIFICATION, uuid, delayMs);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HIDDeviceBLESteamController(HIDDeviceManager manager, BluetoothDevice device) {
|
HIDDeviceBLESteamController(HIDDeviceManager manager, BluetoothDevice device) {
|
||||||
@@ -205,8 +166,6 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
|
|||||||
mHandler = new Handler(Looper.getMainLooper());
|
mHandler = new Handler(Looper.getMainLooper());
|
||||||
|
|
||||||
mGatt = connectGatt();
|
mGatt = connectGatt();
|
||||||
mHasEnabledNotifications = false;
|
|
||||||
mHasSeenInputUpdate = false;
|
|
||||||
// final HIDDeviceBLESteamController finalThis = this;
|
// final HIDDeviceBLESteamController finalThis = this;
|
||||||
// mHandler.postDelayed(new Runnable() {
|
// mHandler.postDelayed(new Runnable() {
|
||||||
// @Override
|
// @Override
|
||||||
@@ -355,45 +314,8 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
|
|||||||
Log.v(TAG, "Found Valve steam controller service " + service.getUuid());
|
Log.v(TAG, "Found Valve steam controller service " + service.getUuid());
|
||||||
|
|
||||||
for (BluetoothGattCharacteristic chr : service.getCharacteristics()) {
|
for (BluetoothGattCharacteristic chr : service.getCharacteristics()) {
|
||||||
if (chr.getUuid().equals(inputCharacteristicTriton_0x45)) {
|
if (chr.getUuid().equals(inputCharacteristic)) {
|
||||||
Log.v(TAG, "Found Triton input characteristic 0x45");
|
Log.v(TAG, "Found input characteristic");
|
||||||
mProductId = TRITON_BLE_PID;
|
|
||||||
mReportId = 0x45;
|
|
||||||
mInputCharacteristic = chr.getUuid();
|
|
||||||
} else if (chr.getUuid().equals(inputCharacteristicTriton_0x47)) {
|
|
||||||
Log.v(TAG, "Found Triton input characteristic 0x47");
|
|
||||||
mProductId = TRITON_BLE_PID;
|
|
||||||
mReportId = 0x47;
|
|
||||||
mInputCharacteristic = chr.getUuid();
|
|
||||||
} else if (chr.getUuid().equals(inputCharacteristicD0G)) {
|
|
||||||
Log.v(TAG, "Found D0G input characteristic");
|
|
||||||
mProductId = D0G_BLE2_PID;
|
|
||||||
mReportId = 0x03;
|
|
||||||
mInputCharacteristic = chr.getUuid();
|
|
||||||
} else {
|
|
||||||
Pattern reportPattern = Pattern.compile("100F6C([0-9A-Z]{2})", Pattern.CASE_INSENSITIVE);
|
|
||||||
Matcher matcher = reportPattern.matcher(chr.getUuid().toString());
|
|
||||||
|
|
||||||
if (matcher.find()) {
|
|
||||||
try {
|
|
||||||
int reportId = Integer.parseInt(matcher.group(1), 16);
|
|
||||||
|
|
||||||
reportId -= 0x35;
|
|
||||||
if (reportId >= 0x80) {
|
|
||||||
// This is a Triton output report characteristic that we need to care about.
|
|
||||||
Log.v(TAG, "Found Triton output report 0x" + Integer.toString(reportId, 16));
|
|
||||||
mOutputReportChars.put(reportId, chr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (NumberFormatException nfe) {
|
|
||||||
Log.w(TAG, "Could not parse report characteristic " + chr.getUuid().toString() + ": " + nfe.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (BluetoothGattCharacteristic chr : service.getCharacteristics()) {
|
|
||||||
if (chr.getUuid().equals(mInputCharacteristic)) {
|
|
||||||
// Start notifications
|
// Start notifications
|
||||||
BluetoothGattDescriptor cccd = chr.getDescriptor(UUID.fromString("00002902-0000-1000-8000-00805f9b34fb"));
|
BluetoothGattDescriptor cccd = chr.getDescriptor(UUID.fromString("00002902-0000-1000-8000-00805f9b34fb"));
|
||||||
if (cccd != null) {
|
if (cccd != null) {
|
||||||
@@ -450,30 +372,21 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
|
|||||||
mCurrentOperation = mOperations.removeFirst();
|
mCurrentOperation = mOperations.removeFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
Runnable gattOperationRunnable = new Runnable() {
|
// Run in main thread
|
||||||
@Override
|
mHandler.post(new Runnable() {
|
||||||
public void run() {
|
@Override
|
||||||
synchronized (mOperations) {
|
public void run() {
|
||||||
if (mCurrentOperation == null) {
|
synchronized (mOperations) {
|
||||||
Log.e(TAG, "Current operation null in executor?");
|
if (mCurrentOperation == null) {
|
||||||
return;
|
Log.e(TAG, "Current operation null in executor?");
|
||||||
}
|
return;
|
||||||
|
|
||||||
mCurrentOperation.run();
|
|
||||||
// now wait for the GATT callback and when it comes, finish this operation
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mCurrentOperation.run();
|
||||||
|
// now wait for the GATT callback and when it comes, finish this operation
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
});
|
||||||
if (mCurrentOperation.getDelayMs() == 0) {
|
|
||||||
// Run in main thread
|
|
||||||
mHandler.post(gattOperationRunnable);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// If we have a delay on this operation, wait before we post it.
|
|
||||||
mHandler.postDelayed(gattOperationRunnable, mCurrentOperation.getDelayMs());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void queueGattOperation(GattOperation op) {
|
private void queueGattOperation(GattOperation op) {
|
||||||
@@ -484,39 +397,8 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void enableNotification(UUID chrUuid) {
|
private void enableNotification(UUID chrUuid) {
|
||||||
// Add a 500ms delay to notification write for Amazon Fire TV devices, as otherwise if we do this too quickly after connecting
|
GattOperation op = HIDDeviceBLESteamController.GattOperation.enableNotification(mGatt, chrUuid);
|
||||||
// it will return success and then silently drop the operation on the floor.
|
|
||||||
GattOperation op = HIDDeviceBLESteamController.GattOperation.enableNotification(mGatt, chrUuid, 500);
|
|
||||||
queueGattOperation(op);
|
queueGattOperation(op);
|
||||||
|
|
||||||
// Amazon Fire devices can also silently timeout on writeDescriptor, so
|
|
||||||
// set up a little delayed check that will attempt to write a second time.
|
|
||||||
//
|
|
||||||
// While this only seems to be needed on Amazon Fire TV devices at present, it
|
|
||||||
// doesn't hurt to have a retry on other devices as well.
|
|
||||||
//
|
|
||||||
final HIDDeviceBLESteamController finalThis = this;
|
|
||||||
final UUID finalUuid = chrUuid;
|
|
||||||
mHandler.postDelayed(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (!finalThis.mHasEnabledNotifications) {
|
|
||||||
|
|
||||||
if (finalThis.mHasSeenInputUpdate) {
|
|
||||||
// Amazon Five devices may have enabled notifications on the input characteristic and not given us a callback. If we've seen
|
|
||||||
// input reports, though, somewhat by definition notifications are enabled.
|
|
||||||
Log.w(TAG, "WriteDescriptor has never returned, but we've seen input reports. Moving on with controller initialization.");
|
|
||||||
finalThis.mHasEnabledNotifications = true;
|
|
||||||
finalThis.enableValveMode();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Give one more try.
|
|
||||||
GattOperation retry = HIDDeviceBLESteamController.GattOperation.enableNotification(finalThis.mGatt, finalUuid, 500);
|
|
||||||
finalThis.queueGattOperation(retry);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, 1000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void writeCharacteristic(UUID uuid, byte[] value) {
|
void writeCharacteristic(UUID uuid, byte[] value) {
|
||||||
@@ -566,16 +448,8 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
|
|||||||
mIsConnected = false;
|
mIsConnected = false;
|
||||||
gatt.disconnect();
|
gatt.disconnect();
|
||||||
mGatt = connectGatt(false);
|
mGatt = connectGatt(false);
|
||||||
} else {
|
}
|
||||||
if (getProductId() == TRITON_BLE_PID) {
|
else {
|
||||||
// Android will not properly play well with Data Length Extensions without manually requesting a large MTU,
|
|
||||||
// and Triton controllers require DLE support.
|
|
||||||
//
|
|
||||||
// 517 is basically a "magic number" as far as Android's bluetooth code is concerned, so do not change
|
|
||||||
// this value. It is functionally "please enable data length extensions" on some Android builds.
|
|
||||||
mGatt.requestMtu(517);
|
|
||||||
}
|
|
||||||
|
|
||||||
probeService(this);
|
probeService(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -600,7 +474,7 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
|
|||||||
// Only register controller with the native side once it has been fully configured
|
// Only register controller with the native side once it has been fully configured
|
||||||
if (!isRegistered()) {
|
if (!isRegistered()) {
|
||||||
Log.v(TAG, "Registering Steam Controller with ID: " + getId());
|
Log.v(TAG, "Registering Steam Controller with ID: " + getId());
|
||||||
mManager.HIDDeviceConnected(getId(), getIdentifier(), getVendorId(), getProductId(), getSerialNumber(), getVersion(), getManufacturerName(), getProductName(), 0, 0, 0, 0, true, mReportId);
|
mManager.HIDDeviceConnected(getId(), getIdentifier(), getVendorId(), getProductId(), getSerialNumber(), getVersion(), getManufacturerName(), getProductName(), 0, 0, 0, 0, true);
|
||||||
setRegistered();
|
setRegistered();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -613,8 +487,7 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
|
|||||||
// Enable this for verbose logging of controller input reports
|
// Enable this for verbose logging of controller input reports
|
||||||
//Log.v(TAG, "onCharacteristicChanged uuid=" + characteristic.getUuid() + " data=" + HexDump.dumpHexString(characteristic.getValue()));
|
//Log.v(TAG, "onCharacteristicChanged uuid=" + characteristic.getUuid() + " data=" + HexDump.dumpHexString(characteristic.getValue()));
|
||||||
|
|
||||||
if (characteristic.getUuid().equals(mInputCharacteristic) && !mFrozen) {
|
if (characteristic.getUuid().equals(inputCharacteristic) && !mFrozen) {
|
||||||
mHasSeenInputUpdate = true;
|
|
||||||
mManager.HIDDeviceInputReport(getId(), characteristic.getValue());
|
mManager.HIDDeviceInputReport(getId(), characteristic.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -624,36 +497,19 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
|
|||||||
//Log.v(TAG, "onDescriptorRead status=" + status);
|
//Log.v(TAG, "onDescriptorRead status=" + status);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enableValveMode()
|
|
||||||
{
|
|
||||||
BluetoothGattService valveService = mGatt.getService(steamControllerService);
|
|
||||||
if (valveService == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
BluetoothGattCharacteristic reportChr = valveService.getCharacteristic(reportCharacteristic);
|
|
||||||
if (reportChr != null) {
|
|
||||||
if (getProductId() == TRITON_BLE_PID) {
|
|
||||||
// For Triton we just mark things registered.
|
|
||||||
Log.v(TAG, "Registering Triton Steam Controller with ID: " + getId());
|
|
||||||
mManager.HIDDeviceConnected(getId(), getIdentifier(), getVendorId(), getProductId(), getSerialNumber(), getVersion(), getManufacturerName(), getProductName(), 0, 0, 0, 0, true, mReportId);
|
|
||||||
setRegistered();
|
|
||||||
} else {
|
|
||||||
// For the original controller, we need to manually enter Valve mode.
|
|
||||||
Log.v(TAG, "Writing report characteristic to enter valve mode");
|
|
||||||
reportChr.setValue(enterValveMode);
|
|
||||||
mGatt.writeCharacteristic(reportChr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDescriptorWrite(BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status) {
|
public void onDescriptorWrite(BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status) {
|
||||||
BluetoothGattCharacteristic chr = descriptor.getCharacteristic();
|
BluetoothGattCharacteristic chr = descriptor.getCharacteristic();
|
||||||
//Log.v(TAG, "onDescriptorWrite status=" + status + " uuid=" + chr.getUuid() + " descriptor=" + descriptor.getUuid());
|
//Log.v(TAG, "onDescriptorWrite status=" + status + " uuid=" + chr.getUuid() + " descriptor=" + descriptor.getUuid());
|
||||||
|
|
||||||
if (chr.getUuid().equals(mInputCharacteristic)) {
|
if (chr.getUuid().equals(inputCharacteristic)) {
|
||||||
mHasEnabledNotifications = true;
|
boolean hasWrittenInputDescriptor = true;
|
||||||
enableValveMode();
|
BluetoothGattCharacteristic reportChr = chr.getService().getCharacteristic(reportCharacteristic);
|
||||||
|
if (reportChr != null) {
|
||||||
|
Log.v(TAG, "Writing report characteristic to enter valve mode");
|
||||||
|
reportChr.setValue(enterValveMode);
|
||||||
|
gatt.writeCharacteristic(reportChr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
finishCurrentGattOperation();
|
finishCurrentGattOperation();
|
||||||
@@ -692,20 +548,9 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getProductId() {
|
public int getProductId() {
|
||||||
if (mProductId > 0) {
|
// We don't have an easy way to query from the Bluetooth device, but we know what it is
|
||||||
// We've already set a product ID.
|
final int D0G_BLE2_PID = 0x1106;
|
||||||
return mProductId;
|
return D0G_BLE2_PID;
|
||||||
}
|
|
||||||
|
|
||||||
if (mDevice.getName().startsWith("Steam Ctrl")) {
|
|
||||||
// We're a newer Triton device
|
|
||||||
mProductId = TRITON_BLE_PID;
|
|
||||||
} else {
|
|
||||||
// We're an OG Steam Controller
|
|
||||||
mProductId = D0G_BLE2_PID;
|
|
||||||
}
|
|
||||||
|
|
||||||
return mProductId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -756,29 +601,10 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
|
|||||||
writeCharacteristic(reportCharacteristic, actual_report);
|
writeCharacteristic(reportCharacteristic, actual_report);
|
||||||
return report.length;
|
return report.length;
|
||||||
} else {
|
} else {
|
||||||
// If we're an original-recipe Steam Controller we just write to the characteristic directly.
|
//Log.v(TAG, "writeOutputReport " + HexDump.dumpHexString(report));
|
||||||
if (getProductId() == D0G_BLE2_PID) {
|
writeCharacteristic(reportCharacteristic, report);
|
||||||
//Log.v(TAG, "writeOutputReport " + HexDump.dumpHexString(report));
|
return report.length;
|
||||||
writeCharacteristic(reportCharacteristic, report);
|
|
||||||
return report.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we're a Triton, we need to find the correct report characteristic.
|
|
||||||
if (report.length > 0) {
|
|
||||||
int reportId = report[0] & 0xFF;
|
|
||||||
BluetoothGattCharacteristic targetedReportCharacteristic = mOutputReportChars.get(reportId);
|
|
||||||
if (targetedReportCharacteristic != null) {
|
|
||||||
byte[] actual_report = Arrays.copyOfRange(report, 1, report.length - 1);
|
|
||||||
//Log.v(TAG, "writeOutputReport 0x" + Integer.toString(reportId, 16) + " " + HexDump.dumpHexString(report));
|
|
||||||
writeCharacteristic(targetedReportCharacteristic.getUuid(), actual_report);
|
|
||||||
return report.length;
|
|
||||||
} else {
|
|
||||||
Log.w(TAG, "Got report write request for unknown report type 0x" + Integer.toString(reportId, 16));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -256,7 +256,6 @@ public class HIDDeviceManager {
|
|||||||
0x24c6, // PowerA
|
0x24c6, // PowerA
|
||||||
0x2c22, // Qanba
|
0x2c22, // Qanba
|
||||||
0x2dc8, // 8BitDo
|
0x2dc8, // 8BitDo
|
||||||
0x3537, // GameSir
|
|
||||||
0x37d7, // Flydigi
|
0x37d7, // Flydigi
|
||||||
0x9886, // ASTRO Gaming
|
0x9886, // ASTRO Gaming
|
||||||
};
|
};
|
||||||
@@ -361,7 +360,7 @@ public class HIDDeviceManager {
|
|||||||
HIDDeviceUSB device = new HIDDeviceUSB(this, usbDevice, interface_index);
|
HIDDeviceUSB device = new HIDDeviceUSB(this, usbDevice, interface_index);
|
||||||
int id = device.getId();
|
int id = device.getId();
|
||||||
mDevicesById.put(id, device);
|
mDevicesById.put(id, device);
|
||||||
HIDDeviceConnected(id, device.getIdentifier(), device.getVendorId(), device.getProductId(), device.getSerialNumber(), device.getVersion(), device.getManufacturerName(), device.getProductName(), usbInterface.getId(), usbInterface.getInterfaceClass(), usbInterface.getInterfaceSubclass(), usbInterface.getInterfaceProtocol(), false, 0);
|
HIDDeviceConnected(id, device.getIdentifier(), device.getVendorId(), device.getProductId(), device.getSerialNumber(), device.getVersion(), device.getManufacturerName(), device.getProductName(), usbInterface.getId(), usbInterface.getInterfaceClass(), usbInterface.getInterfaceSubclass(), usbInterface.getInterfaceProtocol(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -530,13 +529,7 @@ public class HIDDeviceManager {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Steam Controllers will always support Bluetooth Low Energy
|
return bluetoothDevice.getName().equals("SteamController") && ((bluetoothDevice.getType() & BluetoothDevice.DEVICE_TYPE_LE) != 0);
|
||||||
if ((bluetoothDevice.getType() & BluetoothDevice.DEVICE_TYPE_LE) == 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Match on the name either the original Steam Controller or the new second-generation one advertise with.
|
|
||||||
return bluetoothDevice.getName().equals("SteamController") || bluetoothDevice.getName().startsWith("Steam Ctrl");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void close() {
|
private void close() {
|
||||||
@@ -688,7 +681,7 @@ public class HIDDeviceManager {
|
|||||||
private native void HIDDeviceRegisterCallback();
|
private native void HIDDeviceRegisterCallback();
|
||||||
private native void HIDDeviceReleaseCallback();
|
private native void HIDDeviceReleaseCallback();
|
||||||
|
|
||||||
native void HIDDeviceConnected(int deviceID, String identifier, int vendorId, int productId, String serial_number, int release_number, String manufacturer_string, String product_string, int interface_number, int interface_class, int interface_subclass, int interface_protocol, boolean bBluetooth, int reportID);
|
native void HIDDeviceConnected(int deviceID, String identifier, int vendorId, int productId, String serial_number, int release_number, String manufacturer_string, String product_string, int interface_number, int interface_class, int interface_subclass, int interface_protocol, boolean bBluetooth);
|
||||||
native void HIDDeviceOpenPending(int deviceID);
|
native void HIDDeviceOpenPending(int deviceID);
|
||||||
native void HIDDeviceOpenResult(int deviceID, boolean opened);
|
native void HIDDeviceOpenResult(int deviceID, boolean opened);
|
||||||
native void HIDDeviceDisconnected(int deviceID);
|
native void HIDDeviceDisconnected(int deviceID);
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ class HIDDeviceUSB implements HIDDevice {
|
|||||||
protected InputThread mInputThread;
|
protected InputThread mInputThread;
|
||||||
protected boolean mRunning;
|
protected boolean mRunning;
|
||||||
protected boolean mFrozen;
|
protected boolean mFrozen;
|
||||||
protected boolean mClaimed;
|
|
||||||
|
|
||||||
public HIDDeviceUSB(HIDDeviceManager manager, UsbDevice usbDevice, int interface_index) {
|
public HIDDeviceUSB(HIDDeviceManager manager, UsbDevice usbDevice, int interface_index) {
|
||||||
mManager = manager;
|
mManager = manager;
|
||||||
@@ -30,7 +29,6 @@ class HIDDeviceUSB implements HIDDevice {
|
|||||||
mInterface = mDevice.getInterface(mInterfaceIndex).getId();
|
mInterface = mDevice.getInterface(mInterfaceIndex).getId();
|
||||||
mDeviceId = manager.getDeviceIDForIdentifier(getIdentifier());
|
mDeviceId = manager.getDeviceIDForIdentifier(getIdentifier());
|
||||||
mRunning = false;
|
mRunning = false;
|
||||||
mClaimed = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String getIdentifier() {
|
String getIdentifier() {
|
||||||
@@ -116,7 +114,6 @@ class HIDDeviceUSB implements HIDDevice {
|
|||||||
close();
|
close();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
mClaimed = true;
|
|
||||||
|
|
||||||
// Find the endpoints
|
// Find the endpoints
|
||||||
for (int j = 0; j < iface.getEndpointCount(); j++) {
|
for (int j = 0; j < iface.getEndpointCount(); j++) {
|
||||||
@@ -135,12 +132,9 @@ class HIDDeviceUSB implements HIDDevice {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure the required endpoints were present. The original Steam Controller and the wireless dongle for it do NOT
|
// Make sure the required endpoints were present
|
||||||
// actually have -- or require -- output endpoints, so we need to accept only an input one for them or else we'll fall
|
if (mInputEndpoint == null || mOutputEndpoint == null) {
|
||||||
// back to the Android system gamepad functionality (and lose our paddles et al).
|
|
||||||
if (mInputEndpoint == null) {
|
|
||||||
Log.w(TAG, "Missing required endpoint on USB device " + getDeviceName());
|
Log.w(TAG, "Missing required endpoint on USB device " + getDeviceName());
|
||||||
mConnection.releaseInterface(iface);
|
|
||||||
close();
|
close();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -160,11 +154,6 @@ class HIDDeviceUSB implements HIDDevice {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mClaimed) {
|
|
||||||
Log.w(TAG, "writeReport() called but some other process currently owns the USB device");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (feature) {
|
if (feature) {
|
||||||
int res = -1;
|
int res = -1;
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
@@ -196,11 +185,6 @@ class HIDDeviceUSB implements HIDDevice {
|
|||||||
}
|
}
|
||||||
return length;
|
return length;
|
||||||
} else {
|
} else {
|
||||||
if (mOutputEndpoint == null)
|
|
||||||
{
|
|
||||||
Log.e(TAG, "Tried to write an output report to an interface with no output endpoint!");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
int res = mConnection.bulkTransfer(mOutputEndpoint, report, report.length, 1000);
|
int res = mConnection.bulkTransfer(mOutputEndpoint, report, report.length, 1000);
|
||||||
if (res != report.length) {
|
if (res != report.length) {
|
||||||
Log.w(TAG, "writeOutputReport() returned " + res + " on device " + getDeviceName());
|
Log.w(TAG, "writeOutputReport() returned " + res + " on device " + getDeviceName());
|
||||||
@@ -221,12 +205,6 @@ class HIDDeviceUSB implements HIDDevice {
|
|||||||
Log.w(TAG, "readReport() called with no device connection");
|
Log.w(TAG, "readReport() called with no device connection");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!mClaimed) {
|
|
||||||
if (feature) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (report_number == 0x0) {
|
if (report_number == 0x0) {
|
||||||
/* Offset the return buffer by 1, so that the report ID
|
/* Offset the return buffer by 1, so that the report ID
|
||||||
@@ -280,13 +258,10 @@ class HIDDeviceUSB implements HIDDevice {
|
|||||||
mInputThread = null;
|
mInputThread = null;
|
||||||
}
|
}
|
||||||
if (mConnection != null) {
|
if (mConnection != null) {
|
||||||
if (mClaimed) {
|
UsbInterface iface = mDevice.getInterface(mInterfaceIndex);
|
||||||
UsbInterface iface = mDevice.getInterface(mInterfaceIndex);
|
mConnection.releaseInterface(iface);
|
||||||
mConnection.releaseInterface(iface);
|
|
||||||
}
|
|
||||||
mConnection.close();
|
mConnection.close();
|
||||||
mConnection = null;
|
mConnection = null;
|
||||||
mClaimed = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -299,22 +274,6 @@ class HIDDeviceUSB implements HIDDevice {
|
|||||||
@Override
|
@Override
|
||||||
public void setFrozen(boolean frozen) {
|
public void setFrozen(boolean frozen) {
|
||||||
mFrozen = frozen;
|
mFrozen = frozen;
|
||||||
|
|
||||||
/* If we have a valid device connection and the claim state doesn't match what we want, try to correct that. */
|
|
||||||
if (mConnection != null && mClaimed == mFrozen) {
|
|
||||||
UsbInterface iface = mDevice.getInterface(mInterfaceIndex);
|
|
||||||
if (frozen) {
|
|
||||||
mClaimed = !mConnection.releaseInterface(iface);
|
|
||||||
if (mClaimed) {
|
|
||||||
Log.e(TAG, "Tried to release claim on USB device, but failed!");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
mClaimed = mConnection.claimInterface(iface, true);
|
|
||||||
if (!mClaimed) {
|
|
||||||
Log.e(TAG, "Tried to regain claim on USB device, but failed!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected class InputThread extends Thread {
|
protected class InputThread extends Thread {
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
|||||||
private static final String TAG = "SDL";
|
private static final String TAG = "SDL";
|
||||||
private static final int SDL_MAJOR_VERSION = 3;
|
private static final int SDL_MAJOR_VERSION = 3;
|
||||||
private static final int SDL_MINOR_VERSION = 4;
|
private static final int SDL_MINOR_VERSION = 4;
|
||||||
private static final int SDL_MICRO_VERSION = 10;
|
private static final int SDL_MICRO_VERSION = 8;
|
||||||
/*
|
/*
|
||||||
// Display InputType.SOURCE/CLASS of events and devices
|
// Display InputType.SOURCE/CLASS of events and devices
|
||||||
//
|
//
|
||||||
@@ -530,8 +530,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
|||||||
|
|
||||||
if (mHIDDeviceManager != null) {
|
if (mHIDDeviceManager != null) {
|
||||||
mHIDDeviceManager.setFrozen(true);
|
mHIDDeviceManager.setFrozen(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mHasMultiWindow) {
|
if (!mHasMultiWindow) {
|
||||||
pauseNativeThread();
|
pauseNativeThread();
|
||||||
}
|
}
|
||||||
@@ -544,8 +543,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
|||||||
|
|
||||||
if (mHIDDeviceManager != null) {
|
if (mHIDDeviceManager != null) {
|
||||||
mHIDDeviceManager.setFrozen(false);
|
mHIDDeviceManager.setFrozen(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mHasMultiWindow) {
|
if (!mHasMultiWindow) {
|
||||||
resumeNativeThread();
|
resumeNativeThread();
|
||||||
}
|
}
|
||||||
@@ -618,14 +616,6 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
|||||||
super.onWindowFocusChanged(hasFocus);
|
super.onWindowFocusChanged(hasFocus);
|
||||||
Log.v(TAG, "onWindowFocusChanged(): " + hasFocus);
|
Log.v(TAG, "onWindowFocusChanged(): " + hasFocus);
|
||||||
|
|
||||||
// If we are gaining focus, we can always try to restore our USB devices. If we are losing focus,
|
|
||||||
// only try to relinquish them if we don't have background events allowed (for multi-window Android setups).
|
|
||||||
if (hasFocus || !SDLActivity.nativeGetHintBoolean("SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS", false)) {
|
|
||||||
if (mHIDDeviceManager != null) {
|
|
||||||
mHIDDeviceManager.setFrozen(!hasFocus);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (SDLActivity.mBrokenLibraries) {
|
if (SDLActivity.mBrokenLibraries) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1491,11 +1481,11 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
|||||||
if (SDLControllerManager.isDeviceSDLJoystick(deviceId)) {
|
if (SDLControllerManager.isDeviceSDLJoystick(deviceId)) {
|
||||||
// Note that we process events with specific key codes here
|
// Note that we process events with specific key codes here
|
||||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||||
if (SDLControllerManager.onNativePadDown(deviceId, keyCode, event.getScanCode())) {
|
if (SDLControllerManager.onNativePadDown(deviceId, keyCode)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (event.getAction() == KeyEvent.ACTION_UP) {
|
} else if (event.getAction() == KeyEvent.ACTION_UP) {
|
||||||
if (SDLControllerManager.onNativePadUp(deviceId, keyCode, event.getScanCode())) {
|
if (SDLControllerManager.onNativePadUp(deviceId, keyCode)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1973,7 +1963,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
|||||||
Intent i = new Intent(Intent.ACTION_VIEW);
|
Intent i = new Intent(Intent.ACTION_VIEW);
|
||||||
i.setData(Uri.parse(url));
|
i.setData(Uri.parse(url));
|
||||||
|
|
||||||
int flags = Intent.FLAG_ACTIVITY_NO_HISTORY
|
int flags = Intent.FLAG_ACTIVITY_NO_HISTORY
|
||||||
| Intent.FLAG_ACTIVITY_MULTIPLE_TASK
|
| Intent.FLAG_ACTIVITY_MULTIPLE_TASK
|
||||||
| Intent.FLAG_ACTIVITY_NEW_DOCUMENT;
|
| Intent.FLAG_ACTIVITY_NEW_DOCUMENT;
|
||||||
i.addFlags(flags);
|
i.addFlags(flags);
|
||||||
@@ -2237,4 +2227,3 @@ class SDLClipboardHandler implements
|
|||||||
SDLActivity.onNativeClipboardChanged();
|
SDLActivity.onNativeClipboardChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,10 +10,6 @@ import android.hardware.lights.Light;
|
|||||||
import android.hardware.lights.LightsRequest;
|
import android.hardware.lights.LightsRequest;
|
||||||
import android.hardware.lights.LightsManager;
|
import android.hardware.lights.LightsManager;
|
||||||
import android.hardware.lights.LightState;
|
import android.hardware.lights.LightState;
|
||||||
import android.hardware.Sensor;
|
|
||||||
import android.hardware.SensorEvent;
|
|
||||||
import android.hardware.SensorEventListener;
|
|
||||||
import android.hardware.SensorManager;
|
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.VibrationEffect;
|
import android.os.VibrationEffect;
|
||||||
@@ -34,18 +30,16 @@ public class SDLControllerManager
|
|||||||
static native void nativeAddJoystick(int device_id, String name, String desc,
|
static native void nativeAddJoystick(int device_id, String name, String desc,
|
||||||
int vendor_id, int product_id,
|
int vendor_id, int product_id,
|
||||||
int button_mask,
|
int button_mask,
|
||||||
int naxes, int axis_mask, int nhats, boolean can_rumble, boolean has_rgb_led,
|
int naxes, int axis_mask, int nhats, boolean can_rumble, boolean has_rgb_led);
|
||||||
boolean has_accelerometer, boolean has_gyroscope);
|
|
||||||
static native void nativeRemoveJoystick(int device_id);
|
static native void nativeRemoveJoystick(int device_id);
|
||||||
static native void nativeAddHaptic(int device_id, String name);
|
static native void nativeAddHaptic(int device_id, String name);
|
||||||
static native void nativeRemoveHaptic(int device_id);
|
static native void nativeRemoveHaptic(int device_id);
|
||||||
static public native boolean onNativePadDown(int device_id, int keycode, int scancode);
|
static public native boolean onNativePadDown(int device_id, int keycode);
|
||||||
static public native boolean onNativePadUp(int device_id, int keycode, int scancode);
|
static public native boolean onNativePadUp(int device_id, int keycode);
|
||||||
static native void onNativeJoy(int device_id, int axis,
|
static native void onNativeJoy(int device_id, int axis,
|
||||||
float value);
|
float value);
|
||||||
static native void onNativeHat(int device_id, int hat_id,
|
static native void onNativeHat(int device_id, int hat_id,
|
||||||
int x, int y);
|
int x, int y);
|
||||||
static native void onNativeJoySensor(int device_id, int sensor_type, long sensor_timestamp, float x, float y, float z);
|
|
||||||
|
|
||||||
protected static SDLJoystickHandler mJoystickHandler;
|
protected static SDLJoystickHandler mJoystickHandler;
|
||||||
protected static SDLHapticHandler mHapticHandler;
|
protected static SDLHapticHandler mHapticHandler;
|
||||||
@@ -87,13 +81,6 @@ public class SDLControllerManager
|
|||||||
mJoystickHandler.setLED(device_id, red, green, blue);
|
mJoystickHandler.setLED(device_id, red, green, blue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* This method is called by SDL using JNI.
|
|
||||||
*/
|
|
||||||
static void joystickSetSensorsEnabled(int device_id, boolean enabled) {
|
|
||||||
mJoystickHandler.setSensorsEnabled(device_id, enabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is called by SDL using JNI.
|
* This method is called by SDL using JNI.
|
||||||
*/
|
*/
|
||||||
@@ -166,10 +153,6 @@ class SDLJoystickHandler {
|
|||||||
ArrayList<InputDevice.MotionRange> hats;
|
ArrayList<InputDevice.MotionRange> hats;
|
||||||
ArrayList<Light> lights;
|
ArrayList<Light> lights;
|
||||||
LightsManager.LightsSession lightsSession;
|
LightsManager.LightsSession lightsSession;
|
||||||
SensorManager sensorManager;
|
|
||||||
SDLJoySensorListener sensorListener;
|
|
||||||
Sensor accelerometerSensor;
|
|
||||||
Sensor gyroscopeSensor;
|
|
||||||
}
|
}
|
||||||
static class RangeComparator implements Comparator<InputDevice.MotionRange> {
|
static class RangeComparator implements Comparator<InputDevice.MotionRange> {
|
||||||
@Override
|
@Override
|
||||||
@@ -242,13 +225,12 @@ class SDLJoystickHandler {
|
|||||||
joystick.desc = getJoystickDescriptor(joystickDevice);
|
joystick.desc = getJoystickDescriptor(joystickDevice);
|
||||||
joystick.axes = new ArrayList<InputDevice.MotionRange>();
|
joystick.axes = new ArrayList<InputDevice.MotionRange>();
|
||||||
joystick.hats = new ArrayList<InputDevice.MotionRange>();
|
joystick.hats = new ArrayList<InputDevice.MotionRange>();
|
||||||
java.util.Set<Integer> axisStrsSet = new java.util.HashSet<Integer>();
|
|
||||||
joystick.lights = new ArrayList<Light>();
|
joystick.lights = new ArrayList<Light>();
|
||||||
|
|
||||||
List<InputDevice.MotionRange> ranges = joystickDevice.getMotionRanges();
|
List<InputDevice.MotionRange> ranges = joystickDevice.getMotionRanges();
|
||||||
Collections.sort(ranges, new RangeComparator());
|
Collections.sort(ranges, new RangeComparator());
|
||||||
for (InputDevice.MotionRange range : ranges) {
|
for (InputDevice.MotionRange range : ranges) {
|
||||||
if (((range.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) && axisStrsSet.add(range.getAxis())) {
|
if ((range.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) {
|
||||||
if (range.getAxis() == MotionEvent.AXIS_HAT_X || range.getAxis() == MotionEvent.AXIS_HAT_Y) {
|
if (range.getAxis() == MotionEvent.AXIS_HAT_X || range.getAxis() == MotionEvent.AXIS_HAT_Y) {
|
||||||
joystick.hats.add(range);
|
joystick.hats.add(range);
|
||||||
} else {
|
} else {
|
||||||
@@ -259,8 +241,6 @@ class SDLJoystickHandler {
|
|||||||
|
|
||||||
boolean can_rumble = false;
|
boolean can_rumble = false;
|
||||||
boolean has_rgb_led = false;
|
boolean has_rgb_led = false;
|
||||||
boolean has_accelerometer = false;
|
|
||||||
boolean has_gyroscope = false;
|
|
||||||
if (Build.VERSION.SDK_INT >= 31 /* Android 12.0 (S) */) {
|
if (Build.VERSION.SDK_INT >= 31 /* Android 12.0 (S) */) {
|
||||||
VibratorManager vibratorManager = joystickDevice.getVibratorManager();
|
VibratorManager vibratorManager = joystickDevice.getVibratorManager();
|
||||||
int[] vibrators = vibratorManager.getVibratorIds();
|
int[] vibrators = vibratorManager.getVibratorIds();
|
||||||
@@ -278,26 +258,12 @@ class SDLJoystickHandler {
|
|||||||
joystick.lightsSession = lightsManager.openSession();
|
joystick.lightsSession = lightsManager.openSession();
|
||||||
has_rgb_led = true;
|
has_rgb_led = true;
|
||||||
}
|
}
|
||||||
SensorManager sensorManager = joystickDevice.getSensorManager();
|
|
||||||
if (sensorManager != null) {
|
|
||||||
joystick.sensorManager = sensorManager;
|
|
||||||
joystick.sensorListener = new SDLJoySensorListener(joystick.device_id);
|
|
||||||
joystick.accelerometerSensor = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
|
|
||||||
if (joystick.accelerometerSensor != null) {
|
|
||||||
has_accelerometer = true;
|
|
||||||
}
|
|
||||||
joystick.gyroscopeSensor = sensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE);
|
|
||||||
if (joystick.gyroscopeSensor != null) {
|
|
||||||
has_gyroscope = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mJoysticks.add(joystick);
|
mJoysticks.add(joystick);
|
||||||
SDLControllerManager.nativeAddJoystick(joystick.device_id, joystick.name, joystick.desc,
|
SDLControllerManager.nativeAddJoystick(joystick.device_id, joystick.name, joystick.desc,
|
||||||
getVendorId(joystickDevice), getProductId(joystickDevice),
|
getVendorId(joystickDevice), getProductId(joystickDevice),
|
||||||
getButtonMask(joystickDevice), joystick.axes.size(), getAxisMask(joystick.axes), joystick.hats.size()/2, can_rumble, has_rgb_led,
|
getButtonMask(joystickDevice), joystick.axes.size(), getAxisMask(joystick.axes), joystick.hats.size()/2, can_rumble, has_rgb_led);
|
||||||
has_accelerometer, has_gyroscope);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -542,31 +508,6 @@ class SDLJoystickHandler {
|
|||||||
}
|
}
|
||||||
joystick.lightsSession.requestLights(lightsRequest.build());
|
joystick.lightsSession.requestLights(lightsRequest.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
void setSensorsEnabled(int device_id, boolean enabled) {
|
|
||||||
if (Build.VERSION.SDK_INT < 31 /* Android 12.0 (S) */) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
SDLJoystick joystick = getJoystick(device_id);
|
|
||||||
if (joystick == null || joystick.sensorManager == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (enabled) {
|
|
||||||
if (joystick.accelerometerSensor != null) {
|
|
||||||
SDLSensorManager.registerListener(joystick.sensorManager, joystick.sensorListener, joystick.accelerometerSensor, SensorManager.SENSOR_DELAY_GAME);
|
|
||||||
}
|
|
||||||
if (joystick.gyroscopeSensor != null) {
|
|
||||||
SDLSensorManager.registerListener(joystick.sensorManager, joystick.sensorListener, joystick.gyroscopeSensor, SensorManager.SENSOR_DELAY_GAME);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (joystick.accelerometerSensor != null) {
|
|
||||||
SDLSensorManager.unregisterListener(joystick.sensorManager, joystick.sensorListener, joystick.accelerometerSensor);
|
|
||||||
}
|
|
||||||
if (joystick.gyroscopeSensor != null) {
|
|
||||||
SDLSensorManager.unregisterListener(joystick.sensorManager, joystick.sensorListener, joystick.gyroscopeSensor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class SDLHapticHandler_API31 extends SDLHapticHandler {
|
class SDLHapticHandler_API31 extends SDLHapticHandler {
|
||||||
@@ -992,19 +933,3 @@ class SDLGenericMotionListener_API29 extends SDLGenericMotionListener_API26 {
|
|||||||
return penDevice.isExternal() ? SDL_PEN_DEVICE_TYPE_INDIRECT : SDL_PEN_DEVICE_TYPE_DIRECT;
|
return penDevice.isExternal() ? SDL_PEN_DEVICE_TYPE_INDIRECT : SDL_PEN_DEVICE_TYPE_DIRECT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class SDLJoySensorListener implements SensorEventListener {
|
|
||||||
int device_id;
|
|
||||||
|
|
||||||
public SDLJoySensorListener(int device_id) {
|
|
||||||
this.device_id = device_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAccuracyChanged(Sensor sensor, int accuracy) {}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSensorChanged(SensorEvent event) {
|
|
||||||
SDLControllerManager.onNativeJoySensor(device_id, event.sensor.getType(), event.timestamp, event.values[0], event.values[1], event.values[2]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,32 +0,0 @@
|
|||||||
package org.libsdl.app;
|
|
||||||
|
|
||||||
import android.hardware.Sensor;
|
|
||||||
import android.hardware.SensorEventListener;
|
|
||||||
import android.hardware.SensorManager;
|
|
||||||
|
|
||||||
// This class coordinates synchronized access to sensor manager registration
|
|
||||||
//
|
|
||||||
// This prevents a java.util.ConcurrentModificationException exception on
|
|
||||||
// Android 16, specifically on the Samsung Tab S9 Ultra.
|
|
||||||
|
|
||||||
class SDLSensorManager
|
|
||||||
{
|
|
||||||
static private SDLSensorManager mManager = new SDLSensorManager();
|
|
||||||
|
|
||||||
public static void registerListener(SensorManager manager, SensorEventListener listener, Sensor sensor, int samplingPeriodUs) {
|
|
||||||
mManager.RegisterListener(manager, listener, sensor, samplingPeriodUs);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void unregisterListener(SensorManager manager, SensorEventListener listener, Sensor sensor) {
|
|
||||||
mManager.UnregisterListener(manager, listener, sensor);
|
|
||||||
}
|
|
||||||
|
|
||||||
private synchronized void RegisterListener(SensorManager manager, SensorEventListener listener, Sensor sensor, int samplingPeriodUs) {
|
|
||||||
manager.registerListener(listener, sensor, samplingPeriodUs, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
private synchronized void UnregisterListener(SensorManager manager, SensorEventListener listener, Sensor sensor) {
|
|
||||||
manager.unregisterListener(listener, sensor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -47,9 +47,6 @@ public class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
|
|||||||
// Is SurfaceView ready for rendering
|
// Is SurfaceView ready for rendering
|
||||||
protected boolean mIsSurfaceReady;
|
protected boolean mIsSurfaceReady;
|
||||||
|
|
||||||
// Is on-screen keyboard visible
|
|
||||||
protected boolean mKeyboardVisible;
|
|
||||||
|
|
||||||
// Pinch events
|
// Pinch events
|
||||||
private final ScaleGestureDetector scaleGestureDetector;
|
private final ScaleGestureDetector scaleGestureDetector;
|
||||||
|
|
||||||
@@ -216,18 +213,6 @@ public class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
|
|||||||
WindowInsets.Type.displayCutout());
|
WindowInsets.Type.displayCutout());
|
||||||
|
|
||||||
SDLActivity.onNativeInsetsChanged(combined.left, combined.right, combined.top, combined.bottom);
|
SDLActivity.onNativeInsetsChanged(combined.left, combined.right, combined.top, combined.bottom);
|
||||||
|
|
||||||
if (insets.isVisible(WindowInsets.Type.ime())) {
|
|
||||||
if (!mKeyboardVisible) {
|
|
||||||
mKeyboardVisible = true;
|
|
||||||
SDLActivity.onNativeScreenKeyboardShown();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (mKeyboardVisible) {
|
|
||||||
mKeyboardVisible = false;
|
|
||||||
SDLActivity.onNativeScreenKeyboardHidden();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pass these to any child views in case they need them
|
// Pass these to any child views in case they need them
|
||||||
@@ -333,11 +318,11 @@ public class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
|
|||||||
protected void enableSensor(int sensortype, boolean enabled) {
|
protected void enableSensor(int sensortype, boolean enabled) {
|
||||||
// TODO: This uses getDefaultSensor - what if we have >1 accels?
|
// TODO: This uses getDefaultSensor - what if we have >1 accels?
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
SDLSensorManager.registerListener(mSensorManager, this,
|
mSensorManager.registerListener(this,
|
||||||
mSensorManager.getDefaultSensor(sensortype),
|
mSensorManager.getDefaultSensor(sensortype),
|
||||||
SensorManager.SENSOR_DELAY_GAME);
|
SensorManager.SENSOR_DELAY_GAME, null);
|
||||||
} else {
|
} else {
|
||||||
SDLSensorManager.unregisterListener(mSensorManager, this,
|
mSensorManager.unregisterListener(this,
|
||||||
mSensorManager.getDefaultSensor(sensortype));
|
mSensorManager.getDefaultSensor(sensortype));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,38 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<component type="desktop-application">
|
|
||||||
<id>dev.twilitrealm.dusk</id>
|
|
||||||
<launchable type="desktop-id">dev.twilitrealm.dusk.desktop</launchable>
|
|
||||||
<name>Dusklight</name>
|
|
||||||
<summary>Native port of a classic adventure game</summary>
|
|
||||||
<developer id="dev.twilitrealm">
|
|
||||||
<name>Twilit Realm</name>
|
|
||||||
</developer>
|
|
||||||
<url type="homepage">https://twilitrealm.dev</url>
|
|
||||||
<url type="bugtracker">https://github.com/TwilitRealm/dusklight/issues</url>
|
|
||||||
<metadata_license>CC0-1.0</metadata_license>
|
|
||||||
<project_license>CC0-1.0</project_license>
|
|
||||||
<content_rating type="oars-1.0"/>
|
|
||||||
<supports>
|
|
||||||
<control>console</control>
|
|
||||||
<control>gamepad</control>
|
|
||||||
</supports>
|
|
||||||
<description>
|
|
||||||
<p>
|
|
||||||
Dusklight is a reverse-engineered reimplementation of a classic adventure game.
|
|
||||||
It aims to be as accurate as possible to the original while also providing new options, enhancements, and tools to customize your experience.
|
|
||||||
</p>
|
|
||||||
</description>
|
|
||||||
|
|
||||||
<provides>
|
|
||||||
<binary>dusklight</binary>
|
|
||||||
<id>dev.twilitrealm.dusk.desktop</id>
|
|
||||||
</provides>
|
|
||||||
|
|
||||||
<releases>
|
|
||||||
<release version="UNRELEASED" date="2026-12-31">
|
|
||||||
<description>
|
|
||||||
<p>Initial Flatpak release.</p>
|
|
||||||
</description>
|
|
||||||
</release>
|
|
||||||
</releases>
|
|
||||||
</component>
|
|
||||||
File diff suppressed because it is too large
Load Diff
+3
-53
@@ -16,12 +16,11 @@ body {
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
align-items: stretch;
|
align-items: stretch;
|
||||||
z-index: 2;
|
z-index: 1;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
fps,
|
fps,
|
||||||
pipeline-progress,
|
|
||||||
toast {
|
toast {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
border: 1dp #92875B;
|
border: 1dp #92875B;
|
||||||
@@ -99,7 +98,7 @@ toast message row.muted {
|
|||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
progress {
|
toast progress {
|
||||||
height: 4dp;
|
height: 4dp;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0;
|
left: 0;
|
||||||
@@ -107,50 +106,10 @@ progress {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
progress fill {
|
toast progress fill {
|
||||||
background-color: rgba(194, 164, 45, 80%);
|
background-color: rgba(194, 164, 45, 80%);
|
||||||
}
|
}
|
||||||
|
|
||||||
pipeline-progress {
|
|
||||||
left: 12dp;
|
|
||||||
bottom: 12dp;
|
|
||||||
display: flex;
|
|
||||||
flex-flow: column;
|
|
||||||
z-index: 100;
|
|
||||||
min-width: 260dp;
|
|
||||||
max-width: 90%;
|
|
||||||
padding: 10dp 16dp 12dp;
|
|
||||||
border-radius: 7dp;
|
|
||||||
overflow: hidden;
|
|
||||||
filter: opacity(0);
|
|
||||||
transition: filter 0.2s linear-in-out;
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
pipeline-progress[open] {
|
|
||||||
filter: opacity(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
pipeline-status {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 8dp;
|
|
||||||
font-size: 18dp;
|
|
||||||
font-weight: normal;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
icon.pipeline-spinner {
|
|
||||||
width: 1.2em;
|
|
||||||
height: 1.2em;
|
|
||||||
line-height: 1.2em;
|
|
||||||
font-size: 1.2em;
|
|
||||||
color: #C2A42D;
|
|
||||||
text-align: center;
|
|
||||||
transform-origin: center;
|
|
||||||
animation: 1s linear infinite pipeline-spinner-spin;
|
|
||||||
}
|
|
||||||
|
|
||||||
toast.achievement {
|
toast.achievement {
|
||||||
border: 1dp #C2A42D;
|
border: 1dp #C2A42D;
|
||||||
}
|
}
|
||||||
@@ -351,15 +310,6 @@ logo img.outer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes pipeline-spinner-spin {
|
|
||||||
from {
|
|
||||||
transform: rotate(0deg);
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
transform: rotate(360deg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-height: 640dp) {
|
@media (max-height: 640dp) {
|
||||||
toast {
|
toast {
|
||||||
top: 20dp;
|
top: 20dp;
|
||||||
|
|||||||
@@ -1,339 +0,0 @@
|
|||||||
*, *:before, *:after {
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
overflow: hidden;
|
|
||||||
font-family: "Fira Sans Condensed";
|
|
||||||
font-weight: bold;
|
|
||||||
color: rgba(248, 244, 232, 90%);
|
|
||||||
z-index: 1;
|
|
||||||
filter: opacity(0);
|
|
||||||
transition: filter 0.2s linear-in-out;
|
|
||||||
}
|
|
||||||
|
|
||||||
body[open] {
|
|
||||||
filter: opacity(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
body:not([open]) {
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
button {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
decorator: none;
|
|
||||||
padding: 0;
|
|
||||||
border: 1dp rgba(255, 255, 255, 22%);
|
|
||||||
background-color: rgba(22, 24, 28, 48%);
|
|
||||||
color: rgba(248, 244, 232, 90%);
|
|
||||||
text-align: center;
|
|
||||||
/* backdrop-filter: blur(7dp); */
|
|
||||||
/* box-shadow: 0 6dp 18dp rgba(0, 0, 0, 28%); */
|
|
||||||
transform-origin: center;
|
|
||||||
transition: background-color border-color filter transform 0.08s linear-in-out,
|
|
||||||
opacity 0.2s linear-in-out;
|
|
||||||
}
|
|
||||||
|
|
||||||
button.pressed,
|
|
||||||
button.active {
|
|
||||||
background-color: rgba(63, 78, 90, 68%);
|
|
||||||
border-color: rgba(255, 255, 255, 48%);
|
|
||||||
filter: brightness(1.18);
|
|
||||||
}
|
|
||||||
|
|
||||||
button:hidden {
|
|
||||||
opacity: 0;
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
button span {
|
|
||||||
display: block;
|
|
||||||
line-height: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
button icon {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
button icon glyph {
|
|
||||||
display: block;
|
|
||||||
font-family: "Material Symbols Rounded";
|
|
||||||
font-weight: normal;
|
|
||||||
font-size: 24dp;
|
|
||||||
line-height: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.midna-icon,
|
|
||||||
.item-icon,
|
|
||||||
.item-count,
|
|
||||||
.oil-meter {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.midna-icon.visible,
|
|
||||||
.item-icon.visible,
|
|
||||||
.item-count.visible,
|
|
||||||
.oil-meter.visible {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.control {
|
|
||||||
position: absolute;
|
|
||||||
}
|
|
||||||
|
|
||||||
.trigger-l.active {
|
|
||||||
background-color: rgba(57, 116, 133, 74%);
|
|
||||||
border-color: rgba(128, 222, 234, 72%);
|
|
||||||
}
|
|
||||||
|
|
||||||
.trigger,
|
|
||||||
.skip {
|
|
||||||
border-radius: 23dp;
|
|
||||||
}
|
|
||||||
|
|
||||||
.trigger {
|
|
||||||
font-size: 22dp;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button-z {
|
|
||||||
background-color: rgba(118, 79, 158, 58%);
|
|
||||||
border-color: rgba(203, 170, 255, 36%);
|
|
||||||
}
|
|
||||||
|
|
||||||
.midna-icon {
|
|
||||||
position: absolute;
|
|
||||||
left: 9dp;
|
|
||||||
top: -1dp;
|
|
||||||
height: 48dp;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button-z.has-icon span,
|
|
||||||
.face.has-item span {
|
|
||||||
position: absolute;
|
|
||||||
font-size: 13dp;
|
|
||||||
line-height: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button-z.has-icon span {
|
|
||||||
right: 9dp;
|
|
||||||
bottom: 7dp;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button-z.pressed {
|
|
||||||
background-color: rgba(139, 91, 187, 82%);
|
|
||||||
border-color: rgba(220, 194, 255, 70%);
|
|
||||||
}
|
|
||||||
|
|
||||||
action-bar {
|
|
||||||
position: absolute;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
border: 1dp rgba(255, 255, 255, 22%);
|
|
||||||
border-radius: 23dp;
|
|
||||||
background-color: rgba(22, 24, 28, 48%);
|
|
||||||
/* backdrop-filter: blur(7dp); */
|
|
||||||
/* box-shadow: 0 -6dp 18dp rgba(0, 0, 0, 28%); */
|
|
||||||
overflow: hidden;
|
|
||||||
opacity: 1;
|
|
||||||
transform-origin: center;
|
|
||||||
transition: opacity 0.2s linear-in-out;
|
|
||||||
}
|
|
||||||
|
|
||||||
action-bar:hidden,
|
|
||||||
action-bar:hidden button,
|
|
||||||
action-bar:hidden separator {
|
|
||||||
opacity: 0;
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.utility {
|
|
||||||
position: relative;
|
|
||||||
flex: 1 1 auto;
|
|
||||||
width: 56dp;
|
|
||||||
height: 44dp;
|
|
||||||
margin: 0;
|
|
||||||
border-width: 0dp;
|
|
||||||
border-radius: 0;
|
|
||||||
background-color: transparent;
|
|
||||||
box-shadow: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.utility,
|
|
||||||
.skip {
|
|
||||||
opacity: 0.55;
|
|
||||||
}
|
|
||||||
|
|
||||||
.utility.pressed {
|
|
||||||
background-color: rgba(63, 78, 90, 68%);
|
|
||||||
}
|
|
||||||
|
|
||||||
.utility.pressed,
|
|
||||||
.skip.pressed {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.skip {
|
|
||||||
z-index: 1;
|
|
||||||
border-color: rgba(255, 255, 255, 36%);
|
|
||||||
}
|
|
||||||
|
|
||||||
separator {
|
|
||||||
display: block;
|
|
||||||
flex: 0 0 1dp;
|
|
||||||
width: 1dp;
|
|
||||||
height: 24dp;
|
|
||||||
background-color: rgba(255, 255, 255, 18%);
|
|
||||||
opacity: 1;
|
|
||||||
transition: opacity 0.2s linear-in-out;
|
|
||||||
}
|
|
||||||
|
|
||||||
.face {
|
|
||||||
position: absolute;
|
|
||||||
border-radius: 29dp;
|
|
||||||
font-size: 24dp;
|
|
||||||
overflow: visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
.item-icon {
|
|
||||||
width: auto;
|
|
||||||
height: auto;
|
|
||||||
max-width: 76%;
|
|
||||||
max-height: 76%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.item-count {
|
|
||||||
position: absolute;
|
|
||||||
left: 6dp;
|
|
||||||
bottom: 5dp;
|
|
||||||
min-width: 17dp;
|
|
||||||
height: 15dp;
|
|
||||||
padding: 1dp 3dp;
|
|
||||||
border-radius: 7dp;
|
|
||||||
background-color: rgba(0, 0, 0, 52%);
|
|
||||||
color: rgba(255, 255, 255, 92%);
|
|
||||||
font-size: 12dp;
|
|
||||||
line-height: 13dp;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.oil-meter {
|
|
||||||
position: absolute;
|
|
||||||
left: 12dp;
|
|
||||||
bottom: -5dp;
|
|
||||||
width: 34dp;
|
|
||||||
height: 8dp;
|
|
||||||
padding: 2dp;
|
|
||||||
border: 1dp rgba(42, 32, 18, 82%);
|
|
||||||
border-radius: 4dp;
|
|
||||||
background-color: rgba(18, 14, 10, 70%);
|
|
||||||
/* box-shadow: 0 2dp 6dp rgba(0, 0, 0, 35%); */
|
|
||||||
}
|
|
||||||
|
|
||||||
oil-fill {
|
|
||||||
display: block;
|
|
||||||
width: 0%;
|
|
||||||
height: 100%;
|
|
||||||
border-radius: 2dp;
|
|
||||||
background-color: rgb(255, 232, 74);
|
|
||||||
}
|
|
||||||
|
|
||||||
.face.has-item span {
|
|
||||||
right: 6dp;
|
|
||||||
bottom: 6dp;
|
|
||||||
color: rgba(255, 255, 255, 88%);
|
|
||||||
}
|
|
||||||
|
|
||||||
.face.a {
|
|
||||||
border-radius: 37dp;
|
|
||||||
font-size: 31dp;
|
|
||||||
background-color: rgba(34, 112, 123, 62%);
|
|
||||||
}
|
|
||||||
|
|
||||||
.face.b {
|
|
||||||
background-color: rgba(161, 61, 66, 58%);
|
|
||||||
}
|
|
||||||
|
|
||||||
.face.x {
|
|
||||||
background-color: rgba(83, 115, 151, 56%);
|
|
||||||
}
|
|
||||||
|
|
||||||
.face.y {
|
|
||||||
background-color: rgba(113, 91, 150, 54%);
|
|
||||||
}
|
|
||||||
|
|
||||||
button.control.docked-top,
|
|
||||||
action-bar.docked-top {
|
|
||||||
border-top-width: 0dp;
|
|
||||||
border-top-left-radius: 0dp;
|
|
||||||
border-top-right-radius: 0dp;
|
|
||||||
}
|
|
||||||
|
|
||||||
button.control.docked-bottom,
|
|
||||||
action-bar.docked-bottom {
|
|
||||||
border-bottom-width: 0dp;
|
|
||||||
border-bottom-left-radius: 0dp;
|
|
||||||
border-bottom-right-radius: 0dp;
|
|
||||||
}
|
|
||||||
|
|
||||||
button.control.docked-left,
|
|
||||||
action-bar.docked-left {
|
|
||||||
border-left-width: 0dp;
|
|
||||||
border-top-left-radius: 0dp;
|
|
||||||
border-bottom-left-radius: 0dp;
|
|
||||||
}
|
|
||||||
|
|
||||||
button.control.docked-right,
|
|
||||||
action-bar.docked-right {
|
|
||||||
border-right-width: 0dp;
|
|
||||||
border-top-right-radius: 0dp;
|
|
||||||
border-bottom-right-radius: 0dp;
|
|
||||||
}
|
|
||||||
|
|
||||||
touch-stick {
|
|
||||||
display: block;
|
|
||||||
position: absolute;
|
|
||||||
width: 124dp;
|
|
||||||
height: 124dp;
|
|
||||||
border-radius: 62dp;
|
|
||||||
background-color: rgba(18, 20, 24, 35%);
|
|
||||||
border: 1dp rgba(255, 255, 255, 20%);
|
|
||||||
/* backdrop-filter: blur(7dp); */
|
|
||||||
/* box-shadow: 0 8dp 24dp rgba(0, 0, 0, 24%); */
|
|
||||||
opacity: 0;
|
|
||||||
pointer-events: none;
|
|
||||||
transition: opacity 0.18s linear-in-out;
|
|
||||||
}
|
|
||||||
|
|
||||||
touch-stick.active {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
stick-ring {
|
|
||||||
position: absolute;
|
|
||||||
left: 18dp;
|
|
||||||
top: 18dp;
|
|
||||||
width: 88dp;
|
|
||||||
height: 88dp;
|
|
||||||
border-radius: 44dp;
|
|
||||||
border: 1dp rgba(255, 255, 255, 18%);
|
|
||||||
}
|
|
||||||
|
|
||||||
stick-knob {
|
|
||||||
position: absolute;
|
|
||||||
width: 48dp;
|
|
||||||
height: 48dp;
|
|
||||||
border-radius: 24dp;
|
|
||||||
background-color: rgba(238, 236, 226, 55%);
|
|
||||||
border: 1dp rgba(255, 255, 255, 45%);
|
|
||||||
}
|
|
||||||
@@ -1,138 +0,0 @@
|
|||||||
body.touch-editor {
|
|
||||||
background-color: rgba(4, 6, 8, 34%);
|
|
||||||
z-index: 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
body.touch-editor .control,
|
|
||||||
body.touch-editor action-bar {
|
|
||||||
opacity: 0.88;
|
|
||||||
cursor: move;
|
|
||||||
pointer-events: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
body.touch-editor .control:hover,
|
|
||||||
body.touch-editor action-bar:hover,
|
|
||||||
body.touch-editor .control.editor-selected,
|
|
||||||
body.touch-editor action-bar.editor-selected {
|
|
||||||
border-color: rgba(255, 232, 128, 80%);
|
|
||||||
filter: brightness(1.15);
|
|
||||||
}
|
|
||||||
|
|
||||||
body.touch-editor action-bar button,
|
|
||||||
body.touch-editor action-bar separator {
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
selection-frame {
|
|
||||||
display: none;
|
|
||||||
position: absolute;
|
|
||||||
z-index: 20;
|
|
||||||
border: 2dp rgba(255, 232, 128, 88%);
|
|
||||||
background-color: rgba(255, 232, 128, 7%);
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
selection-frame.visible {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
resize-handle {
|
|
||||||
display: block;
|
|
||||||
position: absolute;
|
|
||||||
width: 22dp;
|
|
||||||
height: 22dp;
|
|
||||||
border: 2dp rgba(255, 244, 190, 96%);
|
|
||||||
border-radius: 11dp;
|
|
||||||
background-color: rgba(34, 37, 42, 86%);
|
|
||||||
pointer-events: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
resize-handle.left {
|
|
||||||
left: -12dp;
|
|
||||||
}
|
|
||||||
|
|
||||||
resize-handle.right {
|
|
||||||
right: -12dp;
|
|
||||||
}
|
|
||||||
|
|
||||||
resize-handle.top {
|
|
||||||
top: -12dp;
|
|
||||||
}
|
|
||||||
|
|
||||||
resize-handle.bottom {
|
|
||||||
bottom: -12dp;
|
|
||||||
}
|
|
||||||
|
|
||||||
resize-handle.horizontal {
|
|
||||||
top: 50%;
|
|
||||||
margin-top: -11dp;
|
|
||||||
}
|
|
||||||
|
|
||||||
resize-handle.vertical {
|
|
||||||
left: 50%;
|
|
||||||
margin-left: -11dp;
|
|
||||||
}
|
|
||||||
|
|
||||||
resize-handle.corner.left {
|
|
||||||
left: -12dp;
|
|
||||||
}
|
|
||||||
|
|
||||||
resize-handle.corner.right {
|
|
||||||
right: -12dp;
|
|
||||||
}
|
|
||||||
|
|
||||||
resize-handle.corner.top {
|
|
||||||
top: -12dp;
|
|
||||||
}
|
|
||||||
|
|
||||||
resize-handle.corner.bottom {
|
|
||||||
bottom: -12dp;
|
|
||||||
}
|
|
||||||
|
|
||||||
editor-toolbar {
|
|
||||||
display: flex;
|
|
||||||
position: absolute;
|
|
||||||
left: 24dp;
|
|
||||||
right: 24dp;
|
|
||||||
top: 50%;
|
|
||||||
z-index: 30;
|
|
||||||
height: 48dp;
|
|
||||||
margin-top: -24dp;
|
|
||||||
gap: 8dp;
|
|
||||||
justify-content: center;
|
|
||||||
pointer-events: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
editor-toolbar button.editor-command {
|
|
||||||
flex: 0 1 150dp;
|
|
||||||
min-width: 96dp;
|
|
||||||
height: 48dp;
|
|
||||||
padding: 0 14dp;
|
|
||||||
border-radius: 8dp;
|
|
||||||
border: 1dp rgba(255, 255, 255, 26%);
|
|
||||||
background-color: rgba(17, 19, 24, 88%);
|
|
||||||
color: rgba(255, 250, 232, 94%);
|
|
||||||
font-family: "Fira Sans";
|
|
||||||
font-size: 18dp;
|
|
||||||
line-height: 48dp;
|
|
||||||
opacity: 1;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
editor-toolbar button.editor-command span {
|
|
||||||
display: block;
|
|
||||||
width: 100%;
|
|
||||||
line-height: 48dp;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
editor-toolbar button.editor-command.primary {
|
|
||||||
border-color: rgba(255, 232, 128, 70%);
|
|
||||||
background-color: rgba(96, 82, 38, 90%);
|
|
||||||
}
|
|
||||||
|
|
||||||
editor-toolbar button.editor-command:hover,
|
|
||||||
editor-toolbar button.editor-command:focus-visible {
|
|
||||||
border-color: rgba(255, 244, 190, 92%);
|
|
||||||
background-color: rgba(78, 85, 96, 92%);
|
|
||||||
}
|
|
||||||
+18
-46
@@ -12734,19 +12734,7 @@ void daAlink_c::setMagicArmorBrk(int i_status) {
|
|||||||
|
|
||||||
BOOL daAlink_c::checkMagicArmorHeavy() const {
|
BOOL daAlink_c::checkMagicArmorHeavy() const {
|
||||||
#if TARGET_PC
|
#if TARGET_PC
|
||||||
if(!checkMagicArmorWearAbility()) {
|
return checkMagicArmorWearAbility() && (dComIfGs_getRupee() == 0 && !dusk::getSettings().game.freeMagicArmor);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch(dusk::getSettings().game.armorRupeeDrain) {
|
|
||||||
case dusk::MagicArmorMode::NORMAL:
|
|
||||||
return dComIfGs_getRupee() == 0;
|
|
||||||
case dusk::MagicArmorMode::ON_DAMAGE:
|
|
||||||
case dusk::MagicArmorMode::DOUBLE_DEFENSE:
|
|
||||||
case dusk::MagicArmorMode::INVINCIBLE:
|
|
||||||
case dusk::MagicArmorMode::COSMETIC:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
return checkMagicArmorWearAbility() && dComIfGs_getRupee() == 0;
|
return checkMagicArmorWearAbility() && dComIfGs_getRupee() == 0;
|
||||||
#endif
|
#endif
|
||||||
@@ -14808,8 +14796,6 @@ void daAlink_c::deleteEquipItem(BOOL i_isPlaySound, BOOL i_isDeleteKantera) {
|
|||||||
#if TARGET_PC
|
#if TARGET_PC
|
||||||
mIBChainInterpPrevValid = false;
|
mIBChainInterpPrevValid = false;
|
||||||
mIBChainInterpCurrValid = false;
|
mIBChainInterpCurrValid = false;
|
||||||
mHsChainInterpPrevValid = false;
|
|
||||||
mHsChainInterpCurrValid = false;
|
|
||||||
#endif
|
#endif
|
||||||
field_0x0774 = NULL;
|
field_0x0774 = NULL;
|
||||||
field_0x0778 = NULL;
|
field_0x0778 = NULL;
|
||||||
@@ -18721,7 +18707,7 @@ int daAlink_c::execute() {
|
|||||||
#if TARGET_PC
|
#if TARGET_PC
|
||||||
// This handles rupee drain and transitions between rupees/no rupees
|
// This handles rupee drain and transitions between rupees/no rupees
|
||||||
// We can skip all of that if the magic armor doesn't use rupees
|
// We can skip all of that if the magic armor doesn't use rupees
|
||||||
if (dusk::getSettings().game.armorRupeeDrain.getValue() == dusk::MagicArmorMode::NORMAL && checkMagicArmorWearAbility() && mClothesChangeWaitTimer == 0) {
|
if (!dusk::getSettings().game.freeMagicArmor && checkMagicArmorWearAbility() && mClothesChangeWaitTimer == 0) {
|
||||||
#else
|
#else
|
||||||
if (checkMagicArmorWearAbility() && mClothesChangeWaitTimer == 0) {
|
if (checkMagicArmorWearAbility() && mClothesChangeWaitTimer == 0) {
|
||||||
#endif
|
#endif
|
||||||
@@ -19782,37 +19768,23 @@ int daAlink_c::draw() {
|
|||||||
dComIfGd_getOpaListDark()->entryImm(mpHookChain, 0);
|
dComIfGd_getOpaListDark()->entryImm(mpHookChain, 0);
|
||||||
|
|
||||||
#if TARGET_PC
|
#if TARGET_PC
|
||||||
if (dusk::frame_interp::is_enabled()) {
|
if (dusk::frame_interp::is_enabled() &&
|
||||||
if (mEquipItem == dItemNo_IRONBALL_e &&
|
mEquipItem == dItemNo_IRONBALL_e &&
|
||||||
mIronBallChainPos != NULL && mIronBallChainAngle != NULL)
|
mIronBallChainPos != NULL && mIronBallChainAngle != NULL)
|
||||||
{
|
{
|
||||||
if (mIBChainInterpCurrValid) {
|
if (mIBChainInterpCurrValid) {
|
||||||
memcpy(mIBChainInterpPrevPos, mIBChainInterpCurrPos, IRON_BALL_CHAIN_COUNT * sizeof(cXyz));
|
memcpy(mIBChainInterpPrevPos, mIBChainInterpCurrPos, IRON_BALL_CHAIN_COUNT * sizeof(cXyz));
|
||||||
memcpy(mIBChainInterpPrevAngle, mIBChainInterpCurrAngle, IRON_BALL_CHAIN_COUNT * sizeof(csXyz));
|
memcpy(mIBChainInterpPrevAngle, mIBChainInterpCurrAngle, IRON_BALL_CHAIN_COUNT * sizeof(csXyz));
|
||||||
mIBChainInterpPrevHandRoot = mIBChainInterpCurrHandRoot;
|
mIBChainInterpPrevHandRoot = mIBChainInterpCurrHandRoot;
|
||||||
mIBChainInterpPrevValid = true;
|
mIBChainInterpPrevValid = true;
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(mIBChainInterpCurrPos, mIronBallChainPos, IRON_BALL_CHAIN_COUNT * sizeof(cXyz));
|
|
||||||
memcpy(mIBChainInterpCurrAngle, mIronBallChainAngle, IRON_BALL_CHAIN_COUNT * sizeof(csXyz));
|
|
||||||
mIBChainInterpCurrHandRoot = mHookshotTopPos;
|
|
||||||
mIBChainInterpCurrValid = true;
|
|
||||||
|
|
||||||
dusk::frame_interp::add_interpolation_callback(&ironBallChainInterpCallback, this);
|
|
||||||
} else {
|
|
||||||
if (mHsChainInterpCurrValid) {
|
|
||||||
mHsChainInterpPrevTop = mHsChainInterpCurrTop;
|
|
||||||
mHsChainInterpPrevRoot = mHsChainInterpCurrRoot;
|
|
||||||
mHsChainInterpPrevSubRoot = mHsChainInterpCurrSubRoot;
|
|
||||||
mHsChainInterpPrevSubTop = mHsChainInterpCurrSubTop;
|
|
||||||
mHsChainInterpPrevValid = true;
|
|
||||||
}
|
|
||||||
mHsChainInterpCurrTop = mHookshotTopPos;
|
|
||||||
mHsChainInterpCurrRoot = mHeldItemRootPos;
|
|
||||||
mHsChainInterpCurrSubRoot = field_0x3810;
|
|
||||||
mHsChainInterpCurrSubTop = mIronBallBgChkPos;
|
|
||||||
mHsChainInterpCurrValid = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
memcpy(mIBChainInterpCurrPos, mIronBallChainPos, IRON_BALL_CHAIN_COUNT * sizeof(cXyz));
|
||||||
|
memcpy(mIBChainInterpCurrAngle, mIronBallChainAngle, IRON_BALL_CHAIN_COUNT * sizeof(csXyz));
|
||||||
|
mIBChainInterpCurrHandRoot = mHookshotTopPos;
|
||||||
|
mIBChainInterpCurrValid = true;
|
||||||
|
|
||||||
|
dusk::frame_interp::add_interpolation_callback(&ironBallChainInterpCallback, this);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ int daAlink_c::setDamagePoint(int i_dmgAmount, BOOL i_checkZoraMag, BOOL i_setDm
|
|||||||
|
|
||||||
if (checkMagicArmorNoDamage()) {
|
if (checkMagicArmorNoDamage()) {
|
||||||
#if TARGET_PC
|
#if TARGET_PC
|
||||||
if(dusk::getSettings().game.armorRupeeDrain.getValue() == dusk::MagicArmorMode::INVINCIBLE) {
|
if(dusk::getSettings().game.freeMagicArmor) {
|
||||||
i_dmgAmount = 0;
|
i_dmgAmount = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -202,11 +202,6 @@ int daAlink_c::setDamagePoint(int i_dmgAmount, BOOL i_checkZoraMag, BOOL i_setDm
|
|||||||
if (!mpHIO->mDamage.m.mInvincible && g_debugHpMode == 0)
|
if (!mpHIO->mDamage.m.mInvincible && g_debugHpMode == 0)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#if TARGET_PC
|
|
||||||
if(checkMagicArmorWearAbility() && dusk::getSettings().game.armorRupeeDrain.getValue() == dusk::MagicArmorMode::DOUBLE_DEFENSE) {
|
|
||||||
i_dmgAmount /= 2;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
dComIfGp_setItemLifeCount(-i_dmgAmount, 0);
|
dComIfGp_setItemLifeCount(-i_dmgAmount, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -286,26 +281,7 @@ BOOL daAlink_c::checkIcePolygonDamage(cBgS_PolyInfo* i_poly) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
BOOL daAlink_c::checkMagicArmorNoDamage() {
|
BOOL daAlink_c::checkMagicArmorNoDamage() {
|
||||||
#ifdef TARGET_PC
|
|
||||||
if (!checkMagicArmorWearAbility()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch(dusk::getSettings().game.armorRupeeDrain) {
|
|
||||||
case dusk::MagicArmorMode::NORMAL:
|
|
||||||
return !checkMagicArmorHeavy();
|
|
||||||
case dusk::MagicArmorMode::ON_DAMAGE:
|
|
||||||
return dComIfGs_getRupee() != 0;
|
|
||||||
case dusk::MagicArmorMode::DOUBLE_DEFENSE:
|
|
||||||
return false;
|
|
||||||
case dusk::MagicArmorMode::INVINCIBLE:
|
|
||||||
return true;
|
|
||||||
case dusk::MagicArmorMode::COSMETIC:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
return checkMagicArmorWearAbility() && !checkMagicArmorHeavy();
|
return checkMagicArmorWearAbility() && !checkMagicArmorHeavy();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int daAlink_c::checkPolyDamage() {
|
int daAlink_c::checkPolyDamage() {
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ void daAlink_c::handleQuickTransform() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check to see if Link has the ability to transform.
|
// Check to see if Link has the ability to transform.
|
||||||
if (!dComIfGs_isEventBit(dSv_event_flag_c::M_077)) {
|
if (!dComIfGs_isEventBit(dSv_event_flag_c::M_077) && !dusk::getSettings().game.transformWithoutShadowCrystal) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,7 +102,7 @@ void daAlink_c::handleQuickTransform() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ensure that the Z Button is not dimmed
|
// Ensure that the Z Button is not dimmed
|
||||||
if (meterDrawPtr->getButtonZAlpha() != 1.f) {
|
if (meterDrawPtr->getButtonZAlpha() != 1.f && !dusk::getSettings().game.transformWithoutShadowCrystal) {
|
||||||
Z2GetAudioMgr()->seStart(Z2SE_SYS_ERROR, NULL, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0);
|
Z2GetAudioMgr()->seStart(Z2SE_SYS_ERROR, NULL, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -122,7 +122,7 @@ void daAlink_c::handleQuickTransform() {
|
|||||||
bool canTransform = false;
|
bool canTransform = false;
|
||||||
|
|
||||||
if (mLinkAcch.ChkGroundHit() && !checkModeFlg(MODE_PLAYER_FLY) && !checkMagneBootsOn()) {
|
if (mLinkAcch.ChkGroundHit() && !checkModeFlg(MODE_PLAYER_FLY) && !checkMagneBootsOn()) {
|
||||||
if (checkMidnaRide()) {
|
if (checkMidnaRide() || dusk::getSettings().game.transformWithoutShadowCrystal) {
|
||||||
if ((checkWolf() &&
|
if ((checkWolf() &&
|
||||||
(checkModeFlg(MODE_UNK_1000) || dComIfGp_checkPlayerStatus0(0, 0x10))) ||
|
(checkModeFlg(MODE_UNK_1000) || dComIfGp_checkPlayerStatus0(0, 0x10))) ||
|
||||||
(!checkWolf() &&
|
(!checkWolf() &&
|
||||||
@@ -144,7 +144,7 @@ void daAlink_c::handleQuickTransform() {
|
|||||||
procCoMetamorphoseInit();
|
procCoMetamorphoseInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool daAlink_c::checkAimContext() {
|
bool daAlink_c::checkGyroAimContext() {
|
||||||
switch (mProcID) {
|
switch (mProcID) {
|
||||||
case PROC_SUBJECTIVITY:
|
case PROC_SUBJECTIVITY:
|
||||||
case PROC_SWIM_SUBJECTIVITY:
|
case PROC_SWIM_SUBJECTIVITY:
|
||||||
@@ -175,13 +175,3 @@ bool daAlink_c::checkAimContext() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool daAlink_c::checkAimInputContext() {
|
|
||||||
switch (mProcID) {
|
|
||||||
case PROC_HOOKSHOT_ROOF_WAIT:
|
|
||||||
case PROC_HOOKSHOT_WALL_WAIT:
|
|
||||||
return false;
|
|
||||||
default:
|
|
||||||
return checkAimContext();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -2028,10 +2028,11 @@ void daAlink_blur_c::traceBlur(cXyz const* param_0, cXyz const* param_1, s16 par
|
|||||||
}
|
}
|
||||||
|
|
||||||
void daAlink_blur_c::draw() {
|
void daAlink_blur_c::draw() {
|
||||||
ZoneScoped;
|
|
||||||
j3dSys.reinitGX();
|
j3dSys.reinitGX();
|
||||||
|
|
||||||
#if !TARGET_PC
|
#ifdef TARGET_PC
|
||||||
|
TGXTexObj texObj;
|
||||||
|
#else
|
||||||
static TGXTexObj texObj;
|
static TGXTexObj texObj;
|
||||||
#endif
|
#endif
|
||||||
static GXColor nColor0 = {0xFF, 0xFF, 0xFF, 0x14};
|
static GXColor nColor0 = {0xFF, 0xFF, 0xFF, 0x14};
|
||||||
@@ -2039,25 +2040,11 @@ void daAlink_blur_c::draw() {
|
|||||||
GXSetNumIndStages(0);
|
GXSetNumIndStages(0);
|
||||||
nColor0.a = field_0x20;
|
nColor0.a = field_0x20;
|
||||||
|
|
||||||
#if TARGET_PC
|
|
||||||
if (mpCachedBlurTex != m_blurTex) {
|
|
||||||
mBlurTexObj.reset();
|
|
||||||
GXInitTexObj(&mBlurTexObj,
|
|
||||||
reinterpret_cast<void*>(
|
|
||||||
reinterpret_cast<uintptr_t>(m_blurTex) + m_blurTex->imageOffset),
|
|
||||||
16, 4, GX_TF_I4, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
|
||||||
GXInitTexObjLOD(
|
|
||||||
&mBlurTexObj, GX_LINEAR, GX_LINEAR, 0.0f, 0.0f, 0.0f, GX_FALSE, GX_FALSE, GX_ANISO_1);
|
|
||||||
mpCachedBlurTex = m_blurTex;
|
|
||||||
}
|
|
||||||
GXLoadTexObj(&mBlurTexObj, GX_TEXMAP0);
|
|
||||||
#else
|
|
||||||
GXInitTexObj(&texObj, (void*)((uintptr_t)m_blurTex + m_blurTex->imageOffset), 16, 4, GX_TF_I4,
|
GXInitTexObj(&texObj, (void*)((uintptr_t)m_blurTex + m_blurTex->imageOffset), 16, 4, GX_TF_I4,
|
||||||
GX_CLAMP, GX_CLAMP, GX_FALSE);
|
GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||||
GXInitTexObjLOD(&texObj, GX_LINEAR, GX_LINEAR, 0.0f, 0.0f, 0.0f, GX_FALSE, GX_FALSE,
|
GXInitTexObjLOD(&texObj, GX_LINEAR, GX_LINEAR, 0.0f, 0.0f, 0.0f, GX_FALSE, GX_FALSE,
|
||||||
GX_ANISO_1);
|
GX_ANISO_1);
|
||||||
GXLoadTexObj(&texObj, GX_TEXMAP0);
|
GXLoadTexObj(&texObj, GX_TEXMAP0);
|
||||||
#endif
|
|
||||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_F32, 0);
|
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_F32, 0);
|
||||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_RGBA4, 8);
|
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_RGBA4, 8);
|
||||||
GXClearVtxDesc();
|
GXClearVtxDesc();
|
||||||
|
|||||||
@@ -136,26 +136,8 @@ void daAlink_c::hsChainShape_c::draw() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
#if TARGET_PC
|
|
||||||
cXyz hsInterpTop, hsInterpRoot, hsInterpSubRoot, hsInterpSubTop;
|
|
||||||
if (dusk::frame_interp::is_enabled() && alink->mHsChainInterpPrevValid && alink->mHsChainInterpCurrValid) {
|
|
||||||
const f32 alpha = dusk::frame_interp::get_interpolation_step();
|
|
||||||
hsInterpTop = alink->mHsChainInterpPrevTop + (alink->mHsChainInterpCurrTop - alink->mHsChainInterpPrevTop) * alpha;
|
|
||||||
hsInterpRoot = alink->mHsChainInterpPrevRoot + (alink->mHsChainInterpCurrRoot - alink->mHsChainInterpPrevRoot) * alpha;
|
|
||||||
hsInterpSubRoot = alink->mHsChainInterpPrevSubRoot + (alink->mHsChainInterpCurrSubRoot - alink->mHsChainInterpPrevSubRoot) * alpha;
|
|
||||||
hsInterpSubTop = alink->mHsChainInterpPrevSubTop + (alink->mHsChainInterpCurrSubTop - alink->mHsChainInterpPrevSubTop) * alpha;
|
|
||||||
} else {
|
|
||||||
hsInterpTop = alink->getHsChainTopPos();
|
|
||||||
hsInterpRoot = alink->getHsChainRootPos();
|
|
||||||
hsInterpSubRoot = alink->getHsSubChainRootPos();
|
|
||||||
hsInterpSubTop = alink->getHsSubChainTopPos();
|
|
||||||
}
|
|
||||||
const cXyz& chainRootPos = hsInterpRoot;
|
|
||||||
const cXyz& chainTopPos = hsInterpTop;
|
|
||||||
#else
|
|
||||||
const cXyz& chainRootPos = alink->getHsChainRootPos();
|
const cXyz& chainRootPos = alink->getHsChainRootPos();
|
||||||
const cXyz& chainTopPos = alink->getHsChainTopPos();
|
const cXyz& chainTopPos = alink->getHsChainTopPos();
|
||||||
#endif
|
|
||||||
cXyz maxDistance = chainRootPos - chainTopPos;
|
cXyz maxDistance = chainRootPos - chainTopPos;
|
||||||
|
|
||||||
f32 maxDistanceF = maxDistance.abs();
|
f32 maxDistanceF = maxDistance.abs();
|
||||||
@@ -218,13 +200,8 @@ void daAlink_c::hsChainShape_c::draw() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TARGET_PC
|
|
||||||
const cXyz& subChainRootPos = hsInterpSubRoot;
|
|
||||||
const cXyz& subChainTopPos = hsInterpSubTop;
|
|
||||||
#else
|
|
||||||
const cXyz& subChainRootPos = alink->getHsSubChainRootPos();
|
const cXyz& subChainRootPos = alink->getHsSubChainRootPos();
|
||||||
const cXyz& subChainTopPos = alink->getHsSubChainTopPos();
|
const cXyz& subChainTopPos = alink->getHsSubChainTopPos();
|
||||||
#endif
|
|
||||||
maxDistance = subChainRootPos - subChainTopPos;
|
maxDistance = subChainRootPos - subChainTopPos;
|
||||||
|
|
||||||
maxDistanceF = maxDistance.abs();
|
maxDistanceF = maxDistance.abs();
|
||||||
|
|||||||
@@ -11,10 +11,8 @@
|
|||||||
#include "d/actor/d_a_tag_mhint.h"
|
#include "d/actor/d_a_tag_mhint.h"
|
||||||
|
|
||||||
#if TARGET_PC
|
#if TARGET_PC
|
||||||
#include "dusk/action_bindings.h"
|
|
||||||
#include "dusk/gyro.h"
|
#include "dusk/gyro.h"
|
||||||
#include "dusk/mouse.h"
|
#include "dusk/action_bindings.h"
|
||||||
#include "dusk/touch_camera.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool daAlink_c::checkNoSubjectModeCamera() {
|
bool daAlink_c::checkNoSubjectModeCamera() {
|
||||||
@@ -133,10 +131,7 @@ BOOL daAlink_c::setBodyAngleToCamera() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if TARGET_PC
|
#if TARGET_PC
|
||||||
if ((dusk::getSettings().game.enableGyroAim ||
|
if (dusk::getSettings().game.enableGyroAim && checkGyroAimContext()) {
|
||||||
dusk::getSettings().game.enableMouseAim) &&
|
|
||||||
checkAimInputContext())
|
|
||||||
{
|
|
||||||
f32 gyro_scale = 1.0f;
|
f32 gyro_scale = 1.0f;
|
||||||
if (checkWolfEyeUp()) {
|
if (checkWolfEyeUp()) {
|
||||||
gyro_scale *= 0.6f;
|
gyro_scale *= 0.6f;
|
||||||
@@ -146,52 +141,17 @@ BOOL daAlink_c::setBodyAngleToCamera() {
|
|||||||
gyro_scale /= dComIfGp_getCameraZoomScale(field_0x317c);
|
gyro_scale /= dComIfGp_getCameraZoomScale(field_0x317c);
|
||||||
}
|
}
|
||||||
|
|
||||||
f32 final_yaw = 0.f;
|
f32 gy_yaw = 0.f;
|
||||||
f32 final_pitch = 0.f;
|
f32 gy_pitch = 0.f;
|
||||||
if (dusk::getSettings().game.enableMouseAim) {
|
dusk::gyro::getAimDeltas(gy_yaw, gy_pitch);
|
||||||
dusk::mouse::get_aim_deltas(final_yaw, final_pitch);
|
|
||||||
}
|
|
||||||
if (dusk::getSettings().game.enableGyroAim) {
|
|
||||||
f32 gyro_yaw = 0.f;
|
|
||||||
f32 gyro_pitch = 0.f;
|
|
||||||
dusk::gyro::getAimDeltas(gyro_yaw, gyro_pitch);
|
|
||||||
final_yaw += gyro_yaw;
|
|
||||||
final_pitch += gyro_pitch;
|
|
||||||
}
|
|
||||||
|
|
||||||
shape_angle.y = shape_angle.y + cM_rad2s(final_yaw * gyro_scale);
|
shape_angle.y = shape_angle.y + cM_rad2s(gy_yaw * gyro_scale);
|
||||||
sp8 = sp8 + cM_rad2s(final_pitch * gyro_scale);
|
sp8 = sp8 + cM_rad2s(gy_pitch * gyro_scale);
|
||||||
|
|
||||||
if (checkNotItemSinkLimit() && sp8 > 0 && sp8 > mBodyAngle.x) {
|
if (checkNotItemSinkLimit() && sp8 > 0 && sp8 > mBodyAngle.x) {
|
||||||
sp8 = mBodyAngle.x;
|
sp8 = mBodyAngle.x;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dusk::getSettings().game.enableTouchControls && checkAimInputContext()) {
|
|
||||||
f32 touchYawDp = 0.0f;
|
|
||||||
f32 touchPitchDp = 0.0f;
|
|
||||||
if (dusk::touch_camera::consume_delta(touchYawDp, touchPitchDp)) {
|
|
||||||
f32 scale = 1.0f;
|
|
||||||
if (checkWolfEyeUp()) {
|
|
||||||
scale *= 0.6f;
|
|
||||||
}
|
|
||||||
if (dComIfGp_checkPlayerStatus0(0, 0x200000)) {
|
|
||||||
scale /= dComIfGp_getCameraZoomScale(field_0x317c);
|
|
||||||
}
|
|
||||||
|
|
||||||
const f32 yawDeg = -touchYawDp * dusk::touch_camera::YAW_DEGREES_PER_DP * scale *
|
|
||||||
dusk::getSettings().game.touchCameraXSensitivity;
|
|
||||||
const f32 pitchDeg = touchPitchDp * dusk::touch_camera::PITCH_DEGREES_PER_DP *
|
|
||||||
scale * dusk::getSettings().game.touchCameraYSensitivity;
|
|
||||||
|
|
||||||
shape_angle.y = shape_angle.y + cM_deg2s(yawDeg);
|
|
||||||
sp8 = sp8 + cM_deg2s(pitchDeg);
|
|
||||||
|
|
||||||
if (checkNotItemSinkLimit() && sp8 > 0 && sp8 > mBodyAngle.x) {
|
|
||||||
sp8 = mBodyAngle.x;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (checkNotItemSinkLimit() && sp8 > 0) {
|
if (checkNotItemSinkLimit() && sp8 > 0) {
|
||||||
|
|||||||
@@ -85,6 +85,17 @@ int daAlink_c::loadModelDVD() {
|
|||||||
}
|
}
|
||||||
cPhs_Reset(&mPhaseReq);
|
cPhs_Reset(&mPhaseReq);
|
||||||
mpArcHeap->freeAll();
|
mpArcHeap->freeAll();
|
||||||
|
#if TARGET_PC
|
||||||
|
field_0x06d0 = NULL;
|
||||||
|
field_0x06d4 = NULL;
|
||||||
|
field_0x06d8 = NULL;
|
||||||
|
field_0x06dc = NULL;
|
||||||
|
field_0x06e0 = NULL;
|
||||||
|
field_0x06e4 = NULL;
|
||||||
|
field_0x06e8 = NULL;
|
||||||
|
field_0x06ec = NULL;
|
||||||
|
field_0x06f0 = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (mProcID == PROC_METAMORPHOSE || mProcID == PROC_METAMORPHOSE_ONLY) {
|
if (mProcID == PROC_METAMORPHOSE || mProcID == PROC_METAMORPHOSE_ONLY) {
|
||||||
setArcName(!checkWolf());
|
setArcName(!checkWolf());
|
||||||
|
|||||||
@@ -348,7 +348,7 @@ void daAlink_c::changeLink(int param_0) {
|
|||||||
initModel(static_cast<J3DModelData*>(dComIfG_getObjectRes(l_mArcName, "al_hands.bmd")), 0);
|
initModel(static_cast<J3DModelData*>(dComIfG_getObjectRes(l_mArcName, "al_hands.bmd")), 0);
|
||||||
|
|
||||||
#if TARGET_PC
|
#if TARGET_PC
|
||||||
if (dComIfGs_getRupee() != 0 || dusk::getSettings().game.armorRupeeDrain.getValue() != dusk::MagicArmorMode::NORMAL)
|
if (dComIfGs_getRupee() != 0 || dusk::getSettings().game.freeMagicArmor)
|
||||||
#else
|
#else
|
||||||
if (dComIfGs_getRupee() != 0)
|
if (dComIfGs_getRupee() != 0)
|
||||||
#endif
|
#endif
|
||||||
@@ -458,7 +458,7 @@ void daAlink_c::changeLink(int param_0) {
|
|||||||
field_0x06f0 = field_0x064C->getMaterialNodePointer(2)->getShape();
|
field_0x06f0 = field_0x064C->getMaterialNodePointer(2)->getShape();
|
||||||
|
|
||||||
#if TARGET_PC
|
#if TARGET_PC
|
||||||
if (dComIfGs_getRupee() != 0 || dusk::getSettings().game.armorRupeeDrain.getValue() != dusk::MagicArmorMode::NORMAL) {
|
if (dComIfGs_getRupee() != 0 || dusk::getSettings().game.freeMagicArmor) {
|
||||||
#else
|
#else
|
||||||
if (dComIfGs_getRupee() != 0) {
|
if (dComIfGs_getRupee() != 0) {
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -5472,15 +5472,6 @@ int daB_ZANT_c::create() {
|
|||||||
fopAcM_ct(this, daB_ZANT_c);
|
fopAcM_ct(this, daB_ZANT_c);
|
||||||
OS_REPORT("B_ZANT PARAM %x\n", fopAcM_GetParam(this));
|
OS_REPORT("B_ZANT PARAM %x\n", fopAcM_GetParam(this));
|
||||||
|
|
||||||
#if TARGET_PC
|
|
||||||
// Due to our loads being so much faster, Zant can initialize *before* the player
|
|
||||||
// This breaks respawning in the final phase of the fight when it tries
|
|
||||||
// to load the player's position
|
|
||||||
if (daPy_getPlayerActorClass() == NULL) {
|
|
||||||
return cPhs_INIT_e;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
mSwbit = fopAcM_GetParam(this);
|
mSwbit = fopAcM_GetParam(this);
|
||||||
if (mSwbit != 0xFF) {
|
if (mSwbit != 0xFF) {
|
||||||
if (dComIfGs_isSwitch(mSwbit, fopAcM_GetRoomNo(this))) {
|
if (dComIfGs_isSwitch(mSwbit, fopAcM_GetRoomNo(this))) {
|
||||||
|
|||||||
@@ -144,7 +144,11 @@ bool daBgObj_c::spec_data_c::Set(void* i_ptr) {
|
|||||||
default:
|
default:
|
||||||
// Invalid data block type
|
// Invalid data block type
|
||||||
OS_REPORT_ERROR("データブロックタイプが不正です<%d>\n", block_type);
|
OS_REPORT_ERROR("データブロックタイプが不正です<%d>\n", block_type);
|
||||||
|
#if DUSK_TPHD
|
||||||
|
return 0; // HD-port: skip actor instead of asserting.
|
||||||
|
#else
|
||||||
JUT_ASSERT(527, FALSE);
|
JUT_ASSERT(527, FALSE);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (block_type == 0) {
|
if (block_type == 0) {
|
||||||
@@ -185,7 +189,11 @@ bool daBgObj_c::spec_data_c::Set(void* i_ptr) {
|
|||||||
default:
|
default:
|
||||||
// Invalid data block type
|
// Invalid data block type
|
||||||
OS_REPORT_ERROR("データブロックタイプが不正です<%d>\n", block_type);
|
OS_REPORT_ERROR("データブロックタイプが不正です<%d>\n", block_type);
|
||||||
|
#if DUSK_TPHD
|
||||||
|
return 0;
|
||||||
|
#else
|
||||||
JUT_ASSERT(570, FALSE);
|
JUT_ASSERT(570, FALSE);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (block_type == 0) {
|
if (block_type == 0) {
|
||||||
@@ -226,8 +234,12 @@ bool daBgObj_c::spec_data_c::Set(void* i_ptr) {
|
|||||||
default:
|
default:
|
||||||
// "Data Block type invalid<%d>\n"
|
// "Data Block type invalid<%d>\n"
|
||||||
OSReport_Error("データブロックタイプが不正です<%d>\n", block_type);
|
OSReport_Error("データブロックタイプが不正です<%d>\n", block_type);
|
||||||
|
#if DUSK_TPHD
|
||||||
|
return 0;
|
||||||
|
#else
|
||||||
JUT_ASSERT(619, FALSE);
|
JUT_ASSERT(619, FALSE);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (block_type == 0) {
|
if (block_type == 0) {
|
||||||
|
|||||||
@@ -923,14 +923,6 @@ static void damage_check(e_sm2_class* i_this) {
|
|||||||
sm_hit_actor->mode = 10;
|
sm_hit_actor->mode = 10;
|
||||||
|
|
||||||
u8 new_color_type = new_col_d[(sm_hit_actor->type * 7) + i_this->type];
|
u8 new_color_type = new_col_d[(sm_hit_actor->type * 7) + i_this->type];
|
||||||
#if TARGET_PC
|
|
||||||
if (dusk::getSettings().game.restoreWiiGlitches &&
|
|
||||||
((sm_hit_actor->type == TYPE_BLUE && i_this->type == TYPE_YELLOW) ||
|
|
||||||
(sm_hit_actor->type == TYPE_YELLOW && i_this->type == TYPE_BLUE)))
|
|
||||||
{
|
|
||||||
new_color_type = TYPE_GREEN;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
i_this->type = new_color_type;
|
i_this->type = new_color_type;
|
||||||
sm_hit_actor->type = new_color_type;
|
sm_hit_actor->type = new_color_type;
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include "d/actor/d_a_player.h"
|
#include "d/actor/d_a_player.h"
|
||||||
#include "d/d_com_inf_game.h"
|
#include "d/d_com_inf_game.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <dusk/ui/settings.hpp>
|
||||||
|
|
||||||
static int daKytag04_Draw(kytag04_class* i_this) {
|
static int daKytag04_Draw(kytag04_class* i_this) {
|
||||||
dScnKy_env_light_c* kankyo = dKy_getEnvlight();
|
dScnKy_env_light_c* kankyo = dKy_getEnvlight();
|
||||||
@@ -260,12 +261,25 @@ static int daKytag04_Create(fopAc_ac_c* i_this) {
|
|||||||
|
|
||||||
a_this->mNeedDropNum = i_this->current.angle.z & 0xFF;
|
a_this->mNeedDropNum = i_this->current.angle.z & 0xFF;
|
||||||
|
|
||||||
|
#if TARGET_PC
|
||||||
|
if (dusk::tphd_active()) {
|
||||||
|
a_this->mNeedDropNum = 12;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int phase_state = dComIfG_resLoad(&a_this->mPhase, "Kytag04");
|
int phase_state = dComIfG_resLoad(&a_this->mPhase, "Kytag04");
|
||||||
if (phase_state == cPhs_COMPLEATE_e) {
|
if (phase_state == cPhs_COMPLEATE_e) {
|
||||||
a_this->field_0x5b4 = (fopAcM_GetParam(i_this) >> 8) & 7;
|
a_this->field_0x5b4 = (fopAcM_GetParam(i_this) >> 8) & 7;
|
||||||
a_this->mStageNo = (i_this->current.angle.z >> 8) & 0xFF;
|
a_this->mStageNo = (i_this->current.angle.z >> 8) & 0xFF;
|
||||||
a_this->mExitID = fopAcM_GetParam(i_this) & 0xFF;
|
a_this->mExitID = fopAcM_GetParam(i_this) & 0xFF;
|
||||||
a_this->mNeedDropNum = i_this->current.angle.z & 0xFF;
|
a_this->mNeedDropNum = i_this->current.angle.z & 0xFF;
|
||||||
|
|
||||||
|
#if TARGET_PC
|
||||||
|
if (dusk::tphd_active()) {
|
||||||
|
a_this->mNeedDropNum = 12;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
a_this->field_0x5b5 = fopAcM_GetParam(i_this) >> 0x10;
|
a_this->field_0x5b5 = fopAcM_GetParam(i_this) >> 0x10;
|
||||||
a_this->field_0x5b6 = fopAcM_GetParam(i_this) >> 0x18;
|
a_this->field_0x5b6 = fopAcM_GetParam(i_this) >> 0x18;
|
||||||
|
|
||||||
|
|||||||
+234
-82
@@ -11,38 +11,17 @@
|
|||||||
#include "d/d_com_inf_game.h"
|
#include "d/d_com_inf_game.h"
|
||||||
|
|
||||||
#if TARGET_PC
|
#if TARGET_PC
|
||||||
#include <aurora/texture.hpp>
|
|
||||||
#include "dusk/dvd_asset.hpp"
|
#include "dusk/dvd_asset.hpp"
|
||||||
#include "dusk/frame_interpolation.h"
|
#include "dusk/frame_interpolation.h"
|
||||||
|
|
||||||
using GameVersion = dusk::version::GameVersion;
|
using GameVersion = dusk::version::GameVersion;
|
||||||
|
|
||||||
// keep the original version of the cape texture const so we don't need to reload the file
|
static u8* l_Egnd_mantTEX_get() { alignas(32) static u8 buf[0x4000]; static bool _ = (dusk::LoadRelAsset(buf, "/rel/Final/Release/d_a_mant.rel", {{GameVersion::GcnUsa, 0x1C00}, {GameVersion::GcnPal, 0x1C00}}, 0x4000), true); return buf; }
|
||||||
static u8 const * l_Egnd_mantTEX_get() { alignas(32) static u8 buf[0x4000]; static bool _ = (dusk::LoadRelAsset(buf, "/rel/Final/Release/d_a_mant.rel", {{GameVersion::GcnUsa, 0x1C00}, {GameVersion::GcnPal, 0x1C00}}, 0x4000), true); return buf; }
|
|
||||||
static u8* l_Egnd_mantTEX_U_get() { alignas(32) static u8 buf[0x4000]; static bool _ = (dusk::LoadRelAsset(buf, "/rel/Final/Release/d_a_mant.rel", {{GameVersion::GcnUsa, 0x5C00}, {GameVersion::GcnPal, 0x5C00}}, 0x4000), true); return buf; }
|
static u8* l_Egnd_mantTEX_U_get() { alignas(32) static u8 buf[0x4000]; static bool _ = (dusk::LoadRelAsset(buf, "/rel/Final/Release/d_a_mant.rel", {{GameVersion::GcnUsa, 0x5C00}, {GameVersion::GcnPal, 0x5C00}}, 0x4000), true); return buf; }
|
||||||
static u8* l_Egnd_mantPAL_get() { alignas(32) static u8 buf[0x60]; static bool _ = (dusk::LoadRelAsset(buf, "/rel/Final/Release/d_a_mant.rel", {{GameVersion::GcnUsa, 0x9C00}, {GameVersion::GcnPal, 0x9C00}}, 0x60), true); return buf; }
|
static u8* l_Egnd_mantPAL_get() { alignas(32) static u8 buf[0x60]; static bool _ = (dusk::LoadRelAsset(buf, "/rel/Final/Release/d_a_mant.rel", {{GameVersion::GcnUsa, 0x9C00}, {GameVersion::GcnPal, 0x9C00}}, 0x60), true); return buf; }
|
||||||
#define l_Egnd_mantTEX (l_Egnd_mantTEX_get())
|
#define l_Egnd_mantTEX (l_Egnd_mantTEX_get())
|
||||||
#define l_Egnd_mantTEX_U (l_Egnd_mantTEX_U_get())
|
#define l_Egnd_mantTEX_U (l_Egnd_mantTEX_U_get())
|
||||||
#define l_Egnd_mantPAL (l_Egnd_mantPAL_get())
|
#define l_Egnd_mantPAL (l_Egnd_mantPAL_get())
|
||||||
|
|
||||||
// make a copy of the cape texture that can be overwritten with the tears
|
|
||||||
static u8 l_Egnd_mantTEX_copy[0x4000];
|
|
||||||
|
|
||||||
// keep our cached texture objects out here so that we can update them from multiple places
|
|
||||||
static bool textureObjsInitialized = false;
|
|
||||||
static TGXTlutObj tlutObj;
|
|
||||||
static TGXTexObj mainTexObj;
|
|
||||||
static TGXTexObj undersideTexObj;
|
|
||||||
|
|
||||||
// l_pos is unused
|
|
||||||
//static f32* l_pos_get() { alignas(32) static f32 buf[507]; static bool _ = (dusk::LoadRelAsset(buf, "/rel/Final/Release/d_a_mant.rel", {{GameVersion::GcnUsa, 0xA44C}, {GameVersion::GcnPal, 0xA44C}}, sizeof(buf)), true); return buf; }
|
|
||||||
static f32* l_normal_get() { alignas(32) static f32 buf[3]; static bool _ = (dusk::LoadRelAsset(buf, "/rel/Final/Release/d_a_mant.rel", {{GameVersion::GcnUsa, 0x9C60}, {GameVersion::GcnPal, 0x9C60}}, sizeof(buf)), true); return buf; }
|
|
||||||
static f32* l_texCoord_get() { alignas(32) static f32 buf[338]; static bool _ = (dusk::LoadRelAsset(buf, "/rel/Final/Release/d_a_mant.rel", {{GameVersion::GcnUsa, 0xA458}, {GameVersion::GcnPal, 0xA458}}, sizeof(buf)), true); return buf; }
|
|
||||||
//#define l_pos (l_pos_get())
|
|
||||||
#define l_normal (l_normal_get())
|
|
||||||
#define l_texCoord (l_texCoord_get())
|
|
||||||
|
|
||||||
static bool l_Egnd_mantTEX_hasReplacement = false;
|
|
||||||
#else
|
#else
|
||||||
#include "assets/l_Egnd_mantTEX.h"
|
#include "assets/l_Egnd_mantTEX.h"
|
||||||
|
|
||||||
@@ -52,6 +31,228 @@ static bool l_Egnd_mantTEX_hasReplacement = false;
|
|||||||
#endif
|
#endif
|
||||||
#include "d/d_s_play.h"
|
#include "d/d_s_play.h"
|
||||||
|
|
||||||
|
static u32 l_pos[507] = {
|
||||||
|
0x42480000, 0x3F5CFC93, 0xC365BD9C, 0x4226AAAA,
|
||||||
|
0x3F5CFC93, 0xC365BD9C, 0x42055556, 0x3F5CFC93,
|
||||||
|
0xC365BD9C, 0x41C80000, 0x3F5CFC93, 0xC365BD9C,
|
||||||
|
0x41855556, 0x3F5CFC93, 0xC365BD9C, 0x41055556,
|
||||||
|
0x3F5CFC93, 0xC365BD9C, 0x358637BD, 0x3F5CFC93,
|
||||||
|
0xC365BD9C, 0xC1055554, 0x3F5CFC93, 0xC365BD9C,
|
||||||
|
0xC1855554, 0x3F5CFC93, 0xC365BD9C, 0xC1C7FFFF,
|
||||||
|
0x3F5CFC93, 0xC365BD9C, 0xC2055554, 0x3F5CFC93,
|
||||||
|
0xC365BD9C, 0xC226AAAA, 0x3F5CFC93, 0xC365BD9C,
|
||||||
|
0xC2480000, 0x3F5CFC93, 0xC365BD9C, 0x42480000,
|
||||||
|
0x3F5CFC93, 0xC35292F0, 0x4226AAAA, 0x3F5CFC93,
|
||||||
|
0xC35292F0, 0x42055556, 0x3F5CFC93, 0xC35292F0,
|
||||||
|
0x41C80000, 0x3F5CFC93, 0xC35292F0, 0x41855556,
|
||||||
|
0x3F5CFC93, 0xC35292F0, 0x41055556, 0x3F5CFC93,
|
||||||
|
0xC35292F0, 0x358637BD, 0x3F5CFC93, 0xC35292F0,
|
||||||
|
0xC1055554, 0x3F5CFC93, 0xC35292F0, 0xC1855554,
|
||||||
|
0x3F5CFC93, 0xC35292F0, 0xC1C7FFFF, 0x3F5CFC93,
|
||||||
|
0xC35292F0, 0xC2055554, 0x3F5CFC93, 0xC35292F0,
|
||||||
|
0xC226AAAA, 0x3F5CFC93, 0xC35292F0, 0xC2480000,
|
||||||
|
0x3F5CFC93, 0xC35292F0, 0x42480000, 0x3F5CFC93,
|
||||||
|
0xC33F6846, 0x4226AAAA, 0x3F5CFC93, 0xC33F6846,
|
||||||
|
0x42055556, 0x3F5CFC93, 0xC33F6846, 0x41C80000,
|
||||||
|
0x3F5CFC93, 0xC33F6846, 0x41855556, 0x3F5CFC93,
|
||||||
|
0xC33F6846, 0x41055556, 0x3F5CFC93, 0xC33F6846,
|
||||||
|
0x358637BD, 0x3F5CFC93, 0xC33F6846, 0xC1055554,
|
||||||
|
0x3F5CFC93, 0xC33F6846, 0xC1855554, 0x3F5CFC93,
|
||||||
|
0xC33F6846, 0xC1C7FFFF, 0x3F5CFC93, 0xC33F6846,
|
||||||
|
0xC2055554, 0x3F5CFC93, 0xC33F6846, 0xC226AAAA,
|
||||||
|
0x3F5CFC93, 0xC33F6846, 0xC2480000, 0x3F5CFC93,
|
||||||
|
0xC33F6846, 0x42480000, 0x3F5CFC93, 0xC32C3D9C,
|
||||||
|
0x4226AAAA, 0x3F5CFC93, 0xC32C3D9C, 0x42055556,
|
||||||
|
0x3F5CFC93, 0xC32C3D9C, 0x41C80000, 0x3F5CFC93,
|
||||||
|
0xC32C3D9C, 0x41855556, 0x3F5CFC93, 0xC32C3D9C,
|
||||||
|
0x41055556, 0x3F5CFC93, 0xC32C3D9C, 0x358637BD,
|
||||||
|
0x3F5CFC93, 0xC32C3D9C, 0xC1055554, 0x3F5CFC93,
|
||||||
|
0xC32C3D9C, 0xC1855554, 0x3F5CFC93, 0xC32C3D9C,
|
||||||
|
0xC1C7FFFF, 0x3F5CFC93, 0xC32C3D9C, 0xC2055554,
|
||||||
|
0x3F5CFC93, 0xC32C3D9C, 0xC226AAAA, 0x3F5CFC93,
|
||||||
|
0xC32C3D9C, 0xC2480000, 0x3F5CFC93, 0xC32C3D9C,
|
||||||
|
0x42480000, 0x3F5CFC93, 0xC31912F1, 0x4226AAAA,
|
||||||
|
0x3F5CFC93, 0xC31912F1, 0x42055556, 0x3F5CFC93,
|
||||||
|
0xC31912F1, 0x41C80000, 0x3F5CFC93, 0xC31912F1,
|
||||||
|
0x41855556, 0x3F5CFC93, 0xC31912F1, 0x41055556,
|
||||||
|
0x3F5CFC93, 0xC31912F1, 0x358637BD, 0x3F5CFC93,
|
||||||
|
0xC31912F1, 0xC1055554, 0x3F5CFC93, 0xC31912F1,
|
||||||
|
0xC1855554, 0x3F5CFC93, 0xC31912F1, 0xC1C7FFFF,
|
||||||
|
0x3F5CFC93, 0xC31912F1, 0xC2055554, 0x3F5CFC93,
|
||||||
|
0xC31912F1, 0xC226AAAA, 0x3F5CFC93, 0xC31912F1,
|
||||||
|
0xC2480000, 0x3F5CFC93, 0xC31912F1, 0x42480000,
|
||||||
|
0x3F5CFC93, 0xC305E846, 0x4226AAAA, 0x3F5CFC93,
|
||||||
|
0xC305E846, 0x42055556, 0x3F5CFC93, 0xC305E846,
|
||||||
|
0x41C80000, 0x3F5CFC93, 0xC305E846, 0x41855556,
|
||||||
|
0x3F5CFC93, 0xC305E846, 0x41055556, 0x3F5CFC93,
|
||||||
|
0xC305E846, 0x358637BD, 0x3F5CFC93, 0xC305E846,
|
||||||
|
0xC1055554, 0x3F5CFC93, 0xC305E846, 0xC1855554,
|
||||||
|
0x3F5CFC93, 0xC305E846, 0xC1C7FFFF, 0x3F5CFC93,
|
||||||
|
0xC305E846, 0xC2055554, 0x3F5CFC93, 0xC305E846,
|
||||||
|
0xC226AAAA, 0x3F5CFC93, 0xC305E846, 0xC2480000,
|
||||||
|
0x3F5CFC93, 0xC305E846, 0x42480000, 0x3F5CFC93,
|
||||||
|
0xC2E57B38, 0x4226AAAA, 0x3F5CFC93, 0xC2E57B38,
|
||||||
|
0x42055556, 0x3F5CFC93, 0xC2E57B38, 0x41C80000,
|
||||||
|
0x3F5CFC93, 0xC2E57B38, 0x41855556, 0x3F5CFC93,
|
||||||
|
0xC2E57B38, 0x41055556, 0x3F5CFC93, 0xC2E57B38,
|
||||||
|
0x358637BD, 0x3F5CFC93, 0xC2E57B38, 0xC1055554,
|
||||||
|
0x3F5CFC93, 0xC2E57B38, 0xC1855554, 0x3F5CFC93,
|
||||||
|
0xC2E57B38, 0xC1C7FFFF, 0x3F5CFC93, 0xC2E57B38,
|
||||||
|
0xC2055554, 0x3F5CFC93, 0xC2E57B38, 0xC226AAAA,
|
||||||
|
0x3F5CFC93, 0xC2E57B38, 0xC2480000, 0x3F5CFC93,
|
||||||
|
0xC2E57B38, 0x42480000, 0x3F5CFC93, 0xC2BF25E2,
|
||||||
|
0x4226AAAA, 0x3F5CFC93, 0xC2BF25E2, 0x42055556,
|
||||||
|
0x3F5CFC93, 0xC2BF25E2, 0x41C80000, 0x3F5CFC93,
|
||||||
|
0xC2BF25E2, 0x41855556, 0x3F5CFC93, 0xC2BF25E2,
|
||||||
|
0x41055556, 0x3F5CFC93, 0xC2BF25E2, 0x358637BD,
|
||||||
|
0x3F5CFC93, 0xC2BF25E2, 0xC1055554, 0x3F5CFC93,
|
||||||
|
0xC2BF25E2, 0xC1855554, 0x3F5CFC93, 0xC2BF25E2,
|
||||||
|
0xC1C7FFFF, 0x3F5CFC93, 0xC2BF25E2, 0xC2055554,
|
||||||
|
0x3F5CFC93, 0xC2BF25E2, 0xC226AAAA, 0x3F5CFC93,
|
||||||
|
0xC2BF25E2, 0xC2480000, 0x3F5CFC93, 0xC2BF25E2,
|
||||||
|
0x42480000, 0x3F5CFC93, 0xC298D08D, 0x4226AAAA,
|
||||||
|
0x3F5CFC93, 0xC298D08D, 0x42055556, 0x3F5CFC93,
|
||||||
|
0xC298D08D, 0x41C80000, 0x3F5CFC93, 0xC298D08D,
|
||||||
|
0x41855556, 0x3F5CFC93, 0xC298D08D, 0x41055556,
|
||||||
|
0x3F5CFC93, 0xC298D08D, 0x358637BD, 0x3F5CFC93,
|
||||||
|
0xC298D08D, 0xC1055554, 0x3F5CFC93, 0xC298D08D,
|
||||||
|
0xC1855554, 0x3F5CFC93, 0xC298D08D, 0xC1C7FFFF,
|
||||||
|
0x3F5CFC93, 0xC298D08D, 0xC2055554, 0x3F5CFC93,
|
||||||
|
0xC298D08D, 0xC226AAAA, 0x3F5CFC93, 0xC298D08D,
|
||||||
|
0xC2480000, 0x3F5CFC93, 0xC298D08D, 0x42480000,
|
||||||
|
0x3F5CFC93, 0xC264F66F, 0x4226AAAA, 0x3F5CFC93,
|
||||||
|
0xC264F66F, 0x42055556, 0x3F5CFC93, 0xC264F66F,
|
||||||
|
0x41C80000, 0x3F5CFC93, 0xC264F66F, 0x41855556,
|
||||||
|
0x3F5CFC93, 0xC264F66F, 0x41055556, 0x3F5CFC93,
|
||||||
|
0xC264F66F, 0x358637BD, 0x3F5CFC93, 0xC264F66F,
|
||||||
|
0xC1055554, 0x3F5CFC93, 0xC264F66F, 0xC1855554,
|
||||||
|
0x3F5CFC93, 0xC264F66F, 0xC1C7FFFF, 0x3F5CFC93,
|
||||||
|
0xC264F66F, 0xC2055554, 0x3F5CFC93, 0xC264F66F,
|
||||||
|
0xC226AAAA, 0x3F5CFC93, 0xC264F66F, 0xC2480000,
|
||||||
|
0x3F5CFC93, 0xC264F66F, 0x42480000, 0x3F5CFC93,
|
||||||
|
0xC2184BC4, 0x4226AAAA, 0x3F5CFC93, 0xC2184BC4,
|
||||||
|
0x42055556, 0x3F5CFC93, 0xC2184BC4, 0x41C80000,
|
||||||
|
0x3F5CFC93, 0xC2184BC4, 0x41855556, 0x3F5CFC93,
|
||||||
|
0xC2184BC4, 0x41055556, 0x3F5CFC93, 0xC2184BC4,
|
||||||
|
0x358637BD, 0x3F5CFC93, 0xC2184BC4, 0xC1055554,
|
||||||
|
0x3F5CFC93, 0xC2184BC4, 0xC1855554, 0x3F5CFC93,
|
||||||
|
0xC2184BC4, 0xC1C7FFFF, 0x3F5CFC93, 0xC2184BC4,
|
||||||
|
0xC2055554, 0x3F5CFC93, 0xC2184BC4, 0xC226AAAA,
|
||||||
|
0x3F5CFC93, 0xC2184BC4, 0xC2480000, 0x3F5CFC93,
|
||||||
|
0xC2184BC4, 0x42480000, 0x3F5CFC93, 0xC1974231,
|
||||||
|
0x4226AAAA, 0x3F5CFC93, 0xC1974231, 0x42055556,
|
||||||
|
0x3F5CFC93, 0xC1974231, 0x41C80000, 0x3F5CFC93,
|
||||||
|
0xC1974231, 0x41855556, 0x3F5CFC93, 0xC1974231,
|
||||||
|
0x41055556, 0x3F5CFC93, 0xC1974231, 0x358637BD,
|
||||||
|
0x3F5CFC93, 0xC1974231, 0xC1055554, 0x3F5CFC93,
|
||||||
|
0xC1974231, 0xC1855554, 0x3F5CFC93, 0xC1974231,
|
||||||
|
0xC1C7FFFF, 0x3F5CFC93, 0xC1974231, 0xC2055554,
|
||||||
|
0x3F5CFC93, 0xC1974231, 0xC226AAAA, 0x3F5CFC93,
|
||||||
|
0xC1974231, 0xC2480000, 0x3F5CFC93, 0xC1974231,
|
||||||
|
0x42480000, 0x3F5CFC93, 0x3E84C964, 0x4226AAAA,
|
||||||
|
0x3F5CFC93, 0x3E84C964, 0x42055556, 0x3F5CFC93,
|
||||||
|
0x3E84C964, 0x41C80000, 0x3F5CFC93, 0x3E84C964,
|
||||||
|
0x41855556, 0x3F5CFC93, 0x3E84C964, 0x41055556,
|
||||||
|
0x3F5CFC93, 0x3E84C964, 0x358637BD, 0x3F5CFC93,
|
||||||
|
0x3E84C964, 0xC1055554, 0x3F5CFC93, 0x3E84C964,
|
||||||
|
0xC1855554, 0x3F5CFC93, 0x3E84C964, 0xC1C7FFFF,
|
||||||
|
0x3F5CFC93, 0x3E84C964, 0xC2055554, 0x3F5CFC93,
|
||||||
|
0x3E84C964, 0xC226AAAA, 0x3F5CFC93, 0x3E84C964,
|
||||||
|
0xC2480000, 0x3F5CFC93, 0x3E84C964,
|
||||||
|
};
|
||||||
|
|
||||||
|
static u32 l_normal[3] = {
|
||||||
|
0x00000000, 0x3F800000, 0x00000000,
|
||||||
|
};
|
||||||
|
|
||||||
|
static u32 l_texCoord[338] = {
|
||||||
|
0x00000000, 0x3F6AAAB0, 0x3DAAAA7E, 0x3F6AAAB0,
|
||||||
|
0x3DAAAA7E, 0x3F800000, 0x00000000, 0x3F800000,
|
||||||
|
0x3E2AAAC1, 0x3F6AAAB0, 0x3E2AAAC1, 0x3F800000,
|
||||||
|
0x3E800000, 0x3F6AAAB0, 0x3E800000, 0x3F800000,
|
||||||
|
0x3EAAAA9F, 0x3F6AAAB0, 0x3EAAAA9F, 0x3F800000,
|
||||||
|
0x3ED55561, 0x3F6AAAB0, 0x3ED55561, 0x3F800000,
|
||||||
|
0x3F000000, 0x3F6AAAB0, 0x3F000000, 0x3F800000,
|
||||||
|
0x3F155550, 0x3F6AAAB0, 0x3F155550, 0x3F800000,
|
||||||
|
0x3F2AAAB0, 0x3F6AAAB0, 0x3F2AAAB0, 0x3F800000,
|
||||||
|
0x3F400000, 0x3F6AAAB0, 0x3F400000, 0x3F800000,
|
||||||
|
0x3F555550, 0x3F6AAAB0, 0x3F555550, 0x3F800000,
|
||||||
|
0x3F6AAAB0, 0x3F6AAAB0, 0x3F6AAAB0, 0x3F800000,
|
||||||
|
0x3F800000, 0x3F6AAAB0, 0x3F800000, 0x3F800000,
|
||||||
|
0x00000000, 0x3F555550, 0x3DAAAA7E, 0x3F555550,
|
||||||
|
0x3E2AAAC1, 0x3F555550, 0x3E800000, 0x3F555550,
|
||||||
|
0x3EAAAA9F, 0x3F555550, 0x3ED55561, 0x3F555550,
|
||||||
|
0x3F000000, 0x3F555550, 0x3F155550, 0x3F555550,
|
||||||
|
0x3F2AAAB0, 0x3F555550, 0x3F400000, 0x3F555550,
|
||||||
|
0x3F555550, 0x3F555550, 0x3F6AAAB0, 0x3F555550,
|
||||||
|
0x3F800000, 0x3F555550, 0x00000000, 0x3F400000,
|
||||||
|
0x3DAAAA7E, 0x3F400000, 0x3E2AAAC1, 0x3F400000,
|
||||||
|
0x3E800000, 0x3F400000, 0x3EAAAA9F, 0x3F400000,
|
||||||
|
0x3ED55561, 0x3F400000, 0x3F000000, 0x3F400000,
|
||||||
|
0x3F155550, 0x3F400000, 0x3F2AAAB0, 0x3F400000,
|
||||||
|
0x3F400000, 0x3F400000, 0x3F555550, 0x3F400000,
|
||||||
|
0x3F6AAAB0, 0x3F400000, 0x3F800000, 0x3F400000,
|
||||||
|
0x00000000, 0x3F2AAAB0, 0x3DAAAA7E, 0x3F2AAAB0,
|
||||||
|
0x3E2AAAC1, 0x3F2AAAB0, 0x3E800000, 0x3F2AAAB0,
|
||||||
|
0x3EAAAA9F, 0x3F2AAAB0, 0x3ED55561, 0x3F2AAAB0,
|
||||||
|
0x3F000000, 0x3F2AAAB0, 0x3F155550, 0x3F2AAAB0,
|
||||||
|
0x3F2AAAB0, 0x3F2AAAB0, 0x3F400000, 0x3F2AAAB0,
|
||||||
|
0x3F555550, 0x3F2AAAB0, 0x3F6AAAB0, 0x3F2AAAB0,
|
||||||
|
0x3F800000, 0x3F2AAAB0, 0x00000000, 0x3F155550,
|
||||||
|
0x3DAAAA7E, 0x3F155550, 0x3E2AAAC1, 0x3F155550,
|
||||||
|
0x3E800000, 0x3F155550, 0x3EAAAA9F, 0x3F155550,
|
||||||
|
0x3ED55561, 0x3F155550, 0x3F000000, 0x3F155550,
|
||||||
|
0x3F155550, 0x3F155550, 0x3F2AAAB0, 0x3F155550,
|
||||||
|
0x3F400000, 0x3F155550, 0x3F555550, 0x3F155550,
|
||||||
|
0x3F6AAAB0, 0x3F155550, 0x3F800000, 0x3F155550,
|
||||||
|
0x00000000, 0x3F000000, 0x3DAAAA7E, 0x3F000000,
|
||||||
|
0x3E2AAAC1, 0x3F000000, 0x3E800000, 0x3F000000,
|
||||||
|
0x3EAAAA9F, 0x3F000000, 0x3ED55561, 0x3F000000,
|
||||||
|
0x3F000000, 0x3F000000, 0x3F155550, 0x3F000000,
|
||||||
|
0x3F2AAAB0, 0x3F000000, 0x3F400000, 0x3F000000,
|
||||||
|
0x3F555550, 0x3F000000, 0x3F6AAAB0, 0x3F000000,
|
||||||
|
0x3F800000, 0x3F000000, 0x00000000, 0x3ED55561,
|
||||||
|
0x3DAAAA7E, 0x3ED55561, 0x3E2AAAC1, 0x3ED55561,
|
||||||
|
0x3E800000, 0x3ED55561, 0x3EAAAA9F, 0x3ED55561,
|
||||||
|
0x3ED55561, 0x3ED55561, 0x3F000000, 0x3ED55561,
|
||||||
|
0x3F155550, 0x3ED55561, 0x3F2AAAB0, 0x3ED55561,
|
||||||
|
0x3F400000, 0x3ED55561, 0x3F555550, 0x3ED55561,
|
||||||
|
0x3F6AAAB0, 0x3ED55561, 0x3F800000, 0x3ED55561,
|
||||||
|
0x00000000, 0x3EAAAA9F, 0x3DAAAA7E, 0x3EAAAA9F,
|
||||||
|
0x3E2AAAC1, 0x3EAAAA9F, 0x3E800000, 0x3EAAAA9F,
|
||||||
|
0x3EAAAA9F, 0x3EAAAA9F, 0x3ED55561, 0x3EAAAA9F,
|
||||||
|
0x3F000000, 0x3EAAAA9F, 0x3F155550, 0x3EAAAA9F,
|
||||||
|
0x3F2AAAB0, 0x3EAAAA9F, 0x3F400000, 0x3EAAAA9F,
|
||||||
|
0x3F555550, 0x3EAAAA9F, 0x3F6AAAB0, 0x3EAAAA9F,
|
||||||
|
0x3F800000, 0x3EAAAA9F, 0x00000000, 0x3E800000,
|
||||||
|
0x3DAAAA7E, 0x3E800000, 0x3E2AAAC1, 0x3E800000,
|
||||||
|
0x3E800000, 0x3E800000, 0x3EAAAA9F, 0x3E800000,
|
||||||
|
0x3ED55561, 0x3E800000, 0x3F000000, 0x3E800000,
|
||||||
|
0x3F155550, 0x3E800000, 0x3F2AAAB0, 0x3E800000,
|
||||||
|
0x3F400000, 0x3E800000, 0x3F555550, 0x3E800000,
|
||||||
|
0x3F6AAAB0, 0x3E800000, 0x3F800000, 0x3E800000,
|
||||||
|
0x00000000, 0x3E2AAAC1, 0x3DAAAA7E, 0x3E2AAAC1,
|
||||||
|
0x3E2AAAC1, 0x3E2AAAC1, 0x3E800000, 0x3E2AAAC1,
|
||||||
|
0x3EAAAA9F, 0x3E2AAAC1, 0x3ED55561, 0x3E2AAAC1,
|
||||||
|
0x3F000000, 0x3E2AAAC1, 0x3F155550, 0x3E2AAAC1,
|
||||||
|
0x3F2AAAB0, 0x3E2AAAC1, 0x3F400000, 0x3E2AAAC1,
|
||||||
|
0x3F555550, 0x3E2AAAC1, 0x3F6AAAB0, 0x3E2AAAC1,
|
||||||
|
0x3F800000, 0x3E2AAAC1, 0x00000000, 0x3DAAAA7E,
|
||||||
|
0x3DAAAA7E, 0x3DAAAA7E, 0x3E2AAAC1, 0x3DAAAA7E,
|
||||||
|
0x3E800000, 0x3DAAAA7E, 0x3EAAAA9F, 0x3DAAAA7E,
|
||||||
|
0x3ED55561, 0x3DAAAA7E, 0x3F000000, 0x3DAAAA7E,
|
||||||
|
0x3F155550, 0x3DAAAA7E, 0x3F2AAAB0, 0x3DAAAA7E,
|
||||||
|
0x3F400000, 0x3DAAAA7E, 0x3F555550, 0x3DAAAA7E,
|
||||||
|
0x3F6AAAB0, 0x3DAAAA7E, 0x3F800000, 0x3DAAAA7E,
|
||||||
|
0x00000000, 0x00000000, 0x3DAAAA7E, 0x00000000,
|
||||||
|
0x3E2AAAC1, 0x00000000, 0x3E800000, 0x00000000,
|
||||||
|
0x3EAAAA9F, 0x00000000, 0x3ED55561, 0x00000000,
|
||||||
|
0x3F000000, 0x00000000, 0x3F155550, 0x00000000,
|
||||||
|
0x3F2AAAB0, 0x00000000, 0x3F400000, 0x00000000,
|
||||||
|
0x3F555550, 0x00000000, 0x3F6AAAB0, 0x00000000,
|
||||||
|
0x3F800000, 0x00000000,
|
||||||
|
};
|
||||||
|
|
||||||
#if TARGET_PC
|
#if TARGET_PC
|
||||||
using GameVersion = dusk::version::GameVersion;
|
using GameVersion = dusk::version::GameVersion;
|
||||||
|
|
||||||
@@ -104,9 +305,8 @@ static void mant_build_anchor_frame(const cXyz& anchor_a, const cXyz& anchor_b,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void daMant_packet_c::draw() {
|
void daMant_packet_c::draw() {
|
||||||
ZoneScoped;
|
|
||||||
#if TARGET_PC
|
#if TARGET_PC
|
||||||
void* image = l_Egnd_mantTEX_copy;
|
void* image = l_Egnd_mantTEX;
|
||||||
void* lut = l_Egnd_mantPAL;
|
void* lut = l_Egnd_mantPAL;
|
||||||
#else
|
#else
|
||||||
void* image = tex_d[0];
|
void* image = tex_d[0];
|
||||||
@@ -188,12 +388,12 @@ void daMant_packet_c::draw() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
GXSETARRAY(GX_VA_POS, draw_pos, sizeof(mNrm[0]), 12, true);
|
GXSETARRAY(GX_VA_POS, draw_pos, sizeof(mNrm[0]), 12, true);
|
||||||
GXSETARRAY(GX_VA_NRM, l_normal, sizeof(f32) * 3, 12, false);
|
GXSETARRAY(GX_VA_NRM, &l_normal, sizeof(l_normal), 12, false);
|
||||||
#else
|
#else
|
||||||
GXSETARRAY(GX_VA_POS, this->getPos(), sizeof(mPos[0]), 12, true);
|
GXSETARRAY(GX_VA_POS, this->getPos(), sizeof(mPos[0]), 12, true);
|
||||||
GXSETARRAY(GX_VA_NRM, this->getNrm(), sizeof(mNrm[0]), 12, true);
|
GXSETARRAY(GX_VA_NRM, this->getNrm(), sizeof(mNrm[0]), 12, true);
|
||||||
#endif
|
#endif
|
||||||
GXSETARRAY(GX_VA_TEX0, l_texCoord, sizeof(f32) * 338, 8, false);
|
GXSETARRAY(GX_VA_TEX0, &l_texCoord, sizeof(l_texCoord), 8, false); // TODO: set to true when converted to float literals
|
||||||
|
|
||||||
GXSetZCompLoc(0);
|
GXSetZCompLoc(0);
|
||||||
GXSetZMode(GX_ENABLE, GX_LEQUAL, GX_ENABLE);
|
GXSetZMode(GX_ENABLE, GX_LEQUAL, GX_ENABLE);
|
||||||
@@ -218,33 +418,15 @@ void daMant_packet_c::draw() {
|
|||||||
GXSetTevKAlphaSel(GX_TEVSTAGE0, GX_TEV_KASEL_K3_A);
|
GXSetTevKAlphaSel(GX_TEVSTAGE0, GX_TEV_KASEL_K3_A);
|
||||||
GXSetAlphaCompare(GX_GREATER, 0, GX_AOP_OR, GX_GREATER, 0);
|
GXSetAlphaCompare(GX_GREATER, 0, GX_AOP_OR, GX_GREATER, 0);
|
||||||
|
|
||||||
#if TARGET_PC
|
|
||||||
if (!textureObjsInitialized) {
|
|
||||||
GXInitTlutObj(&tlutObj, lut, GX_TL_RGB5A3, 0x100);
|
|
||||||
GXInitTexObjCI(&mainTexObj, image, 0x80, 0x80, GX_TF_C8, GX_CLAMP, GX_CLAMP, 0, 0);
|
|
||||||
GXInitTexObjLOD(&mainTexObj, GX_LINEAR, GX_LINEAR, 0.0, 0.0, 0.0, 0, 0, GX_ANISO_1);
|
|
||||||
GXInitTexObjCI(
|
|
||||||
&undersideTexObj, l_Egnd_mantTEX_U, 0x80, 0x80, GX_TF_C8, GX_CLAMP, GX_CLAMP, 0, 0);
|
|
||||||
GXInitTexObjLOD(&undersideTexObj, GX_LINEAR, GX_LINEAR, 0.0, 0.0, 0.0, 0, 0, GX_ANISO_1);
|
|
||||||
l_Egnd_mantTEX_hasReplacement = aurora::texture::has_replacement(&mainTexObj, &tlutObj);
|
|
||||||
textureObjsInitialized = true;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
GXTlutObj GStack_80;
|
GXTlutObj GStack_80;
|
||||||
GXInitTlutObj(&GStack_80, lut, GX_TL_RGB5A3, 0x100);
|
GXInitTlutObj(&GStack_80, lut, GX_TL_RGB5A3, 0x100);
|
||||||
|
|
||||||
TGXTexObj GStack_74;
|
TGXTexObj GStack_74;
|
||||||
GXInitTexObjCI(&GStack_74, image, 0x80, 0x80, GX_TF_C8, GX_CLAMP, GX_CLAMP, 0, 0);
|
GXInitTexObjCI(&GStack_74, image, 0x80, 0x80, GX_TF_C8, GX_CLAMP, GX_CLAMP, 0, 0);
|
||||||
GXInitTexObjLOD(&GStack_74, GX_LINEAR, GX_LINEAR, 0.0, 0.0, 0.0, 0, 0, GX_ANISO_1);
|
GXInitTexObjLOD(&GStack_74, GX_LINEAR, GX_LINEAR, 0.0, 0.0, 0.0, 0, 0, GX_ANISO_1);
|
||||||
#endif
|
|
||||||
|
|
||||||
#if TARGET_PC
|
GXLoadTlut(&GStack_80, 0);
|
||||||
GXLoadTlut(&tlutObj, GX_TLUT0);
|
|
||||||
GXLoadTexObj(&mainTexObj, GX_TEXMAP0);
|
|
||||||
#else
|
|
||||||
GXLoadTlut(&GStack_80, GX_TLUT0);
|
|
||||||
GXLoadTexObj(&GStack_74, GX_TEXMAP0);
|
GXLoadTexObj(&GStack_74, GX_TEXMAP0);
|
||||||
#endif
|
|
||||||
|
|
||||||
GXSetCullMode(GX_CULL_BACK);
|
GXSetCullMode(GX_CULL_BACK);
|
||||||
|
|
||||||
@@ -260,13 +442,12 @@ void daMant_packet_c::draw() {
|
|||||||
GXLoadNrmMtxImm(MStack_54, GX_PNMTX0);
|
GXLoadNrmMtxImm(MStack_54, GX_PNMTX0);
|
||||||
GXCallDisplayList(l_Egnd_mantDL, 0x3e0);
|
GXCallDisplayList(l_Egnd_mantDL, 0x3e0);
|
||||||
|
|
||||||
#if TARGET_PC
|
#ifdef TARGET_PC
|
||||||
GXLoadTexObj(&undersideTexObj, GX_TEXMAP0);
|
GStack_74.reset();
|
||||||
#else
|
#endif
|
||||||
GXInitTexObjCI(&GStack_74, l_Egnd_mantTEX_U, 0x80, 0x80, GX_TF_C8, GX_CLAMP, GX_CLAMP, 0, 0);
|
GXInitTexObjCI(&GStack_74, l_Egnd_mantTEX_U, 0x80, 0x80, GX_TF_C8, GX_CLAMP, GX_CLAMP, 0, 0);
|
||||||
GXInitTexObjLOD(&GStack_74, GX_LINEAR, GX_LINEAR, 0.0, 0.0, 0.0, 0, 0, GX_ANISO_1);
|
GXInitTexObjLOD(&GStack_74, GX_LINEAR, GX_LINEAR, 0.0, 0.0, 0.0, 0, 0, GX_ANISO_1);
|
||||||
GXLoadTexObj(&GStack_74, GX_TEXMAP0);
|
GXLoadTexObj(&GStack_74, GX_TEXMAP0);
|
||||||
#endif
|
|
||||||
|
|
||||||
GXSetTevColor(GX_TEVREG0, COMPOUND_LITERAL(GXColor){0, 0, 0, 0});
|
GXSetTevColor(GX_TEVREG0, COMPOUND_LITERAL(GXColor){0, 0, 0, 0});
|
||||||
GXSetTevKColor(GX_KCOLOR0, COMPOUND_LITERAL(GXColor){0, 0, 0, 0});
|
GXSetTevKColor(GX_KCOLOR0, COMPOUND_LITERAL(GXColor){0, 0, 0, 0});
|
||||||
@@ -640,11 +821,7 @@ static int daMant_Execute(mant_class* i_this) {
|
|||||||
iVar8 = 0;
|
iVar8 = 0;
|
||||||
|
|
||||||
if (i_this->field_0x3967 != 0) {
|
if (i_this->field_0x3967 != 0) {
|
||||||
#if TARGET_PC
|
|
||||||
mant_cut_type = l_Egnd_mantTEX_hasReplacement ? 1 : i_this->field_0x3967;
|
|
||||||
#else
|
|
||||||
mant_cut_type = i_this->field_0x3967;
|
mant_cut_type = i_this->field_0x3967;
|
||||||
#endif
|
|
||||||
|
|
||||||
if (i_this->field_0x3968 < 15) {
|
if (i_this->field_0x3968 < 15) {
|
||||||
i_this->field_0x3968++;
|
i_this->field_0x3968++;
|
||||||
@@ -656,18 +833,9 @@ static int daMant_Execute(mant_class* i_this) {
|
|||||||
iVar8 = 20;
|
iVar8 = 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TARGET_PC
|
unaff_r29 = cM_rndF(65536.0f);
|
||||||
if (l_Egnd_mantTEX_hasReplacement) {
|
var_f31 = cM_rndFX(32.0f);
|
||||||
unaff_r29 = i_this->mMantRng.getF(65536.0f);
|
var_f30 = cM_rndFX(32.0f);
|
||||||
var_f31 = i_this->mMantRng.getFX(32.0f);
|
|
||||||
var_f30 = i_this->mMantRng.getFX(32.0f);
|
|
||||||
} else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
unaff_r29 = cM_rndF(65536.0f);
|
|
||||||
var_f31 = cM_rndFX(32.0f);
|
|
||||||
var_f30 = cM_rndFX(32.0f);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
i_this->field_0x3967 = 0;
|
i_this->field_0x3967 = 0;
|
||||||
@@ -726,14 +894,8 @@ static int daMant_Execute(mant_class* i_this) {
|
|||||||
|
|
||||||
if (0 <= uVar1 && uVar1 < 0x4000) {
|
if (0 <= uVar1 && uVar1 < 0x4000) {
|
||||||
int iVar5 = (uVar1 & 7) + (uVar1 & 0x78) * 4 + (uVar1 >> 4 & 0x18) + (uVar1 & 0x3e00);
|
int iVar5 = (uVar1 & 7) + (uVar1 & 0x78) * 4 + (uVar1 >> 4 & 0x18) + (uVar1 & 0x3e00);
|
||||||
DUSK_IF_ELSE(l_Egnd_mantTEX_copy[iVar5], l_Egnd_mantTEX[iVar5]) = l_Egnd_mantTEX_U[iVar5] = 0;
|
l_Egnd_mantTEX[iVar5] = l_Egnd_mantTEX_U[iVar5] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TARGET_PC
|
|
||||||
if(textureObjsInitialized) {
|
|
||||||
GXInitTlutObjData(&tlutObj, l_Egnd_mantPAL); // make sure the cached textures are updated
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -771,16 +933,6 @@ static int daMant_Create(fopAc_ac_c* i_this) {
|
|||||||
l_Egnd_mantTEX_U[i] = 6;
|
l_Egnd_mantTEX_U[i] = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TARGET_PC
|
|
||||||
memcpy(l_Egnd_mantTEX_copy, l_Egnd_mantTEX, sizeof(l_Egnd_mantTEX_copy));
|
|
||||||
|
|
||||||
if(textureObjsInitialized) {
|
|
||||||
GXInitTlutObjData(&tlutObj, l_Egnd_mantPAL); // make sure the cached textures are updated
|
|
||||||
}
|
|
||||||
|
|
||||||
m_this->mMantRng.init(66, 16983, 855);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
lbl_277_bss_0 = 0;
|
lbl_277_bss_0 = 0;
|
||||||
daMant_Execute(m_this);
|
daMant_Execute(m_this);
|
||||||
return 4;
|
return 4;
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#if TARGET_PC
|
#if TARGET_PC
|
||||||
#include "dusk/frame_interpolation.h"
|
|
||||||
#include "dusk/settings.h"
|
#include "dusk/settings.h"
|
||||||
#include "dusk/version.hpp"
|
#include "dusk/version.hpp"
|
||||||
#endif
|
#endif
|
||||||
@@ -181,25 +180,6 @@ static int Worm_nodeCallBack(J3DJoint* i_joint, int param_1) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TARGET_PC
|
|
||||||
static void dmg_rod_interp_callback(bool isSimFrame, void* pUserWork) {
|
|
||||||
dmg_rod_class* i_this = (dmg_rod_class*)pUserWork;
|
|
||||||
if (!i_this->mLineInterpPrevValid || !i_this->mLineInterpCurrValid) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const f32 alpha = dusk::frame_interp::get_interpolation_step();
|
|
||||||
const int count = i_this->kind == MG_ROD_KIND_LURE ? MG_ROD_LURE_LINE_LEN : MG_ROD_UKI_LINE_LEN;
|
|
||||||
cXyz* dst = i_this->linemat.getPos(0);
|
|
||||||
for (int i = 0; i < count; i++) {
|
|
||||||
const cXyz& p0 = i_this->mLineInterpPrev[i];
|
|
||||||
const cXyz& p1 = i_this->mLineInterpCurr[i];
|
|
||||||
dst[i] = p0 + (p1 - p0) * alpha;
|
|
||||||
}
|
|
||||||
static GXColor l_color = {0xFF, 0xFF, 0x96, 0xFF};
|
|
||||||
i_this->linemat.update(count, l_color, &i_this->actor.tevStr);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int dmg_rod_Draw(dmg_rod_class* i_this) {
|
static int dmg_rod_Draw(dmg_rod_class* i_this) {
|
||||||
int unused;
|
int unused;
|
||||||
fopAc_ac_c* actor = &i_this->actor;
|
fopAc_ac_c* actor = &i_this->actor;
|
||||||
@@ -240,18 +220,6 @@ static int dmg_rod_Draw(dmg_rod_class* i_this) {
|
|||||||
i_this->linemat.update(MG_ROD_LURE_LINE_LEN, l_color, &i_this->actor.tevStr);
|
i_this->linemat.update(MG_ROD_LURE_LINE_LEN, l_color, &i_this->actor.tevStr);
|
||||||
dComIfGd_set3DlineMat(&i_this->linemat);
|
dComIfGd_set3DlineMat(&i_this->linemat);
|
||||||
|
|
||||||
#if TARGET_PC
|
|
||||||
if (dusk::frame_interp::is_enabled()) {
|
|
||||||
if (i_this->mLineInterpCurrValid) {
|
|
||||||
memcpy(i_this->mLineInterpPrev, i_this->mLineInterpCurr, MG_ROD_LURE_LINE_LEN * sizeof(cXyz));
|
|
||||||
i_this->mLineInterpPrevValid = true;
|
|
||||||
}
|
|
||||||
memcpy(i_this->mLineInterpCurr, i_this->linemat.getPos(0), MG_ROD_LURE_LINE_LEN * sizeof(cXyz));
|
|
||||||
i_this->mLineInterpCurrValid = true;
|
|
||||||
dusk::frame_interp::add_interpolation_callback(&dmg_rod_interp_callback, i_this);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
model = i_this->rod_modelMorf->getModel();
|
model = i_this->rod_modelMorf->getModel();
|
||||||
g_env_light.setLightTevColorType_MAJI(model, &i_this->actor.tevStr);
|
g_env_light.setLightTevColorType_MAJI(model, &i_this->actor.tevStr);
|
||||||
i_this->rod_modelMorf->entryDL();
|
i_this->rod_modelMorf->entryDL();
|
||||||
@@ -276,18 +244,6 @@ static int dmg_rod_Draw(dmg_rod_class* i_this) {
|
|||||||
i_this->linemat.update(MG_ROD_UKI_LINE_LEN, l_color, &i_this->actor.tevStr);
|
i_this->linemat.update(MG_ROD_UKI_LINE_LEN, l_color, &i_this->actor.tevStr);
|
||||||
dComIfGd_set3DlineMat(&i_this->linemat);
|
dComIfGd_set3DlineMat(&i_this->linemat);
|
||||||
|
|
||||||
#if TARGET_PC
|
|
||||||
if (dusk::frame_interp::is_enabled()) {
|
|
||||||
if (i_this->mLineInterpCurrValid) {
|
|
||||||
memcpy(i_this->mLineInterpPrev, i_this->mLineInterpCurr, MG_ROD_UKI_LINE_LEN * sizeof(cXyz));
|
|
||||||
i_this->mLineInterpPrevValid = true;
|
|
||||||
}
|
|
||||||
memcpy(i_this->mLineInterpCurr, i_this->linemat.getPos(0), MG_ROD_UKI_LINE_LEN * sizeof(cXyz));
|
|
||||||
i_this->mLineInterpCurrValid = true;
|
|
||||||
dusk::frame_interp::add_interpolation_callback(&dmg_rod_interp_callback, i_this);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (int i = 0; i < 15; i++) {
|
for (int i = 0; i < 15; i++) {
|
||||||
g_env_light.setLightTevColorType_MAJI(i_this->rod_uki_model[i], &actor->tevStr);
|
g_env_light.setLightTevColorType_MAJI(i_this->rod_uki_model[i], &actor->tevStr);
|
||||||
mDoExt_modelUpdateDL(i_this->rod_uki_model[i]);
|
mDoExt_modelUpdateDL(i_this->rod_uki_model[i]);
|
||||||
@@ -5799,12 +5755,6 @@ static void play_camera_u(dmg_rod_class* i_this) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TARGET_PC
|
|
||||||
BOOL item_any_fishing_rod(int itemId) {
|
|
||||||
return itemId == dItemNo_FISHING_ROD_1_e || (itemId >= dItemNo_BEE_ROD_e && itemId <= dItemNo_JEWEL_WORM_ROD_e);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int dmg_rod_Execute(dmg_rod_class* i_this) {
|
static int dmg_rod_Execute(dmg_rod_class* i_this) {
|
||||||
fopAc_ac_c* actor = &i_this->actor;
|
fopAc_ac_c* actor = &i_this->actor;
|
||||||
|
|
||||||
@@ -5871,17 +5821,6 @@ static int dmg_rod_Execute(dmg_rod_class* i_this) {
|
|||||||
i_this->prev_rod_substick_y = i_this->rod_substick_y;
|
i_this->prev_rod_substick_y = i_this->rod_substick_y;
|
||||||
i_this->rod_substick_y = mDoCPd_c::getSubStickY(PAD_1);
|
i_this->rod_substick_y = mDoCPd_c::getSubStickY(PAD_1);
|
||||||
|
|
||||||
#if TARGET_PC
|
|
||||||
if (dusk::getSettings().game.buttonFishing) {
|
|
||||||
if ((item_any_fishing_rod(dComIfGp_getSelectItem(0)) && mDoCPd_c::getHoldX(PAD_1)) ||
|
|
||||||
(item_any_fishing_rod(dComIfGp_getSelectItem(1)) && mDoCPd_c::getHoldY(PAD_1)))
|
|
||||||
{
|
|
||||||
i_this->rod_stick_y = -1.0f;
|
|
||||||
i_this->rod_substick_y = -1.0f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
i_this->reel_speed = 5.0f;
|
i_this->reel_speed = 5.0f;
|
||||||
i_this->reel_btn_flags = mDoCPd_c::getHoldB(PAD_1) | mDoCPd_c::getHoldDown(PAD_1);
|
i_this->reel_btn_flags = mDoCPd_c::getHoldB(PAD_1) | mDoCPd_c::getHoldDown(PAD_1);
|
||||||
if (mDoCPd_c::getHoldDown(PAD_1)) {
|
if (mDoCPd_c::getHoldDown(PAD_1)) {
|
||||||
@@ -6449,11 +6388,6 @@ static int dmg_rod_Create(fopAc_ac_c* i_this) {
|
|||||||
return cPhs_ERROR_e;
|
return cPhs_ERROR_e;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TARGET_PC
|
|
||||||
rod->mLineInterpPrevValid = false;
|
|
||||||
rod->mLineInterpCurrValid = false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
OS_REPORT("//////////////MG_ROD SET 2 !!\n");
|
OS_REPORT("//////////////MG_ROD SET 2 !!\n");
|
||||||
if (!hio_set) {
|
if (!hio_set) {
|
||||||
rod->HIOInit = TRUE;
|
rod->HIOInit = TRUE;
|
||||||
|
|||||||
@@ -3106,14 +3106,18 @@ void daMidna_c::setMidnaNoDrawFlg() {
|
|||||||
|
|
||||||
BOOL daMidna_c::checkMetamorphoseEnableBase() {
|
BOOL daMidna_c::checkMetamorphoseEnableBase() {
|
||||||
BOOL tmp;
|
BOOL tmp;
|
||||||
if (!daAlink_getAlinkActorClass()->checkMidnaRide() || (g_env_light.mEvilInitialized & 0x80) ||
|
|
||||||
/* dSv_event_flag_c::M_077 - Main Event - Get shadow crystal (can now transform) */
|
|
||||||
!dComIfGs_isEventBit(0xD04) ||
|
|
||||||
#if TARGET_PC
|
#if TARGET_PC
|
||||||
(fopAcIt_Judge((fopAcIt_JudgeFunc)daMidna_searchNpc, &tmp) &&
|
if (((!daAlink_getAlinkActorClass()->checkMidnaRide() || (g_env_light.mEvilInitialized & 0x80) ||
|
||||||
!dusk::getSettings().game.canTransformAnywhere)
|
/* dSv_event_flag_c::M_077 - Main Event - Get shadow crystal (can now transform) */
|
||||||
|
!dComIfGs_isEventBit(0xD04)) &&
|
||||||
|
!dusk::getSettings().game.transformWithoutShadowCrystal) ||
|
||||||
|
(fopAcIt_Judge((fopAcIt_JudgeFunc)daMidna_searchNpc, &tmp) &&
|
||||||
|
!dusk::getSettings().game.canTransformAnywhere)
|
||||||
#else
|
#else
|
||||||
fopAcIt_Judge((fopAcIt_JudgeFunc)daMidna_searchNpc, &tmp)
|
if (!daAlink_getAlinkActorClass()->checkMidnaRide() || (g_env_light.mEvilInitialized & 0x80) ||
|
||||||
|
/* dSv_event_flag_c::M_077 - Main Event - Get shadow crystal (can now transform) */
|
||||||
|
!dComIfGs_isEventBit(0xD04) ||
|
||||||
|
fopAcIt_Judge((fopAcIt_JudgeFunc)daMidna_searchNpc, &tmp)
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -105,7 +105,6 @@ int dMirror_packet_c::entryModel(J3DModel* i_model) {
|
|||||||
|
|
||||||
void dMirror_packet_c::mirrorZdraw(f32* param_0, f32* param_1, f32 param_2, f32 param_3,
|
void dMirror_packet_c::mirrorZdraw(f32* param_0, f32* param_1, f32 param_2, f32 param_3,
|
||||||
f32 param_4, f32 param_5, f32 param_6, f32 param_7) {
|
f32 param_4, f32 param_5, f32 param_6, f32 param_7) {
|
||||||
ZoneScoped;
|
|
||||||
GXSetNumChans(1);
|
GXSetNumChans(1);
|
||||||
GXSetChanCtrl(GX_COLOR0, GX_FALSE, GX_SRC_REG, GX_SRC_REG, 0, GX_DF_NONE, GX_AF_NONE);
|
GXSetChanCtrl(GX_COLOR0, GX_FALSE, GX_SRC_REG, GX_SRC_REG, 0, GX_DF_NONE, GX_AF_NONE);
|
||||||
GXSetNumTexGens(0);
|
GXSetNumTexGens(0);
|
||||||
@@ -266,7 +265,6 @@ void dMirror_packet_c::modelDraw(J3DModel* i_model, Mtx param_1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void dMirror_packet_c::mainDraw() {
|
void dMirror_packet_c::mainDraw() {
|
||||||
ZoneScoped;
|
|
||||||
j3dSys.reinitGX();
|
j3dSys.reinitGX();
|
||||||
|
|
||||||
cXyz sp19C[5];
|
cXyz sp19C[5];
|
||||||
|
|||||||
@@ -328,13 +328,13 @@ int daNpcImpal_c::step(s16 i_angle, int i_animate) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void daNpcImpal_c::playExpression() {
|
void daNpcImpal_c::playExpression() {
|
||||||
daNpcF_anmPlayData dat0 = {ANM_1, mpHIO->m.common.morf_frame, DUSK_IF_ELSE(0, 1)};
|
daNpcF_anmPlayData dat0 = {ANM_1, mpHIO->m.common.morf_frame, 1};
|
||||||
daNpcF_anmPlayData* pDat0[1] = {&dat0};
|
daNpcF_anmPlayData* pDat0[1] = {&dat0};
|
||||||
daNpcF_anmPlayData dat1 = {ANM_5, mpHIO->m.common.morf_frame, DUSK_IF_ELSE(0, 1)};
|
daNpcF_anmPlayData dat1 = {ANM_5, mpHIO->m.common.morf_frame, 1};
|
||||||
daNpcF_anmPlayData* pDat1[1] = {&dat1};
|
daNpcF_anmPlayData* pDat1[1] = {&dat1};
|
||||||
daNpcF_anmPlayData dat2 = {ANM_4, mpHIO->m.common.morf_frame, DUSK_IF_ELSE(0, 1)};
|
daNpcF_anmPlayData dat2 = {ANM_4, mpHIO->m.common.morf_frame, 1};
|
||||||
daNpcF_anmPlayData* pDat2[1] = {&dat2};
|
daNpcF_anmPlayData* pDat2[1] = {&dat2};
|
||||||
daNpcF_anmPlayData dat3 = {ANM_6, mpHIO->m.common.morf_frame, DUSK_IF_ELSE(0, 1)};
|
daNpcF_anmPlayData dat3 = {ANM_6, mpHIO->m.common.morf_frame, 1};
|
||||||
daNpcF_anmPlayData* pDat3[1] = {&dat3};
|
daNpcF_anmPlayData* pDat3[1] = {&dat3};
|
||||||
daNpcF_anmPlayData dat4 = {ANM_8, mpHIO->m.common.morf_frame, 0};
|
daNpcF_anmPlayData dat4 = {ANM_8, mpHIO->m.common.morf_frame, 0};
|
||||||
daNpcF_anmPlayData* pDat4[1] = {&dat4};
|
daNpcF_anmPlayData* pDat4[1] = {&dat4};
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ static void anm_init(npc_ks_class* i_this, int param_2, f32 i_morf, u8 i_attr, f
|
|||||||
param_2 = 42;
|
param_2 = 42;
|
||||||
} else {
|
} else {
|
||||||
// bug: developers meant to set equal to 44?
|
// bug: developers meant to set equal to 44?
|
||||||
IF_NOT_DUSK(param_2 == 44);
|
param_2 == 44;
|
||||||
dComIfGs_shake_kandelaar();
|
dComIfGs_shake_kandelaar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6882,16 +6882,6 @@ static int daNpc_Ks_Delete(npc_ks_class* i_this) {
|
|||||||
i_this->model->stopZelAnime();
|
i_this->model->stopZelAnime();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TARGET_PC
|
|
||||||
if (leader == i_this) {
|
|
||||||
leader = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (saru_p[i_this->set_id] == i_this) {
|
|
||||||
saru_p[i_this->set_id] = NULL;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,8 @@
|
|||||||
daObjDrop_HIO_c l_HIO;
|
daObjDrop_HIO_c l_HIO;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <dusk/ui/settings.hpp>
|
||||||
|
|
||||||
static void* searchParentSub(void* pproc, void* pdata) {
|
static void* searchParentSub(void* pproc, void* pdata) {
|
||||||
daObjDrop_c* pdrop = (daObjDrop_c*)pdata;
|
daObjDrop_c* pdrop = (daObjDrop_c*)pdata;
|
||||||
fopAc_ac_c* pym = (fopAc_ac_c*)pproc;
|
fopAc_ac_c* pym = (fopAc_ac_c*)pproc;
|
||||||
@@ -103,9 +105,17 @@ void daObjDrop_c::dropGet() {
|
|||||||
dComIfGs_setLightDropNum(dComIfGp_getStartStageDarkArea(), num + 1);
|
dComIfGs_setLightDropNum(dComIfGp_getStartStageDarkArea(), num + 1);
|
||||||
|
|
||||||
if (dComIfGp_getStartStageDarkArea() == 2 &&
|
if (dComIfGp_getStartStageDarkArea() == 2 &&
|
||||||
|
#if TARGET_PC
|
||||||
|
((dusk::tphd_active() &&
|
||||||
|
dComIfGs_getLightDropNum(dComIfGp_getStartStageDarkArea()) == 11) ||
|
||||||
|
!dusk::tphd_active() &&
|
||||||
|
dComIfGs_getLightDropNum(dComIfGp_getStartStageDarkArea()) == 15
|
||||||
|
))
|
||||||
|
#else
|
||||||
dComIfGs_getLightDropNum(dComIfGp_getStartStageDarkArea()) == 15)
|
dComIfGs_getLightDropNum(dComIfGp_getStartStageDarkArea()) == 15)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
/* dSv_event_flag_c::F_0005 - Misc. - Gathered 14 Tears of Light in area 4 */
|
/* dSv_event_flag_c::F_0005 - Misc. - Gathered 15 Tears of Light in area 4 */
|
||||||
dComIfGs_onEventBit(dSv_event_flag_c::saveBitLabels[9]);
|
dComIfGs_onEventBit(dSv_event_flag_c::saveBitLabels[9]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -261,7 +261,6 @@ void FlagCloth_c::execute() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FlagCloth_c::draw() {
|
void FlagCloth_c::draw() {
|
||||||
ZoneScoped;
|
|
||||||
j3dSys.reinitGX();
|
j3dSys.reinitGX();
|
||||||
GXSetNumIndStages(0);
|
GXSetNumIndStages(0);
|
||||||
dKy_setLight_again();
|
dKy_setLight_again();
|
||||||
|
|||||||
@@ -220,7 +220,6 @@ void FlagCloth2_c::initCcSphere(fopAc_ac_c*) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline void FlagCloth2_c::draw() {
|
inline void FlagCloth2_c::draw() {
|
||||||
ZoneScoped;
|
|
||||||
j3dSys.reinitGX();
|
j3dSys.reinitGX();
|
||||||
GXSetNumIndStages(0);
|
GXSetNumIndStages(0);
|
||||||
dKy_setLight_again();
|
dKy_setLight_again();
|
||||||
|
|||||||
@@ -10,9 +10,6 @@
|
|||||||
#include "d/d_s_play.h"
|
#include "d/d_s_play.h"
|
||||||
#include "d/actor/d_a_player.h"
|
#include "d/actor/d_a_player.h"
|
||||||
#include "Z2AudioLib/Z2Instances.h"
|
#include "Z2AudioLib/Z2Instances.h"
|
||||||
#if TARGET_PC
|
|
||||||
#include "dusk/frame_interpolation.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
daObj_Keyhole_HIO_c::daObj_Keyhole_HIO_c() {
|
daObj_Keyhole_HIO_c::daObj_Keyhole_HIO_c() {
|
||||||
id = -1;
|
id = -1;
|
||||||
@@ -56,21 +53,6 @@ static int daObj_Keyhole_Draw(obj_keyhole_class* i_this) {
|
|||||||
for (int i = 0; i < 6; i++) {
|
for (int i = 0; i < 6; i++) {
|
||||||
kh_chain_s* chain_s = &i_this->chain_s[i];
|
kh_chain_s* chain_s = &i_this->chain_s[i];
|
||||||
for (int j = 0; j < i_this->chain_num; j++) {
|
for (int j = 0; j < i_this->chain_num; j++) {
|
||||||
#if TARGET_PC
|
|
||||||
if (dusk::frame_interp::is_enabled() && i_this->mChainInterpPrevValid && i_this->mChainInterpCurrValid) {
|
|
||||||
const f32 alpha = dusk::frame_interp::get_interpolation_step();
|
|
||||||
Mtx mtx;
|
|
||||||
const f32* p0 = (const f32*)i_this->mChainInterpPrev[i][j];
|
|
||||||
const f32* p1 = (const f32*)i_this->mChainInterpCurr[i][j];
|
|
||||||
f32* dst = (f32*)mtx;
|
|
||||||
for (int k = 0; k < 12; k++) {
|
|
||||||
dst[k] = p0[k] + (p1[k] - p0[k]) * alpha;
|
|
||||||
}
|
|
||||||
chain_s->model[j]->setBaseTRMtx(mtx);
|
|
||||||
g_env_light.setLightTevColorType_MAJI(chain_s->model[j], &actor->tevStr);
|
|
||||||
mDoExt_modelUpdateDL(chain_s->model[j]);
|
|
||||||
} else
|
|
||||||
#endif
|
|
||||||
dComIfGp_entrySimpleModel(chain_s->model[j], fopAcM_GetRoomNo(actor));
|
dComIfGp_entrySimpleModel(chain_s->model[j], fopAcM_GetRoomNo(actor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -388,21 +370,6 @@ static void chain_move(obj_keyhole_class* i_this) {
|
|||||||
ANGLE_ADD(sp8, TREG_S(0) + 0x3D00);
|
ANGLE_ADD(sp8, TREG_S(0) + 0x3D00);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TARGET_PC
|
|
||||||
if (dusk::frame_interp::is_enabled()) {
|
|
||||||
if (i_this->mChainInterpCurrValid) {
|
|
||||||
memcpy(i_this->mChainInterpPrev, i_this->mChainInterpCurr, sizeof(i_this->mChainInterpCurr));
|
|
||||||
i_this->mChainInterpPrevValid = true;
|
|
||||||
}
|
|
||||||
for (int i = 0; i < 6; i++) {
|
|
||||||
for (int j = 0; j < i_this->chain_num; j++) {
|
|
||||||
MTXCopy(i_this->chain_s[i].model[j]->getBaseTRMtx(), i_this->mChainInterpCurr[i][j]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
i_this->mChainInterpCurrValid = true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void open(obj_keyhole_class* i_this) {
|
static void open(obj_keyhole_class* i_this) {
|
||||||
@@ -783,11 +750,6 @@ static int daObj_Keyhole_Create(fopAc_ac_c* a_this) {
|
|||||||
return cPhs_ERROR_e;
|
return cPhs_ERROR_e;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TARGET_PC
|
|
||||||
i_this->mChainInterpPrevValid = false;
|
|
||||||
i_this->mChainInterpCurrValid = false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
OS_REPORT("//////////////OBJ_KEYHOLE SET 2 !!\n");
|
OS_REPORT("//////////////OBJ_KEYHOLE SET 2 !!\n");
|
||||||
|
|
||||||
if (i_this->arg0 == 3) {
|
if (i_this->arg0 == 3) {
|
||||||
|
|||||||
@@ -392,10 +392,7 @@ static const u8* l_sightDL_get() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void daPy_sightPacket_c::draw() {
|
void daPy_sightPacket_c::draw() {
|
||||||
ZoneScoped;
|
|
||||||
#if !TARGET_PC
|
|
||||||
TGXTexObj texObj;
|
TGXTexObj texObj;
|
||||||
#endif
|
|
||||||
|
|
||||||
j3dSys.reinitGX();
|
j3dSys.reinitGX();
|
||||||
GXSetNumIndStages(0);
|
GXSetNumIndStages(0);
|
||||||
@@ -410,24 +407,10 @@ void daPy_sightPacket_c::draw() {
|
|||||||
|
|
||||||
GXSetTevColor(GX_TEVREG0, reg0);
|
GXSetTevColor(GX_TEVREG0, reg0);
|
||||||
GXSetTevColor(GX_TEVREG1, reg1);
|
GXSetTevColor(GX_TEVREG1, reg1);
|
||||||
#if TARGET_PC
|
|
||||||
if (mpCachedImg != mpImg) {
|
|
||||||
mTexObj.reset();
|
|
||||||
GXInitTexObj(&mTexObj, mpData, mpImg->width, mpImg->height,
|
|
||||||
static_cast<GXTexFmt>(mpImg->format), static_cast<GXTexWrapMode>(mpImg->wrapS),
|
|
||||||
static_cast<GXTexWrapMode>(mpImg->wrapT),
|
|
||||||
mpImg->mipmapCount > 1 ? GX_ENABLE : GX_DISABLE);
|
|
||||||
GXInitTexObjLOD(
|
|
||||||
&mTexObj, GX_LINEAR, GX_LINEAR, 0.0, 0.0, 0.0, GX_FALSE, GX_FALSE, GX_ANISO_1);
|
|
||||||
mpCachedImg = mpImg;
|
|
||||||
}
|
|
||||||
GXLoadTexObj(&mTexObj, GX_TEXMAP0);
|
|
||||||
#else
|
|
||||||
GXInitTexObj(&texObj, mpData, mpImg->width, mpImg->height, (GXTexFmt)mpImg->format,
|
GXInitTexObj(&texObj, mpData, mpImg->width, mpImg->height, (GXTexFmt)mpImg->format,
|
||||||
(GXTexWrapMode)mpImg->wrapS, (GXTexWrapMode)mpImg->wrapT, mpImg->mipmapCount > 1 ? GX_ENABLE : GX_DISABLE);
|
(GXTexWrapMode)mpImg->wrapS, (GXTexWrapMode)mpImg->wrapT, mpImg->mipmapCount > 1 ? GX_ENABLE : GX_DISABLE);
|
||||||
GXInitTexObjLOD(&texObj, GX_LINEAR, GX_LINEAR, 0.0, 0.0, 0.0, GX_FALSE, GX_FALSE, GX_ANISO_1);
|
GXInitTexObjLOD(&texObj, GX_LINEAR, GX_LINEAR, 0.0, 0.0, 0.0, GX_FALSE, GX_FALSE, GX_ANISO_1);
|
||||||
GXLoadTexObj(&texObj, GX_TEXMAP0);
|
GXLoadTexObj(&texObj, GX_TEXMAP0);
|
||||||
#endif
|
|
||||||
GXLoadPosMtxImm(mProjMtx, GX_PNMTX0);
|
GXLoadPosMtxImm(mProjMtx, GX_PNMTX0);
|
||||||
GXSetCurrentMtx(0);
|
GXSetCurrentMtx(0);
|
||||||
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR_NULL);
|
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR_NULL);
|
||||||
|
|||||||
@@ -15,12 +15,6 @@ const u16 l_J_Ohana00_64TEX__height = 63;
|
|||||||
using GameVersion = dusk::version::GameVersion;
|
using GameVersion = dusk::version::GameVersion;
|
||||||
static u8* l_J_Ohana00_64TEX_get() { static u8 buf[0x800]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x9060}, {GameVersion::GcnPal, 0x9060}}, 0x800), true); return buf; }
|
static u8* l_J_Ohana00_64TEX_get() { static u8 buf[0x800]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x9060}, {GameVersion::GcnPal, 0x9060}}, 0x800), true); return buf; }
|
||||||
#define l_J_Ohana00_64TEX (l_J_Ohana00_64TEX_get())
|
#define l_J_Ohana00_64TEX (l_J_Ohana00_64TEX_get())
|
||||||
|
|
||||||
// from d_grass.inc
|
|
||||||
static MtxP get_model_mtx(Mtx modelMtx, Mtx storage);
|
|
||||||
static void transform_positions(
|
|
||||||
const dusk::batch::LeafTemplate& tpl, const Vec* posArray, const Mtx mtx, Vec* xfPos);
|
|
||||||
static void split_batch(u32& emitted, u32 vtxCount);
|
|
||||||
#else
|
#else
|
||||||
#include "assets/l_J_Ohana00_64TEX.h"
|
#include "assets/l_J_Ohana00_64TEX.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -594,12 +588,6 @@ dFlower_packet_c::dFlower_packet_c() {
|
|||||||
GXInitTexObj(&mTexObj_l_J_Ohana01_64128_0419TEX, l_J_Ohana01_64128_0419TEX,
|
GXInitTexObj(&mTexObj_l_J_Ohana01_64128_0419TEX, l_J_Ohana01_64128_0419TEX,
|
||||||
l_J_Ohana01_64128_0419TEX__width + 1, l_J_Ohana01_64128_0419TEX__height + 1, GX_TF_CMPR, GX_MIRROR, GX_MIRROR, GX_FALSE
|
l_J_Ohana01_64128_0419TEX__width + 1, l_J_Ohana01_64128_0419TEX__height + 1, GX_TF_CMPR, GX_MIRROR, GX_MIRROR, GX_FALSE
|
||||||
);
|
);
|
||||||
|
|
||||||
dusk::batch::decode_leaf_template(l_J_hana00DL, 0x140, mTplHana00);
|
|
||||||
dusk::batch::decode_leaf_template(l_J_hana00_cDL, 0xC0, mTplHana00Cut);
|
|
||||||
dusk::batch::decode_leaf_template(l_J_hana01DL, 0x120, mTplHana01);
|
|
||||||
dusk::batch::decode_leaf_template(l_J_hana01_c_00DL, 0xC0, mTplHana01Cut00);
|
|
||||||
dusk::batch::decode_leaf_template(l_J_hana01_c_01DL, 0x120, mTplHana01Cut);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_deleteRoom = &dFlower_packet_c::deleteRoom;
|
m_deleteRoom = &dFlower_packet_c::deleteRoom;
|
||||||
@@ -609,373 +597,7 @@ dFlower_packet_c::dFlower_packet_c() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TARGET_PC
|
|
||||||
static void batch_setup_tev(u32 lightMask) {
|
|
||||||
GXSetCullMode(GX_CULL_NONE);
|
|
||||||
|
|
||||||
GXSetNumChans(2);
|
|
||||||
GXSetChanCtrl(GX_COLOR0, GX_FALSE, GX_SRC_REG, GX_SRC_VTX, 0, GX_DF_NONE, GX_AF_NONE);
|
|
||||||
GXSetChanCtrl(GX_COLOR1, GX_TRUE, GX_SRC_VTX, GX_SRC_REG, lightMask, GX_DF_CLAMP, GX_AF_SPOT);
|
|
||||||
|
|
||||||
GXSetNumTevStages(3);
|
|
||||||
|
|
||||||
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR1A1);
|
|
||||||
GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, GX_CC_RASC);
|
|
||||||
GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV);
|
|
||||||
GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO);
|
|
||||||
GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV);
|
|
||||||
|
|
||||||
GXSetTevOrder(GX_TEVSTAGE1, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0);
|
|
||||||
GXSetTevColorIn(GX_TEVSTAGE1, GX_CC_ZERO, GX_CC_CPREV, GX_CC_RASC, GX_CC_ZERO);
|
|
||||||
GXSetTevColorOp(GX_TEVSTAGE1, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV);
|
|
||||||
GXSetTevAlphaIn(GX_TEVSTAGE1, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO);
|
|
||||||
GXSetTevAlphaOp(GX_TEVSTAGE1, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV);
|
|
||||||
|
|
||||||
GXSetTevOrder(GX_TEVSTAGE2, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR_NULL);
|
|
||||||
GXSetTevColorIn(GX_TEVSTAGE2, GX_CC_ZERO, GX_CC_TEXC, GX_CC_CPREV, GX_CC_C0);
|
|
||||||
GXSetTevColorOp(GX_TEVSTAGE2, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_4, GX_TRUE, GX_TEVPREV);
|
|
||||||
GXSetTevAlphaIn(GX_TEVSTAGE2, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_TEXA);
|
|
||||||
GXSetTevAlphaOp(GX_TEVSTAGE2, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV);
|
|
||||||
}
|
|
||||||
|
|
||||||
static GXColor hana00_amb_color(const dFlower_data_c* flower, const dKy_tevstr_c* tevstr) {
|
|
||||||
GXColor amb = {0, 0, 0, 0xFF};
|
|
||||||
if (DEBUG && g_kankyoHIO.navy.grass_adjust_ON != 0) {
|
|
||||||
amb.r = g_kankyoHIO.navy.grass_ambcol.r * 2;
|
|
||||||
amb.g = g_kankyoHIO.navy.grass_ambcol.g * 2;
|
|
||||||
amb.b = g_kankyoHIO.navy.grass_ambcol.b * 2;
|
|
||||||
} else {
|
|
||||||
amb.r = (flower->field_0x04 & 0x1F) * 2;
|
|
||||||
amb.g = ((flower->field_0x04 >> 5) & 0x1F) * 2;
|
|
||||||
amb.b = ((flower->field_0x04 >> 0xA) & 0x1F) * 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (daPy_py_c::checkNowWolfPowerUp()) {
|
|
||||||
f32 ambRate = g_env_light.bg_amb_col[0].r / 255.0f;
|
|
||||||
f32 col = (((flower->field_0x04 & 0x1F) * 2 + 0x10));
|
|
||||||
amb.r = col * (ambRate * 4.0f);
|
|
||||||
|
|
||||||
ambRate = g_env_light.bg_amb_col[0].g / 255.0f;
|
|
||||||
f32 col2 = (((flower->field_0x04 >> 5) & 0x1F) * 2 + 0x10);
|
|
||||||
amb.g = col2 * (4.0f * ambRate);
|
|
||||||
|
|
||||||
ambRate = g_env_light.bg_amb_col[0].b / 255.0f;
|
|
||||||
f32 col3 = (((flower->field_0x04 >> 10) & 0x1F) * 2 + 0x10);
|
|
||||||
amb.b = col3 * (4.0f * ambRate);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (amb.r == 0x3E) {
|
|
||||||
amb.r = tevstr->AmbCol.r;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (amb.g == 0x3E) {
|
|
||||||
amb.g = tevstr->AmbCol.g;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (amb.b == 0x3E) {
|
|
||||||
amb.b = tevstr->AmbCol.b;
|
|
||||||
}
|
|
||||||
|
|
||||||
return amb;
|
|
||||||
}
|
|
||||||
|
|
||||||
static GXColor hana01_amb_color(int idx, const dKy_tevstr_c* tevstr) {
|
|
||||||
f32 rRate = tevstr->AmbCol.r * 0.03125f;
|
|
||||||
if (rRate > 1.0f) {
|
|
||||||
rRate = 1.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
f32 gRate = tevstr->AmbCol.g * 0.03125f;
|
|
||||||
if (gRate > 1.0f) {
|
|
||||||
gRate = 1.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
f32 bRate = tevstr->AmbCol.b * 0.03125f;
|
|
||||||
if (bRate > 1.0f) {
|
|
||||||
bRate = 1.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
GXColor amb = {1, 1, 1, 1};
|
|
||||||
|
|
||||||
GXColor sub;
|
|
||||||
sub.r = -0.4f * tevstr->AmbCol.r * rRate;
|
|
||||||
sub.g = -0.4f * tevstr->AmbCol.g * gRate;
|
|
||||||
sub.b = -0.4f * tevstr->AmbCol.b * bRate;
|
|
||||||
|
|
||||||
switch (idx & 7) {
|
|
||||||
case 0:
|
|
||||||
amb.r = tevstr->AmbCol.r + sub.r;
|
|
||||||
amb.g = tevstr->AmbCol.g;
|
|
||||||
amb.b = tevstr->AmbCol.b;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
amb.r = tevstr->AmbCol.r;
|
|
||||||
amb.g = tevstr->AmbCol.g + sub.g;
|
|
||||||
amb.b = tevstr->AmbCol.b;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
amb.r = tevstr->AmbCol.r;
|
|
||||||
amb.g = tevstr->AmbCol.g;
|
|
||||||
amb.b = tevstr->AmbCol.b + sub.b;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
amb.r = tevstr->AmbCol.r + sub.r;
|
|
||||||
amb.g = tevstr->AmbCol.g + sub.g;
|
|
||||||
amb.b = tevstr->AmbCol.b;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
amb.r = tevstr->AmbCol.r;
|
|
||||||
amb.g = tevstr->AmbCol.g + sub.g;
|
|
||||||
amb.b = tevstr->AmbCol.b + sub.b;
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
amb.r = tevstr->AmbCol.r + sub.r;
|
|
||||||
amb.g = tevstr->AmbCol.g;
|
|
||||||
amb.b = tevstr->AmbCol.b + sub.b;
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
amb.r = tevstr->AmbCol.r + sub.r;
|
|
||||||
amb.g = tevstr->AmbCol.g + sub.g;
|
|
||||||
amb.b = tevstr->AmbCol.b + sub.b;
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (daPy_py_c::checkNowWolfPowerUp()) {
|
|
||||||
f32 ambRate = g_env_light.bg_amb_col[0].r / 255.0f;
|
|
||||||
amb.r = (amb.r + 8) * (6.0f * ambRate);
|
|
||||||
|
|
||||||
ambRate = g_env_light.bg_amb_col[0].g / 255.0f;
|
|
||||||
amb.g = (amb.g + 8) * (6.0f * ambRate);
|
|
||||||
|
|
||||||
ambRate = g_env_light.bg_amb_col[0].b / 255.0f;
|
|
||||||
amb.b = (amb.b + 8) * (6.0f * ambRate);
|
|
||||||
}
|
|
||||||
|
|
||||||
amb.a = 0xFF;
|
|
||||||
return amb;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void flower_emit(const dusk::batch::LeafTemplate& tpl, const Vec* xformedPos, GXColor amb) {
|
|
||||||
for (u32 i = 0; i < tpl.vtxCount; i++) {
|
|
||||||
const dusk::batch::LeafTemplate::Vtx& v = tpl.vtx[i];
|
|
||||||
const Vec& p = xformedPos[v.pos];
|
|
||||||
GXPosition3f32(p.x, p.y, p.z);
|
|
||||||
GXNormal1x8(v.nrm);
|
|
||||||
GXColor1x8(v.clr);
|
|
||||||
GXColor4u8(amb.r, amb.g, amb.b, amb.a);
|
|
||||||
GXTexCoord1x8(v.tex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void dFlower_packet_c::draw() {
|
void dFlower_packet_c::draw() {
|
||||||
ZoneScoped;
|
|
||||||
dScnKy_env_light_c* kankyo = dKy_getEnvlight();
|
|
||||||
j3dSys.reinitGX();
|
|
||||||
|
|
||||||
GXSetNumIndStages(0);
|
|
||||||
dKy_setLight_again();
|
|
||||||
GXClearVtxDesc();
|
|
||||||
GXSetVtxDesc(GX_VA_POS, GX_INDEX8);
|
|
||||||
GXSetVtxDesc(GX_VA_NRM, GX_INDEX8);
|
|
||||||
GXSetVtxDesc(GX_VA_CLR0, GX_INDEX8);
|
|
||||||
GXSetVtxDesc(GX_VA_TEX0, GX_INDEX8);
|
|
||||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
|
|
||||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_NRM, GX_NRM_XYZ, GX_F32, 0);
|
|
||||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0);
|
|
||||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_F32, 0);
|
|
||||||
GXSetVtxAttrFmt(GX_VTXFMT1, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
|
|
||||||
GXSetVtxAttrFmt(GX_VTXFMT1, GX_VA_NRM, GX_NRM_XYZ, GX_F32, 0);
|
|
||||||
GXSetVtxAttrFmt(GX_VTXFMT1, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0);
|
|
||||||
GXSetVtxAttrFmt(GX_VTXFMT1, GX_VA_CLR1, GX_CLR_RGBA, GX_RGBA8, 0);
|
|
||||||
GXSetVtxAttrFmt(GX_VTXFMT1, GX_VA_TEX0, GX_TEX_ST, GX_F32, 0);
|
|
||||||
GXSETARRAY(GX_VA_POS, &l_flowerPos, sizeof(l_flowerPos), sizeof(Vec), true);
|
|
||||||
GXSETARRAY(GX_VA_NRM, &l_flowerNormal, sizeof(l_flowerNormal), sizeof(Vec), true);
|
|
||||||
GXSETARRAY(GX_VA_CLR0, &l_flowerColor, sizeof(l_flowerColor), sizeof(GXColor), true);
|
|
||||||
GXSETARRAY(GX_VA_TEX0, &l_flowerTexCoord, sizeof(l_flowerTexCoord), 8, true);
|
|
||||||
|
|
||||||
static GXVtxDescList vtxDescList[] = {
|
|
||||||
{GX_VA_POS, GX_DIRECT},
|
|
||||||
{GX_VA_NRM, GX_INDEX8},
|
|
||||||
{GX_VA_CLR0, GX_INDEX8},
|
|
||||||
{GX_VA_CLR1, GX_DIRECT},
|
|
||||||
{GX_VA_TEX0, GX_INDEX8},
|
|
||||||
{GX_VA_NULL, GX_NONE},
|
|
||||||
};
|
|
||||||
static Vec xfPos[256];
|
|
||||||
Mtx identity;
|
|
||||||
MTXIdentity(identity);
|
|
||||||
|
|
||||||
// --- hana00 ---
|
|
||||||
for (int i = 0; i < 64; i++) {
|
|
||||||
dFlower_data_c* first = m_room[i].getData();
|
|
||||||
if (first == nullptr || !dComIfGp_roomControl_checkStatusFlag(i, 0x10)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
dKy_tevstr_c* tevstr = dComIfGp_roomControl_getTevStr(i);
|
|
||||||
int lightCount = 6;
|
|
||||||
|
|
||||||
if (dComIfGp_roomControl_getStatusRoomDt(i) != nullptr) {
|
|
||||||
lightCount = dComIfGp_roomControl_getStatusRoomDt(i)->getLightVecInfoNum();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dKy_SunMoon_Light_Check() && lightCount < 2) {
|
|
||||||
lightCount = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int j = 0; j < 6; j++) {
|
|
||||||
if (kankyo->field_0x0c18[j].field_0x26 == 1) {
|
|
||||||
lightCount++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lightCount <= 2) {
|
|
||||||
GXCallDisplayList(l_matLight4DL, 0x80);
|
|
||||||
} else {
|
|
||||||
GXCallDisplayList(l_matDL, 0x80);
|
|
||||||
}
|
|
||||||
|
|
||||||
GXSetTevColorS10(GX_TEVREG0, {0, 0, 0, 0});
|
|
||||||
dKy_Global_amb_set(tevstr);
|
|
||||||
dKy_GxFog_tevstr_set(tevstr);
|
|
||||||
dKy_setLight_nowroom_grass(tevstr->room_no, 1.0f);
|
|
||||||
|
|
||||||
GXLoadTexObj(&mTexObj_l_J_Ohana00_64TEX, GX_TEXMAP0);
|
|
||||||
batch_setup_tev(lightCount <= 2 ? (GX_LIGHT1 | GX_LIGHT2 | GX_LIGHT3 | GX_LIGHT4) :
|
|
||||||
(GX_LIGHT1 | GX_LIGHT2 | GX_LIGHT3 | GX_LIGHT4 |
|
|
||||||
GX_LIGHT5 | GX_LIGHT6 | GX_LIGHT7));
|
|
||||||
GXSetVtxDescv(vtxDescList);
|
|
||||||
GXLoadPosMtxImm(identity, GX_PNMTX0);
|
|
||||||
GXLoadNrmMtxImm(j3dSys.getViewMtx(), 0);
|
|
||||||
|
|
||||||
for (int bucket = 0; bucket < 2; bucket++) {
|
|
||||||
const bool cut = bucket != 0;
|
|
||||||
const dusk::batch::LeafTemplate& tpl = cut ? mTplHana00Cut : mTplHana00;
|
|
||||||
|
|
||||||
bool open = false;
|
|
||||||
u32 emitted = 0;
|
|
||||||
for (dFlower_data_c* flower = first; flower != nullptr; flower = flower->mp_next) {
|
|
||||||
if (cLib_checkBit<u8>(flower->m_state, 4) ||
|
|
||||||
cLib_checkBit<u8>(flower->m_state, 0x40))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if ((cLib_checkBit<u8>(flower->m_state, 8) != 0) != cut) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!open) {
|
|
||||||
GXBegin(GX_TRIANGLES, GX_VTXFMT1, GX_AUTO);
|
|
||||||
open = true;
|
|
||||||
}
|
|
||||||
split_batch(emitted, tpl.vtxCount);
|
|
||||||
|
|
||||||
Mtx interpMtx;
|
|
||||||
MtxP mtx = get_model_mtx(flower->m_modelMtx, interpMtx);
|
|
||||||
transform_positions(tpl, reinterpret_cast<Vec*>(l_flowerPos), mtx, xfPos);
|
|
||||||
flower_emit(tpl, xfPos, hana00_amb_color(flower, tevstr));
|
|
||||||
}
|
|
||||||
if (open) {
|
|
||||||
GXEnd();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// --- hana01 ---
|
|
||||||
GXSETARRAY(GX_VA_POS, mp_pos, sizeof(l_flowerPos2), sizeof(Vec), true);
|
|
||||||
GXSETARRAY(GX_VA_NRM, &l_flowerNormal2, sizeof(l_flowerNormal2), sizeof(Vec), true);
|
|
||||||
GXSETARRAY(GX_VA_CLR0, mp_colors, sizeof(l_flowerColor2), sizeof(GXColor), true);
|
|
||||||
GXSETARRAY(GX_VA_TEX0, mp_texCoords, sizeof(l_flowerTexCoord2), 8, true);
|
|
||||||
|
|
||||||
for (int i = 0; i < 64; i++) {
|
|
||||||
dFlower_data_c* first = m_room[i].getData();
|
|
||||||
if (first == NULL) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
dKy_tevstr_c* tevstr = dComIfGp_roomControl_getTevStr(i);
|
|
||||||
int lightCount = 6;
|
|
||||||
|
|
||||||
if (dComIfGp_roomControl_getStatusRoomDt(i) != NULL) {
|
|
||||||
lightCount = dComIfGp_roomControl_getStatusRoomDt(i)->getLightVecInfoNum();
|
|
||||||
}
|
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
if (g_kankyoHIO.light.m_HOSTIO_setting != 0) {
|
|
||||||
lightCount = g_kankyoHIO.dungeonLight.usedLights;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (dKy_SunMoon_Light_Check() == TRUE && lightCount < 2) {
|
|
||||||
lightCount = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lightCount <= 2) {
|
|
||||||
GXCallDisplayList(mp_mat2Light4DL, m_mat2Light4DL_size);
|
|
||||||
} else {
|
|
||||||
GXCallDisplayList(mp_mat2DL, m_mat2DL_size);
|
|
||||||
}
|
|
||||||
|
|
||||||
GXSetTevColorS10(GX_TEVREG0, {0, 0, 0, 0});
|
|
||||||
dKy_Global_amb_set(tevstr);
|
|
||||||
dKy_GxFog_tevstr_set(tevstr);
|
|
||||||
dKy_setLight_nowroom_grass(tevstr->room_no, 1.0f);
|
|
||||||
|
|
||||||
GXLoadTexObj(&mTexObj_l_J_Ohana01_64128_0419TEX, GX_TEXMAP0);
|
|
||||||
batch_setup_tev(lightCount <= 2 ? (GX_LIGHT1 | GX_LIGHT2 | GX_LIGHT3 | GX_LIGHT4) :
|
|
||||||
(GX_LIGHT1 | GX_LIGHT2 | GX_LIGHT3 | GX_LIGHT4 |
|
|
||||||
GX_LIGHT5 | GX_LIGHT6 | GX_LIGHT7));
|
|
||||||
GXSetVtxDescv(vtxDescList);
|
|
||||||
GXLoadPosMtxImm(identity, GX_PNMTX0);
|
|
||||||
GXLoadNrmMtxImm(j3dSys.getViewMtx(), 0);
|
|
||||||
|
|
||||||
const dusk::batch::LeafTemplate* const buckets[3] = {
|
|
||||||
&mTplHana01, &mTplHana01Cut00, &mTplHana01Cut};
|
|
||||||
for (int bucket = 0; bucket < 3; bucket++) {
|
|
||||||
const dusk::batch::LeafTemplate& tpl = *buckets[bucket];
|
|
||||||
|
|
||||||
bool open = false;
|
|
||||||
u32 emitted = 0;
|
|
||||||
int idx = 0;
|
|
||||||
for (dFlower_data_c* flower = first; flower != NULL; flower = flower->mp_next, idx++) {
|
|
||||||
if (cLib_checkBit<u8>(flower->m_state, 4) ||
|
|
||||||
!cLib_checkBit<u8>(flower->m_state, 0x40))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
const int flowerBucket = cLib_checkBit<u8>(flower->m_state, 8) ? 2 :
|
|
||||||
cLib_checkBit<u8>(flower->m_state, 0x10) ? 1 :
|
|
||||||
0;
|
|
||||||
if (flowerBucket != bucket) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!open) {
|
|
||||||
GXBegin(GX_TRIANGLES, GX_VTXFMT1, GX_AUTO);
|
|
||||||
open = true;
|
|
||||||
}
|
|
||||||
split_batch(emitted, tpl.vtxCount);
|
|
||||||
|
|
||||||
Mtx interpMtx;
|
|
||||||
MtxP mtx = get_model_mtx(flower->m_modelMtx, interpMtx);
|
|
||||||
transform_positions(tpl, mp_pos, mtx, xfPos);
|
|
||||||
flower_emit(tpl, xfPos, hana01_amb_color(idx, tevstr));
|
|
||||||
}
|
|
||||||
if (open) {
|
|
||||||
GXEnd();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
GXSetNumTevStages(1);
|
|
||||||
GXSetNumChans(1);
|
|
||||||
J3DShape::resetVcdVatCache();
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
void dFlower_packet_c::draw() {
|
|
||||||
ZoneScoped;
|
|
||||||
dScnKy_env_light_c* kankyo = dKy_getEnvlight();
|
dScnKy_env_light_c* kankyo = dKy_getEnvlight();
|
||||||
j3dSys.reinitGX();
|
j3dSys.reinitGX();
|
||||||
|
|
||||||
@@ -1263,7 +885,6 @@ void dFlower_packet_c::draw() {
|
|||||||
|
|
||||||
J3DShape::resetVcdVatCache();
|
J3DShape::resetVcdVatCache();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void dFlower_packet_c::calc() {
|
void dFlower_packet_c::calc() {
|
||||||
dFlower_anm_c* anm_p = getAnm();
|
dFlower_anm_c* anm_p = getAnm();
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user