mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-07-04 11:19:58 -04:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b6f1fbf074 | |||
| 7a77d48954 | |||
| 4ee0d8ed4b |
@@ -1,8 +1,19 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
#include <dolphin/types.h>
|
#include <dolphin/types.h>
|
||||||
|
|
||||||
namespace dusk::audio {
|
namespace dusk::audio {
|
||||||
|
|
||||||
|
// Converts a 0-1 volume to a linear amplitude multiplier.
|
||||||
|
// The curve is -4 dB per 10% step: 100% = 0 dB, 90% = -4 dB, ..., 0% = -inf dB
|
||||||
|
inline f32 MasterVolumeToLinear(f32 v) {
|
||||||
|
if (v <= 0.0f) {
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
|
return std::pow(10.0f, (v - 1.0f) * 2.0f);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the audio system and start playing audio.
|
* Initialize the audio system and start playing audio.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -175,6 +175,7 @@ class ConfigVar : public ConfigVarBase {
|
|||||||
T defaultValue;
|
T defaultValue;
|
||||||
T value;
|
T value;
|
||||||
T overrideValue;
|
T overrideValue;
|
||||||
|
ConfigVarLayer priorLayer = ConfigVarLayer::Default;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
@@ -265,6 +266,7 @@ public:
|
|||||||
void setSpeedrunValue(T newValue) {
|
void setSpeedrunValue(T newValue) {
|
||||||
checkRegistered();
|
checkRegistered();
|
||||||
if (layer != ConfigVarLayer::Override) {
|
if (layer != ConfigVarLayer::Override) {
|
||||||
|
priorLayer = layer;
|
||||||
overrideValue = std::move(newValue);
|
overrideValue = std::move(newValue);
|
||||||
layer = ConfigVarLayer::Speedrun;
|
layer = ConfigVarLayer::Speedrun;
|
||||||
}
|
}
|
||||||
@@ -282,7 +284,7 @@ public:
|
|||||||
checkRegistered();
|
checkRegistered();
|
||||||
if (layer == ConfigVarLayer::Speedrun) {
|
if (layer == ConfigVarLayer::Speedrun) {
|
||||||
overrideValue = {};
|
overrideValue = {};
|
||||||
layer = ConfigVarLayer::Value;
|
layer = priorLayer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -293,7 +295,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
[[nodiscard]] constexpr const T& getValueForSave() const noexcept {
|
[[nodiscard]] constexpr const T& getValueForSave() const noexcept {
|
||||||
checkRegistered();
|
checkRegistered();
|
||||||
return layer == ConfigVarLayer::Default ? defaultValue : value;
|
const ConfigVarLayer effectiveLayer = (layer == ConfigVarLayer::Speedrun) ? priorLayer : layer;
|
||||||
|
return effectiveLayer == ConfigVarLayer::Default ? defaultValue : value;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -171,7 +171,9 @@ struct UserSettings {
|
|||||||
ConfigVar<bool> canTransformAnywhere;
|
ConfigVar<bool> canTransformAnywhere;
|
||||||
ConfigVar<bool> fastRoll;
|
ConfigVar<bool> fastRoll;
|
||||||
ConfigVar<bool> fastSpinner;
|
ConfigVar<bool> fastSpinner;
|
||||||
ConfigVar<bool> freeMagicArmor;
|
ConfigVar<bool> magicArmorNoDrain;
|
||||||
|
ConfigVar<bool> magicArmorNoDamageLoss;
|
||||||
|
ConfigVar<bool> magicArmorNoHeavy;
|
||||||
ConfigVar<bool> invincibleEnemies;
|
ConfigVar<bool> invincibleEnemies;
|
||||||
|
|
||||||
// Technical
|
// Technical
|
||||||
|
|||||||
@@ -12738,7 +12738,7 @@ void daAlink_c::setMagicArmorBrk(int i_status) {
|
|||||||
|
|
||||||
BOOL daAlink_c::checkMagicArmorHeavy() const {
|
BOOL daAlink_c::checkMagicArmorHeavy() const {
|
||||||
#if TARGET_PC
|
#if TARGET_PC
|
||||||
return checkMagicArmorWearAbility() && (dComIfGs_getRupee() == 0 && !dusk::getSettings().game.freeMagicArmor);
|
return checkMagicArmorWearAbility() && (dComIfGs_getRupee() == 0 && !dusk::getSettings().game.magicArmorNoHeavy);
|
||||||
#else
|
#else
|
||||||
return checkMagicArmorWearAbility() && dComIfGs_getRupee() == 0;
|
return checkMagicArmorWearAbility() && dComIfGs_getRupee() == 0;
|
||||||
#endif
|
#endif
|
||||||
@@ -18711,7 +18711,7 @@ int daAlink_c::execute() {
|
|||||||
#if TARGET_PC
|
#if TARGET_PC
|
||||||
// This handles rupee drain and transitions between rupees/no rupees
|
// This handles rupee drain and transitions between rupees/no rupees
|
||||||
// We can skip all of that if the magic armor doesn't use rupees
|
// We can skip all of that if the magic armor doesn't use rupees
|
||||||
if (!dusk::getSettings().game.freeMagicArmor && checkMagicArmorWearAbility() && mClothesChangeWaitTimer == 0) {
|
if (!dusk::getSettings().game.magicArmorNoDrain && checkMagicArmorWearAbility() && mClothesChangeWaitTimer == 0) {
|
||||||
#else
|
#else
|
||||||
if (checkMagicArmorWearAbility() && mClothesChangeWaitTimer == 0) {
|
if (checkMagicArmorWearAbility() && mClothesChangeWaitTimer == 0) {
|
||||||
#endif
|
#endif
|
||||||
@@ -18724,7 +18724,8 @@ int daAlink_c::execute() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dComIfGs_getRupee() == 0 && field_0x2fd7 != 0) {
|
if (dComIfGs_getRupee() == 0 && field_0x2fd7 != 0 IF_DUSK( && !dusk::getSettings().game.magicArmorNoHeavy))
|
||||||
|
{
|
||||||
setMagicArmorBrk(0);
|
setMagicArmorBrk(0);
|
||||||
seStartOnlyReverb(Z2SE_AL_M_ARMER_TURNOFF);
|
seStartOnlyReverb(Z2SE_AL_M_ARMER_TURNOFF);
|
||||||
mZ2Link.setLinkState(5);
|
mZ2Link.setLinkState(5);
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ int daAlink_c::setDamagePoint(int i_dmgAmount, BOOL i_checkZoraMag, BOOL i_setDm
|
|||||||
|
|
||||||
if (checkMagicArmorNoDamage()) {
|
if (checkMagicArmorNoDamage()) {
|
||||||
#if TARGET_PC
|
#if TARGET_PC
|
||||||
if(dusk::getSettings().game.freeMagicArmor) {
|
if(dusk::getSettings().game.magicArmorNoDamageLoss) {
|
||||||
i_dmgAmount = 0;
|
i_dmgAmount = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -77,7 +77,12 @@ int daAlink_c::loadModelDVD() {
|
|||||||
mpWlMidnaHairModel = NULL;
|
mpWlMidnaHairModel = NULL;
|
||||||
|
|
||||||
if (!checkNoResetFlg2(FLG2_UNK_280000)) {
|
if (!checkNoResetFlg2(FLG2_UNK_280000)) {
|
||||||
dComIfG_resDelete(&mPhaseReq, mArcName);
|
if (!dComIfG_resDelete(&mPhaseReq, mArcName)) {
|
||||||
|
#if TARGET_PC
|
||||||
|
// resDelete no-ops if load was in-progress; force-unregister before freeAll
|
||||||
|
dComIfG_deleteObjectResMain(mArcName);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
cPhs_Reset(&mPhaseReq);
|
cPhs_Reset(&mPhaseReq);
|
||||||
mpArcHeap->freeAll();
|
mpArcHeap->freeAll();
|
||||||
|
|
||||||
|
|||||||
@@ -348,7 +348,7 @@ void daAlink_c::changeLink(int param_0) {
|
|||||||
initModel(static_cast<J3DModelData*>(dComIfG_getObjectRes(l_mArcName, "al_hands.bmd")), 0);
|
initModel(static_cast<J3DModelData*>(dComIfG_getObjectRes(l_mArcName, "al_hands.bmd")), 0);
|
||||||
|
|
||||||
#if TARGET_PC
|
#if TARGET_PC
|
||||||
if (dComIfGs_getRupee() != 0 || dusk::getSettings().game.freeMagicArmor)
|
if (dComIfGs_getRupee() != 0 || dusk::getSettings().game.magicArmorNoHeavy)
|
||||||
#else
|
#else
|
||||||
if (dComIfGs_getRupee() != 0)
|
if (dComIfGs_getRupee() != 0)
|
||||||
#endif
|
#endif
|
||||||
@@ -458,7 +458,7 @@ void daAlink_c::changeLink(int param_0) {
|
|||||||
field_0x06f0 = field_0x064C->getMaterialNodePointer(2)->getShape();
|
field_0x06f0 = field_0x064C->getMaterialNodePointer(2)->getShape();
|
||||||
|
|
||||||
#if TARGET_PC
|
#if TARGET_PC
|
||||||
if (dComIfGs_getRupee() != 0 || dusk::getSettings().game.freeMagicArmor) {
|
if (dComIfGs_getRupee() != 0 || dusk::getSettings().game.magicArmorNoHeavy) {
|
||||||
#else
|
#else
|
||||||
if (dComIfGs_getRupee() != 0) {
|
if (dComIfGs_getRupee() != 0) {
|
||||||
#endif
|
#endif
|
||||||
@@ -8723,6 +8723,12 @@ int daAlink_c::procWolfCargoCarry() {
|
|||||||
return checkNextActionWolf(0);
|
return checkNextActionWolf(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if TARGET_PC
|
||||||
|
if (field_0x280c.getActor() == NULL) {
|
||||||
|
return checkNextActionWolf(0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
mDoMtx_stack_c::copy(((e_yc_class*)field_0x280c.getActor())->getLegR3Mtx());
|
mDoMtx_stack_c::copy(((e_yc_class*)field_0x280c.getActor())->getLegR3Mtx());
|
||||||
mDoMtx_stack_c::transM(-9.0f, -7.0f, -30.0f);
|
mDoMtx_stack_c::transM(-9.0f, -7.0f, -30.0f);
|
||||||
mDoMtx_stack_c::multVecZero(¤t.pos);
|
mDoMtx_stack_c::multVecZero(¤t.pos);
|
||||||
|
|||||||
@@ -3882,7 +3882,11 @@ bool dCamera_c::hintTalkEvCamera() {
|
|||||||
|
|
||||||
cSAngle acStack_1fc(20.0f);
|
cSAngle acStack_1fc(20.0f);
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
|
#if AVOID_UB
|
||||||
|
for (j = 0; j < 10; j++) {
|
||||||
|
#else
|
||||||
for (j = 0; j < 12; j++) {
|
for (j = 0; j < 12; j++) {
|
||||||
|
#endif
|
||||||
cSAngle acStack_200(local_b0[j] * fVar22);
|
cSAngle acStack_200(local_b0[j] * fVar22);
|
||||||
hintTalk->mDirection.U(acStack_1f8 + acStack_200);
|
hintTalk->mDirection.U(acStack_1f8 + acStack_200);
|
||||||
hintTalk->mDirection.V(((hintTalk->field_0x28.V() * acStack_200.Cos()) * 0.2f) + acStack_1fc);
|
hintTalk->mDirection.V(((hintTalk->field_0x28.V() * acStack_200.Cos()) * 0.2f) + acStack_1fc);
|
||||||
|
|||||||
+10
-4
@@ -26,8 +26,12 @@ void updateAutoSave() {
|
|||||||
(AutoSaveFuncsProc[mAutoSaveProc])();
|
(AutoSaveFuncsProc[mAutoSaveProc])();
|
||||||
}
|
}
|
||||||
|
|
||||||
void writeAutoSave() {
|
bool writeAutoSave() {
|
||||||
int stageNo = dStage_stagInfo_GetSaveTbl(dComIfGp_getStageStagInfo());
|
stage_stag_info_class* stagInfo = dComIfGp_getStageStagInfo();
|
||||||
|
if (stagInfo == nullptr) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
int stageNo = dStage_stagInfo_GetSaveTbl(stagInfo);
|
||||||
|
|
||||||
dComIfGs_putSave(stageNo);
|
dComIfGs_putSave(stageNo);
|
||||||
dComIfGs_setMemoryToCard(mSaveBuffer, dComIfGs_getDataNum());
|
dComIfGs_setMemoryToCard(mSaveBuffer, dComIfGs_getDataNum());
|
||||||
@@ -40,6 +44,7 @@ void writeAutoSave() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_mDoMemCd_control.save(mSaveBuffer, sizeof(mSaveBuffer), 0);
|
g_mDoMemCd_control.save(mSaveBuffer, sizeof(mSaveBuffer), 0);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void autoSaving() {
|
void autoSaving() {
|
||||||
@@ -48,8 +53,9 @@ void autoSaving() {
|
|||||||
if (cardState == 2) {
|
if (cardState == 2) {
|
||||||
mAutoSaveProc = 1;
|
mAutoSaveProc = 1;
|
||||||
} else if (cardState == 1) {
|
} else if (cardState == 1) {
|
||||||
writeAutoSave();
|
if (writeAutoSave()) {
|
||||||
mAutoSaveProc = 3;
|
mAutoSaveProc = 3;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+43
-23
@@ -78,6 +78,7 @@ struct MigrationStats {
|
|||||||
|
|
||||||
std::optional<std::filesystem::path> sConfiguredDataPath;
|
std::optional<std::filesystem::path> sConfiguredDataPath;
|
||||||
std::optional<std::filesystem::path> sActiveDescriptorPath;
|
std::optional<std::filesystem::path> sActiveDescriptorPath;
|
||||||
|
std::optional<std::filesystem::path> sActivePrefPath;
|
||||||
|
|
||||||
std::filesystem::path path_from_utf8(std::string_view value) {
|
std::filesystem::path path_from_utf8(std::string_view value) {
|
||||||
return std::filesystem::path{
|
return std::filesystem::path{
|
||||||
@@ -86,19 +87,22 @@ std::filesystem::path path_from_utf8(std::string_view value) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::filesystem::path get_legacy_path() {
|
std::filesystem::path legacy_path_for_pref_path(const std::filesystem::path& prefPath) {
|
||||||
if (std::string_view{LegacyAppName}.empty()) {
|
if (std::string_view{LegacyAppName}.empty() || prefPath.empty()) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
char* prefPath = SDL_GetPrefPath(OrgName, LegacyAppName);
|
auto normalizedPrefPath = prefPath;
|
||||||
if (!prefPath) {
|
if (normalizedPrefPath.filename().empty()) {
|
||||||
Log.fatal("Unable to get PrefPath: {}", SDL_GetError());
|
normalizedPrefPath = normalizedPrefPath.parent_path();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::filesystem::path result{reinterpret_cast<const char8_t*>(prefPath)};
|
const auto parentPath = normalizedPrefPath.parent_path();
|
||||||
SDL_free(prefPath);
|
if (parentPath.empty()) {
|
||||||
return result;
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
return parentPath / LegacyAppName;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::filesystem::path get_pref_path() {
|
std::filesystem::path get_pref_path() {
|
||||||
@@ -112,6 +116,13 @@ std::filesystem::path get_pref_path() {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::filesystem::path active_pref_path() {
|
||||||
|
if (sActivePrefPath) {
|
||||||
|
return *sActivePrefPath;
|
||||||
|
}
|
||||||
|
return get_pref_path();
|
||||||
|
}
|
||||||
|
|
||||||
std::filesystem::path base_path_relative(const std::filesystem::path& path) {
|
std::filesystem::path base_path_relative(const std::filesystem::path& path) {
|
||||||
const auto* basePath = SDL_GetBasePath();
|
const auto* basePath = SDL_GetBasePath();
|
||||||
if (!basePath) {
|
if (!basePath) {
|
||||||
@@ -265,12 +276,12 @@ std::filesystem::path absolute_path(const std::filesystem::path& path) {
|
|||||||
return absolute.lexically_normal();
|
return absolute.lexically_normal();
|
||||||
}
|
}
|
||||||
|
|
||||||
void rename_legacy_pref_path(
|
std::filesystem::path rename_legacy_pref_path(
|
||||||
const std::filesystem::path& legacyPath, const std::filesystem::path& prefPath) {
|
const std::filesystem::path& legacyPath, const std::filesystem::path& prefPath) {
|
||||||
if (legacyPath.empty() || prefPath.empty() ||
|
if (legacyPath.empty() || prefPath.empty() ||
|
||||||
normalized_path(legacyPath) == normalized_path(prefPath))
|
normalized_path(legacyPath) == normalized_path(prefPath))
|
||||||
{
|
{
|
||||||
return;
|
return prefPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::error_code ec;
|
std::error_code ec;
|
||||||
@@ -279,14 +290,14 @@ void rename_legacy_pref_path(
|
|||||||
Log.warn("Failed to inspect legacy data directory '{}': {}",
|
Log.warn("Failed to inspect legacy data directory '{}': {}",
|
||||||
io::fs_path_to_string(legacyPath), ec.message());
|
io::fs_path_to_string(legacyPath), ec.message());
|
||||||
}
|
}
|
||||||
return;
|
return prefPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool prefExists = std::filesystem::exists(prefPath, ec);
|
const bool prefExists = std::filesystem::exists(prefPath, ec);
|
||||||
if (ec) {
|
if (ec) {
|
||||||
Log.warn("Failed to inspect data directory '{}': {}", io::fs_path_to_string(prefPath),
|
Log.warn("Failed to inspect data directory '{}': {}", io::fs_path_to_string(prefPath),
|
||||||
ec.message());
|
ec.message());
|
||||||
return;
|
return prefPath;
|
||||||
}
|
}
|
||||||
if (prefExists) {
|
if (prefExists) {
|
||||||
if (!std::filesystem::is_directory(prefPath, ec) ||
|
if (!std::filesystem::is_directory(prefPath, ec) ||
|
||||||
@@ -299,14 +310,14 @@ void rename_legacy_pref_path(
|
|||||||
Log.info("Skipping legacy data directory rename because '{}' is not empty",
|
Log.info("Skipping legacy data directory rename because '{}' is not empty",
|
||||||
io::fs_path_to_string(prefPath));
|
io::fs_path_to_string(prefPath));
|
||||||
}
|
}
|
||||||
return;
|
return prefPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::filesystem::remove(prefPath, ec);
|
std::filesystem::remove(prefPath, ec);
|
||||||
if (ec) {
|
if (ec) {
|
||||||
Log.warn("Failed to remove empty data directory '{}' before legacy rename: {}",
|
Log.warn("Failed to remove empty data directory '{}' before legacy rename: {}",
|
||||||
io::fs_path_to_string(prefPath), ec.message());
|
io::fs_path_to_string(prefPath), ec.message());
|
||||||
return;
|
return prefPath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -314,11 +325,18 @@ void rename_legacy_pref_path(
|
|||||||
if (ec) {
|
if (ec) {
|
||||||
Log.warn("Failed to rename legacy data directory '{}' to '{}': {}",
|
Log.warn("Failed to rename legacy data directory '{}' to '{}': {}",
|
||||||
io::fs_path_to_string(legacyPath), io::fs_path_to_string(prefPath), ec.message());
|
io::fs_path_to_string(legacyPath), io::fs_path_to_string(prefPath), ec.message());
|
||||||
return;
|
ec.clear();
|
||||||
|
if (!std::filesystem::exists(prefPath, ec) && !ec) {
|
||||||
|
Log.info("Using legacy data directory '{}' because the new data directory is absent",
|
||||||
|
io::fs_path_to_string(legacyPath));
|
||||||
|
return legacyPath;
|
||||||
|
}
|
||||||
|
return prefPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.info("Renamed legacy data directory '{}' to '{}'", io::fs_path_to_string(legacyPath),
|
Log.info("Renamed legacy data directory '{}' to '{}'", io::fs_path_to_string(legacyPath),
|
||||||
io::fs_path_to_string(prefPath));
|
io::fs_path_to_string(prefPath));
|
||||||
|
return prefPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_same_or_inside(const std::filesystem::path& root, const std::filesystem::path& path) {
|
bool is_same_or_inside(const std::filesystem::path& root, const std::filesystem::path& path) {
|
||||||
@@ -394,7 +412,7 @@ std::filesystem::path current_data_path() {
|
|||||||
if (!ConfigPath.empty()) {
|
if (!ConfigPath.empty()) {
|
||||||
return ConfigPath;
|
return ConfigPath;
|
||||||
}
|
}
|
||||||
const auto prefPath = get_pref_path();
|
const auto prefPath = active_pref_path();
|
||||||
const auto descriptor = read_location_descriptor(prefPath);
|
const auto descriptor = read_location_descriptor(prefPath);
|
||||||
if (descriptor) {
|
if (descriptor) {
|
||||||
sActiveDescriptorPath = descriptor->path;
|
sActiveDescriptorPath = descriptor->path;
|
||||||
@@ -460,7 +478,7 @@ bool write_location_descriptor(LocationMode mode, const std::filesystem::path& t
|
|||||||
json["previousPath"] = io::fs_path_to_string(descriptor.previousPath);
|
json["previousPath"] = io::fs_path_to_string(descriptor.previousPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto prefPath = get_pref_path();
|
const auto prefPath = active_pref_path();
|
||||||
for (const auto& path : descriptor_write_paths(prefPath)) {
|
for (const auto& path : descriptor_write_paths(prefPath)) {
|
||||||
if (write_descriptor_json(path, json)) {
|
if (write_descriptor_json(path, json)) {
|
||||||
sActiveDescriptorPath = path;
|
sActiveDescriptorPath = path;
|
||||||
@@ -1013,12 +1031,12 @@ bool set_portable_data_path() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool reset_data_path() {
|
bool reset_data_path() {
|
||||||
const auto prefPath = get_pref_path();
|
const auto prefPath = active_pref_path();
|
||||||
return write_location_descriptor(LocationMode::Default, default_data_path(prefPath));
|
return write_location_descriptor(LocationMode::Default, default_data_path(prefPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_default_data_path() {
|
bool is_default_data_path() {
|
||||||
const auto prefPath = get_pref_path();
|
const auto prefPath = active_pref_path();
|
||||||
return normalized_path(configured_data_path()) == normalized_path(default_data_path(prefPath));
|
return normalized_path(configured_data_path()) == normalized_path(default_data_path(prefPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1027,7 +1045,7 @@ std::filesystem::path configured_data_path() {
|
|||||||
return *sConfiguredDataPath;
|
return *sConfiguredDataPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto prefPath = get_pref_path();
|
const auto prefPath = active_pref_path();
|
||||||
const auto descriptor = read_location_descriptor(prefPath);
|
const auto descriptor = read_location_descriptor(prefPath);
|
||||||
if (descriptor) {
|
if (descriptor) {
|
||||||
sActiveDescriptorPath = descriptor->path;
|
sActiveDescriptorPath = descriptor->path;
|
||||||
@@ -1041,7 +1059,7 @@ std::filesystem::path cache_path() {
|
|||||||
if (!CachePath.empty()) {
|
if (!CachePath.empty()) {
|
||||||
return CachePath;
|
return CachePath;
|
||||||
}
|
}
|
||||||
return get_pref_path();
|
return active_pref_path();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_data_path_restart_pending() {
|
bool is_data_path_restart_pending() {
|
||||||
@@ -1053,8 +1071,10 @@ bool is_data_path_restart_pending() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Paths initialize_data() {
|
Paths initialize_data() {
|
||||||
const auto prefPath = get_pref_path();
|
const auto preferredPrefPath = get_pref_path();
|
||||||
rename_legacy_pref_path(get_legacy_path(), prefPath);
|
const auto prefPath =
|
||||||
|
rename_legacy_pref_path(legacy_path_for_pref_path(preferredPrefPath), preferredPrefPath);
|
||||||
|
sActivePrefPath = prefPath;
|
||||||
|
|
||||||
const auto descriptor = read_location_descriptor(prefPath);
|
const auto descriptor = read_location_descriptor(prefPath);
|
||||||
if (descriptor) {
|
if (descriptor) {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ UserSettings g_userSettings = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
.audio = {
|
.audio = {
|
||||||
.masterVolume {"audio.masterVolume", 80},
|
.masterVolume {"audio.masterVolume", 60},
|
||||||
.mainMusicVolume {"audio.mainMusicVolume", 100},
|
.mainMusicVolume {"audio.mainMusicVolume", 100},
|
||||||
.subMusicVolume {"audio.subMusicVolume", 100},
|
.subMusicVolume {"audio.subMusicVolume", 100},
|
||||||
.soundEffectsVolume {"audio.soundEffectsVolume", 100},
|
.soundEffectsVolume {"audio.soundEffectsVolume", 100},
|
||||||
@@ -106,7 +106,9 @@ UserSettings g_userSettings = {
|
|||||||
.canTransformAnywhere {"game.canTransformAnywhere", false},
|
.canTransformAnywhere {"game.canTransformAnywhere", false},
|
||||||
.fastRoll {"game.fastRoll", false},
|
.fastRoll {"game.fastRoll", false},
|
||||||
.fastSpinner {"game.fastSpinner", false},
|
.fastSpinner {"game.fastSpinner", false},
|
||||||
.freeMagicArmor {"game.freeMagicArmor", false},
|
.magicArmorNoDrain {"game.magicArmorNoDrain", false},
|
||||||
|
.magicArmorNoDamageLoss {"game.magicArmorNoDamageLoss", false},
|
||||||
|
.magicArmorNoHeavy {"game.magicArmorNoHeavy", false},
|
||||||
.invincibleEnemies {"game.invincibleEnemies", false},
|
.invincibleEnemies {"game.invincibleEnemies", false},
|
||||||
|
|
||||||
// Technical
|
// Technical
|
||||||
@@ -226,7 +228,9 @@ void registerSettings() {
|
|||||||
Register(g_userSettings.game.enableFastIronBoots);
|
Register(g_userSettings.game.enableFastIronBoots);
|
||||||
Register(g_userSettings.game.canTransformAnywhere);
|
Register(g_userSettings.game.canTransformAnywhere);
|
||||||
Register(g_userSettings.game.fastRoll);
|
Register(g_userSettings.game.fastRoll);
|
||||||
Register(g_userSettings.game.freeMagicArmor);
|
Register(g_userSettings.game.magicArmorNoDrain);
|
||||||
|
Register(g_userSettings.game.magicArmorNoDamageLoss);
|
||||||
|
Register(g_userSettings.game.magicArmorNoHeavy);
|
||||||
Register(g_userSettings.game.restoreWiiGlitches);
|
Register(g_userSettings.game.restoreWiiGlitches);
|
||||||
Register(g_userSettings.game.enableLinkDollRotation);
|
Register(g_userSettings.game.enableLinkDollRotation);
|
||||||
Register(g_userSettings.game.enableAchievementToasts);
|
Register(g_userSettings.game.enableAchievementToasts);
|
||||||
|
|||||||
@@ -33,7 +33,10 @@ void resetForSpeedrunMode() {
|
|||||||
getSettings().game.canTransformAnywhere.setSpeedrunValue(false);
|
getSettings().game.canTransformAnywhere.setSpeedrunValue(false);
|
||||||
getSettings().game.fastRoll.setSpeedrunValue(false);
|
getSettings().game.fastRoll.setSpeedrunValue(false);
|
||||||
getSettings().game.fastSpinner.setSpeedrunValue(false);
|
getSettings().game.fastSpinner.setSpeedrunValue(false);
|
||||||
getSettings().game.freeMagicArmor.setSpeedrunValue(false);
|
getSettings().game.magicArmorNoDrain.setSpeedrunValue(false);
|
||||||
|
getSettings().game.magicArmorNoDamageLoss.setSpeedrunValue(false);
|
||||||
|
getSettings().game.magicArmorNoHeavy.setSpeedrunValue(false);
|
||||||
|
getSettings().game.invincibleEnemies.setSpeedrunValue(false);
|
||||||
|
|
||||||
getSettings().game.pauseOnFocusLost.setSpeedrunValue(false);
|
getSettings().game.pauseOnFocusLost.setSpeedrunValue(false);
|
||||||
aurora_set_pause_on_focus_lost(false);
|
aurora_set_pause_on_focus_lost(false);
|
||||||
|
|||||||
@@ -354,8 +354,9 @@ void Overlay::update() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u32 count = 0;
|
||||||
const bool showControllerWarning = PADGetIndexForPort(PAD_CHAN0) < 0 &&
|
const bool showControllerWarning = PADGetIndexForPort(PAD_CHAN0) < 0 &&
|
||||||
PADGetKeyButtonBindings(PAD_CHAN0, nullptr) == nullptr &&
|
PADGetKeyButtonBindings(PAD_CHAN0, &count) == nullptr &&
|
||||||
dynamic_cast<Window*>(top_document()) == nullptr &&
|
dynamic_cast<Window*>(top_document()) == nullptr &&
|
||||||
dynamic_cast<WindowSmall*>(top_document()) == nullptr;
|
dynamic_cast<WindowSmall*>(top_document()) == nullptr;
|
||||||
if (showControllerWarning && mControllerWarning == nullptr) {
|
if (showControllerWarning && mControllerWarning == nullptr) {
|
||||||
|
|||||||
@@ -200,7 +200,9 @@ void reset_for_speedrun_mode() {
|
|||||||
getSettings().game.canTransformAnywhere.setSpeedrunValue(false);
|
getSettings().game.canTransformAnywhere.setSpeedrunValue(false);
|
||||||
getSettings().game.fastRoll.setSpeedrunValue(false);
|
getSettings().game.fastRoll.setSpeedrunValue(false);
|
||||||
getSettings().game.fastSpinner.setSpeedrunValue(false);
|
getSettings().game.fastSpinner.setSpeedrunValue(false);
|
||||||
getSettings().game.freeMagicArmor.setSpeedrunValue(false);
|
getSettings().game.magicArmorNoDrain.setSpeedrunValue(false);
|
||||||
|
getSettings().game.magicArmorNoDamageLoss.setSpeedrunValue(false);
|
||||||
|
getSettings().game.magicArmorNoHeavy.setSpeedrunValue(false);
|
||||||
getSettings().game.invincibleEnemies.setSpeedrunValue(false);
|
getSettings().game.invincibleEnemies.setSpeedrunValue(false);
|
||||||
|
|
||||||
getSettings().game.pauseOnFocusLost.setSpeedrunValue(false);
|
getSettings().game.pauseOnFocusLost.setSpeedrunValue(false);
|
||||||
@@ -953,7 +955,7 @@ SettingsWindow::SettingsWindow(bool prelaunch) : mPrelaunch(prelaunch) {
|
|||||||
[](int value) {
|
[](int value) {
|
||||||
getSettings().audio.masterVolume.setValue(value);
|
getSettings().audio.masterVolume.setValue(value);
|
||||||
config::Save();
|
config::Save();
|
||||||
audio::SetMasterVolume(value / 100.f);
|
audio::SetMasterVolume(audio::MasterVolumeToLinear(value / 100.0f));
|
||||||
},
|
},
|
||||||
.isModified =
|
.isModified =
|
||||||
[] {
|
[] {
|
||||||
@@ -1173,8 +1175,93 @@ SettingsWindow::SettingsWindow(bool prelaunch) : mPrelaunch(prelaunch) {
|
|||||||
"Makes Link's roll animation and movement twice as fast.");
|
"Makes Link's roll animation and movement twice as fast.");
|
||||||
addCheat("Fast Spinner", getSettings().game.fastSpinner,
|
addCheat("Fast Spinner", getSettings().game.fastSpinner,
|
||||||
"Speeds up Spinner movement while holding R.");
|
"Speeds up Spinner movement while holding R.");
|
||||||
addCheat("Free Magic Armor", getSettings().game.freeMagicArmor,
|
|
||||||
"Lets the magic armor work without consuming rupees.");
|
leftPane.register_control(
|
||||||
|
leftPane.add_select_button({
|
||||||
|
.key = "Magic Armor Mode",
|
||||||
|
.getValue =
|
||||||
|
[] {
|
||||||
|
const bool noDrain = getSettings().game.magicArmorNoDrain.getValue();
|
||||||
|
const bool noDamageLoss = getSettings().game.magicArmorNoDamageLoss.getValue();
|
||||||
|
const bool noHeavy = getSettings().game.magicArmorNoHeavy.getValue();
|
||||||
|
|
||||||
|
if (!noDrain && !noDamageLoss && !noHeavy) {
|
||||||
|
return Rml::String{"Off"};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (noDrain && noDamageLoss && noHeavy) {
|
||||||
|
return Rml::String{"All"};
|
||||||
|
}
|
||||||
|
|
||||||
|
return Rml::String{"Some"};
|
||||||
|
},
|
||||||
|
.isModified =
|
||||||
|
[] {
|
||||||
|
const auto& noDrain = getSettings().game.magicArmorNoDrain;
|
||||||
|
const auto& noDamageLoss = getSettings().game.magicArmorNoDamageLoss;
|
||||||
|
const auto& noHeavy = getSettings().game.magicArmorNoHeavy;
|
||||||
|
|
||||||
|
return noDrain.getValue() != noDrain.getDefaultValue() ||
|
||||||
|
noDamageLoss.getValue() != noDamageLoss.getDefaultValue() ||
|
||||||
|
noHeavy.getValue() != noHeavy.getDefaultValue();
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
rightPane, [](Pane& pane) {
|
||||||
|
pane.clear();
|
||||||
|
pane.add_button("Select All").on_pressed([] {
|
||||||
|
mDoAud_seStartMenu(kSoundItemChange);
|
||||||
|
getSettings().game.magicArmorNoDrain.setValue(true);
|
||||||
|
getSettings().game.magicArmorNoDamageLoss.setValue(true);
|
||||||
|
getSettings().game.magicArmorNoHeavy.setValue(true);
|
||||||
|
config::Save();
|
||||||
|
});
|
||||||
|
pane.add_button("Select None").on_pressed([] {
|
||||||
|
mDoAud_seStartMenu(kSoundItemChange);
|
||||||
|
getSettings().game.magicArmorNoDrain.setValue(false);
|
||||||
|
getSettings().game.magicArmorNoDamageLoss.setValue(false);
|
||||||
|
getSettings().game.magicArmorNoHeavy.setValue(false);
|
||||||
|
config::Save();
|
||||||
|
});
|
||||||
|
|
||||||
|
pane.add_section("Features");
|
||||||
|
pane.add_button({
|
||||||
|
.text = "No Rupee Drain",
|
||||||
|
.isSelected =
|
||||||
|
[] { return getSettings().game.magicArmorNoDrain.getValue(); },
|
||||||
|
})
|
||||||
|
.on_pressed([] {
|
||||||
|
mDoAud_seStartMenu(kSoundItemChange);
|
||||||
|
auto& v = getSettings().game.magicArmorNoDrain;
|
||||||
|
v.setValue(!v.getValue());
|
||||||
|
config::Save();
|
||||||
|
});
|
||||||
|
pane.add_button(
|
||||||
|
{
|
||||||
|
.text = "No Damage Loss",
|
||||||
|
.isSelected =
|
||||||
|
[] { return getSettings().game.magicArmorNoDamageLoss.getValue(); },
|
||||||
|
})
|
||||||
|
.on_pressed([] {
|
||||||
|
mDoAud_seStartMenu(kSoundItemChange);
|
||||||
|
auto& v = getSettings().game.magicArmorNoDamageLoss;
|
||||||
|
v.setValue(!v.getValue());
|
||||||
|
config::Save();
|
||||||
|
});
|
||||||
|
pane.add_button(
|
||||||
|
{
|
||||||
|
.text = "No Heavy Armor",
|
||||||
|
.isSelected =
|
||||||
|
[] { return getSettings().game.magicArmorNoHeavy.getValue(); },
|
||||||
|
})
|
||||||
|
.on_pressed([] {
|
||||||
|
mDoAud_seStartMenu(kSoundItemChange);
|
||||||
|
auto& v = getSettings().game.magicArmorNoHeavy;
|
||||||
|
v.setValue(!v.getValue());
|
||||||
|
config::Save();
|
||||||
|
});
|
||||||
|
pane.add_rml("<br/>Toggle which features of the Magic Armor you want active.");
|
||||||
|
});
|
||||||
|
|
||||||
addCheat("Invincible Enemies", getSettings().game.invincibleEnemies,
|
addCheat("Invincible Enemies", getSettings().game.invincibleEnemies,
|
||||||
"Prevents enemies from taking damage.");
|
"Prevents enemies from taking damage.");
|
||||||
});
|
});
|
||||||
|
|||||||
+10
-1
@@ -136,8 +136,17 @@ base_process_class* fpcBs_Create(s16 i_profname, fpc_ProcID i_procID, void* i_ap
|
|||||||
u32 size;
|
u32 size;
|
||||||
|
|
||||||
pprofile = (process_profile_definition*)fpcPf_Get(i_profname);
|
pprofile = (process_profile_definition*)fpcPf_Get(i_profname);
|
||||||
|
if (pprofile == NULL) {
|
||||||
|
#if TARGET_PC
|
||||||
|
DuskLog.debug("fpcBs_Create: profile not found for profname={}", i_profname);
|
||||||
|
#endif
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
#if TARGET_PC
|
||||||
|
const char* procName = getProcName(i_profname);
|
||||||
DuskLog.debug("fpcBs_Create: pid={} profname={} ({}) profile={} procSize={} unkSize={}",
|
DuskLog.debug("fpcBs_Create: pid={} profname={} ({}) profile={} procSize={} unkSize={}",
|
||||||
i_procID, getProcName(i_profname), i_profname, (void*)pprofile, pprofile->process_size, pprofile->unk_size);
|
i_procID, procName ? procName : "(unknown)", i_profname, (void*)pprofile, pprofile->process_size, pprofile->unk_size);
|
||||||
|
#endif
|
||||||
size = pprofile->process_size + pprofile->unk_size;
|
size = pprofile->process_size + pprofile->unk_size;
|
||||||
|
|
||||||
pprocess = (base_process_class*)cMl::memalignB(-4, size);
|
pprocess = (base_process_class*)cMl::memalignB(-4, size);
|
||||||
|
|||||||
@@ -585,7 +585,7 @@ int game_main(int argc, char* argv[]) {
|
|||||||
}
|
}
|
||||||
VISetFrameBufferScale(dusk::getSettings().game.internalResolutionScale.getValue());
|
VISetFrameBufferScale(dusk::getSettings().game.internalResolutionScale.getValue());
|
||||||
|
|
||||||
dusk::audio::SetMasterVolume(dusk::getSettings().audio.masterVolume / 100.0f);
|
dusk::audio::SetMasterVolume(dusk::audio::MasterVolumeToLinear(dusk::getSettings().audio.masterVolume / 100.0f));
|
||||||
dusk::audio::SetEnableReverb(dusk::getSettings().audio.enableReverb);
|
dusk::audio::SetEnableReverb(dusk::getSettings().audio.enableReverb);
|
||||||
dusk::audio::EnableHrtf = dusk::getSettings().audio.enableHrtf;
|
dusk::audio::EnableHrtf = dusk::getSettings().audio.enableHrtf;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user