mirror of
https://github.com/izzy2lost/shipdev.git
synced 2026-03-26 16:50:51 -07:00
Lock RAM audio to size of buffer.
External saves
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
<Identity
|
||||
Name="uwpSOH"
|
||||
Publisher="CN=datboi"
|
||||
Version="1.1.1.0" />
|
||||
Version="1.1.2.0" />
|
||||
|
||||
<mp:PhoneIdentity PhoneProductId="0587b567-7771-46ca-a4e2-0ec8ef4343c0" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
|
||||
|
||||
|
||||
@@ -44,12 +44,12 @@ void SaveManager::ReadSaveFile(std::filesystem::path savePath, uintptr_t addr, v
|
||||
}
|
||||
|
||||
std::filesystem::path SaveManager::GetFileName(int fileNum) {
|
||||
const std::filesystem::path sSavePath(LUS::Context::GetPathRelativeToAppDirectory("Save"));
|
||||
const std::filesystem::path sSavePath(LUS::Context::GetPathRelativeToAuxiliary("Save"));
|
||||
return sSavePath / ("file" + std::to_string(fileNum + 1) + ".sav");
|
||||
}
|
||||
|
||||
std::filesystem::path SaveManager::GetFileTempName(int fileNum) {
|
||||
const std::filesystem::path sSavePath(LUS::Context::GetPathRelativeToAppDirectory("Save"));
|
||||
const std::filesystem::path sSavePath(LUS::Context::GetPathRelativeToAuxiliary("Save"));
|
||||
return sSavePath / ("file" + std::to_string(fileNum + 1) + ".temp");
|
||||
}
|
||||
|
||||
@@ -371,10 +371,10 @@ void SaveManager::SaveRandomizer(SaveContext* saveContext, int sectionID, bool f
|
||||
void SaveManager::Init() {
|
||||
// Wait on saves that snuck through the Wait in OnExitGame
|
||||
ThreadPoolWait();
|
||||
const std::filesystem::path sSavePath(LUS::Context::GetPathRelativeToAppDirectory("Save"));
|
||||
const std::filesystem::path sSavePath(LUS::Context::GetPathRelativeToAuxiliary("Save"));
|
||||
const std::filesystem::path sGlobalPath = sSavePath / std::string("global.sav");
|
||||
auto sOldSavePath = LUS::Context::GetPathRelativeToAppDirectory("oot_save.sav");
|
||||
auto sOldBackupSavePath = LUS::Context::GetPathRelativeToAppDirectory("oot_save.bak");
|
||||
auto sOldSavePath = LUS::Context::GetPathRelativeToAuxiliary("oot_save.sav");
|
||||
auto sOldBackupSavePath = LUS::Context::GetPathRelativeToAuxiliary("oot_save.bak");
|
||||
|
||||
// If the save directory does not exist, create it
|
||||
if (!std::filesystem::exists(sSavePath)) {
|
||||
@@ -1017,7 +1017,7 @@ void SaveManager::SaveGlobal() {
|
||||
globalBlock["zTargetSetting"] = gSaveContext.zTargetSetting;
|
||||
globalBlock["language"] = gSaveContext.language;
|
||||
|
||||
const std::filesystem::path sSavePath(LUS::Context::GetPathRelativeToAppDirectory("Save"));
|
||||
const std::filesystem::path sSavePath(LUS::Context::GetPathRelativeToAuxiliary("Save"));
|
||||
const std::filesystem::path sGlobalPath = sSavePath / std::string("global.sav");
|
||||
|
||||
std::ofstream output(sGlobalPath);
|
||||
@@ -1076,7 +1076,7 @@ void SaveManager::LoadFile(int fileNum) {
|
||||
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnLoadFile>(fileNum);
|
||||
} catch (const std::exception& e) {
|
||||
input.close();
|
||||
std::filesystem::path newFile(LUS::Context::GetPathRelativeToAppDirectory("Save") + ("/file" + std::to_string(fileNum + 1) + "-" + std::to_string(GetUnixTimestamp()) + ".bak"));
|
||||
std::filesystem::path newFile(LUS::Context::GetPathRelativeToAuxiliary("Save") + ("/file" + std::to_string(fileNum + 1) + "-" + std::to_string(GetUnixTimestamp()) + ".bak"));
|
||||
#if defined(__SWITCH__) || defined(__WIIU__)
|
||||
copy_file(fileName.c_str(), newFile.c_str());
|
||||
#else
|
||||
|
||||
@@ -714,7 +714,7 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSubEu, NoteSynthesisS
|
||||
s16* filter;
|
||||
s32 bookOffset;
|
||||
s32 finished;
|
||||
s32 aligned;
|
||||
s32 aligned, ramAlign;
|
||||
s16 addr;
|
||||
u16 unused;
|
||||
|
||||
@@ -803,6 +803,7 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSubEu, NoteSynthesisS
|
||||
noteFinished = false;
|
||||
restart = false;
|
||||
phi_s4 = 0;
|
||||
endOfSample = false;
|
||||
|
||||
nFirstFrameSamplesToIgnore = synthState->samplePosInt & 0xF;
|
||||
nSamplesUntilLoopEnd = loopEndPos - synthState->samplePosInt;
|
||||
@@ -897,7 +898,18 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSubEu, NoteSynthesisS
|
||||
aLoadBuffer(cmd++, sampleData - sampleDataStartPad, addr, aligned);
|
||||
// RAM samples do not need rounded alignment value for src bytes otherwise access violations ahoy!
|
||||
} else {
|
||||
aLoadBufferNoRound(cmd++, sampleData - sampleDataStartPad, addr, (nFramesToDecode * frameSize + 16));
|
||||
/*
|
||||
* Probably a cleaner way of handling this but 16 padding needs to scale down towards end of
|
||||
* buffer. Example:
|
||||
*
|
||||
* Final frame with one sample remaining:
|
||||
* S
|
||||
* DDDDDDDDDPPPPPPPPPPPPPPPP
|
||||
*
|
||||
* This should return a padding of 17, not 25
|
||||
*/
|
||||
ramAlign = min((nFramesToDecode * frameSize) + 16, (audioFontSample->size + 16) - (sampleDataOffset + sampleDataStart));
|
||||
aLoadBufferNoRound(cmd++, sampleData - sampleDataStartPad, addr, ramAlign);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user