mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-08-09 10:22:16 -04:00
716a2b4020
* Improve Widescreen/Ultrawide Collection/File Select Menus Re-scale (unstretch) and center elements of the Collection Screen/File Select details screen for Widescreen/Ultrawide * Fix oversight Fix default behavior * Support ultrawide on Collection menu, target PC support ultrawide instead of reverting to default behavior wrap logic in target PC ifdefs (both changed functions themselves are still behind them as a whole as well) and use old function behavior otherwise * Fix icon overshift at ultrawide Icon shifted too much at ultrawide Move redundant duplicate line * Finished Collection/File Select screen changes Added settings for the scaling mode (GameCube, Wii, Dusklight) Depending on the setting in the Interface menu (Dusklight preset automatically sets scaling to Dusklight option, Classic preset sets to Gamecube, Wii/all old behavior available as well) Collection and File Select screens get scaled differently Fixed backdrop behind slots on File Select with Dusklight setting (the Magic Armor background slot seeming too low on all aspects is vanilla behavior) Fixed Fused Shadow/Mirror size and position with Dusklight setting All logic is behind TARGET_PC gates (not the logic specifically, but the functions themselves have always been) Changes dSelect_cursor_c::refreshAspectScale to take a parameter so the scale of the selection cursor can be reset to default (only ever called in TARGET_PC functions or wrapped in gates) * Ultrawide oversight * Update d_file_select.cpp copy paste oopsie * Update d_file_select.cpp im tired, never tested msvc * Menu Scaling Mode changed definitions to be more open ended header additions now in TARGET_PC ifdefs fixed/added scaling for Save/Option buttons in Collection menu with Dusklight setting, stopped scaling just the text * Update settings.cpp
153 lines
4.8 KiB
C++
153 lines
4.8 KiB
C++
#include "preset.hpp"
|
|
|
|
#include "button.hpp"
|
|
#include "dusk/config.hpp"
|
|
#include "dusk/settings.h"
|
|
#include "ui.hpp"
|
|
|
|
#include <dolphin/gx/GXAurora.h>
|
|
|
|
namespace dusk::ui {
|
|
namespace {
|
|
|
|
void applyPresetClassic() {
|
|
auto& s = getSettings();
|
|
s.video.lockAspectRatio.setValue(true);
|
|
s.game.bloomMode.setValue(BloomMode::Classic);
|
|
s.game.enableAchievementToasts.setValue(false);
|
|
s.game.enableControllerToasts.setValue(false);
|
|
s.game.internalResolutionScale.setValue(1);
|
|
s.game.shadowResolutionMultiplier.setValue(1);
|
|
s.game.hideTvSettingsScreen.setValue(false);
|
|
s.game.menuScalingMode.setValue(MenuScaling::GameCube);
|
|
AuroraSetViewportPolicy(AURORA_VIEWPORT_FIT);
|
|
}
|
|
|
|
void applyPresetDusk() {
|
|
auto& s = getSettings();
|
|
s.game.hideTvSettingsScreen.setValue(true);
|
|
s.game.noReturnRupees.setValue(true);
|
|
s.game.disableRupeeCutscenes.setValue(true);
|
|
s.game.noSwordRecoil.setValue(true);
|
|
s.game.fastClimbing.setValue(true);
|
|
s.game.noMissClimbing.setValue(true);
|
|
s.game.fastTears.setValue(true);
|
|
s.game.biggerWallets.setValue(true);
|
|
s.game.invertCameraXAxis.setValue(true);
|
|
s.game.invertFirstPersonYAxis.setValue(true);
|
|
s.game.no2ndFishForCat.setValue(true);
|
|
s.game.enableAchievementToasts.setValue(true);
|
|
s.game.enableControllerToasts.setValue(true);
|
|
s.game.enableQuickTransform.setValue(true);
|
|
s.game.instantSaves.setValue(true);
|
|
s.game.midnasLamentNonStop.setValue(true);
|
|
s.game.enableFrameInterpolation.setValue(FrameInterpMode::Unlimited);
|
|
s.game.sunsSong.setValue(true);
|
|
s.game.bloomMode.setValue(BloomMode::Dusk);
|
|
s.game.internalResolutionScale.setValue(0);
|
|
s.game.shadowResolutionMultiplier.setValue(4);
|
|
s.game.enableGyroAim.setValue(true);
|
|
s.game.autoSave.setValue(true);
|
|
s.game.menuScalingMode.setValue(MenuScaling::Dusklight);
|
|
}
|
|
|
|
} // namespace
|
|
|
|
PresetWindow::PresetWindow() : WindowSmall("modal", "modal-dialog") {
|
|
mDialog->SetClass("modal-dialog", true);
|
|
|
|
auto* header = append(mDialog, "div");
|
|
header->SetClass("modal-header", true);
|
|
|
|
auto* title = append(header, "div");
|
|
title->SetClass("modal-title", true);
|
|
title->SetInnerRML("Welcome to Dusklight");
|
|
|
|
auto* headIcon = append(header, "icon");
|
|
headIcon->SetClass("celebration", true);
|
|
|
|
auto* intro = append(mDialog, "div");
|
|
intro->SetClass("modal-body", true);
|
|
intro->SetInnerRML(
|
|
"Choose a preset to get started. You can change any setting later from the Settings menu.");
|
|
|
|
auto* grid = append(mDialog, "div");
|
|
grid->SetClass("preset-grid", true);
|
|
|
|
struct PresetInfo {
|
|
const char* name;
|
|
const char* desc;
|
|
void (*apply)();
|
|
};
|
|
|
|
static constexpr PresetInfo kPresets[] = {
|
|
{"Classic",
|
|
"Enhancements disabled to match the GameCube version. "
|
|
"Good for speedrunning or simple nostalgia!",
|
|
applyPresetClassic},
|
|
{"Dusklight",
|
|
"Graphics & quality of life tweaks, including some from the Wii U version. "
|
|
"Our recommended way to play!",
|
|
applyPresetDusk},
|
|
};
|
|
|
|
for (const auto& preset : kPresets) {
|
|
auto* col = append(grid, "div");
|
|
col->SetClass("preset-col", true);
|
|
|
|
auto btn = std::make_unique<Button>(col, Rml::String(preset.name));
|
|
btn->on_nav_command([this, apply = preset.apply](Rml::Event&, NavCommand cmd) {
|
|
if (cmd == NavCommand::Confirm) {
|
|
apply();
|
|
getSettings().backend.wasPresetChosen.setValue(true);
|
|
config::Save();
|
|
hide(true);
|
|
return true;
|
|
}
|
|
return false;
|
|
});
|
|
mButtons.push_back(std::move(btn));
|
|
|
|
auto* desc = append(col, "div");
|
|
desc->SetClass("preset-desc", true);
|
|
desc->SetInnerRML(preset.desc);
|
|
}
|
|
}
|
|
|
|
bool PresetWindow::focus() {
|
|
if (!mButtons.empty()) {
|
|
return mButtons.back()->focus();
|
|
}
|
|
return false;
|
|
}
|
|
|
|
bool PresetWindow::handle_nav_command(Rml::Event& event, NavCommand cmd) {
|
|
if (cmd == NavCommand::Cancel || cmd == NavCommand::Menu) {
|
|
return true;
|
|
}
|
|
int direction = 0;
|
|
if (cmd == NavCommand::Left) {
|
|
direction = -1;
|
|
} else if (cmd == NavCommand::Right) {
|
|
direction = 1;
|
|
} else {
|
|
return false;
|
|
}
|
|
auto* target = event.GetTargetElement();
|
|
for (int i = 0; i < static_cast<int>(mButtons.size()); ++i) {
|
|
if (mButtons[i]->contains(target)) {
|
|
const int next = i + direction;
|
|
if (next >= 0 && next < static_cast<int>(mButtons.size())) {
|
|
if (mButtons[next]->focus()) {
|
|
mDoAud_seStartMenu(kSoundItemFocus);
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
} // namespace dusk::ui
|