Merge branch 'TwilitRealm:main' into faster-scene-transitions

This commit is contained in:
tomtee
2026-09-16 14:27:00 +00:00
committed by GitHub
484 changed files with 26343 additions and 7224 deletions
+2
View File
@@ -187,6 +187,8 @@ jobs:
- name: Setup Android SDK
uses: android-actions/setup-android@v4
with:
packages: platform-tools
- name: Install Android SDK packages
run: sdkmanager "platforms;android-36" "build-tools;36.1.0" "ndk;${ANDROID_NDK_VERSION}"
+44 -3
View File
@@ -92,6 +92,8 @@ option(DUSK_SELECTED_OPT "If on, selected parts of the project will be compiled
option(DUSK_PACKAGE_INSTALL "Install Dusklight with a Linux-native file structure" OFF)
option(DUSK_GFX_DEBUG_GROUPS "Report debug groups to the native graphics API" ${DUSK_GFX_DEBUG_GROUPS_DEFAULT})
option(DUSK_ENABLE_CODE_MODS "Enable code mods" ON)
option(DUSK_ENABLE_OPUS "Enable loading Opus audio files for mods" OFF)
set(DUSK_HAS_FUNCHOOK OFF)
if (DUSK_ENABLE_CODE_MODS AND (NOT APPLE OR CMAKE_SYSTEM_NAME STREQUAL "Darwin"))
@@ -180,8 +182,34 @@ FetchContent_Declare(miniz
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
EXCLUDE_FROM_ALL
)
message(STATUS "dusklight: Fetching PicoSHA2")
FetchContent_Declare(picosha2
URL https://github.com/okdshin/PicoSHA2/archive/refs/tags/v1.0.1.tar.gz
URL_HASH SHA256=9983136544234e573fe07cc1a22fdf978ad7979043e7be2e9082f6d4991ff8a8
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
EXCLUDE_FROM_ALL
)
set(_fetch_content_deps miniz picosha2)
if (DUSK_ENABLE_OPUS)
message(STATUS "dusklight: Fetching opusfile")
# Opusfile options
SET(OP_DISABLE_HTTP ON CACHE BOOL "" FORCE)
SET(OP_DISABLE_DOCS ON CACHE BOOL "" FORCE)
SET(OP_DISABLE_EXAMPLES ON CACHE BOOL "" FORCE)
message(STATUS "dusklight: Fetching opusfile")
FetchContent_Declare(
opusfile
GIT_REPOSITORY https://github.com/xiph/opusfile.git
GIT_TAG 6dfd29e7adb87f2e193575fc3fa88cbf1a0b27df
)
list(APPEND _fetch_content_deps opusfile)
endif ()
set(_fetch_content_deps miniz)
if (DUSK_HAS_FUNCHOOK)
message(STATUS "dusklight: Fetching funchook")
# cmake/PatchFunchook.cmake patches funchook's cmake/capstone.cmake.in to inject a
@@ -216,6 +244,14 @@ if (DUSK_HAS_FUNCHOOK)
endif ()
FetchContent_MakeAvailable(${_fetch_content_deps})
if (DUSK_HAS_FUNCHOOK AND APPLE)
target_sources(funchook-static PRIVATE src/dusk/mods/loader/code_patch_macos.cpp)
target_include_directories(funchook-static PRIVATE src/dusk/mods/loader)
set_source_files_properties(src/dusk/mods/loader/code_patch_macos.cpp
TARGET_DIRECTORY funchook-static PROPERTIES
COMPILE_OPTIONS "-O2;-fno-sanitize=all;-fno-stack-protector")
endif ()
# Use signed char on ARM to match the original game (and x86)
string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" _arch)
if(_arch MATCHES "^(arm|aarch64)" AND CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "GNU")
@@ -241,11 +277,15 @@ include(cmake/GameABIConfig.cmake)
find_package(Threads REQUIRED)
set(GAME_COMPILE_DEFS DUSK_BUILDING_GAME=1)
set(GAME_LIBS aurora::core aurora::gx aurora::gd aurora::si aurora::vi aurora::pad aurora::mtx aurora::os aurora::dvd aurora::thp
aurora::card borealis::cli borealis::crash borealis::data borealis::disc borealis::discord borealis::file_select borealis::io borealis::log borealis::net borealis::presentation borealis::sentry borealis::update borealis::ws freeverb cxxopts::cxxopts absl::flat_hash_map nlohmann_json::nlohmann_json TracyClient fmt::fmt
Threads::Threads zstd::libzstd dusklight_game_headers)
aurora::card borealis::http borealis::cli borealis::crash borealis::data borealis::disc borealis::discord borealis::file_select borealis::io borealis::log borealis::net borealis::presentation borealis::sentry borealis::update borealis::ws freeverb cxxopts::cxxopts absl::flat_hash_map nlohmann_json::nlohmann_json TracyClient fmt::fmt
Threads::Threads zstd::libzstd dusklight_game_headers picosha2 PNG::PNG)
if (DUSK_HAS_FUNCHOOK)
list(APPEND GAME_LIBS funchook-static)
endif ()
if (DUSK_ENABLE_OPUS)
list(APPEND GAME_LIBS OpusFile::opusfile)
list(APPEND GAME_COMPILE_DEFS DUSK_OPUS=1)
endif ()
if (WIN32)
list(APPEND GAME_LIBS Ws2_32)
@@ -502,6 +542,7 @@ if (DUSK_ENABLE_CODE_MODS AND CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR
add_subdirectory(mods/custom_actor_demo)
add_subdirectory(mods/cosmetics)
add_subdirectory(mods/randomizer)
add_subdirectory(mods/audio_mod)
endif ()
if (APPLE)
+3
View File
@@ -14,6 +14,9 @@ Dusklight is a reverse-engineered reimplementation of Twilight Princess.
It aims to be as accurate as possible to the original while also providing new options, enhancements, and tools to customize your experience.
> [!IMPORTANT]
> Dusklight's official website is https://twilitrealm.dev/, any other website is not affiliated and may be promoting AI-generated misinformation.
# Setup
> [!IMPORTANT]
+49 -53
View File
@@ -2,59 +2,55 @@ file(READ "${SOURCE_DIR}/cmake/capstone.cmake.in" _content)
# Insert PATCH_COMMAND before CONFIGURE_COMMAND in the ExternalProject_Add.
# Bracket args prevent cmake from substituting ${...} while writing this file.
string(REPLACE
" CONFIGURE_COMMAND \"\""
[=[ PATCH_COMMAND "${CMAKE_COMMAND}" -DDIR=${CMAKE_CURRENT_BINARY_DIR}/capstone-src -P "${CAPSTONE_FIX_SCRIPT}"
if (NOT _content MATCHES "CAPSTONE_FIX_SCRIPT")
string(REPLACE
" CONFIGURE_COMMAND \"\""
[=[ PATCH_COMMAND "${CMAKE_COMMAND}" -DDIR=${CMAKE_CURRENT_BINARY_DIR}/capstone-src -P "${CAPSTONE_FIX_SCRIPT}"
CONFIGURE_COMMAND ""]=]
_content "${_content}")
file(WRITE "${SOURCE_DIR}/cmake/capstone.cmake.in" "${_content}")
file(READ "${SOURCE_DIR}/src/funchook_unix.c" _unix_content)
# macOS rejects the POSIX mprotect RWX/RW transition for executable image pages on arm64.
# Use Mach VM_PROT_COPY for the short patch window, then restore RX permissions.
if (NOT _unix_content MATCHES "VM_PROT_READ \\| VM_PROT_WRITE \\| VM_PROT_COPY")
string(REPLACE
[=[ rv = mprotect(mstate->addr, mstate->size, prot);]=]
[=[#ifdef __APPLE__
kern_return_t kr = vm_protect(mach_task_self(), (vm_address_t)mstate->addr,
(vm_size_t)mstate->size, FALSE,
VM_PROT_READ | VM_PROT_WRITE | VM_PROT_COPY);
if (kr == KERN_SUCCESS) {
funchook_log(funchook, " unprotect memory %p (size=%"PRIuPTR", prot=read,write,copy) <- %p (size=%"PRIuPTR")\n",
mstate->addr, mstate->size, start, len);
return 0;
}
funchook_set_error_message(funchook, "Failed to unprotect memory %p (size=%"PRIuPTR", prot=read,write,copy) <- %p (size=%"PRIuPTR", error=%s)",
mstate->addr, mstate->size, start, len,
mach_error_string(kr));
return FUNCHOOK_ERROR_MEMORY_FUNCTION;
#endif
rv = mprotect(mstate->addr, mstate->size, prot);]=]
_unix_content "${_unix_content}")
string(REPLACE
[=[ char errbuf[128];
int rv = mprotect(mstate->addr, mstate->size, PROT_READ | PROT_EXEC);]=]
[=[ char errbuf[128];
#ifdef __APPLE__
kern_return_t kr = vm_protect(mach_task_self(), (vm_address_t)mstate->addr,
(vm_size_t)mstate->size, FALSE,
VM_PROT_READ | VM_PROT_EXECUTE);
if (kr == KERN_SUCCESS) {
funchook_log(funchook, " protect memory %p (size=%"PRIuPTR", prot=read,exec)\n",
mstate->addr, mstate->size);
return 0;
}
funchook_set_error_message(funchook, "Failed to protect memory %p (size=%"PRIuPTR", prot=read,exec, error=%s)",
mstate->addr, mstate->size,
mach_error_string(kr));
return FUNCHOOK_ERROR_MEMORY_FUNCTION;
#endif
int rv = mprotect(mstate->addr, mstate->size, PROT_READ | PROT_EXEC);]=]
_unix_content "${_unix_content}")
_content "${_content}")
file(WRITE "${SOURCE_DIR}/cmake/capstone.cmake.in" "${_content}")
endif ()
file(WRITE "${SOURCE_DIR}/src/funchook_unix.c" "${_unix_content}")
file(READ "${SOURCE_DIR}/src/funchook.c" _content)
if (NOT _content MATCHES "commit_code_patch")
string(REPLACE "#include \"funchook_internal.h\""
"#include \"funchook_internal.h\"\n#ifdef __APPLE__\n#include \"code_patch_macos.hpp\"\n#endif"
_content "${_content}")
foreach(_operation install uninstall)
if (_operation STREQUAL "install")
set(_expected old_code)
set(_replacement new_code)
else ()
set(_expected new_code)
set(_replacement old_code)
endif ()
set(_original " mem_state_t mstate;
int rv = funchook_unprotect_begin(funchook, &mstate, entry->target_func, JUMP32_BYTE_SIZE);
if (rv != 0) {
return rv;
}
memcpy(entry->target_func, entry->${_replacement}, JUMP32_BYTE_SIZE);
rv = funchook_unprotect_end(funchook, &mstate);
if (rv != 0) {
return rv;
}
flush_instruction_cache(entry->target_func, JUMP32_BYTE_SIZE);")
string(FIND "${_content}" "${_original}" _position)
if (_position EQUAL -1)
message(FATAL_ERROR "Funchook ${_operation} patch site changed")
endif ()
string(REPLACE "${_original}" "#ifdef __APPLE__
int rv = commit_code_patch(entry->target_func, entry->${_expected},
entry->${_replacement}, JUMP32_BYTE_SIZE);
if (rv != 0) {
funchook_set_error_message(funchook, \"Code patch commit failed (Mach error %d)\", rv);
return FUNCHOOK_ERROR_MEMORY_FUNCTION;
}
#else
${_original}
#endif" _content "${_content}")
endforeach ()
file(WRITE "${SOURCE_DIR}/src/funchook.c" "${_content}")
endif ()
+11 -9
View File
@@ -2,7 +2,7 @@ include_guard(GLOBAL)
get_filename_component(_SYMBOL_MANIFEST_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" DIRECTORY)
set(_SYMGEN_VERSION "1.3.4")
set(_SYMGEN_VERSION "1.3.6")
set(_SYMGEN_RELEASE_BASE_URL "https://github.com/encounter/symgen/releases/download/v${_SYMGEN_VERSION}")
set(SYMGEN_PATH "" CACHE FILEPATH "Path to a symgen executable; empty downloads the pinned release")
mark_as_advanced(SYMGEN_PATH)
@@ -15,32 +15,32 @@ function(symgen_host_asset out_name out_hash)
if (CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
if (_host_processor MATCHES "^(arm64|aarch64)$")
set(_asset "symgen-macos-arm64")
set(_asset_hash "SHA256=983ef6278d30bee38f240f451ca736fd294da0e5705ee15029accac5c7a33829")
set(_asset_hash "SHA256=6b836f4fd7e57fc198ca6bfb3e0161504c98f2be2622819849bfc3f265edf4af")
elseif (_host_processor MATCHES "^(x86_64|amd64)$")
set(_asset "symgen-macos-x86_64")
set(_asset_hash "SHA256=b6ab1720a4f04fadcf291f42d133e2ee68ef2e9a75d143e51584929e808af8a2")
set(_asset_hash "SHA256=93218f786d34d3ec58f96624e0494ff605e6102cdb31cd7c9922364cfc7885a5")
endif ()
elseif (CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
if (_host_processor MATCHES "^(aarch64|arm64)$")
set(_asset "symgen-linux-aarch64")
set(_asset_hash "SHA256=ba84486ff1ceb753973e6213c9bc5f195b5ff6f220f5d3322fd861966cdc791c")
set(_asset_hash "SHA256=7891446505c4dd428f4b84c7ceed1441719d910b3d5a47d3540aa890538449ae")
elseif (_host_processor MATCHES "^(x86_64|amd64)$")
set(_asset "symgen-linux-x86_64")
set(_asset_hash "SHA256=8b81a00a2ef8f5dd4b59adba1badfaca57e472bf272516bc12c4625cefb37718")
set(_asset_hash "SHA256=236bc5cd4bda03a8dd53a4531efff1fec3bcd19b09890893b9b6f8f5ae77f041")
elseif (_host_processor MATCHES "^(i[3-6]86|x86)$")
set(_asset "symgen-linux-i686")
set(_asset_hash "SHA256=01aa85d84148a6806fdf69839dea7e962e6ac46956aed63b9ecb7d596f179f93")
set(_asset_hash "SHA256=e3b4e8e978d630f07ed6aa58d387145356026116b2e8fa99801902dfac73b2ea")
endif ()
elseif (CMAKE_HOST_WIN32)
if (_host_processor MATCHES "^(arm64|aarch64)$")
set(_asset "symgen-windows-arm64.exe")
set(_asset_hash "SHA256=e116099f859177d7e29fc3444d67083596330e5c4fb3a0461b21402c89249d96")
set(_asset_hash "SHA256=36e2c68bb4f9e3abea728c4cd7ddc01ff1f462be7156af18baa20621b7d39df8")
elseif (_host_processor MATCHES "^(x86_64|amd64)$")
set(_asset "symgen-windows-x86_64.exe")
set(_asset_hash "SHA256=57ef1c2f563e33fa4915c40194c4ced540f985c48d9cf081047c6bbcb585fa37")
set(_asset_hash "SHA256=171995a33bfd5a5271b5bb78d3f2c1d4aec58721bf3a894aaad5607ff648e2a4")
elseif (_host_processor MATCHES "^(i[3-6]86|x86)$")
set(_asset "symgen-windows-x86.exe")
set(_asset_hash "SHA256=cc0ba337c798d3f63d8acbb2d16d531d0c2da878fbdd2b6307702334ec880528")
set(_asset_hash "SHA256=9ed095a01e05eb05e91472bfa7b95b84dfeaeead0941a80708196199c95188db")
endif ()
endif ()
@@ -116,6 +116,7 @@ function(setup_symbol_manifest target)
return()
endif ()
add_dependencies(${target} symgen)
set_property(TARGET ${target} APPEND PROPERTY LINK_DEPENDS "${SYMGEN_EXE}")
# Reserve an ELF program-header entry when the linker supports it (mold).
# symgen can replace the PT_NULL entry without relocating the table, keeping later post-link tools safe.
@@ -148,6 +149,7 @@ function(setup_symbol_manifest target)
# signature.
add_custom_command(TARGET ${target} POST_BUILD
COMMAND "${SYMGEN_EXE}" manifest ${_input} --embed "$<TARGET_FILE:${target}>"
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
COMMENT "Embedding symbol manifest"
VERBATIM)
endfunction()
+58
View File
@@ -0,0 +1,58 @@
flowchart TD
Start[Start Sound Effect]
subgraph BST
params[Look up sound parameters]
end
Start-->|Sound ID|BST
subgraph BSC
bms_start[Look up BMS start]
end
Start-->|Sound ID|BSC
BSC-->|BMS data| bms[BMS interpreter]
subgraph IBNK
bnk[Look up instrument parameters]
end
bms-->|Plays notes| IBNK
subgraph WSYS
wsys[Look up wave sample]
end
IBNK-->|Wave ID|WSYS
flowchart TD
Start[Start Sound Effect]
subgraph BST
params[Look up sound parameters]
end
Start-->|Sound ID|BST
BST-->|File path| ast[Stream /AudioRes/Stream/xxx.ast from disc]
flowchart TD
Start[Start Sound Effect]
subgraph BST
params[Look up sound parameters]
end
Start-->|Sound ID|BST
BST-->|Resource ID| arc[Z2SoundSeqs.arc]
arc-->|BMS file| bms[BMS interpreter]
subgraph IBNK
bnk[Look up instrument parameters]
end
bms-->|Plays notes| IBNK
subgraph WSYS
wsys[Look up wave sample]
end
IBNK-->|Wave ID|WSYS
File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 22 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 21 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 15 KiB

+26
View File
@@ -0,0 +1,26 @@
#pragma endian big
#include "std/sys.pat"
#include "type/magic.pat"
#include "std/array.pat"
/**
* Wrapper for a file-global pointer that allows it to be stored in an array.
*/
struct Offset<T> {
T* offset : u32 [[inline]];
};
struct JAUSeqCollectionTable {
u32 mEntryCount;
u32 mBmsOffset[mEntryCount];
};
struct JAUSeqCollectionData {
type::Magic<"SC"> mMagic;
u16 mNumSoundCategories;
u32 mSectionSize;
Offset<JAUSeqCollectionTable> mTableOffsets[mNumSoundCategories];
};
JAUSeqCollectionData data @ 0x0;
+71
View File
@@ -0,0 +1,71 @@
#pragma endian big
#include "std/sys.pat"
#include "type/magic.pat"
#include "std/array.pat"
/**
* Wrapper for a file-global pointer that allows it to be stored in an array.
*/
struct Offset<T> {
T* offset : u32 [[inline]];
};
struct ItemSoundEffect {
u8 mPriority;
u8 mVolume;
padding[2];
u32 mSwBit;
float mPitch;
};
struct ItemSequence {
u8 mPriority;
u8 mVolume;
u16 mResourceId;
};
struct ItemStream {
u8 mPriority;
u8 mVolume;
u16 mStreamPanParameters;
char* mStreamFilePath[] : u32;
};
struct SoundTableGroupEntry {
u8 mTypeId;
if (mTypeId == 0x51) {
ItemSoundEffect* mOffset : u24 [[inline]];
} else if (mTypeId == 0x60) {
ItemSequence* mOffset : u24 [[inline]];
} else if (mTypeId == 0x70 || mTypeId == 0x71) {
ItemStream* mOffset : u24 [[inline]];
} else {
u24 mOffset;
}
};
struct TGroup {
u32 mNumItems;
padding[4];
SoundTableGroupEntry mEntries[mNumItems];
};
struct TSection {
u32 mNumGroups;
Offset<TGroup> mGroupOffsets[mNumGroups];
};
struct Root {
u32 mSectionNumber;
Offset<TSection> mSectionOffsets[mSectionNumber];
};
struct THeader {
type::Magic<"BST "> mMagic;
padding[8];
Root* mRoot : u32;
};
THeader header @ 0x0;
+228
View File
@@ -0,0 +1,228 @@
#pragma endian big
#include "std/sys.pat"
#include "type/magic.pat"
#include "std/array.pat"
/*
WSYS file
The WSYS file contains roughly two sections: WBCT and WINF.
WBCT contains the mapping of Wave ID -> wave archives.
WINF are the wave archives themselves and their metadata.
*/
/**
* Wrapper for a file-global pointer that allows it to be stored in an array.
*/
struct Offset<T> {
T* offset : u32 [[inline]];
};
/**
* Format that audio data is in..
*/
enum WaveFormat : u8 {
/**
* 16-samples-per-9-bytes custom Nintendo ADPCM.
*/
ADPCM4 = 0,
/**
* 16-samples-per-5-bytes custom Nintendo ADPCM.
*/
ADPCM2 = 1,
/**
* 8-bit-per-sample PCM.
*/
PCM8 = 2,
/**
* 16-bit-per-sample PCM.
*/
PCM16 = 3,
};
/**
* Defines playback info for a single audio "wave".
* This data is stored per archive, making it duplicated (except for mAWOffsetStart)
*/
struct TWave {
padding[1]; // unknown
WaveFormat mWaveFormat;
/**
* Key (as in like, the musical term) this sample is in.
*/
u8 mBaseKey;
padding[1];
/**
* Sample rate of the audio in Hz.
*/
float mSampleRate;
/**
* Position where the sample data starts.
* This is in the .aw file for the archive containing this TWave.
*/
u32 mAWOffsetStart;
/**
* Byte length of the sample data.
*/
u32 mAWLength;
/**
* Indicates whether the sample should loop or not. All bits appear set if so.
*/
u32 mLoopFlags;
/**
* Audio sample at which the loop starts.
*/
u32 mLoopStartSample;
/**
* Audio sample at which the loop ends (and goes back to mLoopStartSample).
*/
u32 mLoopEndSample;
/**
* Total sample count in this wave.
*/
u32 mSampleCount;
/**
* Last sample for continuing ADPCM decode after loop.
*/
s16 mpLast;
/**
* Penult sample for continuing ADPCM decode after loop.
*/
s16 mpPenult;
};
/**
* A single wave archive on disk.
* These are paired 1:1 with TCtrlScene objects.
*/
struct TWaveArchive {
/**
* Filename of the raw sample data on disc. Relative to /Audiores/Waves/
*/
char mFileName[0x70];
/**
* Amount of waves in this archive.
* Matches the count in the paired TCtrl object.
*/
u32 mWaveCount;
/**
* Offsets to the wave metadata (not sample data) in the WSYS.
* These are paired 1:1 to the TCtrlWaves, and the TCtrlWave contains the actual
* "Wave ID" used by the game for lookups.
*/
Offset<TWave> waveOffsets[mWaveCount];
};
/**
* Header containing data for wave archives and their metadata.
*/
struct TWaveArchiveBank {
type::Magic<"WINF"> mMagic;
/**
* Amount of archives in this wave bank.
* Matches the value in TCtrlGroup.
*/
u32 mArchiveCounts;
Offset<TWaveArchive> mArchiveOffsets[mArchiveCounts];
};
/**
* Definition for a single wave in a control group.
*/
struct TCtrlWave {
/**
* Group ID matches the index of the control group this item is referenced by.
*/
u16 mGroupId;
/**
* Wave ID used by the game to look this wave up.
*/
u16 mWaveId;
};
/**
* Contains the actual data for a TCtrlScene.
* Why is this separate? Who knows.
*/
struct TCtrl {
// Other versions of this struct with different magic (C-EX and C-ST) also exist in the file.
// They aren't pointed to so we don't need to worry about them.
type::Magic<"C-DF"> mMagic;
/**
* Amount of waves in this group.
* Matches the value in TWaveArchive.
*/
u32 waveCount;
Offset<TCtrlWave> mWaveOffsets[waveCount];
};
/**
* A single scene or "group" of waves that are loaded at once.
*/
struct TCtrlScene {
type::Magic<"SCNE"> mMagic;
padding[8]; // unknown
TCtrl* mCtrlOffset : u32 [[inline]];
};
/**
* Contains the "control" section of the WSYS.
*/
struct TCtrlGroup {
type::Magic<"WBCT"> mMagic;
padding[4]; // unknown
u32 mGroupCount;
Offset<TCtrlScene> mCtrlSceneOffsets[mGroupCount];
};
struct THeader {
type::Magic<"WSYS"> mMagic;
/**
* Size of WSYS in bytes.
*/
u32 mSize;
/**
* ID of wave bank.
* This matches the value passed to the BAA load command.
* The game originally does not use this value itself, but Dusklight does rely on it.
*/
u32 mId;
/**
* Total amount of waves in this wave bank.
* (not groups! Waves!)
*/
u32 mWaveTableSize;
TWaveArchiveBank* archiveBankOffset : u32;
TCtrlGroup* ctrlGroupOffset : u32;
};
THeader header @ 0x0;
std::assert(
header.archiveBankOffset.mArchiveCounts == header.ctrlGroupOffset.mGroupCount,
"Control group and archive count does not match!");
+241
View File
@@ -0,0 +1,241 @@
# JAudio
**JAudio** is the name for the audio engine used by Twilight Princess (along with many other Nintendo games from the era). TP uses exclusively JAudio v2, while other games use v1 or a mix of v1 and v2 infrastructure. This document will primarily focus on TP's use case, but best efforts will be made to document where behavior is TP-specific.
## Common concepts
Audio is almost exclusively
### `JAISoundID`
A "sound", be that a _sound effect_ or music, is referenced in-code through the `JAISoundID` type. This is a `u32` that the game uses to look up the relevant sound. The actual value is bitpacked (BE) from the following fields:
| Type | Field | Description |
|-------|------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `u8` | Section ID | Section of the Sound Table this sound effect is located in. 0 for sound effects, 1 for sequenced music, 2 for streamed music.[^sectionids] |
| `u8` | Group ID | ID of group further used to organize inside the Sound Table's Section. Sound effects are grouped into things like "SYSTEM" and "ENEMY", other sections leave this at 0. |
| `u16` | "Wave ID" | Index inside the group to look up the sound at.<br/>**Note** that the term "wave" in code is extremely confusing[^waveterm]; it does **not** refer to audio samples ("waves") in the wave banks directly. |
[^sectionids]: JAudio itself can seemingly work outside this convention, however it is enforced by some TP-specific game code.
[^waveterm]: Possibly vestigial from JAudio v1, where I believe there were less layers of indirection.
## Disc files
All audio data is stored in `/Audiores` on the disc. Files are as follows:
### `/Audiores/Seqs/Z2SoundSeqs.arc`
Contains the BMS instructions for all BMS-based music. Not all data is kept in memory at once.
### `/Audiores/Stream/*.ast`
Contains individual streamed music. Each file is a separate music track. See [this page](https://www.lumasworkshop.com/wiki/AST_(File_Format)) for file format description.
### `/Audiores/Waves/*.aw`
Contains audio sample data for sequenced music and sound effects. These files are pure meat, no bone: they are loaded directly into ARAM and all metadata is stored in the BAA WSYS sections.
Each file contains audio samples for one "scene", with factors like the current level determining what "scenes" are made resident in memory. There is tons of duplicate data between scenes, presumably to increase simplicity and loading performance.
### `/Audiores/Z2Sound.baa`
Contains all remaining metadata for the audio system. This is effectively a container for a bunch of different sub-sections. The file starts with a bunch of "commands" that indicate where other data in the file is. Each command has a 4-character identifier and depending on the command will be followed by some extra arguments before the next command.
The commands used by TP's BAA file are as follows (note that the decompiled code has support for more load commands, which are unused):
| Command/Argument | Value | Description |
|------------------|-----------------|-------------------------------------------------------------------------------------------------------------------------------------------|
| Command | `AA_<` | Start of BAA commands. Must be at the start of the file and only appear once. |
| Command | `>_AA` | End of BAA commands. |
| Command | `ws `[^spaces] | Wave bank/WSYS data. Defines where audio samples are located on disc. |
| Argument | u32 | Wave bank ID, max 255. In TP, 0 is sound effects, 1 is music samples. |
| Argument | u32 | File offset for start of `WSYS` data |
| Argument | u32 | Bit field selecting which groups (= `.aw` files) to load immediately. TP leaves this at zero.[^32ws] |
| Command | `bnk `[^spaces] | Instrument bank/IBNK |
| Argument | u32 | Target wave bank ID |
| Argument | u32 | File offset for start of `IBNK` data |
| Command | `bsc `[^spaces] | Sound effect sequence collection. |
| Argument | u32 | File offset for start of `SC` data. |
| Argument | u32 | File offset for end of `SC` data. |
| Command | `bst `[^spaces] | Sound table. Defines parameters for music and sound effects. |
| Argument | u32 | File offset for start of `BST `[^spaces] data. |
| Argument | u32 | File offset for end of `BST `[^spaces] data. |
| Command | `bstn` | Sound name table. Defines names of all music and sound effects. Present on disc, but loading is disabled on release versions of the game. |
| Argument | u32 | File offset for start of `BSTN` data. |
| Argument | u32 | File offset for end of `BSTN` data. |
| Command | `bfca` | Unknown, something related to initialization of DSP FX data. |
| Argument | u32 | File offset for start of `RARC` data. |
[^spaces]: Padded with spaces.
[^32ws]: Both of TP's wave banks have far more than 32 groups, and seemingly this mechanism would not be able to deal with that.
Following is data descriptions for the remaining data in the `.BAA`, as pointed to by the above commands.
### `WSYS` / Wave banks
`WSYS` / Wave bank data defines where a set of audio samples can be found on disc. Each wave bank is made of multiple "groups", where each group corresponds to one `.aw` file on disc. Each group has a set of "wave IDs" it contains, along with the metadata (e.g. sample rate) and data offset in the `.aw` file.
Multiple groups can contain the same wave ID, thus meaning the raw audio samples can be duplicated on disk.
*Relevant classes: `JASWSParser`, `JASBasicWaveBank`, `JASSimpleWaveBank`.* For the actual binary layout of this data, check [the ImHex pattern](imhex/jaudio/wsys.hexpat)
### `BST ` / Sound Table
The `BST` / Sound table defines various parameters for music and sound effect playback.
The layout is pretty simple: it's hierarchical with sections (sound effects, music sequences, streamed music)[^sectionids],
which have groups (only sound effects use this) and each group just has a flat list of items.
These indices match directly to the fields of the `JAISoundID`.
*Relevant classes: `JAUSoundTable`.* For the actual binary layout of this data, check [the ImHex pattern](imhex/jaudio/bst.hexpat)
Each item has a Type ID and a set of data. Types used by TP are as follows:
#### `0x51` / sound effect
Defines that this is a sound effect. The actual BMS code to execute (and unlike the other types, including its location) is looked up in the BSC.
Layout:
```
u8 mPriority; // Priority relative to other sound effects.
u8 mVolume; // Converted to float: mVolume * (1.0/127.0)
padding[2];
u32 mSwBit; // See below.
float mPitch; // Pitch multiplier
```
```cpp
// Values for mSwBit on sound effect items. (taken from JAUSoundTable.h)
/**
* Sound is always calculated as max priority (0).
*/
#define SOUND_SW_ALWAYS_MAX_PRIORITY 0x0000'0001
/**
* Don't calculate volume by distance.
*/
#define SOUND_SW_IGNORE_DISTANCE_VOL 0x0000'0002
/**
* Don't calculate FX mix (reverb) by distance.
*/
#define SOUND_SW_IGNORE_FX_MIX 0x0000'0004
/**
* Mute all BGM sequences while this sound is playing.
*/
#define SOUND_SW_MUTE_BGM 0x0000'0008
/**
* Offset to shift to access @see SOUND_SW_RANDOM_PITCH_MASK
*/
#define SOUND_SW_RANDOM_PITCH_OFFSET 4
/**
* 4-bit value (0-15) to control the power of pitch randomization on sound playback.
* Code acts different for values above 8, not sure what the exact implication is.
*/
#define SOUND_SW_RANDOM_PITCH_MASK 0x0000'00F0
/**
* Offset to shift to access @see SOUND_SW_DOPPLER_POWER_MASK
*/
#define SOUND_SW_DOPPLER_POWER_OFFSET 8
/**
* 4-bit value (0-15) to scale the power of the Doppler effect for this sound.
*/
#define SOUND_SW_DOPPLER_POWER_MASK 0x0000'0F00
/**
* Don't calculate panning (left/right) values for this sound.
*/
#define SOUND_SW_IGNORE_PAN 0x0000'1000
/**
* Don't calculate Dolby (behind/front) values for this sound.
*/
#define SOUND_SW_IGNORE_DOLBY 0x0000'2000
/**
* Unsure. Relates to Z2 pooling of sound handles.
*/
#define SOUND_SW_POOL_FLAG_1 0x0000'4000
/**
* Unsure. Relates to Z2 pooling of sound handles.
*/
#define SOUND_SW_POOL_FLAG_2 0x0000'8000
/**
* 3-bit mask used to select a volume distance/falloff class for this sound.
*/
#define SOUND_SW_VOL_DIST_BIT_MASK 0x0007'0000
#define SOUND_SW_VOL_DIST_BIT_OFFSET 16
/**
* Limit minimum volume of this sound (after distance falloff) to 0.2.
*/
#define SOUND_SW_CLAMP_MIN_VOLUME 0x0008'0000
/**
* 3-bit mask used to select a *different* volume distance/falloff class for this sound.
* @see SOUND_SW_VOL_DIST_BIT_MASK must be zero for this to work.
*/
#define SOUND_SW_VOL_DIST_BIT_2_MASK 0x0070'0000
#define SOUND_SW_VOL_DIST_BIT_2_OFFSET 20
/**
* Mark sound as "far away" or "culled" when at max distance (selected by distance class).
* This affects a bunch of stuff like culling, automatic stopping, priorities, etc.
*/
#define SOUND_SW_CULL_AT_MAX_DISTANCE 0x0080'0000
/**
* Not sure what this does.
* Something causing volume/pan/dolby adjustment in Z2Audible::setOuterParams?
*/
#define SOUND_SW_VOL_SOMETHING_MASK 0x0F00'0000
/**
* Offset to shift to access @see SOUND_SW_RANDOM_VOLUME_MASK
*/
#define SOUND_SW_RANDOM_VOLUME_OFFSET 28
/**
* 4-bit value (0-15) to control the power of volume randomization on sound playback.
*/
#define SOUND_SW_RANDOM_VOLUME_MASK 0xF000'0000
```
#### `0x60` / music sequence
Defines background music that plays through the BMS system.
```
u8 mPriority;
u8 mVolume; // Converted to float: mVolume * (1.0/127.0)
u16 mResourceId; // ID to look up in Z2SoundSeqs.arc
```
#### `0x70` / `0x71` / music sequence
Defines a streamed music track. Difference between `0x70` and `0x71` seems to only be that `0x71` stops automatically
on scene changes in TP's game code.
```
u8 mPriority;
u8 mVolume; // Converted to float: mVolume * (1.0/127.0)
u16 mStreamPanParameters; // Bitpacked, two bits per channel determining whether a channel is center (01), left (10), or right (11).
char* mStreamFilePath[] : u32; // File path to the .ast on disc.
```
## Further reading & credits
* https://www.lumasworkshop.com/wiki/SMR.szs (note that details like the exact layout of the BAA are not the same as TP)
* XAYRGA for doing much RE work and making [JAMTools](https://xayr.gay/tools/SoundModdingToolkit/)
* The decompiled source code, duh.
+30 -11
View File
@@ -852,8 +852,9 @@ per-window RCSS. A non-`MOD_OK` result from `build`/`update` fails your mod, as
callback.
**Controls:** `pane_add_control` adds an input row described by a `UiControlDesc`: `UI_CONTROL_BUTTON`,
`UI_CONTROL_GROUP`, `UI_CONTROL_TOGGLE`, `UI_CONTROL_NUMBER`, `UI_CONTROL_STRING`, `UI_CONTROL_SELECT`, or
`UI_CONTROL_COLOR`. Values bind with callbacks or directly to a config var.
`UI_CONTROL_GROUP`, `UI_CONTROL_TOGGLE`, `UI_CONTROL_NUMBER`, `UI_CONTROL_STRING`, `UI_CONTROL_SELECT`,
`UI_CONTROL_COLOR`, `UI_CONTROL_FILE_PICKER`, `UI_CONTROL_ICON_BUTTON`, or `UI_CONTROL_DROPDOWN`. Bind values with
callbacks or directly to a config var.
```cpp
UiControlDesc control = UI_CONTROL_DESC_INIT;
@@ -862,18 +863,32 @@ control.label = "Enable rainbows";
control.help_rml = "Shown in the help pane while focused.";
control.binding = UI_BINDING_CONFIG_VAR;
control.config_var = myBoolVar; // from svc_config->register_var
svc_ui->pane_add_control(mod_ctx, leftPane, &control, nullptr);
svc_ui->pane_add_control(mod_ctx, pane, &control, nullptr);
UiRowDesc rowDesc = UI_ROW_DESC_INIT;
rowDesc.align = UI_ROW_ALIGN_CENTER;
UiElementHandle row = 0;
svc_ui->pane_add_row(mod_ctx, pane, &rowDesc, &row);
UiControlDesc play = UI_CONTROL_DESC_INIT;
play.kind = UI_CONTROL_ICON_BUTTON;
play.icon = "play_arrow";
play.label = "Play";
play.on_pressed = play_track;
svc_ui->pane_add_control(mod_ctx, row, &play, nullptr);
```
`UI_BINDING_CONFIG_VAR` wires persistence, change notifications, and the modified indicator automatically. The var
type must match the control: `TOGGLE` = bool, `NUMBER` and `SELECT` = int, `STRING` and `COLOR` = string. Float vars
are not bindable; use callbacks and convert. `help_rml` and `SELECT` option lists render in a help pane, so `SELECT`
controls are only available inside window tabs.
type must match the control: `TOGGLE` = bool, `NUMBER`, `SELECT`, and `DROPDOWN` = int, `STRING`, `COLOR`, and
`FILE_PICKER` = string. Float vars are not bindable; use callbacks and convert. `help_rml` and `SELECT` option lists
render in a help pane, so `SELECT` controls are only available inside window tabs.
`pane_add_group` adds a category button to a window tab's left pane. Focusing the button clears the paired right pane
and calls the group's build callback with that pane, which is useful for organizing related controls without adding
more tabs.
`pane_add_row` adds a horizontal container that other controls may be nested inside.
**Lists:** `pane_add_list` adds a scrollable virtualized list of items that can be efficiently updated and filtered.
Keys must be unique and remain stable across replacements.
@@ -1371,12 +1386,16 @@ HookshotHit::g_orig(link, atObjInf, target, tgObjInf); // call through to the o
Class member functions must include `Class*` as the first argument.
Two spellings work on every platform:
There are three ways to refer to a function by symbol:
- **Display names** (`daAlink_c::posMove`, `fapGm_Before`): the qualified name with no parameter list. They carry no
signature, so overload sets (and file-local statics sharing a name) return `MOD_CONFLICT`.
- **Decorated names** (`_ZN9daAlink_c7posMoveEv` / `?posMove@daAlink_c@@...`): the platform's mangled spelling in
dlsym convention (no Mach-O leading underscore). The escape hatch for overloads.
- **Display names** (`daAlink_c::posMove`, `fapGm_Before`): the qualified name with no parameter list. Since they have
no signature, overloads (and file-local statics sharing a name) return `MOD_CONFLICT`.
- **Decorated names** (`_ZN9daAlink_c7posMoveEv` / `?posMove@daAlink_c@@...`): the platform's mangled name, like you'd
pass to dlsym(). Useful for overloads, but must be specified separately for Windows (`#ifdef _MSVC_LANG`) and other
platforms.
- **Translation unit aliases** (`src/d/actor/d_a_b_gnd.cpp#action`): the source path relative to the repository root,
followed by `#` and then the function display name without parameters. This allows disambiguating static functions
with the same name across different source files.
Installing fails with `MOD_UNAVAILABLE` when it didn't resolve (missing, ambiguous, or no symbol manifest). Unlike
`DEFINE_HOOK`, the signature is **not** compiler-checked: a mismatched signature will corrupt the
+1 -1
+60 -2
View File
@@ -1422,6 +1422,8 @@ set(DUSK_FILES
src/dusk/achievements.cpp
src/dusk/action_bindings.cpp
src/dusk/action_bindings.h
src/dusk/archive.cpp
src/dusk/archive.hpp
src/dusk/asserts.cpp
src/dusk/autosave.cpp
src/dusk/config.cpp
@@ -1432,10 +1434,10 @@ set(DUSK_FILES
src/dusk/dvd_asset.cpp
src/dusk/dvd_asset.hpp
src/dusk/extras.c
src/dusk/frame_interpolation.cpp
src/dusk/commands.cpp
src/dusk/commands.hpp
src/dusk/game_clock.cpp
src/dusk/hash.hpp
src/dusk/game_mode.cpp
src/dusk/gamepad_color.cpp
src/dusk/globals.cpp
@@ -1462,6 +1464,13 @@ set(DUSK_FILES
src/dusk/imgui/ImGuiStateShare.cpp
src/dusk/imgui/ImGuiStateShare.hpp
src/dusk/imgui/ImGuiStubLog.cpp
src/dusk/interp/camera.cpp
src/dusk/interp/frame_interpolation.cpp
src/dusk/interp/line.cpp
src/dusk/interp/material.cpp
src/dusk/interp/particle.cpp
src/dusk/interp/samples.cpp
src/dusk/interp/vertex.cpp
src/dusk/io.cpp
src/dusk/iso_validate.cpp
src/dusk/language.cpp
@@ -1478,10 +1487,23 @@ set(DUSK_FILES
src/dusk/mods/loader/depgraph.hpp
src/dusk/mods/loader/loader.cpp
src/dusk/mods/loader/loader.hpp
src/dusk/mods/loader/manifest.cpp
src/dusk/mods/loader/manifest.hpp
src/dusk/mods/loader/natives.cpp
src/dusk/mods/loader/natives.hpp
src/dusk/mods/loader/packages.cpp
src/dusk/mods/loader/packages.hpp
src/dusk/mods/loader/native_module.cpp
src/dusk/mods/loader/native_module.hpp
src/dusk/mods/loader/prepatch.cpp
src/dusk/mods/loader/prepatch.hpp
src/dusk/mods/updates.cpp
src/dusk/mods/updates.hpp
src/dusk/mods/catalog.cpp
src/dusk/mods/catalog.hpp
src/dusk/mods/queue.cpp
src/dusk/mods/queue.hpp
src/dusk/mods/services.hpp
src/dusk/mods/item.hpp
src/dusk/mods/item_actor.cpp
src/dusk/mods/item_checks.cpp
@@ -1491,6 +1513,14 @@ set(DUSK_FILES
src/dusk/mods/manifest.cpp
src/dusk/mods/manifest.hpp
src/dusk/mods/svc/actor.cpp
src/dusk/mods/svc/audio_res/audio_res.hpp
src/dusk/mods/svc/audio_res/audio_res.cpp
src/dusk/mods/svc/audio_res/bst.cpp
src/dusk/mods/svc/audio_res/bst.hpp
src/dusk/mods/svc/audio_res/wsys.cpp
src/dusk/mods/svc/audio_res/wsys.hpp
src/dusk/mods/svc/audio_res/wave.cpp
src/dusk/mods/svc/audio_res/opus.cpp
src/dusk/mods/svc/camera.cpp
src/dusk/mods/svc/config.cpp
src/dusk/mods/svc/config.hpp
@@ -1506,6 +1536,8 @@ set(DUSK_FILES
src/dusk/mods/svc/websocket.cpp
src/dusk/mods/svc/item.cpp
src/dusk/mods/svc/item.hpp
src/dusk/mods/svc/id_allocator.cpp
src/dusk/mods/svc/id_allocator.hpp
src/dusk/mods/svc/log.cpp
src/dusk/mods/svc/overlay.cpp
src/dusk/mods/svc/registry.cpp
@@ -1539,6 +1571,8 @@ set(DUSK_FILES
src/dusk/ui/bool_button.hpp
src/dusk/ui/button.cpp
src/dusk/ui/button.hpp
src/dusk/ui/clamped_text.cpp
src/dusk/ui/clamped_text.hpp
src/dusk/ui/color_input.cpp
src/dusk/ui/color_input.hpp
src/dusk/ui/component.cpp
@@ -1548,6 +1582,10 @@ set(DUSK_FILES
src/dusk/ui/controls.hpp
src/dusk/ui/document.cpp
src/dusk/ui/document.hpp
src/dusk/ui/drop_install_modal.cpp
src/dusk/ui/drop_install_modal.hpp
src/dusk/ui/dropdown_button.cpp
src/dusk/ui/dropdown_button.hpp
src/dusk/ui/editor.cpp
src/dusk/ui/editor.hpp
src/dusk/ui/event.cpp
@@ -1568,21 +1606,41 @@ set(DUSK_FILES
src/dusk/ui/list.hpp
src/dusk/ui/menu_bar.cpp
src/dusk/ui/menu_bar.hpp
src/dusk/ui/mod_browser.cpp
src/dusk/ui/mod_browser.hpp
src/dusk/ui/online_mods.cpp
src/dusk/ui/online_mods.hpp
src/dusk/ui/package_row.cpp
src/dusk/ui/package_row.hpp
src/dusk/ui/mod_texture_provider.cpp
src/dusk/ui/mod_texture_provider.hpp
src/dusk/ui/remote_texture_provider.cpp
src/dusk/ui/remote_texture_provider.hpp
src/dusk/ui/runtime_image.cpp
src/dusk/ui/runtime_image.hpp
src/dusk/ui/mod_window.cpp
src/dusk/ui/mod_window.hpp
src/dusk/ui/modal.cpp
src/dusk/ui/modal.hpp
src/dusk/ui/mod_updates.cpp
src/dusk/ui/mod_updates.hpp
src/dusk/ui/mods_window.cpp
src/dusk/ui/mods_window.hpp
src/dusk/ui/nav_types.hpp
src/dusk/ui/nav_group.cpp
src/dusk/ui/nav_group.hpp
src/dusk/ui/context_menu.cpp
src/dusk/ui/context_menu.hpp
src/dusk/ui/icon_button.cpp
src/dusk/ui/icon_button.hpp
src/dusk/ui/tooltip.cpp
src/dusk/ui/tooltip.hpp
src/dusk/ui/number_button.cpp
src/dusk/ui/number_button.hpp
src/dusk/ui/overlay.cpp
src/dusk/ui/overlay.hpp
src/dusk/ui/row.cpp
src/dusk/ui/row.hpp
src/dusk/ui/pane.cpp
src/dusk/ui/pane.hpp
src/dusk/ui/popover.cpp
@@ -1616,7 +1674,7 @@ set(DUSK_FILES
src/dusk/version.cpp
src/dusk/utilities.cpp
src/helpers/batch.cpp
src/helpers/endian.cpp
src/helpers/offset_ptr.cpp
src/helpers/string.cpp
src/helpers/cast.cpp
)
+85 -45
View File
@@ -9,6 +9,8 @@
#include "JSystem/JAudio2/JAUAudibleParam.h"
#include "JSystem/TPosition3.h"
#define Z2_AUDIO_PLAYERS 1
struct Z2Audible;
struct Z2AudibleAbsPos {
@@ -49,10 +51,10 @@ struct Z2AudioCamera {
f32 getCamDist() const { return mCamDist; }
/* 0x00 */ JGeometry::TPosition3f32 field_0x0;
/* 0x00 */ JGeometry::TPosition3f32 mViewMatrix;
/* 0x30 */ JGeometry::TVec3<f32> mVel;
/* 0x3C */ JGeometry::TVec3<f32> mPos;
/* 0x48 */ JGeometry::TVec3<f32> field_0x48;
/* 0x48 */ JGeometry::TVec3<f32> mLastPos;
/* 0x54 */ f32 mFovySin;
/* 0x58 */ f32 mVolCenterZ;
/* 0x5C */ f32 mTargetVolume;
@@ -83,14 +85,14 @@ struct Z2SpotMic {
/* 0x04 */ f32 field_0x4;
/* 0x08 */ f32 field_0x8;
/* 0x0C */ f32 field_0xc;
/* 0x10 */ Z2AudioCamera* field_0x10[1];
/* 0x10 */ Z2AudioCamera* field_0x10[Z2_AUDIO_PLAYERS];
/* 0x14 */ Vec* mPosPtr;
/* 0x18 */ f32 field_0x18[1];
/* 0x18 */ f32 field_0x18[Z2_AUDIO_PLAYERS];
/* 0x1C */ f32 field_0x1c;
/* 0x20 */ f32 field_0x20[1];
/* 0x20 */ f32 field_0x20[Z2_AUDIO_PLAYERS];
/* 0x24 */ bool mIgnoreIfOut;
/* 0x25 */ bool mMicOn;
/* 0x26 */ bool field_0x26[1];
/* 0x26 */ bool field_0x26[Z2_AUDIO_PLAYERS];
}; // Size: 0x28
struct Z2Audience3DSetting {
@@ -102,62 +104,99 @@ struct Z2Audience3DSetting {
void updateDolbyDist(f32, f32);
void calcVolumeFactorAll() {
field_0x0[1] = 1.25f * field_0x0[0];
field_0x0[2] = 1.5f * field_0x0[0];
field_0x0[3] = 2.0f * field_0x0[0];
field_0x0[4] = 3.0f * field_0x0[0];
field_0x0[5] = 4.0f * field_0x0[0];
field_0x0[6] = 6.0f * field_0x0[0];
field_0x0[7] = 8.0f * field_0x0[0];
field_0x0[8] = 0.9f * field_0x0[0];
field_0x0[9] = 0.8f * field_0x0[0];
field_0x0[10] = 0.7f * field_0x0[0];
field_0x0[11] = 0.6f * field_0x0[0];
field_0x0[12] = 0.5f * field_0x0[0];
field_0x0[13] = 0.4f * field_0x0[0];
field_0x0[14] = 0.3f * field_0x0[0];
mDistanceMaxes[1] = 1.25f * mDistanceMaxes[0];
mDistanceMaxes[2] = 1.5f * mDistanceMaxes[0];
mDistanceMaxes[3] = 2.0f * mDistanceMaxes[0];
mDistanceMaxes[4] = 3.0f * mDistanceMaxes[0];
mDistanceMaxes[5] = 4.0f * mDistanceMaxes[0];
mDistanceMaxes[6] = 6.0f * mDistanceMaxes[0];
mDistanceMaxes[7] = 8.0f * mDistanceMaxes[0];
mDistanceMaxes[8] = 0.9f * mDistanceMaxes[0];
mDistanceMaxes[9] = 0.8f * mDistanceMaxes[0];
mDistanceMaxes[10] = 0.7f * mDistanceMaxes[0];
mDistanceMaxes[11] = 0.6f * mDistanceMaxes[0];
mDistanceMaxes[12] = 0.5f * mDistanceMaxes[0];
mDistanceMaxes[13] = 0.4f * mDistanceMaxes[0];
mDistanceMaxes[14] = 0.3f * mDistanceMaxes[0];
for (int i = 0; i < 15; i++) {
field_0x70[i] = (field_0x40 - 1.0f) / (field_0x0[i] - field_0x3c);
mVolumeFactor[i] = (mMinDistanceVolume - 1.0f) / (mDistanceMaxes[i] - mMaxVolumeDistance);
}
}
void calcPriorityFactorAll() {
for (int i = 0; i < 15; i++) {
field_0xac[i] = field_0x64 / (field_0x0[i] - field_0x3c);
mPriorityFactor[i] = mMaxDistancePriority / (mDistanceMaxes[i] - mMaxVolumeDistance);
}
}
void calcFxMixFactorAll() {
for (int i = 0; i < 15; i++) {
field_0xe8[i] = (field_0x54 - field_0x50) / (field_0x0[i] - field_0x3c);
mFxMixFactor[i] = (mMaxDistanceFxMix - mMinDistanceFxMix) / (mDistanceMaxes[i] - mMaxVolumeDistance);
}
}
/* 0x000 */ f32 field_0x0[15];
/* 0x03C */ f32 field_0x3c;
/* 0x040 */ f32 field_0x40;
/* 0x044 */ f32 field_0x44;
/* 0x048 */ f32 field_0x48;
/* 0x04C */ f32 field_0x4c;
/* 0x050 */ f32 field_0x50;
/* 0x054 */ f32 field_0x54;
/* 0x058 */ f32 field_0x58;
/* 0x05C */ f32 field_0x5c;
/**
* Maximum distance a sound can reach before being "far away"
* Being far away affects stuff like culling, lowering its priority, forcibly stopping it, etc.
* Sounds select which entry they use based on their VolBits.
*/
/* 0x000 */ f32 mDistanceMaxes[15];
/**
* Distance at which the max volume of a sound is reached.
* i.e. sounds do *not* get louder if they get closer than this.
*/
/* 0x03C */ f32 mMaxVolumeDistance;
/**
* FX Mix value at maximum distance (@ref mDistanceMaxes)
*/
/* 0x040 */ f32 mMinDistanceVolume;
/* 0x044 */ f32 mDolbyFrontDistanceMax;
/* 0x048 */ f32 mDolbyBehindDistanceMax;
/* 0x04C */ f32 mDolbyCenterValue;
/**
* FX Mix value at minimum distance (@ref mMaxVolumeDistance)
*/
/* 0x050 */ f32 mMinDistanceFxMix;
/**
* FX Mix value at maximum distance (@ref mDistanceMaxes)
*/
/* 0x054 */ f32 mMaxDistanceFxMix;
/* 0x058 */ f32 mPanFactor;
/* 0x05C */ f32 mSonicSpeed; // Used for doppler effect calculations.
/* 0x060 */ f32 field_0x60;
/* 0x064 */ u32 field_0x64;
/**
* Priority that sounds receive when "far away".
* @see mDistanceMaxes
*/
/* 0x064 */ u32 mMaxDistancePriority;
/* 0x068 */ f32 field_0x68;
/* 0x06C */ f32 field_0x6c;
/* 0x070 */ f32 field_0x70[15];
/* 0x0AC */ f32 field_0xac[15];
/* 0x0E8 */ f32 field_0xe8[15];
/* 0x070 */ f32 mVolumeFactor[15];
/* 0x0AC */ f32 mPriorityFactor[15];
/* 0x0E8 */ f32 mFxMixFactor[15];
/* 0x124 */ bool mVolumeDistInit;
/* 0x125 */ bool mDolbyDistInit;
}; // Size: 0x128
struct Z2AudibleRelPos {
/* 0x00 */ JGeometry::TVec3<f32> field_0x00;
/* 0x0C */ f32 field_0xC;
/* 0x10 */ f32 field_0x10;
/* 0x00 */ JGeometry::TVec3<f32> mCameraRelative;
/**
* Distance from mCameraRelative. This is from the object root and not the
* exact distance used for volume/priority calculations.
*/
/* 0x0C */ f32 mTrueDistance;
/**
* Distance from mCameraRelative but offset by mVolCenterZ.
* This presumably means the distance is more centered on the object than mTrueDistance.
*/
/* 0x10 */ f32 mCenterDistance;
};
struct Z2AudibleChannel {
@@ -171,7 +210,7 @@ struct Z2AudibleChannel {
}
/* 0x00 */ JASSoundParams mParams;
/* 0x14 */ Z2AudibleRelPos field_0x14;
/* 0x14 */ Z2AudibleRelPos mRelPos;
/* 0x28 */ f32 field_0x28;
/* 0x2c */ f32 mPan;
/* 0x30 */ f32 mDolby;
@@ -200,8 +239,8 @@ struct Z2Audible : public JAIAudible, public JASPoolAllocObject<Z2Audible> {
/* 0x10 */ JAUAudibleParam mParam;
/* 0x14 */ Z2AudibleAbsPos mAbsPos;
/* 0x2C */ Z2AudibleChannel mChannel[1];
/* 0x64 */ f32 field_0x64[1];
/* 0x2C */ Z2AudibleChannel mChannel[Z2_AUDIO_PLAYERS];
/* 0x64 */ f32 mMicDistances[Z2_AUDIO_PLAYERS];
};
struct Z2Audience : public JAIAudience, public JASGlobalInstance<Z2Audience> {
@@ -223,7 +262,8 @@ struct Z2Audience : public JAIAudience, public JASGlobalInstance<Z2Audience> {
virtual ~Z2Audience();
virtual JAIAudible* newAudible(const JGeometry::TVec3<f32>& pos, JAISoundID soundID,
const JGeometry::TVec3<f32>*, u32);
const JGeometry::TVec3<f32>*, u32
IF_DUSK_ARG(dusk::mods::svc::audio_res::bst::SoundTableReplacementSlot const*));
virtual int getMaxChannels();
virtual void deleteAudible(JAIAudible* audible);
virtual u32 calcPriority(JAIAudible* audible);
@@ -237,7 +277,7 @@ struct Z2Audience : public JAIAudience, public JASGlobalInstance<Z2Audience> {
}
Z2Audience3DSetting* getSetting() { return &mSetting; }
const Z2AudioCamera* getAudioCamera(int camID) const { return &mAudioCamera[camID]; }
const Z2AudioCamera* getAudioCamera(int camID) const { return &mAudioCamera[camID]; }
void setUsingOffMicVol(bool value) { mUsingOffMicVol = value; }
+14 -8
View File
@@ -6,23 +6,29 @@
#include "JSystem/JAudio2/JAUSoundInfo.h"
#include "JSystem/JAudio2/JAUSoundTable.h"
#define STRM_CH_SHIFT_ 2
#define STRM_CH_CENTER 1
#define STRM_CH_LEFT 2
#define STRM_CH_RIGHT 3
class Z2SoundInfo : public JAISoundInfo, public JAUSoundInfo, public JAIStreamDataMgr, public JASGlobalInstance<Z2SoundInfo> {
public:
Z2SoundInfo() : JAISoundInfo(true), JAUSoundInfo(true), JASGlobalInstance<Z2SoundInfo>(true) {}
virtual u16 getAudibleSw(JAISoundID soundID) const;
virtual u16 getAudibleSw(JAISoundID soundID IF_DUSK_ARG(SoundTableReplacementSlot const* replacement)) const;
virtual u16 getBgmSeqResourceID(JAISoundID soundID) const;
virtual s32 getStreamFileEntry(JAISoundID soundID);
virtual s32 getStreamFileEntry(JAISoundID soundID IF_DUSK_ARG(StreamReplacementSlot const* replacement));
virtual int getSoundType(JAISoundID soundID) const;
virtual int getCategory(JAISoundID soundID) const;
virtual u32 getPriority(JAISoundID soundID) const;
virtual void getSeInfo(JAISoundID soundID, JAISe* sePtr) const;
virtual u32 getPriority(JAISoundID soundID IF_DUSK_ARG(SoundTableReplacementSlot const* replacement)) const;
virtual void getSeInfo(JAISoundID soundID, JAISe* sePtr IF_DUSK_ARG(SoundEffectReplacementSlot const* replacement)) const;
virtual void getSeqInfo(JAISoundID soundID, JAISeq* seqPtr) const;
virtual void getStreamInfo(JAISoundID soundID, JAIStream* streamPtr) const;
virtual void getStreamInfo(JAISoundID soundID, JAIStream* streamPtr IF_DUSK_ARG(StreamReplacementSlot const* replacement)) const;
virtual ~Z2SoundInfo() {}
JAUAudibleParam getAudibleSwFull(JAISoundID soundID);
const char* getStreamFilePath(JAISoundID soundID);
int getSwBit(JAISoundID soundID) const;
JAUAudibleParam getAudibleSwFull(JAISoundID soundID IF_DUSK_ARG(SoundTableReplacementSlot const* replacement));
const char* getStreamFilePath(JAISoundID soundID IF_DUSK_ARG(StreamReplacementSlot const* replacement));
int getSwBit(JAISoundID soundID IF_DUSK_ARG(SoundTableReplacementSlot const* replacement)) const;
void getSoundInfo_(JAISoundID soundID, JAISound* soundPtr) const;
BOOL isValid() const {
+1 -1
View File
@@ -41,7 +41,7 @@ public:
/* 0x004 */ JAISeMgr seMgr_;
/* 0x728 */ JAISeqMgr seqMgr_;
/* 0x79C */ JAIStreamMgr streamMgr_;
/* 0x80C */ JAISoundID soundID_;
/* 0x80C */ JAISoundID bgmMuter;
}; // Size: 0x810
#if VERSION != VERSION_SHIELD_DEBUG
+4 -24
View File
@@ -124,7 +124,11 @@ public:
BOOL create();
void update();
virtual void draw();
#if TARGET_PC
virtual ~daAlink_lockCursor_c();
#else
virtual ~daAlink_lockCursor_c() {}
#endif
void initFrame() {
field_0x4 = 0;
@@ -4556,31 +4560,7 @@ public:
bool checkAimContext();
bool checkAimInputContext();
void onIronBallChainInterpCallback();
static const int IRON_BALL_CHAIN_COUNT = 102;
cXyz mIBChainInterpPrevPos[IRON_BALL_CHAIN_COUNT];
cXyz mIBChainInterpCurrPos[IRON_BALL_CHAIN_COUNT];
csXyz mIBChainInterpPrevAngle[IRON_BALL_CHAIN_COUNT];
csXyz mIBChainInterpCurrAngle[IRON_BALL_CHAIN_COUNT];
cXyz mIBChainInterpPrevHandRoot;
cXyz mIBChainInterpCurrHandRoot;
bool mIBChainInterpPrevValid;
bool mIBChainInterpCurrValid;
cXyz mHsChainInterpPrevTop;
cXyz mHsChainInterpCurrTop;
cXyz mHsChainInterpPrevRoot;
cXyz mHsChainInterpCurrRoot;
cXyz mHsChainInterpPrevSubRoot;
cXyz mHsChainInterpCurrSubRoot;
cXyz mHsChainInterpPrevSubTop;
cXyz mHsChainInterpCurrSubTop;
bool mHsChainInterpPrevValid;
bool mHsChainInterpCurrValid;
bool mIsRollstab = false;
void* mAnmBuffers[3] = {};
#endif
}; // Size: 0x385C
+3
View File
@@ -110,6 +110,9 @@ public:
/* 0x1CFC */ int field_0x1cfc;
/* 0x1D00 */ f32 mKankyoBlend;
/* 0x1D04 */ u8 mInitHIO;
#if TARGET_PC
s8 mDemoCamSyncTicks;
#endif
};
STATIC_ASSERT(sizeof(b_gm_class) == 0x1d08);
-6
View File
@@ -189,12 +189,6 @@ public:
/* 0x2740 */ u8 field_0x2740;
/* 0x2744 */ dMsgFlow_c mMsgFlow;
#if TARGET_PC
cXyz mReinsInterpPrev[2][16];
cXyz mReinsInterpCurr[2][16];
cXyz mReinsTexInterpPrev[2];
cXyz mReinsTexInterpCurr[2];
bool mReinsInterpPrevValid;
bool mReinsInterpCurrValid;
s8 mDemoCamSyncTicks;
#endif
};
+1 -1
View File
@@ -72,7 +72,7 @@ public:
struct ScoreCount {
cXyz field_0x0;
u16 field_0xc;
u8 field_0xe;
DUSK_IF_ELSE(f32, u8) field_0xe;
u8 field_0xf;
};
+4
View File
@@ -17,7 +17,11 @@ public:
void setSight(cXyz const*, int);
virtual void draw();
#if TARGET_PC
virtual ~daBoomerang_sight_c();
#else
virtual ~daBoomerang_sight_c() {}
#endif
u8 getReserve() const { return mReserve; }
u8 getAlpha(int i_index) { return m_alpha[i_index]; }
-6
View File
@@ -80,12 +80,6 @@ public:
/* 0x125C */ u32 field_0x125c;
/* 0x1260 */ u8 field_0x1260[0x126C - 0x1260];
/* 0x126C */ u8 HIOInit;
#if TARGET_PC
cXyz mStalkLineInterpPrev[12];
cXyz mStalkLineInterpCurr[12];
bool mStalkLineInterpPrevValid;
bool mStalkLineInterpCurrValid;
#endif
};
STATIC_ASSERT(sizeof(e_db_class) == 0x1270);
-6
View File
@@ -73,12 +73,6 @@ public:
/* 0x124C */ f32 field_0x124c;
/* 0x1250 */ u8 field_0x1250[0x1264 - 0x1250];
/* 0x1264 */ u8 HIOInit;
#if TARGET_PC
cXyz mStalkLineInterpPrev[12];
cXyz mStalkLineInterpCurr[12];
bool mStalkLineInterpPrevValid;
bool mStalkLineInterpCurrValid;
#endif
};
STATIC_ASSERT(sizeof(e_hb_class) == 0x1268);
-6
View File
@@ -44,12 +44,6 @@ public:
/* 0x88C */ u8 field_0x88C[0x8C8 - 0x88C];
/* 0x8C8 */ s8 field_0x8c8;
/* 0x8C9 */ u8 mInitHIO;
#if TARGET_PC
cXyz mRopeInterpPrev[16];
cXyz mRopeInterpCurr[16];
bool mRopeInterpPrevValid;
bool mRopeInterpCurrValid;
#endif
};
STATIC_ASSERT(sizeof(e_mb_class) == 0x8cc);
-9
View File
@@ -81,15 +81,6 @@ public:
/* 0x306D */ u8 field_0x306D[0x307C - 0x306D];
/* 0x307C */ u32 mBodyEffEmtrID;
/* 0x3080 */ u8 mInitHIO;
#if TARGET_PC
static const int HAIR_STRAND_COUNT = 22;
static const int HAIR_SEGMENT_COUNT = 16;
cXyz mHairInterpPrev[HAIR_STRAND_COUNT * HAIR_SEGMENT_COUNT];
cXyz mHairInterpCurr[HAIR_STRAND_COUNT * HAIR_SEGMENT_COUNT];
bool mHairInterpPrevValid;
bool mHairInterpCurrValid;
#endif
};
STATIC_ASSERT(sizeof(e_s1_class) == 0x3084);
-6
View File
@@ -221,12 +221,6 @@ public:
/* 0x17E4 */ u8 field_0x17e4[0x17e8 - 0x17e4];
/* 0x17E8 */ f32 ride_speed_max; ///< @brief Speed rate for riding calculations.
#if TARGET_PC
cXyz himo_mat_interp_prev[2][16];
cXyz himo_mat_interp_curr[2][16];
cXyz himo_tex_interp_prev[2];
cXyz himo_tex_interp_curr[2];
bool himo_interp_prev_valid;
bool himo_interp_curr_valid;
s8 demo_cam_sync_ticks;
#endif
};
-6
View File
@@ -74,12 +74,6 @@ public:
/* 0x1250 */ f32 field_0x1250;
/* 0x1254 */ u8 field_0x1254[0x1268 - 0x1254];
/* 0x1268 */ u8 field_0x1268;
#if TARGET_PC
cXyz mLineMatInterpPrev[12];
cXyz mLineMatInterpCurr[12];
bool mLineMatInterpPrevValid;
bool mLineMatInterpCurrValid;
#endif
};
STATIC_ASSERT(sizeof(e_yd_class) == 0x126c);
-9
View File
@@ -63,15 +63,6 @@ public:
/* 0x0BB4 */ yg_ke_s mYgKes[13];
/* 0x1880 */ mDoExt_3DlineMat0_c mLineMat;
/* 0x189C */ u8 mIsFirstSpawn;
#if TARGET_PC
static const int TENTACLE_STRAND_COUNT = 13;
static const int TENTACLE_SEGMENT_COUNT = 10;
cXyz mTentacleInterpPrev[TENTACLE_STRAND_COUNT * TENTACLE_SEGMENT_COUNT];
cXyz mTentacleInterpCurr[TENTACLE_STRAND_COUNT * TENTACLE_SEGMENT_COUNT];
bool mTentacleInterpPrevValid;
bool mTentacleInterpCurrValid;
#endif
};
STATIC_ASSERT(sizeof(e_yg_class) == 0x18a0);
-6
View File
@@ -77,12 +77,6 @@ public:
/* 0x1260 */ u32 field_0x1260;
/* 0x1260 */ u8 field_0x1264[0x1270 - 0x1264];
/* 0x1270 */ bool mIsHIOOwner;
#if TARGET_PC
cXyz mLineInterpPrev[12];
cXyz mLineInterpCurr[12];
bool mLineInterpPrevValid;
bool mLineInterpCurrValid;
#endif
};
STATIC_ASSERT(sizeof(e_yh_class) == 0x1274);
-3
View File
@@ -196,9 +196,6 @@ public:
void copyReinPos();
void setReinPosHandSubstance(int);
void setReinPosNormalSubstance();
#if TARGET_PC
void lerpControlPoints(f32 alpha);
#endif
void bgCheck();
bool checkSpecialWallHitSubstance(cXyz const&) const;
void setServiceWaitTimer();
-7
View File
@@ -299,13 +299,6 @@ public:
/* 0x168C */ u8 field_0x168c;
/* 0x168D */ u8 field_0x168d;
/* 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
};
#endif /* D_A_MG_ROD_H */
-12
View File
@@ -31,10 +31,6 @@ public:
csXyz* getAngle() { return field_0x8a4; }
J3DModelData* getModelData() { return mModelData; }
#if TARGET_PC
void onInterpCallback();
#endif
/* 0x568 */ request_of_phase_process_class mPhase;
/* 0x570 */ J3DModelData* mModelData;
/* 0x574 */ daObjFchain_shape_c mShape;
@@ -45,14 +41,6 @@ public:
/* 0x694 */ cXyz field_0x694[22];
/* 0x79C */ cXyz field_0x79c[22];
/* 0x8A4 */ csXyz field_0x8a4[22];
#if TARGET_PC
static const int CHAIN_COUNT = 22;
cXyz mChainInterpPrev[CHAIN_COUNT];
cXyz mChainInterpCurr[CHAIN_COUNT];
bool mChainInterpPrevValid;
bool mChainInterpCurrValid;
#endif
};
STATIC_ASSERT(sizeof(daObjFchain_c) == 0x928);
-9
View File
@@ -66,18 +66,9 @@ public:
/* 0x2CA7 */ s8 hide_lock;
/* 0x2CA8 */ cXyz field_0x2ca8;
/* 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);
#endif
class daObj_Keyhole_HIO_c : public JORReflexible {
public:
+1 -12
View File
@@ -17,7 +17,7 @@
class daObjKLift00_c : public dBgS_MoveBgActor, public request_of_phase_process_class {
public:
cPhs_Step create1st();
void setMtx();
void setMtx(IF_DUSK(bool presentation = false));
void rideActor(fopAc_ac_c*);
int CreateHeap();
int Create();
@@ -25,10 +25,6 @@ public:
int Draw();
int Delete();
#if TARGET_PC
void onInterpCallback();
#endif
enum Param_e {
LOCK_e = (1 << 6), NO_BASE_DISP = (1 << 7)
};
@@ -53,13 +49,6 @@ public:
/* 0x1020 */ dCcD_Cyl mCylinderCollider;
/* 0x115C */ s32 mStopSwingingFrames;
#if TARGET_PC
cXyz mChainInterpPrev[64];
cXyz mChainInterpCurr[64];
bool mChainInterpPrevValid;
bool mChainInterpCurrValid;
#endif
// Number of chain models
u32 getArg0() {
return fopAcM_GetParamBit(this, 0, 6);
-3
View File
@@ -58,9 +58,6 @@ public:
void setNextPoint();
int Draw();
int Delete();
#if TARGET_PC
friend void daL8Lift_interp_callback(bool isSimFrame, void* pUserWork);
#endif
u8 getPthID() { return fopAcM_GetParamBit(this, 0, 8); }
u8 getMoveSpeed() { return fopAcM_GetParamBit(this, 8, 4); }
+5 -16
View File
@@ -33,9 +33,13 @@ class daPy_sightPacket_c : public dDlst_base_c {
public:
daPy_sightPacket_c() {}
virtual void draw();
#if TARGET_PC
virtual ~daPy_sightPacket_c();
#else
virtual ~daPy_sightPacket_c() {}
#endif
void setSight();
void setSight(IF_DUSK(bool registerPacket = true));
void setSightImage(ResTIMG* i_img);
u8 getDrawFlg() { return mDrawFlag; }
@@ -89,14 +93,6 @@ public:
#define PLAYER_CREATE_ANM_HEAP(heap, type, name) (heap).createHeap(type)
#endif
#if TARGET_PC
inline u32 daPy_getAnmResourceSize(u16 i_resId, u32 i_minSize) {
JKRArchive* archive = dComIfGp_getAnmArchive();
u32 size = archive->getFileSize(archive->findIdxResource(i_resId));
return size > i_minSize ? size : i_minSize;
}
#endif
class daPy_anmHeap_c {
public:
enum daAlinkHEAP_TYPE {
@@ -113,9 +109,6 @@ public:
void* mallocBuffer();
#if TARGET_PC
void createHeap(daAlinkHEAP_TYPE i_heapType, const char* name);
void reserveBuffer(u16 i_resId);
void* allocTempBuffer(u16 i_resId, u32* io_size);
void freeTempBuffers();
#else
void createHeap(daAlinkHEAP_TYPE i_heapType);
#endif
@@ -145,10 +138,6 @@ public:
/* 0x08 */ u32 mBufferSize;
/* 0x0C */ u8* mBuffer;
/* 0x10 */ JKRSolidHeap* mAnimeHeap;
#if TARGET_PC
u8* mOwnedBuffer = NULL;
void** mTempBuffers = NULL;
#endif
}; // Size = 0x14
class daPy_actorKeep_c {
+1 -1
View File
@@ -68,7 +68,7 @@ public:
/* 0x5FB */ u8 mProcID;
/* 0x5FC */ u8 mWaitTimer;
/* 0x600 */ CPaneMgrAlpha* field_0x600;
/* 0x604 */ u8 field_0x604;
/* 0x604 */ DUSK_IF_ELSE(f32, u8) field_0x604;
}; // Size: 0x608
typedef void (daTitle_c::*procFunc)();
+1 -1
View File
@@ -441,7 +441,7 @@ public:
}
#if TARGET_PC
void refresh3DlineMats(const cXyz& eye);
void refresh3DlineMats();
#endif
void peekZdata() { mPeekZ.peekData(); }
+4 -1
View File
@@ -35,6 +35,9 @@ public:
void drawSelf();
void setText(u32);
void setFontColor(JUtility::TColor, JUtility::TColor);
#if TARGET_PC
void presentAnims();
#endif
virtual ~dFile_warning_c();
@@ -47,7 +50,7 @@ public:
/* 0x1C */ CPaneMgr* mpRootPane;
/* 0x20 */ J2DTextBox* field_0x20;
/* 0x24 */ J2DAnmTransform* field_0x24;
/* 0x28 */ int field_0x28;
/* 0x28 */ DUSK_IF_ELSE(f32, int) field_0x28;
/* 0x2C */ int field_0x2c;
/* 0x30 */ u8 field_0x30[4];
/* 0x34 */ f32 field_0x34;
+35 -31
View File
@@ -385,7 +385,7 @@ public:
void menuCursorShow();
void yesnoWakuAlpahAnmInit(u8, u8, u8, u8);
bool yesnoWakuAlpahAnm(u8);
#if TARGET_PC
#if TARGET_PC
void fileSelectWide();
bool pointerDataSelect();
bool pointerMenuSelect();
@@ -398,7 +398,10 @@ public:
modoruTxtDispAnmInit(0);
mDataSelProc = DATASELPROC_NAME_TO_DATA_SELECT_MOVE;
}
#endif
void presentLayoutAnims();
void presentAnims();
void presentNameInputFade();
#endif
void _draw();
void errorMoveAnmInitSet(int, int);
bool errorMoveAnm();
@@ -523,7 +526,7 @@ public:
/* 0x00A0 */ s32 field_0x00a0;
/* 0x00A4 */ CPaneMgr* mBaseMovePane;
/* 0x00A8 */ u8 field_0x00a8[0xb0-0xa8];
/* 0x00B0 */ s32 mBaseMoveAnmFrame;
/* 0x00B0 */ DUSK_IF_ELSE(f32, s32) mBaseMoveAnmFrame;
/* 0x00B4 */ s32 mBaseMoveAnmFrameMax;
/* 0x00B8 */ u8 field_0x00b8;
/* 0x00B9 */ u8 field_0x00b9;
@@ -532,26 +535,26 @@ public:
/* 0x00BC */ CPaneMgr* mSelFilePanes[3];
/* 0x00C8 */ f32 field_0x00c8[3];
/* 0x00D4 */ f32 field_0x00d4[3];
/* 0x00E0 */ s32 field_0x00e0[3];
/* 0x00E0 */ DUSK_IF_ELSE(f32, s32) field_0x00e0[3];
/* 0x00EC */ s32 field_0x00ec;
/* 0x00F0 */ CPaneMgr* mYnSelPane[2];
/* 0x00F8 */ s32 field_0x00f8[2];
/* 0x0100 */ s32 field_0x0100;
/* 0x00F8 */ DUSK_IF_ELSE(f32, s32) field_0x00f8[2];
/* 0x0100 */ DUSK_IF_ELSE(f32, s32) field_0x0100;
/* 0x0104 */ s32 field_0x0104;
/* 0x0108 */ bool field_0x0108;
/* 0x0109 */ bool field_0x0109;
/* 0x010A */ u8 field_0x10a[2];
/* 0x010C */ J2DPane* mBaseSubPane;
/* 0x0110 */ int field_0x0110;
/* 0x0110 */ DUSK_IF_ELSE(f32, int) field_0x0110;
/* 0x0114 */ int field_0x0114;
/* 0x0118 */ J2DPane* m3mMenuPane;
/* 0x011C */ J2DPane* mNameBasePane;
/* 0x0120 */ int field_0x0120;
/* 0x0120 */ DUSK_IF_ELSE(f32, int) field_0x0120;
/* 0x0124 */ int field_0x0124;
/* 0x0128 */ bool field_0x0128;
/* 0x0129 */ u8 field_0x0129[0x012C - 0x0129];
/* 0x012C */ J2DPane* mErrorMsgPane;
/* 0x0130 */ int field_0x0130;
/* 0x0130 */ DUSK_IF_ELSE(f32, int) field_0x0130;
/* 0x0134 */ int field_0x0134;
/* 0x0138 */ CPaneMgrAlpha* mErrorMsgTxtPane[2];
/* 0x0140 */ TEXT_SPAN mErrorMsgStringPtr[2];
@@ -578,24 +581,24 @@ public:
/* 0x01BE */ u8 field_0x01be[2];
/* 0x01C0 */ CPaneMgr* mYnSelTxtPane[2];
/* 0x01C8 */ J2DAnmColor* mFileSelBpk;
/* 0x01CC */ s32 mSelFileBpkFrame;
/* 0x01CC */ DUSK_IF_ELSE(f32, s32) mSelFileBpkFrame;
/* 0x01D0 */ J2DAnmTextureSRTKey* mFileSel05Btk;
/* 0x01D4 */ s32 mSelFileBtk05Frame;
/* 0x01D4 */ DUSK_IF_ELSE(f32, s32) mSelFileBtk05Frame;
/* 0x01D8 */ J2DAnmColor* mSelFileBookBpk;
/* 0x01DC */ s32 mSelFileBookBpkFrame;
/* 0x01DC */ DUSK_IF_ELSE(f32, s32) mSelFileBookBpkFrame;
/* 0x01E0 */ J2DAnmTextureSRTKey* mSelFileBookBtk;
/* 0x01E4 */ s32 mSelFileBookBtkFrame;
/* 0x01E4 */ DUSK_IF_ELSE(f32, s32) mSelFileBookBtkFrame;
/* 0x01E8 */ J2DAnmTevRegKey* mSelFileBookBrk;
/* 0x01EC */ s32 mSelFileBookBrkFrame;
/* 0x01EC */ DUSK_IF_ELSE(f32, s32) mSelFileBookBrkFrame;
/* 0x01F0 */ J2DAnmTextureSRTKey* mDtEffBtk;
/* 0x01F4 */ s32 mDtEffBtkFrame;
/* 0x01F4 */ DUSK_IF_ELSE(f32, s32) mDtEffBtkFrame;
/* 0x01F8 */ J2DAnmTextureSRTKey* mCpEffBtk;
/* 0x01FC */ s32 mCpEffBtkFrame;
/* 0x01FC */ DUSK_IF_ELSE(f32, s32) mCpEffBtkFrame;
/* 0x0200 */ J2DAnmTevRegKey* mCpDtEffBrk;
/* 0x0204 */ s32 mCpDtEffBrkFrame;
/* 0x0204 */ DUSK_IF_ELSE(f32, s32) mCpDtEffBrkFrame;
/* 0x0208 */ u8 field_0x0208;
/* 0x0209 */ u8 field_0x0209;
/* 0x020A */ u8 mFadeTimer;
/* 0x020A */ DUSK_IF_ELSE(f32, u8) mFadeTimer;
/* 0x020B */ u8 field_0x020b;
/* 0x020C */ CPaneMgrAlpha* mHeaderTxtPane[2];
/* 0x0214 */ TEXT_SPAN mHeaderStringPtr[2];
@@ -648,7 +651,7 @@ public:
/* 0x02A0 */ J2DAnmTransform* mCpSelBck2;
/* 0x02A4 */ CPaneMgr* mCpSelPane[3];
/* 0x02B0 */ u8 field_0x02b0[0x2b4-0x2b0];
/* 0x02B4 */ int field_0x02b4[3];
/* 0x02B4 */ DUSK_IF_ELSE(f32, int) field_0x02b4[3];
/* 0x02C0 */ CPaneMgr* mCpSelPane_moyo[2];
/* 0x02C8 */ CPaneMgr* mCpSelPane_gold[2];
/* 0x02D0 */ CPaneMgr* mCpSelPane_gold2[2];
@@ -658,30 +661,30 @@ public:
/* 0x02E4 */ u8 field_0x02e4[2];
/* 0x02E4 */ u8 field_0x02e6[0x2e8-0x2e6];
/* 0x02E8 */ J2DAnmColor* mCpSelBpk;
/* 0x02EC */ s32 mCpSelBpkFrame;
/* 0x02EC */ DUSK_IF_ELSE(f32, s32) mCpSelBpkFrame;
/* 0x02F0 */ J2DAnmTextureSRTKey* mCpSel03Btk;
/* 0x02F4 */ s32 mCpSel03BtkFrame;
/* 0x02F4 */ DUSK_IF_ELSE(f32, s32) mCpSel03BtkFrame;
/* 0x02F8 */ J2DAnmColor* mCpSelBookBpk;
/* 0x02FC */ s32 mCpSelBookBpkFrame;
/* 0x02FC */ DUSK_IF_ELSE(f32, s32) mCpSelBookBpkFrame;
/* 0x0300 */ J2DAnmTextureSRTKey* mCpSelBookBtk;
/* 0x0304 */ s32 mCpSelBookBtkFrame;
/* 0x0304 */ DUSK_IF_ELSE(f32, s32) mCpSelBookBtkFrame;
/* 0x0308 */ J2DAnmTevRegKey* mCpSelBookBrk;
/* 0x030C */ s32 mCpSelBookBrkFrame;
/* 0x030C */ DUSK_IF_ELSE(f32, s32) mCpSelBookBrkFrame;
/* 0x0310 */ J2DAnmTransform* mYnSelBck;
/* 0x0314 */ J2DAnmTransform* mYnSelBck2;
/* 0x0318 */ J2DAnmColor* mYnSelBpk;
/* 0x031C */ s32 mYnSelBpkFrame;
/* 0x031C */ DUSK_IF_ELSE(f32, s32) mYnSelBpkFrame;
/* 0x0320 */ J2DAnmTextureSRTKey* mYnSelBtk;
/* 0x0324 */ s32 mYnSelBtkFrame;
/* 0x0324 */ DUSK_IF_ELSE(f32, s32) mYnSelBtkFrame;
/* 0x0328 */ J2DAnmTransform* m3mBck;
/* 0x032C */ J2DAnmTransform* m3mBck2;
/* 0x0330 */ J2DAnmColor* m3mBpk;
/* 0x0334 */ s32 m3mBpkFrame;
/* 0x0334 */ DUSK_IF_ELSE(f32, s32) m3mBpkFrame;
/* 0x0338 */ J2DAnmTextureSRTKey* m3mBtk;
/* 0x033C */ s32 m3mBtkFrame;
/* 0x033C */ DUSK_IF_ELSE(f32, s32) m3mBtkFrame;
/* 0x0340 */ CPaneMgr* m3mSelPane[3];
/* 0x034C */ s32 field_0x034c[3];
/* 0x0358 */ int field_0x0358;
/* 0x034C */ DUSK_IF_ELSE(f32, s32) field_0x034c[3];
/* 0x0358 */ DUSK_IF_ELSE(f32, int) field_0x0358;
/* 0x035C */ int field_0x035c;
/* 0x0360 */ bool field_0x0360;
/* 0x0361 */ u8 field_0x0361[3];
@@ -694,7 +697,7 @@ public:
/* 0x0390 */ u8 field_0x0391[3];
/* 0x0394 */ CPaneMgr* m3mSelTextPane[3];
/* 0x03A0 */ J2DAnmTextureSRTKey* mSelDtBtk;
/* 0x03A4 */ s32 mSelDtBtkFrame;
/* 0x03A4 */ DUSK_IF_ELSE(f32, s32) mSelDtBtkFrame;
/* 0x03A8 */ CPaneMgr* mSelDtPane_mset;
/* 0x03AC */ s16 mWaitTimer;
/* 0x03AE */ u8 field_0x03AE[0x03B0 - 0x03AE];
@@ -720,6 +723,7 @@ public:
dDlst_FileSelFade_c mFadeDlst;
bool mGameModeSaveStartBuildUi = true;
GameModeNewSaveState mGameModeNewSaveState = GAME_MODE_STATE_PENDING;
bool mNameMoveRequested = false;
#endif
};
+3
View File
@@ -194,6 +194,9 @@ public:
/* 0x25F */ u8 field_0x25f;
/* 0x260 */ u8 field_0x260;
/* 0x261 */ u8 field_0x261;
#if TARGET_PC
f32 mBackAlpha = 0.0f;
#endif
};
class dMenu_Collect3D_c {
+7 -8
View File
@@ -91,10 +91,6 @@ public:
void calcCursor();
void drawCursor();
#if TARGET_PC
void dMapBgWide();
#endif
void setDPDFloorSelCurPos(s8 i_pos) { field_0xdd6 = i_pos; }
f32 getMapWidth() { return mMapWidth; }
@@ -108,7 +104,7 @@ public:
}
#if TARGET_PC
void resetScrollArrowMask() { field_0xdda = 0; }
void dMapBgWide();
#endif
/* 0xC98 */ JKRExpHeap* mpHeap;
@@ -174,16 +170,15 @@ public:
/* 0xDCC */ f32 field_0xdcc;
/* 0xDD0 */ u8 field_0xdd0;
/* 0xDD1 */ u8 field_0xdd1;
/* 0xDD2 */ u8 field_0xdd2;
/* 0xDD2 */ DUSK_IF_ELSE(f32, u8) field_0xdd2;
/* 0xDD3 */ u8 field_0xdd3;
/* 0xDD4 */ s8 field_0xdd4;
/* 0xDD5 */ u8 field_0xdd5;
/* 0xDD6 */ s8 field_0xdd6;
/* 0xDD7 */ u8 field_0xdd7;
/* 0xDD7 */ DUSK_IF_ELSE(f32, u8) field_0xdd7;
/* 0xDD8 */ u8 field_0xdd8;
/* 0xDD9 */ u8 field_0xdd9;
/* 0xDDA */ u8 field_0xdda;
#if TARGET_PC
J2DTextBox* mpPoeCountPane;
J2DPicture* mpPoeCountIcon;
@@ -210,6 +205,10 @@ public:
void mapControl();
bool isOpen();
bool isClose();
#if TARGET_PC
void presentAnims();
void presentMapView();
#endif
void _draw();
void itemInfo_init_proc();
void itemInfo_proc();
+4 -4
View File
@@ -191,10 +191,10 @@ public:
/* 0xEE */ s8 field_0xee;
/* 0xEF */ u8 field_0xef;
/* 0xF0 */ u8 field_0xf0;
/* 0xF1 */ u8 field_0xf1;
/* 0xF2 */ u8 field_0xf2;
/* 0xF3 */ u8 field_0xf3;
/* 0xF4 */ s8 field_0xf4;
/* 0xF1 */ DUSK_IF_ELSE(f32, u8) field_0xf1;
/* 0xF2 */ DUSK_IF_ELSE(f32, u8) field_0xf2;
/* 0xF3 */ DUSK_IF_ELSE(f32, u8) field_0xf3;
/* 0xF4 */ DUSK_IF_ELSE(f32, s8) field_0xf4;
/* 0xF5 */ u8 field_0xf5;
/* 0xF6 */ u8 field_0xf6;
/* 0xF7 */ s8 field_0xf7;
+10 -2
View File
@@ -112,12 +112,20 @@ public:
class dMenu_Fmap_c {
public:
typedef void (dMenu_Fmap_c::*process)();
dMenu_Fmap_c(JKRExpHeap*, STControl*, CSTControl*, u8, u8, u8, f32, f32, u8);
void _create();
void _delete();
void _move();
void _draw();
#if TARGET_PC
void presentAnims();
void presentZoomView(u8 process, f32 zoomLevel, f32 zoomBlend);
void captureRenderState();
void captureZoomEnd(u8 process);
void resetRenderState();
void resetZoomEnd();
#endif
u8 getNextStatus(u8*);
bool isSync();
void all_map_init();
@@ -266,7 +274,7 @@ public:
/* 0x1B */ PROC_HOWL_DEMO1,
/* 0x1C */ PROC_HOWL_DEMO2,
/* 0x1D */ PROC_HOWL_DEMO3,
};
};
static DUSK_GAME_DATA dMenu_Fmap_c* MyClass;
+2 -5
View File
@@ -156,9 +156,6 @@ public:
void setRegionCursor(u8 i_value) { mRegionCursor = i_value; }
void setMapDrawFlag(bool i_flag) { mMapDrawFlag = i_flag; }
void resetDrug() { field_0x1238 = 0; }
#if TARGET_PC
void resetScrollArrowMask() { field_0x122d = 0; }
#endif
void offArrowDrawFlag() { mArrowDrawFlag = false; }
void onArrowDrawFlag() { mArrowDrawFlag = true; }
@@ -288,8 +285,8 @@ public:
/* 0x120C */ JUtility::TColor field_0x120c;
/* 0x1210 */ float field_0x1210;
/* 0x1214 */ float field_0x1214;
/* 0x1218 */ s16 field_0x1218;
/* 0x121A */ s16 field_0x121a;
/* 0x1218 */ DUSK_IF_ELSE(f32, s16) field_0x1218;
/* 0x121A */ DUSK_IF_ELSE(f32, s16) field_0x121a;
/* 0x121C */ u8 mRegionTextureReadNum[8];
/* 0x1224 */ u8 mSpotNum;
/* 0x1225 */ u8 mStageDataNum;
+11 -1
View File
@@ -172,6 +172,10 @@ public:
~dMenu_FmapMap_c();
void _create(u16, u16, u16, u16, void*);
void _delete();
#if TARGET_PC
void presentAnims();
void presentRendering(dMenu_Fmap_world_data_c*, int, f32, f32, f32, f32);
#endif
void draw();
void rendering(line_class const*);
int getLineWidth(int);
@@ -224,9 +228,15 @@ public:
/* 0xDC */ int mStageCursor;
/* 0xE0 */ int mLastStageCursor;
/* 0xE4 */ u8 mRegionCursor;
/* 0xE5 */ u8 mFlashTimer;
/* 0xE5 */ DUSK_IF_ELSE(f32, u8) mFlashTimer;
/* 0xE8 */ u8* mp_roomList;
/* 0xEC */ int m_roomListNumber;
#if TARGET_PC
f32 mFlashFrame = 0.0f;
f32 mPaletteFrame[2] = {};
bool mResetFlashFrame = true;
bool mPaletteFrameInitialized = false;
#endif
static dMenu_FmapMap_c* mMySelfPointer;
};
+2 -1
View File
@@ -57,6 +57,7 @@ public:
#if TARGET_PC
bool pointerWait();
void presentAnims();
#endif
virtual void draw() { _draw(); }
@@ -109,7 +110,7 @@ public:
/* 0x360 */ f32 field_0x360;
/* 0x364 */ f32 field_0x364;
/* 0x368 */ s16 field_0x368;
/* 0x36A */ s16 field_0x36a;
/* 0x36A */ DUSK_IF_ELSE(f32, s16) field_0x36a;
/* 0x36C */ u8 mStatus;
/* 0x36D */ u8 mProcess;
/* 0x36E */ u8 mIndex;
+2 -2
View File
@@ -123,8 +123,8 @@ public:
/* 0x06C */ u32 _6c;
/* 0x070 */ IconInfo_s mIconInfo[128];
/* 0xC70 */ u16 mIconNum;
/* 0xC72 */ s16 mBlinkTimer;
/* 0xC74 */ s16 mLightDropFlashTimer;
/* 0xC72 */ DUSK_IF_ELSE(f32, s16) mBlinkTimer;
/* 0xC74 */ DUSK_IF_ELSE(f32, s16) mLightDropFlashTimer;
/* 0xC76 */ u16 _c76;
/* 0xC78 */ f32 mBlinkAlpha;
/* 0xC7C */ f32 _c7c;
+6 -4
View File
@@ -96,6 +96,8 @@ public:
bool dpdMenuMove();
#if TARGET_PC
bool pointerConfirmSelect();
void presentLayoutAnims();
void presentAnims();
#endif
void paneResize(u64);
void initialize();
@@ -190,11 +192,11 @@ public:
/* 0x3B4 */ f32 field_0x3b4;
/* 0x3B8 */ JUtility::TColor field_0x3b8;
/* 0x3BC */ JUtility::TColor field_0x3bc;
/* 0x3C0 */ int field_0x3c0;
/* 0x3C4 */ int field_0x3c4;
/* 0x3C8 */ int field_0x3c8[4];
/* 0x3C0 */ DUSK_IF_ELSE(f32, int) field_0x3c0;
/* 0x3C4 */ DUSK_IF_ELSE(f32, int) field_0x3c4;
/* 0x3C8 */ DUSK_IF_ELSE(f32, int) field_0x3c8[4];
/* 0x3D8 */ s16 mFrame;
/* 0x3DA */ s16 field_0x3da;
/* 0x3DA */ DUSK_IF_ELSE(f32, s16) field_0x3da;
/* 0x3DC */ u16 field_0x3dc;
/* 0x3DE */ u16 field_0x3de;
/* 0x3E0 */ u8 field_0x3e0;
+5 -11
View File
@@ -27,6 +27,10 @@ public:
void _delete();
void _move();
void _draw();
#if TARGET_PC
void advanceSelectItem();
void captureRenderState();
#endif
void setKanteraPos(f32, f32);
bool isOpen();
bool isMoveEnd();
@@ -166,7 +170,7 @@ public:
/* 0x67E */ s16 field_0x67e;
/* 0x680 */ s16 mCursorSpeed;
/* 0x682 */ s16 field_0x682;
/* 0x684 */ s16 field_0x684;
/* 0x684 */ DUSK_IF_ELSE(f32, s16) field_0x684;
/* 0x686 */ s16 field_0x686[4];
/* 0x68E */ s16 field_0x68e;
/* 0x690 */ u8 mItemSlots[MAX_ITEM_SLOTS];
@@ -207,16 +211,6 @@ public:
/* 0x6D2 */ u8 field_0x6d2;
/* 0x6D3 */ u8 field_0x6d3;
#if TARGET_PC
f32 mSelectItemSlideElapsed[4];
f32 mCursorInterpPrevX;
f32 mCursorInterpPrevY;
f32 mCursorInterpCurrX;
f32 mCursorInterpCurrY;
s16 mCursorInterpPrevAngle;
s16 mCursorInterpCurrAngle;
bool mCursorInterpPrevAngular;
bool mCursorInterpCurrAngular;
bool mCursorInterpInit;
bool mPointerTouchPressHoveredCurrent;
#endif
};
+16 -12
View File
@@ -263,11 +263,12 @@ public:
void setInitSaveData();
void _draw();
#if TARGET_PC
#if TARGET_PC
void menuSaveWide();
bool pointerSaveSelect();
bool pointerYesNoSelect(bool errorSelect, u8 errParam = 0, u8 soundParam = 0);
#endif
void presentLayoutAnims();
#endif
void _draw2();
@@ -293,16 +294,16 @@ public:
/* 0x0054 */ u8 mSelectedFile;
/* 0x0055 */ u8 mLastSelFile;
/* 0x0058 */ CPaneMgr* mpSelectMoveBase;
/* 0x005C */ int mDataBaseMoveAnmFrame;
/* 0x005C */ DUSK_IF_ELSE(f32, int) mDataBaseMoveAnmFrame;
/* 0x0060 */ int mDataBaseMoveFrameMax;
/* 0x0064 */ u8 field_0x64;
/* 0x0065 */ u8 field_0x65;
/* 0x0068 */ CPaneMgr* mpSelData[3];
/* 0x0074 */ int field_0x74[3];
/* 0x0074 */ DUSK_IF_ELSE(f32, int) field_0x74[3];
/* 0x0080 */ int field_0x80;
/* 0x0084 */ CPaneMgr* mpNoYes[2];
/* 0x008C */ int field_0x8c[2];
/* 0x0094 */ int mYesNoMoveAnmFrame;
/* 0x008C */ DUSK_IF_ELSE(f32, int) field_0x8c[2];
/* 0x0094 */ DUSK_IF_ELSE(f32, int) mYesNoMoveAnmFrame;
/* 0x0098 */ int mYesNoMoveAnmMax;
/* 0x009C */ u8 field_0x9c;
/* 0x009D */ u8 field_0x9d;
@@ -310,7 +311,7 @@ public:
/* 0x00A0 */ J2DPane* field_0xa0;
/* 0x00A4 */ u8 field_0xa4[0x10];
/* 0x00B4 */ J2DPane* field_0xb4;
/* 0x00B8 */ int field_0xb8;
/* 0x00B8 */ DUSK_IF_ELSE(f32, int) field_0xb8;
/* 0x00BC */ int field_0xbc;
/* 0x00C0 */ CPaneMgrAlpha* mpErrTxtPane[2];
/* 0x00C8 */ TEXT_SPAN mpErrTxt[2];
@@ -334,15 +335,15 @@ public:
/* 0x0134 */ u8 mNoYesWakuAnmTimer[2];
/* 0x0138 */ CPaneMgr* mpNoYesTxt[2];
/* 0x0140 */ J2DAnmColor* mpFileWakuAnm;
/* 0x0144 */ int mFileWakuAnmFrame;
/* 0x0144 */ DUSK_IF_ELSE(f32, int) mFileWakuAnmFrame;
/* 0x0148 */ J2DAnmTextureSRTKey* mpFileWakuRotAnm;
/* 0x014C */ int mFileWakuRotAnmFrame;
/* 0x014C */ DUSK_IF_ELSE(f32, int) mFileWakuRotAnmFrame;
/* 0x0150 */ J2DAnmColor* field_0x150;
/* 0x0154 */ int field_0x154;
/* 0x0154 */ DUSK_IF_ELSE(f32, int) field_0x154;
/* 0x0158 */ J2DAnmTextureSRTKey* field_0x158;
/* 0x015C */ int field_0x15c;
/* 0x015C */ DUSK_IF_ELSE(f32, int) field_0x15c;
/* 0x0160 */ J2DAnmTevRegKey* field_0x160;
/* 0x0164 */ int field_0x164;
/* 0x0164 */ DUSK_IF_ELSE(f32, int) field_0x164;
/* 0x0168 */ CPaneMgrAlpha* mpHeaderTxtPane[2];
/* 0x0170 */ TEXT_SPAN mpHeaderTxt[2];
/* 0x0178 */ u8 mHeaderTxtType; // 0: Select Menu 1: YesNo Menu
@@ -394,6 +395,9 @@ public:
/* 0x21A1 */ u8 field_0x21a1;
/* 0x21A2 */ u8 field_0x21a2;
/* 0x21A3 */ u8 field_0x21a3;
#if TARGET_PC
u8 mYesNoSelAnmCol;
#endif
};
#endif /* D_MENU_D_MENU_SAVE_H */
+2 -1
View File
@@ -51,6 +51,7 @@ public:
#if TARGET_PC
bool pointerWait();
void presentAnims();
#endif
virtual void draw() { _draw(); }
@@ -90,7 +91,7 @@ public:
/* 0x1F4 */ f32 mBarScale[2];
/* 0x1FC */ u32 mStringID;
/* 0x200 */ s16 mFrame;
/* 0x202 */ s16 mProcFrame;
/* 0x202 */ DUSK_IF_ELSE(f32, s16) mProcFrame;
/* 0x204 */ u8 mStatus;
/* 0x205 */ u8 mProcess;
/* 0x206 */ u8 mIndex;
+15
View File
@@ -100,6 +100,11 @@ public:
bool isShowFlag(int i_no) { return field_0x1e6 & (1 << i_no); }
void onShowFlag(int i_no) { field_0x1e6 |= (1 << i_no); }
#if TARGET_PC
void presentAnims();
void presentMap();
#endif
/* 0x0FC */ int field_0xfc;
/* 0x100 */ JKRExpHeap* mpHeap;
/* 0x104 */ JKRExpHeap* mpSubHeap;
@@ -299,6 +304,16 @@ public:
/* 0x460 */ u8 field_0x460[0x4bc - 0x460];
/* 0x4BC */ u8 field_0x4bc;
/* 0x4BC */ u8 field_0x4bd;
#if TARGET_PC
struct {
f32 vesselX, vesselY, vesselScale, vesselAlpha;
f32 buttonAX[2], buttonAY[2];
f32 buttonBX[2], buttonBY[2];
f32 crossX, crossY;
bool ready;
} mPresentationTargets;
#endif
};
#endif /* D_METER_D_METER2_H */
+34 -4
View File
@@ -11,6 +11,7 @@ class JKRExpHeap;
class JKRHeap;
class dKantera_icon_c;
IF_DUSK(class dMeterMap_c);
class dMeter2Draw_c : public dDlst_base_c {
public:
@@ -46,7 +47,8 @@ public:
void playPikariBpkAnimation(f32);
void playOxygenBpkAnimation(J2DAnmColor*);
void drawPikari(f32, f32, f32*, f32, JUtility::TColor, JUtility::TColor,
JUtility::TColor, JUtility::TColor, f32, u8);
JUtility::TColor, JUtility::TColor, f32, u8
IF_DUSK_ARG(f32 elapsedFrames = -1.0f));
void drawPikari(CPaneMgr*, f32*, f32, JUtility::TColor, JUtility::TColor,
JUtility::TColor, JUtility::TColor, f32, u8);
void drawPikariHakusha(f32, f32, f32, f32, JUtility::TColor, JUtility::TColor,
@@ -59,11 +61,11 @@ public:
void drawKanteraScreen(u8);
void drawMagic(s16, s16, f32, f32);
void setAlphaMagicChange(bool);
void drawKantera(s32, s32, f32, f32);
void drawKantera(s32, DUSK_IF_ELSE(f32, s32), f32, f32);
void setAlphaKanteraChange(bool);
void setAlphaKanteraAnimeMin();
void setAlphaKanteraAnimeMax();
void drawOxygen(s32, s32, f32, f32);
void drawOxygen(s32, DUSK_IF_ELSE(f32, s32), f32, f32);
void setAlphaOxygenChange(bool);
void setAlphaOxygenAnimeMin();
void setAlphaOxygenAnimeMax();
@@ -134,7 +136,11 @@ public:
J2DScreen* getMainScreenPtr() { return mpScreen; }
bool isEmphasisC() { return field_0x766 == 7 ? true : false; }
#if TARGET_PC
f32 getMeterGaugeAlphaRate(u8 i_no);
#else
f32 getMeterGaugeAlphaRate(u8 i_no) { return mMeterAlphaRate[i_no]; }
#endif
bool isEmphasisA() { return field_0x761 == 7 ? true : false; }
bool isEmphasisB() { return field_0x762 == 7 ? true : false; }
bool isEmphasisBin() { return field_0x763 == 7 ? true : false; }
@@ -152,6 +158,27 @@ public:
constexpr f32 getButtonZAlpha() const {
return mButtonZAlpha;
}
void beginExecution();
void endExecution();
bool isExecuting() const { return mExecuting; }
void setExecuting(bool executing) { mExecuting = executing; }
void publishKantera(s32 now, s32 max);
void publishOxygen(s32 now, s32 max);
void present();
void presentVessel(f32 i_posX, f32 i_posY, f32 i_scale);
void presentButtonA(f32 i_posX, f32 i_posY, f32 i_textPosX, f32 i_textPosY, f32 i_scale);
void presentButtonB(f32 i_posX, f32 i_posY, f32 i_textPosX, f32 i_textPosY, f32 i_scale);
void presentMapAlpha(dMeterMap_c* map);
void showLightDrop(bool show, bool get_path = false);
void showCross(bool show);
void showMap(bool show);
bool lightDropRowUsed() const;
void resetRows();
#endif
/* 0x004 */ item_params mItemParams[4];
@@ -284,7 +311,7 @@ public:
/* 0x742 */ s16 field_0x742[3];
/* 0x748 */ u8 field_0x748[0xC];
/* 0x756 */ u16 field_0x754;
/* 0x756 */ s16 field_0x756;
/* 0x756 */ DUSK_IF_ELSE(f32, s16) field_0x756;
/* 0x758 */ u8 field_0x758;
/* 0x759 */ u8 field_0x759;
/* 0x75A */ u8 field_0x75a;
@@ -363,6 +390,9 @@ public:
/* 0x858 */ GXColor mButtonZTextColor;
/* 0x85C */ GXColor mButtonXYTextColor;
/* 0x860 */ u8 field_0x860[2];
#if TARGET_PC
bool mExecuting;
#endif
};
#endif /* D_METER_D_METER2_DRAW_H */
+3 -5
View File
@@ -255,7 +255,7 @@ public:
/* 0x4B2 */ u16 mMsgID;
/* 0x4B4 */ s16 field_0x4b4;
/* 0x4B6 */ s16 field_0x4b6;
/* 0x4B8 */ s16 field_0x4b8[2];
/* 0x4B8 */ DUSK_IF_ELSE(f32, s16) field_0x4b8[2];
/* 0x4BC */ u8 field_0x4bc[2];
/* 0x4BE */ u8 field_0x4be[2];
/* 0x4C0 */ bool mPlayedButtonSound[BUTTON_NUM];
@@ -344,10 +344,8 @@ public:
/* 0x624 */ f32 mMidonaPosX;
/* 0x628 */ f32 mMidonaPosY;
/* 0x62C */ f32 mMidonaScale;
#ifdef TARGET_PC
bool mWasListen[2];
bool mWasRepeat[2];
#if TARGET_PC
u16 mBlinkButton = 0;
#endif
};
+8 -1
View File
@@ -4,6 +4,10 @@
#include "d/d_map_path_dmap.h"
#include "JSystem/JHostIO/JORReflexible.h"
#if TARGET_PC
#include "global.h"
#endif
class J2DPicture;
class dMap_c;
class dMap_HIO_c;
@@ -111,13 +115,16 @@ public:
/* 0x1C */ f32 mDrawPosY;
/* 0x20 */ f32 mSizeW;
/* 0x24 */ f32 mSizeH;
/* 0x28 */ s16 mSlidePositionOffset;
/* 0x28 */ DUSK_IF_ELSE(f32, s16) mSlidePositionOffset;
/* 0x2A */ u8 field_0x2a;
/* 0x2B */ u8 field_0x2b;
/* 0x2C */ u8 mMapAlpha;
/* 0x2D */ u8 mMapIsInside;
/* 0x2E */ u8 field_0x2e;
/* 0x30 */ int field_0x30;
#if TARGET_PC
f32 mSlidePositionOffsetTarget;
#endif
};
#endif /* D_METER_D_METER_MAP_H */
+6 -1
View File
@@ -17,7 +17,12 @@ public:
virtual int _execute(u32);
virtual int _delete();
f32 acc(s16 param_0, s16 param_1, s16 param_2) {
f32 acc(DUSK_IF_ELSE(f32, s16) param_0, DUSK_IF_ELSE(f32, s16) param_1, DUSK_IF_ELSE(f32, s16) param_2) {
#if TARGET_PC
if (param_0 == param_2) {
return 1.0f;
}
#endif
return ((f32)(param_1 - param_2) * (f32)(param_1 - param_2)) / ((f32)(param_0 - param_2) * (f32)(param_0 - param_2));
}
+8
View File
@@ -197,12 +197,16 @@ struct jmessage_tReference : public JMessage::TReference {
void addDrawLightCount() { mDrawLightCount++; }
void setCharAlpha(f32 alpha) { mCharAlpha = alpha; }
#if TARGET_PC
void addCharAlpha();
#else
void addCharAlpha() {
mCharAlpha += mAddCharAlpha;
if (mCharAlpha > 255.0f) {
mCharAlpha = 255.0f;
}
}
#endif
void setLineLength(int i_no, f32 i_strLen, f32 i_spaceLen) {
mStrLength[i_no] = i_strLen;
@@ -215,12 +219,16 @@ struct jmessage_tReference : public JMessage::TReference {
}
}
#if TARGET_PC
void addCharAllAlphaRate();
#else
void addCharAllAlphaRate() {
mCharAllAlphaRate += mAddCharAllAlphaRate;
if (mCharAllAlphaRate > 1.0f) {
mCharAllAlphaRate = 1.0f;
}
}
#endif
void addLineLength(int param_0, f32 param_1, f32 param_2) {
mStrLength[param_0] += param_1;
+4 -1
View File
@@ -21,6 +21,9 @@ public:
int _create(msg_class*);
int _execute();
int _draw();
#if TARGET_PC
void presentAnims();
#endif
int _delete();
void setMessageIndex(u32, u32, bool);
void setMessageIndexDemo(u32, bool);
@@ -285,7 +288,7 @@ public:
/* 0x164 */ u16 mNodeIdx;
/* 0x166 */ u16 field_0x166;
/* 0x168 */ u16 field_0x168;
/* 0x16A */ s16 field_0x16a;
/* 0x16A */ DUSK_IF_ELSE(f32, s16) field_0x16a;
/* 0x16C */ s16 mCurrentGroupID; // group whose BMG is parsed; -1 none, 0 common, 1-8 stage
/* 0x16E */ s16 field_0x16e;
/* 0x170 */ s16 mNowTalkFlowNo;
+2 -2
View File
@@ -39,7 +39,7 @@ class COutFont_c {
public:
COutFont_c(u8);
void initialize();
void setBlendAnime(J2DPicture*, s16);
void setBlendAnime(J2DPicture*, DUSK_IF_ELSE(f32, s16));
const char* getBtiName(int);
virtual ~COutFont_c();
@@ -57,7 +57,7 @@ public:
/* 0x1A8 */ f32 mAlphaRatio;
/* 0x1AC */ f32 field_0x1ac;
/* 0x1B0 */ f32 field_0x1b0;
/* 0x1B4 */ s16 field_0x1b4[70];
/* 0x1B4 */ DUSK_IF_ELSE(f32, s16) field_0x1b4[70];
/* 0x240 */ bool field_0x240;
/* 0x241 */ u8 mRupeeColor;
/* 0x242 */ u8 field_0x242;
+9
View File
@@ -26,10 +26,16 @@ public:
dMsgScrn3Select_c();
virtual ~dMsgScrn3Select_c();
bool isSelect();
#if TARGET_PC
bool isAnimeActive() { return mProcess < PROC_MAX_e; }
#endif
void setString(DUSK_CONST char*, DUSK_CONST char*, DUSK_CONST char*);
void setRubyString(DUSK_CONST char*, DUSK_CONST char*, DUSK_CONST char*);
void translate(f32, f32);
void draw(f32, f32);
#if TARGET_PC
void presentAnims();
#endif
void selAnimeInit(u8, u8, u8, f32, u8);
bool selAnimeMove(u8, u8, bool);
bool selAnimeEnd();
@@ -101,6 +107,9 @@ public:
/* 0x115 */ u8 mDPDPoint;
/* 0x116 */ u8 field_0x116;
/* 0x117 */ u8 field_0x117;
#if TARGET_PC
bool mPresenting;
#endif
}; // Size: 0x118
#endif /* MSG_SCRN_D_MSG_SCRN_3SELECT_H */
+4
View File
@@ -37,6 +37,10 @@ public:
virtual void fukiAlpha(f32);
virtual void fontAlpha(f32);
virtual void fukiPosCalc(u8) {}
#if TARGET_PC
virtual void presentAnims();
virtual bool isSelectAnimeActive() { return false; }
#endif
f32 getSelTextBoxPosX(int idx) { return mSelTextBoxPosX[idx]; }
f32 getSelTextBoxPosY(int idx) { return mSelTextBoxPosY[idx]; }
+4 -1
View File
@@ -23,6 +23,9 @@ public:
dMsgScrnExplain_c(STControl*, u8, bool, u8);
void move();
void draw(J2DOrthoGraph*);
#if TARGET_PC
void presentAnims();
#endif
void wait_init();
void wait_proc();
void open_request_init();
@@ -67,7 +70,7 @@ public:
/* 0x50 */ f32 field_0x50;
/* 0x54 */ u32 mOpenMsgId;
/* 0x58 */ bool field_0x58;
/* 0x5A */ s16 field_0x5a;
/* 0x5A */ DUSK_IF_ELSE(f32, s16) field_0x5a;
/* 0x5C */ s16 field_0x5c;
/* 0x5E */ s16 mKeyWaitTimer;
/* 0x60 */ u8 mStatus;
+6 -1
View File
@@ -8,6 +8,9 @@ struct dMsgScrnHowl_c : public dMsgScrnBase_c {
~dMsgScrnHowl_c();
void exec();
void drawSelf();
#if TARGET_PC
void presentAnims();
#endif
void guide_on_init();
void guide_on_proc();
void guide_off_init();
@@ -77,7 +80,7 @@ struct dMsgScrnHowl_c : public dMsgScrnBase_c {
/* 0x1A18 */ f32 field_0x1a18[30];
/* 0x1A90 */ f32 field_0x1a90[30];
/* 0x1B08 */ f32 field_0x1b08[3];
/* 0x1B14 */ s16 field_0x1b14[0x300];
/* 0x1B14 */ DUSK_IF_ELSE(f32, s16) field_0x1b14[0x300];
/* 0x2114 */ u32 field_0x2114;
/* 0x2118 */ u32 field_0x2118;
/* 0x211C */ u32 field_0x211c;
@@ -113,6 +116,8 @@ struct dMsgScrnHowl_c : public dMsgScrnBase_c {
#if TARGET_PC
u8 showCursor;
f32 mSampleAcc;
f32 mPulseFrame;
#endif
};
+6
View File
@@ -13,6 +13,9 @@ struct dMsgScrnItem_c : public dMsgScrnBase_c {
~dMsgScrnItem_c();
void exec();
void drawSelf();
#if TARGET_PC
void presentAnims();
#endif
void arwAnimeInit();
void arwAnimeMove();
void dotAnimeInit();
@@ -23,6 +26,9 @@ struct dMsgScrnItem_c : public dMsgScrnBase_c {
void selectAnimeInit(u8, u8, f32, u8);
bool selectAnimeMove(u8, u8, bool);
bool selectAnimeEnd();
#if TARGET_PC
bool isSelectAnimeActive();
#endif
void fukiScale(f32);
void fukiTrans(f32, f32);
void fukiAlpha(f32);
+3
View File
@@ -13,6 +13,9 @@ struct dMsgScrnKanban_c : public dMsgScrnBase_c {
~dMsgScrnKanban_c();
void exec();
void draw();
#if TARGET_PC
void presentAnims();
#endif
void fukiAlpha(f32);
void fukiScale(f32);
void fukiTrans(f32, f32);
+5 -1
View File
@@ -23,6 +23,10 @@ struct dMsgScrnTalk_c : public dMsgScrnBase_c {
void selectAnimeInit(u8, u8, f32, u8);
bool selectAnimeMove(u8, u8, bool);
bool selectAnimeEnd();
#if TARGET_PC
void presentAnims();
bool isSelectAnimeActive();
#endif
void fukiScale(f32);
void fukiTrans(f32, f32);
void fukiAlpha(f32);
@@ -42,7 +46,7 @@ struct dMsgScrnTalk_c : public dMsgScrnBase_c {
/* 0x0F4 */ f32 field_0xf4;
/* 0x0F8 */ f32 field_0xf8[150];
/* 0x350 */ f32 field_0x350[3];
/* 0x35C */ s16 field_0x35c[150];
/* 0x35C */ DUSK_IF_ELSE(f32, s16) field_0x35c[150];
/* 0x488 */ u8 field_0x488;
};
+3
View File
@@ -11,6 +11,9 @@ struct dMsgScrnTree_c : public dMsgScrnBase_c {
virtual ~dMsgScrnTree_c();
void exec();
void draw();
#if TARGET_PC
void presentAnims();
#endif
void fukiAlpha(f32);
void fukiScale(f32);
void fukiTrans(f32, f32);
+4 -4
View File
@@ -111,9 +111,9 @@ public:
void menuCursorMove2();
void selectCursorPosSet(int);
#if TARGET_PC
#if TARGET_PC
void nameWide();
#endif
#endif
void _draw();
void screenSet();
@@ -135,9 +135,9 @@ public:
/* 0x00C */ dDlst_NameIN_c nameIn;
/* 0x020 */ dSelect_cursor_c* mSelIcon;
/* 0x024 */ J2DAnmColorKey* mCursorColorKey;
/* 0x028 */ int mCurColAnmF;
/* 0x028 */ DUSK_IF_ELSE(f32, int) mCurColAnmF;
/* 0x02C */ J2DAnmTextureSRTKey* mCursorTexKey;
/* 0x030 */ int mCurTexAnmF;
/* 0x030 */ DUSK_IF_ELSE(f32, int) mCurTexAnmF;
/* 0x034 */ CPaneMgrAlpha* mNameCursor[8];
/* 0x054 */ TEXT_SPAN mNameText[8];
/* 0x074 */ CPaneMgr* mMojiIcon[65];
+21 -4
View File
@@ -4,6 +4,10 @@
#include "JSystem/JUtility/TColor.h"
#include "d/d_pane_class_alpha.h"
#if TARGET_PC
#include <utility>
#endif
class JKRHeap;
void dPaneClass_showNullPane(J2DScreen*);
@@ -26,6 +30,9 @@ public:
void setBlackWhite(JUtility::TColor, JUtility::TColor);
void paneTrans(f32, f32);
void paneScale(f32, f32);
#if TARGET_PC
void presentAnime();
#endif
bool scaleAnime(s16, f32, f32, u8);
bool colorAnime(s16, JUtility::TColor, JUtility::TColor, JUtility::TColor,
JUtility::TColor, u8);
@@ -54,8 +61,14 @@ public:
void resize(f32 x, f32 y) { getPanePtr()->resize(x, y); }
void move(f32 x, f32 y) { getPanePtr()->move(x, y); }
void scaleAnimeStart(s16 v) { mScaleAnime = v; }
void colorAnimeStart(s16 start) { mColorAnime = start; }
void scaleAnimeStart(DUSK_IF_ELSE(f32, s16) v) {
mScaleAnime = v;
IF_DUSK(mScaleAnimation.active = false;)
}
void colorAnimeStart(DUSK_IF_ELSE(f32, s16) start) {
mColorAnime = start;
IF_DUSK(mColorAnimation.active = false;)
}
f32 getPosX() { return getPanePtr()->getBounds().i.x; }
f32 getPosY() { return getPanePtr()->getBounds().i.y; }
@@ -106,10 +119,14 @@ public:
/* 0x5C */ JUtility::TColor mInitBlack;
/* 0x60 */ s16 field_0x60;
/* 0x62 */ s16 field_0x62;
/* 0x64 */ s16 mScaleAnime;
/* 0x64 */ DUSK_IF_ELSE(f32, s16) mScaleAnime;
/* 0x66 */ s16 field_0x66;
/* 0x68 */ s16 field_0x68;
/* 0x6A */ s16 mColorAnime;
/* 0x6A */ DUSK_IF_ELSE(f32, s16) mColorAnime;
#if TARGET_PC
Animation<f32> mScaleAnimation;
Animation<std::pair<JUtility::TColor, JUtility::TColor>> mColorAnimation;
#endif
};
#endif /* D_PANE_D_PANE_CLASS_H */
+23 -4
View File
@@ -9,6 +9,16 @@ class JKRExpHeap;
class CPaneMgrAlpha {
public:
#if TARGET_PC
template <typename T>
struct Animation {
bool active = false;
s16 duration;
u8 curve;
T start, end;
};
#endif
virtual ~CPaneMgrAlpha();
virtual void setAlpha(u8);
@@ -18,9 +28,12 @@ public:
void show();
void hide();
bool isVisible();
f32 rateCalc(s16, s16, u8);
f32 rateCalc(DUSK_IF_ELSE(f32, s16), DUSK_IF_ELSE(f32, s16), u8);
void setAlphaRate(f32);
f32 getAlphaRate();
#if TARGET_PC
void presentAlphaAnime();
#endif
bool alphaAnime(s16 timer, u8 startAlpha, u8 endAlpha, u8 calcType);
bool alphaAnimeLoop(s16, u8, u8, u8);
void childPaneCount(J2DPane*);
@@ -29,8 +42,11 @@ public:
J2DPane* getPanePtr() { return mPane; }
u8 getAlpha() { return getPanePtr()->getAlpha(); }
s16 getAlphaTimer() { return mAlphaTimer; }
void alphaAnimeStart(s16 start) { mAlphaTimer = start; }
DUSK_IF_ELSE(f32, s16) getAlphaTimer() { return mAlphaTimer; }
void alphaAnimeStart(DUSK_IF_ELSE(f32, s16) start) {
mAlphaTimer = start;
IF_DUSK(mAlphaAnimation.active = false;)
}
u8 getInitAlpha() { return mInitAlpha; }
/* 0x04 */ J2DPane* mPane;
@@ -38,9 +54,12 @@ public:
/* 0x0C */ void* mpFirstStackAlpha;
/* 0x10 */ u8* field_0x10;
/* 0x14 */ s16 mChildPaneCount;
/* 0x16 */ s16 mAlphaTimer;
/* 0x16 */ DUSK_IF_ELSE(f32, s16) mAlphaTimer;
/* 0x18 */ u8 mInitAlpha;
/* 0x19 */ u8 mFlags;
#if TARGET_PC
Animation<u8> mAlphaAnimation;
#endif
};
class CPaneMgrAlphaMorf : public CPaneMgrAlpha {
+12 -1
View File
@@ -42,12 +42,18 @@ public:
virtual ~dSelect_cursor_c();
virtual void draw();
#if TARGET_PC
void setInterp(bool enabled);
void setPos(f32 x, f32 y, const cXyz* world = nullptr);
void setWorldPos(const cXyz& position, f32 offsetX, f32 offsetY) { setPos(offsetX, offsetY, &position); }
#else
void setPos(f32 x, f32 y) {
mPositionX = x;
mPositionY = y;
}
#endif
#ifdef TARGET_PC
#if TARGET_PC
f32 getPositionX() const { return mPositionX; }
f32 getPositionY() const { return mPositionY; }
@@ -100,6 +106,11 @@ public:
/* 0xB5 */ u8 mNameIdx;
/* 0xB6 */ u8 field_0xb6;
/* 0xB7 */ bool mUpdateFlag;
#if TARGET_PC
cXyz mWorldPosition{0.0f, 0.0f, 0.0f};
bool mWorldCursor = false;
bool mInterpolatePosition = true;
#endif
};
#endif /* D_D_SELECT_CURSOR_H */
+17 -3
View File
@@ -57,6 +57,9 @@ public:
#endif
void drawPikari(int);
#if TARGET_PC
void presentAnims();
#endif
virtual void draw();
virtual ~dDlst_TimerScrnDraw_c();
@@ -68,10 +71,15 @@ public:
void resetCowID() { mCowID = 0; }
bool isVisible() { return mTimerVisible; }
f32 acc(s16 param_0, s16 param_1, s16 param_2) {
f32 acc(DUSK_IF_ELSE(f32, s16) param_0, DUSK_IF_ELSE(f32, s16) param_1, DUSK_IF_ELSE(f32, s16) param_2) {
#if TARGET_PC
if (param_0 == param_2) {
return 1.0f;
}
#endif
return ((f32)(param_1 - param_2) * (f32)(param_1 - param_2)) / ((f32)(param_0 - param_2) * (f32)(param_0 - param_2));
}
void setTimerTrans(f32 x, f32 y) {
mTimerTransX = x;
mTimerTransY = y;
@@ -103,7 +111,7 @@ public:
/* 0x3CC */ int field_0x3CC;
/* 0x3D0 */ int field_0x3D0;
/* 0x3D4 */ int field_0x3D4;
/* 0x3D8 */ int field_0x3D8;
/* 0x3D8 */ DUSK_IF_ELSE(f32, int) field_0x3D8;
/* 0x3DC */ u8 mCowID;
/* 0x3DD */ u8 mHIOType;
/* 0x3DE */ u8 field_0x3DE;
@@ -111,6 +119,12 @@ public:
/* 0x3E0 */ u8 field_0x3E0;
/* 0x3E1 */ u8 mTimerVisible;
/* 0x3E2 */ u8 field_0x3e2;
#if TARGET_PC
bool mPresentStep = false;
bool mPresentOpening = false;
bool mPresentClosing = false;
bool mPresentTimerSlide = false;
#endif
};
class dTimer_c : public msg_class {
+19
View File
@@ -0,0 +1,19 @@
#pragma once
namespace dusk::helpers {
/**
* Read data from an address that may not be aligned properly.
* @tparam T Type of data to read.
* @param ptr Address to read from.
* @return The copied value.
*/
template <typename T>
requires std::is_trivially_copyable_v<T>
[[nodiscard]] constexpr T read_unaligned(u8 const* ptr) {
T copy;
memcpy(&copy, ptr, sizeof(T));
return copy;
}
} // namespace dusk::helpers
+48
View File
@@ -0,0 +1,48 @@
#pragma once
#include <limits>
#include <span>
#include <utility>
/**
* Helper functions for performing casts.
*/
namespace dusk::helpers::cast {
/**
* Implementation details of dusk::helpers::cast.
*/
namespace _impl {
[[noreturn]] void overrun_high();
[[noreturn]] void overrun_low();
} // namespace _impl
template <typename T>
concept IntCastable = std::is_integral_v<T> && std::is_trivially_copyable_v<T>;
/**
* Helper type that allows easily casting between integer types,
* that safely aborts if an overflow were to occur.
* Usage:
* @code
* size_t foobar = 20;
* int real = bounded_cast(foobar);
* @endcode
*/
template <IntCastable Source>
struct bounded_cast {
Source src;
template <IntCastable Target>
[[nodiscard]] constexpr operator Target() const {
if (std::cmp_greater(src, std::numeric_limits<Target>::max())) [[unlikely]] {
_impl::overrun_high();
}
if (std::cmp_less(src, std::numeric_limits<Target>::min())) [[unlikely]] {
_impl::overrun_low();
}
return static_cast<Target>(src);
}
};
} // namespace dusk::helpers::cast
+106 -45
View File
@@ -28,35 +28,96 @@
#define BSWAP32(x) (x)
#endif
// clang-format off
// yeah ofc Microsoft's _byteswap_* aren't constexpr like the GCC/Clang ones.
constexpr u16 be16_manual(u16 val)
{
return (val >> 8) |
(val << 8);
}
constexpr u32 be32_manual(u32 val)
{
return (val >> 24) |
((val << 8) & 0x00FF0000) |
((val >> 8) & 0x0000FF00) |
(val << 24);
}
constexpr u64 be64_manual(u64 val)
{
return (val >> 56) |
((val << 40) & 0x00FF000000000000) |
((val << 24) & 0x0000FF0000000000) |
((val << 8) & 0x000000FF00000000) |
((val >> 8) & 0x00000000FF000000) |
((val >> 24) & 0x0000000000FF0000) |
((val >> 40) & 0x000000000000FF00) |
(val << 56);
}
// clang-format on
// Big-Endian to Host conversion
inline u16 be16(u16 val) { return BSWAP16(val); }
inline s16 be16s(s16 val) { return (s16)BSWAP16((u16)val); }
inline u32 be32(u32 val) { return BSWAP32(val); }
inline s32 be32s(s32 val) { return (s32)BSWAP32((u32)val); }
inline u64 be64(u64 val) { return BSWAP64(val); }
inline s64 be64s(s64 val) { return (s64)BSWAP64((u64)val); }
// _manual is behind std::is_constant_evaluated() checks,
// to avoid pessimizing debug perf too much.
constexpr u16 be16(u16 val) {
if (std::is_constant_evaluated()) {
return be16_manual(val);
}
return BSWAP16(val);
}
constexpr s16 be16s(s16 val) {
if (std::is_constant_evaluated()) {
return (s16)be16_manual((u16)val);
}
return (s16)BSWAP16((u16)val);
}
constexpr u32 be32(u32 val) {
if (std::is_constant_evaluated()) {
return be32_manual(val);
}
return BSWAP32(val);
}
constexpr s32 be32s(s32 val) {
if (std::is_constant_evaluated()) {
return (s32)be32_manual((u32)val);
}
return (s32)BSWAP32((u32)val);
}
constexpr u64 be64(u64 val) {
if (std::is_constant_evaluated()) {
return be64_manual(val);
}
return BSWAP64(val);
}
constexpr s64 be64s(s64 val) {
if (std::is_constant_evaluated()) {
return (s64)be64_manual((u64)val);
}
return (s64)BSWAP64((u64)val);
}
#ifdef TARGET_PC
// Helper wrappers so code below reads nicely:
static inline u16 RES_U16(u16 v) {
constexpr u16 RES_U16(u16 v) {
return be16(v);
}
static inline s16 RES_S16(s16 v) {
constexpr s16 RES_S16(s16 v) {
return be16s(v);
}
static inline u32 RES_U32(u32 v) {
constexpr u32 RES_U32(u32 v) {
return be32(v);
}
static inline s32 RES_S32(s32 v) {
constexpr s32 RES_S32(s32 v) {
return be32s(v);
}
static inline u64 RES_U64(u64 v) {
constexpr u64 RES_U64(u64 v) {
return be64(v);
}
static inline s64 RES_S64(s64 v) {
constexpr s64 RES_S64(s64 v) {
return be64s(v);
}
static inline f32 RES_F32(f32 v) {
constexpr f32 RES_F32(f32 v) {
return std::bit_cast<f32, s32>(RES_S32(std::bit_cast<s32, f32>(v)));
}
#else
@@ -76,33 +137,33 @@ static inline f32 RES_F32(f32 v) {
template<class T>
struct BE {
T inner;
BE() = default;
BE(const T& from) {
constexpr BE() noexcept = default;
constexpr BE(const T& from) noexcept {
inner = swap(from);
}
// post-ops
T operator--(int) {
constexpr T operator--(int) {
T orig = inner;
*this -= 1;
return swap(orig);
}
T operator++(int) {
constexpr T operator++(int) {
T orig = inner;
*this += 1;
return swap(orig);
}
operator T() const {
constexpr operator T() const noexcept {
return swap(inner);
}
T host[[nodiscard]]() const {
constexpr T host[[nodiscard]]() const noexcept {
return swap(inner);
}
static T swap[[nodiscard]](T val);
static constexpr T swap[[nodiscard]](T val) noexcept;
};
#define BIN_ASSIGN_OP(op) \
@@ -124,44 +185,43 @@ BIN_ASSIGN_OP(^=);
#undef BIN_ASSIGN_OP
template<>
inline u16 BE<u16>::swap(u16 val) {
constexpr u16 BE<u16>::swap(u16 val) noexcept {
return RES_U16(val);
}
template<>
inline s16 BE<s16>::swap(s16 val) {
constexpr s16 BE<s16>::swap(s16 val) noexcept {
return RES_S16(val);
}
template<>
inline u32 BE<u32>::swap(u32 val) {
constexpr u32 BE<u32>::swap(u32 val) noexcept {
return RES_U32(val);
}
template<>
inline s32 BE<s32>::swap(s32 val) {
constexpr s32 BE<s32>::swap(s32 val) noexcept {
return RES_S32(val);
}
template<>
inline s64 BE<s64>::swap(s64 val) {
constexpr s64 BE<s64>::swap(s64 val) noexcept {
return RES_S64(val);
}
template<>
inline u64 BE<u64>::swap(u64 val) {
constexpr u64 BE<u64>::swap(u64 val) noexcept {
return RES_U64(val);
}
template<>
inline f32 BE<f32>::swap(f32 val) {
constexpr f32 BE<f32>::swap(f32 val) noexcept {
return RES_F32(val);
}
template<>
inline S16Vec BE<S16Vec>::swap(S16Vec val) {
constexpr S16Vec BE<S16Vec>::swap(S16Vec val) noexcept {
return {
BE<s16>::swap(val.x),
BE<s16>::swap(val.y),
@@ -175,23 +235,23 @@ struct BE<Vec> {
BE<f32> y;
BE<f32> z;
BE() = default;
BE(f32 x, f32 y, f32 z) {
constexpr BE() noexcept = default;
constexpr BE(f32 x, f32 y, f32 z) noexcept {
this->x = x;
this->y = y;
this->z = z;
}
BE(const Vec& from) {
constexpr BE(const Vec& from) noexcept {
x = from.x;
y = from.y;
z = from.z;
}
operator Vec() const {
constexpr operator Vec() const noexcept {
return { x, y, z };
}
static Vec swap(Vec val) {
constexpr static Vec swap(Vec val) noexcept {
return {
BE<f32>::swap(val.x),
BE<f32>::swap(val.y),
@@ -204,7 +264,7 @@ template <>
struct BE<Mtx44> {
BE<f32> contents[4][4];
auto& operator[](int x) const {
constexpr auto& operator[](int x) const noexcept {
return contents[x];
}
};
@@ -213,11 +273,11 @@ template <>
struct BE<Mtx> {
BE<f32> contents[3][4];
auto& operator[](int x) const {
constexpr auto& operator[](int x) const noexcept {
return contents[x];
}
void to_host(Mtx& mtx) const {
constexpr void to_host(Mtx& mtx) const noexcept {
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 4; j++) {
mtx[i][j] = contents[i][j];
@@ -231,15 +291,15 @@ template <>
struct BE<Mtx23> {
BE<f32> contents[2][3];
auto& operator[](int x) {
constexpr auto& operator[](int x) noexcept {
return contents[x];
}
auto& operator[](int x) const {
constexpr auto& operator[](int x) const noexcept {
return contents[x];
}
void to_host(Mtx23& mtx) const {
constexpr void to_host(Mtx23& mtx) const noexcept {
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 3; j++) {
mtx[i][j] = contents[i][j];
@@ -249,26 +309,26 @@ struct BE<Mtx23> {
};
template<typename T>
void be_swap(T& val) {
constexpr void be_swap(T& val) noexcept {
val = BE<T>::swap(val);
}
template<typename T, u32 N>
void be_swap(T (& val)[N]) {
constexpr void be_swap(T (& val)[N]) noexcept {
for (u32 i = 0; i < N; i++) {
be_swap(val[i]);
}
}
template<typename T>
void be_swap(T array[], const u32 size) {
constexpr void be_swap(T array[], const u32 size) noexcept {
for (u32 i = 0; i < size; i++) {
be_swap(array[i]);
}
}
template<>
inline void be_swap(Mtx44& val) {
constexpr void be_swap(Mtx44& val) noexcept {
for (auto & x : val) {
for (float & y : x) {
be_swap(y);
@@ -277,7 +337,7 @@ inline void be_swap(Mtx44& val) {
}
template<>
inline void be_swap(Mtx& val) {
constexpr void be_swap(Mtx& val) noexcept {
for (auto & x : val) {
for (float & y : x) {
be_swap(y);
@@ -285,6 +345,7 @@ inline void be_swap(Mtx& val) {
}
}
#define LE(T) T
#define BE(T) BE<T>
#define BE_HOST(T) (T.host())
#else
+44 -2
View File
@@ -3,12 +3,28 @@
#include "dolphin/gx/GXStruct.h"
#include "endian.h"
#define IMPL_ENUM(type) \
template <> \
constexpr type BE<type>::swap(type val) noexcept { \
return static_cast<type>(be32(val)); \
}
IMPL_ENUM(GXCullMode);
IMPL_ENUM(GXAttr);
IMPL_ENUM(GXAttrType);
IMPL_ENUM(GXCompType);
IMPL_ENUM(GXCompCnt);
#undef IMPL_ENUM
template <>
struct BE<GXVtxDescList> {
BE<GXAttr> attr;
BE<GXAttrType> type;
static GXVtxDescList swap[[nodiscard]](GXVtxDescList val);
constexpr static GXVtxDescList swap[[nodiscard]](GXVtxDescList val) noexcept;
};
template <>
@@ -18,5 +34,31 @@ struct BE<GXVtxAttrFmtList> {
BE<GXCompType> type;
u8 frac;
static GXVtxAttrFmtList swap[[nodiscard]](GXVtxAttrFmtList val);
constexpr static GXVtxAttrFmtList swap[[nodiscard]](GXVtxAttrFmtList val) noexcept;
};
template <>
constexpr GXColorS10 BE<GXColorS10>::swap(GXColorS10 val) noexcept {
return {
be16s(val.r),
be16s(val.g),
be16s(val.b),
be16s(val.a),
};
}
constexpr GXVtxDescList BE<GXVtxDescList>::swap(GXVtxDescList val) noexcept {
return {
BE<GXAttr>::swap(val.attr),
BE<GXAttrType>::swap(val.type),
};
}
constexpr GXVtxAttrFmtList BE<GXVtxAttrFmtList>::swap(GXVtxAttrFmtList val) noexcept {
return {
BE<GXAttr>::swap(val.attr),
BE<GXCompCnt>::swap(val.cnt),
BE<GXCompType>::swap(val.type),
val.frac
};
}
+8
View File
@@ -60,3 +60,11 @@ struct BE<cXyz> {
};
}
};
template<>
constexpr cXy BE<cXy>::swap(cXy val) noexcept {
return {
BE<f32>::swap(val.x),
BE<f32>::swap(val.y),
};
}
+29 -14
View File
@@ -80,7 +80,13 @@ public:
int remove(J3DModelData* i_modelData) { return i_modelData->removeTexMtxAnimator(mpAnm); }
void entryFrame() { entryFrame(getFrame()); }
void entryFrame(f32 frame) { mpAnm->setFrame(frame); }
#if TARGET_PC
void entryFrame(f32 frame);
#else
void entryFrame(f32 frame) {
mpAnm->setFrame(frame);
}
#endif
J3DAnmTextureSRTKey* getBtkAnm() const { return mpAnm; }
@@ -110,7 +116,13 @@ public:
int remove(J3DModelData* i_modelData) { return i_modelData->removeTevRegAnimator(mpAnm); }
void entryFrame() { entryFrame(getFrame()); }
void entryFrame(f32 frame) { mpAnm->setFrame(frame); }
#if TARGET_PC
void entryFrame(f32 frame);
#else
void entryFrame(f32 frame) {
mpAnm->setFrame(frame);
}
#endif
J3DAnmTevRegKey* getBrkAnm() const { return mpAnm; }
@@ -542,10 +554,18 @@ public:
virtual void setMaterial() = 0;
virtual void draw() = 0;
#if TARGET_PC
virtual void refreshGeometryForPresentationEye(const cXyz& eye) {}
virtual void captureInterpPoints() {}
virtual void refreshGeometryForPresentation() {}
#endif
/* 0x4 */ mDoExt_3DlineMat_c* field_0x4;
#if TARGET_PC
protected:
u8 mInterpKind;
f32 mInterpWidth;
u16 mInterpTaper;
#endif
};
class mDoExt_3DlineMat0_c : public mDoExt_3DlineMat_c {
@@ -567,6 +587,10 @@ public:
virtual int getMaterialID() { return 0; }
virtual void setMaterial();
virtual void draw();
#if TARGET_PC
void captureInterpPoints() override;
void refreshGeometryForPresentation() override;
#endif
cXyz* getPos(int param_0) { return field_0x18[param_0].field_0x0; }
f32* getSize(int param_0) { return field_0x18[param_0].field_0x4; }
@@ -585,18 +609,14 @@ class dKy_tevstr_c;
class mDoExt_3DlineMat1_c : public mDoExt_3DlineMat_c {
public:
int init(u16, u16, ResTIMG*, int);
#if TARGET_PC
void update(int, GXColor&, dKy_tevstr_c*, const cXyz* presentationEye = nullptr);
void update(int, f32, GXColor&, u16, dKy_tevstr_c*, const cXyz* presentationEye = nullptr);
#else
void update(int, GXColor&, dKy_tevstr_c*);
void update(int, f32, GXColor&, u16, dKy_tevstr_c*);
#endif
int getMaterialID() { return 1; }
void setMaterial();
void draw();
#if TARGET_PC
void refreshGeometryForPresentationEye(const cXyz& eye) override;
void captureInterpPoints() override;
void refreshGeometryForPresentation() override;
#endif
cXyz* getPos(int i_idx) { return mpLines[i_idx].field_0x0; }
@@ -611,11 +631,6 @@ private:
/* 0x34 */ u16 field_0x34;
/* 0x36 */ u8 mIsDrawn;
/* 0x38 */ mDoExt_3Dline_c* mpLines;
#if TARGET_PC
u8 mInterpLineKind;
f32 mInterpLineF;
u16 mInterpLineU16;
#endif
};
class mDoExt_3DlineMat2_c : public mDoExt_3DlineMat1_c {
@@ -3,6 +3,10 @@
#include <types.h>
#if TARGET_PC
#include "helpers/endian.h"
#endif
class JSUInputStream;
/**
@@ -6,9 +6,9 @@
#include <mtx.h>
#include "global.h"
#if TARGET_PC
#include "helpers/endian.h"
#if TARGET_PC
#define OFFSET_PTR_V0 BE(u32)
#else
#define OFFSET_PTR_V0 void*
@@ -478,27 +478,45 @@ struct J3DAnmClusterFullTable {
*/
class J3DAnmBase {
public:
#if TARGET_PC
J3DAnmBase();
#else
J3DAnmBase() {
mAttribute = 0;
field_0x5 = 0;
mFrameMax = 0;
mFrame = 0.0f;
}
#endif
#if TARGET_PC
J3DAnmBase(s16 frameMax);
#else
J3DAnmBase(s16 frameMax) {
mAttribute = 0;
field_0x5 = 0;
mFrameMax = frameMax;
mFrame = 0.0f;
}
#endif
#if TARGET_PC
virtual ~J3DAnmBase();
#else
virtual ~J3DAnmBase() {}
#endif
virtual s32 getKind() const = 0;
u8 getAttribute() const { return mAttribute; }
s16 getFrameMax() const { return mFrameMax; }
f32 getFrame() const { return mFrame; }
void setFrame(f32 frame) { mFrame = frame; }
#if TARGET_PC
void setFrame(f32 frame);
#else
void setFrame(f32 frame) {
mFrame = frame;
}
#endif
/* 0x4 */ u8 mAttribute;
/* 0x5 */ u8 field_0x5;
@@ -960,30 +978,66 @@ public:
void init(int endFrame) { init((s16)endFrame); }
BOOL checkPass(f32);
void update();
#if TARGET_PC
virtual ~J3DFrameCtrl();
#else
virtual ~J3DFrameCtrl() {}
#endif
u8 getAttribute() const { return mAttribute; }
void setAttribute(u8 attr) { mAttribute = attr; }
#if TARGET_PC
void setAttribute(u8 attr);
#else
void setAttribute(u8 attr) {
mAttribute = attr;
}
#endif
u8 getState() const { return mState; }
bool checkState(u8 state) const { return mState & state ? true : false; }
s16 getStart() const { return mStart; }
#if TARGET_PC
void setStart(s16 start);
#else
void setStart(s16 start) {
mStart = start;
mFrame = start;
}
#endif
s16 getEnd() const { return mEnd; }
void setEnd(s16 end) { mEnd = end; }
#if TARGET_PC
void setEnd(s16 end);
#else
void setEnd(s16 end) {
mEnd = end;
}
#endif
s16 getLoop() const { return mLoop; }
void setLoop(s16 loop) { mLoop = loop; }
#if TARGET_PC
void setLoop(s16 loop);
#else
void setLoop(s16 loop) {
mLoop = loop;
}
#endif
f32 getRate() const { return mRate; }
void setRate(f32 rate) { mRate = rate; }
f32 getFrame() const { return mFrame; }
void setFrame(f32 frame) { mFrame = frame; }
#if TARGET_PC
void setFrame(f32 frame);
#else
void setFrame(f32 frame) {
mFrame = frame;
}
#endif
#if TARGET_PC
void reset();
#else
void reset() {
mFrame = mStart;
mRate = 1.0f;
mState = 0;
}
#endif
/* 0x04 */ u8 mAttribute;
/* 0x05 */ u8 mState;
@@ -31,10 +31,15 @@ public:
void setAnmFlag(bool flag) { mAnmFlag = flag; }
bool getAnmFlag() const { return mAnmFlag; }
#if TARGET_PC
void calc(GXColor* pColor) const;
J3DAnmColor* getAnimation() const { return mAnmColor; }
#else
void calc(GXColor* pColor) const {
J3D_ASSERT_NULLPTR(507, pColor != NULL);
mAnmColor->getColor(field_0x0, pColor);
}
#endif
private:
/* 0x0 */ u16 field_0x0;
@@ -66,10 +71,15 @@ public:
void setAnmFlag(bool flag) { mAnmFlag = flag; }
#if TARGET_PC
void calc(J3DTextureSRTInfo* pSRTInfo) const;
J3DAnmTextureSRTKey* getAnimation() const { return mAnmTransform; }
#else
void calc(J3DTextureSRTInfo* pSRTInfo) const {
J3D_ASSERT_NULLPTR(519, pSRTInfo != NULL);
mAnmTransform->getTransform(field_0x0, pSRTInfo);
}
#endif
bool getAnmFlag() const { return mAnmFlag; }
@@ -108,6 +118,9 @@ public:
void setAnmFlag(bool flag) { mAnmFlag = flag; }
bool getAnmFlag() const { return mAnmFlag; }
#if TARGET_PC
J3DAnmTexPattern* getAnimation() const { return mAnmTexPattern; }
#endif
J3DAnmTexPattern* getAnmTexPattern() { return mAnmTexPattern; }
private:
@@ -141,10 +154,15 @@ public:
void setAnmFlag(bool flag) { mAnmFlag = flag; }
bool getAnmFlag() const { return mAnmFlag; }
#if TARGET_PC
void calc(GXColorS10* pColor) const;
J3DAnmTevRegKey* getAnimation() const { return mAnmTevReg; }
#else
void calc(GXColorS10* pColor) const {
J3D_ASSERT_NULLPTR(545, pColor != NULL);
mAnmTevReg->getTevColorReg(field_0x0, pColor);
}
#endif
private:
/* 0x0 */ u16 field_0x0;
@@ -177,10 +195,15 @@ public:
void setAnmFlag(bool flag) { mAnmFlag = flag; }
bool getAnmFlag() const { return mAnmFlag; }
#if TARGET_PC
void calc(GXColor* pColor) const;
J3DAnmTevRegKey* getAnimation() const { return mAnmTevReg; }
#else
void calc(GXColor* pColor) const {
J3D_ASSERT_NULLPTR(558, pColor != NULL);
mAnmTevReg->getTevKonstReg(field_0x0, pColor);
}
#endif
private:
/* 0x0 */ u16 field_0x0;
@@ -197,6 +220,9 @@ public:
J3DMaterialAnm() { initialize(); }
void initialize();
#if TARGET_PC
bool hasMaterialAnimation() const;
#endif
void setMatColorAnm(int, J3DMatColorAnm*);
void setTexMtxAnm(int, J3DTexMtxAnm*);
void setTexNoAnm(int, J3DTexNoAnm*);
@@ -207,6 +233,12 @@ public:
virtual void calc(J3DMaterial*) const;
const J3DTexMtxAnm& getTexMtxAnm(int i) const { return mTexMtxAnm[i]; }
#if TARGET_PC
const J3DMatColorAnm& getMatColorAnm(int i) const { return mMatColorAnm[i]; }
const J3DTexNoAnm& getTexNoAnm(int i) const { return mTexNoAnm[i]; }
const J3DTevColorAnm& getTevColorAnm(int i) const { return mTevColorAnm[i]; }
const J3DTevKColorAnm& getTevKColorAnm(int i) const { return mTevKColorAnm[i]; }
#endif
private:
/* 0x04 */ J3DMatColorAnm mMatColorAnm[2];
@@ -79,7 +79,8 @@ public:
virtual ~J3DModel() {}
#if TARGET_PC
static void interp_callback(bool isSimFrame, void* pUserWork);
void calc_presentation_base_mtx();
void prepare_presentation_view();
#endif
J3DModelData* getModelData() { return mModelData; }
@@ -107,6 +108,7 @@ public:
Vec* getBaseScale() { return &mBaseScale; }
#if TARGET_PC
void setAnmMtx(int jointNo, Mtx m);
void forgetMtx();
#else
void setAnmMtx(int jointNo, Mtx m) {
mMtxBuffer->setAnmMtx(jointNo, m);
@@ -133,6 +135,9 @@ public:
/* 0xD0 */ J3DVtxColorCalc* mVtxColorCalc;
/* 0xD4 */ J3DUnkCalc1* mUnkCalc1;
/* 0xD8 */ J3DUnkCalc2* mUnkCalc2;
#if TARGET_PC
Mtx mPresentationBase;
#endif
};
#endif /* J3DMODEL_H */
@@ -3,6 +3,10 @@
#include "JSystem/JGeometry.h"
namespace dusk::mods::svc::audio_res::bst {
struct SoundTableReplacementSlot;
}
class JAIAudible;
class JAISoundID;
struct JASSoundParams;
@@ -14,7 +18,8 @@ struct JASSoundParams;
struct JAIAudience {
virtual ~JAIAudience();
virtual JAIAudible* newAudible(JGeometry::TVec3<f32> const&, JAISoundID,
JGeometry::TVec3<f32> const*, u32) = 0;
JGeometry::TVec3<f32> const*, u32
IF_DUSK_ARG(dusk::mods::svc::audio_res::bst::SoundTableReplacementSlot const*)) = 0;
virtual int getMaxChannels() = 0;
virtual void deleteAudible(JAIAudible*) = 0;
virtual u32 calcPriority(JAIAudible*) = 0;
+1 -1
View File
@@ -43,7 +43,7 @@ public:
void startTrack_(const JASSoundParams& params);
void JAISeCategoryMgr_mixOut_(bool, const JASSoundParams& params, JAISoundActivity activity);
void JAISeCategoryMgr_calc_();
void JAISeMgr_startID_(JAISoundID id, const JGeometry::TVec3<f32>* posPtr, JAIAudience* audience);
void JAISeMgr_startID_(JAISoundID id, const JGeometry::TVec3<f32>* posPtr, JAIAudience* audience IF_DUSK_ARG(std::shared_ptr<SoundEffectReplacementSlot> replacement));
bool prepare_getSeqData_();
void prepare_();
@@ -104,7 +104,7 @@ public:
JAISe* newSe_(int category, u32 priority);
void calc();
void mixOut();
bool startSound(JAISoundID id, JAISoundHandle* handle, const JGeometry::TVec3<f32>* posPtr);
bool startSound(JAISoundID id, JAISoundHandle* handle, const JGeometry::TVec3<f32>* posPtr IF_DUSK_ARG(std::shared_ptr<dusk::mods::svc::audio_res::bst::SoundEffectReplacementSlot> replacement));
int getNumActiveSe() const;
/* 0x004 */ JAISoundActivity mSoundActivity;
@@ -6,7 +6,16 @@
#include "JSystem/JUtility/JUTAssert.h"
#include "global.h"
#include "helpers/endian.h"
#include <cstdint>
#if TARGET_PC
#include <memory>
namespace dusk::mods::svc::audio_res::bst {
struct SoundTableReplacementSlot;
struct SoundEffectReplacementSlot;
struct StreamReplacementSlot;
}
#endif
class JAISound;
@@ -101,7 +110,7 @@ struct JAISoundStatus_ {
bool isMute() const { return field_0x0.flags.mute; }
bool isPaused() const { return field_0x0.flags.paused; }
void pauseWhenOut() {
field_0x1.flags.flag3 = 1;
field_0x1.flags.mPauseWhenOut = 1;
}
/* 0x0 */ union {
@@ -120,9 +129,9 @@ struct JAISoundStatus_ {
/* 0x1 */ union {
u8 value;
struct {
u8 flag1 : 1;
u8 mComesBack : 1;
u8 flag2 : 1;
u8 flag3 : 1;
u8 mPauseWhenOut : 1;
u8 flag4 : 1;
u8 flag5 : 1;
u8 flag6 : 1;
@@ -271,10 +280,16 @@ class JAITempoMgr;
*/
class JAISound {
public:
#if TARGET_PC
using SoundTableReplacementSlot = dusk::mods::svc::audio_res::bst::SoundTableReplacementSlot;
using SoundEffectReplacementSlot = dusk::mods::svc::audio_res::bst::SoundEffectReplacementSlot;
using StreamReplacementSlot = dusk::mods::svc::audio_res::bst::StreamReplacementSlot;
#endif
void releaseHandle();
void attachHandle(JAISoundHandle* handle);
JAISound();
void start_JAISound_(JAISoundID id, const JGeometry::TVec3<f32>* posPtr, JAIAudience* audience);
void start_JAISound_(JAISoundID id, const JGeometry::TVec3<f32>* posPtr, JAIAudience* audience IF_DUSK_ARG(std::shared_ptr<SoundTableReplacementSlot> replacement));
bool acceptsNewAudible() const;
void newAudible(const JGeometry::TVec3<f32>&, JGeometry::TVec3<f32> const*, u32,
JAIAudience*);
@@ -297,6 +312,11 @@ public:
virtual bool JAISound_tryDie_() = 0;
JAISoundID getID() const { return soundID_; }
#if TARGET_PC
SoundTableReplacementSlot* getReplacement() const {
return replacement.get();
}
#endif
u32 getAnimationState() const { return status_.state.flags.animationState; }
bool isAnimated() const { return getAnimationState() != 0; }
void setAnimationState(u32 state) {
@@ -309,7 +329,7 @@ public:
bool hasLifeTime() const { return status_.field_0x1.flags.flag2; }
void removeLifeTime_() {
status_.field_0x1.flags.flag1 = false;
status_.field_0x1.flags.mComesBack = false;
status_.field_0x1.flags.flag2 = 0;
}
@@ -346,7 +366,7 @@ public:
void setComesBack(bool param_0) {
JUT_ASSERT(354, status_.state.flags.calcedOnce == 0);
status_.field_0x1.flags.flag1 = 1;
status_.field_0x1.flags.mComesBack = 1;
if (param_0) {
status_.pauseWhenOut();
}
@@ -380,6 +400,9 @@ public:
/* 0x34 */ u32 priority_;
/* 0x38 */ s32 count_;
/* 0x3C */ JAISoundParams params_;
#if TARGET_PC
std::shared_ptr<SoundTableReplacementSlot> replacement;
#endif
}; // Size: 0x98
STATIC_ASSERT(sizeof(JAISound) == 0x98);
@@ -9,13 +9,17 @@
*
*/
struct JAISoundInfo : public JASGlobalInstance<JAISoundInfo> {
IF_DUSK(using SoundTableReplacementSlot = dusk::mods::svc::audio_res::bst::SoundTableReplacementSlot);
IF_DUSK(using SoundEffectReplacementSlot = dusk::mods::svc::audio_res::bst::SoundEffectReplacementSlot);
IF_DUSK(using StreamReplacementSlot = dusk::mods::svc::audio_res::bst::StreamReplacementSlot);
JAISoundInfo(bool);
virtual int getSoundType(JAISoundID) const = 0;
virtual int getCategory(JAISoundID) const = 0;
virtual u32 getPriority(JAISoundID) const = 0;
virtual void getSeInfo(JAISoundID, JAISe*) const = 0;
virtual u32 getPriority(JAISoundID IF_DUSK_ARG(SoundTableReplacementSlot const* replacement)) const = 0;
virtual void getSeInfo(JAISoundID, JAISe* IF_DUSK_ARG(SoundEffectReplacementSlot const* replacement)) const = 0;
virtual void getSeqInfo(JAISoundID, JAISeq*) const = 0;
virtual void getStreamInfo(JAISoundID, JAIStream*) const = 0;
virtual void getStreamInfo(JAISoundID, JAIStream* IF_DUSK_ARG(StreamReplacementSlot const* replacement)) const = 0;
virtual ~JAISoundInfo();
};
@@ -9,14 +9,14 @@
*/
struct JAISoundParamsProperty {
void init() {
field_0x0 = 1.0f;
field_0x4 = 0.0f;
field_0x8 = 1.0f;
mVolume = 1.0f;
mFxMix = 0.0f;
mPitch = 1.0f;
}
/* 0x00 */ f32 field_0x0;
/* 0x04 */ f32 field_0x4;
/* 0x08 */ f32 field_0x8;
/* 0x00 */ f32 mVolume;
/* 0x04 */ f32 mFxMix;
/* 0x08 */ f32 mPitch;
}; // Size: 0xC
/**
@@ -20,7 +20,7 @@ public:
JAIStream(JAIStreamMgr* streamMgr, JAISoundStrategyMgr<JAIStream>* soundStrategyMgr);
void JAIStreamMgr_startID_(JAISoundID id, s32 streamFileEntry,
const JGeometry::TVec3<f32>* posPtr, JAIAudience* audience,
int category);
int category IF_DUSK_ARG(std::shared_ptr<StreamReplacementSlot> replacement));
bool prepare_prepareStream_();
void prepare_();
void prepare_startStream_();
@@ -8,7 +8,9 @@
*
*/
struct JAIStreamDataMgr {
virtual s32 getStreamFileEntry(JAISoundID) = 0;
IF_DUSK(using StreamReplacementSlot2 = dusk::mods::svc::audio_res::bst::StreamReplacementSlot);
virtual s32 getStreamFileEntry(JAISoundID IF_DUSK_ARG(StreamReplacementSlot2 const*)) = 0;
virtual ~JAIStreamDataMgr();
};
@@ -15,7 +15,7 @@ struct JAIStreamDataMgr;
class JAIStreamMgr : public JASGlobalInstance<JAIStreamMgr> {
public:
JAIStreamMgr(bool setInstance);
bool startSound(JAISoundID id, JAISoundHandle* handle, const JGeometry::TVec3<f32>* posPtr);
bool startSound(JAISoundID id, JAISoundHandle* handle, const JGeometry::TVec3<f32>* posPtr IF_DUSK_ARG(std::shared_ptr<dusk::mods::svc::audio_res::bst::StreamReplacementSlot> replacement));
void freeDeadStream_();
void calc();
void stop();
@@ -14,20 +14,20 @@ const int OSC_MAX = 2;
*/
struct JASInstParam : public JASSoundParams {
JASInstParam() {
field_0x14 = NULL;
field_0x18 = 0;
field_0x1a = 0;
field_0x1c = 0;
field_0x1d = 0;
field_0x1e = 0;
mOscillators = NULL;
mDirectRelease = 0;
mWaveId = 0;
mChannelType = 0;
mOscillatorCount = 0;
mDontSetKey = 0;
}
JASOscillator::Data** field_0x14;
u16 field_0x18;
u16 field_0x1a;
u8 field_0x1c;
u8 field_0x1d;
u8 field_0x1e;
JASOscillator::Data** mOscillators;
u16 mDirectRelease;
u16 mWaveId;
u8 mChannelType; // Always CHANNEL_WAVE in practice
u8 mOscillatorCount;
u8 mDontSetKey;
};
/**
@@ -52,10 +52,10 @@ struct JASBasicInst : public JASInst {
void setHighKey(int key) { mHighKey = key; }
/* 0x0 */ s32 mHighKey;
/* 0x4 */ u16 field_0x4;
/* 0x4 */ u16 mWaveId;
/* 0x6 */ u16 field_0x6;
/* 0x8 */ f32 field_0x8;
/* 0xC */ f32 field_0xc;
/* 0x8 */ f32 mVolumeMult;
/* 0xC */ f32 mPitchMult;
};
JASBasicInst();
@@ -74,7 +74,7 @@ struct JASBasicInst : public JASInst {
/* 0x04 */ f32 mVolume;
/* 0x08 */ f32 mPitch;
/* 0x0C */ JASOscillator::Data const* field_0xc[OSC_MAX];
/* 0x0C */ JASOscillator::Data const* mOscillators[OSC_MAX];
/* 0x10 */ u32 mKeymapCount;
/* 0x14 */ TKeymap* mKeymap;
};
@@ -12,21 +12,27 @@ struct JASBasicWaveBank : public JASWaveBank {
struct TWaveHandle : public JASWaveHandle {
TWaveHandle() { mHeap = NULL; }
virtual intptr_t getWavePtr() const;
virtual const JASWaveInfo* getWaveInfo() const { return &field_0x4; }
virtual const JASWaveInfo* getWaveInfo() const { return &mWaveInfo; }
#if TARGET_PC
/**
* @see JASChannel::mAramBaseAddress
*/
[[nodiscard]] void const* getAramBaseAddress() const override { return nullptr; }
#endif
bool compareHeap(JASHeap* heap) const { return mHeap == heap;}
/* 0x04 */ JASWaveInfo field_0x4;
/* 0x04 */ JASWaveInfo mWaveInfo;
/* 0x28 */ JASHeap* mHeap;
};
struct TGroupWaveInfo {
TGroupWaveInfo() {
field_0x0 = 0xffff;
field_0x4 = -1;
waveId = 0xffff;
mOffsetStart = -1;
}
/* 0x00 */ u16 field_0x0;
/* 0x04 */ int field_0x4;
/* 0x00 */ u16 waveId;
/* 0x04 */ int mOffsetStart;
};
struct TWaveGroup : JASWaveArc {
@@ -44,7 +50,7 @@ struct JASBasicWaveBank : public JASWaveBank {
u32 getWaveCount() const { return mWaveCount; }
};
JASBasicWaveBank();
JASBasicWaveBank(IF_DUSK(u32 bankId));
~JASBasicWaveBank();
TWaveGroup* getWaveGroup(u32);
void setGroupCount(u32, JKRHeap*);
@@ -56,7 +62,7 @@ struct JASBasicWaveBank : public JASWaveBank {
JASWaveArc* getWaveArc(u32 param_0) { return getWaveGroup(param_0); }
u32 getArcCount() const { return mGroupCount; }
/* 0x04 */ OSMutex field_0x4;
/* 0x04 */ OSMutex mWaveTableMutex;
/* 0x1C */ TWaveHandle* mWaveTable;
/* 0x20 */ TWaveGroup* mWaveGroupArray;
/* 0x24 */ u16 mHandleCount;
@@ -8,6 +8,7 @@
#include "JSystem/JAudio2/JASWaveInfo.h"
#include "JSystem/JAudio2/JASDSPInterface.h"
#include <os.h>
#include <memory>
struct JASDSPChannel;
@@ -15,6 +16,10 @@ namespace JASDsp {
struct TChannel;
}
#if TARGET_PC
#include "JSystem/JAudio2/JASSampleDataReference.h"
#endif
/**
* @ingroup jsystem-jaudio
*
@@ -159,13 +164,30 @@ public:
struct {
u32 mChannelType; // CHANNEL_WAVE or CHANNEL_OSCILLATOR
JASWaveInfo mWaveInfo;
} field_0xdc;
} mAnon;
union {
u32 mWaveAramAddress;
u32 mOscillatorSomething;
u32 field_0x104;
};
#if TARGET_PC
/**
* Memory address at which this sound effect should consider ARAM to start.
*
* By changing this, sound effects can effectively be played back from anywhere in memory,
* rather than just the emulated ARAM space.
*
* If nullptr, the regular emulated ARAM is used.
*/
void const* mAramBaseAddress;
/**
* @see JASSampleDataReference
*/
std::unique_ptr<JASSampleDataReference> mSampleReference;
#endif
static DUSK_GAME_DATA OSMessageQueue sBankDisposeMsgQ;
static DUSK_GAME_DATA OSMessage sBankDisposeMsg[16];
static DUSK_GAME_DATA OSMessage sBankDisposeList[16];
@@ -109,7 +109,9 @@ namespace JASDsp {
* Pitch shift via changing playback speed.
*/
/* 0x004 */ u16 mPitch;
#if !TARGET_PC
/* 0x006 */ short _unused1;
#endif
/**
* Set to 1 when playback starts, cleared by DSP later,
@@ -118,19 +120,27 @@ namespace JASDsp {
* (Corroborated by fields JASAramStream checks never being cleared explicitly by CPU.)
*/
/* 0x008 */ u16 mResetFlag;
#if !TARGET_PC
/* 0x00A */ u8 _unused2[0x00C - 0x00A];
#endif
/* 0x00C */ s16 mPauseFlag;
#if !TARGET_PC
/* 0x00E */ short _unused3;
#endif
/* 0x010 */ OutputChannelConfig mOutputChannels[DSP_OUTPUT_CHANNELS];
#if !TARGET_PC
/* 0x040 */ u8 _unused4[0x050 - 0x040];
#endif
/* 0x050 */ u16 mAutoMixerPanDolby; // pan is upper 8 bits, dolby lower 8.
/* 0x052 */ u16 mAutoMixerFxMix;
/* 0x054 */ u16 mAutoMixerInitVolume;
/* 0x056 */ u16 mAutoMixerVolume;
/* 0x058 */ u16 mAutoMixerBeenSet;
#if !TARGET_PC
/* 0x05A */ u8 _unused5[0x060 - 0x05A];
/* 0x060 */ short field_0x060; // Only cleared to zero, presumed used by DSP.
/* 0x062 */ u8 _unused6[0x064 - 0x062];
#endif
/**
* Samples per ADPCM frame for ADPCM audio. Seems just set to 1 for PCM formats.
@@ -139,7 +149,9 @@ namespace JASDsp {
/* 0x064 */ u16 mSamplesPerBlock;
/* 0x066 */ short field_0x066; // Only cleared to zero, presumed used by DSP.
/* 0x068 */ u32 mSamplePosition; // Only ever initialized by code, name is guess.
#if !TARGET_PC
/* 0x06C */ u8 _unused7[0x070 - 0x06C];
#endif
/**
* Current audio read position in ARAM. Updated by DSP.
@@ -151,11 +163,13 @@ namespace JASDsp {
* Gets written by DSP, but also CPU.
*/
/* 0x074 */ u32 mSamplesLeft; // Never directly cleared to zero. Seems sus. Cleared by DSP?
#if !TARGET_PC
/* 0x078 */ short field_0x078[4]; // Only cleared to zero, presumed used by DSP.
/* 0x080 */ short field_0x080[20]; // Only cleared to zero, presumed used by DSP.
/* 0x0A8 */ short field_0x0a8[4]; // Only cleared to zero, presumed used by DSP.
/* 0x0B0 */ u16 field_0x0b0[16]; // Only cleared to zero, presumed used by DSP.
/* 0x0D0 */ u8 _unused8[0x100 - 0x0D0];
#endif
/* 0x100 */ u16 mBytesPerBlock;
/* 0x102 */ u16 mLoopFlag;
@@ -176,9 +190,26 @@ namespace JASDsp {
/* 0x118 */ u32 mWaveAramAddress;
/* 0x11C */ int mSampleCount;
/* 0x120 */ s16 fir_filter_params[8];
#if !TARGET_PC
/* 0x130 */ u8 _unused9[0x148 - 0x130];
#endif
/* 0x148 */ s16 iir_filter_params[8];
#if !TARGET_PC
/* 0x158 */ u8 _unused10[0x180 - 0x158];
#endif
#if TARGET_PC
/**
* Memory address at which this sound effect should consider ARAM to start.
* This means fields like mWaveAramAddress will be relative to this pointer instead.
*
* By changing this, sound effects can effectively be played back from anywhere in memory,
* rather than just the emulated ARAM space.
*
* If nullptr, the regular emulated ARAM is used.
*/
void const* mAramBaseAddress;
#endif
};
void boot(void (*)(void*));

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