mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-22 17:32:19 -05:00
Merge pull request #431 from HarbourMasters/zelda64
Ship of Harkinian 64 bit compilation
This commit is contained in:
commit
d5db4a86bd
1
.gitignore
vendored
1
.gitignore
vendored
@ -7,7 +7,6 @@ __pycache__/
|
|||||||
.vscode/
|
.vscode/
|
||||||
.vs/
|
.vs/
|
||||||
.idea/
|
.idea/
|
||||||
CMakeLists.txt
|
|
||||||
cmake-build-debug
|
cmake-build-debug
|
||||||
venv/
|
venv/
|
||||||
|
|
||||||
|
7
Jenkinsfile
vendored
7
Jenkinsfile
vendored
@ -17,7 +17,7 @@ pipeline {
|
|||||||
MSBUILD='C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Msbuild\\Current\\Bin\\msbuild.exe'
|
MSBUILD='C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Msbuild\\Current\\Bin\\msbuild.exe'
|
||||||
CONFIG='Release'
|
CONFIG='Release'
|
||||||
OTRPLATFORM='x64'
|
OTRPLATFORM='x64'
|
||||||
PLATFORM='x86'
|
PLATFORM='x64'
|
||||||
ZIP='C:\\Program Files\\7-Zip\\7z.exe'
|
ZIP='C:\\Program Files\\7-Zip\\7z.exe'
|
||||||
PYTHON='C:\\Users\\jenkins\\AppData\\Local\\Programs\\Python\\Python310\\python.exe'
|
PYTHON='C:\\Users\\jenkins\\AppData\\Local\\Programs\\Python\\Python310\\python.exe'
|
||||||
CMAKE='C:\\Program Files\\CMake\\bin\\cmake.exe'
|
CMAKE='C:\\Program Files\\CMake\\bin\\cmake.exe'
|
||||||
@ -57,7 +57,7 @@ pipeline {
|
|||||||
|
|
||||||
cd "..\\..\\"
|
cd "..\\..\\"
|
||||||
|
|
||||||
move "soh\\Release\\soh.exe" ".\\"
|
move "soh\\x64\\Release\\soh.exe" ".\\"
|
||||||
move "OTRGui\\build\\assets" ".\\"
|
move "OTRGui\\build\\assets" ".\\"
|
||||||
move ".\\OTRExporter\\x64\\Release\\ZAPD.exe" ".\\assets\\extractor\\"
|
move ".\\OTRExporter\\x64\\Release\\ZAPD.exe" ".\\assets\\extractor\\"
|
||||||
move ".\\OTRGui\\build\\Release\\OTRGui.exe" ".\\"
|
move ".\\OTRGui\\build\\Release\\OTRGui.exe" ".\\"
|
||||||
@ -106,7 +106,6 @@ pipeline {
|
|||||||
mv ZAPDTR/ZAPD.out build/assets/extractor/
|
mv ZAPDTR/ZAPD.out build/assets/extractor/
|
||||||
mv README.md build/readme.txt
|
mv README.md build/readme.txt
|
||||||
cd build
|
cd build
|
||||||
|
|
||||||
7z a soh-linux.7z soh.elf OTRGui assets readme.txt
|
7z a soh-linux.7z soh.elf OTRGui assets readme.txt
|
||||||
mv soh-linux.7z ../
|
mv soh-linux.7z ../
|
||||||
|
|
||||||
@ -124,4 +123,4 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -31,7 +31,7 @@ void OTRExporter_Audio::WriteSampleEntryReference(ZAudio* audio, SampleEntry* en
|
|||||||
void OTRExporter_Audio::WriteSampleEntry(SampleEntry* entry, BinaryWriter* writer)
|
void OTRExporter_Audio::WriteSampleEntry(SampleEntry* entry, BinaryWriter* writer)
|
||||||
{
|
{
|
||||||
WriteHeader(nullptr, "", writer, Ship::ResourceType::AudioSample, Ship::Version::Rachael);
|
WriteHeader(nullptr, "", writer, Ship::ResourceType::AudioSample, Ship::Version::Rachael);
|
||||||
|
|
||||||
writer->Write(entry->codec);
|
writer->Write(entry->codec);
|
||||||
writer->Write(entry->medium);
|
writer->Write(entry->medium);
|
||||||
writer->Write(entry->unk_bit26);
|
writer->Write(entry->unk_bit26);
|
||||||
@ -182,7 +182,7 @@ void OTRExporter_Audio::Save(ZResource* res, const fs::path& outPath, BinaryWrit
|
|||||||
seqWriter.Write((uint8_t)audio->sequenceTable[i].medium);
|
seqWriter.Write((uint8_t)audio->sequenceTable[i].medium);
|
||||||
seqWriter.Write((uint8_t)audio->sequenceTable[i].cachePolicy);
|
seqWriter.Write((uint8_t)audio->sequenceTable[i].cachePolicy);
|
||||||
seqWriter.Write((uint32_t)audio->fontIndices[i].size());
|
seqWriter.Write((uint32_t)audio->fontIndices[i].size());
|
||||||
|
|
||||||
for (size_t k = 0; k < audio->fontIndices[i].size(); k++)
|
for (size_t k = 0; k < audio->fontIndices[i].size(); k++)
|
||||||
seqWriter.Write((uint8_t)audio->fontIndices[i][k]);
|
seqWriter.Write((uint8_t)audio->fontIndices[i][k]);
|
||||||
|
|
||||||
|
@ -12,7 +12,8 @@ LTO ?= 0
|
|||||||
WARN := -Wall -Wextra -Werror \
|
WARN := -Wall -Wextra -Werror \
|
||||||
-Wno-unused-parameter \
|
-Wno-unused-parameter \
|
||||||
-Wno-unused-function \
|
-Wno-unused-function \
|
||||||
-Wno-unused-variable
|
-Wno-unused-variable \
|
||||||
|
-Wno-error=multichar
|
||||||
|
|
||||||
|
|
||||||
CXXFLAGS := $(WARN) -std=c++17
|
CXXFLAGS := $(WARN) -std=c++17
|
||||||
|
395
StormLib/CMakeLists.txt
Normal file
395
StormLib/CMakeLists.txt
Normal file
@ -0,0 +1,395 @@
|
|||||||
|
project(StormLib)
|
||||||
|
cmake_minimum_required(VERSION 3.10)
|
||||||
|
|
||||||
|
set(LIBRARY_NAME storm)
|
||||||
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
|
include(CMakeDependentOption)
|
||||||
|
|
||||||
|
option(BUILD_SHARED_LIBS "Compile shared libraries" OFF)
|
||||||
|
option(STORM_SKIP_INSTALL "Skip installing files" OFF)
|
||||||
|
option(STORM_BUILD_TESTS
|
||||||
|
"Compile StormLib test application" OFF
|
||||||
|
# "BUILD_TESTING" OFF # Stay coherent with CTest variables
|
||||||
|
)
|
||||||
|
|
||||||
|
set(SRC_FILES
|
||||||
|
src/adpcm/adpcm.cpp
|
||||||
|
src/huffman/huff.cpp
|
||||||
|
src/jenkins/lookup3.c
|
||||||
|
src/lzma/C/LzFind.c
|
||||||
|
src/lzma/C/LzmaDec.c
|
||||||
|
src/lzma/C/LzmaEnc.c
|
||||||
|
src/pklib/explode.c
|
||||||
|
src/pklib/implode.c
|
||||||
|
src/sparse/sparse.cpp
|
||||||
|
src/FileStream.cpp
|
||||||
|
src/SBaseCommon.cpp
|
||||||
|
src/SBaseDumpData.cpp
|
||||||
|
src/SBaseFileTable.cpp
|
||||||
|
src/SBaseSubTypes.cpp
|
||||||
|
src/SCompression.cpp
|
||||||
|
src/SFileAddFile.cpp
|
||||||
|
src/SFileAttributes.cpp
|
||||||
|
src/SFileCompactArchive.cpp
|
||||||
|
src/SFileCreateArchive.cpp
|
||||||
|
src/SFileExtractFile.cpp
|
||||||
|
src/SFileFindFile.cpp
|
||||||
|
src/SFileGetFileInfo.cpp
|
||||||
|
src/SFileListFile.cpp
|
||||||
|
src/SFileOpenArchive.cpp
|
||||||
|
src/SFileOpenFileEx.cpp
|
||||||
|
src/SFilePatchArchives.cpp
|
||||||
|
src/SFileReadFile.cpp
|
||||||
|
src/SFileVerify.cpp
|
||||||
|
src/libtomcrypt/src/pk/rsa/rsa_verify_simple.c
|
||||||
|
src/libtomcrypt/src/misc/crypt_libc.c
|
||||||
|
)
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
|
# This file is used to create a DLL on windows
|
||||||
|
# Use BUILD_SHARED_LIBS to create StormLib.dll
|
||||||
|
set(STORM_DEF_FILES
|
||||||
|
src/DllMain.def
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(TOMCRYPT_FILES
|
||||||
|
src/libtomcrypt/src/hashes/hash_memory.c
|
||||||
|
src/libtomcrypt/src/hashes/md5.c
|
||||||
|
src/libtomcrypt/src/hashes/sha1.c
|
||||||
|
src/libtomcrypt/src/math/ltm_desc.c
|
||||||
|
src/libtomcrypt/src/math/multi.c
|
||||||
|
src/libtomcrypt/src/math/rand_prime.c
|
||||||
|
src/libtomcrypt/src/misc/base64_decode.c
|
||||||
|
src/libtomcrypt/src/misc/crypt_argchk.c
|
||||||
|
src/libtomcrypt/src/misc/crypt_find_hash.c
|
||||||
|
src/libtomcrypt/src/misc/crypt_find_prng.c
|
||||||
|
src/libtomcrypt/src/misc/crypt_hash_descriptor.c
|
||||||
|
src/libtomcrypt/src/misc/crypt_hash_is_valid.c
|
||||||
|
src/libtomcrypt/src/misc/crypt_ltc_mp_descriptor.c
|
||||||
|
src/libtomcrypt/src/misc/crypt_prng_descriptor.c
|
||||||
|
src/libtomcrypt/src/misc/crypt_prng_is_valid.c
|
||||||
|
src/libtomcrypt/src/misc/crypt_register_hash.c
|
||||||
|
src/libtomcrypt/src/misc/crypt_register_prng.c
|
||||||
|
src/libtomcrypt/src/misc/zeromem.c
|
||||||
|
src/libtomcrypt/src/pk/asn1/der_decode_bit_string.c
|
||||||
|
src/libtomcrypt/src/pk/asn1/der_decode_boolean.c
|
||||||
|
src/libtomcrypt/src/pk/asn1/der_decode_choice.c
|
||||||
|
src/libtomcrypt/src/pk/asn1/der_decode_ia5_string.c
|
||||||
|
src/libtomcrypt/src/pk/asn1/der_decode_integer.c
|
||||||
|
src/libtomcrypt/src/pk/asn1/der_decode_object_identifier.c
|
||||||
|
src/libtomcrypt/src/pk/asn1/der_decode_octet_string.c
|
||||||
|
src/libtomcrypt/src/pk/asn1/der_decode_printable_string.c
|
||||||
|
src/libtomcrypt/src/pk/asn1/der_decode_sequence_ex.c
|
||||||
|
src/libtomcrypt/src/pk/asn1/der_decode_sequence_flexi.c
|
||||||
|
src/libtomcrypt/src/pk/asn1/der_decode_sequence_multi.c
|
||||||
|
src/libtomcrypt/src/pk/asn1/der_decode_short_integer.c
|
||||||
|
src/libtomcrypt/src/pk/asn1/der_decode_utctime.c
|
||||||
|
src/libtomcrypt/src/pk/asn1/der_decode_utf8_string.c
|
||||||
|
src/libtomcrypt/src/pk/asn1/der_encode_bit_string.c
|
||||||
|
src/libtomcrypt/src/pk/asn1/der_encode_boolean.c
|
||||||
|
src/libtomcrypt/src/pk/asn1/der_encode_ia5_string.c
|
||||||
|
src/libtomcrypt/src/pk/asn1/der_encode_integer.c
|
||||||
|
src/libtomcrypt/src/pk/asn1/der_encode_object_identifier.c
|
||||||
|
src/libtomcrypt/src/pk/asn1/der_encode_octet_string.c
|
||||||
|
src/libtomcrypt/src/pk/asn1/der_encode_printable_string.c
|
||||||
|
src/libtomcrypt/src/pk/asn1/der_encode_sequence_ex.c
|
||||||
|
src/libtomcrypt/src/pk/asn1/der_encode_sequence_multi.c
|
||||||
|
src/libtomcrypt/src/pk/asn1/der_encode_set.c
|
||||||
|
src/libtomcrypt/src/pk/asn1/der_encode_setof.c
|
||||||
|
src/libtomcrypt/src/pk/asn1/der_encode_short_integer.c
|
||||||
|
src/libtomcrypt/src/pk/asn1/der_encode_utctime.c
|
||||||
|
src/libtomcrypt/src/pk/asn1/der_encode_utf8_string.c
|
||||||
|
src/libtomcrypt/src/pk/asn1/der_length_bit_string.c
|
||||||
|
src/libtomcrypt/src/pk/asn1/der_length_boolean.c
|
||||||
|
src/libtomcrypt/src/pk/asn1/der_length_ia5_string.c
|
||||||
|
src/libtomcrypt/src/pk/asn1/der_length_integer.c
|
||||||
|
src/libtomcrypt/src/pk/asn1/der_length_object_identifier.c
|
||||||
|
src/libtomcrypt/src/pk/asn1/der_length_octet_string.c
|
||||||
|
src/libtomcrypt/src/pk/asn1/der_length_printable_string.c
|
||||||
|
src/libtomcrypt/src/pk/asn1/der_length_sequence.c
|
||||||
|
src/libtomcrypt/src/pk/asn1/der_length_utctime.c
|
||||||
|
src/libtomcrypt/src/pk/asn1/der_sequence_free.c
|
||||||
|
src/libtomcrypt/src/pk/asn1/der_length_utf8_string.c
|
||||||
|
src/libtomcrypt/src/pk/asn1/der_length_short_integer.c
|
||||||
|
src/libtomcrypt/src/pk/ecc/ltc_ecc_map.c
|
||||||
|
src/libtomcrypt/src/pk/ecc/ltc_ecc_mul2add.c
|
||||||
|
src/libtomcrypt/src/pk/ecc/ltc_ecc_mulmod.c
|
||||||
|
src/libtomcrypt/src/pk/ecc/ltc_ecc_points.c
|
||||||
|
src/libtomcrypt/src/pk/ecc/ltc_ecc_projective_add_point.c
|
||||||
|
src/libtomcrypt/src/pk/ecc/ltc_ecc_projective_dbl_point.c
|
||||||
|
src/libtomcrypt/src/pk/pkcs1/pkcs_1_mgf1.c
|
||||||
|
src/libtomcrypt/src/pk/pkcs1/pkcs_1_oaep_decode.c
|
||||||
|
src/libtomcrypt/src/pk/pkcs1/pkcs_1_pss_decode.c
|
||||||
|
src/libtomcrypt/src/pk/pkcs1/pkcs_1_pss_encode.c
|
||||||
|
src/libtomcrypt/src/pk/pkcs1/pkcs_1_v1_5_decode.c
|
||||||
|
src/libtomcrypt/src/pk/pkcs1/pkcs_1_v1_5_encode.c
|
||||||
|
src/libtomcrypt/src/pk/rsa/rsa_exptmod.c
|
||||||
|
src/libtomcrypt/src/pk/rsa/rsa_free.c
|
||||||
|
src/libtomcrypt/src/pk/rsa/rsa_import.c
|
||||||
|
src/libtomcrypt/src/pk/rsa/rsa_make_key.c
|
||||||
|
src/libtomcrypt/src/pk/rsa/rsa_sign_hash.c
|
||||||
|
src/libtomcrypt/src/pk/rsa/rsa_verify_hash.c
|
||||||
|
)
|
||||||
|
|
||||||
|
set(TOMMATH_FILES
|
||||||
|
src/libtommath/bncore.c
|
||||||
|
src/libtommath/bn_fast_mp_invmod.c
|
||||||
|
src/libtommath/bn_fast_mp_montgomery_reduce.c
|
||||||
|
src/libtommath/bn_fast_s_mp_mul_digs.c
|
||||||
|
src/libtommath/bn_fast_s_mp_mul_high_digs.c
|
||||||
|
src/libtommath/bn_fast_s_mp_sqr.c
|
||||||
|
src/libtommath/bn_mp_2expt.c
|
||||||
|
src/libtommath/bn_mp_abs.c
|
||||||
|
src/libtommath/bn_mp_add.c
|
||||||
|
src/libtommath/bn_mp_addmod.c
|
||||||
|
src/libtommath/bn_mp_add_d.c
|
||||||
|
src/libtommath/bn_mp_and.c
|
||||||
|
src/libtommath/bn_mp_clamp.c
|
||||||
|
src/libtommath/bn_mp_clear.c
|
||||||
|
src/libtommath/bn_mp_clear_multi.c
|
||||||
|
src/libtommath/bn_mp_cmp.c
|
||||||
|
src/libtommath/bn_mp_cmp_d.c
|
||||||
|
src/libtommath/bn_mp_cmp_mag.c
|
||||||
|
src/libtommath/bn_mp_cnt_lsb.c
|
||||||
|
src/libtommath/bn_mp_copy.c
|
||||||
|
src/libtommath/bn_mp_count_bits.c
|
||||||
|
src/libtommath/bn_mp_div.c
|
||||||
|
src/libtommath/bn_mp_div_2.c
|
||||||
|
src/libtommath/bn_mp_div_2d.c
|
||||||
|
src/libtommath/bn_mp_div_3.c
|
||||||
|
src/libtommath/bn_mp_div_d.c
|
||||||
|
src/libtommath/bn_mp_dr_is_modulus.c
|
||||||
|
src/libtommath/bn_mp_dr_reduce.c
|
||||||
|
src/libtommath/bn_mp_dr_setup.c
|
||||||
|
src/libtommath/bn_mp_exch.c
|
||||||
|
src/libtommath/bn_mp_exptmod.c
|
||||||
|
src/libtommath/bn_mp_exptmod_fast.c
|
||||||
|
src/libtommath/bn_mp_expt_d.c
|
||||||
|
src/libtommath/bn_mp_exteuclid.c
|
||||||
|
src/libtommath/bn_mp_fread.c
|
||||||
|
src/libtommath/bn_mp_fwrite.c
|
||||||
|
src/libtommath/bn_mp_gcd.c
|
||||||
|
src/libtommath/bn_mp_get_int.c
|
||||||
|
src/libtommath/bn_mp_grow.c
|
||||||
|
src/libtommath/bn_mp_init.c
|
||||||
|
src/libtommath/bn_mp_init_copy.c
|
||||||
|
src/libtommath/bn_mp_init_multi.c
|
||||||
|
src/libtommath/bn_mp_init_set.c
|
||||||
|
src/libtommath/bn_mp_init_set_int.c
|
||||||
|
src/libtommath/bn_mp_init_size.c
|
||||||
|
src/libtommath/bn_mp_invmod.c
|
||||||
|
src/libtommath/bn_mp_invmod_slow.c
|
||||||
|
src/libtommath/bn_mp_is_square.c
|
||||||
|
src/libtommath/bn_mp_jacobi.c
|
||||||
|
src/libtommath/bn_mp_karatsuba_mul.c
|
||||||
|
src/libtommath/bn_mp_karatsuba_sqr.c
|
||||||
|
src/libtommath/bn_mp_lcm.c
|
||||||
|
src/libtommath/bn_mp_lshd.c
|
||||||
|
src/libtommath/bn_mp_mod.c
|
||||||
|
src/libtommath/bn_mp_mod_2d.c
|
||||||
|
src/libtommath/bn_mp_mod_d.c
|
||||||
|
src/libtommath/bn_mp_montgomery_calc_normalization.c
|
||||||
|
src/libtommath/bn_mp_montgomery_reduce.c
|
||||||
|
src/libtommath/bn_mp_montgomery_setup.c
|
||||||
|
src/libtommath/bn_mp_mul.c
|
||||||
|
src/libtommath/bn_mp_mulmod.c
|
||||||
|
src/libtommath/bn_mp_mul_2.c
|
||||||
|
src/libtommath/bn_mp_mul_2d.c
|
||||||
|
src/libtommath/bn_mp_mul_d.c
|
||||||
|
src/libtommath/bn_mp_neg.c
|
||||||
|
src/libtommath/bn_mp_n_root.c
|
||||||
|
src/libtommath/bn_mp_or.c
|
||||||
|
src/libtommath/bn_mp_prime_fermat.c
|
||||||
|
src/libtommath/bn_mp_prime_is_divisible.c
|
||||||
|
src/libtommath/bn_mp_prime_is_prime.c
|
||||||
|
src/libtommath/bn_mp_prime_miller_rabin.c
|
||||||
|
src/libtommath/bn_mp_prime_next_prime.c
|
||||||
|
src/libtommath/bn_mp_prime_rabin_miller_trials.c
|
||||||
|
src/libtommath/bn_mp_prime_random_ex.c
|
||||||
|
src/libtommath/bn_mp_radix_size.c
|
||||||
|
src/libtommath/bn_mp_radix_smap.c
|
||||||
|
src/libtommath/bn_mp_rand.c
|
||||||
|
src/libtommath/bn_mp_read_radix.c
|
||||||
|
src/libtommath/bn_mp_read_signed_bin.c
|
||||||
|
src/libtommath/bn_mp_read_unsigned_bin.c
|
||||||
|
src/libtommath/bn_mp_reduce.c
|
||||||
|
src/libtommath/bn_mp_reduce_2k.c
|
||||||
|
src/libtommath/bn_mp_reduce_2k_l.c
|
||||||
|
src/libtommath/bn_mp_reduce_2k_setup.c
|
||||||
|
src/libtommath/bn_mp_reduce_2k_setup_l.c
|
||||||
|
src/libtommath/bn_mp_reduce_is_2k.c
|
||||||
|
src/libtommath/bn_mp_reduce_is_2k_l.c
|
||||||
|
src/libtommath/bn_mp_reduce_setup.c
|
||||||
|
src/libtommath/bn_mp_rshd.c
|
||||||
|
src/libtommath/bn_mp_set.c
|
||||||
|
src/libtommath/bn_mp_set_int.c
|
||||||
|
src/libtommath/bn_mp_shrink.c
|
||||||
|
src/libtommath/bn_mp_signed_bin_size.c
|
||||||
|
src/libtommath/bn_mp_sqr.c
|
||||||
|
src/libtommath/bn_mp_sqrmod.c
|
||||||
|
src/libtommath/bn_mp_sqrt.c
|
||||||
|
src/libtommath/bn_mp_sub.c
|
||||||
|
src/libtommath/bn_mp_submod.c
|
||||||
|
src/libtommath/bn_mp_sub_d.c
|
||||||
|
src/libtommath/bn_mp_toom_mul.c
|
||||||
|
src/libtommath/bn_mp_toom_sqr.c
|
||||||
|
src/libtommath/bn_mp_toradix.c
|
||||||
|
src/libtommath/bn_mp_toradix_n.c
|
||||||
|
src/libtommath/bn_mp_to_signed_bin.c
|
||||||
|
src/libtommath/bn_mp_to_signed_bin_n.c
|
||||||
|
src/libtommath/bn_mp_to_unsigned_bin.c
|
||||||
|
src/libtommath/bn_mp_to_unsigned_bin_n.c
|
||||||
|
src/libtommath/bn_mp_unsigned_bin_size.c
|
||||||
|
src/libtommath/bn_mp_xor.c
|
||||||
|
src/libtommath/bn_mp_zero.c
|
||||||
|
src/libtommath/bn_prime_tab.c
|
||||||
|
src/libtommath/bn_reverse.c
|
||||||
|
src/libtommath/bn_s_mp_add.c
|
||||||
|
src/libtommath/bn_s_mp_exptmod.c
|
||||||
|
src/libtommath/bn_s_mp_mul_digs.c
|
||||||
|
src/libtommath/bn_s_mp_mul_high_digs.c
|
||||||
|
src/libtommath/bn_s_mp_sqr.c
|
||||||
|
src/libtommath/bn_s_mp_sub.c
|
||||||
|
)
|
||||||
|
|
||||||
|
set(BZIP2_FILES
|
||||||
|
src/bzip2/blocksort.c
|
||||||
|
src/bzip2/bzlib.c
|
||||||
|
src/bzip2/compress.c
|
||||||
|
src/bzip2/crctable.c
|
||||||
|
src/bzip2/decompress.c
|
||||||
|
src/bzip2/huffman.c
|
||||||
|
src/bzip2/randtable.c
|
||||||
|
)
|
||||||
|
|
||||||
|
set(ZLIB_FILES
|
||||||
|
src/zlib/adler32.c
|
||||||
|
src/zlib/compress.c
|
||||||
|
src/zlib/crc32.c
|
||||||
|
src/zlib/deflate.c
|
||||||
|
src/zlib/inffast.c
|
||||||
|
src/zlib/inflate.c
|
||||||
|
src/zlib/inftrees.c
|
||||||
|
src/zlib/trees.c
|
||||||
|
src/zlib/zutil.c
|
||||||
|
)
|
||||||
|
|
||||||
|
set(TEST_SRC_FILES
|
||||||
|
test/StormTest.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
add_definitions(-D_7ZIP_ST -DBZ_STRICT_ANSI)
|
||||||
|
set(LINK_LIBS)
|
||||||
|
|
||||||
|
find_package(ZLIB)
|
||||||
|
if (ZLIB_FOUND)
|
||||||
|
set(LINK_LIBS ${LINK_LIBS} ZLIB::ZLIB)
|
||||||
|
add_definitions(-D__SYS_ZLIB)
|
||||||
|
else()
|
||||||
|
set(SRC_FILES ${SRC_FILES} ${ZLIB_FILES})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_package(BZip2)
|
||||||
|
if (BZIP2_FOUND)
|
||||||
|
set(LINK_LIBS ${LINK_LIBS} BZip2::BZip2)
|
||||||
|
add_definitions(-D__SYS_BZLIB)
|
||||||
|
else()
|
||||||
|
set(SRC_FILES ${SRC_FILES} ${BZIP2_FILES})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
set(SRC_ADDITIONAL_FILES ${TOMCRYPT_FILES} ${TOMMATH_FILES})
|
||||||
|
set(LINK_LIBS ${LINK_LIBS} wininet)
|
||||||
|
else()
|
||||||
|
option(WITH_LIBTOMCRYPT "Use system LibTomCrypt library" OFF)
|
||||||
|
if(WITH_LIBTOMCRYPT)
|
||||||
|
include(FindPkgConfig)
|
||||||
|
pkg_check_modules(PC_LIBTOMCRYPT libtomcrypt REQUIRED)
|
||||||
|
find_path(LIBTOMCRYPT_INCLUDE_DIR NAMES tomcrypt.h HINTS ${PC_LIBTOMCRYPT_INCLUDE_DIRS} REQUIRED)
|
||||||
|
find_library(LIBTOMCRYPT_LIBRARY NAMES tomcrypt HINTS ${PC_LIBTOMCRYPT_LIBRARY_DIRS} REQUIRED)
|
||||||
|
set(LINK_LIBS ${LINK_LIBS} ${LIBTOMCRYPT_LIBRARY})
|
||||||
|
include_directories(${LIBTOMCRYPT_INCLUDE_DIR})
|
||||||
|
else()
|
||||||
|
set(SRC_ADDITIONAL_FILES ${TOMCRYPT_FILES} ${TOMMATH_FILES})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(${CMAKE_SYSTEM_NAME} STREQUAL FreeBSD)
|
||||||
|
message(STATUS "Using FreeBSD port")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DO_LARGEFILE=0 -Dstat64=stat -Dlstat64=lstat -Dlseek64=lseek -Doff64_t=off_t -Dfstat64=fstat -Dftruncate64=ftruncate")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_library(${LIBRARY_NAME} ${LIB_TYPE} ${SRC_FILES} ${SRC_ADDITIONAL_FILES} ${STORM_DEF_FILES})
|
||||||
|
if(WIN32)
|
||||||
|
set_target_properties(${LIBRARY_NAME} PROPERTIES OUTPUT_NAME "StormLib")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_link_libraries(${LIBRARY_NAME} ${LINK_LIBS})
|
||||||
|
target_compile_definitions(${LIBRARY_NAME} INTERFACE STORMLIB_NO_AUTO_LINK) #CMake will take care of the linking
|
||||||
|
target_include_directories(${LIBRARY_NAME} PUBLIC src/)
|
||||||
|
set_target_properties(${LIBRARY_NAME} PROPERTIES PUBLIC_HEADER "src/StormLib.h;src/StormPort.h")
|
||||||
|
if(BUILD_SHARED_LIBS)
|
||||||
|
message(STATUS "Linking against dependent libraries dynamically")
|
||||||
|
|
||||||
|
if(APPLE)
|
||||||
|
set_target_properties(${LIBRARY_NAME} PROPERTIES FRAMEWORK true)
|
||||||
|
set_target_properties(${LIBRARY_NAME} PROPERTIES LINK_FLAGS "-framework Carbon")
|
||||||
|
endif()
|
||||||
|
if(UNIX)
|
||||||
|
SET(VERSION_MAJOR "9")
|
||||||
|
SET(VERSION_MINOR "22")
|
||||||
|
SET(VERSION_PATCH "0")
|
||||||
|
SET(VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
|
||||||
|
set_target_properties(${LIBRARY_NAME} PROPERTIES VERSION "${VERSION_STRING}")
|
||||||
|
set_target_properties(${LIBRARY_NAME} PROPERTIES SOVERSION "${VERSION_MAJOR}")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
message(STATUS "Linking against dependent libraries statically")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (NOT STORM_SKIP_INSTALL)
|
||||||
|
install(TARGETS ${LIBRARY_NAME}
|
||||||
|
RUNTIME DESTINATION bin
|
||||||
|
LIBRARY DESTINATION lib
|
||||||
|
ARCHIVE DESTINATION lib
|
||||||
|
FRAMEWORK DESTINATION /Library/Frameworks
|
||||||
|
PUBLIC_HEADER DESTINATION include
|
||||||
|
INCLUDES DESTINATION include)
|
||||||
|
|
||||||
|
#CPack configurtion
|
||||||
|
SET(CPACK_GENERATOR "DEB" "RPM")
|
||||||
|
SET(CPACK_PACKAGE_NAME ${PROJECT_NAME})
|
||||||
|
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MPQ manipulation library")
|
||||||
|
SET(CPACK_PACKAGE_VENDOR "Ladislav Zezula")
|
||||||
|
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
|
||||||
|
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
|
||||||
|
SET(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}")
|
||||||
|
SET(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}")
|
||||||
|
SET(CPACK_PACKAGE_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}")
|
||||||
|
|
||||||
|
#DEB configuration
|
||||||
|
SET(CPACK_DEBIAN_PACKAGE_SECTION "libs")
|
||||||
|
SET(CPACK_DEBIAN_PACKAGE_HOMEPAGE "http://www.zezula.net/en/mpq/stormlib.html")
|
||||||
|
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "imbacen@gmail.com")
|
||||||
|
SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
|
||||||
|
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "zlib1g,bzip2")
|
||||||
|
|
||||||
|
#RPM configuration
|
||||||
|
SET(CPACK_RPM_PACKAGE_RELEASE 1)
|
||||||
|
SET(CPACK_RPM_PACKAGE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
|
||||||
|
SET(CPACK_RPM_PACKAGE_GROUP "${PROJECT_NAME}")
|
||||||
|
SET(CPACK_RPM_PACKAGE_URL "http://www.zezula.net/en/mpq/stormlib.html")
|
||||||
|
SET(CPACK_RPM_PACKAGE_REQUIRES "zlib,bzip2")
|
||||||
|
|
||||||
|
INCLUDE(CPack)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(STORM_BUILD_TESTS)
|
||||||
|
add_executable(StormLib_test ${TEST_SRC_FILES})
|
||||||
|
target_link_libraries(StormLib_test ${LIBRARY_NAME})
|
||||||
|
install(TARGETS StormLib_test RUNTIME DESTINATION bin)
|
||||||
|
endif()
|
@ -959,7 +959,7 @@ ULONGLONG FindFreeMpqSpace(TMPQArchive * ha)
|
|||||||
|
|
||||||
//static TFileEntry* furthestFile = nullptr;
|
//static TFileEntry* furthestFile = nullptr;
|
||||||
//TFileEntry* startEntry = furthestFile == nullptr ? ha->pFileTable : furthestFile;
|
//TFileEntry* startEntry = furthestFile == nullptr ? ha->pFileTable : furthestFile;
|
||||||
|
|
||||||
TFileEntry* startEntry = (ha->useFreeSpaceOptimization && ha->lastFreeSpaceEntry != nullptr) ? ha->lastFreeSpaceEntry : ha->pFileTable;
|
TFileEntry* startEntry = (ha->useFreeSpaceOptimization && ha->lastFreeSpaceEntry != nullptr) ? ha->lastFreeSpaceEntry : ha->pFileTable;
|
||||||
|
|
||||||
// Parse the entire block table
|
// Parse the entire block table
|
||||||
|
@ -45,7 +45,7 @@ endif
|
|||||||
# CXXFLAGS += -DTEXTURE_DEBUG
|
# CXXFLAGS += -DTEXTURE_DEBUG
|
||||||
|
|
||||||
LDFLAGS := -lm -ldl -lpng \
|
LDFLAGS := -lm -ldl -lpng \
|
||||||
-L../external -L../libultraship -lz -lbz2 -pthread -lpulse -lultraship -lstorm -lSDL2 -lGLEW -lGL -lX11
|
-L../StormLib/build -L../libultraship -lz -lbz2 -pthread -lpulse -lultraship -lstorm -lSDL2 -lGLEW -lGL -lX11
|
||||||
|
|
||||||
# Use LLD if available. Set LLD=0 to not use it
|
# Use LLD if available. Set LLD=0 to not use it
|
||||||
ifeq ($(shell command -v ld.lld >/dev/null 2>&1; echo $$?),0)
|
ifeq ($(shell command -v ld.lld >/dev/null 2>&1; echo $$?),0)
|
||||||
@ -103,6 +103,7 @@ clean:
|
|||||||
$(MAKE) -C lib/libgfxd clean
|
$(MAKE) -C lib/libgfxd clean
|
||||||
$(MAKE) -C ZAPDUtils clean
|
$(MAKE) -C ZAPDUtils clean
|
||||||
$(MAKE) -C ExporterTest clean
|
$(MAKE) -C ExporterTest clean
|
||||||
|
rm -rf ../StormLib/build
|
||||||
|
|
||||||
rebuild: clean all
|
rebuild: clean all
|
||||||
|
|
||||||
@ -121,6 +122,11 @@ build/%.o: %.cpp
|
|||||||
lib/libgfxd/libgfxd.a:
|
lib/libgfxd/libgfxd.a:
|
||||||
$(MAKE) -C lib/libgfxd
|
$(MAKE) -C lib/libgfxd
|
||||||
|
|
||||||
|
.PHONY: StormLib
|
||||||
|
StormLib:
|
||||||
|
LDFLAGS="" cmake -B ../StormLib/build -S ../StormLib
|
||||||
|
LDFLAGS="" cmake --build ../StormLib/build
|
||||||
|
|
||||||
.PHONY: ExporterTest
|
.PHONY: ExporterTest
|
||||||
ExporterTest:
|
ExporterTest:
|
||||||
$(MAKE) -C ExporterTest
|
$(MAKE) -C ExporterTest
|
||||||
@ -131,5 +137,5 @@ ZAPDUtils:
|
|||||||
|
|
||||||
|
|
||||||
# Linking
|
# Linking
|
||||||
ZAPD.out: $(O_FILES) lib/libgfxd/libgfxd.a ExporterTest ZAPDUtils
|
ZAPD.out: $(O_FILES) lib/libgfxd/libgfxd.a ExporterTest ZAPDUtils StormLib
|
||||||
$(CXX) $(CXXFLAGS) $(O_FILES) lib/libgfxd/libgfxd.a ZAPDUtils/ZAPDUtils.a $(EXPORTERS) $(LDFLAGS) $(OUTPUT_OPTION)
|
$(CXX) $(CXXFLAGS) $(O_FILES) lib/libgfxd/libgfxd.a ZAPDUtils/ZAPDUtils.a ../StormLib/build/libstorm.a $(EXPORTERS) $(LDFLAGS) $(OUTPUT_OPTION)
|
||||||
|
@ -188,7 +188,7 @@ SampleEntry* ZAudio::ParseSampleEntry(std::vector<uint8_t> audioBank,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return samples[sampleOffset];
|
return samples[sampleOffset];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -338,7 +338,7 @@ void ZAudio::ParseRawData()
|
|||||||
"Audioseq");
|
"Audioseq");
|
||||||
|
|
||||||
// TABLE PARSING
|
// TABLE PARSING
|
||||||
|
|
||||||
// MQ DBG ROM
|
// MQ DBG ROM
|
||||||
//int gSoundFontTableOffset = 0x138270;
|
//int gSoundFontTableOffset = 0x138270;
|
||||||
//int gSequenceTableOffset = 0x1386A0;
|
//int gSequenceTableOffset = 0x1386A0;
|
||||||
|
@ -68,7 +68,7 @@ ZRom::ZRom(std::string romPath)
|
|||||||
romData = File::ReadAllBytes(romPath);
|
romData = File::ReadAllBytes(romPath);
|
||||||
|
|
||||||
version.crc = BitConverter::ToInt32BE(romData, 0x10);
|
version.crc = BitConverter::ToInt32BE(romData, 0x10);
|
||||||
|
|
||||||
switch (version.crc)
|
switch (version.crc)
|
||||||
{
|
{
|
||||||
case OOT_NTSC_10:
|
case OOT_NTSC_10:
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
@ -136,7 +136,7 @@
|
|||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
<LanguageStandard_C>Default</LanguageStandard_C>
|
<LanguageStandard_C>Default</LanguageStandard_C>
|
||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -18,8 +18,11 @@ WARN := -Wall -Wextra -Werror \
|
|||||||
-Wno-narrowing \
|
-Wno-narrowing \
|
||||||
-Wno-missing-field-initializers
|
-Wno-missing-field-initializers
|
||||||
|
|
||||||
CXXFLAGS := $(WARN) -std=c++20 -D_GNU_SOURCE -DENABLE_OPENGL -DSPDLOG_ACTIVE_LEVEL=0 -m32
|
CWARN :=
|
||||||
CFLAGS := $(WARN) -std=c99 -D_GNU_SOURCE -DENABLE_OPENGL -DSPDLOG_ACTIVE_LEVEL=0 -m32
|
CXXWARN := -Wno-deprecated-enum-enum-conversion
|
||||||
|
|
||||||
|
CXXFLAGS := $(WARN) $(CXXWARN) -std=c++20 -D_GNU_SOURCE -DENABLE_OPENGL -DSPDLOG_ACTIVE_LEVEL=0
|
||||||
|
CFLAGS := $(WARN) $(CWARN) -std=c99 -D_GNU_SOURCE -DENABLE_OPENGL -DSPDLOG_ACTIVE_LEVEL=0
|
||||||
CPPFLAGS := -MMD
|
CPPFLAGS := -MMD
|
||||||
|
|
||||||
ifneq ($(DEBUG),0)
|
ifneq ($(DEBUG),0)
|
||||||
@ -40,10 +43,10 @@ endif
|
|||||||
SRC_DIRS := $(shell find -type d -not -path "*build*")
|
SRC_DIRS := $(shell find -type d -not -path "*build*")
|
||||||
|
|
||||||
CXX_FILES := \
|
CXX_FILES := \
|
||||||
$(shell find libultraship/Factories -name *.cpp) \
|
$(shell find libultraship/Factories -name "*.cpp") \
|
||||||
$(shell find libultraship/Lib/Fast3D -name *.cpp) \
|
$(shell find libultraship/Lib/Fast3D -name "*.cpp") \
|
||||||
$(shell find libultraship -maxdepth 1 -name *.cpp) \
|
$(shell find libultraship -maxdepth 1 -name "*.cpp") \
|
||||||
$(shell find libultraship/Lib/ImGui -maxdepth 1 -name *.cpp) \
|
$(shell find libultraship/Lib/ImGui -maxdepth 1 -name "*.cpp") \
|
||||||
libultraship/Lib/ImGui/backends/imgui_impl_opengl3.cpp \
|
libultraship/Lib/ImGui/backends/imgui_impl_opengl3.cpp \
|
||||||
libultraship/Lib/ImGui/backends/imgui_impl_sdl.cpp \
|
libultraship/Lib/ImGui/backends/imgui_impl_sdl.cpp \
|
||||||
libultraship/Lib/StrHash64.cpp \
|
libultraship/Lib/StrHash64.cpp \
|
||||||
@ -53,7 +56,7 @@ C_FILES := \
|
|||||||
libultraship/mixer.c \
|
libultraship/mixer.c \
|
||||||
libultraship/Lib/stb/stb_impl.c
|
libultraship/Lib/stb/stb_impl.c
|
||||||
|
|
||||||
FMT_FILES := $(shell find libultraship/ -type f \( -name *.cpp -o -name *.h \) -a -not -path "libultraship/Lib/*")
|
FMT_FILES := $(shell find libultraship/ -type f \( -name "*.cpp" -o -name "*.h" \) -a -not -path "libultraship/Lib/*")
|
||||||
|
|
||||||
O_FILES := \
|
O_FILES := \
|
||||||
$(CXX_FILES:%.cpp=build/%.o) \
|
$(CXX_FILES:%.cpp=build/%.o) \
|
||||||
|
@ -37,7 +37,7 @@ namespace Ship
|
|||||||
entry->unk_bit25 = reader->ReadByte();
|
entry->unk_bit25 = reader->ReadByte();
|
||||||
|
|
||||||
int dataSize = reader->ReadInt32();
|
int dataSize = reader->ReadInt32();
|
||||||
|
|
||||||
for (int i = 0; i < dataSize; i++)
|
for (int i = 0; i < dataSize; i++)
|
||||||
entry->data.push_back(reader->ReadUByte());
|
entry->data.push_back(reader->ReadUByte());
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ namespace Ship
|
|||||||
drum.loaded = reader->ReadUByte();
|
drum.loaded = reader->ReadUByte();
|
||||||
|
|
||||||
drum.env = ReadEnvelopeData(reader);
|
drum.env = ReadEnvelopeData(reader);
|
||||||
|
|
||||||
bool hasSample = reader->ReadByte();
|
bool hasSample = reader->ReadByte();
|
||||||
drum.sampleFileName = reader->ReadString();
|
drum.sampleFileName = reader->ReadString();
|
||||||
drum.tuning = reader->ReadSingle();
|
drum.tuning = reader->ReadSingle();
|
||||||
@ -103,7 +103,7 @@ namespace Ship
|
|||||||
entry.releaseRate = reader->ReadUByte();
|
entry.releaseRate = reader->ReadUByte();
|
||||||
|
|
||||||
entry.env = ReadEnvelopeData(reader);
|
entry.env = ReadEnvelopeData(reader);
|
||||||
|
|
||||||
{
|
{
|
||||||
bool hasSFEntry = reader->ReadByte();
|
bool hasSFEntry = reader->ReadByte();
|
||||||
|
|
||||||
@ -184,4 +184,4 @@ namespace Ship
|
|||||||
|
|
||||||
ResourceFile::ParseFileBinary(reader, res);
|
ResourceFile::ParseFileBinary(reader, res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ namespace Ship
|
|||||||
public:
|
public:
|
||||||
void ParseFileBinary(BinaryReader* reader, Resource* res) override;
|
void ParseFileBinary(BinaryReader* reader, Resource* res) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AudioV2 : public ResourceFile
|
class AudioV2 : public ResourceFile
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -128,4 +128,4 @@ namespace Ship
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -11,5 +11,6 @@ namespace Ship {
|
|||||||
virtual int Buffered(void) = 0;
|
virtual int Buffered(void) = 0;
|
||||||
virtual int GetDesiredBuffered(void) = 0;
|
virtual int GetDesiredBuffered(void) = 0;
|
||||||
virtual void Play(const uint8_t* buf, uint32_t len) = 0;
|
virtual void Play(const uint8_t* buf, uint32_t len) = 0;
|
||||||
|
constexpr int GetSampleRate() const { return 44100; }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -16,16 +16,40 @@ namespace Ship
|
|||||||
{
|
{
|
||||||
uint64_t data = reader->ReadUInt64();
|
uint64_t data = reader->ReadUInt64();
|
||||||
|
|
||||||
dl->instructions.push_back(data);
|
if (sizeof(uintptr_t) < 8){
|
||||||
|
dl->instructions.push_back(data);
|
||||||
uint8_t opcode = data >> 24;
|
|
||||||
|
|
||||||
// These are 128-bit commands, so read an extra 64 bits...
|
uint8_t opcode = data >> 24;
|
||||||
if (opcode == G_SETTIMG_OTR || opcode == G_DL_OTR || opcode == G_VTX_OTR || opcode == G_BRANCH_Z_OTR || opcode == G_MARKER || opcode == G_MTX_OTR)
|
|
||||||
dl->instructions.push_back(reader->ReadUInt64());
|
|
||||||
|
|
||||||
if (opcode == G_ENDDL)
|
// These are 128-bit commands, so read an extra 64 bits...
|
||||||
break;
|
if (opcode == G_SETTIMG_OTR || opcode == G_DL_OTR || opcode == G_VTX_OTR || opcode == G_BRANCH_Z_OTR || opcode == G_MARKER || opcode == G_MTX_OTR)
|
||||||
|
dl->instructions.push_back(reader->ReadUInt64());
|
||||||
|
|
||||||
|
if (opcode == G_ENDDL)
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
uint32_t w0 = (uint32_t)data;
|
||||||
|
uint32_t w1 = (uint32_t)(data >> 32);
|
||||||
|
|
||||||
|
dl->instructions.push_back(w0);
|
||||||
|
dl->instructions.push_back(w1);
|
||||||
|
|
||||||
|
uint8_t opcode = (uint8_t)(w0 >> 24);
|
||||||
|
|
||||||
|
if (opcode == G_SETTIMG_OTR || opcode == G_DL_OTR || opcode == G_VTX_OTR || opcode == G_BRANCH_Z_OTR || opcode == G_MARKER || opcode == G_MTX_OTR)
|
||||||
|
{
|
||||||
|
data = reader->ReadUInt64();
|
||||||
|
|
||||||
|
w0 = (uint32_t)data;
|
||||||
|
w1 = (uint32_t)(data >> 32);
|
||||||
|
|
||||||
|
dl->instructions.push_back(w0);
|
||||||
|
dl->instructions.push_back(w1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opcode == G_ENDDL)
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -29,9 +29,9 @@ namespace Ship
|
|||||||
|
|
||||||
for (int i = 0; i < 3; i++)
|
for (int i = 0; i < 3; i++)
|
||||||
reader->ReadByte();
|
reader->ReadByte();
|
||||||
|
|
||||||
// OTRTODO: Setup the binaryreader to use the resource's endianess
|
// OTRTODO: Setup the binaryreader to use the resource's endianess
|
||||||
|
|
||||||
ResourceType resourceType = (ResourceType)reader->ReadUInt32();
|
ResourceType resourceType = (ResourceType)reader->ReadUInt32();
|
||||||
Resource* result = nullptr;
|
Resource* result = nullptr;
|
||||||
|
|
||||||
|
@ -1637,13 +1637,17 @@ typedef struct {
|
|||||||
* Generic Gfx Packet
|
* Generic Gfx Packet
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
unsigned int w0;
|
uintptr_t w0;
|
||||||
unsigned int w1;
|
uintptr_t w1;
|
||||||
|
|
||||||
//unsigned long long w0;
|
//unsigned long long w0;
|
||||||
//unsigned long long w1;
|
//unsigned long long w1;
|
||||||
} Gwords;
|
} Gwords;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
static_assert(sizeof(Gwords) == 2 * sizeof(void*), "Display list size is bad");
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This union is the fundamental type of the display list.
|
* This union is the fundamental type of the display list.
|
||||||
* It is, by law, exactly 64 bits in size.
|
* It is, by law, exactly 64 bits in size.
|
||||||
@ -1684,12 +1688,12 @@ _DW({ \
|
|||||||
Gfx *_g = (Gfx *)(pkt); \
|
Gfx *_g = (Gfx *)(pkt); \
|
||||||
\
|
\
|
||||||
_g->words.w0 = _SHIFTL((c), 24, 8) | _SHIFTL((l), 0, 24); \
|
_g->words.w0 = _SHIFTL((c), 24, 8) | _SHIFTL((l), 0, 24); \
|
||||||
_g->words.w1 = (unsigned int)(s); \
|
_g->words.w1 = (uintptr_t)(s); \
|
||||||
})
|
})
|
||||||
|
|
||||||
#define gsDma0p(c, s, l) \
|
#define gsDma0p(c, s, l) \
|
||||||
{ \
|
{ \
|
||||||
_SHIFTL((c), 24, 8) | _SHIFTL((l), 0, 24), (unsigned int)(s) \
|
_SHIFTL((c), 24, 8) | _SHIFTL((l), 0, 24), (uintptr_t)(s) \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define gDma1p(pkt, c, s, l, p) \
|
#define gDma1p(pkt, c, s, l, p) \
|
||||||
@ -1698,14 +1702,14 @@ _DW({ \
|
|||||||
\
|
\
|
||||||
_g->words.w0 = (_SHIFTL((c), 24, 8) | _SHIFTL((p), 16, 8) | \
|
_g->words.w0 = (_SHIFTL((c), 24, 8) | _SHIFTL((p), 16, 8) | \
|
||||||
_SHIFTL((l), 0, 16)); \
|
_SHIFTL((l), 0, 16)); \
|
||||||
_g->words.w1 = (unsigned int)(s); \
|
_g->words.w1 = (uintptr_t)(s); \
|
||||||
})
|
})
|
||||||
|
|
||||||
#define gsDma1p(c, s, l, p) \
|
#define gsDma1p(c, s, l, p) \
|
||||||
{ \
|
{ \
|
||||||
(_SHIFTL((c), 24, 8) | _SHIFTL((p), 16, 8) | \
|
(_SHIFTL((c), 24, 8) | _SHIFTL((p), 16, 8) | \
|
||||||
_SHIFTL((l), 0, 16)), \
|
_SHIFTL((l), 0, 16)), \
|
||||||
(unsigned int)(s) \
|
(uintptr_t)(s) \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define gDma2p(pkt, c, adrs, len, idx, ofs) \
|
#define gDma2p(pkt, c, adrs, len, idx, ofs) \
|
||||||
@ -1713,13 +1717,13 @@ _DW({ \
|
|||||||
Gfx *_g = (Gfx *)(pkt); \
|
Gfx *_g = (Gfx *)(pkt); \
|
||||||
_g->words.w0 = (_SHIFTL((c),24,8)|_SHIFTL(((len)-1)/8,19,5)| \
|
_g->words.w0 = (_SHIFTL((c),24,8)|_SHIFTL(((len)-1)/8,19,5)| \
|
||||||
_SHIFTL((ofs)/8,8,8)|_SHIFTL((idx),0,8)); \
|
_SHIFTL((ofs)/8,8,8)|_SHIFTL((idx),0,8)); \
|
||||||
_g->words.w1 = (unsigned int)(adrs); \
|
_g->words.w1 = (uintptr_t)(adrs); \
|
||||||
})
|
})
|
||||||
#define gsDma2p(c, adrs, len, idx, ofs) \
|
#define gsDma2p(c, adrs, len, idx, ofs) \
|
||||||
{ \
|
{ \
|
||||||
(_SHIFTL((c),24,8)|_SHIFTL(((len)-1)/8,19,5)| \
|
(_SHIFTL((c),24,8)|_SHIFTL(((len)-1)/8,19,5)| \
|
||||||
_SHIFTL((ofs)/8,8,8)|_SHIFTL((idx),0,8)), \
|
_SHIFTL((ofs)/8,8,8)|_SHIFTL((idx),0,8)), \
|
||||||
(unsigned int)(adrs) \
|
(uintptr_t)(adrs) \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define gSPNoOp(pkt) gDma0p(pkt, G_SPNOOP, 0, 0)
|
#define gSPNoOp(pkt) gDma0p(pkt, G_SPNOOP, 0, 0)
|
||||||
@ -1750,12 +1754,12 @@ _DW({ \
|
|||||||
Gfx *_g = (Gfx *)(pkt); \
|
Gfx *_g = (Gfx *)(pkt); \
|
||||||
_g->words.w0 = \
|
_g->words.w0 = \
|
||||||
_SHIFTL(G_VTX,24,8)|_SHIFTL((n),12,8)|_SHIFTL((v0)+(n),1,7); \
|
_SHIFTL(G_VTX,24,8)|_SHIFTL((n),12,8)|_SHIFTL((v0)+(n),1,7); \
|
||||||
_g->words.w1 = (unsigned int)(v); \
|
_g->words.w1 = (uintptr_t)(v); \
|
||||||
})
|
})
|
||||||
# define gsSPVertex(v, n, v0) \
|
# define gsSPVertex(v, n, v0) \
|
||||||
{ \
|
{ \
|
||||||
(_SHIFTL(G_VTX,24,8)|_SHIFTL((n),12,8)|_SHIFTL((v0)+(n),1,7)), \
|
(_SHIFTL(G_VTX,24,8)|_SHIFTL((n),12,8)|_SHIFTL((v0)+(n),1,7)), \
|
||||||
(unsigned int)(v) \
|
(uintptr_t)(v) \
|
||||||
}
|
}
|
||||||
#elif (defined(F3DEX_GBI)||defined(F3DLP_GBI))
|
#elif (defined(F3DEX_GBI)||defined(F3DLP_GBI))
|
||||||
/*
|
/*
|
||||||
@ -1820,12 +1824,12 @@ _DW({ \
|
|||||||
Gfx *_g = (Gfx *)(pkt); \
|
Gfx *_g = (Gfx *)(pkt); \
|
||||||
\
|
\
|
||||||
_g->words.w0 = _SHIFTL((c), 24, 8); \
|
_g->words.w0 = _SHIFTL((c), 24, 8); \
|
||||||
_g->words.w1 = (unsigned int)(p0); \
|
_g->words.w1 = (uintptr_t)(p0); \
|
||||||
})
|
})
|
||||||
|
|
||||||
#define gsImmp1(c, p0) \
|
#define gsImmp1(c, p0) \
|
||||||
{ \
|
{ \
|
||||||
_SHIFTL((c), 24, 8), (unsigned int)(p0) \
|
_SHIFTL((c), 24, 8), (uintptr_t)(p0) \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define gImmp2(pkt, c, p0, p1) \
|
#define gImmp2(pkt, c, p0, p1) \
|
||||||
@ -1862,13 +1866,13 @@ _DW({ \
|
|||||||
\
|
\
|
||||||
_g->words.w0 = (_SHIFTL((c), 24, 8) | _SHIFTL((p0), 8, 16) | \
|
_g->words.w0 = (_SHIFTL((c), 24, 8) | _SHIFTL((p0), 8, 16) | \
|
||||||
_SHIFTL((p1), 0, 8)); \
|
_SHIFTL((p1), 0, 8)); \
|
||||||
_g->words.w1 = (unsigned int) (dat); \
|
_g->words.w1 = (uintptr_t) (dat); \
|
||||||
})
|
})
|
||||||
|
|
||||||
#define gsImmp21(c, p0, p1, dat) \
|
#define gsImmp21(c, p0, p1, dat) \
|
||||||
{ \
|
{ \
|
||||||
_SHIFTL((c), 24, 8) | _SHIFTL((p0), 8, 16) | _SHIFTL((p1), 0, 8),\
|
_SHIFTL((c), 24, 8) | _SHIFTL((p0), 8, 16) | _SHIFTL((p1), 0, 8),\
|
||||||
(unsigned int) (dat) \
|
(uintptr_t) (dat) \
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef F3DEX_GBI_2
|
#ifdef F3DEX_GBI_2
|
||||||
@ -2308,7 +2312,7 @@ _DW({ \
|
|||||||
_DW({ \
|
_DW({ \
|
||||||
Gfx *_g = (Gfx *)(pkt); \
|
Gfx *_g = (Gfx *)(pkt); \
|
||||||
_g->words.w0 = _SHIFTL(G_RDPHALF_1,24,8); \
|
_g->words.w0 = _SHIFTL(G_RDPHALF_1,24,8); \
|
||||||
_g->words.w1 = (unsigned int)(dl); \
|
_g->words.w1 = (uintptr_t)(dl); \
|
||||||
_g = (Gfx *)(pkt); \
|
_g = (Gfx *)(pkt); \
|
||||||
_g->words.w0 = (_SHIFTL(G_BRANCH_Z,24,8)| \
|
_g->words.w0 = (_SHIFTL(G_BRANCH_Z,24,8)| \
|
||||||
_SHIFTL((vtx)*5,12,12)|_SHIFTL((vtx)*2,0,12)); \
|
_SHIFTL((vtx)*5,12,12)|_SHIFTL((vtx)*2,0,12)); \
|
||||||
@ -2317,7 +2321,7 @@ _DW({ \
|
|||||||
|
|
||||||
#define gsSPBranchLessZrg(dl, vtx, zval, near, far, flag, zmin, zmax) \
|
#define gsSPBranchLessZrg(dl, vtx, zval, near, far, flag, zmin, zmax) \
|
||||||
{ _SHIFTL(G_RDPHALF_1,24,8), \
|
{ _SHIFTL(G_RDPHALF_1,24,8), \
|
||||||
(unsigned int)(dl), }, \
|
(uintptr_t)(dl), }, \
|
||||||
{ _SHIFTL(G_BRANCH_Z,24,8)|_SHIFTL((vtx)*5,12,12)|_SHIFTL((vtx)*2,0,12),\
|
{ _SHIFTL(G_BRANCH_Z,24,8)|_SHIFTL((vtx)*5,12,12)|_SHIFTL((vtx)*2,0,12),\
|
||||||
G_DEPTOZSrg(zval, near, far, flag, zmin, zmax), }
|
G_DEPTOZSrg(zval, near, far, flag, zmin, zmax), }
|
||||||
|
|
||||||
@ -2337,18 +2341,18 @@ _DW({ \
|
|||||||
_DW({ \
|
_DW({ \
|
||||||
Gfx *_g = (Gfx *)(pkt); \
|
Gfx *_g = (Gfx *)(pkt); \
|
||||||
_g->words.w0 = _SHIFTL(G_RDPHALF_1,24,8); \
|
_g->words.w0 = _SHIFTL(G_RDPHALF_1,24,8); \
|
||||||
_g->words.w1 = (unsigned int)(dl); \
|
_g->words.w1 = (uintptr_t)(dl); \
|
||||||
_g = (Gfx *)(pkt); \
|
_g = (Gfx *)(pkt); \
|
||||||
_g->words.w0 = (_SHIFTL(G_BRANCH_Z,24,8)| \
|
_g->words.w0 = (_SHIFTL(G_BRANCH_Z,24,8)| \
|
||||||
_SHIFTL((vtx)*5,12,12)|_SHIFTL((vtx)*2,0,12)); \
|
_SHIFTL((vtx)*5,12,12)|_SHIFTL((vtx)*2,0,12)); \
|
||||||
_g->words.w1 = (unsigned int)(zval); \
|
_g->words.w1 = (uintptr_t)(zval); \
|
||||||
})
|
})
|
||||||
|
|
||||||
#define gsSPBranchLessZraw(dl, vtx, zval) \
|
#define gsSPBranchLessZraw(dl, vtx, zval) \
|
||||||
{ _SHIFTL(G_RDPHALF_1,24,8), \
|
{ _SHIFTL(G_RDPHALF_1,24,8), \
|
||||||
(unsigned int)(dl), }, \
|
(uintptr_t)(dl), }, \
|
||||||
{ _SHIFTL(G_BRANCH_Z,24,8)|_SHIFTL((vtx)*5,12,12)|_SHIFTL((vtx)*2,0,12),\
|
{ _SHIFTL(G_BRANCH_Z,24,8)|_SHIFTL((vtx)*5,12,12)|_SHIFTL((vtx)*2,0,12),\
|
||||||
(unsigned int)(zval), }
|
(uintptr_t)(zval), }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* gSPLoadUcode RSP loads specified ucode.
|
* gSPLoadUcode RSP loads specified ucode.
|
||||||
@ -2360,19 +2364,19 @@ _DW({ \
|
|||||||
_DW({ \
|
_DW({ \
|
||||||
Gfx *_g = (Gfx *)(pkt); \
|
Gfx *_g = (Gfx *)(pkt); \
|
||||||
_g->words.w0 = _SHIFTL(G_RDPHALF_1,24,8); \
|
_g->words.w0 = _SHIFTL(G_RDPHALF_1,24,8); \
|
||||||
_g->words.w1 = (unsigned int)(uc_dstart); \
|
_g->words.w1 = (uintptr_t)(uc_dstart); \
|
||||||
_g = (Gfx *)(pkt); \
|
_g = (Gfx *)(pkt); \
|
||||||
_g->words.w0 = (_SHIFTL(G_LOAD_UCODE,24,8)| \
|
_g->words.w0 = (_SHIFTL(G_LOAD_UCODE,24,8)| \
|
||||||
_SHIFTL((int)(uc_dsize)-1,0,16)); \
|
_SHIFTL((int)(uc_dsize)-1,0,16)); \
|
||||||
_g->words.w1 = (unsigned int)(uc_start); \
|
_g->words.w1 = (uintptr_t)(uc_start); \
|
||||||
})
|
})
|
||||||
|
|
||||||
#define gsSPLoadUcodeEx(uc_start, uc_dstart, uc_dsize) \
|
#define gsSPLoadUcodeEx(uc_start, uc_dstart, uc_dsize) \
|
||||||
{ _SHIFTL(G_RDPHALF_1,24,8), \
|
{ _SHIFTL(G_RDPHALF_1,24,8), \
|
||||||
(unsigned int)(uc_dstart), }, \
|
(uintptr_t)(uc_dstart), }, \
|
||||||
{ _SHIFTL(G_LOAD_UCODE,24,8)| \
|
{ _SHIFTL(G_LOAD_UCODE,24,8)| \
|
||||||
_SHIFTL((int)(uc_dsize)-1,0,16), \
|
_SHIFTL((int)(uc_dsize)-1,0,16), \
|
||||||
(unsigned int)(uc_start), }
|
(uintptr_t)(uc_start), }
|
||||||
|
|
||||||
#define gSPLoadUcode(pkt, uc_start, uc_dstart) \
|
#define gSPLoadUcode(pkt, uc_start, uc_dstart) \
|
||||||
gSPLoadUcodeEx((pkt), (uc_start), (uc_dstart), SP_UCODE_DATA_SIZE)
|
gSPLoadUcodeEx((pkt), (uc_start), (uc_dstart), SP_UCODE_DATA_SIZE)
|
||||||
@ -2396,14 +2400,14 @@ _DW({ \
|
|||||||
Gfx *_g = (Gfx *)(pkt); \
|
Gfx *_g = (Gfx *)(pkt); \
|
||||||
_g->words.w0 = _SHIFTL(G_DMA_IO,24,8)|_SHIFTL((flag),23,1)| \
|
_g->words.w0 = _SHIFTL(G_DMA_IO,24,8)|_SHIFTL((flag),23,1)| \
|
||||||
_SHIFTL((dmem)/8,13,10)|_SHIFTL((size)-1,0,12); \
|
_SHIFTL((dmem)/8,13,10)|_SHIFTL((size)-1,0,12); \
|
||||||
_g->words.w1 = (unsigned int)(dram); \
|
_g->words.w1 = (uintptr_t)(dram); \
|
||||||
})
|
})
|
||||||
|
|
||||||
#define gsSPDma_io(flag, dmem, dram, size) \
|
#define gsSPDma_io(flag, dmem, dram, size) \
|
||||||
{ \
|
{ \
|
||||||
_SHIFTL(G_DMA_IO,24,8)|_SHIFTL((flag),23,1)| \
|
_SHIFTL(G_DMA_IO,24,8)|_SHIFTL((flag),23,1)| \
|
||||||
_SHIFTL((dmem)/8,13,10)|_SHIFTL((size)-1,0,12), \
|
_SHIFTL((dmem)/8,13,10)|_SHIFTL((size)-1,0,12), \
|
||||||
(unsigned int)(dram) \
|
(uintptr_t)(dram) \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define gSPDmaRead(pkt,dmem,dram,size) gSPDma_io((pkt),0,(dmem),(dram),(size))
|
#define gSPDmaRead(pkt,dmem,dram,size) gSPDma_io((pkt),0,(dmem),(dram),(size))
|
||||||
@ -3018,14 +3022,14 @@ _DW({ \
|
|||||||
\
|
\
|
||||||
_g->words.w0 = _SHIFTL(cmd, 24, 8) | _SHIFTL(fmt, 21, 3) | \
|
_g->words.w0 = _SHIFTL(cmd, 24, 8) | _SHIFTL(fmt, 21, 3) | \
|
||||||
_SHIFTL(siz, 19, 2) | _SHIFTL((width)-1, 0, 12); \
|
_SHIFTL(siz, 19, 2) | _SHIFTL((width)-1, 0, 12); \
|
||||||
_g->words.w1 = (unsigned int)(i); \
|
_g->words.w1 = (uintptr_t)(i); \
|
||||||
})
|
})
|
||||||
|
|
||||||
#define gsSetImage(cmd, fmt, siz, width, i) \
|
#define gsSetImage(cmd, fmt, siz, width, i) \
|
||||||
{ \
|
{ \
|
||||||
_SHIFTL(cmd, 24, 8) | _SHIFTL(fmt, 21, 3) | \
|
_SHIFTL(cmd, 24, 8) | _SHIFTL(fmt, 21, 3) | \
|
||||||
_SHIFTL(siz, 19, 2) | _SHIFTL((width)-1, 0, 12), \
|
_SHIFTL(siz, 19, 2) | _SHIFTL((width)-1, 0, 12), \
|
||||||
(unsigned int)(i) \
|
(uintptr_t)(i) \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define gDPSetColorImage(pkt, f, s, w, i) gSetImage(pkt, G_SETCIMG, f, s, w, i)
|
#define gDPSetColorImage(pkt, f, s, w, i) gSetImage(pkt, G_SETCIMG, f, s, w, i)
|
||||||
|
@ -6,7 +6,23 @@
|
|||||||
#define OS_MESG_NOBLOCK 0
|
#define OS_MESG_NOBLOCK 0
|
||||||
#define OS_MESG_BLOCK 1
|
#define OS_MESG_BLOCK 1
|
||||||
|
|
||||||
typedef void* OSMesg;
|
typedef union {
|
||||||
|
u8 data8;
|
||||||
|
u16 data16;
|
||||||
|
u32 data32;
|
||||||
|
void* ptr;
|
||||||
|
} OSMesg;
|
||||||
|
|
||||||
|
#define OS_MESG_8(x) ((OSMesg) { .data8 = (x) })
|
||||||
|
#define OS_MESG_16(x) ((OSMesg) { .data16 = (x) })
|
||||||
|
#define OS_MESG_32(x) ((OSMesg) { .data32 = (x) })
|
||||||
|
#define OS_MESG_PTR(x) ((OSMesg) { .ptr = (x) })
|
||||||
|
|
||||||
|
#define osSendMesg8(queue, msg, flag) osSendMesg(queue, OS_MESG_8(msg), flag)
|
||||||
|
#define osSendMesg16(queue, msg, flag) osSendMesg(queue, OS_MESG_16(msg), flag)
|
||||||
|
#define osSendMesg32(queue, msg, flag) osSendMesg(queue, OS_MESG_32(msg), flag)
|
||||||
|
#define osSendMesgPtr(queue, msg, flag) osSendMesg(queue, OS_MESG_PTR(msg), flag)
|
||||||
|
|
||||||
typedef u32 OSEvent;
|
typedef u32 OSEvent;
|
||||||
|
|
||||||
#define OS_NUM_EVENTS 15
|
#define OS_NUM_EVENTS 15
|
||||||
|
@ -1586,7 +1586,7 @@ static void gfx_sp_movemem(uint8_t index, uint8_t offset, const void* data) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gfx_sp_moveword(uint8_t index, uint16_t offset, uint32_t data) {
|
static void gfx_sp_moveword(uint8_t index, uint16_t offset, uintptr_t data) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case G_MW_NUMLIGHT:
|
case G_MW_NUMLIGHT:
|
||||||
#ifdef F3DEX_GBI_2
|
#ifdef F3DEX_GBI_2
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
#include "U64/PR/ultra64/types.h"
|
#include "U64/PR/ultra64/types.h"
|
||||||
|
|
||||||
|
Binary file not shown.
4826
libultraship/libultraship/Lib/dr_libs/mp3.h
Normal file
4826
libultraship/libultraship/Lib/dr_libs/mp3.h
Normal file
File diff suppressed because it is too large
Load Diff
8418
libultraship/libultraship/Lib/dr_libs/wav.h
Normal file
8418
libultraship/libultraship/Lib/dr_libs/wav.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -74,7 +74,7 @@ namespace Ship
|
|||||||
// Create stream
|
// Create stream
|
||||||
pa_sample_spec ss;
|
pa_sample_spec ss;
|
||||||
ss.format = PA_SAMPLE_S16LE;
|
ss.format = PA_SAMPLE_S16LE;
|
||||||
ss.rate = 32000;
|
ss.rate = this->GetSampleRate();
|
||||||
ss.channels = 2;
|
ss.channels = 2;
|
||||||
|
|
||||||
pa_buffer_attr attr;
|
pa_buffer_attr attr;
|
||||||
@ -149,8 +149,7 @@ namespace Ship
|
|||||||
|
|
||||||
int PulseAudioPlayer::GetDesiredBuffered()
|
int PulseAudioPlayer::GetDesiredBuffered()
|
||||||
{
|
{
|
||||||
// return 1100;
|
return 2480;
|
||||||
return 1680;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PulseAudioPlayer::Play(const uint8_t* buff, uint32_t len)
|
void PulseAudioPlayer::Play(const uint8_t* buff, uint32_t len)
|
||||||
|
@ -49,7 +49,7 @@ namespace Ship
|
|||||||
{
|
{
|
||||||
auto res = (Ship::DisplayList*)resShared.get();
|
auto res = (Ship::DisplayList*)resShared.get();
|
||||||
|
|
||||||
Gfx* gfx = (Gfx*)&res->instructions[patches[i].index];
|
Gfx* gfx = &((Gfx*)res->instructions.data())[patches[i].index];
|
||||||
gfx->words.w1 = patches[i].origData;
|
gfx->words.w1 = patches[i].origData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,40 +2,40 @@
|
|||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
bool SDLAudioPlayer::Init(void) {
|
bool SDLAudioPlayer::Init(void) {
|
||||||
if (SDL_Init(SDL_INIT_AUDIO) != 0) {
|
if (SDL_Init(SDL_INIT_AUDIO) != 0) {
|
||||||
SPDLOG_ERROR("SDL init error: %s\n", SDL_GetError());
|
SPDLOG_ERROR("SDL init error: %s\n", SDL_GetError());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
SDL_AudioSpec want, have;
|
SDL_AudioSpec want, have;
|
||||||
SDL_zero(want);
|
SDL_zero(want);
|
||||||
want.freq = 32000;
|
want.freq = this->GetSampleRate();
|
||||||
want.format = AUDIO_S16;
|
want.format = AUDIO_S16;
|
||||||
want.channels = 2;
|
want.channels = 2;
|
||||||
want.samples = 1024;
|
want.samples = 1024;
|
||||||
want.callback = NULL;
|
want.callback = NULL;
|
||||||
Device = SDL_OpenAudioDevice(NULL, 0, &want, &have, 0);
|
Device = SDL_OpenAudioDevice(NULL, 0, &want, &have, 0);
|
||||||
if (Device == 0) {
|
if (Device == 0) {
|
||||||
SPDLOG_ERROR("SDL_OpenAudio error: {}", SDL_GetError());
|
SPDLOG_ERROR("SDL_OpenAudio error: {}", SDL_GetError());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
SDL_PauseAudioDevice(Device, 0);
|
SDL_PauseAudioDevice(Device, 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDLAudioPlayer::Buffered(void) {
|
int SDLAudioPlayer::Buffered(void) {
|
||||||
// 4 is sizeof(int16_t) * num_channels (2 for stereo)
|
// 4 is sizeof(int16_t) * num_channels (2 for stereo)
|
||||||
return SDL_GetQueuedAudioSize(Device) / 4;
|
return SDL_GetQueuedAudioSize(Device) / 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDLAudioPlayer::GetDesiredBuffered(void) {
|
int SDLAudioPlayer::GetDesiredBuffered(void) {
|
||||||
return 2480;
|
return 2480;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDLAudioPlayer::Play(const uint8_t* Buffer, uint32_t BufferLen) {
|
void SDLAudioPlayer::Play(const uint8_t* Buffer, uint32_t BufferLen) {
|
||||||
if (Buffered() < 6000) {
|
if (Buffered() < 6000) {
|
||||||
// Don't fill the audio buffer too much in case this happens
|
// Don't fill the audio buffer too much in case this happens
|
||||||
SDL_QueueAudio(Device, Buffer, BufferLen);
|
SDL_QueueAudio(Device, Buffer, BufferLen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,8 +30,8 @@ namespace Ship {
|
|||||||
WAVEFORMATEX desired;
|
WAVEFORMATEX desired;
|
||||||
desired.wFormatTag = WAVE_FORMAT_PCM;
|
desired.wFormatTag = WAVE_FORMAT_PCM;
|
||||||
desired.nChannels = 2;
|
desired.nChannels = 2;
|
||||||
desired.nSamplesPerSec = 44100;
|
desired.nSamplesPerSec = this->GetSampleRate();
|
||||||
desired.nAvgBytesPerSec = 44100 * 2 * 2;
|
desired.nAvgBytesPerSec = desired.nSamplesPerSec * 2 * 2;
|
||||||
desired.nBlockAlign = 4;
|
desired.nBlockAlign = 4;
|
||||||
desired.wBitsPerSample = 16;
|
desired.wBitsPerSample = 16;
|
||||||
desired.cbSize = 0;
|
desired.cbSize = 0;
|
||||||
@ -171,4 +171,4 @@ namespace Ship {
|
|||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -319,7 +319,7 @@ namespace Ship {
|
|||||||
GlobalCtx2::GetInstance()->GetWindow()->ToggleFullscreen();
|
GlobalCtx2::GetInstance()->GetWindow()->ToggleFullscreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// OTRTODO: Rig with Kirito's console?
|
// OTRTODO: Rig with Kirito's console?
|
||||||
//if (dwScancode == Ship::stoi(Conf["KEYBOARD SHORTCUTS"]["KEY_CONSOLE"])) {
|
//if (dwScancode == Ship::stoi(Conf["KEYBOARD SHORTCUTS"]["KEY_CONSOLE"])) {
|
||||||
|
@ -204,12 +204,13 @@
|
|||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<PreprocessorDefinitions>SPDLOG_ACTIVE_LEVEL=0;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;ENABLE_DX11;ENABLE_OPENGL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>SPDLOG_ACTIVE_LEVEL=0;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;ENABLE_OPENGL;ENABLE_DX11;%(PreprocessorDefinitions)GLEW_STATIC </PreprocessorDefinitions>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||||
<LanguageStandard_C>stdc17</LanguageStandard_C>
|
<LanguageStandard_C>stdc17</LanguageStandard_C>
|
||||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
|
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
@ -238,7 +239,7 @@
|
|||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<PreprocessorDefinitions>SPDLOG_ACTIVE_LEVEL=0;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;ENABLE_OPENGL;ENABLE_DX11;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>SPDLOG_ACTIVE_LEVEL=0;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;ENABLE_OPENGL;ENABLE_DX11;%(PreprocessorDefinitions)GLEW_STATIC</PreprocessorDefinitions>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||||
<LanguageStandard_C>stdc11</LanguageStandard_C>
|
<LanguageStandard_C>stdc11</LanguageStandard_C>
|
||||||
@ -351,6 +352,8 @@
|
|||||||
<ClInclude Include="GameOverlay.h" />
|
<ClInclude Include="GameOverlay.h" />
|
||||||
<ClInclude Include="GameSettings.h" />
|
<ClInclude Include="GameSettings.h" />
|
||||||
<ClInclude Include="GameVersions.h" />
|
<ClInclude Include="GameVersions.h" />
|
||||||
|
<ClInclude Include="Lib\dr_libs\mp3.h" />
|
||||||
|
<ClInclude Include="Lib\dr_libs\wav.h" />
|
||||||
<ClInclude Include="Lib\ImGui\backends\imgui_impl_dx11.h" />
|
<ClInclude Include="Lib\ImGui\backends\imgui_impl_dx11.h" />
|
||||||
<ClInclude Include="Lib\ImGui\backends\imgui_impl_win32.h" />
|
<ClInclude Include="Lib\ImGui\backends\imgui_impl_win32.h" />
|
||||||
<ClInclude Include="Lib\stb\stb_image_write.h" />
|
<ClInclude Include="Lib\stb\stb_image_write.h" />
|
||||||
|
@ -91,6 +91,9 @@
|
|||||||
<Filter Include="Source Files\CustomImpl\Overlay">
|
<Filter Include="Source Files\CustomImpl\Overlay">
|
||||||
<UniqueIdentifier>{3285ab8a-06d8-4dac-9af9-efb2a9723ab1}</UniqueIdentifier>
|
<UniqueIdentifier>{3285ab8a-06d8-4dac-9af9-efb2a9723ab1}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter Include="Source Files\Lib\dr_libs">
|
||||||
|
<UniqueIdentifier>{db6e02cc-fc4c-4138-8219-1d281ad93ec2}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="Factories\MaterialFactory.cpp">
|
<ClCompile Include="Factories\MaterialFactory.cpp">
|
||||||
@ -650,5 +653,11 @@
|
|||||||
<ClInclude Include="Factories\AudioFactory.h">
|
<ClInclude Include="Factories\AudioFactory.h">
|
||||||
<Filter>Header Files\Resources\Factories</Filter>
|
<Filter>Header Files\Resources\Factories</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="Lib\dr_libs\mp3.h">
|
||||||
|
<Filter>Source Files\Lib\dr_libs</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="Lib\dr_libs\wav.h">
|
||||||
|
<Filter>Source Files\Lib\dr_libs</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
26
soh/Makefile
26
soh/Makefile
@ -7,6 +7,7 @@ ZAPD := ../ZAPDTR/ZAPD.out
|
|||||||
|
|
||||||
LIBULTRASHIP := ../libultraship/libultraship.a
|
LIBULTRASHIP := ../libultraship/libultraship.a
|
||||||
ZAPDUTILS := ../ZAPDTR/ZAPDUtils/ZAPDUtils.a
|
ZAPDUTILS := ../ZAPDTR/ZAPDUtils/ZAPDUtils.a
|
||||||
|
LIBSTORM := ../StormLib/build/libstorm.a
|
||||||
|
|
||||||
ASAN ?= 0
|
ASAN ?= 0
|
||||||
DEBUG ?= 1
|
DEBUG ?= 1
|
||||||
@ -16,11 +17,11 @@ LTO ?= 0
|
|||||||
WARN := \
|
WARN := \
|
||||||
-Wno-return-type \
|
-Wno-return-type \
|
||||||
-funsigned-char \
|
-funsigned-char \
|
||||||
-m32 -mhard-float -fno-stack-protector -fno-common -fno-zero-initialized-in-bss -fno-strict-aliasing -fno-inline-functions -fno-inline-small-functions -fno-toplevel-reorder -ffreestanding -fwrapv \
|
-mhard-float -fno-stack-protector -fno-common -fno-zero-initialized-in-bss -fno-strict-aliasing -fno-inline-functions -fno-inline-small-functions -fno-toplevel-reorder -ffreestanding -fwrapv \
|
||||||
|
|
||||||
CXXFLAGS := $(WARN) -std=c++20 -D_GNU_SOURCE -fpermissive -no-pie -nostdlib -march=i386 -msse2 -mfpmath=sse
|
CXXFLAGS := $(WARN) -std=c++20 -D_GNU_SOURCE -fpermissive -no-pie -nostdlib -msse2 -mfpmath=sse
|
||||||
CFLAGS := $(WARN) -std=c99 -D_GNU_SOURCE -no-pie -nostdlib -march=i386 -msse2 -mfpmath=sse
|
CFLAGS := $(WARN) -std=c99 -D_GNU_SOURCE -no-pie -nostdlib -msse2 -mfpmath=sse
|
||||||
LDFLAGS := -m32
|
LDFLAGS :=
|
||||||
CPPFLAGS := -MMD
|
CPPFLAGS := -MMD
|
||||||
|
|
||||||
ifneq ($(DEBUG),0)
|
ifneq ($(DEBUG),0)
|
||||||
@ -30,11 +31,13 @@ endif
|
|||||||
|
|
||||||
ifneq ($(ASAN),0)
|
ifneq ($(ASAN),0)
|
||||||
CXXFLAGS += -fsanitize=address
|
CXXFLAGS += -fsanitize=address
|
||||||
|
CFLAGS += -fsanitize=address
|
||||||
LDFLAGS += -fsanitize=address
|
LDFLAGS += -fsanitize=address
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(LTO),0)
|
ifneq ($(LTO),0)
|
||||||
CXXFLAGS += -flto
|
CXXFLAGS += -flto
|
||||||
|
CFLAGS += -flto
|
||||||
LDFLAGS += -flto
|
LDFLAGS += -flto
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -54,12 +57,12 @@ INC_DIRS := $(addprefix -I, \
|
|||||||
)
|
)
|
||||||
|
|
||||||
LDDIRS := $(addprefix -L, \
|
LDDIRS := $(addprefix -L, \
|
||||||
../external \
|
|
||||||
../libultraship/ \
|
../libultraship/ \
|
||||||
)
|
)
|
||||||
|
|
||||||
LDLIBS := \
|
LDLIBS := \
|
||||||
$(ZAPDUTILS) \
|
$(ZAPDUTILS) \
|
||||||
|
$(LIBSTORM) \
|
||||||
$(addprefix -l, \
|
$(addprefix -l, \
|
||||||
X11 \
|
X11 \
|
||||||
dl \
|
dl \
|
||||||
@ -70,7 +73,6 @@ LDLIBS := \
|
|||||||
SDL2 \
|
SDL2 \
|
||||||
GL \
|
GL \
|
||||||
GLEW \
|
GLEW \
|
||||||
storm \
|
|
||||||
pulse\
|
pulse\
|
||||||
ultraship \
|
ultraship \
|
||||||
) \
|
) \
|
||||||
@ -87,14 +89,14 @@ TEXTURE_FILES_OUT := $(foreach f,$(TEXTURE_FILES_PNG:.png=.inc.c),build/$f) \
|
|||||||
$(foreach f,$(TEXTURE_FILES_JPG:.jpg=.jpg.inc.c),build/$f) \
|
$(foreach f,$(TEXTURE_FILES_JPG:.jpg=.jpg.inc.c),build/$f) \
|
||||||
|
|
||||||
CXX_FILES := \
|
CXX_FILES := \
|
||||||
$(shell find soh -type f -name *.cpp)
|
$(shell find soh -type f -name "*.cpp")
|
||||||
|
|
||||||
C_FILES := \
|
C_FILES := \
|
||||||
$(shell find soh -type f -name *.c) \
|
$(shell find soh -type f -name "*.c") \
|
||||||
$(shell find src/boot -type f -name *.c) \
|
$(shell find src/boot -type f -name "*.c") \
|
||||||
$(shell find src/buffers -type f -name *.c) \
|
$(shell find src/buffers -type f -name "*.c") \
|
||||||
$(shell find src/code -type f -name *.c) \
|
$(shell find src/code -type f -name "*.c") \
|
||||||
$(shell find src/overlays -type f -name *.c) \
|
$(shell find src/overlays -type f -name "*.c") \
|
||||||
src/libultra/gu/coss.c \
|
src/libultra/gu/coss.c \
|
||||||
src/libultra/gu/guLookAt.c \
|
src/libultra/gu/guLookAt.c \
|
||||||
src/libultra/gu/guLookAtHilite.c \
|
src/libultra/gu/guLookAtHilite.c \
|
||||||
|
@ -1433,7 +1433,7 @@
|
|||||||
<Offset Version="MQDebug" At="0"/>
|
<Offset Version="MQDebug" At="0"/>
|
||||||
</Sample>
|
</Sample>
|
||||||
</Samples>
|
</Samples>
|
||||||
|
|
||||||
<Samples Bank="3">
|
<Samples Bank="3">
|
||||||
<Sample Name="Low Rumbling">
|
<Sample Name="Low Rumbling">
|
||||||
<Offset Version="MQDebug" At="0"/>
|
<Offset Version="MQDebug" At="0"/>
|
||||||
@ -1515,9 +1515,9 @@
|
|||||||
</Samples>
|
</Samples>
|
||||||
|
|
||||||
|
|
||||||
<Soundfont Name="02_Ambient_Sounds" Index="2"/>
|
<Soundfont Name="02_Ambient_Sounds" Index="2"/>
|
||||||
<Soundfont Name="37_Unused_Deku_Tree" Index="37" OverrideSampleBank="2"/>
|
<Soundfont Name="37_Unused_Deku_Tree" Index="37" OverrideSampleBank="2"/>
|
||||||
<Soundfont Name="04_Deku_Tree" Index="4"/>
|
<Soundfont Name="04_Deku_Tree" Index="4"/>
|
||||||
<Soundfont Name="11_Dodongos_Cavern" Index="11"/>
|
<Soundfont Name="11_Dodongos_Cavern" Index="11"/>
|
||||||
<Soundfont Name="33_Ending_1" Index="33"/>
|
<Soundfont Name="33_Ending_1" Index="33"/>
|
||||||
<Soundfont Name="34_Ending_2" Index="34"/>
|
<Soundfont Name="34_Ending_2" Index="34"/>
|
||||||
@ -1553,8 +1553,6 @@
|
|||||||
<Soundfont Name="18_Warp_Songs" Index="18"/>
|
<Soundfont Name="18_Warp_Songs" Index="18"/>
|
||||||
<Soundfont Name="25_Water_Temple" Index="25"/>
|
<Soundfont Name="25_Water_Temple" Index="25"/>
|
||||||
<Soundfont Name="21_Zoras_Domain" Index="21"/>
|
<Soundfont Name="21_Zoras_Domain" Index="21"/>
|
||||||
|
|
||||||
|
|
||||||
</Audio>
|
</Audio>
|
||||||
</File>
|
</File>
|
||||||
</Root>
|
</Root>
|
||||||
|
@ -113,8 +113,6 @@
|
|||||||
<Sequence Name="108_Timed_Minigame"/>
|
<Sequence Name="108_Timed_Minigame"/>
|
||||||
<Sequence Name="109_Cutscene_Effects"/>
|
<Sequence Name="109_Cutscene_Effects"/>
|
||||||
</Sequences>
|
</Sequences>
|
||||||
|
|
||||||
|
|
||||||
<Samples Bank="0">
|
<Samples Bank="0">
|
||||||
<Sample Name="Bird Chirp 1">
|
<Sample Name="Bird Chirp 1">
|
||||||
<Offset Version="MQDebug" At="0"/>
|
<Offset Version="MQDebug" At="0"/>
|
||||||
|
@ -1900,7 +1900,7 @@ void AudioHeap_AllocPoolInit(AudioAllocPool* pool, void* mem, size_t size);
|
|||||||
void AudioHeap_PersistentCacheClear(AudioPersistentCache* persistent);
|
void AudioHeap_PersistentCacheClear(AudioPersistentCache* persistent);
|
||||||
void AudioHeap_TemporaryCacheClear(AudioTemporaryCache* temporary);
|
void AudioHeap_TemporaryCacheClear(AudioTemporaryCache* temporary);
|
||||||
void AudioHeap_PopCache(s32 tableType);
|
void AudioHeap_PopCache(s32 tableType);
|
||||||
void AudioHeap_InitMainPools(ptrdiff_t sizeForAudioInitPool);
|
void AudioHeap_InitMainPools(size_t sizeForAudioInitPool);
|
||||||
void* AudioHeap_AllocCached(s32 tableType, ptrdiff_t size, s32 cache, s32 id);
|
void* AudioHeap_AllocCached(s32 tableType, ptrdiff_t size, s32 cache, s32 id);
|
||||||
void* AudioHeap_SearchCaches(s32 tableType, s32 arg1, s32 id);
|
void* AudioHeap_SearchCaches(s32 tableType, s32 arg1, s32 id);
|
||||||
void* AudioHeap_SearchRegularCaches(s32 tableType, s32 cache, s32 id);
|
void* AudioHeap_SearchRegularCaches(s32 tableType, s32 cache, s32 id);
|
||||||
@ -1912,7 +1912,7 @@ void* AudioHeap_AllocPermanent(s32 tableType, s32 id, size_t size);
|
|||||||
void* AudioHeap_AllocSampleCache(size_t size, s32 fontId, void* sampleAddr, s8 medium, s32 cache);
|
void* AudioHeap_AllocSampleCache(size_t size, s32 fontId, void* sampleAddr, s8 medium, s32 cache);
|
||||||
void AudioHeap_ApplySampleBankCache(s32 sampleBankId);
|
void AudioHeap_ApplySampleBankCache(s32 sampleBankId);
|
||||||
void AudioLoad_DecreaseSampleDmaTtls(void);
|
void AudioLoad_DecreaseSampleDmaTtls(void);
|
||||||
void* AudioLoad_DmaSampleData(u32 devAddr, size_t size, s32 arg2, u8* dmaIndexRef, s32 medium);
|
uintptr_t AudioLoad_DmaSampleData(uintptr_t devAddr, size_t size, s32 arg2, u8* dmaIndexRef, s32 medium);
|
||||||
void AudioLoad_InitSampleDmaBuffers(s32 arg0);
|
void AudioLoad_InitSampleDmaBuffers(s32 arg0);
|
||||||
s32 AudioLoad_IsFontLoadComplete(s32 fontId);
|
s32 AudioLoad_IsFontLoadComplete(s32 fontId);
|
||||||
s32 AudioLoad_IsSeqLoadComplete(s32 seqId);
|
s32 AudioLoad_IsSeqLoadComplete(s32 seqId);
|
||||||
@ -1929,7 +1929,7 @@ s32 AudioLoad_SyncInitSeqPlayer(s32 playerIdx, s32 seqId, s32 arg2);
|
|||||||
s32 AudioLoad_SyncInitSeqPlayerSkipTicks(s32 playerIdx, s32 seqId, s32 arg2);
|
s32 AudioLoad_SyncInitSeqPlayerSkipTicks(s32 playerIdx, s32 seqId, s32 arg2);
|
||||||
void AudioLoad_ProcessLoads(s32 resetStatus);
|
void AudioLoad_ProcessLoads(s32 resetStatus);
|
||||||
void AudioLoad_SetDmaHandler(DmaHandler callback);
|
void AudioLoad_SetDmaHandler(DmaHandler callback);
|
||||||
void AudioLoad_Init(void* heap, u32 heapSize);
|
void AudioLoad_Init(void* heap, size_t heapSize);
|
||||||
void AudioLoad_InitSlowLoads(void);
|
void AudioLoad_InitSlowLoads(void);
|
||||||
s32 AudioLoad_SlowLoadSample(s32 arg0, s32 arg1, s8* arg2);
|
s32 AudioLoad_SlowLoadSample(s32 arg0, s32 arg1, s8* arg2);
|
||||||
s32 AudioLoad_SlowLoadSeq(s32 playerIdx, u8* ramAddr, s8* arg2);
|
s32 AudioLoad_SlowLoadSeq(s32 playerIdx, u8* ramAddr, s8* arg2);
|
||||||
@ -2167,10 +2167,10 @@ f32 Math_FAtanF(f32 x);
|
|||||||
f32 Math_FAtan2F(f32 y, f32 x);
|
f32 Math_FAtan2F(f32 y, f32 x);
|
||||||
f32 Math_FAsinF(f32 x);
|
f32 Math_FAsinF(f32 x);
|
||||||
f32 Math_FAcosF(f32 x);
|
f32 Math_FAcosF(f32 x);
|
||||||
f32 ceilf(f32 x);
|
/*f32 ceilf(f32 x);
|
||||||
f32 truncf(f32 x);
|
f32 truncf(f32 x);
|
||||||
f32 roundf(f32 x);
|
f32 roundf(f32 x);
|
||||||
f32 nearbyintf(f32 x);
|
f32 nearbyintf(f32 x);*/
|
||||||
void SystemArena_CheckPointer(void* ptr, size_t size, const char* name, const char* action);
|
void SystemArena_CheckPointer(void* ptr, size_t size, const char* name, const char* action);
|
||||||
void* SystemArena_Malloc(size_t size);
|
void* SystemArena_Malloc(size_t size);
|
||||||
void* SystemArena_MallocDebug(size_t size, const char* file, s32 line);
|
void* SystemArena_MallocDebug(size_t size, const char* file, s32 line);
|
||||||
|
@ -30,8 +30,11 @@
|
|||||||
#include "ichain.h"
|
#include "ichain.h"
|
||||||
#include "regs.h"
|
#include "regs.h"
|
||||||
|
|
||||||
//#define AUDIO_HEAP_SIZE 0x38000
|
#if defined(_WIN64) || defined(__x86_64__) || defined(__arm64__)
|
||||||
#define AUDIO_HEAP_SIZE 0x3800000 // The original audio heap size was too small. The heap would exceed capacity and corrupt everything in its path.
|
#define _SOH64
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define AUDIO_HEAP_SIZE 0x3800000
|
||||||
#define SYSTEM_HEAP_SIZE (1024 * 1024 * 4)
|
#define SYSTEM_HEAP_SIZE (1024 * 1024 * 4)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@ -537,9 +540,9 @@ typedef enum {
|
|||||||
/* 4 */ TEXT_STATE_CHOICE,
|
/* 4 */ TEXT_STATE_CHOICE,
|
||||||
/* 5 */ TEXT_STATE_EVENT,
|
/* 5 */ TEXT_STATE_EVENT,
|
||||||
/* 6 */ TEXT_STATE_DONE,
|
/* 6 */ TEXT_STATE_DONE,
|
||||||
/* 7 */ TEXT_STATE_SONG_DEMO_DONE,
|
/* 7 */ TEXT_STATE_SONG_DEMO_DONE,
|
||||||
/* 8 */ TEXT_STATE_8,
|
/* 8 */ TEXT_STATE_8,
|
||||||
/* 9 */ TEXT_STATE_9,
|
/* 9 */ TEXT_STATE_9,
|
||||||
/* 10 */ TEXT_STATE_AWAITING_NEXT
|
/* 10 */ TEXT_STATE_AWAITING_NEXT
|
||||||
} TextState;
|
} TextState;
|
||||||
|
|
||||||
|
@ -112,8 +112,8 @@ typedef struct {
|
|||||||
} AdsrEnvelope; // size = 0x4
|
} AdsrEnvelope; // size = 0x4
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* 0x00 */ u32 start;
|
/* 0x00 */ uintptr_t start;
|
||||||
/* 0x04 */ u32 end;
|
/* 0x04 */ uintptr_t end;
|
||||||
/* 0x08 */ u32 count;
|
/* 0x08 */ u32 count;
|
||||||
/* 0x0C */ char unk_0C[0x4];
|
/* 0x0C */ char unk_0C[0x4];
|
||||||
/* 0x10 */ s16 state[16]; // only exists if count != 0. 8-byte aligned
|
/* 0x10 */ s16 state[16]; // only exists if count != 0. 8-byte aligned
|
||||||
@ -150,7 +150,7 @@ typedef struct {
|
|||||||
/* 0x04 */ union {
|
/* 0x04 */ union {
|
||||||
u32 tuningAsU32;
|
u32 tuningAsU32;
|
||||||
f32 tuning;// frequency scale factor
|
f32 tuning;// frequency scale factor
|
||||||
};
|
};
|
||||||
} SoundFontSound; // size = 0x8
|
} SoundFontSound; // size = 0x8
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -696,7 +696,7 @@ typedef struct {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
union {
|
union {
|
||||||
void* data;
|
u32 data;
|
||||||
f32 asFloat;
|
f32 asFloat;
|
||||||
s32 asInt;
|
s32 asInt;
|
||||||
struct {
|
struct {
|
||||||
@ -720,10 +720,10 @@ typedef struct {
|
|||||||
/* 0x01 */ s8 delay;
|
/* 0x01 */ s8 delay;
|
||||||
/* 0x02 */ s8 medium;
|
/* 0x02 */ s8 medium;
|
||||||
/* 0x04 */ u8* ramAddr;
|
/* 0x04 */ u8* ramAddr;
|
||||||
/* 0x08 */ u32 curDevAddr;
|
/* 0x08 */ u8* curDevAddr;
|
||||||
/* 0x0C */ u8* curRamAddr;
|
/* 0x0C */ u8* curRamAddr;
|
||||||
/* 0x10 */ u32 bytesRemaining;
|
/* 0x10 */ size_t bytesRemaining;
|
||||||
/* 0x14 */ u32 chunkSize;
|
/* 0x14 */ size_t chunkSize;
|
||||||
/* 0x18 */ s32 unkMediumParam;
|
/* 0x18 */ s32 unkMediumParam;
|
||||||
/* 0x1C */ u32 retMsg;
|
/* 0x1C */ u32 retMsg;
|
||||||
/* 0x20 */ OSMesgQueue* retQueue;
|
/* 0x20 */ OSMesgQueue* retQueue;
|
||||||
@ -737,7 +737,7 @@ typedef struct {
|
|||||||
/* 0x01 */ u8 seqOrFontId;
|
/* 0x01 */ u8 seqOrFontId;
|
||||||
/* 0x02 */ u16 instId;
|
/* 0x02 */ u16 instId;
|
||||||
/* 0x04 */ s32 unkMediumParam;
|
/* 0x04 */ s32 unkMediumParam;
|
||||||
/* 0x08 */ s32 curDevAddr;
|
/* 0x08 */ u8* curDevAddr;
|
||||||
/* 0x0C */ u8* curRamAddr;
|
/* 0x0C */ u8* curRamAddr;
|
||||||
/* 0x10 */ u8* ramAddr;
|
/* 0x10 */ u8* ramAddr;
|
||||||
/* 0x14 */ s32 status;
|
/* 0x14 */ s32 status;
|
||||||
@ -886,7 +886,7 @@ typedef struct {
|
|||||||
/* 0x351C */ s32 audioResetFadeOutFramesLeft;
|
/* 0x351C */ s32 audioResetFadeOutFramesLeft;
|
||||||
/* 0x3520 */ f32* unk_3520;
|
/* 0x3520 */ f32* unk_3520;
|
||||||
/* 0x3524 */ u8* audioHeap;
|
/* 0x3524 */ u8* audioHeap;
|
||||||
/* 0x3528 */ u32 audioHeapSize;
|
/* 0x3528 */ size_t audioHeapSize;
|
||||||
/* 0x352C */ Note* notes;
|
/* 0x352C */ Note* notes;
|
||||||
/* 0x3530 */ SequencePlayer seqPlayers[4];
|
/* 0x3530 */ SequencePlayer seqPlayers[4];
|
||||||
/* 0x3AB0 */ SequenceLayer sequenceLayers[64];
|
/* 0x3AB0 */ SequenceLayer sequenceLayers[64];
|
||||||
@ -924,9 +924,9 @@ typedef struct {
|
|||||||
} NoteSubAttributes; // size = 0x18
|
} NoteSubAttributes; // size = 0x18
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* 0x00 */ u32 heapSize;
|
/* 0x00 */ size_t heapSize;
|
||||||
/* 0x04 */ u32 initPoolSize;
|
/* 0x04 */ size_t initPoolSize;
|
||||||
/* 0x08 */ u32 permanentPoolSize;
|
/* 0x08 */ size_t permanentPoolSize;
|
||||||
} AudioContextInitSizes; // size = 0xC
|
} AudioContextInitSizes; // size = 0xC
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -55,7 +55,7 @@ typedef enum {
|
|||||||
/* 0x1E */ CAM_SET_CRAWLSPACE, // Used in all crawlspaces "RAIL3"
|
/* 0x1E */ CAM_SET_CRAWLSPACE, // Used in all crawlspaces "RAIL3"
|
||||||
/* 0x1F */ CAM_SET_START0, // Data is given in Temple of Time, but no surface uses it
|
/* 0x1F */ CAM_SET_START0, // Data is given in Temple of Time, but no surface uses it
|
||||||
/* 0x20 */ CAM_SET_START1, // Scene/room door transitions that snap the camera to a fixed location (example: ganon's towers doors climbing up)
|
/* 0x20 */ CAM_SET_START1, // Scene/room door transitions that snap the camera to a fixed location (example: ganon's towers doors climbing up)
|
||||||
/* 0x21 */ CAM_SET_FREE0, // Full manual control is given over the camera
|
/* 0x21 */ CAM_SET_FREE0, // Full manual control is given over the camera
|
||||||
/* 0x22 */ CAM_SET_FREE2, // Various OnePoint Cutscenes, 10 total (example: falling chest)
|
/* 0x22 */ CAM_SET_FREE2, // Various OnePoint Cutscenes, 10 total (example: falling chest)
|
||||||
/* 0x23 */ CAM_SET_PIVOT_CORNER, // Inside the carpenter jail cells from theives hideout "CIRCLE4"
|
/* 0x23 */ CAM_SET_PIVOT_CORNER, // Inside the carpenter jail cells from theives hideout "CIRCLE4"
|
||||||
/* 0x24 */ CAM_SET_PIVOT_WATER_SURFACE, // Player diving from the surface of the water to underwater "CIRCLE5"
|
/* 0x24 */ CAM_SET_PIVOT_WATER_SURFACE, // Player diving from the surface of the water to underwater "CIRCLE5"
|
||||||
@ -391,7 +391,7 @@ typedef struct {
|
|||||||
{ groundAtLerpStepScale, CAM_DATA_GROUND_AT_LERP_STEP_SCALE }
|
{ groundAtLerpStepScale, CAM_DATA_GROUND_AT_LERP_STEP_SCALE }
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* 0x00 */ SwingAnimation swing;
|
/* 0x00 */ SwingAnimation swing;
|
||||||
/* 0x1C */ f32 unk_1C;
|
/* 0x1C */ f32 unk_1C;
|
||||||
/* 0x20 */ VecSph unk_20;
|
/* 0x20 */ VecSph unk_20;
|
||||||
@ -403,7 +403,7 @@ typedef struct {
|
|||||||
/* 0x08 */ f32 distMax;
|
/* 0x08 */ f32 distMax;
|
||||||
/* 0x0C */ f32 yawUpateRateTarget;
|
/* 0x0C */ f32 yawUpateRateTarget;
|
||||||
/* 0x10 */ f32 maxYawUpdate;
|
/* 0x10 */ f32 maxYawUpdate;
|
||||||
/* 0x14 */ f32 unk_14; // never used.
|
/* 0x14 */ f32 unk_14; // never used.
|
||||||
/* 0x18 */ f32 atLERPScaleMax;
|
/* 0x18 */ f32 atLERPScaleMax;
|
||||||
/* 0x1C */ s16 interfaceFlags;
|
/* 0x1C */ s16 interfaceFlags;
|
||||||
/* 0x20 */ Jump1Anim anim;
|
/* 0x20 */ Jump1Anim anim;
|
||||||
@ -954,7 +954,7 @@ typedef struct {
|
|||||||
* 0x2: Add atTargetInit to view's lookAt
|
* 0x2: Add atTargetInit to view's lookAt
|
||||||
* if initFlags & 0x6060: use world for focus point
|
* if initFlags & 0x6060: use world for focus point
|
||||||
* 0x3: Add atTargetInit to camera's at
|
* 0x3: Add atTargetInit to camera's at
|
||||||
* 0x4: Don't update targets?
|
* 0x4: Don't update targets?
|
||||||
* 0x8: flag to use atTagetInit as f32 pitch, yaw, r
|
* 0x8: flag to use atTagetInit as f32 pitch, yaw, r
|
||||||
* 0x10: ? unused
|
* 0x10: ? unused
|
||||||
* 0x20: focus on player
|
* 0x20: focus on player
|
||||||
@ -1033,7 +1033,7 @@ typedef struct {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
/* 0x0 */ s16 interfaceFlags;
|
/* 0x0 */ s16 interfaceFlags;
|
||||||
/* 0x2 */ s16 unk_02;
|
/* 0x2 */ s16 unk_02;
|
||||||
/* 0x4 */ Demo6Anim anim;
|
/* 0x4 */ Demo6Anim anim;
|
||||||
} Demo6; // size = 0x14
|
} Demo6; // size = 0x14
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -1157,7 +1157,7 @@ typedef struct {
|
|||||||
} CamColChk; // size = 0x28
|
} CamColChk; // size = 0x28
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* 0x000 */ char paramData[0x50];
|
/* 0x000 */ char paramData[0x14 * sizeof(void*)];
|
||||||
/* 0x050 */ Vec3f at;
|
/* 0x050 */ Vec3f at;
|
||||||
/* 0x05C */ Vec3f eye;
|
/* 0x05C */ Vec3f eye;
|
||||||
/* 0x068 */ Vec3f up;
|
/* 0x068 */ Vec3f up;
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<EnableASAN>false</EnableASAN>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
@ -53,6 +54,7 @@
|
|||||||
<PlatformToolset>v142</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<EnableASAN>false</EnableASAN>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
@ -85,13 +87,15 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<LinkIncremental>true</LinkIncremental>
|
<LinkIncremental>true</LinkIncremental>
|
||||||
<IncludePath>$(ProjectDir)assets;$(ProjectDir)build;$(ProjectDir)include;$(ProjectDir)src;$(ProjectDir);$(ProjectDir)..\libultraship\libultraship;$(ProjectDir)..\libultraship\libultraship\Lib\spdlog\include;$(ProjectDir)..\ZAPDTR\ZAPDUtils;$(ProjectDir)..\libultraship\libultraship\Lib\Fast3D\U64;$(ProjectDir)..\libultraship\libultraship\Lib\Fast3D\U64\PR;$(IncludePath)</IncludePath>
|
<IncludePath>$(ProjectDir)assets;$(ProjectDir)build;$(ProjectDir)include;$(ProjectDir)src;$(ProjectDir);$(ProjectDir)..\libultraship\libultraship\Lib\libjpeg\include;$(ProjectDir)..\libultraship\libultraship;$(ProjectDir)..\libultraship\libultraship\Lib\spdlog\include;$(ProjectDir)..\ZAPDTR\ZAPDUtils;$(ProjectDir)..\libultraship\libultraship\Lib\Fast3D\U64;$(ProjectDir)..\libultraship\libultraship\Lib\Fast3D\U64\PR;$(ProjectDir)..\libultraship\libultraship\Lib\SDL;$(IncludePath)</IncludePath>
|
||||||
<LibraryPath>$(OutDir);$(ProjectDir)..\libultraship\libultraship;$(ProjectDir)..\libultraship\libultraship\Lib\SDL\lib\x64;$(ProjectDir)..\libultraship\libultraship\Lib\GLEW\x64;$(ProjectDir)..\libultraship\libultraship\Lib\GLFW;$(LibraryPath)</LibraryPath>
|
<LibraryPath>$(OutDir);$(ProjectDir)..\libultraship\libultraship;$(ProjectDir)..\libultraship\libultraship\Lib\SDL\lib\x64;$(ProjectDir)..\libultraship\libultraship\Lib\GLEW\x64;$(ProjectDir)..\libultraship\libultraship\Lib\GLFW;$(ProjectDir)..\StormLib\bin\StormLib\x64\DebugUS\;$(LibraryPath)</LibraryPath>
|
||||||
|
<IntDir>$(Platform)\$(Configuration)Obj\</IntDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
<IncludePath>$(ProjectDir)assets;$(ProjectDir)build;$(ProjectDir)include;$(ProjectDir)src;$(ProjectDir);$(ProjectDir)..\libultraship\libultraship;$(ProjectDir)..\libultraship\libultraship\Lib\spdlog\include;$(ProjectDir)..\ZAPDTR\ZAPDUtils;$(ProjectDir)..\libultraship\libultraship\Lib\Fast3D\U64;$(ProjectDir)..\libultraship\libultraship\Lib\Fast3D\U64\PR;$(IncludePath)</IncludePath>
|
<IncludePath>$(ProjectDir)assets;$(ProjectDir)build;$(ProjectDir)include;$(ProjectDir)src;$(ProjectDir);$(ProjectDir)..\libultraship\libultraship\Lib\libjpeg\include;$(ProjectDir)..\libultraship\libultraship;$(ProjectDir)..\libultraship\libultraship\Lib\spdlog\include;$(ProjectDir)..\ZAPDTR\ZAPDUtils;$(ProjectDir)..\libultraship\libultraship\Lib\Fast3D\U64;$(ProjectDir)..\libultraship\libultraship\Lib\Fast3D\U64\PR;$(ProjectDir)..\libultraship\libultraship\Lib\SDL;$(ProjectDir)..\libultraship\libultraship\Lib\dr_libs;$(IncludePath)</IncludePath>
|
||||||
<LibraryPath>$(OutDir);$(ProjectDir)..\libultraship\libultraship;$(ProjectDir)..\libultraship\libultraship\Lib\SDL\lib\x64;$(ProjectDir)..\libultraship\libultraship\Lib\GLEW\x64;$(ProjectDir)..\libultraship\libultraship\Lib\GLFW;$(LibraryPath)</LibraryPath>
|
<LibraryPath>$(OutDir);$(ProjectDir)..\libultraship\libultraship;$(ProjectDir)..\libultraship\libultraship\Lib\SDL\lib\x64;$(ProjectDir)..\libultraship\libultraship\Lib\GLEW\x64;$(ProjectDir)..\libultraship\libultraship\Lib\GLFW;$(ProjectDir)..\StormLib\bin\StormLib\x64\ReleaseUS\;$(LibraryPath)</LibraryPath>
|
||||||
|
<IntDir>$(Platform)\$(Configuration)Obj\</IntDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
@ -102,12 +106,12 @@
|
|||||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
<BasicRuntimeChecks>StackFrameRuntimeCheck</BasicRuntimeChecks>
|
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>libultraship.lib;ZAPDUtils.lib;opengl32.lib;glu32.lib;SDL2.lib;SDL2main.lib;glfw3dll.lib;glew32s.lib;winmm.lib;imm32.lib;version.lib;setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>libultraship.lib;ZAPDUtils.lib;opengl32.lib;glu32.lib;SDL2.lib;SDL2main.lib;glew32s.lib;winmm.lib;imm32.lib;version.lib;setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<StackReserveSize>8777216</StackReserveSize>
|
<StackReserveSize>8777216</StackReserveSize>
|
||||||
<GenerateMapFile>true</GenerateMapFile>
|
<GenerateMapFile>true</GenerateMapFile>
|
||||||
<MapExports>true</MapExports>
|
<MapExports>true</MapExports>
|
||||||
@ -131,7 +135,7 @@
|
|||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>libultraship.lib;ZAPDUtils.lib;opengl32.lib;glu32.lib;SDL2.lib;SDL2main.lib;glfw3dll.lib;glew32s.lib;winmm.lib;imm32.lib;version.lib;setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>libultraship.lib;ZAPDUtils.lib;opengl32.lib;glu32.lib;SDL2.lib;SDL2main.lib;glew32s.lib;winmm.lib;imm32.lib;version.lib;setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<AdditionalOptions>/FORCE:MULTIPLE %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalOptions>/FORCE:MULTIPLE %(AdditionalOptions)</AdditionalOptions>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
@ -144,32 +148,34 @@
|
|||||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
|
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>libultraship.lib;ZAPDUtils.lib;opengl32.lib;glu32.lib;SDL2.lib;SDL2main.lib;glfw3dll.lib;glew32s.lib;winmm.lib;imm32.lib;version.lib;setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>libultraship.lib;ZAPDUtils.lib;opengl32.lib;glu32.lib;SDL2.lib;SDL2main.lib;glew32s.lib;winmm.lib;imm32.lib;version.lib;setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<IgnoreSpecificDefaultLibraries>
|
<IgnoreSpecificDefaultLibraries>
|
||||||
</IgnoreSpecificDefaultLibraries>
|
</IgnoreSpecificDefaultLibraries>
|
||||||
<AdditionalOptions>/FORCE:MULTIPLE %(AdditionalOptions)</AdditionalOptions>
|
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>TurnOffAllWarnings</WarningLevel>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>false</SDLCheck>
|
||||||
<PreprocessorDefinitions>INCLUDE_GAME_PRINTF;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)GLEW_STATIC </PreprocessorDefinitions>
|
<PreprocessorDefinitions>INCLUDE_GAME_PRINTF;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)GLEW_STATIC </PreprocessorDefinitions>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
|
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||||
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalOptions>/FORCE:MULTIPLE %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalDependencies>libultraship.lib;ZAPDUtils.lib;opengl32.lib;glu32.lib;SDL2.lib;SDL2main.lib;glew32s.lib;winmm.lib;imm32.lib;version.lib;setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -3786,6 +3786,11 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Image Include="SHIPOFHARKINIAN.ico" />
|
<Image Include="SHIPOFHARKINIAN.ico" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="Resource.rc">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</ResourceCompile>
|
||||||
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="include\macro.inc" />
|
<None Include="include\macro.inc" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -19,4 +19,8 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ShowAllFiles>false</ShowAllFiles>
|
<ShowAllFiles>false</ShowAllFiles>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<LocalDebuggerWorkingDirectory>$(TargetDir)</LocalDebuggerWorkingDirectory>
|
||||||
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
@ -27,6 +27,10 @@
|
|||||||
#include <Cutscene.h>
|
#include <Cutscene.h>
|
||||||
#include <Texture.h>
|
#include <Texture.h>
|
||||||
#include "Lib/stb/stb_image.h"
|
#include "Lib/stb/stb_image.h"
|
||||||
|
#define DRMP3_IMPLEMENTATION
|
||||||
|
#include "Lib/dr_libs/mp3.h"
|
||||||
|
#define DRWAV_IMPLEMENTATION
|
||||||
|
#include "Lib/dr_libs/wav.h"
|
||||||
#include "AudioPlayer.h"
|
#include "AudioPlayer.h"
|
||||||
#include "Enhancements/debugconsole.h"
|
#include "Enhancements/debugconsole.h"
|
||||||
#include "Enhancements/debugger/debugger.h"
|
#include "Enhancements/debugger/debugger.h"
|
||||||
@ -53,6 +57,11 @@ OTRGlobals::OTRGlobals() {
|
|||||||
OTRGlobals::~OTRGlobals() {
|
OTRGlobals::~OTRGlobals() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct ExtensionEntry {
|
||||||
|
std::string path;
|
||||||
|
std::string ext;
|
||||||
|
};
|
||||||
|
|
||||||
extern uintptr_t clearMtx;
|
extern uintptr_t clearMtx;
|
||||||
extern "C" Mtx gMtxClear;
|
extern "C" Mtx gMtxClear;
|
||||||
extern "C" MtxF gMtxFClear;
|
extern "C" MtxF gMtxFClear;
|
||||||
@ -63,14 +72,28 @@ extern "C" int AudioPlayer_Buffered(void);
|
|||||||
extern "C" int AudioPlayer_GetDesiredBuffered(void);
|
extern "C" int AudioPlayer_GetDesiredBuffered(void);
|
||||||
extern "C" void ResourceMgr_CacheDirectory(const char* resName);
|
extern "C" void ResourceMgr_CacheDirectory(const char* resName);
|
||||||
extern "C" SequenceData ResourceMgr_LoadSeqByName(const char* path);
|
extern "C" SequenceData ResourceMgr_LoadSeqByName(const char* path);
|
||||||
|
std::unordered_map<std::string, ExtensionEntry> ExtensionCache;
|
||||||
|
|
||||||
// C->C++ Bridge
|
// C->C++ Bridge
|
||||||
extern "C" void OTRAudio_Init()
|
extern "C" void OTRAudio_Init()
|
||||||
{
|
{
|
||||||
// Precache all our samples, sequences, etc...
|
// Precache all our samples, sequences, etc...
|
||||||
ResourceMgr_CacheDirectory("audio");
|
ResourceMgr_CacheDirectory("audio");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" void OTRExtScanner() {
|
||||||
|
auto lst = *OTRGlobals::Instance->context->GetResourceManager()->ListFiles("*.*").get();
|
||||||
|
|
||||||
|
for (auto& rPath : lst) {
|
||||||
|
std::vector<std::string> raw = StringHelper::Split(rPath, ".");
|
||||||
|
std::string ext = raw[raw.size() - 1];
|
||||||
|
std::string nPath = rPath.substr(0, rPath.size() - (ext.size() + 1));
|
||||||
|
replace(nPath.begin(), nPath.end(), '\\', '/');
|
||||||
|
|
||||||
|
ExtensionCache[nPath] = { rPath, ext };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" void InitOTR() {
|
extern "C" void InitOTR() {
|
||||||
OTRGlobals::Instance = new OTRGlobals();
|
OTRGlobals::Instance = new OTRGlobals();
|
||||||
SaveManager::Instance = new SaveManager();
|
SaveManager::Instance = new SaveManager();
|
||||||
@ -88,6 +111,7 @@ extern "C" void InitOTR() {
|
|||||||
OTRAudio_Init();
|
OTRAudio_Init();
|
||||||
DebugConsole_Init();
|
DebugConsole_Init();
|
||||||
Debug_Init();
|
Debug_Init();
|
||||||
|
OTRExtScanner();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@ -336,13 +360,12 @@ extern "C" char** ResourceMgr_ListFiles(const char* searchMask, int* resultSize)
|
|||||||
auto lst = OTRGlobals::Instance->context->GetResourceManager()->ListFiles(searchMask);
|
auto lst = OTRGlobals::Instance->context->GetResourceManager()->ListFiles(searchMask);
|
||||||
char** result = (char**)malloc(lst->size() * sizeof(char*));
|
char** result = (char**)malloc(lst->size() * sizeof(char*));
|
||||||
|
|
||||||
for (int i = 0; i < lst->size(); i++) {
|
for (size_t i = 0; i < lst->size(); i++) {
|
||||||
char* str = (char*)malloc(lst.get()[0][i].size() + 1);
|
char* str = (char*)malloc(lst.get()[0][i].size() + 1);
|
||||||
memcpy(str, lst.get()[0][i].data(), lst.get()[0][i].size());
|
memcpy(str, lst.get()[0][i].data(), lst.get()[0][i].size());
|
||||||
str[lst.get()[0][i].size()] = '\0';
|
str[lst.get()[0][i].size()] = '\0';
|
||||||
result[i] = str;
|
result[i] = str;
|
||||||
}
|
}
|
||||||
|
|
||||||
*resultSize = lst->size();
|
*resultSize = lst->size();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@ -459,7 +482,7 @@ extern "C" char* ResourceMgr_LoadArrayByNameAsVec3s(const char* path) {
|
|||||||
{
|
{
|
||||||
Vec3s* data = (Vec3s*)malloc(sizeof(Vec3s) * res->scalars.size());
|
Vec3s* data = (Vec3s*)malloc(sizeof(Vec3s) * res->scalars.size());
|
||||||
|
|
||||||
for (int i = 0; i < res->scalars.size(); i += 3) {
|
for (size_t i = 0; i < res->scalars.size(); i += 3) {
|
||||||
data[(i / 3)].x = res->scalars[i + 0].s16;
|
data[(i / 3)].x = res->scalars[i + 0].s16;
|
||||||
data[(i / 3)].y = res->scalars[i + 1].s16;
|
data[(i / 3)].y = res->scalars[i + 1].s16;
|
||||||
data[(i / 3)].z = res->scalars[i + 2].s16;
|
data[(i / 3)].z = res->scalars[i + 2].s16;
|
||||||
@ -491,7 +514,7 @@ extern "C" CollisionHeader* ResourceMgr_LoadColByName(const char* path)
|
|||||||
colHeader->vtxList = (Vec3s*)malloc(sizeof(Vec3s) * colRes->vertices.size());
|
colHeader->vtxList = (Vec3s*)malloc(sizeof(Vec3s) * colRes->vertices.size());
|
||||||
colHeader->numVertices = colRes->vertices.size();
|
colHeader->numVertices = colRes->vertices.size();
|
||||||
|
|
||||||
for (int i = 0; i < colRes->vertices.size(); i++)
|
for (size_t i = 0; i < colRes->vertices.size(); i++)
|
||||||
{
|
{
|
||||||
colHeader->vtxList[i].x = colRes->vertices[i].x;
|
colHeader->vtxList[i].x = colRes->vertices[i].x;
|
||||||
colHeader->vtxList[i].y = colRes->vertices[i].y;
|
colHeader->vtxList[i].y = colRes->vertices[i].y;
|
||||||
@ -501,7 +524,7 @@ extern "C" CollisionHeader* ResourceMgr_LoadColByName(const char* path)
|
|||||||
colHeader->polyList = (CollisionPoly*)malloc(sizeof(CollisionPoly) * colRes->polygons.size());
|
colHeader->polyList = (CollisionPoly*)malloc(sizeof(CollisionPoly) * colRes->polygons.size());
|
||||||
colHeader->numPolygons = colRes->polygons.size();
|
colHeader->numPolygons = colRes->polygons.size();
|
||||||
|
|
||||||
for (int i = 0; i < colRes->polygons.size(); i++)
|
for (size_t i = 0; i < colRes->polygons.size(); i++)
|
||||||
{
|
{
|
||||||
colHeader->polyList[i].type = colRes->polygons[i].type;
|
colHeader->polyList[i].type = colRes->polygons[i].type;
|
||||||
colHeader->polyList[i].flags_vIA = colRes->polygons[i].vtxA;
|
colHeader->polyList[i].flags_vIA = colRes->polygons[i].vtxA;
|
||||||
@ -515,7 +538,7 @@ extern "C" CollisionHeader* ResourceMgr_LoadColByName(const char* path)
|
|||||||
|
|
||||||
colHeader->surfaceTypeList = (SurfaceType*)malloc(colRes->polygonTypes.size() * sizeof(SurfaceType));
|
colHeader->surfaceTypeList = (SurfaceType*)malloc(colRes->polygonTypes.size() * sizeof(SurfaceType));
|
||||||
|
|
||||||
for (int i = 0; i < colRes->polygonTypes.size(); i++)
|
for (size_t i = 0; i < colRes->polygonTypes.size(); i++)
|
||||||
{
|
{
|
||||||
colHeader->surfaceTypeList[i].data[0] = colRes->polygonTypes[i] >> 32;
|
colHeader->surfaceTypeList[i].data[0] = colRes->polygonTypes[i] >> 32;
|
||||||
colHeader->surfaceTypeList[i].data[1] = colRes->polygonTypes[i] & 0xFFFFFFFF;
|
colHeader->surfaceTypeList[i].data[1] = colRes->polygonTypes[i] & 0xFFFFFFFF;
|
||||||
@ -523,7 +546,7 @@ extern "C" CollisionHeader* ResourceMgr_LoadColByName(const char* path)
|
|||||||
|
|
||||||
colHeader->cameraDataList = (CamData*)malloc(sizeof(CamData) * colRes->camData->entries.size());
|
colHeader->cameraDataList = (CamData*)malloc(sizeof(CamData) * colRes->camData->entries.size());
|
||||||
|
|
||||||
for (int i = 0; i < colRes->camData->entries.size(); i++)
|
for (size_t i = 0; i < colRes->camData->entries.size(); i++)
|
||||||
{
|
{
|
||||||
colHeader->cameraDataList[i].cameraSType = colRes->camData->entries[i]->cameraSType;
|
colHeader->cameraDataList[i].cameraSType = colRes->camData->entries[i]->cameraSType;
|
||||||
colHeader->cameraDataList[i].numCameras = colRes->camData->entries[i]->numData;
|
colHeader->cameraDataList[i].numCameras = colRes->camData->entries[i]->numData;
|
||||||
@ -571,7 +594,7 @@ extern "C" Vtx* ResourceMgr_LoadVtxByName(const char* path)
|
|||||||
return (Vtx*)res->vertices.data();
|
return (Vtx*)res->vertices.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" SequenceData ResourceMgr_LoadSeqByName(const char* path)
|
extern "C" SequenceData ResourceMgr_LoadSeqByName(const char* path)
|
||||||
{
|
{
|
||||||
auto file = std::static_pointer_cast<Ship::AudioSequence>(OTRGlobals::Instance->context->GetResourceManager()
|
auto file = std::static_pointer_cast<Ship::AudioSequence>(OTRGlobals::Instance->context->GetResourceManager()
|
||||||
->LoadResource(path));
|
->LoadResource(path));
|
||||||
@ -593,7 +616,63 @@ extern "C" SequenceData ResourceMgr_LoadSeqByName(const char* path)
|
|||||||
|
|
||||||
std::map<std::string, SoundFontSample*> cachedCustomSFs;
|
std::map<std::string, SoundFontSample*> cachedCustomSFs;
|
||||||
|
|
||||||
extern "C" SoundFontSample* ResourceMgr_LoadAudioSample(const char* path)
|
extern "C" SoundFontSample* ReadCustomSample(const char* path) {
|
||||||
|
|
||||||
|
if (!ExtensionCache.contains(path))
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
ExtensionEntry entry = ExtensionCache[path];
|
||||||
|
|
||||||
|
auto sampleRaw = OTRGlobals::Instance->context->GetResourceManager()->LoadFile(entry.path);
|
||||||
|
uint32_t* strem = (uint32_t*)sampleRaw->buffer.get();
|
||||||
|
uint8_t* strem2 = (uint8_t*)strem;
|
||||||
|
|
||||||
|
SoundFontSample* sampleC = new SoundFontSample;
|
||||||
|
|
||||||
|
if (entry.ext == "wav") {
|
||||||
|
drwav_uint32 channels;
|
||||||
|
drwav_uint32 sampleRate;
|
||||||
|
drwav_uint64 totalPcm;
|
||||||
|
drmp3_int16* pcmData =
|
||||||
|
drwav_open_memory_and_read_pcm_frames_s16(strem2, sampleRaw->dwBufferSize, &channels, &sampleRate, &totalPcm, NULL);
|
||||||
|
sampleC->size = totalPcm;
|
||||||
|
sampleC->sampleAddr = (uint8_t*)pcmData;
|
||||||
|
sampleC->codec = CODEC_S16;
|
||||||
|
|
||||||
|
sampleC->loop = new AdpcmLoop;
|
||||||
|
sampleC->loop->start = 0;
|
||||||
|
sampleC->loop->end = sampleC->size - 1;
|
||||||
|
sampleC->loop->count = 0;
|
||||||
|
sampleC->sampleRateMagicValue = 'RIFF';
|
||||||
|
sampleC->sampleRate = sampleRate;
|
||||||
|
|
||||||
|
cachedCustomSFs[path] = sampleC;
|
||||||
|
return sampleC;
|
||||||
|
} else if (entry.ext == "mp3") {
|
||||||
|
drmp3_config mp3Info;
|
||||||
|
drmp3_uint64 totalPcm;
|
||||||
|
drmp3_int16* pcmData =
|
||||||
|
drmp3_open_memory_and_read_pcm_frames_s16(strem2, sampleRaw->dwBufferSize, &mp3Info, &totalPcm, NULL);
|
||||||
|
|
||||||
|
sampleC->size = totalPcm * mp3Info.channels * sizeof(short);
|
||||||
|
sampleC->sampleAddr = (uint8_t*)pcmData;
|
||||||
|
sampleC->codec = CODEC_S16;
|
||||||
|
|
||||||
|
sampleC->loop = new AdpcmLoop;
|
||||||
|
sampleC->loop->start = 0;
|
||||||
|
sampleC->loop->end = sampleC->size;
|
||||||
|
sampleC->loop->count = 0;
|
||||||
|
sampleC->sampleRateMagicValue = 'RIFF';
|
||||||
|
sampleC->sampleRate = mp3Info.sampleRate;
|
||||||
|
|
||||||
|
cachedCustomSFs[path] = sampleC;
|
||||||
|
return sampleC;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" SoundFontSample* ResourceMgr_LoadAudioSample(const char* path)
|
||||||
{
|
{
|
||||||
if (std::string(path) == "")
|
if (std::string(path) == "")
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -601,56 +680,25 @@ extern "C" SoundFontSample* ResourceMgr_LoadAudioSample(const char* path)
|
|||||||
if (cachedCustomSFs.find(path) != cachedCustomSFs.end())
|
if (cachedCustomSFs.find(path) != cachedCustomSFs.end())
|
||||||
return cachedCustomSFs[path];
|
return cachedCustomSFs[path];
|
||||||
|
|
||||||
// Check if our file is actually a wav...
|
SoundFontSample* cSample = ReadCustomSample(path);
|
||||||
auto sampleRaw = OTRGlobals::Instance->context->GetResourceManager()->LoadFile(path);
|
|
||||||
uint32_t* strem = (uint32_t*)sampleRaw->buffer.get();
|
|
||||||
uint8_t* strem2 = (uint8_t*)strem;
|
|
||||||
|
|
||||||
if (strem2[0] == 'R' && strem2[1] == 'I' && strem2[2] == 'F' && strem2[3] == 'F')
|
if (cSample != nullptr)
|
||||||
{
|
return cSample;
|
||||||
SoundFontSample* sampleC = (SoundFontSample*)malloc(sizeof(SoundFontSample));
|
|
||||||
|
|
||||||
*strem++; // RIFF
|
|
||||||
*strem++; // size
|
|
||||||
*strem++; // WAVE
|
|
||||||
|
|
||||||
*strem++; // fmt
|
|
||||||
int fmtChunkSize = *strem++;
|
|
||||||
*strem++; // wFormatTag + wChannels
|
|
||||||
int32_t sampleRate = *strem++; // dwSamplesPerSec
|
|
||||||
// OTRTODO: Make sure wav format is what the audio driver wants!
|
|
||||||
|
|
||||||
strem = (uint32_t*)&strem2[0x0C + fmtChunkSize + 8 + 4];
|
|
||||||
sampleC->size = *strem++;
|
|
||||||
sampleC->sampleAddr = (uint8_t*)strem;
|
|
||||||
sampleC->codec = CODEC_S16;
|
|
||||||
|
|
||||||
// OTRTODO: Grab loop data from wav
|
|
||||||
sampleC->loop = (AdpcmLoop*)malloc(sizeof(AdpcmLoop));
|
|
||||||
sampleC->loop->start = 0;
|
|
||||||
sampleC->loop->end = sampleC->size / 2; // OTRTODO: This calculation is probably incorrect... Sometimes it goes past the sample, sometimes it stops too early...
|
|
||||||
sampleC->loop->count = 0;
|
|
||||||
sampleC->sampleRateMagicValue = 'RIFF';
|
|
||||||
sampleC->sampleRate = sampleRate;
|
|
||||||
|
|
||||||
cachedCustomSFs[path] = sampleC;
|
|
||||||
return sampleC;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto sample = std::static_pointer_cast<Ship::AudioSample>(
|
auto sample = std::static_pointer_cast<Ship::AudioSample>(
|
||||||
OTRGlobals::Instance->context->GetResourceManager()->LoadResource(path));
|
OTRGlobals::Instance->context->GetResourceManager()->LoadResource(path));
|
||||||
|
|
||||||
if (sample == nullptr)
|
if (sample == nullptr)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (sample->cachedGameAsset != nullptr)
|
if (sample->cachedGameAsset != nullptr)
|
||||||
{
|
{
|
||||||
SoundFontSample* sampleC = (SoundFontSample*)sample->cachedGameAsset;
|
SoundFontSample* sampleC = (SoundFontSample*)sample->cachedGameAsset;
|
||||||
return (SoundFontSample*)sample->cachedGameAsset;
|
return (SoundFontSample*)sample->cachedGameAsset;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SoundFontSample* sampleC = (SoundFontSample*)malloc(sizeof(SoundFontSample));
|
SoundFontSample* sampleC = new SoundFontSample;
|
||||||
|
|
||||||
sampleC->sampleAddr = sample->data.data();
|
sampleC->sampleAddr = sample->data.data();
|
||||||
|
|
||||||
@ -660,14 +708,14 @@ extern "C" SoundFontSample* ResourceMgr_LoadAudioSample(const char* path)
|
|||||||
sampleC->unk_bit26 = sample->unk_bit26;
|
sampleC->unk_bit26 = sample->unk_bit26;
|
||||||
sampleC->unk_bit25 = sample->unk_bit25;
|
sampleC->unk_bit25 = sample->unk_bit25;
|
||||||
|
|
||||||
sampleC->book = (AdpcmBook*)malloc(sizeof(AdpcmBook) + (sample->book.books.size() * sizeof(int16_t)));
|
sampleC->book = new AdpcmBook[sample->book.books.size() * sizeof(int16_t)];
|
||||||
sampleC->book->npredictors = sample->book.npredictors;
|
sampleC->book->npredictors = sample->book.npredictors;
|
||||||
sampleC->book->order = sample->book.order;
|
sampleC->book->order = sample->book.order;
|
||||||
|
|
||||||
for (int i = 0; i < sample->book.books.size(); i++)
|
for (size_t i = 0; i < sample->book.books.size(); i++)
|
||||||
sampleC->book->book[i] = sample->book.books[i];
|
sampleC->book->book[i] = sample->book.books[i];
|
||||||
|
|
||||||
sampleC->loop = (AdpcmLoop*)malloc(sizeof(AdpcmLoop));
|
sampleC->loop = new AdpcmLoop;
|
||||||
sampleC->loop->start = sample->loop.start;
|
sampleC->loop->start = sample->loop.start;
|
||||||
sampleC->loop->end = sample->loop.end;
|
sampleC->loop->end = sample->loop.end;
|
||||||
sampleC->loop->count = sample->loop.count;
|
sampleC->loop->count = sample->loop.count;
|
||||||
@ -675,7 +723,7 @@ extern "C" SoundFontSample* ResourceMgr_LoadAudioSample(const char* path)
|
|||||||
for (int i = 0; i < 16; i++)
|
for (int i = 0; i < 16; i++)
|
||||||
sampleC->loop->state[i] = 0;
|
sampleC->loop->state[i] = 0;
|
||||||
|
|
||||||
for (int i = 0; i < sample->loop.states.size(); i++)
|
for (size_t i = 0; i < sample->loop.states.size(); i++)
|
||||||
sampleC->loop->state[i] = sample->loop.states[i];
|
sampleC->loop->state[i] = sample->loop.states[i];
|
||||||
|
|
||||||
sample->cachedGameAsset = sampleC;
|
sample->cachedGameAsset = sampleC;
|
||||||
@ -690,11 +738,11 @@ extern "C" SoundFont* ResourceMgr_LoadAudioSoundFont(const char* path) {
|
|||||||
if (soundFont == nullptr)
|
if (soundFont == nullptr)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (soundFont->cachedGameAsset != nullptr)
|
if (soundFont->cachedGameAsset != nullptr)
|
||||||
{
|
{
|
||||||
return (SoundFont*)soundFont->cachedGameAsset;
|
return (SoundFont*)soundFont->cachedGameAsset;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SoundFont* soundFontC = (SoundFont*)malloc(sizeof(SoundFont));
|
SoundFont* soundFontC = (SoundFont*)malloc(sizeof(SoundFont));
|
||||||
|
|
||||||
@ -707,7 +755,7 @@ extern "C" SoundFont* ResourceMgr_LoadAudioSoundFont(const char* path) {
|
|||||||
|
|
||||||
soundFontC->drums = (Drum**)malloc(sizeof(Drum*) * soundFont->drums.size());
|
soundFontC->drums = (Drum**)malloc(sizeof(Drum*) * soundFont->drums.size());
|
||||||
|
|
||||||
for (int i = 0; i < soundFont->drums.size(); i++)
|
for (size_t i = 0; i < soundFont->drums.size(); i++)
|
||||||
{
|
{
|
||||||
Drum* drum = (Drum*)malloc(sizeof(Drum));
|
Drum* drum = (Drum*)malloc(sizeof(Drum));
|
||||||
|
|
||||||
@ -721,7 +769,7 @@ extern "C" SoundFont* ResourceMgr_LoadAudioSoundFont(const char* path) {
|
|||||||
{
|
{
|
||||||
drum->envelope = (AdsrEnvelope*)malloc(sizeof(AdsrEnvelope) * soundFont->drums[i].env.size());
|
drum->envelope = (AdsrEnvelope*)malloc(sizeof(AdsrEnvelope) * soundFont->drums[i].env.size());
|
||||||
|
|
||||||
for (int k = 0; k < soundFont->drums[i].env.size(); k++)
|
for (size_t k = 0; k < soundFont->drums[i].env.size(); k++)
|
||||||
{
|
{
|
||||||
drum->envelope[k].delay = BOMSWAP16(soundFont->drums[i].env[k]->delay);
|
drum->envelope[k].delay = BOMSWAP16(soundFont->drums[i].env[k]->delay);
|
||||||
drum->envelope[k].arg = BOMSWAP16(soundFont->drums[i].env[k]->arg);
|
drum->envelope[k].arg = BOMSWAP16(soundFont->drums[i].env[k]->arg);
|
||||||
@ -736,9 +784,9 @@ extern "C" SoundFont* ResourceMgr_LoadAudioSoundFont(const char* path) {
|
|||||||
|
|
||||||
soundFontC->instruments = (Instrument**)malloc(sizeof(Instrument*) * soundFont->instruments.size());
|
soundFontC->instruments = (Instrument**)malloc(sizeof(Instrument*) * soundFont->instruments.size());
|
||||||
|
|
||||||
for (int i = 0; i < soundFont->instruments.size(); i++) {
|
for (size_t i = 0; i < soundFont->instruments.size(); i++) {
|
||||||
|
|
||||||
if (soundFont->instruments[i].isValidEntry)
|
if (soundFont->instruments[i].isValidEntry)
|
||||||
{
|
{
|
||||||
Instrument* inst = (Instrument*)malloc(sizeof(Instrument));
|
Instrument* inst = (Instrument*)malloc(sizeof(Instrument));
|
||||||
|
|
||||||
@ -749,17 +797,17 @@ extern "C" SoundFont* ResourceMgr_LoadAudioSoundFont(const char* path) {
|
|||||||
|
|
||||||
if (soundFont->instruments[i].env.size() == 0)
|
if (soundFont->instruments[i].env.size() == 0)
|
||||||
inst->envelope = NULL;
|
inst->envelope = NULL;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
inst->envelope = (AdsrEnvelope*)malloc(sizeof(AdsrEnvelope) * soundFont->instruments[i].env.size());
|
inst->envelope = (AdsrEnvelope*)malloc(sizeof(AdsrEnvelope) * soundFont->instruments[i].env.size());
|
||||||
|
|
||||||
for (int k = 0; k < soundFont->instruments[i].env.size(); k++)
|
for (int k = 0; k < soundFont->instruments[i].env.size(); k++)
|
||||||
{
|
{
|
||||||
inst->envelope[k].delay = BOMSWAP16(soundFont->instruments[i].env[k]->delay);
|
inst->envelope[k].delay = BOMSWAP16(soundFont->instruments[i].env[k]->delay);
|
||||||
inst->envelope[k].arg = BOMSWAP16(soundFont->instruments[i].env[k]->arg);
|
inst->envelope[k].arg = BOMSWAP16(soundFont->instruments[i].env[k]->arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (soundFont->instruments[i].lowNotesSound != nullptr)
|
if (soundFont->instruments[i].lowNotesSound != nullptr)
|
||||||
{
|
{
|
||||||
inst->lowNotesSound.sample =
|
inst->lowNotesSound.sample =
|
||||||
ResourceMgr_LoadAudioSample(soundFont->instruments[i].lowNotesSound->sampleFileName.c_str());
|
ResourceMgr_LoadAudioSample(soundFont->instruments[i].lowNotesSound->sampleFileName.c_str());
|
||||||
@ -789,7 +837,8 @@ extern "C" SoundFont* ResourceMgr_LoadAudioSoundFont(const char* path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
soundFontC->instruments[i] = inst;
|
soundFontC->instruments[i] = inst;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
soundFontC->instruments[i] = nullptr;
|
soundFontC->instruments[i] = nullptr;
|
||||||
}
|
}
|
||||||
@ -797,7 +846,7 @@ extern "C" SoundFont* ResourceMgr_LoadAudioSoundFont(const char* path) {
|
|||||||
|
|
||||||
soundFontC->soundEffects = (SoundFontSound*)malloc(sizeof(SoundFontSound) * soundFont->soundEffects.size());
|
soundFontC->soundEffects = (SoundFontSound*)malloc(sizeof(SoundFontSound) * soundFont->soundEffects.size());
|
||||||
|
|
||||||
for (int i = 0; i < soundFont->soundEffects.size(); i++)
|
for (size_t i = 0; i < soundFont->soundEffects.size(); i++)
|
||||||
{
|
{
|
||||||
soundFontC->soundEffects[i].sample = ResourceMgr_LoadAudioSample(soundFont->soundEffects[i]->sampleFileName.c_str());
|
soundFontC->soundEffects[i].sample = ResourceMgr_LoadAudioSample(soundFont->soundEffects[i]->sampleFileName.c_str());
|
||||||
soundFontC->soundEffects[i].tuning = soundFont->soundEffects[i]->tuning;
|
soundFontC->soundEffects[i].tuning = soundFont->soundEffects[i]->tuning;
|
||||||
@ -812,10 +861,12 @@ extern "C" int ResourceMgr_OTRSigCheck(char* imgData)
|
|||||||
{
|
{
|
||||||
uintptr_t i = (uintptr_t)(imgData);
|
uintptr_t i = (uintptr_t)(imgData);
|
||||||
|
|
||||||
if (i == 0xD9000000 || i == 0xE7000000 || (i & 1) == 1)
|
// if (i == 0xD9000000 || i == 0xE7000000 || (i & 1) == 1)
|
||||||
|
if ((i & 1) == 1)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if ((i & 0xFF000000) != 0xAB000000 && (i & 0xFF000000) != 0xCD000000 && i != 0) {
|
// if ((i & 0xFF000000) != 0xAB000000 && (i & 0xFF000000) != 0xCD000000 && i != 0) {
|
||||||
|
if (i != 0) {
|
||||||
if (imgData[0] == '_' && imgData[1] == '_' && imgData[2] == 'O' && imgData[3] == 'T' && imgData[4] == 'R' &&
|
if (imgData[0] == '_' && imgData[1] == '_' && imgData[2] == 'O' && imgData[3] == 'T' && imgData[4] == 'R' &&
|
||||||
imgData[5] == '_' && imgData[6] == '_')
|
imgData[5] == '_' && imgData[6] == '_')
|
||||||
return 1;
|
return 1;
|
||||||
@ -839,13 +890,13 @@ extern "C" AnimationHeaderCommon* ResourceMgr_LoadAnimByName(const char* path) {
|
|||||||
animNormal->common.frameCount = res->frameCount;
|
animNormal->common.frameCount = res->frameCount;
|
||||||
animNormal->frameData = (int16_t*)malloc(res->rotationValues.size() * sizeof(int16_t));
|
animNormal->frameData = (int16_t*)malloc(res->rotationValues.size() * sizeof(int16_t));
|
||||||
|
|
||||||
for (int i = 0; i < res->rotationValues.size(); i++)
|
for (size_t i = 0; i < res->rotationValues.size(); i++)
|
||||||
animNormal->frameData[i] = res->rotationValues[i];
|
animNormal->frameData[i] = res->rotationValues[i];
|
||||||
|
|
||||||
|
|
||||||
animNormal->jointIndices = (JointIndex*)malloc(res->rotationIndices.size() * sizeof(Vec3s));
|
animNormal->jointIndices = (JointIndex*)malloc(res->rotationIndices.size() * sizeof(Vec3s));
|
||||||
|
|
||||||
for (int i = 0; i < res->rotationIndices.size(); i++) {
|
for (size_t i = 0; i < res->rotationIndices.size(); i++) {
|
||||||
animNormal->jointIndices[i].x = res->rotationIndices[i].x;
|
animNormal->jointIndices[i].x = res->rotationIndices[i].x;
|
||||||
animNormal->jointIndices[i].y = res->rotationIndices[i].y;
|
animNormal->jointIndices[i].y = res->rotationIndices[i].y;
|
||||||
animNormal->jointIndices[i].z = res->rotationIndices[i].z;
|
animNormal->jointIndices[i].z = res->rotationIndices[i].z;
|
||||||
@ -861,12 +912,12 @@ extern "C" AnimationHeaderCommon* ResourceMgr_LoadAnimByName(const char* path) {
|
|||||||
|
|
||||||
animCurve->copyValues = (s16*)malloc(res->copyValuesArr.size() * sizeof(s16));
|
animCurve->copyValues = (s16*)malloc(res->copyValuesArr.size() * sizeof(s16));
|
||||||
|
|
||||||
for (int i = 0; i < res->copyValuesArr.size(); i++)
|
for (size_t i = 0; i < res->copyValuesArr.size(); i++)
|
||||||
animCurve->copyValues[i] = res->copyValuesArr[i];
|
animCurve->copyValues[i] = res->copyValuesArr[i];
|
||||||
|
|
||||||
animCurve->transformData = (TransformData*)malloc(res->transformDataArr.size() * sizeof(TransformData));
|
animCurve->transformData = (TransformData*)malloc(res->transformDataArr.size() * sizeof(TransformData));
|
||||||
|
|
||||||
for (int i = 0; i < res->transformDataArr.size(); i++)
|
for (size_t i = 0; i < res->transformDataArr.size(); i++)
|
||||||
{
|
{
|
||||||
animCurve->transformData[i].unk_00 = res->transformDataArr[i].unk_00;
|
animCurve->transformData[i].unk_00 = res->transformDataArr[i].unk_00;
|
||||||
animCurve->transformData[i].unk_02 = res->transformDataArr[i].unk_02;
|
animCurve->transformData[i].unk_02 = res->transformDataArr[i].unk_02;
|
||||||
@ -876,7 +927,7 @@ extern "C" AnimationHeaderCommon* ResourceMgr_LoadAnimByName(const char* path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
animCurve->refIndex = (u8*)malloc(res->refIndexArr.size());
|
animCurve->refIndex = (u8*)malloc(res->refIndexArr.size());
|
||||||
for (int i = 0; i < res->refIndexArr.size(); i++)
|
for (size_t i = 0; i < res->refIndexArr.size(); i++)
|
||||||
animCurve->refIndex[i] = res->refIndexArr[i];
|
animCurve->refIndex[i] = res->refIndexArr[i];
|
||||||
|
|
||||||
anim = (AnimationHeaderCommon*)animCurve;
|
anim = (AnimationHeaderCommon*)animCurve;
|
||||||
@ -926,7 +977,7 @@ extern "C" SkeletonHeader* ResourceMgr_LoadSkeletonByName(const char* path) {
|
|||||||
baseHeader->segment = (void**)malloc(sizeof(StandardLimb*) * res->limbTable.size());
|
baseHeader->segment = (void**)malloc(sizeof(StandardLimb*) * res->limbTable.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < res->limbTable.size(); i++) {
|
for (size_t i = 0; i < res->limbTable.size(); i++) {
|
||||||
std::string limbStr = res->limbTable[i];
|
std::string limbStr = res->limbTable[i];
|
||||||
auto limb = std::static_pointer_cast<Ship::SkeletonLimb>(
|
auto limb = std::static_pointer_cast<Ship::SkeletonLimb>(
|
||||||
OTRGlobals::Instance->context->GetResourceManager()->LoadResource(limbStr.c_str()));
|
OTRGlobals::Instance->context->GetResourceManager()->LoadResource(limbStr.c_str()));
|
||||||
@ -1023,7 +1074,7 @@ extern "C" SkeletonHeader* ResourceMgr_LoadSkeletonByName(const char* path) {
|
|||||||
animData->limbModifications = new SkinLimbModif[animData->limbModifCount];
|
animData->limbModifications = new SkinLimbModif[animData->limbModifCount];
|
||||||
animData->dlist = ResourceMgr_LoadGfxByName(limb->skinDList2.c_str());
|
animData->dlist = ResourceMgr_LoadGfxByName(limb->skinDList2.c_str());
|
||||||
|
|
||||||
for (int i = 0; i < skinDataSize; i++)
|
for (size_t i = 0; i < skinDataSize; i++)
|
||||||
{
|
{
|
||||||
animData->limbModifications[i].vtxCount = limb->skinData[i].unk_8_arr.size();
|
animData->limbModifications[i].vtxCount = limb->skinData[i].unk_8_arr.size();
|
||||||
animData->limbModifications[i].transformCount = limb->skinData[i].unk_C_arr.size();
|
animData->limbModifications[i].transformCount = limb->skinData[i].unk_C_arr.size();
|
||||||
@ -1241,7 +1292,7 @@ extern "C" uint32_t OTRGetCurrentHeight() {
|
|||||||
|
|
||||||
extern "C" void OTRControllerCallback(ControllerCallback* controller) {
|
extern "C" void OTRControllerCallback(ControllerCallback* controller) {
|
||||||
auto controllers = OTRGlobals::Instance->context->GetWindow()->Controllers;
|
auto controllers = OTRGlobals::Instance->context->GetWindow()->Controllers;
|
||||||
for (int i = 0; i < controllers.size(); i++) {
|
for (size_t i = 0; i < controllers.size(); i++) {
|
||||||
for (int j = 0; j < controllers[i].size(); j++) {
|
for (int j = 0; j < controllers[i].size(); j++) {
|
||||||
OTRGlobals::Instance->context->GetWindow()->Controllers[i][j]->WriteToSource(controller);
|
OTRGlobals::Instance->context->GetWindow()->Controllers[i][j]->WriteToSource(controller);
|
||||||
}
|
}
|
||||||
|
@ -39,13 +39,16 @@ void ResourceMgr_CacheDirectory(const char* resName);
|
|||||||
char** ResourceMgr_ListFiles(const char* searchMask, int* resultSize);
|
char** ResourceMgr_ListFiles(const char* searchMask, int* resultSize);
|
||||||
void ResourceMgr_LoadFile(const char* resName);
|
void ResourceMgr_LoadFile(const char* resName);
|
||||||
char* ResourceMgr_LoadFileFromDisk(const char* filePath);
|
char* ResourceMgr_LoadFileFromDisk(const char* filePath);
|
||||||
|
char* ResourceMgr_LoadJPEG(char* data, int dataSize);
|
||||||
char* ResourceMgr_LoadTexByName(const char* texPath);
|
char* ResourceMgr_LoadTexByName(const char* texPath);
|
||||||
char* ResourceMgr_LoadTexOrDListByName(const char* filePath);
|
char* ResourceMgr_LoadTexOrDListByName(const char* filePath);
|
||||||
char* ResourceMgr_LoadPlayerAnimByName(const char* animPath);
|
char* ResourceMgr_LoadPlayerAnimByName(const char* animPath);
|
||||||
|
AnimationHeaderCommon* ResourceMgr_LoadAnimByName(const char* path);
|
||||||
char* ResourceMgr_GetNameByCRC(uint64_t crc, char* alloc);
|
char* ResourceMgr_GetNameByCRC(uint64_t crc, char* alloc);
|
||||||
Gfx* ResourceMgr_LoadGfxByCRC(uint64_t crc);
|
Gfx* ResourceMgr_LoadGfxByCRC(uint64_t crc);
|
||||||
Gfx* ResourceMgr_LoadGfxByName(const char* path);
|
Gfx* ResourceMgr_LoadGfxByName(const char* path);
|
||||||
Gfx* ResourceMgr_PatchGfxByName(const char* path, int size);
|
Gfx* ResourceMgr_PatchGfxByName(const char* path, int size);
|
||||||
|
char* ResourceMgr_LoadArrayByNameAsVec3s(const char* path);
|
||||||
Vtx* ResourceMgr_LoadVtxByCRC(uint64_t crc);
|
Vtx* ResourceMgr_LoadVtxByCRC(uint64_t crc);
|
||||||
|
|
||||||
Vtx* ResourceMgr_LoadVtxByName(const char* path);
|
Vtx* ResourceMgr_LoadVtxByName(const char* path);
|
||||||
@ -60,6 +63,7 @@ bool Config_setValue(char* category, char* key, char* value);
|
|||||||
|
|
||||||
uint64_t GetPerfCounter();
|
uint64_t GetPerfCounter();
|
||||||
struct SkeletonHeader* ResourceMgr_LoadSkeletonByName(const char* path);
|
struct SkeletonHeader* ResourceMgr_LoadSkeletonByName(const char* path);
|
||||||
|
s32* ResourceMgr_LoadCSByName(const char* path);
|
||||||
int ResourceMgr_OTRSigCheck(char* imgData);
|
int ResourceMgr_OTRSigCheck(char* imgData);
|
||||||
uint64_t osGetTime(void);
|
uint64_t osGetTime(void);
|
||||||
uint32_t osGetCount(void);
|
uint32_t osGetCount(void);
|
||||||
@ -85,4 +89,4 @@ void AudioMgr_CreateNextAudioBuffer(s16* samples, u32 num_samples);
|
|||||||
int Controller_ShouldRumble(size_t i);
|
int Controller_ShouldRumble(size_t i);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -449,6 +449,7 @@ bool func_8009899C(GlobalContext* globalCtx, Ship::SceneCommand* cmd)
|
|||||||
|
|
||||||
k = 0;
|
k = 0;
|
||||||
//i = globalCtx->objectCtx.unk_09;
|
//i = globalCtx->objectCtx.unk_09;
|
||||||
|
i = 0;
|
||||||
firstStatus = &globalCtx->objectCtx.status[0];
|
firstStatus = &globalCtx->objectCtx.status[0];
|
||||||
status = &globalCtx->objectCtx.status[i];
|
status = &globalCtx->objectCtx.status[i];
|
||||||
|
|
||||||
@ -913,7 +914,7 @@ extern "C" s32 OTRfunc_8009728C(GlobalContext* globalCtx, RoomContext* roomCtx,
|
|||||||
return 0; // UH OH
|
return 0; // UH OH
|
||||||
|
|
||||||
size = globalCtx->roomList[roomNum].vromEnd - globalCtx->roomList[roomNum].vromStart;
|
size = globalCtx->roomList[roomNum].vromEnd - globalCtx->roomList[roomNum].vromStart;
|
||||||
roomCtx->unk_34 = (void*)ALIGN16((u32)roomCtx->bufPtrs[roomCtx->unk_30] - ((size + 8) * roomCtx->unk_30 + 7));
|
roomCtx->unk_34 = (void*)ALIGN16((uintptr_t)roomCtx->bufPtrs[roomCtx->unk_30] - ((size + 8) * roomCtx->unk_30 + 7));
|
||||||
|
|
||||||
osCreateMesgQueue(&roomCtx->loadQueue, &roomCtx->loadMsg, 1);
|
osCreateMesgQueue(&roomCtx->loadQueue, &roomCtx->loadMsg, 1);
|
||||||
//DmaMgr_SendRequest2(&roomCtx->dmaRequest, roomCtx->unk_34, globalCtx->roomList[roomNum].vromStart, size, 0,
|
//DmaMgr_SendRequest2(&roomCtx->dmaRequest, roomCtx->unk_34, globalCtx->roomList[roomNum].vromStart, size, 0,
|
||||||
|
@ -312,7 +312,7 @@ void DmaMgr_ThreadEntry(void* arg0) {
|
|||||||
osSyncPrintf("DMAマネージャスレッド実行開始\n");
|
osSyncPrintf("DMAマネージャスレッド実行開始\n");
|
||||||
while (true) {
|
while (true) {
|
||||||
osRecvMesg(&sDmaMgrMsgQueue, &msg, OS_MESG_BLOCK);
|
osRecvMesg(&sDmaMgrMsgQueue, &msg, OS_MESG_BLOCK);
|
||||||
req = (DmaRequest*)msg;
|
req = (DmaRequest*)msg.ptr;
|
||||||
if (req == NULL) {
|
if (req == NULL) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -360,7 +360,7 @@ s32 DmaMgr_SendRequestImpl(DmaRequest* req, uintptr_t ram, uintptr_t vrom, size_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
osSendMesg(&sDmaMgrMsgQueue, req, OS_MESG_BLOCK);
|
osSendMesgPtr(&sDmaMgrMsgQueue, req, OS_MESG_BLOCK);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -371,7 +371,7 @@ s32 DmaMgr_SendRequest0(uintptr_t ram, uintptr_t vrom, size_t size) {
|
|||||||
s32 ret;
|
s32 ret;
|
||||||
|
|
||||||
osCreateMesgQueue(&queue, &msg, 1);
|
osCreateMesgQueue(&queue, &msg, 1);
|
||||||
ret = DmaMgr_SendRequestImpl(&req, ram, vrom, size, 0, &queue, NULL);
|
ret = DmaMgr_SendRequestImpl(&req, ram, vrom, size, 0, &queue, OS_MESG_PTR(NULL));
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -413,7 +413,7 @@ void DmaMgr_Init(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if ((uintptr_t)_bootSegmentRomStart != gDmaDataTable[0].vromEnd)
|
if ((uintptr_t)_bootSegmentRomStart != gDmaDataTable[0].vromEnd)
|
||||||
{
|
{
|
||||||
osSyncPrintf("_bootSegmentRomStart(%08x) != dma_rom_ad[0].rom_b(%08x)\n", _bootSegmentRomStart,
|
osSyncPrintf("_bootSegmentRomStart(%08x) != dma_rom_ad[0].rom_b(%08x)\n", _bootSegmentRomStart,
|
||||||
gDmaDataTable[0].vromEnd);
|
gDmaDataTable[0].vromEnd);
|
||||||
|
@ -63,7 +63,7 @@ void ArenaImpl_LockInit(Arena* arena) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ArenaImpl_Lock(Arena* arena) {
|
void ArenaImpl_Lock(Arena* arena) {
|
||||||
osSendMesg(&arena->lock, NULL, OS_MESG_BLOCK);
|
osSendMesgPtr(&arena->lock, NULL, OS_MESG_BLOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArenaImpl_Unlock(Arena* arena) {
|
void ArenaImpl_Unlock(Arena* arena) {
|
||||||
|
@ -7,7 +7,7 @@ void func_800C3C80(AudioMgr* audioMgr) {
|
|||||||
|
|
||||||
task = audioMgr->rspTask;
|
task = audioMgr->rspTask;
|
||||||
if (audioMgr->rspTask->taskQueue != NULL) {
|
if (audioMgr->rspTask->taskQueue != NULL) {
|
||||||
osSendMesg(task->taskQueue, NULL, OS_MESG_BLOCK);
|
osSendMesgPtr(task->taskQueue, NULL, OS_MESG_BLOCK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,8 +25,8 @@ void AudioMgr_HandleRetrace(AudioMgr* audioMgr) {
|
|||||||
audioMgr->audioTask.list = audioMgr->rspTask->task;
|
audioMgr->audioTask.list = audioMgr->rspTask->task;
|
||||||
audioMgr->audioTask.msgQ = &audioMgr->unk_AC;
|
audioMgr->audioTask.msgQ = &audioMgr->unk_AC;
|
||||||
|
|
||||||
audioMgr->audioTask.msg = NULL;
|
audioMgr->audioTask.msg.ptr = NULL;
|
||||||
osSendMesg(&audioMgr->sched->cmdQ, &audioMgr->audioTask, OS_MESG_BLOCK);
|
osSendMesgPtr(&audioMgr->sched->cmdQ, &audioMgr->audioTask, OS_MESG_BLOCK);
|
||||||
Sched_SendEntryMsg(audioMgr->sched);
|
Sched_SendEntryMsg(audioMgr->sched);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ void AudioMgr_Init(AudioMgr* audioMgr, void* stack, OSPri pri, OSId id, SchedCon
|
|||||||
osCreateMesgQueue(&audioMgr->unk_74, &audioMgr->unk_8C, 8);
|
osCreateMesgQueue(&audioMgr->unk_74, &audioMgr->unk_8C, 8);
|
||||||
osCreateMesgQueue(&audioMgr->unk_C8, &audioMgr->unk_E0, 1);
|
osCreateMesgQueue(&audioMgr->unk_C8, &audioMgr->unk_E0, 1);
|
||||||
|
|
||||||
osSendMesg(&audioMgr->unk_AC, NULL, OS_MESG_BLOCK);
|
osSendMesgPtr(&audioMgr->unk_AC, NULL, OS_MESG_BLOCK);
|
||||||
|
|
||||||
static bool hasInitialized = false;
|
static bool hasInitialized = false;
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ void AudioMgr_Init(AudioMgr* audioMgr, void* stack, OSPri pri, OSId id, SchedCon
|
|||||||
Audio_Init();
|
Audio_Init();
|
||||||
AudioLoad_SetDmaHandler(DmaMgr_DmaHandler);
|
AudioLoad_SetDmaHandler(DmaMgr_DmaHandler);
|
||||||
Audio_InitSound();
|
Audio_InitSound();
|
||||||
osSendMesg(&audioMgr->unk_C8, NULL, OS_MESG_BLOCK);
|
osSendMesgPtr(&audioMgr->unk_C8, NULL, OS_MESG_BLOCK);
|
||||||
ModInternal_ExecuteAudioInitHooks();
|
ModInternal_ExecuteAudioInitHooks();
|
||||||
// Removed due to crash
|
// Removed due to crash
|
||||||
//IrqMgr_AddClient(audioMgr->irqMgr, &irqClient, &audioMgr->unk_74);
|
//IrqMgr_AddClient(audioMgr->irqMgr, &irqClient, &audioMgr->unk_74);
|
||||||
|
@ -251,7 +251,7 @@ void AudioHeap_PopCache(s32 tableType) {
|
|||||||
persistent->numEntries--;
|
persistent->numEntries--;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioHeap_InitMainPools(ptrdiff_t initPoolSize) {
|
void AudioHeap_InitMainPools(size_t initPoolSize) {
|
||||||
AudioHeap_AllocPoolInit(&gAudioContext.audioInitPool, gAudioContext.audioHeap, initPoolSize);
|
AudioHeap_AllocPoolInit(&gAudioContext.audioInitPool, gAudioContext.audioHeap, initPoolSize);
|
||||||
AudioHeap_AllocPoolInit(&gAudioContext.audioSessionPool, gAudioContext.audioHeap + initPoolSize,
|
AudioHeap_AllocPoolInit(&gAudioContext.audioSessionPool, gAudioContext.audioHeap + initPoolSize,
|
||||||
gAudioContext.audioHeapSize - initPoolSize);
|
gAudioContext.audioHeapSize - initPoolSize);
|
||||||
@ -1150,9 +1150,9 @@ void AudioHeap_UnapplySampleCacheForFont(SampleCacheEntry* entry, s32 fontId) {
|
|||||||
Drum* drum;
|
Drum* drum;
|
||||||
Instrument* inst;
|
Instrument* inst;
|
||||||
SoundFontSound* sfx;
|
SoundFontSound* sfx;
|
||||||
s32 instId;
|
size_t instId;
|
||||||
s32 drumId;
|
size_t drumId;
|
||||||
s32 sfxId;
|
size_t sfxId;
|
||||||
|
|
||||||
for (instId = 0; instId < gAudioContext.soundFonts[fontId].numInstruments; instId++) {
|
for (instId = 0; instId < gAudioContext.soundFonts[fontId].numInstruments; instId++) {
|
||||||
inst = Audio_GetInstrumentInner(fontId, instId);
|
inst = Audio_GetInstrumentInner(fontId, instId);
|
||||||
@ -1203,7 +1203,7 @@ void AudioHeap_DiscardSampleCacheEntry(SampleCacheEntry* entry) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioHeap_UnapplySampleCache(SampleCacheEntry* entry, SoundFontSample* sample)
|
void AudioHeap_UnapplySampleCache(SampleCacheEntry* entry, SoundFontSample* sample)
|
||||||
{
|
{
|
||||||
if (!gUseLegacySD)
|
if (!gUseLegacySD)
|
||||||
return;
|
return;
|
||||||
@ -1272,18 +1272,18 @@ void AudioHeap_DiscardSampleCaches(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u32 oldAddr;
|
uintptr_t oldAddr;
|
||||||
u32 newAddr;
|
uintptr_t newAddr;
|
||||||
size_t size;
|
size_t size;
|
||||||
u8 newMedium;
|
u8 newMedium;
|
||||||
} StorageChange;
|
} StorageChange;
|
||||||
|
|
||||||
void AudioHeap_ChangeStorage(StorageChange* change, SoundFontSample* sample) {
|
void AudioHeap_ChangeStorage(StorageChange* change, SoundFontSample* sample) {
|
||||||
if (sample != NULL) {
|
if (sample != NULL) {
|
||||||
u32 start = change->oldAddr;
|
uintptr_t start = change->oldAddr;
|
||||||
u32 end = change->oldAddr + change->size;
|
uintptr_t end = change->oldAddr + change->size;
|
||||||
|
|
||||||
if (start <= (u32)sample->sampleAddr && (u32)sample->sampleAddr < end) {
|
if (start <= sample->sampleAddr && sample->sampleAddr < end) {
|
||||||
sample->sampleAddr = sample->sampleAddr - start + change->newAddr;
|
sample->sampleAddr = sample->sampleAddr - start + change->newAddr;
|
||||||
sample->medium = change->newMedium;
|
sample->medium = change->newMedium;
|
||||||
}
|
}
|
||||||
@ -1306,7 +1306,7 @@ void AudioHeap_ApplySampleBankCacheInternal(s32 apply, s32 sampleBankId) {
|
|||||||
s32 numFonts;
|
s32 numFonts;
|
||||||
s32 instId;
|
s32 instId;
|
||||||
s32 drumId;
|
s32 drumId;
|
||||||
s32 sfxId;
|
size_t sfxId;
|
||||||
StorageChange change;
|
StorageChange change;
|
||||||
s32 sampleBankId1;
|
s32 sampleBankId1;
|
||||||
s32 sampleBankId2;
|
s32 sampleBankId2;
|
||||||
|
@ -10,8 +10,8 @@ const s16 D_8014A6C0[] = {
|
|||||||
0x0030, // gTatumsPerBeat
|
0x0030, // gTatumsPerBeat
|
||||||
};
|
};
|
||||||
|
|
||||||
//const AudioContextInitSizes D_8014A6C4 = { 0x37F00, 0xE0E0, 0xBCE0 };
|
// OTRTODO: This might be overkill...
|
||||||
const AudioContextInitSizes D_8014A6C4 = { 0x37F000, 0xE0E00, 0xBCE00 }; // OTRTODO: This might be overkill...
|
const AudioContextInitSizes D_8014A6C4 = { 0x37F000, 0xE0E00, 0xBCE00 };
|
||||||
|
|
||||||
ReverbSettings D_80133420[][3] = {
|
ReverbSettings D_80133420[][3] = {
|
||||||
{
|
{
|
||||||
|
@ -21,8 +21,8 @@ typedef enum {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
/* 0x00 */ s32 sampleBankId1;
|
/* 0x00 */ s32 sampleBankId1;
|
||||||
/* 0x04 */ s32 sampleBankId2;
|
/* 0x04 */ s32 sampleBankId2;
|
||||||
/* 0x08 */ s32 baseAddr1;
|
/* 0x08 */ intptr_t baseAddr1;
|
||||||
/* 0x0C */ s32 baseAddr2;
|
/* 0x0C */ intptr_t baseAddr2;
|
||||||
/* 0x10 */ u32 medium1;
|
/* 0x10 */ u32 medium1;
|
||||||
/* 0x14 */ u32 medium2;
|
/* 0x14 */ u32 medium2;
|
||||||
} RelocInfo; // size = 0x18
|
} RelocInfo; // size = 0x18
|
||||||
@ -40,27 +40,28 @@ void AudioLoad_ProcessAsyncLoad(AudioAsyncLoad* asyncLoad, s32 resetStatus);
|
|||||||
void AudioLoad_RelocateFontAndPreloadSamples(s32 fontId, SoundFontData* mem, RelocInfo* relocInfo, s32 temporary);
|
void AudioLoad_RelocateFontAndPreloadSamples(s32 fontId, SoundFontData* mem, RelocInfo* relocInfo, s32 temporary);
|
||||||
void AudioLoad_RelocateSample(SoundFontSound* sound, SoundFontData* mem, RelocInfo* relocInfo, int fontId);
|
void AudioLoad_RelocateSample(SoundFontSound* sound, SoundFontData* mem, RelocInfo* relocInfo, int fontId);
|
||||||
void AudioLoad_DiscardFont(s32 fontId);
|
void AudioLoad_DiscardFont(s32 fontId);
|
||||||
u32 AudioLoad_TrySyncLoadSampleBank(u32 sampleBankId, u32* outMedium, s32 noLoad);
|
uintptr_t AudioLoad_TrySyncLoadSampleBank(u32 sampleBankId, u32* outMedium, s32 noLoad);
|
||||||
void* AudioLoad_SyncLoad(u32 tableType, u32 tableId, s32* didAllocate);
|
uintptr_t AudioLoad_SyncLoad(u32 tableType, u32 tableId, s32* didAllocate);
|
||||||
u32 AudioLoad_GetRealTableIndex(s32 tableType, u32 tableId);
|
u32 AudioLoad_GetRealTableIndex(s32 tableType, u32 tableId);
|
||||||
void* AudioLoad_SearchCaches(s32 tableType, s32 id);
|
void* AudioLoad_SearchCaches(s32 tableType, s32 id);
|
||||||
AudioTable* AudioLoad_GetLoadTable(s32 tableType);
|
AudioTable* AudioLoad_GetLoadTable(s32 tableType);
|
||||||
void AudioLoad_SyncDma(uintptr_t devAddr, u8* addr, size_t size, s32 medium);
|
void AudioLoad_SyncDma(uintptr_t devAddr, u8* addr, size_t size, s32 medium);
|
||||||
void AudioLoad_SyncDmaUnkMedium(u32 devAddr, u8* addr, size_t size, s32 unkMediumParam);
|
void AudioLoad_SyncDmaUnkMedium(uintptr_t devAddr, u8* addr, size_t size, s32 unkMediumParam);
|
||||||
s32 AudioLoad_Dma(OSIoMesg* mesg, u32 priority, s32 direction, u32 devAddr, void* ramAddr, size_t size,
|
s32 AudioLoad_Dma(OSIoMesg* mesg, u32 priority, s32 direction, uintptr_t devAddr, uintptr_t ramAddr, size_t size,
|
||||||
OSMesgQueue* reqQueue, s32 medium, const char* dmaFuncType);
|
OSMesgQueue* reqQueue, s32 medium, const char* dmaFuncType);
|
||||||
void* AudioLoad_AsyncLoadInner(s32 tableType, s32 id, s32 nChunks, s32 retData, OSMesgQueue* retQueue);
|
void* AudioLoad_AsyncLoadInner(s32 tableType, s32 id, s32 nChunks, s32 retData, OSMesgQueue* retQueue);
|
||||||
AudioAsyncLoad* AudioLoad_StartAsyncLoadUnkMedium(s32 unkMediumParam, u32 devAddr, void* ramAddr, ptrdiff_t size, s32 medium,
|
AudioAsyncLoad* AudioLoad_StartAsyncLoadUnkMedium(s32 unkMediumParam, uintptr_t devAddr, uintptr_t ramAddr,
|
||||||
|
size_t size, s32 medium,
|
||||||
s32 nChunks, OSMesgQueue* retQueue, s32 retMsg);
|
s32 nChunks, OSMesgQueue* retQueue, s32 retMsg);
|
||||||
AudioAsyncLoad* AudioLoad_StartAsyncLoad(u32 devAddr, void* ramAddr, size_t size, s32 medium, s32 nChunks,
|
AudioAsyncLoad* AudioLoad_StartAsyncLoad(uintptr_t devAddr, uintptr_t ramAddr, size_t size, s32 medium, s32 nChunks,
|
||||||
OSMesgQueue* retQueue, s32 retMsg);
|
OSMesgQueue* retQueue, s32 retMsg);
|
||||||
void AudioLoad_AsyncDma(AudioAsyncLoad* asyncLoad, size_t size);
|
void AudioLoad_AsyncDma(AudioAsyncLoad* asyncLoad, size_t size);
|
||||||
void AudioLoad_AsyncDmaUnkMedium(u32 devAddr, void* ramAddr, size_t size, s16 arg3);
|
void AudioLoad_AsyncDmaUnkMedium(uintptr_t devAddr, uintptr_t ramAddr, size_t size, s16 arg3);
|
||||||
u8* AudioLoad_SyncLoadSeq(s32 seqId);
|
u8* AudioLoad_SyncLoadSeq(s32 seqId);
|
||||||
s32 AudioLoad_ProcessSamplePreloads(s32 resetStatus);
|
s32 AudioLoad_ProcessSamplePreloads(s32 resetStatus);
|
||||||
void AudioLoad_DmaSlowCopy(AudioSlowLoad* slowLoad, ptrdiff_t size);
|
void AudioLoad_DmaSlowCopy(AudioSlowLoad* slowLoad, size_t size);
|
||||||
void AudioLoad_ProcessSlowLoads(s32 resetStatus);
|
void AudioLoad_ProcessSlowLoads(s32 resetStatus);
|
||||||
void AudioLoad_DmaSlowCopyUnkMedium(s32 devAddr, u8* ramAddr, ptrdiff_t size, s32 arg3);
|
void AudioLoad_DmaSlowCopyUnkMedium(uintptr_t devAddr, uintptr_t ramAddr, size_t size, s32 arg3);
|
||||||
|
|
||||||
OSMesgQueue sScriptLoadQueue;
|
OSMesgQueue sScriptLoadQueue;
|
||||||
OSMesg sScriptLoadMesgBuf[0x10];
|
OSMesg sScriptLoadMesgBuf[0x10];
|
||||||
@ -115,11 +116,11 @@ void AudioLoad_DecreaseSampleDmaTtls(void) {
|
|||||||
gAudioContext.unused2628 = 0;
|
gAudioContext.unused2628 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* AudioLoad_DmaSampleData(u32 devAddr, size_t size, s32 arg2, u8* dmaIndexRef, s32 medium) {
|
uintptr_t AudioLoad_DmaSampleData(uintptr_t devAddr, size_t size, s32 arg2, u8* dmaIndexRef, s32 medium) {
|
||||||
s32 pad1;
|
s32 pad1;
|
||||||
SampleDma* dma;
|
SampleDma* dma;
|
||||||
s32 hasDma = false;
|
s32 hasDma = false;
|
||||||
u32 dmaDevAddr;
|
uintptr_t dmaDevAddr;
|
||||||
u32 pad2;
|
u32 pad2;
|
||||||
u32 dmaIndex;
|
u32 dmaIndex;
|
||||||
u32 transfer;
|
u32 transfer;
|
||||||
@ -288,7 +289,6 @@ void AudioLoad_InitSampleDmaBuffers(s32 arg0) {
|
|||||||
|
|
||||||
s32 AudioLoad_IsFontLoadComplete(s32 fontId) {
|
s32 AudioLoad_IsFontLoadComplete(s32 fontId) {
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (fontId == 0xFF) {
|
if (fontId == 0xFF) {
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -390,7 +390,7 @@ SoundFontData* AudioLoad_SyncLoadSeqFonts(s32 seqId, u32* outDefaultFontId) {
|
|||||||
|
|
||||||
while (numFonts > 0) {
|
while (numFonts > 0) {
|
||||||
fontId = gAudioContext.sequenceFontTable[index++];
|
fontId = gAudioContext.sequenceFontTable[index++];
|
||||||
|
|
||||||
font = AudioLoad_SyncLoadFont(fontId);
|
font = AudioLoad_SyncLoadFont(fontId);
|
||||||
numFonts--;
|
numFonts--;
|
||||||
}
|
}
|
||||||
@ -416,7 +416,7 @@ void AudioLoad_SyncLoadSeqParts(s32 seqId, s32 arg1) {
|
|||||||
s32 AudioLoad_SyncLoadSample(SoundFontSample* sample, s32 fontId) {
|
s32 AudioLoad_SyncLoadSample(SoundFontSample* sample, s32 fontId) {
|
||||||
void* sampleAddr;
|
void* sampleAddr;
|
||||||
|
|
||||||
if (sample->unk_bit25 == 1)
|
if (sample->unk_bit25 == 1)
|
||||||
{
|
{
|
||||||
if (sample->medium != MEDIUM_RAM) {
|
if (sample->medium != MEDIUM_RAM) {
|
||||||
sampleAddr = AudioHeap_AllocSampleCache(sample->size, fontId, (void*)sample->sampleAddr, sample->medium,
|
sampleAddr = AudioHeap_AllocSampleCache(sample->size, fontId, (void*)sample->sampleAddr, sample->medium,
|
||||||
@ -464,7 +464,7 @@ s32 AudioLoad_SyncLoadInstrument(s32 fontId, s32 instId, s32 drumId) {
|
|||||||
|
|
||||||
void AudioLoad_AsyncLoad(s32 tableType, s32 id, s32 nChunks, s32 retData, OSMesgQueue* retQueue) {
|
void AudioLoad_AsyncLoad(s32 tableType, s32 id, s32 nChunks, s32 retData, OSMesgQueue* retQueue) {
|
||||||
if (AudioLoad_AsyncLoadInner(tableType, id, nChunks, retData, retQueue) == NULL) {
|
if (AudioLoad_AsyncLoadInner(tableType, id, nChunks, retData, retQueue) == NULL) {
|
||||||
osSendMesg(retQueue, 0xFFFFFFFF, OS_MESG_NOBLOCK);
|
osSendMesg32(retQueue, 0xFFFFFFFF, OS_MESG_NOBLOCK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -483,7 +483,7 @@ void AudioLoad_AsyncLoadFont(s32 fontId, s32 arg1, s32 retData, OSMesgQueue* ret
|
|||||||
u8* AudioLoad_GetFontsForSequence(s32 seqId, u32* outNumFonts) {
|
u8* AudioLoad_GetFontsForSequence(s32 seqId, u32* outNumFonts) {
|
||||||
s32 index;
|
s32 index;
|
||||||
|
|
||||||
if (!gUseLegacySD)
|
if (!gUseLegacySD)
|
||||||
{
|
{
|
||||||
if (seqId == 255)
|
if (seqId == 255)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -555,6 +555,8 @@ s32 AudioLoad_SyncInitSeqPlayer(s32 playerIdx, s32 seqId, s32 arg2) {
|
|||||||
// call matches but is UB because it too is missing a return, and using the
|
// call matches but is UB because it too is missing a return, and using the
|
||||||
// result of a non-void function that has failed to return a value is UB.
|
// result of a non-void function that has failed to return a value is UB.
|
||||||
// The callers of this function do not use the return value, so it's fine.
|
// The callers of this function do not use the return value, so it's fine.
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 AudioLoad_SyncInitSeqPlayerSkipTicks(s32 playerIdx, s32 seqId, s32 skipTicks) {
|
s32 AudioLoad_SyncInitSeqPlayerSkipTicks(s32 playerIdx, s32 seqId, s32 skipTicks) {
|
||||||
@ -565,6 +567,8 @@ s32 AudioLoad_SyncInitSeqPlayerSkipTicks(s32 playerIdx, s32 seqId, s32 skipTicks
|
|||||||
gAudioContext.seqPlayers[playerIdx].skipTicks = skipTicks;
|
gAudioContext.seqPlayers[playerIdx].skipTicks = skipTicks;
|
||||||
AudioLoad_SyncInitSeqPlayerInternal(playerIdx, seqId, 0);
|
AudioLoad_SyncInitSeqPlayerInternal(playerIdx, seqId, 0);
|
||||||
// Missing return, see above.
|
// Missing return, see above.
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 AudioLoad_SyncInitSeqPlayerInternal(s32 playerIdx, s32 seqId, s32 arg2) {
|
s32 AudioLoad_SyncInitSeqPlayerInternal(s32 playerIdx, s32 seqId, s32 arg2) {
|
||||||
@ -581,6 +585,8 @@ s32 AudioLoad_SyncInitSeqPlayerInternal(s32 playerIdx, s32 seqId, s32 arg2) {
|
|||||||
AudioSeq_SequencePlayerDisable(seqPlayer);
|
AudioSeq_SequencePlayerDisable(seqPlayer);
|
||||||
|
|
||||||
fontId = 0xFF;
|
fontId = 0xFF;
|
||||||
|
index = ((u16*)gAudioContext.sequenceFontTable)[seqId];
|
||||||
|
numFonts = gAudioContext.sequenceFontTable[index++];
|
||||||
|
|
||||||
if (gUseLegacySD) {
|
if (gUseLegacySD) {
|
||||||
index = ((u16*)gAudioContext.sequenceFontTable)[seqId];
|
index = ((u16*)gAudioContext.sequenceFontTable)[seqId];
|
||||||
@ -594,11 +600,11 @@ s32 AudioLoad_SyncInitSeqPlayerInternal(s32 playerIdx, s32 seqId, s32 arg2) {
|
|||||||
numFonts--;
|
numFonts--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SequenceData seqData2 = ResourceMgr_LoadSeqByName(sequenceMap[seqId]);
|
SequenceData seqData2 = ResourceMgr_LoadSeqByName(sequenceMap[seqId]);
|
||||||
|
|
||||||
for (int i = 0; i < seqData2.numFonts; i++)
|
for (int i = 0; i < seqData2.numFonts; i++)
|
||||||
{
|
{
|
||||||
fontId = seqData2.fonts[i];
|
fontId = seqData2.fonts[i];
|
||||||
AudioLoad_SyncLoadFont(fontId); // NOTE: If this is commented out, then enemies will play child link sounds...
|
AudioLoad_SyncLoadFont(fontId); // NOTE: If this is commented out, then enemies will play child link sounds...
|
||||||
@ -607,14 +613,13 @@ s32 AudioLoad_SyncInitSeqPlayerInternal(s32 playerIdx, s32 seqId, s32 arg2) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
seqData = AudioLoad_SyncLoadSeq(seqId);
|
seqData = AudioLoad_SyncLoadSeq(seqId);
|
||||||
|
|
||||||
if (seqData == NULL) {
|
if (seqData == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioSeq_ResetSequencePlayer(seqPlayer);
|
AudioSeq_ResetSequencePlayer(seqPlayer);
|
||||||
seqPlayer->seqId = seqId;
|
seqPlayer->seqId = seqId;
|
||||||
|
|
||||||
if (gUseLegacySD)
|
if (gUseLegacySD)
|
||||||
seqPlayer->defaultFont = AudioLoad_GetRealTableIndex(FONT_TABLE, fontId);
|
seqPlayer->defaultFont = AudioLoad_GetRealTableIndex(FONT_TABLE, fontId);
|
||||||
else
|
else
|
||||||
@ -642,12 +647,12 @@ u8* AudioLoad_SyncLoadSeq(s32 seqId) {
|
|||||||
return AudioLoad_SyncLoad(SEQUENCE_TABLE, seqId, &didAllocate);
|
return AudioLoad_SyncLoad(SEQUENCE_TABLE, seqId, &didAllocate);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 AudioLoad_GetSampleBank(u32 sampleBankId, u32* outMedium) {
|
uintptr_t AudioLoad_GetSampleBank(u32 sampleBankId, u32* outMedium) {
|
||||||
return AudioLoad_TrySyncLoadSampleBank(sampleBankId, outMedium, true);
|
return AudioLoad_TrySyncLoadSampleBank(sampleBankId, outMedium, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 AudioLoad_TrySyncLoadSampleBank(u32 sampleBankId, u32* outMedium, s32 noLoad) {
|
uintptr_t AudioLoad_TrySyncLoadSampleBank(u32 sampleBankId, u32* outMedium, s32 noLoad) {
|
||||||
void* ret;
|
uintptr_t ret;
|
||||||
AudioTable* sampleBankTable;
|
AudioTable* sampleBankTable;
|
||||||
u32 realTableId = AudioLoad_GetRealTableIndex(SAMPLE_TABLE, sampleBankId);
|
u32 realTableId = AudioLoad_GetRealTableIndex(SAMPLE_TABLE, sampleBankId);
|
||||||
s8 cachePolicy;
|
s8 cachePolicy;
|
||||||
@ -727,7 +732,7 @@ SoundFontData* AudioLoad_SyncLoadFont(u32 fontId) {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* AudioLoad_SyncLoad(u32 tableType, u32 id, s32* didAllocate) {
|
uintptr_t AudioLoad_SyncLoad(u32 tableType, u32 id, s32* didAllocate) {
|
||||||
size_t size;
|
size_t size;
|
||||||
AudioTable* table;
|
AudioTable* table;
|
||||||
s32 pad;
|
s32 pad;
|
||||||
@ -735,7 +740,7 @@ void* AudioLoad_SyncLoad(u32 tableType, u32 id, s32* didAllocate) {
|
|||||||
s32 status;
|
s32 status;
|
||||||
uintptr_t romAddr;
|
uintptr_t romAddr;
|
||||||
s32 cachePolicy;
|
s32 cachePolicy;
|
||||||
void* ret;
|
uintptr_t ret;
|
||||||
u32 realId;
|
u32 realId;
|
||||||
|
|
||||||
realId = AudioLoad_GetRealTableIndex(tableType, id);
|
realId = AudioLoad_GetRealTableIndex(tableType, id);
|
||||||
@ -743,8 +748,7 @@ void* AudioLoad_SyncLoad(u32 tableType, u32 id, s32* didAllocate) {
|
|||||||
if (ret != NULL) {
|
if (ret != NULL) {
|
||||||
*didAllocate = false;
|
*didAllocate = false;
|
||||||
status = 2;
|
status = 2;
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
char* seqData = 0;
|
char* seqData = 0;
|
||||||
SoundFont* fnt;
|
SoundFont* fnt;
|
||||||
|
|
||||||
@ -756,8 +760,8 @@ void* AudioLoad_SyncLoad(u32 tableType, u32 id, s32* didAllocate) {
|
|||||||
medium = sData.medium;
|
medium = sData.medium;
|
||||||
cachePolicy = sData.cachePolicy;
|
cachePolicy = sData.cachePolicy;
|
||||||
romAddr = 0;
|
romAddr = 0;
|
||||||
}
|
}
|
||||||
else if (!gUseLegacySD && tableType == FONT_TABLE)
|
else if (!gUseLegacySD && tableType == FONT_TABLE)
|
||||||
{
|
{
|
||||||
fnt = ResourceMgr_LoadAudioSoundFont(fontMap[id]);
|
fnt = ResourceMgr_LoadAudioSoundFont(fontMap[id]);
|
||||||
size = sizeof(SoundFont);
|
size = sizeof(SoundFont);
|
||||||
@ -765,7 +769,7 @@ void* AudioLoad_SyncLoad(u32 tableType, u32 id, s32* didAllocate) {
|
|||||||
cachePolicy = 0;
|
cachePolicy = 0;
|
||||||
romAddr = 0;
|
romAddr = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
table = AudioLoad_GetLoadTable(tableType);
|
table = AudioLoad_GetLoadTable(tableType);
|
||||||
size = table->entries[realId].size;
|
size = table->entries[realId].size;
|
||||||
@ -837,7 +841,7 @@ void* AudioLoad_SyncLoad(u32 tableType, u32 id, s32* didAllocate) {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 AudioLoad_GetRealTableIndex(s32 tableType, u32 id)
|
u32 AudioLoad_GetRealTableIndex(s32 tableType, u32 id)
|
||||||
{
|
{
|
||||||
if ((tableType == SEQUENCE_TABLE || tableType == FONT_TABLE) && !gUseLegacySD) {
|
if ((tableType == SEQUENCE_TABLE || tableType == FONT_TABLE) && !gUseLegacySD) {
|
||||||
return id;
|
return id;
|
||||||
@ -845,7 +849,7 @@ u32 AudioLoad_GetRealTableIndex(s32 tableType, u32 id)
|
|||||||
|
|
||||||
AudioTable* table = AudioLoad_GetLoadTable(tableType);
|
AudioTable* table = AudioLoad_GetLoadTable(tableType);
|
||||||
|
|
||||||
// If the size is 0, then this entry actually redirects to another entry.
|
// If the size is 0, then this entry actually redirects to another entry.
|
||||||
// The rom address is actually an index into the same table where the "real" data is.
|
// The rom address is actually an index into the same table where the "real" data is.
|
||||||
if (table->entries[id].size == 0) {
|
if (table->entries[id].size == 0) {
|
||||||
id = table->entries[id].romAddr;
|
id = table->entries[id].romAddr;
|
||||||
@ -891,14 +895,13 @@ AudioTable* AudioLoad_GetLoadTable(s32 tableType) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AudioLoad_RelocateFont(s32 fontId, SoundFontData* mem, RelocInfo* relocInfo) {
|
void AudioLoad_RelocateFont(s32 fontId, SoundFontData* mem, RelocInfo* relocInfo) {
|
||||||
u32 reloc;
|
uintptr_t reloc;
|
||||||
u32 reloc2;
|
uintptr_t reloc2;
|
||||||
Instrument* inst;
|
Instrument* inst;
|
||||||
Drum* drum;
|
Drum* drum;
|
||||||
SoundFontSound* sfx;
|
SoundFontSound* sfx;
|
||||||
s32 i;
|
s32 i;
|
||||||
SoundFont* sf = NULL;
|
SoundFont* sf = NULL;
|
||||||
|
|
||||||
s32 numDrums = 0;
|
s32 numDrums = 0;
|
||||||
s32 numInstruments = 0;
|
s32 numInstruments = 0;
|
||||||
s32 numSfx = 0;
|
s32 numSfx = 0;
|
||||||
@ -912,26 +915,25 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* mem, RelocInfo* relocInfo
|
|||||||
numDrums = sf->numDrums;
|
numDrums = sf->numDrums;
|
||||||
numInstruments = sf->numInstruments;
|
numInstruments = sf->numInstruments;
|
||||||
numSfx = sf->numSfx;
|
numSfx = sf->numSfx;
|
||||||
}
|
}
|
||||||
|
|
||||||
void** ptrs = (void**)mem;
|
void** ptrs = (void**)mem;
|
||||||
|
|
||||||
|
|
||||||
#define BASE_OFFSET(x) (void*)((u32)(x) + (u32)(mem))
|
#define BASE_OFFSET(x) (void*)((u32)(x) + (u32)(mem))
|
||||||
|
|
||||||
reloc2 = ptrs[0];
|
reloc2 = ptrs[0];
|
||||||
if (1) {}
|
if (1) {}
|
||||||
if ((reloc2 != 0 || !gUseLegacySD) && (numDrums != 0))
|
if ((reloc2 != 0 || !gUseLegacySD) && (numDrums != 0))
|
||||||
{
|
{
|
||||||
ptrs[0] = BASE_OFFSET(reloc2);
|
ptrs[0] = BASE_OFFSET(reloc2);
|
||||||
for (i = 0; i < numDrums; i++)
|
for (i = 0; i < numDrums; i++)
|
||||||
{
|
{
|
||||||
if (gUseLegacySD)
|
if (gUseLegacySD)
|
||||||
reloc = ((Drum**)ptrs[0])[i];
|
reloc = ((Drum**)ptrs[0])[i];
|
||||||
|
|
||||||
if (reloc != 0 || !gUseLegacySD)
|
if (reloc != 0 || !gUseLegacySD)
|
||||||
{
|
{
|
||||||
if (gUseLegacySD)
|
if (gUseLegacySD)
|
||||||
{
|
{
|
||||||
reloc = BASE_OFFSET(reloc);
|
reloc = BASE_OFFSET(reloc);
|
||||||
((Drum**)ptrs[0])[i] = drum = reloc;
|
((Drum**)ptrs[0])[i] = drum = reloc;
|
||||||
@ -940,15 +942,15 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* mem, RelocInfo* relocInfo
|
|||||||
if (!gUseLegacySD)
|
if (!gUseLegacySD)
|
||||||
drum = sf->drums[i];
|
drum = sf->drums[i];
|
||||||
|
|
||||||
if (!drum->loaded)
|
if (!drum->loaded)
|
||||||
{
|
{
|
||||||
if (!gUseLegacySD)
|
if (!gUseLegacySD)
|
||||||
{
|
{
|
||||||
AudioLoad_RelocateSample(&sf->drums[i]->sound, mem, relocInfo, fontOffsets[fontId]);
|
AudioLoad_RelocateSample(&sf->drums[i]->sound, mem, relocInfo, fontOffsets[fontId]);
|
||||||
//reloc = drum->envelope;
|
//reloc = drum->envelope;
|
||||||
drum->loaded = 1;
|
drum->loaded = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AudioLoad_RelocateSample(&drum->sound, mem, relocInfo, fontOffsets[fontId]);
|
AudioLoad_RelocateSample(&drum->sound, mem, relocInfo, fontOffsets[fontId]);
|
||||||
reloc = drum->envelope;
|
reloc = drum->envelope;
|
||||||
@ -966,7 +968,7 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* mem, RelocInfo* relocInfo
|
|||||||
ptrs[1] = BASE_OFFSET(reloc2);
|
ptrs[1] = BASE_OFFSET(reloc2);
|
||||||
for (i = 0; i < numSfx; i++) {
|
for (i = 0; i < numSfx; i++) {
|
||||||
reloc = (SoundFontSound*)ptrs[1] + i;
|
reloc = (SoundFontSound*)ptrs[1] + i;
|
||||||
if (reloc != 0 || !gUseLegacySD)
|
if (reloc != 0 || !gUseLegacySD)
|
||||||
{
|
{
|
||||||
if (!gUseLegacySD) {
|
if (!gUseLegacySD) {
|
||||||
AudioLoad_RelocateSample(&sf->soundEffects[i].sample, mem, relocInfo, fontOffsets[fontId]);
|
AudioLoad_RelocateSample(&sf->soundEffects[i].sample, mem, relocInfo, fontOffsets[fontId]);
|
||||||
@ -979,7 +981,7 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* mem, RelocInfo* relocInfo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (numInstruments > 0x7E) {
|
if (numInstruments > 0x7E) {
|
||||||
numInstruments = 0x7E;
|
numInstruments = 0x7E;
|
||||||
}
|
}
|
||||||
@ -988,7 +990,7 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* mem, RelocInfo* relocInfo
|
|||||||
int startEC = gUseLegacySD ? 2 + numInstruments - 1 : numInstruments - 1;
|
int startEC = gUseLegacySD ? 2 + numInstruments - 1 : numInstruments - 1;
|
||||||
//for (i = 2; i <= 2 + numInstruments - 1; i++) {
|
//for (i = 2; i <= 2 + numInstruments - 1; i++) {
|
||||||
for (i = startI; i <= startEC; i++) {
|
for (i = startI; i <= startEC; i++) {
|
||||||
if (!gUseLegacySD || ptrs[i] != NULL)
|
if (!gUseLegacySD || ptrs[i] != NULL)
|
||||||
{
|
{
|
||||||
ptrs[i] = BASE_OFFSET(ptrs[i]);
|
ptrs[i] = BASE_OFFSET(ptrs[i]);
|
||||||
|
|
||||||
@ -996,9 +998,9 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* mem, RelocInfo* relocInfo
|
|||||||
inst = ptrs[i];
|
inst = ptrs[i];
|
||||||
else
|
else
|
||||||
inst = sf->instruments[i];
|
inst = sf->instruments[i];
|
||||||
|
|
||||||
if (inst != NULL && !inst->loaded) {
|
if (inst != NULL && !inst->loaded) {
|
||||||
if (inst->normalRangeLo != 0)
|
if (inst->normalRangeLo != 0)
|
||||||
{
|
{
|
||||||
AudioLoad_RelocateSample(&inst->lowNotesSound, mem, relocInfo, fontOffsets[fontId]);
|
AudioLoad_RelocateSample(&inst->lowNotesSound, mem, relocInfo, fontOffsets[fontId]);
|
||||||
}
|
}
|
||||||
@ -1008,10 +1010,10 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* mem, RelocInfo* relocInfo
|
|||||||
}
|
}
|
||||||
|
|
||||||
reloc = inst->envelope;
|
reloc = inst->envelope;
|
||||||
|
|
||||||
if (gUseLegacySD)
|
if (gUseLegacySD)
|
||||||
inst->envelope = BASE_OFFSET(reloc);
|
inst->envelope = BASE_OFFSET(reloc);
|
||||||
|
|
||||||
inst->loaded = 1;
|
inst->loaded = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1050,10 +1052,10 @@ void AudioLoad_SyncDma(uintptr_t devAddr, u8* addr, size_t size, s32 medium) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioLoad_SyncDmaUnkMedium(u32 devAddr, u8* addr, size_t size, s32 unkMediumParam) {
|
void AudioLoad_SyncDmaUnkMedium(uintptr_t devAddr, u8* addr, size_t size, s32 unkMediumParam) {
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 AudioLoad_Dma(OSIoMesg* mesg, u32 priority, s32 direction, u32 devAddr, void* ramAddr, size_t size,
|
s32 AudioLoad_Dma(OSIoMesg* mesg, u32 priority, s32 direction, uintptr_t devAddr, uintptr_t ramAddr, size_t size,
|
||||||
OSMesgQueue* reqQueue, s32 medium, const char* dmaFuncType) {
|
OSMesgQueue* reqQueue, s32 medium, const char* dmaFuncType) {
|
||||||
if (gAudioContext.resetTimer > 0x10) {
|
if (gAudioContext.resetTimer > 0x10) {
|
||||||
return -1;
|
return -1;
|
||||||
@ -1079,7 +1081,7 @@ void* AudioLoad_AsyncLoadInner(s32 tableType, s32 id, s32 nChunks, s32 retData,
|
|||||||
void* ret;
|
void* ret;
|
||||||
s32 medium;
|
s32 medium;
|
||||||
s8 cachePolicy;
|
s8 cachePolicy;
|
||||||
u32 devAddr;
|
uintptr_t devAddr;
|
||||||
s32 status;
|
s32 status;
|
||||||
u32 temp_v0;
|
u32 temp_v0;
|
||||||
u32 realId;
|
u32 realId;
|
||||||
@ -1106,7 +1108,7 @@ void* AudioLoad_AsyncLoadInner(s32 tableType, s32 id, s32 nChunks, s32 retData,
|
|||||||
ret = AudioLoad_SearchCaches(tableType, realId);
|
ret = AudioLoad_SearchCaches(tableType, realId);
|
||||||
if (ret != NULL) {
|
if (ret != NULL) {
|
||||||
status = 2;
|
status = 2;
|
||||||
osSendMesg(retQueue, MK_ASYNC_MSG(retData, 0, 0, 0), OS_MESG_NOBLOCK);
|
osSendMesg32(retQueue, MK_ASYNC_MSG(retData, 0, 0, 0), OS_MESG_NOBLOCK);
|
||||||
} else {
|
} else {
|
||||||
sp50 = AudioLoad_GetLoadTable(tableType);
|
sp50 = AudioLoad_GetLoadTable(tableType);
|
||||||
size = sp50->entries[realId].size;
|
size = sp50->entries[realId].size;
|
||||||
@ -1206,7 +1208,7 @@ s32 AudioLoad_AssertValidAddr(uintptr_t ramAddr, uintptr_t startAddr, size_t siz
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define BASE_ROM_OFFSET(x) (void*)((u32)(x) + (u32)(romAddr))
|
#define BASE_ROM_OFFSET(x) (uintptr_t)((uintptr_t)(x) + (uintptr_t)(romAddr))
|
||||||
|
|
||||||
void AudioLoad_InitSwapFontSampleHeaders(SoundFontSample* sample, uintptr_t romAddr) {
|
void AudioLoad_InitSwapFontSampleHeaders(SoundFontSample* sample, uintptr_t romAddr) {
|
||||||
size_t maxSoundFontSize = 0x3AA0; // soundFont 0 is the largest size at 0x3AA0
|
size_t maxSoundFontSize = 0x3AA0; // soundFont 0 is the largest size at 0x3AA0
|
||||||
@ -1282,7 +1284,7 @@ void AudioLoad_InitSwapFont(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// sfxs
|
// sfxs
|
||||||
ptrs[1] = (void*)BOMSWAP32((u32)ptrs[1]);
|
ptrs[1] = (void*)BOMSWAP32((uintptr_t)ptrs[1]);
|
||||||
if ((ptrs[1] != NULL) && (numSfxs != 0)) {
|
if ((ptrs[1] != NULL) && (numSfxs != 0)) {
|
||||||
sfxList = (SoundFontSound*)BASE_ROM_OFFSET(ptrs[1]);
|
sfxList = (SoundFontSound*)BASE_ROM_OFFSET(ptrs[1]);
|
||||||
|
|
||||||
@ -1332,25 +1334,18 @@ void AudioLoad_InitSwapFont(void) {
|
|||||||
|
|
||||||
#undef BASE_ROM_OFFSET
|
#undef BASE_ROM_OFFSET
|
||||||
|
|
||||||
void AudioLoad_Init(void* heap, u32 heapSize) {
|
void AudioLoad_Init(void* heap, size_t heapSize) {
|
||||||
char pad[0x48];
|
char pad[0x48];
|
||||||
s32 numFonts;
|
s32 numFonts;
|
||||||
void* temp_v0_3;
|
void* temp_v0_3;
|
||||||
s32 i;
|
s32 i;
|
||||||
u64* heapP;
|
u64* heapP;
|
||||||
u8* ctxP;
|
|
||||||
s16* u2974p;
|
s16* u2974p;
|
||||||
|
|
||||||
D_801755D0 = NULL;
|
D_801755D0 = NULL;
|
||||||
gAudioContext.resetTimer = 0;
|
gAudioContext.resetTimer = 0;
|
||||||
|
|
||||||
{
|
memset(&gAudioContext, 0, sizeof(gAudioContext));
|
||||||
s32 i;
|
|
||||||
u8* ctxP = (u8*)&gAudioContext;
|
|
||||||
for (i = sizeof(gAudioContext); i >= 0; i--) {
|
|
||||||
*ctxP++ = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (osTvType) {
|
switch (osTvType) {
|
||||||
case OS_TV_PAL:
|
case OS_TV_PAL:
|
||||||
@ -1399,7 +1394,7 @@ void AudioLoad_Init(void* heap, u32 heapSize) {
|
|||||||
gAudioContext.audioHeapSize = heapSize;
|
gAudioContext.audioHeapSize = heapSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < (s32)gAudioContext.audioHeapSize / 8; i++) {
|
for (i = 0; i < gAudioContext.audioHeapSize / 8; i++) {
|
||||||
((u64*)gAudioContext.audioHeap)[i] = 0;
|
((u64*)gAudioContext.audioHeap)[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1437,7 +1432,7 @@ void AudioLoad_Init(void* heap, u32 heapSize) {
|
|||||||
if (gUseLegacySD)
|
if (gUseLegacySD)
|
||||||
numFonts = gAudioContext.soundFontTable->numEntries;
|
numFonts = gAudioContext.soundFontTable->numEntries;
|
||||||
|
|
||||||
if (gUseLegacySD)
|
if (gUseLegacySD)
|
||||||
{
|
{
|
||||||
gAudioContext.soundFonts = AudioHeap_Alloc(&gAudioContext.audioInitPool, numFonts * sizeof(SoundFont));
|
gAudioContext.soundFonts = AudioHeap_Alloc(&gAudioContext.audioInitPool, numFonts * sizeof(SoundFont));
|
||||||
|
|
||||||
@ -1450,7 +1445,7 @@ void AudioLoad_Init(void* heap, u32 heapSize) {
|
|||||||
int seqListSize = 0;
|
int seqListSize = 0;
|
||||||
char** seqList = ResourceMgr_ListFiles("audio/sequences*", &seqListSize);
|
char** seqList = ResourceMgr_ListFiles("audio/sequences*", &seqListSize);
|
||||||
|
|
||||||
for (int i = 0; i < seqListSize; i++)
|
for (size_t i = 0; i < seqListSize; i++)
|
||||||
{
|
{
|
||||||
SequenceData sDat = ResourceMgr_LoadSeqByName(seqList[i]);
|
SequenceData sDat = ResourceMgr_LoadSeqByName(seqList[i]);
|
||||||
|
|
||||||
@ -1465,7 +1460,7 @@ void AudioLoad_Init(void* heap, u32 heapSize) {
|
|||||||
int fntListSize = 0;
|
int fntListSize = 0;
|
||||||
char** fntList = ResourceMgr_ListFiles("audio/fonts*", &fntListSize);
|
char** fntList = ResourceMgr_ListFiles("audio/fonts*", &fntListSize);
|
||||||
|
|
||||||
for (int i = 0; i < fntListSize; i++)
|
for (int i = 0; i < fntListSize; i++)
|
||||||
{
|
{
|
||||||
SoundFont* sf = ResourceMgr_LoadAudioSoundFont(fntList[i]);
|
SoundFont* sf = ResourceMgr_LoadAudioSoundFont(fntList[i]);
|
||||||
|
|
||||||
@ -1485,12 +1480,12 @@ void AudioLoad_Init(void* heap, u32 heapSize) {
|
|||||||
|
|
||||||
if (temp_v0_3 = AudioHeap_Alloc(&gAudioContext.audioInitPool, D_8014A6C4.permanentPoolSize), temp_v0_3 == NULL) {
|
if (temp_v0_3 = AudioHeap_Alloc(&gAudioContext.audioInitPool, D_8014A6C4.permanentPoolSize), temp_v0_3 == NULL) {
|
||||||
// cast away const from D_8014A6C4
|
// cast away const from D_8014A6C4
|
||||||
*((u32*)&D_8014A6C4.permanentPoolSize) = 0;
|
// *((u32*)&D_8014A6C4.permanentPoolSize) = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioHeap_AllocPoolInit(&gAudioContext.permanentPool, temp_v0_3, D_8014A6C4.permanentPoolSize);
|
AudioHeap_AllocPoolInit(&gAudioContext.permanentPool, temp_v0_3, D_8014A6C4.permanentPoolSize);
|
||||||
gAudioContextInitalized = true;
|
gAudioContextInitalized = true;
|
||||||
osSendMesg(gAudioContext.taskStartQueueP, (void*)gAudioContext.totalTaskCnt, OS_MESG_NOBLOCK);
|
osSendMesg32(gAudioContext.taskStartQueueP, gAudioContext.totalTaskCnt, OS_MESG_NOBLOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioLoad_InitSlowLoads(void) {
|
void AudioLoad_InitSlowLoads(void) {
|
||||||
@ -1501,6 +1496,7 @@ void AudioLoad_InitSlowLoads(void) {
|
|||||||
s32 AudioLoad_SlowLoadSample(s32 fontId, s32 instId, s8* isDone) {
|
s32 AudioLoad_SlowLoadSample(s32 fontId, s32 instId, s8* isDone) {
|
||||||
SoundFontSample* sample;
|
SoundFontSample* sample;
|
||||||
AudioSlowLoad* slowLoad;
|
AudioSlowLoad* slowLoad;
|
||||||
|
|
||||||
sample = AudioLoad_GetFontSample(fontId, instId);
|
sample = AudioLoad_GetFontSample(fontId, instId);
|
||||||
if (sample == NULL) {
|
if (sample == NULL) {
|
||||||
*isDone = 0;
|
*isDone = 0;
|
||||||
@ -1639,14 +1635,14 @@ void AudioLoad_ProcessSlowLoads(s32 resetStatus) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioLoad_DmaSlowCopy(AudioSlowLoad* slowLoad, ptrdiff_t size) {
|
void AudioLoad_DmaSlowCopy(AudioSlowLoad* slowLoad, size_t size) {
|
||||||
Audio_InvalDCache(slowLoad->curRamAddr, size);
|
Audio_InvalDCache(slowLoad->curRamAddr, size);
|
||||||
osCreateMesgQueue(&slowLoad->msgqueue, &slowLoad->msg, 1);
|
osCreateMesgQueue(&slowLoad->msgqueue, &slowLoad->msg, 1);
|
||||||
AudioLoad_Dma(&slowLoad->ioMesg, OS_MESG_PRI_NORMAL, 0, slowLoad->curDevAddr, slowLoad->curRamAddr, size,
|
AudioLoad_Dma(&slowLoad->ioMesg, OS_MESG_PRI_NORMAL, 0, slowLoad->curDevAddr, slowLoad->curRamAddr, size,
|
||||||
&slowLoad->msgqueue, slowLoad->medium, "SLOWCOPY");
|
&slowLoad->msgqueue, slowLoad->medium, "SLOWCOPY");
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioLoad_DmaSlowCopyUnkMedium(s32 devAddr, u8* ramAddr, ptrdiff_t size, s32 arg3) {
|
void AudioLoad_DmaSlowCopyUnkMedium(uintptr_t devAddr, uintptr_t ramAddr, size_t size, s32 arg3) {
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 AudioLoad_SlowLoadSeq(s32 seqId, u8* ramAddr, s8* isDone) {
|
s32 AudioLoad_SlowLoadSeq(s32 seqId, u8* ramAddr, s8* isDone) {
|
||||||
@ -1660,19 +1656,16 @@ s32 AudioLoad_SlowLoadSeq(s32 seqId, u8* ramAddr, s8* isDone) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
seqId = AudioLoad_GetRealTableIndex(SEQUENCE_TABLE, seqId);
|
seqId = AudioLoad_GetRealTableIndex(SEQUENCE_TABLE, seqId);
|
||||||
|
|
||||||
seqTable = AudioLoad_GetLoadTable(SEQUENCE_TABLE);
|
seqTable = AudioLoad_GetLoadTable(SEQUENCE_TABLE);
|
||||||
|
|
||||||
slowLoad = &gAudioContext.slowLoads[gAudioContext.slowLoadPos];
|
slowLoad = &gAudioContext.slowLoads[gAudioContext.slowLoadPos];
|
||||||
if (slowLoad->status == LOAD_STATUS_DONE) {
|
if (slowLoad->status == LOAD_STATUS_DONE) {
|
||||||
slowLoad->status = LOAD_STATUS_WAITING;
|
slowLoad->status = LOAD_STATUS_WAITING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
slowLoad->sample.sampleAddr = NULL;
|
slowLoad->sample.sampleAddr = NULL;
|
||||||
slowLoad->isDone = isDone;
|
slowLoad->isDone = isDone;
|
||||||
|
|
||||||
if (!gUseLegacySD)
|
if (!gUseLegacySD)
|
||||||
{
|
{
|
||||||
SequenceData sData = ResourceMgr_LoadSeqByName(sequenceMap[seqId]);
|
SequenceData sData = ResourceMgr_LoadSeqByName(sequenceMap[seqId]);
|
||||||
char* seqData = sData.seqData;
|
char* seqData = sData.seqData;
|
||||||
@ -1708,7 +1701,8 @@ void AudioLoad_InitAsyncLoads(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioAsyncLoad* AudioLoad_StartAsyncLoadUnkMedium(s32 unkMediumParam, u32 devAddr, void* ramAddr, ptrdiff_t size, s32 medium,
|
AudioAsyncLoad* AudioLoad_StartAsyncLoadUnkMedium(s32 unkMediumParam, uintptr_t devAddr, uintptr_t ramAddr, size_t size,
|
||||||
|
s32 medium,
|
||||||
s32 nChunks, OSMesgQueue* retQueue, s32 retMsg) {
|
s32 nChunks, OSMesgQueue* retQueue, s32 retMsg) {
|
||||||
AudioAsyncLoad* asyncLoad;
|
AudioAsyncLoad* asyncLoad;
|
||||||
|
|
||||||
@ -1718,12 +1712,12 @@ AudioAsyncLoad* AudioLoad_StartAsyncLoadUnkMedium(s32 unkMediumParam, u32 devAdd
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
osSendMesg(&gAudioContext.asyncLoadUnkMediumQueue, asyncLoad, OS_MESG_NOBLOCK);
|
osSendMesgPtr(&gAudioContext.asyncLoadUnkMediumQueue, asyncLoad, OS_MESG_NOBLOCK);
|
||||||
asyncLoad->unkMediumParam = unkMediumParam;
|
asyncLoad->unkMediumParam = unkMediumParam;
|
||||||
return asyncLoad;
|
return asyncLoad;
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioAsyncLoad* AudioLoad_StartAsyncLoad(u32 devAddr, void* ramAddr, size_t size, s32 medium, s32 nChunks,
|
AudioAsyncLoad* AudioLoad_StartAsyncLoad(uintptr_t devAddr, uintptr_t ramAddr, size_t size, s32 medium, s32 nChunks,
|
||||||
OSMesgQueue* retQueue, s32 retMsg) {
|
OSMesgQueue* retQueue, s32 retMsg) {
|
||||||
AudioAsyncLoad* asyncLoad;
|
AudioAsyncLoad* asyncLoad;
|
||||||
s32 i;
|
s32 i;
|
||||||
@ -1751,7 +1745,7 @@ AudioAsyncLoad* AudioLoad_StartAsyncLoad(u32 devAddr, void* ramAddr, size_t size
|
|||||||
} else if (nChunks == 1) {
|
} else if (nChunks == 1) {
|
||||||
asyncLoad->chunkSize = size;
|
asyncLoad->chunkSize = size;
|
||||||
} else {
|
} else {
|
||||||
asyncLoad->chunkSize = ALIGN256((s32)size / nChunks);
|
asyncLoad->chunkSize = ALIGN256(size / nChunks);
|
||||||
if (asyncLoad->chunkSize < 0x100) {
|
if (asyncLoad->chunkSize < 0x100) {
|
||||||
asyncLoad->chunkSize = 0x100;
|
asyncLoad->chunkSize = 0x100;
|
||||||
}
|
}
|
||||||
@ -1834,7 +1828,7 @@ void AudioLoad_FinishAsyncLoad(AudioAsyncLoad* asyncLoad) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
doneMsg = asyncLoad->retMsg;
|
doneMsg.data32 = asyncLoad->retMsg;
|
||||||
if (1) {}
|
if (1) {}
|
||||||
asyncLoad->status = LOAD_STATUS_WAITING;
|
asyncLoad->status = LOAD_STATUS_WAITING;
|
||||||
osSendMesg(asyncLoad->retQueue, doneMsg, OS_MESG_NOBLOCK);
|
osSendMesg(asyncLoad->retQueue, doneMsg, OS_MESG_NOBLOCK);
|
||||||
@ -1896,14 +1890,14 @@ void AudioLoad_AsyncDma(AudioAsyncLoad* asyncLoad, size_t size) {
|
|||||||
asyncLoad->medium, "BGCOPY");
|
asyncLoad->medium, "BGCOPY");
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioLoad_AsyncDmaUnkMedium(u32 devAddr, void* ramAddr, size_t size, s16 arg3) {
|
void AudioLoad_AsyncDmaUnkMedium(uintptr_t devAddr, uintptr_t ramAddr, size_t size, s16 arg3) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#define RELOC(v, base) (reloc = (void*)((u32)(v) + (u32)(base)))
|
#define RELOC(v, base) (reloc = (uintptr_t)((uintptr_t)(v) + (uintptr_t)(base)))
|
||||||
|
|
||||||
void AudioLoad_RelocateSample(SoundFontSound* sound, SoundFontData* mem, RelocInfo* relocInfo, int fontId) {
|
void AudioLoad_RelocateSample(SoundFontSound* sound, SoundFontData* mem, RelocInfo* relocInfo, int fontId) {
|
||||||
size_t maxSoundBankSize = 0x3EB2A0; // sample bank 0 is largest size at 0x3EB2A0
|
size_t maxSoundBankSize = 0x3EB2A0; // sample bank 0 is largest size at 0x3EB2A0
|
||||||
if (gUseLegacySD)
|
if (gUseLegacySD)
|
||||||
{
|
{
|
||||||
// NOTE: This is hack to detect whether or not the sample has been relocated.
|
// NOTE: This is hack to detect whether or not the sample has been relocated.
|
||||||
if ((uintptr_t)mem <= maxSoundBankSize) {
|
if ((uintptr_t)mem <= maxSoundBankSize) {
|
||||||
@ -1915,7 +1909,7 @@ void AudioLoad_RelocateSample(SoundFontSound* sound, SoundFontData* mem, RelocIn
|
|||||||
void* reloc;
|
void* reloc;
|
||||||
|
|
||||||
// NOTE: Seems precarious to assume the RAM is never <= 0x3EB2A0, but it largely works.
|
// NOTE: Seems precarious to assume the RAM is never <= 0x3EB2A0, but it largely works.
|
||||||
if ((uintptr_t)sound->sample < maxSoundBankSize || !gUseLegacySD)
|
if ((uintptr_t)sound->sample < maxSoundBankSize || !gUseLegacySD)
|
||||||
{
|
{
|
||||||
if (!gUseLegacySD) {
|
if (!gUseLegacySD) {
|
||||||
SoundFontSample* sample2 = sound;
|
SoundFontSample* sample2 = sound;
|
||||||
@ -1958,7 +1952,7 @@ void AudioLoad_RelocateFontAndPreloadSamples(s32 fontId, SoundFontData* mem, Rel
|
|||||||
AudioPreloadReq* preload;
|
AudioPreloadReq* preload;
|
||||||
AudioPreloadReq* topPreload;
|
AudioPreloadReq* topPreload;
|
||||||
SoundFontSample* sample;
|
SoundFontSample* sample;
|
||||||
ptrdiff_t size;
|
size_t size;
|
||||||
s32 nChunks;
|
s32 nChunks;
|
||||||
u8* addr;
|
u8* addr;
|
||||||
s32 preloadInProgress;
|
s32 preloadInProgress;
|
||||||
@ -2021,12 +2015,12 @@ void AudioLoad_RelocateFontAndPreloadSamples(s32 fontId, SoundFontData* mem, Rel
|
|||||||
switch (async) {
|
switch (async) {
|
||||||
case false:
|
case false:
|
||||||
if (sample->medium == MEDIUM_UNK) {
|
if (sample->medium == MEDIUM_UNK) {
|
||||||
AudioLoad_SyncDmaUnkMedium((u32)sample->sampleAddr, addr, sample->size,
|
AudioLoad_SyncDmaUnkMedium(sample->sampleAddr, addr, sample->size,
|
||||||
gAudioContext.sampleBankTable->unkMediumParam);
|
gAudioContext.sampleBankTable->unkMediumParam);
|
||||||
sample->sampleAddr = addr;
|
sample->sampleAddr = addr;
|
||||||
sample->medium = MEDIUM_RAM;
|
sample->medium = MEDIUM_RAM;
|
||||||
} else {
|
} else {
|
||||||
AudioLoad_SyncDma((u32)sample->sampleAddr, addr, sample->size, sample->medium);
|
AudioLoad_SyncDma(sample->sampleAddr, addr, sample->size, sample->medium);
|
||||||
sample->sampleAddr = addr;
|
sample->sampleAddr = addr;
|
||||||
sample->medium = MEDIUM_RAM;
|
sample->medium = MEDIUM_RAM;
|
||||||
}
|
}
|
||||||
@ -2039,7 +2033,7 @@ void AudioLoad_RelocateFontAndPreloadSamples(s32 fontId, SoundFontData* mem, Rel
|
|||||||
preload->ramAddr = addr;
|
preload->ramAddr = addr;
|
||||||
preload->encodedInfo = (gAudioContext.preloadSampleStackTop << 24) | 0xFFFFFF;
|
preload->encodedInfo = (gAudioContext.preloadSampleStackTop << 24) | 0xFFFFFF;
|
||||||
preload->isFree = false;
|
preload->isFree = false;
|
||||||
preload->endAndMediumKey = (u32)sample->sampleAddr + sample->size + sample->medium;
|
preload->endAndMediumKey = sample->sampleAddr + sample->size + sample->medium;
|
||||||
gAudioContext.preloadSampleStackTop++;
|
gAudioContext.preloadSampleStackTop++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2050,7 +2044,7 @@ void AudioLoad_RelocateFontAndPreloadSamples(s32 fontId, SoundFontData* mem, Rel
|
|||||||
topPreload = &gAudioContext.preloadSampleStack[gAudioContext.preloadSampleStackTop - 1];
|
topPreload = &gAudioContext.preloadSampleStack[gAudioContext.preloadSampleStackTop - 1];
|
||||||
sample = topPreload->sample;
|
sample = topPreload->sample;
|
||||||
nChunks = (sample->size >> 12) + 1;
|
nChunks = (sample->size >> 12) + 1;
|
||||||
AudioLoad_StartAsyncLoad((u32)sample->sampleAddr, topPreload->ramAddr, sample->size, sample->medium, nChunks,
|
AudioLoad_StartAsyncLoad(sample->sampleAddr, topPreload->ramAddr, sample->size, sample->medium, nChunks,
|
||||||
&gAudioContext.preloadSampleQueue, topPreload->encodedInfo);
|
&gAudioContext.preloadSampleQueue, topPreload->encodedInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2059,7 +2053,7 @@ s32 AudioLoad_ProcessSamplePreloads(s32 resetStatus) {
|
|||||||
SoundFontSample* sample;
|
SoundFontSample* sample;
|
||||||
AudioPreloadReq* preload;
|
AudioPreloadReq* preload;
|
||||||
u32 preloadIndex;
|
u32 preloadIndex;
|
||||||
u32 key;
|
uintptr_t key;
|
||||||
u32 nChunks;
|
u32 nChunks;
|
||||||
s32 pad;
|
s32 pad;
|
||||||
|
|
||||||
@ -2188,7 +2182,7 @@ void AudioLoad_PreloadSamplesForFont(s32 fontId, s32 async, RelocInfo* relocInfo
|
|||||||
AudioPreloadReq* preload;
|
AudioPreloadReq* preload;
|
||||||
AudioPreloadReq* topPreload;
|
AudioPreloadReq* topPreload;
|
||||||
u8* addr = NULL;
|
u8* addr = NULL;
|
||||||
ptrdiff_t size;
|
size_t size;
|
||||||
s32 i;
|
s32 i;
|
||||||
SoundFontSample* sample;
|
SoundFontSample* sample;
|
||||||
s32 preloadInProgress;
|
s32 preloadInProgress;
|
||||||
@ -2256,7 +2250,6 @@ void AudioLoad_PreloadSamplesForFont(s32 fontId, s32 async, RelocInfo* relocInfo
|
|||||||
}
|
}
|
||||||
|
|
||||||
sample = gAudioContext.usedSamples[i];
|
sample = gAudioContext.usedSamples[i];
|
||||||
|
|
||||||
if (sample->medium == MEDIUM_RAM) {
|
if (sample->medium == MEDIUM_RAM) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -2289,12 +2282,12 @@ void AudioLoad_PreloadSamplesForFont(s32 fontId, s32 async, RelocInfo* relocInfo
|
|||||||
switch (async) {
|
switch (async) {
|
||||||
case false:
|
case false:
|
||||||
if (sample->medium == MEDIUM_UNK) {
|
if (sample->medium == MEDIUM_UNK) {
|
||||||
AudioLoad_SyncDmaUnkMedium((u32)sample->sampleAddr, addr, sample->size,
|
AudioLoad_SyncDmaUnkMedium(sample->sampleAddr, addr, sample->size,
|
||||||
gAudioContext.sampleBankTable->unkMediumParam);
|
gAudioContext.sampleBankTable->unkMediumParam);
|
||||||
sample->sampleAddr = addr;
|
sample->sampleAddr = addr;
|
||||||
sample->medium = MEDIUM_RAM;
|
sample->medium = MEDIUM_RAM;
|
||||||
} else {
|
} else {
|
||||||
AudioLoad_SyncDma((u32)sample->sampleAddr, addr, sample->size, sample->medium);
|
AudioLoad_SyncDma(sample->sampleAddr, addr, sample->size, sample->medium);
|
||||||
sample->sampleAddr = addr;
|
sample->sampleAddr = addr;
|
||||||
sample->medium = MEDIUM_RAM;
|
sample->medium = MEDIUM_RAM;
|
||||||
}
|
}
|
||||||
@ -2306,7 +2299,7 @@ void AudioLoad_PreloadSamplesForFont(s32 fontId, s32 async, RelocInfo* relocInfo
|
|||||||
preload->ramAddr = addr;
|
preload->ramAddr = addr;
|
||||||
preload->encodedInfo = (gAudioContext.preloadSampleStackTop << 24) | 0xFFFFFF;
|
preload->encodedInfo = (gAudioContext.preloadSampleStackTop << 24) | 0xFFFFFF;
|
||||||
preload->isFree = false;
|
preload->isFree = false;
|
||||||
preload->endAndMediumKey = (u32)sample->sampleAddr + sample->size + sample->medium;
|
preload->endAndMediumKey = sample->sampleAddr + sample->size + sample->medium;
|
||||||
gAudioContext.preloadSampleStackTop++;
|
gAudioContext.preloadSampleStackTop++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2317,7 +2310,7 @@ void AudioLoad_PreloadSamplesForFont(s32 fontId, s32 async, RelocInfo* relocInfo
|
|||||||
topPreload = &gAudioContext.preloadSampleStack[gAudioContext.preloadSampleStackTop - 1];
|
topPreload = &gAudioContext.preloadSampleStack[gAudioContext.preloadSampleStackTop - 1];
|
||||||
sample = topPreload->sample;
|
sample = topPreload->sample;
|
||||||
nChunks = (sample->size >> 12) + 1;
|
nChunks = (sample->size >> 12) + 1;
|
||||||
AudioLoad_StartAsyncLoad((u32)sample->sampleAddr, topPreload->ramAddr, sample->size, sample->medium, nChunks,
|
AudioLoad_StartAsyncLoad(sample->sampleAddr, topPreload->ramAddr, sample->size, sample->medium, nChunks,
|
||||||
&gAudioContext.preloadSampleQueue, topPreload->encodedInfo);
|
&gAudioContext.preloadSampleQueue, topPreload->encodedInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2333,11 +2326,11 @@ void AudioLoad_LoadPermanentSamples(void) {
|
|||||||
for (i = 0; i < gAudioContext.permanentPool.count; i++) {
|
for (i = 0; i < gAudioContext.permanentPool.count; i++) {
|
||||||
RelocInfo relocInfo;
|
RelocInfo relocInfo;
|
||||||
|
|
||||||
if (gAudioContext.permanentCache[i].tableType == FONT_TABLE)
|
if (gAudioContext.permanentCache[i].tableType == FONT_TABLE)
|
||||||
{
|
{
|
||||||
fontId = AudioLoad_GetRealTableIndex(FONT_TABLE, gAudioContext.permanentCache[i].id);
|
fontId = AudioLoad_GetRealTableIndex(FONT_TABLE, gAudioContext.permanentCache[i].id);
|
||||||
//fontId = gAudioContext.permanentCache[i].id;
|
//fontId = gAudioContext.permanentCache[i].id;
|
||||||
|
|
||||||
if (!gUseLegacySD) {
|
if (!gUseLegacySD) {
|
||||||
SoundFont* sf = ResourceMgr_LoadAudioSoundFont(fontMap[fontId]);
|
SoundFont* sf = ResourceMgr_LoadAudioSoundFont(fontMap[fontId]);
|
||||||
relocInfo.sampleBankId1 = sf->sampleBankId1;
|
relocInfo.sampleBankId1 = sf->sampleBankId1;
|
||||||
|
@ -286,11 +286,11 @@ void Audio_ProcessNotes(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
subAttrs.frequency *= playbackState->vibratoFreqScale * playbackState->portamentoFreqScale;
|
subAttrs.frequency *= playbackState->vibratoFreqScale * playbackState->portamentoFreqScale;
|
||||||
|
|
||||||
f32 resampRate = gAudioContext.audioBufferParameters.resampleRate;
|
f32 resampRate = gAudioContext.audioBufferParameters.resampleRate;
|
||||||
|
|
||||||
if (!gUseLegacySD && !noteSubEu2->bitField1.isSyntheticWave && noteSubEu2->sound.soundFontSound != NULL &&
|
if (!gUseLegacySD && !noteSubEu2->bitField1.isSyntheticWave && noteSubEu2->sound.soundFontSound != NULL &&
|
||||||
noteSubEu2->sound.soundFontSound->sample != NULL &&
|
noteSubEu2->sound.soundFontSound->sample != NULL &&
|
||||||
noteSubEu2->sound.soundFontSound->sample->sampleRateMagicValue == 'RIFF') {
|
noteSubEu2->sound.soundFontSound->sample->sampleRateMagicValue == 'RIFF') {
|
||||||
resampRate = CALC_RESAMPLE_FREQ(noteSubEu2->sound.soundFontSound->sample->sampleRate);
|
resampRate = CALC_RESAMPLE_FREQ(noteSubEu2->sound.soundFontSound->sample->sampleRate);
|
||||||
}
|
}
|
||||||
@ -320,7 +320,7 @@ SoundFontSound* Audio_InstrumentGetSound(Instrument* instrument, s32 semitone) {
|
|||||||
|
|
||||||
Instrument* Audio_GetInstrumentInner(s32 fontId, s32 instId) {
|
Instrument* Audio_GetInstrumentInner(s32 fontId, s32 instId) {
|
||||||
Instrument* inst;
|
Instrument* inst;
|
||||||
|
|
||||||
if (fontId == 0xFF) {
|
if (fontId == 0xFF) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -354,7 +354,6 @@ Instrument* Audio_GetInstrumentInner(s32 fontId, s32 instId) {
|
|||||||
gAudioContext.audioErrorFlags = ((fontId << 8) + instId) + 0x1000000;
|
gAudioContext.audioErrorFlags = ((fontId << 8) + instId) + 0x1000000;
|
||||||
return inst;
|
return inst;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return inst;
|
return inst;
|
||||||
}
|
}
|
||||||
|
@ -942,7 +942,7 @@ u8 AudioSeq_GetInstrument(SequenceChannel* channel, u8 instId, Instrument** inst
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inst->envelope != NULL)
|
if (inst->envelope != NULL)
|
||||||
{
|
{
|
||||||
adsr->envelope = inst->envelope;
|
adsr->envelope = inst->envelope;
|
||||||
adsr->releaseRate = (inst->releaseRate);
|
adsr->releaseRate = (inst->releaseRate);
|
||||||
@ -1067,8 +1067,7 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
|
|||||||
offset = ((u16*)gAudioContext.sequenceFontTable)[seqPlayer->seqId];
|
offset = ((u16*)gAudioContext.sequenceFontTable)[seqPlayer->seqId];
|
||||||
lowBits = gAudioContext.sequenceFontTable[offset];
|
lowBits = gAudioContext.sequenceFontTable[offset];
|
||||||
command = gAudioContext.sequenceFontTable[offset + lowBits - result];
|
command = gAudioContext.sequenceFontTable[offset + lowBits - result];
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
SequenceData sDat = ResourceMgr_LoadSeqByName(sequenceMap[seqPlayer->seqId]);
|
SequenceData sDat = ResourceMgr_LoadSeqByName(sequenceMap[seqPlayer->seqId]);
|
||||||
command = sDat.fonts[sDat.numFonts - result - 1];
|
command = sDat.fonts[sDat.numFonts - result - 1];
|
||||||
}
|
}
|
||||||
@ -1179,14 +1178,12 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
|
|||||||
result = (u8)parameters[0];
|
result = (u8)parameters[0];
|
||||||
command = (u8)parameters[0];
|
command = (u8)parameters[0];
|
||||||
|
|
||||||
if (seqPlayer->defaultFont != 0xFF)
|
if (seqPlayer->defaultFont != 0xFF) {
|
||||||
{
|
|
||||||
if (gUseLegacySD) {
|
if (gUseLegacySD) {
|
||||||
offset = ((u16*)gAudioContext.sequenceFontTable)[seqPlayer->seqId];
|
offset = ((u16*)gAudioContext.sequenceFontTable)[seqPlayer->seqId];
|
||||||
lowBits = gAudioContext.sequenceFontTable[offset];
|
lowBits = gAudioContext.sequenceFontTable[offset];
|
||||||
command = gAudioContext.sequenceFontTable[offset + lowBits - result];
|
command = gAudioContext.sequenceFontTable[offset + lowBits - result];
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
SequenceData sDat = ResourceMgr_LoadSeqByName(sequenceMap[seqPlayer->seqId]);
|
SequenceData sDat = ResourceMgr_LoadSeqByName(sequenceMap[seqPlayer->seqId]);
|
||||||
command = sDat.fonts[sDat.numFonts - result - 1];
|
command = sDat.fonts[sDat.numFonts - result - 1];
|
||||||
}
|
}
|
||||||
|
@ -382,11 +382,11 @@ void AudioSynth_EnvSetup1(Acmd* cmd, s32 arg1, s32 arg2, s32 arg3, s32 arg4) {
|
|||||||
void func_800DBD08(void) {
|
void func_800DBD08(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioSynth_LoadBuffer(Acmd* cmd, s32 arg1, s32 arg2, s32 arg3) {
|
void AudioSynth_LoadBuffer(Acmd* cmd, s32 arg1, s32 arg2, uintptr_t arg3) {
|
||||||
aLoadBuffer(cmd, arg3, arg1, arg2);
|
aLoadBuffer(cmd, arg3, arg1, arg2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioSynth_SaveBuffer(Acmd* cmd, s32 arg1, s32 arg2, s32 arg3) {
|
void AudioSynth_SaveBuffer(Acmd* cmd, s32 arg1, s32 arg2, uintptr_t arg3) {
|
||||||
aSaveBuffer(cmd, arg1, arg3, arg2);
|
aSaveBuffer(cmd, arg1, arg3, arg2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -678,11 +678,11 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSubEu, NoteSynthesisS
|
|||||||
s32 temp_v1_6;
|
s32 temp_v1_6;
|
||||||
void* buf;
|
void* buf;
|
||||||
s32 nSamplesToDecode;
|
s32 nSamplesToDecode;
|
||||||
u32 sampleAddr;
|
uintptr_t sampleAddr;
|
||||||
u32 samplesLenFixedPoint;
|
u32 samplesLenFixedPoint;
|
||||||
s32 samplesLenAdjusted;
|
s32 samplesLenAdjusted;
|
||||||
s32 nSamplesProcessed;
|
s32 nSamplesProcessed;
|
||||||
s32 loopEndPos;
|
uintptr_t loopEndPos;
|
||||||
s32 nSamplesToProcess;
|
s32 nSamplesToProcess;
|
||||||
s32 phi_s4;
|
s32 phi_s4;
|
||||||
s32 nFirstFrameSamplesToIgnore;
|
s32 nFirstFrameSamplesToIgnore;
|
||||||
@ -690,15 +690,15 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSubEu, NoteSynthesisS
|
|||||||
s32 frameSize;
|
s32 frameSize;
|
||||||
s32 nFramesToDecode;
|
s32 nFramesToDecode;
|
||||||
s32 skipInitialSamples;
|
s32 skipInitialSamples;
|
||||||
s32 sampleDataStart;
|
intptr_t sampleDataStart;
|
||||||
u8* sampleData;
|
u8* sampleData;
|
||||||
s32 nParts;
|
s32 nParts;
|
||||||
s32 curPart;
|
s32 curPart;
|
||||||
s32 sampleDataStartPad;
|
intptr_t sampleDataStartPad;
|
||||||
s32 side;
|
s32 side;
|
||||||
s32 resampledTempLen;
|
s32 resampledTempLen;
|
||||||
u16 noteSamplesDmemAddrBeforeResampling;
|
u16 noteSamplesDmemAddrBeforeResampling;
|
||||||
s32 sampleDataOffset;
|
intptr_t sampleDataOffset;
|
||||||
s32 thing;
|
s32 thing;
|
||||||
s32 s5;
|
s32 s5;
|
||||||
Note* note;
|
Note* note;
|
||||||
|
@ -39,8 +39,7 @@ extern u64 rspAspMainDataStart[];
|
|||||||
extern u64 rspAspMainDataEnd[];
|
extern u64 rspAspMainDataEnd[];
|
||||||
|
|
||||||
void AudioMgr_CreateNextAudioBuffer(s16* samples, u32 num_samples) {
|
void AudioMgr_CreateNextAudioBuffer(s16* samples, u32 num_samples) {
|
||||||
// OTRTODO: uintptr_t?
|
OSMesg sp4C;
|
||||||
u32 sp4C;
|
|
||||||
|
|
||||||
gAudioContext.totalTaskCnt++;
|
gAudioContext.totalTaskCnt++;
|
||||||
|
|
||||||
@ -51,7 +50,7 @@ void AudioMgr_CreateNextAudioBuffer(s16* samples, u32 num_samples) {
|
|||||||
if (gAudioContext.resetStatus != 0) {
|
if (gAudioContext.resetStatus != 0) {
|
||||||
if (AudioHeap_ResetStep() == 0) {
|
if (AudioHeap_ResetStep() == 0) {
|
||||||
if (gAudioContext.resetStatus == 0) {
|
if (gAudioContext.resetStatus == 0) {
|
||||||
osSendMesg(gAudioContext.audioResetQueueP, gAudioContext.audioResetSpecIdToLoad, OS_MESG_NOBLOCK);
|
osSendMesg8(gAudioContext.audioResetQueueP, gAudioContext.audioResetSpecIdToLoad, OS_MESG_NOBLOCK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -59,8 +58,8 @@ void AudioMgr_CreateNextAudioBuffer(s16* samples, u32 num_samples) {
|
|||||||
int j = 0;
|
int j = 0;
|
||||||
if (gAudioContext.resetStatus == 0) {
|
if (gAudioContext.resetStatus == 0) {
|
||||||
// msg = 0000RREE R = read pos, E = End Pos
|
// msg = 0000RREE R = read pos, E = End Pos
|
||||||
while (osRecvMesg(gAudioContext.cmdProcQueueP, (OSMesg*)&sp4C, OS_MESG_NOBLOCK) != -1) {
|
while (osRecvMesg(gAudioContext.cmdProcQueueP, &sp4C, OS_MESG_NOBLOCK) != -1) {
|
||||||
Audio_ProcessCmds(sp4C);
|
Audio_ProcessCmds(sp4C.data32);
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
if ((j == 0) && (gAudioContext.cmdQueueFinished)) {
|
if ((j == 0) && (gAudioContext.cmdQueueFinished)) {
|
||||||
@ -85,7 +84,7 @@ AudioTask* func_800E5000(void) {
|
|||||||
s16* currAiBuffer;
|
s16* currAiBuffer;
|
||||||
OSTask_t* task;
|
OSTask_t* task;
|
||||||
s32 index;
|
s32 index;
|
||||||
u32 sp4C;
|
OSMesg sp4C;
|
||||||
s32 sp48;
|
s32 sp48;
|
||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
@ -103,7 +102,7 @@ AudioTask* func_800E5000(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
osSendMesg(gAudioContext.taskStartQueueP, gAudioContext.totalTaskCnt, OS_MESG_NOBLOCK);
|
osSendMesg32(gAudioContext.taskStartQueueP, gAudioContext.totalTaskCnt, OS_MESG_NOBLOCK);
|
||||||
gAudioContext.rspTaskIdx ^= 1;
|
gAudioContext.rspTaskIdx ^= 1;
|
||||||
gAudioContext.curAIBufIdx++;
|
gAudioContext.curAIBufIdx++;
|
||||||
gAudioContext.curAIBufIdx %= 3;
|
gAudioContext.curAIBufIdx %= 3;
|
||||||
@ -150,7 +149,7 @@ AudioTask* func_800E5000(void) {
|
|||||||
if (gAudioContext.resetStatus != 0) {
|
if (gAudioContext.resetStatus != 0) {
|
||||||
if (AudioHeap_ResetStep() == 0) {
|
if (AudioHeap_ResetStep() == 0) {
|
||||||
if (gAudioContext.resetStatus == 0) {
|
if (gAudioContext.resetStatus == 0) {
|
||||||
osSendMesg(gAudioContext.audioResetQueueP, gAudioContext.audioResetSpecIdToLoad, OS_MESG_NOBLOCK);
|
osSendMesg8(gAudioContext.audioResetQueueP, gAudioContext.audioResetSpecIdToLoad, OS_MESG_NOBLOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
sWaitingAudioTask = NULL;
|
sWaitingAudioTask = NULL;
|
||||||
@ -187,11 +186,11 @@ AudioTask* func_800E5000(void) {
|
|||||||
j = 0;
|
j = 0;
|
||||||
if (gAudioContext.resetStatus == 0) {
|
if (gAudioContext.resetStatus == 0) {
|
||||||
// msg = 0000RREE R = read pos, E = End Pos
|
// msg = 0000RREE R = read pos, E = End Pos
|
||||||
while (osRecvMesg(gAudioContext.cmdProcQueueP, (OSMesg*)&sp4C, OS_MESG_NOBLOCK) != -1) {
|
while (osRecvMesg(gAudioContext.cmdProcQueueP, &sp4C, OS_MESG_NOBLOCK) != -1) {
|
||||||
if (1) {}
|
if (1) {}
|
||||||
if (1) {}
|
if (1) {}
|
||||||
if (1) {}
|
if (1) {}
|
||||||
Audio_ProcessCmds(sp4C);
|
Audio_ProcessCmds(sp4C.data32);
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
if ((j == 0) && (gAudioContext.cmdQueueFinished)) {
|
if ((j == 0) && (gAudioContext.cmdQueueFinished)) {
|
||||||
@ -387,11 +386,11 @@ void Audio_InitMesgQueuesInternal(void) {
|
|||||||
ARRAY_COUNT(gAudioContext.audioResetMesgs));
|
ARRAY_COUNT(gAudioContext.audioResetMesgs));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Audio_QueueCmd(u32 opArgs, void** data) {
|
void Audio_QueueCmd(u32 opArgs, u32 data) {
|
||||||
AudioCmd* cmd = &gAudioContext.cmdBuf[gAudioContext.cmdWrPos & 0xFF];
|
AudioCmd* cmd = &gAudioContext.cmdBuf[gAudioContext.cmdWrPos & 0xFF];
|
||||||
|
|
||||||
cmd->opArgs = opArgs;
|
cmd->opArgs = opArgs;
|
||||||
cmd->data = *data;
|
cmd->data = data;
|
||||||
|
|
||||||
gAudioContext.cmdWrPos++;
|
gAudioContext.cmdWrPos++;
|
||||||
|
|
||||||
@ -401,23 +400,28 @@ void Audio_QueueCmd(u32 opArgs, void** data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Audio_QueueCmdF32(u32 opArgs, f32 data) {
|
void Audio_QueueCmdF32(u32 opArgs, f32 data) {
|
||||||
Audio_QueueCmd(opArgs, (void**)&data);
|
union
|
||||||
|
{
|
||||||
|
f32 f;
|
||||||
|
u32 u;
|
||||||
|
} uData = { .f = data };
|
||||||
|
Audio_QueueCmd(opArgs, uData.u);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Audio_QueueCmdS32(u32 opArgs, s32 data) {
|
void Audio_QueueCmdS32(u32 opArgs, s32 data) {
|
||||||
Audio_QueueCmd(opArgs, (void**)&data);
|
Audio_QueueCmd(opArgs, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Audio_QueueCmdS8(u32 opArgs, s8 data) {
|
void Audio_QueueCmdS8(u32 opArgs, s8 data) {
|
||||||
u32 uData = data << 0x18;
|
u32 uData = data << 0x18;
|
||||||
|
|
||||||
Audio_QueueCmd(opArgs, (void**)&uData);
|
Audio_QueueCmd(opArgs, uData);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Audio_QueueCmdU16(u32 opArgs, u16 data) {
|
void Audio_QueueCmdU16(u32 opArgs, u16 data) {
|
||||||
u32 uData = data << 0x10;
|
u32 uData = data << 0x10;
|
||||||
|
|
||||||
Audio_QueueCmd(opArgs, (void**)&uData);
|
Audio_QueueCmd(opArgs, uData);
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 Audio_ScheduleProcessCmds(void) {
|
s32 Audio_ScheduleProcessCmds(void) {
|
||||||
@ -429,8 +433,8 @@ s32 Audio_ScheduleProcessCmds(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret =
|
ret =
|
||||||
osSendMesg(gAudioContext.cmdProcQueueP,
|
osSendMesg32(gAudioContext.cmdProcQueueP,
|
||||||
(void*)(((gAudioContext.cmdRdPos & 0xFF) << 8) | (gAudioContext.cmdWrPos & 0xFF)), OS_MESG_NOBLOCK);
|
(((gAudioContext.cmdRdPos & 0xFF) << 8) | (gAudioContext.cmdWrPos & 0xFF)), OS_MESG_NOBLOCK);
|
||||||
if (ret != -1) {
|
if (ret != -1) {
|
||||||
gAudioContext.cmdRdPos = gAudioContext.cmdWrPos;
|
gAudioContext.cmdRdPos = gAudioContext.cmdWrPos;
|
||||||
ret = 0;
|
ret = 0;
|
||||||
@ -532,11 +536,11 @@ void func_800E5EA4(s32 arg0, u32* arg1, u32* arg2) {
|
|||||||
|
|
||||||
s32 func_800E5EDC(void) {
|
s32 func_800E5EDC(void) {
|
||||||
s32 pad;
|
s32 pad;
|
||||||
s32 sp18;
|
OSMesg sp18;
|
||||||
|
|
||||||
if (osRecvMesg(gAudioContext.audioResetQueueP, (OSMesg*)&sp18, OS_MESG_NOBLOCK) == -1) {
|
if (osRecvMesg(gAudioContext.audioResetQueueP, &sp18, OS_MESG_NOBLOCK) == -1) {
|
||||||
return 0;
|
return 0;
|
||||||
} else if (gAudioContext.audioResetSpecIdToLoad != sp18) {
|
} else if (gAudioContext.audioResetSpecIdToLoad != sp18.data8) {
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
return 1;
|
return 1;
|
||||||
@ -546,7 +550,7 @@ s32 func_800E5EDC(void) {
|
|||||||
void func_800E5F34(void) {
|
void func_800E5F34(void) {
|
||||||
// macro?
|
// macro?
|
||||||
// clang-format off
|
// clang-format off
|
||||||
s32 chk = -1; s32 sp28; do {} while (osRecvMesg(gAudioContext.audioResetQueueP, (OSMesg*)&sp28, OS_MESG_NOBLOCK) != chk);
|
s32 chk = -1; OSMesg sp28; do {} while (osRecvMesg(gAudioContext.audioResetQueueP, &sp28, OS_MESG_NOBLOCK) != chk);
|
||||||
// clang-format on
|
// clang-format on
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1250,7 +1250,7 @@ s32 Audio_SetGanonDistVol(u8 targetVol);
|
|||||||
// Function originally not called, so repurposing for DPad input
|
// Function originally not called, so repurposing for DPad input
|
||||||
void func_800EC960(u8 dpad) {
|
void func_800EC960(u8 dpad) {
|
||||||
if (dpad) {
|
if (dpad) {
|
||||||
sOcarinaAllowedBtnMask =
|
sOcarinaAllowedBtnMask =
|
||||||
(BTN_A | BTN_CUP | BTN_CDOWN | BTN_CLEFT | BTN_CRIGHT | BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT);
|
(BTN_A | BTN_CUP | BTN_CDOWN | BTN_CLEFT | BTN_CRIGHT | BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT);
|
||||||
sOcarinaABtnMap = BTN_A;
|
sOcarinaABtnMap = BTN_A;
|
||||||
sOcarinaCUPBtnMap = BTN_CUP | BTN_DUP;
|
sOcarinaCUPBtnMap = BTN_CUP | BTN_DUP;
|
||||||
@ -4095,7 +4095,7 @@ void func_800F4870(u8 arg0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// (name derived from debug strings, should probably update. used in ganon/ganon_boss scenes)
|
// (name derived from debug strings, should probably update. used in ganon/ganon_boss scenes)
|
||||||
s32 Audio_SetGanonDistVol(u8 targetVol)
|
s32 Audio_SetGanonDistVol(u8 targetVol)
|
||||||
{
|
{
|
||||||
u8 phi_v0;
|
u8 phi_v0;
|
||||||
u16 phi_v0_2;
|
u16 phi_v0_2;
|
||||||
@ -4517,7 +4517,7 @@ void func_800F5C2C(void) {
|
|||||||
sPrevMainBgmSeqId = NA_BGM_DISABLED;
|
sPrevMainBgmSeqId = NA_BGM_DISABLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Audio_PlayFanfare(u16 seqId)
|
void Audio_PlayFanfare(u16 seqId)
|
||||||
{
|
{
|
||||||
u16 sp26;
|
u16 sp26;
|
||||||
u32 sp20;
|
u32 sp20;
|
||||||
|
@ -122,9 +122,9 @@ void Audio_ClearBGMMute(u8 channelIdx) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Audio_PlaySoundGeneral(u16 sfxId, Vec3f* pos, u8 token, f32* freqScale, f32* vol, s8* reverbAdd)
|
void Audio_PlaySoundGeneral(u16 sfxId, Vec3f* pos, u8 token, f32* freqScale, f32* vol, s8* reverbAdd)
|
||||||
{
|
{
|
||||||
u8 i;
|
size_t i;
|
||||||
SoundRequest* req;
|
SoundRequest* req;
|
||||||
|
|
||||||
if (!gSoundBankMuted[SFX_BANK_SHIFT(sfxId)]) {
|
if (!gSoundBankMuted[SFX_BANK_SHIFT(sfxId)]) {
|
||||||
@ -204,7 +204,7 @@ void Audio_RemoveMatchingSoundRequests(u8 aspect, SoundBankEntry* cmp) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Audio_ProcessSoundRequest(void)
|
void Audio_ProcessSoundRequest(void)
|
||||||
{
|
{
|
||||||
u16 sfxId;
|
u16 sfxId;
|
||||||
u8 count;
|
u8 count;
|
||||||
@ -307,7 +307,7 @@ void Audio_ProcessSoundRequest(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Audio_RemoveSoundBankEntry(u8 bankId, u8 entryIndex)
|
void Audio_RemoveSoundBankEntry(u8 bankId, u8 entryIndex)
|
||||||
{
|
{
|
||||||
SoundBankEntry* entry = &gSoundBanks[bankId][entryIndex];
|
SoundBankEntry* entry = &gSoundBanks[bankId][entryIndex];
|
||||||
u8 i;
|
u8 i;
|
||||||
@ -335,7 +335,7 @@ void Audio_RemoveSoundBankEntry(u8 bankId, u8 entryIndex)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Audio_ChooseActiveSounds(u8 bankId)
|
void Audio_ChooseActiveSounds(u8 bankId)
|
||||||
{
|
{
|
||||||
u8 numChosenSounds;
|
u8 numChosenSounds;
|
||||||
u8 numChannels;
|
u8 numChannels;
|
||||||
@ -492,7 +492,7 @@ void Audio_ChooseActiveSounds(u8 bankId)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Audio_PlayActiveSounds(u8 bankId)
|
void Audio_PlayActiveSounds(u8 bankId)
|
||||||
{
|
{
|
||||||
u8 entryIndex;
|
u8 entryIndex;
|
||||||
SequenceChannel* channel;
|
SequenceChannel* channel;
|
||||||
@ -553,7 +553,7 @@ void Audio_PlayActiveSounds(u8 bankId)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Audio_StopSfxByBank(u8 bankId)
|
void Audio_StopSfxByBank(u8 bankId)
|
||||||
{
|
{
|
||||||
SoundBankEntry* entry;
|
SoundBankEntry* entry;
|
||||||
s32 pad;
|
s32 pad;
|
||||||
@ -615,7 +615,7 @@ void Audio_StopSfxByPos(Vec3f* pos) {
|
|||||||
Audio_RemoveMatchingSoundRequests(2, &cmp);
|
Audio_RemoveMatchingSoundRequests(2, &cmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Audio_StopSfxByPosAndId(Vec3f* pos, u16 sfxId)
|
void Audio_StopSfxByPosAndId(Vec3f* pos, u16 sfxId)
|
||||||
{
|
{
|
||||||
SoundBankEntry* entry;
|
SoundBankEntry* entry;
|
||||||
u8 entryIndex = gSoundBanks[SFX_BANK(sfxId)][0].next;
|
u8 entryIndex = gSoundBanks[SFX_BANK(sfxId)][0].next;
|
||||||
@ -735,7 +735,7 @@ void func_800F8F88(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 Audio_IsSfxPlaying(u32 sfxId)
|
u8 Audio_IsSfxPlaying(u32 sfxId)
|
||||||
{
|
{
|
||||||
SoundBankEntry* entry;
|
SoundBankEntry* entry;
|
||||||
u8 entryIndex = gSoundBanks[SFX_BANK(sfxId)][0].next;
|
u8 entryIndex = gSoundBanks[SFX_BANK(sfxId)][0].next;
|
||||||
|
@ -240,7 +240,7 @@ int fbTest = -1;
|
|||||||
void GameState_Update(GameState* gameState) {
|
void GameState_Update(GameState* gameState) {
|
||||||
GraphicsContext* gfxCtx = gameState->gfxCtx;
|
GraphicsContext* gfxCtx = gameState->gfxCtx;
|
||||||
|
|
||||||
if (fbTest == -1)
|
if (fbTest == -1)
|
||||||
{
|
{
|
||||||
fbTest = gfx_create_framebuffer(64, 112);
|
fbTest = gfx_create_framebuffer(64, 112);
|
||||||
//fbTest = gfx_create_framebuffer(256, 512);
|
//fbTest = gfx_create_framebuffer(256, 512);
|
||||||
@ -323,18 +323,18 @@ void GameState_Update(GameState* gameState) {
|
|||||||
GameState_Draw(gameState, gfxCtx);
|
GameState_Draw(gameState, gfxCtx);
|
||||||
func_800C49F4(gfxCtx);
|
func_800C49F4(gfxCtx);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------
|
// -----------------------
|
||||||
// Cheats hooks
|
// Cheats hooks
|
||||||
// -----------------------
|
// -----------------------
|
||||||
|
|
||||||
// Inf Money
|
// Inf Money
|
||||||
if (CVar_GetS32("gInfiniteMoney", 0) != 0) {
|
if (CVar_GetS32("gInfiniteMoney", 0) != 0) {
|
||||||
if (gSaveContext.rupees < CUR_CAPACITY(UPG_WALLET)) {
|
if (gSaveContext.rupees < CUR_CAPACITY(UPG_WALLET)) {
|
||||||
gSaveContext.rupees = CUR_CAPACITY(UPG_WALLET);
|
gSaveContext.rupees = CUR_CAPACITY(UPG_WALLET);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inf Health
|
// Inf Health
|
||||||
if (CVar_GetS32("gInfiniteHealth", 0) != 0) {
|
if (CVar_GetS32("gInfiniteHealth", 0) != 0) {
|
||||||
if (gSaveContext.health < gSaveContext.healthCapacity) {
|
if (gSaveContext.health < gSaveContext.healthCapacity) {
|
||||||
@ -348,33 +348,33 @@ void GameState_Update(GameState* gameState) {
|
|||||||
if (AMMO(ITEM_STICK) < CUR_CAPACITY(UPG_STICKS)) {
|
if (AMMO(ITEM_STICK) < CUR_CAPACITY(UPG_STICKS)) {
|
||||||
AMMO(ITEM_STICK) = CUR_CAPACITY(UPG_STICKS);
|
AMMO(ITEM_STICK) = CUR_CAPACITY(UPG_STICKS);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deku Nuts
|
// Deku Nuts
|
||||||
if (AMMO(ITEM_NUT) < CUR_CAPACITY(UPG_NUTS)) {
|
if (AMMO(ITEM_NUT) < CUR_CAPACITY(UPG_NUTS)) {
|
||||||
AMMO(ITEM_NUT) = CUR_CAPACITY(UPG_NUTS);
|
AMMO(ITEM_NUT) = CUR_CAPACITY(UPG_NUTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bombs
|
// Bombs
|
||||||
if (AMMO(ITEM_BOMB) < CUR_CAPACITY(UPG_BOMB_BAG)) {
|
if (AMMO(ITEM_BOMB) < CUR_CAPACITY(UPG_BOMB_BAG)) {
|
||||||
AMMO(ITEM_BOMB) = CUR_CAPACITY(UPG_BOMB_BAG);
|
AMMO(ITEM_BOMB) = CUR_CAPACITY(UPG_BOMB_BAG);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fairy Bow (Ammo)
|
// Fairy Bow (Ammo)
|
||||||
if (AMMO(ITEM_BOW) < CUR_CAPACITY(UPG_QUIVER)) {
|
if (AMMO(ITEM_BOW) < CUR_CAPACITY(UPG_QUIVER)) {
|
||||||
AMMO(ITEM_BOW) = CUR_CAPACITY(UPG_QUIVER);
|
AMMO(ITEM_BOW) = CUR_CAPACITY(UPG_QUIVER);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fairy Slingshot (Ammo)
|
// Fairy Slingshot (Ammo)
|
||||||
if (AMMO(ITEM_SLINGSHOT) < CUR_CAPACITY(UPG_BULLET_BAG)) {
|
if (AMMO(ITEM_SLINGSHOT) < CUR_CAPACITY(UPG_BULLET_BAG)) {
|
||||||
AMMO(ITEM_SLINGSHOT) = CUR_CAPACITY(UPG_BULLET_BAG);
|
AMMO(ITEM_SLINGSHOT) = CUR_CAPACITY(UPG_BULLET_BAG);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bombchus (max: 50, no upgrades)
|
// Bombchus (max: 50, no upgrades)
|
||||||
if (AMMO(ITEM_BOMBCHU) < 50) {
|
if (AMMO(ITEM_BOMBCHU) < 50) {
|
||||||
AMMO(ITEM_BOMBCHU) = 50;
|
AMMO(ITEM_BOMBCHU) = 50;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inf Magic
|
// Inf Magic
|
||||||
if (CVar_GetS32("gInfiniteMagic", 0) != 0) {
|
if (CVar_GetS32("gInfiniteMagic", 0) != 0) {
|
||||||
if (gSaveContext.magicAcquired && gSaveContext.magic != (gSaveContext.doubleMagic + 1) * 0x30) {
|
if (gSaveContext.magicAcquired && gSaveContext.magic != (gSaveContext.doubleMagic + 1) * 0x30) {
|
||||||
@ -386,7 +386,7 @@ void GameState_Update(GameState* gameState) {
|
|||||||
if (CVar_GetS32("gInfiniteNayru", 0) != 0) {
|
if (CVar_GetS32("gInfiniteNayru", 0) != 0) {
|
||||||
gSaveContext.nayrusLoveTimer = 0x44B;
|
gSaveContext.nayrusLoveTimer = 0x44B;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Moon Jump On L
|
// Moon Jump On L
|
||||||
if (CVar_GetS32("gMoonJumpOnL", 0) != 0) {
|
if (CVar_GetS32("gMoonJumpOnL", 0) != 0) {
|
||||||
if (gGlobalCtx) {
|
if (gGlobalCtx) {
|
||||||
@ -424,7 +424,7 @@ void GameState_Update(GameState* gameState) {
|
|||||||
} else {
|
} else {
|
||||||
CVar_SetS32("gPrevTime", -1);
|
CVar_SetS32("gPrevTime", -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//since our CVar is same value and properly default to 0 there is not problems doing this in single line.
|
//since our CVar is same value and properly default to 0 there is not problems doing this in single line.
|
||||||
gSaveContext.language = CVar_GetS32("gLanguages", 0);
|
gSaveContext.language = CVar_GetS32("gLanguages", 0);
|
||||||
|
|
||||||
@ -525,7 +525,7 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g
|
|||||||
}
|
}
|
||||||
SpeedMeter_Init(&D_801664D0);
|
SpeedMeter_Init(&D_801664D0);
|
||||||
func_800AA0B4();
|
func_800AA0B4();
|
||||||
osSendMesg(&gameState->gfxCtx->queue, NULL, OS_MESG_BLOCK);
|
osSendMesgPtr(&gameState->gfxCtx->queue, NULL, OS_MESG_BLOCK);
|
||||||
|
|
||||||
endTime = osGetTime();
|
endTime = osGetTime();
|
||||||
// "Other initialization processing time %d us"
|
// "Other initialization processing time %d us"
|
||||||
|
@ -170,12 +170,12 @@ void Graph_TaskSet00(GraphicsContext* gfxCtx) {
|
|||||||
|
|
||||||
D_8016A528 = osGetTime() - sGraphSetTaskTime - D_8016A558;
|
D_8016A528 = osGetTime() - sGraphSetTaskTime - D_8016A558;
|
||||||
|
|
||||||
osSetTimer(&timer, OS_USEC_TO_CYCLES(3000000), 0, &gfxCtx->queue, (OSMesg)666);
|
osSetTimer(&timer, OS_USEC_TO_CYCLES(3000000), 0, &gfxCtx->queue, OS_MESG_32(666));
|
||||||
|
|
||||||
osRecvMesg(&gfxCtx->queue, &msg, OS_MESG_BLOCK);
|
osRecvMesg(&gfxCtx->queue, &msg, OS_MESG_BLOCK);
|
||||||
osStopTimer(&timer);
|
osStopTimer(&timer);
|
||||||
//OTRTODO - Proper GFX crash handler
|
//OTRTODO - Proper GFX crash handler
|
||||||
#if 0
|
#if 0
|
||||||
if (msg == (OSMesg)666) {
|
if (msg == (OSMesg)666) {
|
||||||
osSyncPrintf(VT_FGCOL(RED));
|
osSyncPrintf(VT_FGCOL(RED));
|
||||||
osSyncPrintf("RCPが帰ってきませんでした。"); // "RCP did not return."
|
osSyncPrintf("RCPが帰ってきませんでした。"); // "RCP did not return."
|
||||||
@ -194,7 +194,7 @@ void Graph_TaskSet00(GraphicsContext* gfxCtx) {
|
|||||||
}
|
}
|
||||||
Fault_AddHungupAndCrashImpl("RCP is HUNG UP!!", "Oh! MY GOD!!");
|
Fault_AddHungupAndCrashImpl("RCP is HUNG UP!!", "Oh! MY GOD!!");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
osRecvMesg(&gfxCtx->queue, &msg, OS_MESG_NOBLOCK);
|
osRecvMesg(&gfxCtx->queue, &msg, OS_MESG_NOBLOCK);
|
||||||
|
|
||||||
D_8012D260 = gfxCtx->workBuffer;
|
D_8012D260 = gfxCtx->workBuffer;
|
||||||
@ -243,7 +243,7 @@ void Graph_TaskSet00(GraphicsContext* gfxCtx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
scTask->msgQ = &gfxCtx->queue;
|
scTask->msgQ = &gfxCtx->queue;
|
||||||
scTask->msg = NULL;
|
scTask->msg.ptr = NULL;
|
||||||
|
|
||||||
cfb = &sGraphCfbInfos[sGraphCfbInfoIdx++];
|
cfb = &sGraphCfbInfos[sGraphCfbInfoIdx++];
|
||||||
cfb->fb1 = gfxCtx->curFrameBuffer;
|
cfb->fb1 = gfxCtx->curFrameBuffer;
|
||||||
@ -262,7 +262,7 @@ void Graph_TaskSet00(GraphicsContext* gfxCtx) {
|
|||||||
|
|
||||||
gfxCtx->schedMsgQ = &gSchedContext.cmdQ;
|
gfxCtx->schedMsgQ = &gSchedContext.cmdQ;
|
||||||
|
|
||||||
osSendMesg(&gSchedContext.cmdQ, scTask, OS_MESG_BLOCK);
|
osSendMesgPtr(&gSchedContext.cmdQ, scTask, OS_MESG_BLOCK);
|
||||||
Sched_SendEntryMsg(&gSchedContext);
|
Sched_SendEntryMsg(&gSchedContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -399,7 +399,7 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) {
|
|||||||
sGraphUpdateTime = time;
|
sGraphUpdateTime = time;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CVar_GetS32("gDebugEnabled", 0))
|
if (CVar_GetS32("gDebugEnabled", 0))
|
||||||
{
|
{
|
||||||
if (CHECK_BTN_ALL(gameState->input[0].press.button, BTN_Z) &&
|
if (CHECK_BTN_ALL(gameState->input[0].press.button, BTN_Z) &&
|
||||||
CHECK_BTN_ALL(gameState->input[0].cur.button, BTN_L | BTN_R)) {
|
CHECK_BTN_ALL(gameState->input[0].cur.button, BTN_L | BTN_R)) {
|
||||||
@ -475,14 +475,14 @@ static void RunFrame()
|
|||||||
{
|
{
|
||||||
uint64_t ticksA, ticksB;
|
uint64_t ticksA, ticksB;
|
||||||
ticksA = GetPerfCounter();
|
ticksA = GetPerfCounter();
|
||||||
|
|
||||||
Graph_StartFrame();
|
Graph_StartFrame();
|
||||||
|
|
||||||
// TODO: Workaround for rumble being too long. Implement os thread functions.
|
// TODO: Workaround for rumble being too long. Implement os thread functions.
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
PadMgr_ThreadEntry(&gPadMgr);
|
PadMgr_ThreadEntry(&gPadMgr);
|
||||||
}
|
}
|
||||||
|
|
||||||
Graph_Update(&runFrameContext.gfxCtx, runFrameContext.gameState);
|
Graph_Update(&runFrameContext.gfxCtx, runFrameContext.gameState);
|
||||||
ticksB = GetPerfCounter();
|
ticksB = GetPerfCounter();
|
||||||
|
|
||||||
|
@ -32,11 +32,11 @@ void IrqMgr_AddClient(IrqMgr* this, IrqMgrClient* c, OSMesgQueue* msgQ) {
|
|||||||
osSetIntMask(prevInt);
|
osSetIntMask(prevInt);
|
||||||
|
|
||||||
if (this->resetStatus > STATUS_IDLE) {
|
if (this->resetStatus > STATUS_IDLE) {
|
||||||
osSendMesg(c->queue, (OSMesg) & this->prenmiMsg, OS_MESG_NOBLOCK);
|
osSendMesgPtr(c->queue, &this->prenmiMsg, OS_MESG_NOBLOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->resetStatus >= STATUS_NMI) {
|
if (this->resetStatus >= STATUS_NMI) {
|
||||||
osSendMesg(c->queue, (OSMesg) & this->nmiMsg, OS_MESG_NOBLOCK);
|
osSendMesgPtr(c->queue, &this->nmiMsg, OS_MESG_NOBLOCK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,8 +107,8 @@ void IrqMgr_HandlePreNMI(IrqMgr* this) {
|
|||||||
this->resetStatus = STATUS_PRENMI;
|
this->resetStatus = STATUS_PRENMI;
|
||||||
sIrqMgrResetTime = this->resetTime = osGetTime();
|
sIrqMgrResetTime = this->resetTime = osGetTime();
|
||||||
|
|
||||||
osSetTimer(&this->timer, OS_USEC_TO_CYCLES(450000), 0ull, &this->queue, (OSMesg)PRENMI450_MSG);
|
osSetTimer(&this->timer, OS_USEC_TO_CYCLES(450000), 0ull, &this->queue, OS_MESG_32(PRENMI450_MSG));
|
||||||
IrqMgr_JamMesgForClient(this, (OSMesg) & this->prenmiMsg);
|
IrqMgr_JamMesgForClient(this, OS_MESG_PTR(&this->prenmiMsg));
|
||||||
}
|
}
|
||||||
|
|
||||||
void IrqMgr_CheckStack() {
|
void IrqMgr_CheckStack() {
|
||||||
@ -131,19 +131,19 @@ void IrqMgr_HandlePRENMI450(IrqMgr* this) {
|
|||||||
gIrqMgrResetStatus = temp;
|
gIrqMgrResetStatus = temp;
|
||||||
this->resetStatus = STATUS_NMI;
|
this->resetStatus = STATUS_NMI;
|
||||||
|
|
||||||
osSetTimer(&this->timer, OS_USEC_TO_CYCLES(30000), 0ull, &this->queue, (OSMesg)PRENMI480_MSG);
|
osSetTimer(&this->timer, OS_USEC_TO_CYCLES(30000), 0ull, &this->queue, OS_MESG_32(PRENMI480_MSG));
|
||||||
IrqMgr_SendMesgForClient(this, (OSMesg) & this->nmiMsg);
|
IrqMgr_SendMesgForClient(this, OS_MESG_PTR(&this->nmiMsg));
|
||||||
}
|
}
|
||||||
|
|
||||||
void IrqMgr_HandlePRENMI480(IrqMgr* this) {
|
void IrqMgr_HandlePRENMI480(IrqMgr* this) {
|
||||||
u32 ret;
|
u32 ret;
|
||||||
|
|
||||||
osSetTimer(&this->timer, OS_USEC_TO_CYCLES(20000), 0ull, &this->queue, (OSMesg)PRENMI500_MSG);
|
osSetTimer(&this->timer, OS_USEC_TO_CYCLES(20000), 0ull, &this->queue, OS_MESG_32(PRENMI500_MSG));
|
||||||
ret = osAfterPreNMI();
|
ret = osAfterPreNMI();
|
||||||
if (ret) {
|
if (ret) {
|
||||||
// "osAfterPreNMI returned %d !?"
|
// "osAfterPreNMI returned %d !?"
|
||||||
osSyncPrintf("osAfterPreNMIが %d を返しました!?\n", ret);
|
osSyncPrintf("osAfterPreNMIが %d を返しました!?\n", ret);
|
||||||
osSetTimer(&this->timer, OS_USEC_TO_CYCLES(1000), 0ull, &this->queue, (OSMesg)PRENMI480_MSG);
|
osSetTimer(&this->timer, OS_USEC_TO_CYCLES(1000), 0ull, &this->queue, OS_MESG_32(PRENMI480_MSG));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,7 +160,7 @@ void IrqMgr_HandleRetrace(IrqMgr* this) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
sIrqMgrRetraceCount++;
|
sIrqMgrRetraceCount++;
|
||||||
IrqMgr_SendMesgForClient(this, (OSMesg) & this->retraceMsg);
|
IrqMgr_SendMesgForClient(this, OS_MESG_PTR(&this->retraceMsg));
|
||||||
}
|
}
|
||||||
|
|
||||||
void IrqMgr_ThreadEntry(void* arg0) {
|
void IrqMgr_ThreadEntry(void* arg0) {
|
||||||
@ -168,13 +168,13 @@ void IrqMgr_ThreadEntry(void* arg0) {
|
|||||||
IrqMgr* this = (IrqMgr*)arg0;
|
IrqMgr* this = (IrqMgr*)arg0;
|
||||||
u8 exit;
|
u8 exit;
|
||||||
|
|
||||||
msg = 0;
|
msg.data32 = 0;
|
||||||
osSyncPrintf("IRQマネージャスレッド実行開始\n"); // "Start IRQ manager thread execution"
|
osSyncPrintf("IRQマネージャスレッド実行開始\n"); // "Start IRQ manager thread execution"
|
||||||
exit = false;
|
exit = false;
|
||||||
|
|
||||||
while (!exit) {
|
while (!exit) {
|
||||||
osRecvMesg(&this->queue, &msg, OS_MESG_BLOCK);
|
osRecvMesg(&this->queue, &msg, OS_MESG_BLOCK);
|
||||||
switch ((u32)msg) {
|
switch (msg.data32) {
|
||||||
case RETRACE_MSG:
|
case RETRACE_MSG:
|
||||||
IrqMgr_HandleRetrace(this);
|
IrqMgr_HandleRetrace(this);
|
||||||
break;
|
break;
|
||||||
@ -225,8 +225,8 @@ void IrqMgr_Init(IrqMgr* this, void* stack, OSPri pri, u8 retraceCount) {
|
|||||||
this->resetTime = 0;
|
this->resetTime = 0;
|
||||||
|
|
||||||
osCreateMesgQueue(&this->queue, this->msgBuf, ARRAY_COUNT(this->msgBuf));
|
osCreateMesgQueue(&this->queue, this->msgBuf, ARRAY_COUNT(this->msgBuf));
|
||||||
osSetEventMesg(OS_EVENT_PRENMI, &this->queue, (OSMesg)PRE_NMI_MSG);
|
osSetEventMesg(OS_EVENT_PRENMI, &this->queue, OS_MESG_32(PRE_NMI_MSG));
|
||||||
osViSetEvent(&this->queue, (OSMesg)RETRACE_MSG, retraceCount);
|
osViSetEvent(&this->queue, OS_MESG_32(RETRACE_MSG), retraceCount);
|
||||||
osCreateThread(&this->thread, 0x13, IrqMgr_ThreadEntry, this, stack, pri);
|
osCreateThread(&this->thread, 0x13, IrqMgr_ThreadEntry, this, stack, pri);
|
||||||
osStartThread(&this->thread);
|
osStartThread(&this->thread);
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
s32 gScreenWidth = SCREEN_WIDTH;
|
s32 gScreenWidth = SCREEN_WIDTH;
|
||||||
s32 gScreenHeight = SCREEN_HEIGHT;
|
s32 gScreenHeight = SCREEN_HEIGHT;
|
||||||
u32 gSystemHeapSize = 0;
|
size_t gSystemHeapSize = 0;
|
||||||
|
|
||||||
PreNmiBuff* gAppNmiBufferPtr;
|
PreNmiBuff* gAppNmiBufferPtr;
|
||||||
SchedContext gSchedContext;
|
SchedContext gSchedContext;
|
||||||
@ -53,7 +53,7 @@ void Main(void* arg) {
|
|||||||
uintptr_t sysHeap;
|
uintptr_t sysHeap;
|
||||||
uintptr_t fb;
|
uintptr_t fb;
|
||||||
void* debugHeap;
|
void* debugHeap;
|
||||||
s32 debugHeapSize;
|
size_t debugHeapSize;
|
||||||
s16* msg;
|
s16* msg;
|
||||||
|
|
||||||
osSyncPrintf("mainproc 実行開始\n"); // "Start running"
|
osSyncPrintf("mainproc 実行開始\n"); // "Start running"
|
||||||
@ -87,7 +87,7 @@ void Main(void* arg) {
|
|||||||
R_ENABLE_ARENA_DBG = 0;
|
R_ENABLE_ARENA_DBG = 0;
|
||||||
|
|
||||||
osCreateMesgQueue(&sSiIntMsgQ, sSiIntMsgBuf, 1);
|
osCreateMesgQueue(&sSiIntMsgQ, sSiIntMsgBuf, 1);
|
||||||
osSetEventMesg(5, &sSiIntMsgQ, 0);
|
osSetEventMesg(5, &sSiIntMsgQ, OS_MESG_PTR(NULL));
|
||||||
|
|
||||||
Main_LogSystemHeap();
|
Main_LogSystemHeap();
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ void Main(void* arg) {
|
|||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
msg = NULL;
|
msg = NULL;
|
||||||
osRecvMesg(&irqMgrMsgQ, (OSMesg)&msg, OS_MESG_BLOCK);
|
osRecvMesg(&irqMgrMsgQ, (OSMesg*)&msg, OS_MESG_BLOCK);
|
||||||
if (msg == NULL) {
|
if (msg == NULL) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ OSMesgQueue* PadMgr_LockSerialMesgQueue(PadMgr* padMgr) {
|
|||||||
padMgr->serialMsgQ.validCount, padMgr, &padMgr->serialMsgQ, &ctrlrQ);
|
padMgr->serialMsgQ.validCount, padMgr, &padMgr->serialMsgQ, &ctrlrQ);
|
||||||
}
|
}
|
||||||
|
|
||||||
osRecvMesg(&padMgr->serialMsgQ, (OSMesg)&ctrlrQ, OS_MESG_BLOCK);
|
osRecvMesg(&padMgr->serialMsgQ, (OSMesg*)&ctrlrQ, OS_MESG_BLOCK);
|
||||||
|
|
||||||
if (D_8012D280 > 2) {
|
if (D_8012D280 > 2) {
|
||||||
// "serialMsgQ Locked"
|
// "serialMsgQ Locked"
|
||||||
@ -38,7 +38,7 @@ void PadMgr_UnlockSerialMesgQueue(PadMgr* padMgr, OSMesgQueue* ctrlrQ) {
|
|||||||
padMgr->serialMsgQ.validCount, padMgr, &padMgr->serialMsgQ, ctrlrQ);
|
padMgr->serialMsgQ.validCount, padMgr, &padMgr->serialMsgQ, ctrlrQ);
|
||||||
}
|
}
|
||||||
|
|
||||||
osSendMesg(&padMgr->serialMsgQ, ctrlrQ, OS_MESG_BLOCK);
|
osSendMesgPtr(&padMgr->serialMsgQ, ctrlrQ, OS_MESG_BLOCK);
|
||||||
|
|
||||||
if (D_8012D280 > 2) {
|
if (D_8012D280 > 2) {
|
||||||
// "serialMsgQ Unlocked"
|
// "serialMsgQ Unlocked"
|
||||||
@ -52,7 +52,7 @@ void PadMgr_LockPadData(PadMgr* padMgr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PadMgr_UnlockPadData(PadMgr* padMgr) {
|
void PadMgr_UnlockPadData(PadMgr* padMgr) {
|
||||||
osSendMesg(&padMgr->lockMsgQ, NULL, OS_MESG_BLOCK);
|
osSendMesgPtr(&padMgr->lockMsgQ, NULL, OS_MESG_BLOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PadMgr_RumbleControl(PadMgr* padMgr) {
|
void PadMgr_RumbleControl(PadMgr* padMgr) {
|
||||||
@ -174,7 +174,7 @@ void PadMgr_RumbleStop(PadMgr* padMgr) {
|
|||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
if (osMotorInit(ctrlrQ, &padMgr->pfs[i], i) == 0) {
|
if (osMotorInit(ctrlrQ, &padMgr->pfs[i], i) == 0) {
|
||||||
#if 0
|
#if 0
|
||||||
if ((gFaultStruct.msgId == 0) && (padMgr->rumbleOnFrames != 0))
|
if ((gFaultStruct.msgId == 0) && (padMgr->rumbleOnFrames != 0))
|
||||||
{
|
{
|
||||||
osSyncPrintf(VT_FGCOL(YELLOW));
|
osSyncPrintf(VT_FGCOL(YELLOW));
|
||||||
// "Stop vibration pack"
|
// "Stop vibration pack"
|
||||||
@ -399,7 +399,7 @@ void PadMgr_ThreadEntry(PadMgr* padMgr) {
|
|||||||
osSyncPrintf("コントローラスレッドイベント待ち %lld\n", OS_CYCLES_TO_USEC(osGetTime()));
|
osSyncPrintf("コントローラスレッドイベント待ち %lld\n", OS_CYCLES_TO_USEC(osGetTime()));
|
||||||
}
|
}
|
||||||
|
|
||||||
osRecvMesg(&padMgr->interruptMsgQ, (OSMesg)&mesg, OS_MESG_BLOCK);
|
osRecvMesg(&padMgr->interruptMsgQ, (OSMesg*)&mesg, OS_MESG_BLOCK);
|
||||||
//LogUtils_CheckNullPointer("msg", mesg, "../padmgr.c", 563);
|
//LogUtils_CheckNullPointer("msg", mesg, "../padmgr.c", 563);
|
||||||
|
|
||||||
PadMgr_HandleRetraceMsg(padMgr);
|
PadMgr_HandleRetraceMsg(padMgr);
|
||||||
|
@ -84,12 +84,12 @@ void Sched_HandleReset(SchedContext* sc) {
|
|||||||
if (sc->curRSPTask != NULL) {
|
if (sc->curRSPTask != NULL) {
|
||||||
LOG_TIME("(((u64)(now - graph_rsp_start_time)*(1000000LL/15625LL))/((62500000LL*3/4)/15625LL))",
|
LOG_TIME("(((u64)(now - graph_rsp_start_time)*(1000000LL/15625LL))/((62500000LL*3/4)/15625LL))",
|
||||||
OS_CYCLES_TO_USEC(now - sRSPGFXStartTime), "../sched.c", 427);
|
OS_CYCLES_TO_USEC(now - sRSPGFXStartTime), "../sched.c", 427);
|
||||||
osSendMesg(&sc->interruptQ, RSP_DONE_MSG, OS_MESG_NOBLOCK);
|
osSendMesg32(&sc->interruptQ, RSP_DONE_MSG, OS_MESG_NOBLOCK);
|
||||||
}
|
}
|
||||||
if (sc->curRDPTask != NULL) {
|
if (sc->curRDPTask != NULL) {
|
||||||
LOG_TIME("(((u64)(now - rdp_start_time)*(1000000LL/15625LL))/((62500000LL*3/4)/15625LL))",
|
LOG_TIME("(((u64)(now - rdp_start_time)*(1000000LL/15625LL))/((62500000LL*3/4)/15625LL))",
|
||||||
OS_CYCLES_TO_USEC(now - sRDPStartTime), "../sched.c", 431);
|
OS_CYCLES_TO_USEC(now - sRDPStartTime), "../sched.c", 431);
|
||||||
osSendMesg(&sc->interruptQ, RDP_DONE_MSG, OS_MESG_NOBLOCK);
|
osSendMesg32(&sc->interruptQ, RDP_DONE_MSG, OS_MESG_NOBLOCK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -294,10 +294,10 @@ void Sched_HandleEntry(SchedContext* sc) {
|
|||||||
OSScTask* nextRSP = NULL;
|
OSScTask* nextRSP = NULL;
|
||||||
OSScTask* nextRDP = NULL;
|
OSScTask* nextRDP = NULL;
|
||||||
s32 state;
|
s32 state;
|
||||||
OSMesg msg = NULL;
|
OSMesg msg = OS_MESG_PTR(NULL);
|
||||||
|
|
||||||
while (osRecvMesg(&sc->cmdQ, &msg, OS_MESG_NOBLOCK) != -1) {
|
while (osRecvMesg(&sc->cmdQ, &msg, OS_MESG_NOBLOCK) != -1) {
|
||||||
Sched_QueueTask(sc, msg);
|
Sched_QueueTask(sc, msg.ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sc->doAudio != 0 && sc->curRSPTask != NULL) {
|
if (sc->doAudio != 0 && sc->curRSPTask != NULL) {
|
||||||
@ -427,14 +427,14 @@ void Sched_SendEntryMsg(SchedContext* sc) {
|
|||||||
osSyncPrintf("osScKickEntryMsg\n");
|
osSyncPrintf("osScKickEntryMsg\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
osSendMesg(&sc->interruptQ, ENTRY_MSG, OS_MESG_BLOCK);
|
osSendMesg32(&sc->interruptQ, ENTRY_MSG, OS_MESG_BLOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sched_ThreadEntry(void* arg) {
|
void Sched_ThreadEntry(void* arg) {
|
||||||
void* msg;
|
OSMesg msg;
|
||||||
SchedContext* sc = (SchedContext*)arg;
|
SchedContext* sc = (SchedContext*)arg;
|
||||||
|
|
||||||
msg = NULL;
|
msg.ptr = NULL;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if (sLogScheduler) {
|
if (sLogScheduler) {
|
||||||
@ -444,7 +444,7 @@ void Sched_ThreadEntry(void* arg) {
|
|||||||
|
|
||||||
osRecvMesg(&sc->interruptQ, &msg, OS_MESG_BLOCK);
|
osRecvMesg(&sc->interruptQ, &msg, OS_MESG_BLOCK);
|
||||||
|
|
||||||
switch ((s32)msg) {
|
switch (msg.data32) {
|
||||||
case ENTRY_MSG:
|
case ENTRY_MSG:
|
||||||
if (sLogScheduler) {
|
if (sLogScheduler) {
|
||||||
osSyncPrintf("%08d:ENTRY_MSG\n", (u32)OS_CYCLES_TO_USEC(osGetTime()));
|
osSyncPrintf("%08d:ENTRY_MSG\n", (u32)OS_CYCLES_TO_USEC(osGetTime()));
|
||||||
@ -466,7 +466,7 @@ void Sched_ThreadEntry(void* arg) {
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
switch (((OSScMsg*)msg)->type) {
|
switch (((OSScMsg*)msg.ptr)->type) {
|
||||||
case 1:
|
case 1:
|
||||||
Sched_HandleRetrace(sc);
|
Sched_HandleRetrace(sc);
|
||||||
continue;
|
continue;
|
||||||
@ -485,8 +485,8 @@ void Sched_Init(SchedContext* sc, void* stack, OSPri priority, UNK_TYPE arg3, UN
|
|||||||
sc->unk_24C = 1;
|
sc->unk_24C = 1;
|
||||||
osCreateMesgQueue(&sc->interruptQ, sc->intBuf, 8);
|
osCreateMesgQueue(&sc->interruptQ, sc->intBuf, 8);
|
||||||
osCreateMesgQueue(&sc->cmdQ, sc->cmdMsgBuf, 8);
|
osCreateMesgQueue(&sc->cmdQ, sc->cmdMsgBuf, 8);
|
||||||
osSetEventMesg(OS_EVENT_SP, &sc->interruptQ, RSP_DONE_MSG);
|
osSetEventMesg(OS_EVENT_SP, &sc->interruptQ, OS_MESG_32(RSP_DONE_MSG));
|
||||||
osSetEventMesg(OS_EVENT_DP, &sc->interruptQ, RDP_DONE_MSG);
|
osSetEventMesg(OS_EVENT_DP, &sc->interruptQ, OS_MESG_32(RDP_DONE_MSG));
|
||||||
IrqMgr_AddClient(irqMgr, &sc->irqClient, &sc->interruptQ);
|
IrqMgr_AddClient(irqMgr, &sc->irqClient, &sc->interruptQ);
|
||||||
osCreateThread(&sc->thread, 5, Sched_ThreadEntry, sc, stack, priority);
|
osCreateThread(&sc->thread, 5, Sched_ThreadEntry, sc, stack, priority);
|
||||||
osStartThread(&sc->thread);
|
osStartThread(&sc->thread);
|
||||||
|
@ -6,7 +6,7 @@ void Sleep_Cycles(OSTime cycles) {
|
|||||||
OSTimer timer;
|
OSTimer timer;
|
||||||
|
|
||||||
osCreateMesgQueue(&mq, &msg, OS_MESG_BLOCK);
|
osCreateMesgQueue(&mq, &msg, OS_MESG_BLOCK);
|
||||||
osSetTimer(&timer, cycles, 0, &mq, NULL);
|
osSetTimer(&timer, cycles, 0, &mq, OS_MESG_PTR(NULL));
|
||||||
osRecvMesg(&mq, NULL, OS_MESG_BLOCK);
|
osRecvMesg(&mq, NULL, OS_MESG_BLOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1584,6 +1584,11 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis
|
|||||||
&colCtx->subdivLength.y, &colCtx->subdivLengthInv.y);
|
&colCtx->subdivLength.y, &colCtx->subdivLengthInv.y);
|
||||||
BgCheck_SetSubdivisionDimension(colCtx->minBounds.z, colCtx->subdivAmount.z, &colCtx->maxBounds.z,
|
BgCheck_SetSubdivisionDimension(colCtx->minBounds.z, colCtx->subdivAmount.z, &colCtx->maxBounds.z,
|
||||||
&colCtx->subdivLength.z, &colCtx->subdivLengthInv.z);
|
&colCtx->subdivLength.z, &colCtx->subdivLengthInv.z);
|
||||||
|
|
||||||
|
#ifdef _SOH64 // BGCheck needs more memory on 64 bits because it crashes on some areas
|
||||||
|
colCtx->memSize *= 2;
|
||||||
|
#endif
|
||||||
|
|
||||||
memSize = colCtx->subdivAmount.x * sizeof(StaticLookup) * colCtx->subdivAmount.y * colCtx->subdivAmount.z +
|
memSize = colCtx->subdivAmount.x * sizeof(StaticLookup) * colCtx->subdivAmount.y * colCtx->subdivAmount.z +
|
||||||
colCtx->colHeader->numPolygons * sizeof(u8) + colCtx->dyna.polyNodesMax * sizeof(SSNode) +
|
colCtx->colHeader->numPolygons * sizeof(u8) + colCtx->dyna.polyNodesMax * sizeof(SSNode) +
|
||||||
colCtx->dyna.polyListMax * sizeof(CollisionPoly) + colCtx->dyna.vtxListMax * sizeof(Vec3s) +
|
colCtx->dyna.polyListMax * sizeof(CollisionPoly) + colCtx->dyna.vtxListMax * sizeof(Vec3s) +
|
||||||
@ -3787,7 +3792,7 @@ void CollisionHeader_SegmentedToVirtual(CollisionHeader* colHeader) {
|
|||||||
/**
|
/**
|
||||||
* Convert CollisionHeader Segmented to Virtual addressing
|
* Convert CollisionHeader Segmented to Virtual addressing
|
||||||
*/
|
*/
|
||||||
void CollisionHeader_GetVirtual(void* colHeader, CollisionHeader** dest)
|
void CollisionHeader_GetVirtual(void* colHeader, CollisionHeader** dest)
|
||||||
{
|
{
|
||||||
if (ResourceMgr_OTRSigCheck(colHeader))
|
if (ResourceMgr_OTRSigCheck(colHeader))
|
||||||
colHeader = ResourceMgr_LoadColByName(colHeader);
|
colHeader = ResourceMgr_LoadColByName(colHeader);
|
||||||
|
@ -183,7 +183,7 @@ void Font_LoadChar(Font* font, u8 character, u16 codePointIndex) {
|
|||||||
* The different icons are given in the MessageBoxIcon enum.
|
* The different icons are given in the MessageBoxIcon enum.
|
||||||
*/
|
*/
|
||||||
void Font_LoadMessageBoxIcon(Font* font, u16 icon) {
|
void Font_LoadMessageBoxIcon(Font* font, u16 icon) {
|
||||||
memcpy(font->iconBuf, msgStaticTbl[4 + icon], FONT_CHAR_TEX_SIZE);
|
memcpy(font->iconBuf, ResourceMgr_LoadTexByName(msgStaticTbl[4 + icon]), FONT_CHAR_TEX_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -194,7 +194,7 @@ void Font_LoadOrderedFont(Font* font) {
|
|||||||
size_t len;
|
size_t len;
|
||||||
size_t jj;
|
size_t jj;
|
||||||
s32 fontStatic;
|
s32 fontStatic;
|
||||||
u32 fontBuf;
|
u8* fontBuf;
|
||||||
s32 codePointIndex;
|
s32 codePointIndex;
|
||||||
s32 fontBufIndex;
|
s32 fontBufIndex;
|
||||||
s32 offset;
|
s32 offset;
|
||||||
|
@ -136,7 +136,7 @@ void HealthMeter_Init(GlobalContext* globalCtx) {
|
|||||||
HeartDDOutline[1] = HEARTS_DD_PRIM_G;
|
HeartDDOutline[1] = HEARTS_DD_PRIM_G;
|
||||||
HeartDDOutline[2] = HEARTS_DD_PRIM_B;
|
HeartDDOutline[2] = HEARTS_DD_PRIM_B;
|
||||||
}
|
}
|
||||||
|
|
||||||
interfaceCtx->unk_228 = 0x140;
|
interfaceCtx->unk_228 = 0x140;
|
||||||
interfaceCtx->unk_226 = gSaveContext.health;
|
interfaceCtx->unk_226 = gSaveContext.health;
|
||||||
interfaceCtx->unk_22A = interfaceCtx->unk_1FE = 0;
|
interfaceCtx->unk_22A = interfaceCtx->unk_1FE = 0;
|
||||||
@ -162,9 +162,9 @@ void HealthMeter_Init(GlobalContext* globalCtx) {
|
|||||||
sHeartsDDPrim[0][1] = sHeartsDDPrim[1][1] = HeartDDOutline[1];
|
sHeartsDDPrim[0][1] = sHeartsDDPrim[1][1] = HeartDDOutline[1];
|
||||||
sHeartsDDPrim[0][2] = sHeartsDDPrim[1][2] = HeartDDOutline[2];
|
sHeartsDDPrim[0][2] = sHeartsDDPrim[1][2] = HeartDDOutline[2];
|
||||||
|
|
||||||
sHeartsDDPrim[2][0] = HeartInner[0];
|
// sHeartsDDPrim[2][0] = HeartInner[0];
|
||||||
sHeartsDDPrim[2][1] = HeartInner[1];
|
// sHeartsDDPrim[2][1] = HeartInner[1];
|
||||||
sHeartsDDPrim[2][2] = HeartInner[2];
|
// sHeartsDDPrim[2][2] = HeartInner[2];
|
||||||
|
|
||||||
sHeartsDDEnv[0][0] = sHeartsDDEnv[1][0] = HeartDDInner[0];
|
sHeartsDDEnv[0][0] = sHeartsDDEnv[1][0] = HeartDDInner[0];
|
||||||
sHeartsDDEnv[0][1] = sHeartsDDEnv[1][1] = HeartDDInner[1];
|
sHeartsDDEnv[0][1] = sHeartsDDEnv[1][1] = HeartDDInner[1];
|
||||||
@ -274,11 +274,11 @@ void HealthMeter_Update(GlobalContext* globalCtx) {
|
|||||||
sHeartsDDEnv[0][2] = HeartDDInner[2];
|
sHeartsDDEnv[0][2] = HeartDDInner[2];
|
||||||
|
|
||||||
if (CVar_GetS32("gHudColors", 1) == 2) {
|
if (CVar_GetS32("gHudColors", 1) == 2) {
|
||||||
sHeartsDDPrim[2][0] = HeartInner[0];
|
sHeartsDDPrim[2][0] = HeartInner[0];
|
||||||
sHeartsDDPrim[2][1] = HeartInner[1];
|
sHeartsDDPrim[2][1] = HeartInner[1];
|
||||||
sHeartsDDPrim[2][2] = HeartInner[2];
|
sHeartsDDPrim[2][2] = HeartInner[2];
|
||||||
|
|
||||||
sHeartsDDPrim[1][0] = HeartDDOutline[0];
|
sHeartsDDPrim[1][0] = HeartDDOutline[0];
|
||||||
sHeartsDDPrim[1][1] = HeartDDOutline[1];
|
sHeartsDDPrim[1][1] = HeartDDOutline[1];
|
||||||
sHeartsDDPrim[1][2] = HeartDDOutline[2];
|
sHeartsDDPrim[1][2] = HeartDDOutline[2];
|
||||||
|
|
||||||
@ -286,7 +286,7 @@ void HealthMeter_Update(GlobalContext* globalCtx) {
|
|||||||
sHeartsDDEnv[1][1] = HeartDDInner[1];
|
sHeartsDDEnv[1][1] = HeartDDInner[1];
|
||||||
sHeartsDDEnv[1][2] = HeartDDInner[2];
|
sHeartsDDEnv[1][2] = HeartDDInner[2];
|
||||||
|
|
||||||
HeartDDInner[0] = HeartInner[0];
|
HeartDDInner[0] = HeartInner[0];
|
||||||
HeartDDInner[1] = HeartInner[1];
|
HeartDDInner[1] = HeartInner[1];
|
||||||
HeartDDInner[2] = HeartInner[2];
|
HeartDDInner[2] = HeartInner[2];
|
||||||
|
|
||||||
@ -306,9 +306,9 @@ void HealthMeter_Update(GlobalContext* globalCtx) {
|
|||||||
sBeatingHeartsDDEnv[1] = (u8)(gFactor + HeartDDInner[1]) & 0xFF;
|
sBeatingHeartsDDEnv[1] = (u8)(gFactor + HeartDDInner[1]) & 0xFF;
|
||||||
sBeatingHeartsDDEnv[2] = (u8)(bFactor + HeartDDInner[2]) & 0xFF;
|
sBeatingHeartsDDEnv[2] = (u8)(bFactor + HeartDDInner[2]) & 0xFF;
|
||||||
} else {
|
} else {
|
||||||
sHeartsDDPrim[2][0] = HEARTS_PRIM_R;
|
// sHeartsDDPrim[2][0] = HEARTS_PRIM_R;
|
||||||
sHeartsDDPrim[2][1] = HEARTS_PRIM_G;
|
// sHeartsDDPrim[2][1] = HEARTS_PRIM_G;
|
||||||
sHeartsDDPrim[2][2] = HEARTS_PRIM_B;
|
// sHeartsDDPrim[2][2] = HEARTS_PRIM_B;
|
||||||
|
|
||||||
sHeartsDDPrim[1][0] = HEARTS_DD_PRIM_R;
|
sHeartsDDPrim[1][0] = HEARTS_DD_PRIM_R;
|
||||||
sHeartsDDPrim[1][1] = HEARTS_DD_PRIM_G;
|
sHeartsDDPrim[1][1] = HEARTS_DD_PRIM_G;
|
||||||
|
@ -1153,14 +1153,16 @@ void Message_LoadItemIcon(GlobalContext* globalCtx, u16 itemId, s16 y) {
|
|||||||
R_TEXTBOX_ICON_XPOS = R_TEXT_INIT_XPOS - sIconItem32XOffsets[gSaveContext.language];
|
R_TEXTBOX_ICON_XPOS = R_TEXT_INIT_XPOS - sIconItem32XOffsets[gSaveContext.language];
|
||||||
R_TEXTBOX_ICON_YPOS = y + 6;
|
R_TEXTBOX_ICON_YPOS = y + 6;
|
||||||
R_TEXTBOX_ICON_SIZE = 32;
|
R_TEXTBOX_ICON_SIZE = 32;
|
||||||
memcpy((uintptr_t)msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE, gItemIcons[itemId], 0x1000);
|
memcpy((uintptr_t)msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE,
|
||||||
|
ResourceMgr_LoadTexByName(gItemIcons[itemId]), 0x1000);
|
||||||
// "Item 32-0"
|
// "Item 32-0"
|
||||||
osSyncPrintf("アイテム32-0\n");
|
osSyncPrintf("アイテム32-0\n");
|
||||||
} else {
|
} else {
|
||||||
R_TEXTBOX_ICON_XPOS = R_TEXT_INIT_XPOS - sIconItem24XOffsets[gSaveContext.language];
|
R_TEXTBOX_ICON_XPOS = R_TEXT_INIT_XPOS - sIconItem24XOffsets[gSaveContext.language];
|
||||||
R_TEXTBOX_ICON_YPOS = y + 10;
|
R_TEXTBOX_ICON_YPOS = y + 10;
|
||||||
R_TEXTBOX_ICON_SIZE = 24;
|
R_TEXTBOX_ICON_SIZE = 24;
|
||||||
memcpy((uintptr_t)msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE, gItemIcons[itemId], 0x900);
|
memcpy((uintptr_t)msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE,
|
||||||
|
ResourceMgr_LoadTexByName(gItemIcons[itemId]), 0x900);
|
||||||
// "Item 24"
|
// "Item 24"
|
||||||
osSyncPrintf("アイテム24=%d (%d) {%d}\n", itemId, itemId - ITEM_KOKIRI_EMERALD, 84);
|
osSyncPrintf("アイテム24=%d (%d) {%d}\n", itemId, itemId - ITEM_KOKIRI_EMERALD, 84);
|
||||||
}
|
}
|
||||||
@ -3302,7 +3304,7 @@ void Message_Update(GlobalContext* globalCtx) {
|
|||||||
|
|
||||||
void Message_SetTables(void) {
|
void Message_SetTables(void) {
|
||||||
OTRMessage_Init();
|
OTRMessage_Init();
|
||||||
|
|
||||||
// OTRTODO
|
// OTRTODO
|
||||||
//sNesMessageEntryTablePtr = sNesMessageEntryTable;
|
//sNesMessageEntryTablePtr = sNesMessageEntryTable;
|
||||||
//sGerMessageEntryTablePtr = sGerMessageEntryTable;
|
//sGerMessageEntryTablePtr = sGerMessageEntryTable;
|
||||||
|
@ -10,11 +10,11 @@ void MsgEvent_SendNullTask(void) {
|
|||||||
task.next = NULL;
|
task.next = NULL;
|
||||||
task.flags = OS_SC_RCP_MASK;
|
task.flags = OS_SC_RCP_MASK;
|
||||||
task.msgQ = &queue;
|
task.msgQ = &queue;
|
||||||
task.msg = NULL;
|
task.msg.ptr = NULL;
|
||||||
task.framebuffer = NULL;
|
task.framebuffer = NULL;
|
||||||
task.list.t.type = M_NULTASK;
|
task.list.t.type = M_NULTASK;
|
||||||
osCreateMesgQueue(task.msgQ, &msg, 1);
|
osCreateMesgQueue(task.msgQ, &msg, 1);
|
||||||
osSendMesg(&gSchedContext.cmdQ, &task, OS_MESG_BLOCK);
|
osSendMesgPtr(&gSchedContext.cmdQ, &task, OS_MESG_BLOCK);
|
||||||
Sched_SendEntryMsg(&gSchedContext);
|
Sched_SendEntryMsg(&gSchedContext);
|
||||||
osRecvMesg(&queue, NULL, OS_MESG_BLOCK);
|
osRecvMesg(&queue, NULL, OS_MESG_BLOCK);
|
||||||
}
|
}
|
||||||
|
@ -1317,7 +1317,7 @@ void Interface_LoadItemIcon1(GlobalContext* globalCtx, u16 button) {
|
|||||||
osCreateMesgQueue(&interfaceCtx->loadQueue, &interfaceCtx->loadMsg, OS_MESG_BLOCK);
|
osCreateMesgQueue(&interfaceCtx->loadQueue, &interfaceCtx->loadMsg, OS_MESG_BLOCK);
|
||||||
DmaMgr_SendRequest2(&interfaceCtx->dmaRequest_160, interfaceCtx->iconItemSegment + button * 0x1000,
|
DmaMgr_SendRequest2(&interfaceCtx->dmaRequest_160, interfaceCtx->iconItemSegment + button * 0x1000,
|
||||||
(uintptr_t)_icon_item_staticSegmentRomStart + (gSaveContext.equips.buttonItems[button] * 0x1000),
|
(uintptr_t)_icon_item_staticSegmentRomStart + (gSaveContext.equips.buttonItems[button] * 0x1000),
|
||||||
0x1000, 0, &interfaceCtx->loadQueue, NULL, "../z_parameter.c", 1171);
|
0x1000, 0, &interfaceCtx->loadQueue, OS_MESG_PTR(NULL), "../z_parameter.c", 1171);
|
||||||
osRecvMesg(&interfaceCtx->loadQueue, NULL, OS_MESG_BLOCK);
|
osRecvMesg(&interfaceCtx->loadQueue, NULL, OS_MESG_BLOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1327,7 +1327,7 @@ void Interface_LoadItemIcon2(GlobalContext* globalCtx, u16 button) {
|
|||||||
osCreateMesgQueue(&interfaceCtx->loadQueue, &interfaceCtx->loadMsg, OS_MESG_BLOCK);
|
osCreateMesgQueue(&interfaceCtx->loadQueue, &interfaceCtx->loadMsg, OS_MESG_BLOCK);
|
||||||
DmaMgr_SendRequest2(&interfaceCtx->dmaRequest_180, interfaceCtx->iconItemSegment + button * 0x1000,
|
DmaMgr_SendRequest2(&interfaceCtx->dmaRequest_180, interfaceCtx->iconItemSegment + button * 0x1000,
|
||||||
(uintptr_t)_icon_item_staticSegmentRomStart + (gSaveContext.equips.buttonItems[button] * 0x1000),
|
(uintptr_t)_icon_item_staticSegmentRomStart + (gSaveContext.equips.buttonItems[button] * 0x1000),
|
||||||
0x1000, 0, &interfaceCtx->loadQueue, NULL, "../z_parameter.c", 1193);
|
0x1000, 0, &interfaceCtx->loadQueue, OS_MESG_PTR(NULL), "../z_parameter.c", 1193);
|
||||||
osRecvMesg(&interfaceCtx->loadQueue, NULL, OS_MESG_BLOCK);
|
osRecvMesg(&interfaceCtx->loadQueue, NULL, OS_MESG_BLOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2164,7 +2164,7 @@ void Interface_SetNaviCall(GlobalContext* globalCtx, u16 naviCallState) {
|
|||||||
|
|
||||||
if (((naviCallState == 0x1D) || (naviCallState == 0x1E)) && !interfaceCtx->naviCalling &&
|
if (((naviCallState == 0x1D) || (naviCallState == 0x1E)) && !interfaceCtx->naviCalling &&
|
||||||
(globalCtx->csCtx.state == CS_STATE_IDLE)) {
|
(globalCtx->csCtx.state == CS_STATE_IDLE)) {
|
||||||
if (!CVar_GetS32("gDisableNaviCallAudio", 0)) {
|
if (!CVar_GetS32("gDisableNaviCallAudio", 0)) {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
if (naviCallState == 0x1E) { Audio_PlaySoundGeneral(NA_SE_VO_NAVY_CALL, &D_801333D4, 4,
|
if (naviCallState == 0x1E) { Audio_PlaySoundGeneral(NA_SE_VO_NAVY_CALL, &D_801333D4, 4,
|
||||||
&D_801333E0, &D_801333E0, &D_801333E8); }
|
&D_801333E0, &D_801333E0, &D_801333E8); }
|
||||||
@ -2884,7 +2884,7 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) {
|
|||||||
gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 0);
|
gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 0);
|
||||||
gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0,
|
gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0,
|
||||||
PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
|
PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
|
||||||
|
|
||||||
//There is probably a more elegant way to do it.
|
//There is probably a more elegant way to do it.
|
||||||
char* doAction = actionsTbl[3];
|
char* doAction = actionsTbl[3];
|
||||||
char newName[512];
|
char newName[512];
|
||||||
@ -2903,7 +2903,7 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) {
|
|||||||
doAction = newName;
|
doAction = newName;
|
||||||
}
|
}
|
||||||
memcpy(interfaceCtx->doActionSegment + DO_ACTION_TEX_SIZE * 2, ResourceMgr_LoadTexByName(doAction), DO_ACTION_TEX_SIZE);
|
memcpy(interfaceCtx->doActionSegment + DO_ACTION_TEX_SIZE * 2, ResourceMgr_LoadTexByName(doAction), DO_ACTION_TEX_SIZE);
|
||||||
|
|
||||||
gDPLoadTextureBlock_4b(OVERLAY_DISP++, interfaceCtx->doActionSegment + DO_ACTION_TEX_SIZE * 2, G_IM_FMT_IA,
|
gDPLoadTextureBlock_4b(OVERLAY_DISP++, interfaceCtx->doActionSegment + DO_ACTION_TEX_SIZE * 2, G_IM_FMT_IA,
|
||||||
DO_ACTION_TEX_WIDTH, DO_ACTION_TEX_HEIGHT, 0, G_TX_NOMIRROR | G_TX_WRAP,
|
DO_ACTION_TEX_WIDTH, DO_ACTION_TEX_HEIGHT, 0, G_TX_NOMIRROR | G_TX_WRAP,
|
||||||
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
|
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
|
||||||
@ -2987,8 +2987,8 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) {
|
|||||||
//This later will feature color per C button right now that it.
|
//This later will feature color per C button right now that it.
|
||||||
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCCBtnPrimR", R_C_BTN_COLOR(0)), CVar_GetS32("gCCCBtnPrimG", R_C_BTN_COLOR(1)), CVar_GetS32("gCCCBtnPrimB", R_C_BTN_COLOR(2)), interfaceCtx->cRightAlpha);
|
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCCBtnPrimR", R_C_BTN_COLOR(0)), CVar_GetS32("gCCCBtnPrimG", R_C_BTN_COLOR(1)), CVar_GetS32("gCCCBtnPrimB", R_C_BTN_COLOR(2)), interfaceCtx->cRightAlpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, ((u8*)gButtonBackgroundTex), 32, 32,
|
OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, ((u8*)gButtonBackgroundTex), 32, 32,
|
||||||
OTRGetRectDimensionFromRightEdge(R_ITEM_BTN_X(temp)+Right_HUD_Margin), R_ITEM_BTN_Y(temp)+(Top_HUD_Margin*-1), R_ITEM_BTN_WIDTH(temp),
|
OTRGetRectDimensionFromRightEdge(R_ITEM_BTN_X(temp)+Right_HUD_Margin), R_ITEM_BTN_Y(temp)+(Top_HUD_Margin*-1), R_ITEM_BTN_WIDTH(temp),
|
||||||
R_ITEM_BTN_WIDTH(temp), R_ITEM_BTN_DD(temp) << 1, R_ITEM_BTN_DD(temp) << 1);
|
R_ITEM_BTN_WIDTH(temp), R_ITEM_BTN_DD(temp) << 1, R_ITEM_BTN_DD(temp) << 1);
|
||||||
|
|
||||||
@ -3073,7 +3073,7 @@ void Interface_DrawAmmoCount(GlobalContext* globalCtx, s16 button, s16 alpha) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, (u8*)_gAmmoDigit0Tex[i], 8, 8,
|
OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, (u8*)_gAmmoDigit0Tex[i], 8, 8,
|
||||||
OTRGetRectDimensionFromRightEdge(R_ITEM_AMMO_X(button)+Right_HUD_Margin), R_ITEM_AMMO_Y(button)+(Top_HUD_Margin*-1), 8, 8, 1 << 10, 1 << 10);
|
OTRGetRectDimensionFromRightEdge(R_ITEM_AMMO_X(button)+Right_HUD_Margin), R_ITEM_AMMO_Y(button)+(Top_HUD_Margin*-1), 8, 8, 1 << 10, 1 << 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3444,11 +3444,11 @@ void Interface_Draw(GlobalContext* globalCtx) {
|
|||||||
|
|
||||||
if ((player->stateFlags1 & 0x00800000) || (globalCtx->shootingGalleryStatus > 1) ||
|
if ((player->stateFlags1 & 0x00800000) || (globalCtx->shootingGalleryStatus > 1) ||
|
||||||
((globalCtx->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(globalCtx, 0x38))) {
|
((globalCtx->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(globalCtx, 0x38))) {
|
||||||
|
|
||||||
if (!fullUi) {
|
if (!fullUi) {
|
||||||
Interface_DrawItemIconTexture(globalCtx, gItemIcons[gSaveContext.equips.buttonItems[0]], 0);
|
Interface_DrawItemIconTexture(globalCtx, gItemIcons[gSaveContext.equips.buttonItems[0]], 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
gDPPipeSync(OVERLAY_DISP++);
|
gDPPipeSync(OVERLAY_DISP++);
|
||||||
gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE,
|
gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE,
|
||||||
0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
|
0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
|
||||||
@ -4070,7 +4070,7 @@ void Interface_Draw(GlobalContext* globalCtx) {
|
|||||||
|
|
||||||
for (svar1 = 0; svar1 < 5; svar1++) {
|
for (svar1 = 0; svar1 < 5; svar1++) {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
svar5 = OTRGetRectDimensionFromLeftEdge(gSaveContext.timerX[svar6]);
|
svar5 = OTRGetRectDimensionFromLeftEdge(gSaveContext.timerX[svar6]);
|
||||||
OVERLAY_DISP = Gfx_TextureI8(OVERLAY_DISP, digitTextures[timerDigits[svar1]], 8, 16,
|
OVERLAY_DISP = Gfx_TextureI8(OVERLAY_DISP, digitTextures[timerDigits[svar1]], 8, 16,
|
||||||
svar5 + timerDigitLeftPos[svar1],
|
svar5 + timerDigitLeftPos[svar1],
|
||||||
svar2 = gSaveContext.timerY[svar6], digitWidth[svar1], VREG(42), VREG(43) << 1,
|
svar2 = gSaveContext.timerY[svar6], digitWidth[svar1], VREG(42), VREG(43) << 1,
|
||||||
|
@ -198,8 +198,8 @@ void Gameplay_Init(GameState* thisx) {
|
|||||||
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
|
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
|
||||||
gGlobalCtx = globalCtx;
|
gGlobalCtx = globalCtx;
|
||||||
//globalCtx->state.gfxCtx = NULL;
|
//globalCtx->state.gfxCtx = NULL;
|
||||||
u32 zAlloc;
|
uintptr_t zAlloc;
|
||||||
u32 zAllocAligned;
|
uintptr_t zAllocAligned;
|
||||||
size_t zAllocSize;
|
size_t zAllocSize;
|
||||||
Player* player;
|
Player* player;
|
||||||
s32 playerStartCamId;
|
s32 playerStartCamId;
|
||||||
|
@ -363,13 +363,13 @@ void Player_SetModelsForHoldingShield(Player* this) {
|
|||||||
if ((CVar_GetS32("gShieldTwoHanded", 0) && (this->heldItemActionParam != PLAYER_AP_STICK) ||
|
if ((CVar_GetS32("gShieldTwoHanded", 0) && (this->heldItemActionParam != PLAYER_AP_STICK) ||
|
||||||
!Player_HoldsTwoHandedWeapon(this)) && !Player_IsChildWithHylianShield(this)) {
|
!Player_HoldsTwoHandedWeapon(this)) && !Player_IsChildWithHylianShield(this)) {
|
||||||
this->rightHandType = 10;
|
this->rightHandType = 10;
|
||||||
this->rightHandDLists = &sPlayerDListGroups[10][(void)0, gSaveContext.linkAge];
|
this->rightHandDLists = &sPlayerDListGroups[10][gSaveContext.linkAge];
|
||||||
if (this->sheathType == 18) {
|
if (this->sheathType == 18) {
|
||||||
this->sheathType = 16;
|
this->sheathType = 16;
|
||||||
} else if (this->sheathType == 19) {
|
} else if (this->sheathType == 19) {
|
||||||
this->sheathType = 17;
|
this->sheathType = 17;
|
||||||
}
|
}
|
||||||
this->sheathDLists = &sPlayerDListGroups[this->sheathType][(void)0, gSaveContext.linkAge];
|
this->sheathDLists = &sPlayerDListGroups[this->sheathType][gSaveContext.linkAge];
|
||||||
this->modelAnimType = 2;
|
this->modelAnimType = 2;
|
||||||
this->itemActionParam = -1;
|
this->itemActionParam = -1;
|
||||||
}
|
}
|
||||||
@ -381,10 +381,10 @@ void Player_SetModels(Player* this, s32 modelGroup) {
|
|||||||
this->rightHandType = gPlayerModelTypes[modelGroup][2];
|
this->rightHandType = gPlayerModelTypes[modelGroup][2];
|
||||||
this->sheathType = gPlayerModelTypes[modelGroup][3];
|
this->sheathType = gPlayerModelTypes[modelGroup][3];
|
||||||
|
|
||||||
this->leftHandDLists = &sPlayerDListGroups[gPlayerModelTypes[modelGroup][1]][(void)0, gSaveContext.linkAge];
|
this->leftHandDLists = &sPlayerDListGroups[gPlayerModelTypes[modelGroup][1]][gSaveContext.linkAge];
|
||||||
this->rightHandDLists = &sPlayerDListGroups[gPlayerModelTypes[modelGroup][2]][(void)0, gSaveContext.linkAge];
|
this->rightHandDLists = &sPlayerDListGroups[gPlayerModelTypes[modelGroup][2]][gSaveContext.linkAge];
|
||||||
this->sheathDLists = &sPlayerDListGroups[gPlayerModelTypes[modelGroup][3]][(void)0, gSaveContext.linkAge];
|
this->sheathDLists = &sPlayerDListGroups[gPlayerModelTypes[modelGroup][3]][gSaveContext.linkAge];
|
||||||
this->waistDLists = &sPlayerDListGroups[gPlayerModelTypes[modelGroup][4]][(void)0, gSaveContext.linkAge];
|
this->waistDLists = &sPlayerDListGroups[gPlayerModelTypes[modelGroup][4]][gSaveContext.linkAge];
|
||||||
|
|
||||||
Player_SetModelsForHoldingShield(this);
|
Player_SetModelsForHoldingShield(this);
|
||||||
}
|
}
|
||||||
@ -859,15 +859,15 @@ void func_8008F87C(GlobalContext* globalCtx, Player* this, SkelAnime* skelAnime,
|
|||||||
(Player_ActionToMagicSpell(this, this->itemActionParam) < 0)) {
|
(Player_ActionToMagicSpell(this, this->itemActionParam) < 0)) {
|
||||||
s32 pad;
|
s32 pad;
|
||||||
|
|
||||||
sp7C = D_80126058[(void)0, gSaveContext.linkAge];
|
sp7C = D_80126058[gSaveContext.linkAge];
|
||||||
sp78 = D_80126060[(void)0, gSaveContext.linkAge];
|
sp78 = D_80126060[gSaveContext.linkAge];
|
||||||
sp74 = D_80126068[(void)0, gSaveContext.linkAge] - this->unk_6C4;
|
sp74 = D_80126068[gSaveContext.linkAge] - this->unk_6C4;
|
||||||
|
|
||||||
Matrix_Push();
|
Matrix_Push();
|
||||||
Matrix_TranslateRotateZYX(pos, rot);
|
Matrix_TranslateRotateZYX(pos, rot);
|
||||||
Matrix_MultVec3f(&D_8012602C, &spA4);
|
Matrix_MultVec3f(&D_8012602C, &spA4);
|
||||||
Matrix_TranslateRotateZYX(&D_80126038[(void)0, gSaveContext.linkAge], &skelAnime->jointTable[shinLimbIndex]);
|
Matrix_TranslateRotateZYX(&D_80126038[gSaveContext.linkAge], &skelAnime->jointTable[shinLimbIndex]);
|
||||||
Matrix_Translate(D_80126050[(void)0, gSaveContext.linkAge], 0.0f, 0.0f, MTXMODE_APPLY);
|
Matrix_Translate(D_80126050[gSaveContext.linkAge], 0.0f, 0.0f, MTXMODE_APPLY);
|
||||||
Matrix_MultVec3f(&D_8012602C, &sp98);
|
Matrix_MultVec3f(&D_8012602C, &sp98);
|
||||||
Matrix_MultVec3f(&D_80126070, &footprintPos);
|
Matrix_MultVec3f(&D_80126070, &footprintPos);
|
||||||
Matrix_Pop();
|
Matrix_Pop();
|
||||||
@ -1055,16 +1055,16 @@ s32 func_800902F0(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p
|
|||||||
if (this->unk_6AD != 2) {
|
if (this->unk_6AD != 2) {
|
||||||
*dList = NULL;
|
*dList = NULL;
|
||||||
} else if (limbIndex == PLAYER_LIMB_L_FOREARM) {
|
} else if (limbIndex == PLAYER_LIMB_L_FOREARM) {
|
||||||
*dList = sArmOutDLs[(void)0, gSaveContext.linkAge];
|
*dList = sArmOutDLs[gSaveContext.linkAge];
|
||||||
} else if (limbIndex == PLAYER_LIMB_L_HAND) {
|
} else if (limbIndex == PLAYER_LIMB_L_HAND) {
|
||||||
*dList = sHandOutDLs[(void)0, gSaveContext.linkAge];
|
*dList = sHandOutDLs[gSaveContext.linkAge];
|
||||||
} else if (limbIndex == PLAYER_LIMB_R_SHOULDER) {
|
} else if (limbIndex == PLAYER_LIMB_R_SHOULDER) {
|
||||||
*dList = sRightShoulderNearDLs[(void)0, gSaveContext.linkAge];
|
*dList = sRightShoulderNearDLs[gSaveContext.linkAge];
|
||||||
} else if (limbIndex == PLAYER_LIMB_R_FOREARM) {
|
} else if (limbIndex == PLAYER_LIMB_R_FOREARM) {
|
||||||
*dList = D_80125F30[(void)0, gSaveContext.linkAge];
|
*dList = D_80125F30[gSaveContext.linkAge];
|
||||||
} else if (limbIndex == PLAYER_LIMB_R_HAND) {
|
} else if (limbIndex == PLAYER_LIMB_R_HAND) {
|
||||||
*dList = Player_HoldsHookshot(this) ? gLinkAdultRightHandHoldingHookshotFarDL
|
*dList = Player_HoldsHookshot(this) ? gLinkAdultRightHandHoldingHookshotFarDL
|
||||||
: sHoldingFirstPersonWeaponDLs[(void)0, gSaveContext.linkAge];
|
: sHoldingFirstPersonWeaponDLs[gSaveContext.linkAge];
|
||||||
} else {
|
} else {
|
||||||
*dList = NULL;
|
*dList = NULL;
|
||||||
}
|
}
|
||||||
@ -1348,7 +1348,7 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s*
|
|||||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_player_lib.c", 2712),
|
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_player_lib.c", 2712),
|
||||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||||
gDPSetEnvColor(POLY_XLU_DISP++, bottleColor->r, bottleColor->g, bottleColor->b, 0);
|
gDPSetEnvColor(POLY_XLU_DISP++, bottleColor->r, bottleColor->g, bottleColor->b, 0);
|
||||||
gSPDisplayList(POLY_XLU_DISP++, sBottleDLists[((void)0, gSaveContext.linkAge)]);
|
gSPDisplayList(POLY_XLU_DISP++, sBottleDLists[(gSaveContext.linkAge)]);
|
||||||
|
|
||||||
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2717);
|
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2717);
|
||||||
}
|
}
|
||||||
@ -1479,7 +1479,7 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s*
|
|||||||
} else if (limbIndex == PLAYER_LIMB_HEAD) {
|
} else if (limbIndex == PLAYER_LIMB_HEAD) {
|
||||||
Matrix_MultVec3f(&D_801260D4, &this->actor.focus.pos);
|
Matrix_MultVec3f(&D_801260D4, &this->actor.focus.pos);
|
||||||
} else {
|
} else {
|
||||||
Vec3f* vec = &D_801261E0[((void)0, gSaveContext.linkAge)];
|
Vec3f* vec = &D_801261E0[(gSaveContext.linkAge)];
|
||||||
|
|
||||||
Actor_SetFeetPos(&this->actor, limbIndex, PLAYER_LIMB_L_FOOT, vec, PLAYER_LIMB_R_FOOT, vec);
|
Actor_SetFeetPos(&this->actor, limbIndex, PLAYER_LIMB_L_FOOT, vec, PLAYER_LIMB_R_FOOT, vec);
|
||||||
}
|
}
|
||||||
@ -1487,7 +1487,7 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s*
|
|||||||
}
|
}
|
||||||
|
|
||||||
u32 func_80091738(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime) {
|
u32 func_80091738(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime) {
|
||||||
s16 linkObjectId = gLinkObjectIds[(void)0, gSaveContext.linkAge];
|
s16 linkObjectId = gLinkObjectIds[gSaveContext.linkAge];
|
||||||
size_t size;
|
size_t size;
|
||||||
void* ptr;
|
void* ptr;
|
||||||
|
|
||||||
@ -1504,7 +1504,7 @@ u32 func_80091738(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime) {
|
|||||||
gSegments[4] = VIRTUAL_TO_PHYSICAL(segment + 0x3800);
|
gSegments[4] = VIRTUAL_TO_PHYSICAL(segment + 0x3800);
|
||||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(segment + 0x8800);
|
gSegments[6] = VIRTUAL_TO_PHYSICAL(segment + 0x8800);
|
||||||
|
|
||||||
SkelAnime_InitLink(globalCtx, skelAnime, gPlayerSkelHeaders[(void)0, gSaveContext.linkAge], &gPlayerAnim_003238, 9,
|
SkelAnime_InitLink(globalCtx, skelAnime, gPlayerSkelHeaders[gSaveContext.linkAge], &gPlayerAnim_003238, 9,
|
||||||
ptr, ptr, PLAYER_LIMB_MAX);
|
ptr, ptr, PLAYER_LIMB_MAX);
|
||||||
|
|
||||||
return size + 0x8800 + 0x90;
|
return size + 0x8800 + 0x90;
|
||||||
@ -1518,6 +1518,7 @@ s32 func_80091880(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p
|
|||||||
s32 type;
|
s32 type;
|
||||||
s32 dListOffset = 0;
|
s32 dListOffset = 0;
|
||||||
Gfx** dLists;
|
Gfx** dLists;
|
||||||
|
size_t ptrSize = sizeof(uint32_t);
|
||||||
|
|
||||||
if ((modelGroup == 2) && !LINK_IS_ADULT && (ptr[1] == 2)) {
|
if ((modelGroup == 2) && !LINK_IS_ADULT && (ptr[1] == 2)) {
|
||||||
modelGroup = 1;
|
modelGroup = 1;
|
||||||
@ -1537,12 +1538,12 @@ s32 func_80091880(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p
|
|||||||
type = gPlayerModelTypes[modelGroup][2];
|
type = gPlayerModelTypes[modelGroup][2];
|
||||||
D_80160018 = type;
|
D_80160018 = type;
|
||||||
if (type == 10) {
|
if (type == 10) {
|
||||||
dListOffset = ptr[1] * sizeof(uintptr_t);
|
dListOffset = ptr[1] * ptrSize;
|
||||||
}
|
}
|
||||||
} else if (limbIndex == PLAYER_LIMB_SHEATH) {
|
} else if (limbIndex == PLAYER_LIMB_SHEATH) {
|
||||||
type = gPlayerModelTypes[modelGroup][3];
|
type = gPlayerModelTypes[modelGroup][3];
|
||||||
if ((type == 18) || (type == 19)) {
|
if ((type == 18) || (type == 19)) {
|
||||||
dListOffset = ptr[1] * sizeof(uintptr_t);
|
dListOffset = ptr[1] * ptrSize;
|
||||||
} else if (type == 16 && CVar_GetS32("gPauseLiveLink", 0)) {
|
} else if (type == 16 && CVar_GetS32("gPauseLiveLink", 0)) {
|
||||||
//if (ptr[0] == 1)
|
//if (ptr[0] == 1)
|
||||||
//dListOffset = 4;
|
//dListOffset = 4;
|
||||||
@ -1553,7 +1554,7 @@ s32 func_80091880(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
dLists = &sPlayerDListGroups[type][(void)0, gSaveContext.linkAge];
|
dLists = &sPlayerDListGroups[type][gSaveContext.linkAge];
|
||||||
*dList = dLists[dListOffset];
|
*dList = dLists[dListOffset];
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -1609,7 +1610,7 @@ void func_80091A24(GlobalContext* globalCtx, void* seg04, void* seg06, SkelAnime
|
|||||||
viewport.vp.vscale[0] = viewport.vp.vtrans[0] = width * 2;
|
viewport.vp.vscale[0] = viewport.vp.vtrans[0] = width * 2;
|
||||||
viewport.vp.vscale[1] = viewport.vp.vtrans[1] = height * 2;
|
viewport.vp.vscale[1] = viewport.vp.vtrans[1] = height * 2;
|
||||||
gSPViewport(POLY_OPA_DISP++, &viewport);
|
gSPViewport(POLY_OPA_DISP++, &viewport);
|
||||||
|
|
||||||
guPerspective(perspMtx, &perspNorm, fovy, (f32)width / (f32)height, 10.0f, 4000.0f, 1.0f);
|
guPerspective(perspMtx, &perspNorm, fovy, (f32)width / (f32)height, 10.0f, 4000.0f, 1.0f);
|
||||||
|
|
||||||
gSPPerspNormalize(POLY_OPA_DISP++, perspNorm);
|
gSPPerspNormalize(POLY_OPA_DISP++, perspNorm);
|
||||||
|
@ -554,7 +554,7 @@ u32 func_80096FE8(GlobalContext* globalCtx, RoomContext* roomCtx) {
|
|||||||
roomCtx->bufPtrs[0] = GameState_Alloc(&globalCtx->state, maxRoomSize, "../z_room.c", 946);
|
roomCtx->bufPtrs[0] = GameState_Alloc(&globalCtx->state, maxRoomSize, "../z_room.c", 946);
|
||||||
// "Room buffer initial pointer=%08x"
|
// "Room buffer initial pointer=%08x"
|
||||||
osSyncPrintf("部屋バッファ開始ポインタ=%08x\n", roomCtx->bufPtrs[0]);
|
osSyncPrintf("部屋バッファ開始ポインタ=%08x\n", roomCtx->bufPtrs[0]);
|
||||||
roomCtx->bufPtrs[1] = (void*)((s32)roomCtx->bufPtrs[0] + maxRoomSize);
|
roomCtx->bufPtrs[1] = (void*)((intptr_t)roomCtx->bufPtrs[0] + maxRoomSize);
|
||||||
// "Room buffer end pointer=%08x"
|
// "Room buffer end pointer=%08x"
|
||||||
osSyncPrintf("部屋バッファ終了ポインタ=%08x\n", roomCtx->bufPtrs[1]);
|
osSyncPrintf("部屋バッファ終了ポインタ=%08x\n", roomCtx->bufPtrs[1]);
|
||||||
osSyncPrintf(VT_RST);
|
osSyncPrintf(VT_RST);
|
||||||
@ -586,7 +586,7 @@ s32 func_8009728C(GlobalContext* globalCtx, RoomContext* roomCtx, s32 roomNum) {
|
|||||||
|
|
||||||
osCreateMesgQueue(&roomCtx->loadQueue, &roomCtx->loadMsg, 1);
|
osCreateMesgQueue(&roomCtx->loadQueue, &roomCtx->loadMsg, 1);
|
||||||
DmaMgr_SendRequest2(&roomCtx->dmaRequest, roomCtx->unk_34, globalCtx->roomList[roomNum].vromStart, size, 0,
|
DmaMgr_SendRequest2(&roomCtx->dmaRequest, roomCtx->unk_34, globalCtx->roomList[roomNum].vromStart, size, 0,
|
||||||
&roomCtx->loadQueue, NULL, "../z_room.c", 1036);
|
&roomCtx->loadQueue, OS_MESG_PTR(NULL), "../z_room.c", 1036);
|
||||||
roomCtx->unk_30 ^= 1;
|
roomCtx->unk_30 ^= 1;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -61,6 +61,7 @@ void Object_InitBank(GlobalContext* globalCtx, ObjectContext* objectCtx) {
|
|||||||
|
|
||||||
for (i = 0; i < OBJECT_EXCHANGE_BANK_MAX; i++) {
|
for (i = 0; i < OBJECT_EXCHANGE_BANK_MAX; i++) {
|
||||||
objectCtx->status[i].id = OBJECT_INVALID;
|
objectCtx->status[i].id = OBJECT_INVALID;
|
||||||
|
objectCtx->status[i].segment = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
osSyncPrintf(VT_FGCOL(GREEN));
|
osSyncPrintf(VT_FGCOL(GREEN));
|
||||||
|
@ -857,7 +857,7 @@ void AnimationContext_SetLoadFrame(GlobalContext* globalCtx, LinkAnimationHeader
|
|||||||
animation = ResourceMgr_LoadAnimByName(animation);
|
animation = ResourceMgr_LoadAnimByName(animation);
|
||||||
|
|
||||||
LinkAnimationHeader* linkAnimHeader = SEGMENTED_TO_VIRTUAL(animation);
|
LinkAnimationHeader* linkAnimHeader = SEGMENTED_TO_VIRTUAL(animation);
|
||||||
u32 ram = frameTable;
|
Vec3s* ram = frameTable;
|
||||||
|
|
||||||
osCreateMesgQueue(&entry->data.load.msgQueue, &entry->data.load.msg, 1);
|
osCreateMesgQueue(&entry->data.load.msgQueue, &entry->data.load.msg, 1);
|
||||||
|
|
||||||
|
@ -326,6 +326,7 @@ void BossGoma_ClearPixels32x32Rgba16(s16* rgba16image, u8* clearPixelTable, s16
|
|||||||
* Clear pixels from Gohma's textures
|
* Clear pixels from Gohma's textures
|
||||||
*/
|
*/
|
||||||
void BossGoma_ClearPixels(u8* clearPixelTable, s16 i) {
|
void BossGoma_ClearPixels(u8* clearPixelTable, s16 i) {
|
||||||
|
return;
|
||||||
BossGoma_ClearPixels16x16Rgba16(SEGMENTED_TO_VIRTUAL(gGohmaBodyTex), clearPixelTable, i);
|
BossGoma_ClearPixels16x16Rgba16(SEGMENTED_TO_VIRTUAL(gGohmaBodyTex), clearPixelTable, i);
|
||||||
BossGoma_ClearPixels16x16Rgba16(SEGMENTED_TO_VIRTUAL(gGohmaShellUndersideTex), clearPixelTable, i);
|
BossGoma_ClearPixels16x16Rgba16(SEGMENTED_TO_VIRTUAL(gGohmaShellUndersideTex), clearPixelTable, i);
|
||||||
BossGoma_ClearPixels16x16Rgba16(SEGMENTED_TO_VIRTUAL(gGohmaDarkShellTex), clearPixelTable, i);
|
BossGoma_ClearPixels16x16Rgba16(SEGMENTED_TO_VIRTUAL(gGohmaDarkShellTex), clearPixelTable, i);
|
||||||
|
@ -2370,7 +2370,7 @@ void EnHorse_CutsceneUpdate(EnHorse* this, GlobalContext* globalCtx) {
|
|||||||
EnHorse_Freeze(this);
|
EnHorse_Freeze(this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (linkCsAction != 0 && linkCsAction != 0xABABABAB) {
|
if (linkCsAction != 0 && (uint32_t)(uintptr_t)linkCsAction != 0xABABABAB) {
|
||||||
csFunctionIdx = EnHorse_GetCutsceneFunctionIndex(linkCsAction->action);
|
csFunctionIdx = EnHorse_GetCutsceneFunctionIndex(linkCsAction->action);
|
||||||
if (csFunctionIdx != 0) {
|
if (csFunctionIdx != 0) {
|
||||||
if (this->cutsceneAction != csFunctionIdx) {
|
if (this->cutsceneAction != csFunctionIdx) {
|
||||||
|
@ -660,7 +660,7 @@ void func_80AF68E4(EnSa* this, GlobalContext* globalCtx) {
|
|||||||
EnSa_ChangeAnim(this, csAction->action);
|
EnSa_ChangeAnim(this, csAction->action);
|
||||||
this->unk_210 = csAction->action;
|
this->unk_210 = csAction->action;
|
||||||
}
|
}
|
||||||
if (phi_v0) {}
|
//if (phi_v0) {}
|
||||||
if (csAction->action == 3) {
|
if (csAction->action == 3) {
|
||||||
if (this->unk_20C == 0) {
|
if (this->unk_20C == 0) {
|
||||||
phi_v0 = 0;
|
phi_v0 = 0;
|
||||||
|
@ -4868,7 +4868,7 @@ void func_8083AE40(Player* this, s16 objectId) {
|
|||||||
ASSERT(size <= 1024 * 8, "size <= 1024 * 8", "../z_player.c", 9091);
|
ASSERT(size <= 1024 * 8, "size <= 1024 * 8", "../z_player.c", 9091);
|
||||||
|
|
||||||
DmaMgr_SendRequest2(&this->giObjectDmaRequest, (uintptr_t)this->giObjectSegment, gObjectTable[objectId].vromStart,
|
DmaMgr_SendRequest2(&this->giObjectDmaRequest, (uintptr_t)this->giObjectSegment, gObjectTable[objectId].vromStart,
|
||||||
size, 0, &this->giObjectLoadQueue, NULL, "../z_player.c", 9099);
|
size, 0, &this->giObjectLoadQueue, OS_MESG_PTR(NULL), "../z_player.c", 9099);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9479,7 +9479,7 @@ void Player_Init(Actor* thisx, GlobalContext* globalCtx2) {
|
|||||||
Player_SetEquipmentData(globalCtx, this);
|
Player_SetEquipmentData(globalCtx, this);
|
||||||
this->prevBoots = this->currentBoots;
|
this->prevBoots = this->currentBoots;
|
||||||
Player_InitCommon(this, globalCtx, gPlayerSkelHeaders[((void)0, gSaveContext.linkAge)]);
|
Player_InitCommon(this, globalCtx, gPlayerSkelHeaders[((void)0, gSaveContext.linkAge)]);
|
||||||
this->giObjectSegment = (void*)(((u32)ZeldaArena_MallocDebug(0x3008, "../z_player.c", 17175) + 8) & ~0xF);
|
this->giObjectSegment = (void*)(((uintptr_t)ZeldaArena_MallocDebug(0x3008, "../z_player.c", 17175) + 8) & ~0xF);
|
||||||
|
|
||||||
sp50 = gSaveContext.respawnFlag;
|
sp50 = gSaveContext.respawnFlag;
|
||||||
|
|
||||||
@ -10819,7 +10819,7 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) {
|
|||||||
static Vec3f D_80854838 = { 0.0f, 0.0f, -30.0f };
|
static Vec3f D_80854838 = { 0.0f, 0.0f, -30.0f };
|
||||||
|
|
||||||
void Player_Update(Actor* thisx, GlobalContext* globalCtx) {
|
void Player_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||||
static Vec3f sDogSpawnPos;
|
static Vec3f sDogSpawnPos;
|
||||||
Player* this = (Player*)thisx;
|
Player* this = (Player*)thisx;
|
||||||
s32 dogParams;
|
s32 dogParams;
|
||||||
s32 pad;
|
s32 pad;
|
||||||
|
@ -159,7 +159,7 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) {
|
|||||||
u16 pad;
|
u16 pad;
|
||||||
s16 cursorMoveResult;
|
s16 cursorMoveResult;
|
||||||
u16 cursorItem;
|
u16 cursorItem;
|
||||||
u16 cursorSlot;
|
u16 cursorSlot = 0;
|
||||||
s16 cursorPoint;
|
s16 cursorPoint;
|
||||||
s16 cursorX;
|
s16 cursorX;
|
||||||
s16 cursorY;
|
s16 cursorY;
|
||||||
|
@ -3216,11 +3216,11 @@ void KaleidoScope_Update(GlobalContext* globalCtx)
|
|||||||
GameOverContext* gameOverCtx = &globalCtx->gameOverCtx;
|
GameOverContext* gameOverCtx = &globalCtx->gameOverCtx;
|
||||||
Player* player = GET_PLAYER(globalCtx);
|
Player* player = GET_PLAYER(globalCtx);
|
||||||
Input* input = &globalCtx->state.input[0];
|
Input* input = &globalCtx->state.input[0];
|
||||||
size_t size;
|
size_t size = 0;
|
||||||
size_t size0;
|
size_t size0 = 0;
|
||||||
size_t size1;
|
size_t size1 = 0;
|
||||||
size_t size2;
|
size_t size2 = 0;
|
||||||
u16 i;
|
u16 i = 0;
|
||||||
s16 stepR;
|
s16 stepR;
|
||||||
s16 stepG;
|
s16 stepG;
|
||||||
s16 stepB;
|
s16 stepB;
|
||||||
@ -3283,7 +3283,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx)
|
|||||||
//DmaMgr_SendRequest1(pauseCtx->iconItem24Segment, (uintptr_t)_icon_item_24_staticSegmentRomStart, size,
|
//DmaMgr_SendRequest1(pauseCtx->iconItem24Segment, (uintptr_t)_icon_item_24_staticSegmentRomStart, size,
|
||||||
//"../z_kaleido_scope_PAL.c", 3675);
|
//"../z_kaleido_scope_PAL.c", 3675);
|
||||||
|
|
||||||
pauseCtx->iconItemAltSegment = (void*)(((uintptr_t)pauseCtx->iconItem24Segment + size + 0xF) & ~0xF);
|
//pauseCtx->iconItemAltSegment = (void*)(((uintptr_t)pauseCtx->iconItem24Segment + size + 0xF) & ~0xF);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch (globalCtx->sceneNum) {
|
switch (globalCtx->sceneNum) {
|
||||||
@ -3331,7 +3331,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx)
|
|||||||
|
|
||||||
// OTRTODO: LANGUAGE SUPPORT
|
// OTRTODO: LANGUAGE SUPPORT
|
||||||
#if 1
|
#if 1
|
||||||
pauseCtx->iconItemLangSegment = (void*)(((uintptr_t)pauseCtx->iconItemAltSegment + size2 + 0xF) & ~0xF);
|
//pauseCtx->iconItemLangSegment = (void*)(((uintptr_t)pauseCtx->iconItemAltSegment + size2 + 0xF) & ~0xF);
|
||||||
|
|
||||||
if (gSaveContext.language == LANGUAGE_ENG) {
|
if (gSaveContext.language == LANGUAGE_ENG) {
|
||||||
//size = (uintptr_t)_icon_item_nes_staticSegmentRomEnd - (uintptr_t)_icon_item_nes_staticSegmentRomStart;
|
//size = (uintptr_t)_icon_item_nes_staticSegmentRomEnd - (uintptr_t)_icon_item_nes_staticSegmentRomStart;
|
||||||
|
Loading…
Reference in New Issue
Block a user