mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-20 21:33:40 -07:00
fixes
This commit is contained in:
parent
a2993a3430
commit
d9760694d8
15 changed files with 134 additions and 139 deletions
1
soh/include/dr_libs
Submodule
1
soh/include/dr_libs
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 9cb7092ac8c75a82b5c6ea72652ca8d0091d7ffa
|
|
@ -1,4 +1,6 @@
|
||||||
#include "ActorAccessibility.h"
|
#include "ActorAccessibility.h"
|
||||||
|
#include "soh/OTRGlobals.h"
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <random>
|
#include <random>
|
||||||
|
|
||||||
|
@ -25,9 +27,9 @@ extern "C" {
|
||||||
void EnKarebaba_DeadItemDrop(EnKarebaba*, PlayState*);
|
void EnKarebaba_DeadItemDrop(EnKarebaba*, PlayState*);
|
||||||
}
|
}
|
||||||
//Declarations specific to Torches
|
//Declarations specific to Torches
|
||||||
#include "overlays\actors\ovl_Obj_Syokudai\z_obj_syokudai.h"
|
#include "overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.h"
|
||||||
//Declarations specific to dogs
|
//Declarations specific to dogs
|
||||||
#include "overlays\actors\ovl_En_Dog\z_en_dog.h"
|
#include "overlays/actors/ovl_En_Dog/z_en_dog.h"
|
||||||
extern "C" {
|
extern "C" {
|
||||||
void EnDog_FollowPlayer(EnDog*, PlayState*);
|
void EnDog_FollowPlayer(EnDog*, PlayState*);
|
||||||
s8 EnDog_CanFollow(EnDog*, PlayState*);
|
s8 EnDog_CanFollow(EnDog*, PlayState*);
|
||||||
|
@ -303,7 +305,7 @@ void accessible_area_change(AccessibleActor* actor) {
|
||||||
//kakariko village attenuation
|
//kakariko village attenuation
|
||||||
else if (actor->play->sceneNum == 82) {
|
else if (actor->play->sceneNum == 82) {
|
||||||
if (actor->sceneIndex == 83 || actor->sceneIndex == 81 || actor->sceneIndex == 96) {
|
if (actor->sceneIndex == 83 || actor->sceneIndex == 81 || actor->sceneIndex == 96) {
|
||||||
actor->policy.runsAlways == true;
|
actor->policy.runsAlways = true;
|
||||||
actor->policy.ydist = 5000;
|
actor->policy.ydist = 5000;
|
||||||
if (actor->xzDistToPlayer > 700) {
|
if (actor->xzDistToPlayer > 700) {
|
||||||
if (actor->sceneIndex == 81) {
|
if (actor->sceneIndex == 81) {
|
||||||
|
@ -650,9 +652,9 @@ void accessible_audio_compass_cleanup(AccessibleActor* actor)
|
||||||
}
|
}
|
||||||
void accessible_audio_compass(AccessibleActor* actor) {
|
void accessible_audio_compass(AccessibleActor* actor) {
|
||||||
Player* player = GET_PLAYER(actor->play);
|
Player* player = GET_PLAYER(actor->play);
|
||||||
if (player->stateFlags1 & PLAYER_STATE1_TARGETING || player->stateFlags1 & PLAYER_STATE1_CLIMBING_LADDER)
|
if (player->stateFlags1 & PLAYER_STATE1_Z_TARGETING || player->stateFlags1 & PLAYER_STATE1_CLIMBING_LADDER)
|
||||||
return;
|
return;
|
||||||
OSContPad* trackerButtonsPressed = LUS::Context::GetInstance()->GetControlDeck()->GetPads();
|
OSContPad* trackerButtonsPressed = std::dynamic_pointer_cast<LUS::ControlDeck>(Ship::Context::GetInstance()->GetControlDeck())->GetPads();
|
||||||
AudioCompassData* data = (AudioCompassData*)actor->userData;
|
AudioCompassData* data = (AudioCompassData*)actor->userData;
|
||||||
bool compassCombo = trackerButtonsPressed != nullptr && trackerButtonsPressed[0].button & buttonList[11] &&
|
bool compassCombo = trackerButtonsPressed != nullptr && trackerButtonsPressed[0].button & buttonList[11] &&
|
||||||
trackerButtonsPressed[0].button & buttonList[6];
|
trackerButtonsPressed[0].button & buttonList[6];
|
||||||
|
@ -671,7 +673,7 @@ void accessible_audio_compass(AccessibleActor* actor) {
|
||||||
|
|
||||||
|
|
||||||
/* Player* player = GET_PLAYER(actor->play);
|
/* Player* player = GET_PLAYER(actor->play);
|
||||||
if (player->stateFlags1 & PLAYER_STATE1_TARGETING || player->stateFlags1 & PLAYER_STATE1_CLIMBING_LADDER)
|
if (player->stateFlags1 & PLAYER_STATE1_Z_TARGETING || player->stateFlags1 & PLAYER_STATE1_CLIMBING_LADDER)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
actor->world.pos = player->actor.world.pos;
|
actor->world.pos = player->actor.world.pos;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "ActorAccessibility.h"
|
#include "ActorAccessibility.h"
|
||||||
#include "AccessibleAudioEngine.h"
|
#include "AccessibleAudioEngine.h"
|
||||||
#include "soh/OTRGlobals.h"
|
#include "soh/OTRGlobals.h"
|
||||||
|
#include "resource/type/Blob.h"
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <random>
|
#include <random>
|
||||||
|
@ -55,9 +56,8 @@ typedef std::unordered_set<s16> SceneList_t;//A list of scenes which have alread
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
std::string path;
|
std::string path;
|
||||||
std::shared_ptr<LUS::File> resource;
|
std::shared_ptr<Ship::IResource> resource;
|
||||||
std::shared_ptr<s16*> decodedSample;//Set if the record is for a raw sample as opposed to a SFX.
|
std::shared_ptr<s16*> decodedSample;//Set if the record is for a raw sample as opposed to a SFX.
|
||||||
|
|
||||||
}SfxRecord;
|
}SfxRecord;
|
||||||
|
|
||||||
class AudioGlossaryData {
|
class AudioGlossaryData {
|
||||||
|
@ -425,7 +425,7 @@ int ActorAccessibility_GetRandomStartingFrameCount(int min, int max) {
|
||||||
return;
|
return;
|
||||||
if (actor->policy.aimAssist.isProvider) {
|
if (actor->policy.aimAssist.isProvider) {
|
||||||
if (player->stateFlags1 & PLAYER_STATE1_FIRST_PERSON &&
|
if (player->stateFlags1 & PLAYER_STATE1_FIRST_PERSON &&
|
||||||
(player->stateFlags1 & PLAYER_STATE1_BOOMERANG_IN_HAND ||
|
(player->stateFlags1 & PLAYER_STATE1_USING_BOOMERANG ||
|
||||||
player->stateFlags1 & PLAYER_STATE1_ITEM_IN_HAND)) {
|
player->stateFlags1 & PLAYER_STATE1_ITEM_IN_HAND)) {
|
||||||
ActorAccessibility_SetSoundPitch(actor, 9, actor->aimAssist.pitch);
|
ActorAccessibility_SetSoundPitch(actor, 9, actor->aimAssist.pitch);
|
||||||
actor->aimAssist.framesSinceAimAssist++;
|
actor->aimAssist.framesSinceAimAssist++;
|
||||||
|
@ -527,7 +527,7 @@ int ActorAccessibility_GetRandomStartingFrameCount(int min, int max) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
OSContPad* trackerButtonsPressed = LUS::Context::GetInstance()->GetControlDeck()->GetPads();
|
OSContPad* trackerButtonsPressed = std::dynamic_pointer_cast<LUS::ControlDeck>(Ship::Context::GetInstance()->GetControlDeck())->GetPads();
|
||||||
bool comboStartGlossary = trackerButtonsPressed != nullptr && trackerButtonsPressed[0].button & buttons[10] &&
|
bool comboStartGlossary = trackerButtonsPressed != nullptr && trackerButtonsPressed[0].button & buttons[10] &&
|
||||||
trackerButtonsPressed[0].button & buttons[6];
|
trackerButtonsPressed[0].button & buttons[6];
|
||||||
if (comboStartGlossary) {
|
if (comboStartGlossary) {
|
||||||
|
@ -750,7 +750,7 @@ int ActorAccessibility_GetRandomStartingFrameCount(int min, int max) {
|
||||||
{
|
{
|
||||||
SfxRecord tempRecord;
|
SfxRecord tempRecord;
|
||||||
std::string fullPath = SfxExtractor::getExternalFileName(sfxId);
|
std::string fullPath = SfxExtractor::getExternalFileName(sfxId);
|
||||||
auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadFile(fullPath);
|
auto res = std::static_pointer_cast<Ship::Blob>(Ship::Context::GetInstance()->GetResourceManager()->LoadResource(fullPath));
|
||||||
|
|
||||||
if(res == nullptr)
|
if(res == nullptr)
|
||||||
return NULL;//Resource doesn't exist, user's gotta run the extractor.
|
return NULL;//Resource doesn't exist, user's gotta run the extractor.
|
||||||
|
@ -760,8 +760,8 @@ return NULL;//Resource doesn't exist, user's gotta run the extractor.
|
||||||
tempRecord.path = ss.str();
|
tempRecord.path = ss.str();
|
||||||
aa->sfxMap[sfxId] = tempRecord;
|
aa->sfxMap[sfxId] = tempRecord;
|
||||||
record = &aa->sfxMap[sfxId];
|
record = &aa->sfxMap[sfxId];
|
||||||
aa->audioEngine->cacheDecodedSample(record->path, record->resource->Buffer.data(),
|
aa->audioEngine->cacheDecodedSample(record->path, record->resource->GetRawPointer(),
|
||||||
record->resource->Buffer.size());
|
record->resource->GetPointerSize());
|
||||||
} else
|
} else
|
||||||
record = &it->second;
|
record = &it->second;
|
||||||
|
|
||||||
|
@ -780,11 +780,11 @@ return NULL;//Resource doesn't exist, user's gotta run the extractor.
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << "audio/samples/" << key;
|
ss << "audio/samples/" << key;
|
||||||
std::string fullPath = ss.str();
|
std::string fullPath = ss.str();
|
||||||
auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResource(fullPath);
|
auto res = Ship::Context::GetInstance()->GetResourceManager()->LoadResource(fullPath);
|
||||||
if (res == nullptr)
|
if (res == nullptr)
|
||||||
return NULL; // Resource doesn't exist, user's gotta run the extractor.
|
return NULL; // Resource doesn't exist, user's gotta run the extractor.
|
||||||
AudioDecoder decoder;
|
AudioDecoder decoder;
|
||||||
decoder.setSample((LUS::AudioSample*)res.get());
|
decoder.setSample((SOH::AudioSample*)res.get());
|
||||||
s16* wav;
|
s16* wav;
|
||||||
size_t wavSize = decoder.decodeToWav(&wav);
|
size_t wavSize = decoder.decodeToWav(&wav);
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,16 @@
|
||||||
#include "SfxExtractor.h"
|
#include "SfxExtractor.h"
|
||||||
#include "dr_libs/wav.h"
|
#include "dr_libs/dr_wav.h"
|
||||||
#include "soh/Enhancements/speechsynthesizer/SpeechSynthesizer.h"
|
#include "soh/Enhancements/speechsynthesizer/SpeechSynthesizer.h"
|
||||||
#include "soh/Enhancements/tts/tts.h"
|
#include "soh/Enhancements/tts/tts.h"
|
||||||
#include "miniaudio.h"
|
#include "miniaudio.h"
|
||||||
#include "z64.h"
|
|
||||||
#include "functions.h"
|
|
||||||
#include "soh/OTRGlobals.h"
|
#include "soh/OTRGlobals.h"
|
||||||
#include "SfxTable.h"
|
#include "SfxTable.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
const char* GetLanguageCode();
|
const char* GetLanguageCode();
|
||||||
extern "C" {
|
extern "C" {
|
||||||
extern Vec3f D_801333D4;
|
#include "z64.h"
|
||||||
extern f32 D_801333E0;
|
#include "functions.h"
|
||||||
extern s8 D_801333E8;
|
#include "variables.h"
|
||||||
extern u8 D_801333F0;
|
|
||||||
void AudioMgr_CreateNextAudioBuffer(s16* samples, u32 num_samples);
|
void AudioMgr_CreateNextAudioBuffer(s16* samples, u32 num_samples);
|
||||||
extern bool freezeGame;
|
extern bool freezeGame;
|
||||||
}
|
}
|
||||||
|
@ -57,8 +54,8 @@ void SfxExtractor::setEndOfInput() {
|
||||||
endOfInput -= 2;
|
endOfInput -= 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void SfxExtractor::renderOutput() {
|
|
||||||
|
|
||||||
|
void SfxExtractor::renderOutput() {
|
||||||
ma_channel_converter_config config =
|
ma_channel_converter_config config =
|
||||||
ma_channel_converter_config_init(ma_format_s16, 2, NULL, 1, NULL, ma_channel_mix_mode_default);
|
ma_channel_converter_config_init(ma_format_s16, 2, NULL, 1, NULL, ma_channel_mix_mode_default);
|
||||||
ma_channel_converter converter;
|
ma_channel_converter converter;
|
||||||
|
@ -88,10 +85,11 @@ void SfxExtractor::renderOutput() {
|
||||||
mark += thisChunk;
|
mark += thisChunk;
|
||||||
}
|
}
|
||||||
drwav_uninit(&wav);
|
drwav_uninit(&wav);
|
||||||
archive->AddFile(fileName.c_str(), (uintptr_t)mem, size);
|
std::vector<uint8_t> fileData((uint8_t*)mem, (uint8_t*)mem + size);
|
||||||
|
|
||||||
drwav_free(mem, NULL);
|
drwav_free(mem, NULL);
|
||||||
|
archive->WriteFile(fileName.c_str(), fileData);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SfxExtractor::setup() {
|
void SfxExtractor::setup() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
@ -100,7 +98,7 @@ void SfxExtractor::setup() {
|
||||||
captureThreadState = CT_WAITING;
|
captureThreadState = CT_WAITING;
|
||||||
OTRAudio_InstallSfxCaptureThread();
|
OTRAudio_InstallSfxCaptureThread();
|
||||||
// Make sure we're starting from a clean slate.
|
// Make sure we're starting from a clean slate.
|
||||||
std::string sohAccessibilityPath = LUS::Context::GetPathRelativeToAppDirectory("accessibility.otr");
|
std::string sohAccessibilityPath = Ship::Context::GetPathRelativeToAppDirectory("accessibility.otr");
|
||||||
if (std::filesystem::exists(sohAccessibilityPath)) {
|
if (std::filesystem::exists(sohAccessibilityPath)) {
|
||||||
currentStep = STEP_ERROR_OTR;
|
currentStep = STEP_ERROR_OTR;
|
||||||
return;
|
return;
|
||||||
|
@ -114,9 +112,10 @@ void SfxExtractor::setup() {
|
||||||
sfxToRip.push(sfxTable[i]);
|
sfxToRip.push(sfxTable[i]);
|
||||||
|
|
||||||
currentStep = STEP_MAIN;
|
currentStep = STEP_MAIN;
|
||||||
for (int i = 1; i < 10; i++)
|
for (int i = 1; i < 10; i++) {
|
||||||
progressMilestones[i - 1] = sfxToRip.size() - ((int)ceil(sfxToRip.size() * (i / 10.0f)));
|
progressMilestones[i - 1] = sfxToRip.size() - ((int)ceil(sfxToRip.size() * (i / 10.0f)));
|
||||||
archive = LUS::Archive::CreateArchive("accessibility.otr", sfxToRip.size());
|
}
|
||||||
|
archive = Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->AddArchive("accessibility.otr");
|
||||||
|
|
||||||
} catch (...) { currentStep = STEP_ERROR; }
|
} catch (...) { currentStep = STEP_ERROR; }
|
||||||
}
|
}
|
||||||
|
@ -129,7 +128,7 @@ void SfxExtractor::ripNextSfx() {
|
||||||
// Was the last sfx a loop? If so then we need to stop it, and then we need to run audio out to nowhere for as long
|
// Was the last sfx a loop? If so then we need to stop it, and then we need to run audio out to nowhere for as long
|
||||||
// as it takes to get back to a blank slate.
|
// as it takes to get back to a blank slate.
|
||||||
if (currentSfx != -1) {
|
if (currentSfx != -1) {
|
||||||
Audio_StopSfxByPos(&D_801333D4);
|
Audio_StopSfxByPos(&gSfxDefaultPos);
|
||||||
captureThreadState = CT_PRIMING;
|
captureThreadState = CT_PRIMING;
|
||||||
currentSfx = -1;
|
currentSfx = -1;
|
||||||
|
|
||||||
|
@ -144,7 +143,7 @@ void SfxExtractor::ripNextSfx() {
|
||||||
sfxToRip.pop();
|
sfxToRip.pop();
|
||||||
startOfInput = 0;
|
startOfInput = 0;
|
||||||
endOfInput = 0;
|
endOfInput = 0;
|
||||||
Audio_PlaySoundGeneral(currentSfx, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
Audio_PlaySoundGeneral(currentSfx, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||||
|
|
||||||
{
|
{
|
||||||
auto lock = OTRAudio_Lock();
|
auto lock = OTRAudio_Lock();
|
||||||
|
@ -162,8 +161,8 @@ void SfxExtractor::finished() {
|
||||||
Audio_QueueSeqCmd(NA_BGM_TITLE);
|
Audio_QueueSeqCmd(NA_BGM_TITLE);
|
||||||
|
|
||||||
if (currentStep == STEP_ERROR || currentStep == STEP_ERROR_OTR) {
|
if (currentStep == STEP_ERROR || currentStep == STEP_ERROR_OTR) {
|
||||||
Audio_PlaySoundGeneral(NA_SE_SY_ERROR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
Audio_PlaySoundGeneral(NA_SE_SY_ERROR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||||
Audio_PlaySoundGeneral(NA_SE_EN_GANON_LAUGH, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
Audio_PlaySoundGeneral(NA_SE_EN_GANON_LAUGH, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << "Sorry, we tried to extract the sound effects, but Ganondorf overruled us with an iron fist."
|
ss << "Sorry, we tried to extract the sound effects, but Ganondorf overruled us with an iron fist."
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "libultraship/libultraship.h"
|
#include "libultraship/libultraship.h"
|
||||||
class SfxExtractor {
|
class SfxExtractor {
|
||||||
std::shared_ptr<LUS::Archive> archive;
|
std::shared_ptr<Ship::Archive> archive;
|
||||||
int currentStep;
|
int currentStep;
|
||||||
int captureThreadState;
|
int captureThreadState;
|
||||||
std::queue<s16> sfxToRip;
|
std::queue<s16> sfxToRip;
|
||||||
|
|
|
@ -292,7 +292,7 @@ class Wall: protected TerrainCueSound {
|
||||||
play();
|
play();
|
||||||
ActorAccessibility_SeekSound(this, 0, 44100 * 2);
|
ActorAccessibility_SeekSound(this, 0, 44100 * 2);
|
||||||
}
|
}
|
||||||
f32 pitchModifier;
|
f32 pitchModifier = 0.0;
|
||||||
|
|
||||||
if (targetPitch < 0)
|
if (targetPitch < 0)
|
||||||
pitchModifier = LERP(2.5, 0.5 + targetPitch, (f32)frames / 20.0f);
|
pitchModifier = LERP(2.5, 0.5 + targetPitch, (f32)frames / 20.0f);
|
||||||
|
@ -396,13 +396,12 @@ class Lava : protected TerrainCueSound {
|
||||||
f32 probeSpeed; // Approximate for now.
|
f32 probeSpeed; // Approximate for now.
|
||||||
Vec3f velocity;
|
Vec3f velocity;
|
||||||
Vec3f expectedVelocity;
|
Vec3f expectedVelocity;
|
||||||
int terrainDiscovered;
|
int terrainDiscovered = DISCOVERED_NOTHING;
|
||||||
CollisionPoly* floorPoly;
|
CollisionPoly* floorPoly;
|
||||||
CollisionPoly* wallPoly;
|
CollisionPoly* wallPoly;
|
||||||
s32 wallBgId;
|
s32 wallBgId;
|
||||||
f32 wallHeight;
|
f32 wallHeight;
|
||||||
s32 floorBgId;
|
s32 floorBgId;
|
||||||
f32 yDistToWater;
|
|
||||||
f32 pushedSpeed;
|
f32 pushedSpeed;
|
||||||
bool disabled; // Only used for debugging.
|
bool disabled; // Only used for debugging.
|
||||||
bool trackingMode; // A debugging feature which forces Link to move along the probe's path. Used to catch collision
|
bool trackingMode; // A debugging feature which forces Link to move along the probe's path. Used to catch collision
|
||||||
|
@ -549,7 +548,7 @@ class Lava : protected TerrainCueSound {
|
||||||
return wallHeight;
|
return wallHeight;
|
||||||
}
|
}
|
||||||
D_80854798.y = 18.0f;
|
D_80854798.y = 18.0f;
|
||||||
D_80854798.z = player->ageProperties->unk_38 + 10.0f;
|
D_80854798.z = player->ageProperties->wallCheckRadius + 10.0f;
|
||||||
f32 wallYaw = Math_Atan2S(poly->normal.z, poly->normal.x);
|
f32 wallYaw = Math_Atan2S(poly->normal.z, poly->normal.x);
|
||||||
f32 nx = COLPOLY_GET_NORMAL(poly->normal.x);
|
f32 nx = COLPOLY_GET_NORMAL(poly->normal.x);
|
||||||
f32 ny = COLPOLY_GET_NORMAL(poly->normal.y);
|
f32 ny = COLPOLY_GET_NORMAL(poly->normal.y);
|
||||||
|
@ -583,7 +582,7 @@ class Lava : protected TerrainCueSound {
|
||||||
// passing in the real player with a temporarily modified pos vector, I'm using this fake player instance
|
// passing in the real player with a temporarily modified pos vector, I'm using this fake player instance
|
||||||
// instead. These functions only need the player's position and shape rotation vectors set.
|
// instead. These functions only need the player's position and shape rotation vectors set.
|
||||||
if (Player_PosVsWallLineTest(actor->play, &fakePlayer, &D_80854798, &testPoly, &bgId, &collisionResult) &&
|
if (Player_PosVsWallLineTest(actor->play, &fakePlayer, &D_80854798, &testPoly, &bgId, &collisionResult) &&
|
||||||
abs(wallYaw - Math_Atan2S(testPoly->normal.z, testPoly->normal.x)) < 0x4000 &&
|
std::abs(wallYaw - Math_Atan2S(testPoly->normal.z, testPoly->normal.x)) < 0x4000 &&
|
||||||
!func_80041E18(&actor->play->colCtx, testPoly, bgId)) {
|
!func_80041E18(&actor->play->colCtx, testPoly, bgId)) {
|
||||||
wallHeight = 399.96002f;
|
wallHeight = 399.96002f;
|
||||||
}
|
}
|
||||||
|
@ -702,7 +701,7 @@ class Lava : protected TerrainCueSound {
|
||||||
floorHeight = BgCheck_EntityRaycastFloor3(&actor->play->colCtx, &floorPoly, &floorBgId, &pos);
|
floorHeight = BgCheck_EntityRaycastFloor3(&actor->play->colCtx, &floorPoly, &floorBgId, &pos);
|
||||||
if ((floorHeight - playerHeight) > 100.0) {
|
if ((floorHeight - playerHeight) > 100.0) {
|
||||||
destroyCurrentSound();
|
destroyCurrentSound();
|
||||||
pos.y - floorHeight;
|
pos.y -= floorHeight; // TODO remove?
|
||||||
platform.setPosition(pos);
|
platform.setPosition(pos);
|
||||||
platform.run();
|
platform.run();
|
||||||
return true;
|
return true;
|
||||||
|
@ -874,9 +873,9 @@ class Lava : protected TerrainCueSound {
|
||||||
wallCheckHeight = 15.0f;
|
wallCheckHeight = 15.0f;
|
||||||
ceilingCheckHeight = 30.0f;
|
ceilingCheckHeight = 30.0f;
|
||||||
} else {
|
} else {
|
||||||
wallCheckRadius = player->ageProperties->unk_38;
|
wallCheckRadius = player->ageProperties->wallCheckRadius;
|
||||||
wallCheckHeight = 26.0f;
|
wallCheckHeight = 26.0f;
|
||||||
ceilingCheckHeight = player->ageProperties->unk_00;
|
ceilingCheckHeight = player->ageProperties->ceilingCheckHeight;
|
||||||
}
|
}
|
||||||
// The virtual cue actors travel in lines relative to Link's angle.
|
// The virtual cue actors travel in lines relative to Link's angle.
|
||||||
rot = ActorAccessibility_ComputeRelativeAngle(&player->actor.world.rot, &relRot);
|
rot = ActorAccessibility_ComputeRelativeAngle(&player->actor.world.rot, &relRot);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "AudioDecoder.h"
|
#include "AudioDecoder.h"
|
||||||
#include "z64audio.h"
|
#include "z64audio.h"
|
||||||
#include "dr_libs/wav.h"
|
#define DR_WAV_IMPLEMENTATION
|
||||||
|
#include "dr_libs/dr_wav.h"
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#define WAV_DECODE_CHUNK_SIZE 64
|
#define WAV_DECODE_CHUNK_SIZE 64
|
||||||
// A handful of definitions need to be copied from mixer.c.
|
// A handful of definitions need to be copied from mixer.c.
|
||||||
|
@ -11,20 +12,18 @@ static inline int16_t clamp16(int32_t v) {
|
||||||
return -0x8000;
|
return -0x8000;
|
||||||
} else if (v > 0x7fff) {
|
} else if (v > 0x7fff) {
|
||||||
return 0x7fff;
|
return 0x7fff;
|
||||||
|
} else {
|
||||||
|
return v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioDecoder::AudioDecoder() {
|
AudioDecoder::AudioDecoder() {
|
||||||
prev1 = 0;
|
prev1 = 0;
|
||||||
prev2 = 0;
|
prev2 = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
AudioDecoder::~AudioDecoder()
|
AudioDecoder::~AudioDecoder() {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
void AudioDecoder::setSample(LUS::AudioSample* sample)
|
void AudioDecoder::setSample(SOH::AudioSample* sample) {
|
||||||
{
|
|
||||||
this->sample.codec = sample->sample.codec;
|
this->sample.codec = sample->sample.codec;
|
||||||
this->sample.loop.start = sample->sample.loop->start;
|
this->sample.loop.start = sample->sample.loop->start;
|
||||||
this->sample.loop.end = sample->sample.loop->end;
|
this->sample.loop.end = sample->sample.loop->end;
|
||||||
|
@ -50,8 +49,7 @@ void AudioDecoder::setSample(SoundFontSample* sample) {
|
||||||
if (sample->book->book == nullptr)
|
if (sample->book->book == nullptr)
|
||||||
memset(adpcm_table, 0, 8 * 2 * 8 * 2);
|
memset(adpcm_table, 0, 8 * 2 * 8 * 2);
|
||||||
else
|
else
|
||||||
memcpy(adpcm_table, sample->book->book,
|
memcpy(adpcm_table, sample->book->book, 16 * sample->book->order * sample->book->npredictors);
|
||||||
16 * sample->book->order * sample->book->npredictors);
|
|
||||||
prev1 = 0;
|
prev1 = 0;
|
||||||
prev2 = 0;
|
prev2 = 0;
|
||||||
in = sample->sampleAddr;
|
in = sample->sampleAddr;
|
||||||
|
@ -94,7 +92,6 @@ void AudioDecoder::setSample(SoundFontSample* sample) {
|
||||||
acc >>= 11;
|
acc >>= 11;
|
||||||
*out++ = clamp16(acc);
|
*out++ = clamp16(acc);
|
||||||
samplesOut++;
|
samplesOut++;
|
||||||
|
|
||||||
}
|
}
|
||||||
prev1 = out[-1];
|
prev1 = out[-1];
|
||||||
prev2 = out[-2];
|
prev2 = out[-2];
|
||||||
|
@ -102,11 +99,9 @@ void AudioDecoder::setSample(SoundFontSample* sample) {
|
||||||
nbytes -= 16 * sizeof(int16_t);
|
nbytes -= 16 * sizeof(int16_t);
|
||||||
}
|
}
|
||||||
return samplesOut;
|
return samplesOut;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t AudioDecoder::decodeToWav (int16_t** buffer)
|
size_t AudioDecoder::decodeToWav(int16_t** buffer) {
|
||||||
{
|
|
||||||
int16_t* wavOut = nullptr;
|
int16_t* wavOut = nullptr;
|
||||||
|
|
||||||
drwav_data_format format;
|
drwav_data_format format;
|
||||||
|
@ -114,7 +109,8 @@ size_t AudioDecoder::decodeToWav (int16_t** buffer)
|
||||||
format.channels = 1;
|
format.channels = 1;
|
||||||
format.container = drwav_container_riff;
|
format.container = drwav_container_riff;
|
||||||
format.format = DR_WAVE_FORMAT_PCM;
|
format.format = DR_WAVE_FORMAT_PCM;
|
||||||
//Todo: figure out how to really determine the sample rate. CODEC_ADPCM tends to stream at higher rates (usually 20KHZ) while CODEC_SMALL_ADPCM is usually around 14000. They're still not consistent though.
|
// Todo: figure out how to really determine the sample rate. CODEC_ADPCM tends to stream at higher rates (usually
|
||||||
|
// 20KHZ) while CODEC_SMALL_ADPCM is usually around 14000. They're still not consistent though.
|
||||||
if (sample.codec == CODEC_ADPCM)
|
if (sample.codec == CODEC_ADPCM)
|
||||||
format.sampleRate = 20000;
|
format.sampleRate = 20000;
|
||||||
else if (sample.codec = CODEC_SMALL_ADPCM)
|
else if (sample.codec = CODEC_SMALL_ADPCM)
|
||||||
|
@ -145,10 +141,8 @@ size_t AudioDecoder::decodeToWav (int16_t** buffer)
|
||||||
throw std::runtime_error("AudioDecoder: Unable to write wave data.");
|
throw std::runtime_error("AudioDecoder: Unable to write wave data.");
|
||||||
}
|
}
|
||||||
samplesLeft -= samplesRead;
|
samplesLeft -= samplesRead;
|
||||||
|
|
||||||
}
|
}
|
||||||
drwav_uninit(&wav);
|
drwav_uninit(&wav);
|
||||||
*buffer = wavOut;
|
*buffer = wavOut;
|
||||||
return wavSize;
|
return wavSize;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,12 +5,10 @@
|
||||||
#include "libultraship/libultraship.h"
|
#include "libultraship/libultraship.h"
|
||||||
#include "soh/resource/type/AudioSample.h"
|
#include "soh/resource/type/AudioSample.h"
|
||||||
#include "z64audio.h"
|
#include "z64audio.h"
|
||||||
class AudioDecoder
|
class AudioDecoder {
|
||||||
{
|
|
||||||
struct {
|
struct {
|
||||||
int codec;
|
int codec;
|
||||||
struct
|
struct {
|
||||||
{
|
|
||||||
int start;
|
int start;
|
||||||
int end;
|
int end;
|
||||||
int count;
|
int count;
|
||||||
|
@ -20,12 +18,13 @@ class AudioDecoder
|
||||||
|
|
||||||
uint8_t *in, *inStart, *inEnd;
|
uint8_t *in, *inStart, *inEnd;
|
||||||
int16_t adpcm_table[8][2][8];
|
int16_t adpcm_table[8][2][8];
|
||||||
int16_t prev1, prev2;//The internal decoder takes an array of 16 shorts which it calls ADPCM_STATE. Strictly speaking only the last two decoded samples are needed for continuation.
|
int16_t prev1, prev2; // The internal decoder takes an array of 16 shorts which it calls ADPCM_STATE. Strictly
|
||||||
|
// speaking only the last two decoded samples are needed for continuation.
|
||||||
public:
|
public:
|
||||||
AudioDecoder();
|
AudioDecoder();
|
||||||
~AudioDecoder();
|
~AudioDecoder();
|
||||||
//Support both LUS samples and Z64 samples.
|
// Support both SOH samples and Z64 samples.
|
||||||
void setSample(LUS::AudioSample* sample);
|
void setSample(SOH::AudioSample* sample);
|
||||||
void setSample(SoundFontSample* sample);
|
void setSample(SoundFontSample* sample);
|
||||||
|
|
||||||
size_t decode(int16_t* out, size_t nSamples);
|
size_t decode(int16_t* out, size_t nSamples);
|
||||||
|
|
|
@ -288,12 +288,10 @@ void GameInteractor_ExecuteOnSetGameLanguage() {
|
||||||
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnSetGameLanguage>();
|
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnSetGameLanguage>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameInteractor_ExecuteOnGameStillFrozen()
|
void GameInteractor_ExecuteOnGameStillFrozen() {
|
||||||
{
|
|
||||||
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnGameStillFrozen>();
|
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnGameStillFrozen>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// MARK: - System
|
// MARK: - System
|
||||||
|
|
||||||
void GameInteractor_RegisterOnAssetAltChange(void (*fn)(void)) {
|
void GameInteractor_RegisterOnAssetAltChange(void (*fn)(void)) {
|
||||||
|
|
|
@ -77,7 +77,6 @@ void GameInteractor_ExecuteOnSetGameLanguage();
|
||||||
|
|
||||||
void GameInteractor_ExecuteOnGameStillFrozen();
|
void GameInteractor_ExecuteOnGameStillFrozen();
|
||||||
|
|
||||||
|
|
||||||
// MARK: - System
|
// MARK: - System
|
||||||
void GameInteractor_RegisterOnAssetAltChange(void (*fn)(void));
|
void GameInteractor_RegisterOnAssetAltChange(void (*fn)(void));
|
||||||
|
|
||||||
|
|
|
@ -127,11 +127,17 @@ Sail* Sail::Instance;
|
||||||
#include "soh/resource/importer/BackgroundFactory.h"
|
#include "soh/resource/importer/BackgroundFactory.h"
|
||||||
|
|
||||||
#include "soh/config/ConfigUpdaters.h"
|
#include "soh/config/ConfigUpdaters.h"
|
||||||
|
#include "soh/ShipInit.hpp"
|
||||||
#if !defined(__SWITCH__) && !defined(__WIIU__)
|
#if !defined(__SWITCH__) && !defined(__WIIU__)
|
||||||
#include "Enhancements/accessible-actors/ActorAccessibility.h"
|
#include "Enhancements/accessible-actors/ActorAccessibility.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
#include "src/overlays/actors/ovl_En_Dns/z_en_dns.h"
|
||||||
|
}
|
||||||
|
|
||||||
void SoH_ProcessDroppedFiles(std::string filePath);
|
void SoH_ProcessDroppedFiles(std::string filePath);
|
||||||
|
|
||||||
OTRGlobals* OTRGlobals::Instance;
|
OTRGlobals* OTRGlobals::Instance;
|
||||||
SaveManager* SaveManager::Instance;
|
SaveManager* SaveManager::Instance;
|
||||||
CustomMessageManager* CustomMessageManager::Instance;
|
CustomMessageManager* CustomMessageManager::Instance;
|
||||||
|
@ -288,7 +294,7 @@ OTRGlobals::OTRGlobals() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string sohAccessibilityPath = LUS::Context::GetPathRelativeToAppDirectory("accessibility.otr");
|
std::string sohAccessibilityPath = Ship::Context::GetPathRelativeToAppDirectory("accessibility.otr");
|
||||||
if (std::filesystem::exists(sohAccessibilityPath)) {
|
if (std::filesystem::exists(sohAccessibilityPath)) {
|
||||||
OTRFiles.push_back(sohAccessibilityPath);
|
OTRFiles.push_back(sohAccessibilityPath);
|
||||||
}
|
}
|
||||||
|
|
|
@ -196,12 +196,12 @@ void SohMenu::AddMenuSettings() {
|
||||||
.RaceDisable(false)
|
.RaceDisable(false)
|
||||||
.Options(CheckboxOptions().Tooltip("Disables the automatic re-centering of the camera when idle."));
|
.Options(CheckboxOptions().Tooltip("Disables the automatic re-centering of the camera when idle."));
|
||||||
|
|
||||||
AddWidget(path "Accessible Audio Cues", WIDGET_CVAR_CHECKBOX)
|
AddWidget(path, "Accessible Audio Cues", WIDGET_CVAR_CHECKBOX)
|
||||||
.CVar("gA11yAudioInteraction")
|
.CVar("gA11yAudioInteraction")
|
||||||
.RaceDisable(false)
|
.RaceDisable(false)
|
||||||
.Options(CheckboxOptions().Tooltip("Enables accessibility audio cues"));
|
.Options(CheckboxOptions().Tooltip("Enables accessibility audio cues"));
|
||||||
|
|
||||||
AddWidget(path "Extract Sfx", WIDGET_CVAR_CHECKBOX)
|
AddWidget(path, "Extract Sfx", WIDGET_CVAR_CHECKBOX)
|
||||||
.CVar("gExtractSfx")
|
.CVar("gExtractSfx")
|
||||||
.RaceDisable(false)
|
.RaceDisable(false)
|
||||||
.Options(CheckboxOptions().Tooltip("Extracts the sfx to be used in accessible audio cues, must be run once for the audio cues to play then restart game"));
|
.Options(CheckboxOptions().Tooltip("Extracts the sfx to be used in accessible audio cues, must be run once for the audio cues to play then restart game"));
|
||||||
|
|
|
@ -2559,8 +2559,6 @@ u32 D_80116068[ACTORCAT_MAX] = {
|
||||||
|
|
||||||
void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) {
|
void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Actor* refActor;
|
Actor* refActor;
|
||||||
Actor* actor;
|
Actor* actor;
|
||||||
Player* player;
|
Player* player;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue