Compare commits

...

5 Commits

Author SHA1 Message Date
Luke Street 0c1372f986 Revert "Kinda crappy initial controller support"
This reverts commit 23a91a37be.
2026-04-27 21:55:57 -06:00
TakaRikka a4777045fe Merge pull request #578 from TwilitRealm/fix/fix-disable-hud
Fix bugs with Disable Main HUD
2026-04-27 15:29:02 -07:00
TakaRikka bbe8ea6aa6 Merge pull request #577 from TwilitRealm/better-freecam-code
Better Freecam code + Allow Freecam in Target mode
2026-04-27 15:28:39 -07:00
MelonSpeedruns d662db69f0 Fix bugs with Disable Main HUD 2026-04-27 17:04:42 -04:00
MelonSpeedruns 9b259143be Better Freecam code + Allow Freecam in Target mode 2026-04-27 12:05:26 -04:00
7 changed files with 58 additions and 146 deletions
+1 -1
+33 -20
View File
@@ -794,16 +794,15 @@ void dCamera_c::updatePad() {
if (mTriggerLeftLast > mCamSetup.ManualEndVal()) {
if (mLockLActive == 0) {
#if TARGET_PC
mCamParam.mManualMode = 0;
#endif
mLockLJustActivated = 1;
} else {
mLockLJustActivated = 0;
}
mLockLActive = 1;
#if TARGET_PC
mCamParam.mManualMode = 0;
#endif
} else {
mLockLJustActivated = 0;
mLockLActive = 0;
@@ -1178,12 +1177,6 @@ bool dCamera_c::Run() {
} else {
sp0F = (this->*engine_tbl[mCamParam.Algorythmn(mCamStyle)])(mCamStyle);
#if TARGET_PC
if (mCamParam.Algorythmn(mCamStyle) != 1) {
mCamParam.mManualMode = 0;
}
#endif
field_0x170++;
field_0x160++;
mCurCamStyleTimer++;
@@ -3527,6 +3520,12 @@ void dCamera_c::checkGroundInfo() {
}
bool dCamera_c::chaseCamera(s32 param_0) {
#if TARGET_PC
if (freeCamera()) {
return 1;
}
#endif
static f32 JumpCushion = 0.9f;
f32 charge_latitude = mCamSetup.ChargeLatitude();
int charge_timer = mCamSetup.ChargeTimer();
@@ -4631,10 +4630,6 @@ bool dCamera_c::chaseCamera(s32 param_0) {
sp110 = mViewCache.mDirection.R();
mViewCache.mDirection.R(mViewCache.mDirection.R() + (fVar55 - mViewCache.mDirection.R()) * chase->field_0x74);
#if TARGET_PC
freeCamera();
#endif
chase->field_0x64 = mViewCache.mCenter + mViewCache.mDirection.Xyz();
mViewCache.mEye = chase->field_0x64;
@@ -7482,6 +7477,9 @@ bool dCamera_c::freeCamera() {
return false;
}
mCamParam.freeXAngle = mViewCache.mDirection.mAzimuth.Degree();
mCamParam.freeYAngle = mViewCache.mDirection.mInclination.Degree();
cXyz camMovement = {mPadInfo.mCStick.mLastPosX, mPadInfo.mCStick.mLastPosY, 0.0f};
f32 magnitude = sqrt(mPadInfo.mCStick.mLastPosX * mPadInfo.mCStick.mLastPosX + mPadInfo.mCStick.mLastPosY * mPadInfo.mCStick.mLastPosY);
@@ -7498,14 +7496,29 @@ bool dCamera_c::freeCamera() {
mCamParam.freeYAngle += camMovement.y * magnitude * dusk::getSettings().game.freeCameraSensitivity * 4.0f;
}
if (mCamParam.mManualMode) {
mCamParam.freeYAngle = std::clamp(mCamParam.freeYAngle, -35.0f, 60.0f);
mViewCache.mDirection.mAzimuth = cSAngle(mCamParam.freeXAngle);
mViewCache.mDirection.mInclination = cSAngle(mCamParam.freeYAngle);
mViewCache.mDirection.mRadius = std::clamp((mCamParam.freeYAngle + 35.0f) * 10.0f, 300.0f, 10000.0f);
if (!mCamParam.mManualMode) {
return false;
}
return mCamParam.mManualMode;
f32 minYAngle = -10.0f;
f32 maxAngle = 50.0f;
mCamParam.freeYAngle = std::clamp(mCamParam.freeYAngle, minYAngle, maxAngle);
mViewCache.mDirection.mAzimuth = cSAngle(mCamParam.freeXAngle);
mViewCache.mDirection.mInclination = cSAngle(mCamParam.freeYAngle);
f32 currentLerp = (mCamParam.freeYAngle - minYAngle) / (maxAngle - minYAngle);
mViewCache.mDirection.mRadius = std::lerp(200.0f, 1000.0f, currentLerp);
cXyz finalCenter = mpPlayerActor->current.pos;
finalCenter.y += mIsWolf ? 90.0f : 100.0f;
mViewCache.mCenter = finalCenter;
cXyz finalEye = finalCenter + mViewCache.mDirection.Xyz();
mViewCache.mEye = finalEye;
mViewCache.mFovy = 60.0f;
return true;
}
#endif
+6 -6
View File
@@ -316,6 +316,12 @@ int dMeter2_c::_execute() {
}
int dMeter2_c::_draw() {
#if TARGET_PC
if (dusk::getSettings().game.disableMainHUD) {
return 1;
}
#endif
if (mpMap != NULL) {
mpMap->_draw();
}
@@ -424,12 +430,6 @@ void dMeter2_c::setLifeZero() {
void dMeter2_c::checkStatus() {
mStatus = 0;
#if TARGET_PC
if (dusk::getSettings().game.disableMainHUD) {
mStatus |= 0xF0000000;
}
#endif
field_0x12c = field_0x128;
field_0x128 = daPy_py_c::checkNowWolf();
+2 -31
View File
@@ -56,21 +56,6 @@ ImGuiWindow* FindDragScrollWindow(ImGuiWindow* window) {
}
return nullptr;
}
void FocusLastMenuBarItem() {
ImGuiContext& g = *ImGui::GetCurrentContext();
ImGuiWindow* window = ImGui::GetCurrentWindow();
const ImGuiID itemId = g.LastItemData.ID;
if (window == nullptr || itemId == 0) {
return;
}
ImGui::FocusWindow(window);
ImGui::SetNavID(itemId, ImGuiNavLayer_Menu, g.CurrentFocusScopeId,
ImGui::WindowRectAbsToRel(window, g.LastItemData.NavRect));
ImGui::SetNavCursorVisibleAfterMove();
g.NavHighlightItemUnderNav = true;
}
} // namespace
namespace dusk {
@@ -344,17 +329,7 @@ namespace dusk {
}
m_isHidden = !getSettings().backend.duskMenuOpen;
if (dusk::IsGameLaunched) {
if (ImGui::IsKeyPressed(ImGuiKey_F1)) {
m_isHidden = !m_isHidden;
}
if (ImGui::IsKeyPressed(ImGuiKey_GamepadBack)) {
m_isHidden = !m_isHidden;
m_focusMenuBar = !m_isHidden;
}
}
bool showMenu = !dusk::IsGameLaunched || !m_isHidden;
bool showMenu = !dusk::IsGameLaunched || !CheckMenuViewToggle(ImGuiKey_F1, m_isHidden);
if (dusk::IsGameLaunched) {
const bool menuOpen = !m_isHidden;
if (getSettings().backend.duskMenuOpen != menuOpen) {
@@ -368,10 +343,6 @@ namespace dusk {
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0.0f, 0.0f, 0.0f, 0.0f));
if (showMenu && ImGui::BeginMainMenuBar()) {
m_menuGame.draw();
if (m_focusMenuBar) {
FocusLastMenuBarItem();
m_focusMenuBar = false;
}
m_menuTools.draw();
const auto fpsLabel =
@@ -396,7 +367,7 @@ namespace dusk {
if (dusk::IsGameLaunched && !m_isLaunchInitialized) {
m_toasts.emplace_back(ImGui::GetIO().MouseSource == ImGuiMouseSource_TouchScreen ?
"Tap to toggle menu"s :
"Press F1 or Minus/Back to toggle menu"s,
"Press F1 to toggle menu"s,
2.5f);
m_isLaunchInitialized = true;
if (getSettings().game.liveSplitEnabled) {
-1
View File
@@ -41,7 +41,6 @@ private:
float mouseHideTimer = 0.0f;
bool m_isHidden = true;
bool m_focusMenuBar = false;
bool m_isLaunchInitialized = false;
bool m_touchTapActive = false;
bool m_touchTapMoved = false;
+16 -84
View File
@@ -23,15 +23,6 @@
namespace {
constexpr int kInternalResolutionScaleMax = 12;
bool is_controller_neutral(int port) {
if (port < 0) {
return true;
}
return PADGetNativeButtonPressed(port) == -1 &&
PADGetNativeAxisPulled(port).nativeAxis == -1;
}
} // namespace
namespace aurora::gx {
@@ -205,7 +196,7 @@ namespace dusk {
ImGui::SetTooltip("Restores patched glitches from Wii USA 1.0,\n"
"the first released version.");
}
config::ImGuiCheckbox("Enable Rotating Link Doll", getSettings().game.enableLinkDollRotation);
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Enables rotating Link in the collection menu with the C-Stick");
@@ -651,90 +642,39 @@ namespace dusk {
void ImGuiMenuGame::windowControllerConfig() {
if (!m_showControllerConfig) {
if (m_controllerConfig.m_isReading ||
m_controllerConfig.m_suppressRemapActivationUntilRelease)
{
m_controllerConfig.m_isReading = false;
m_controllerConfig.m_pendingButtonMapping = nullptr;
m_controllerConfig.m_pendingAxisMapping = nullptr;
m_controllerConfig.m_pendingPort = -1;
m_controllerConfig.m_waitForInputRelease = false;
m_controllerConfig.m_suppressRemapActivationUntilRelease = false;
m_controllerConfig.m_suppressRemapActivationPort = -1;
PADBlockInput(false);
}
return;
}
bool suppressRemapActivationThisFrame = m_controllerConfig.m_suppressRemapActivationUntilRelease;
if (m_controllerConfig.m_suppressRemapActivationUntilRelease &&
is_controller_neutral(m_controllerConfig.m_suppressRemapActivationPort))
{
m_controllerConfig.m_suppressRemapActivationUntilRelease = false;
m_controllerConfig.m_suppressRemapActivationPort = -1;
PADBlockInput(false);
}
if ((m_controllerConfig.m_pendingButtonMapping != nullptr ||
m_controllerConfig.m_pendingAxisMapping != nullptr) &&
m_controllerConfig.m_waitForInputRelease)
{
m_controllerConfig.m_waitForInputRelease =
!is_controller_neutral(m_controllerConfig.m_pendingPort);
}
// if pending for a button mapping, check to set new input
if (m_controllerConfig.m_pendingButtonMapping != nullptr &&
!m_controllerConfig.m_waitForInputRelease)
{
if (m_controllerConfig.m_pendingButtonMapping != nullptr) {
s32 nativeButton = PADGetNativeButtonPressed(m_controllerConfig.m_pendingPort);
if (nativeButton != -1) {
const int suppressPort = m_controllerConfig.m_pendingPort;
m_controllerConfig.m_pendingButtonMapping->nativeButton = nativeButton;
m_controllerConfig.m_pendingButtonMapping = nullptr;
m_controllerConfig.m_pendingPort = -1;
m_controllerConfig.m_isReading = false;
m_controllerConfig.m_waitForInputRelease = false;
m_controllerConfig.m_suppressRemapActivationUntilRelease = true;
m_controllerConfig.m_suppressRemapActivationPort = suppressPort;
suppressRemapActivationThisFrame = true;
PADBlockInput(true);
PADBlockInput(false);
PADSerializeMappings();
}
}
// if pending for an axis mapping, check to set new input
if (m_controllerConfig.m_pendingAxisMapping != nullptr &&
!m_controllerConfig.m_waitForInputRelease)
{
if (m_controllerConfig.m_pendingAxisMapping != nullptr) {
auto nativeAxis = PADGetNativeAxisPulled(m_controllerConfig.m_pendingPort);
if (nativeAxis.nativeAxis != -1) {
const int suppressPort = m_controllerConfig.m_pendingPort;
m_controllerConfig.m_pendingAxisMapping->nativeAxis = nativeAxis;
m_controllerConfig.m_pendingAxisMapping->nativeButton = -1;
m_controllerConfig.m_pendingAxisMapping = nullptr;
m_controllerConfig.m_pendingPort = -1;
m_controllerConfig.m_isReading = false;
m_controllerConfig.m_waitForInputRelease = false;
m_controllerConfig.m_suppressRemapActivationUntilRelease = true;
m_controllerConfig.m_suppressRemapActivationPort = suppressPort;
suppressRemapActivationThisFrame = true;
PADBlockInput(true);
PADBlockInput(false);
PADSerializeMappings();
} else {
auto nativeButton = PADGetNativeButtonPressed(m_controllerConfig.m_pendingPort);
if (nativeButton != -1) {
const int suppressPort = m_controllerConfig.m_pendingPort;
m_controllerConfig.m_pendingAxisMapping->nativeAxis = {-1, AXIS_SIGN_POSITIVE};
m_controllerConfig.m_pendingAxisMapping->nativeButton = nativeButton;
m_controllerConfig.m_pendingAxisMapping = nullptr;
m_controllerConfig.m_pendingPort = -1;
m_controllerConfig.m_isReading = false;
m_controllerConfig.m_waitForInputRelease = false;
m_controllerConfig.m_suppressRemapActivationUntilRelease = true;
m_controllerConfig.m_suppressRemapActivationPort = suppressPort;
suppressRemapActivationThisFrame = true;
PADBlockInput(true);
PADBlockInput(false);
PADSerializeMappings();
}
}
@@ -770,10 +710,6 @@ namespace dusk {
m_controllerConfig.m_pendingButtonMapping = nullptr;
m_controllerConfig.m_pendingAxisMapping = nullptr;
m_controllerConfig.m_pendingPort = -1;
m_controllerConfig.m_waitForInputRelease = false;
m_controllerConfig.m_isReading = false;
m_controllerConfig.m_suppressRemapActivationUntilRelease = false;
m_controllerConfig.m_suppressRemapActivationPort = -1;
PADBlockInput(false);
}
@@ -850,7 +786,7 @@ namespace dusk {
std::string dispName;
if (m_controllerConfig.m_isReading && m_controllerConfig.m_pendingButtonMapping == &btnMappingList[i]) {
dispName = fmt::format("{}##{}", m_controllerConfig.m_waitForInputRelease ? "Release..." : "Press a Key...", btnName);
dispName = fmt::format("Press a Key...##{}", btnName);
} else {
const char* nativeName = GetNameForGamepadButton(gamepad, btnMappingList[i].nativeButton);
if (nativeName == nullptr) {
@@ -861,11 +797,10 @@ namespace dusk {
bool pressed = ImGui::Button(dispName.c_str(),
btnSize);
if (pressed && !m_controllerConfig.m_isReading && !suppressRemapActivationThisFrame) {
if (pressed) {
m_controllerConfig.m_isReading = true;
m_controllerConfig.m_pendingPort = m_controllerConfig.m_selectedPort;
m_controllerConfig.m_pendingButtonMapping = &btnMappingList[i];
m_controllerConfig.m_waitForInputRelease = true;
PADBlockInput(true);
}
}
@@ -895,18 +830,17 @@ namespace dusk {
std::string dispName;
if (m_controllerConfig.m_isReading && m_controllerConfig.m_pendingAxisMapping == &axisMappingList[trigger]) {
dispName = fmt::format("{}##{}", m_controllerConfig.m_waitForInputRelease ? "Release..." : "Press a Key...", axisName);
dispName = fmt::format("Press a Key...##{}", axisName);
} else {
dispName = fmt::format("{0}##-{1}", PADGetNativeAxisName(axisMappingList[trigger].nativeAxis), trigger);
}
bool pressed = ImGui::Button(dispName.c_str(),
btnSize);
if (pressed && !m_controllerConfig.m_isReading && !suppressRemapActivationThisFrame) {
if (pressed) {
m_controllerConfig.m_isReading = true;
m_controllerConfig.m_pendingPort = m_controllerConfig.m_selectedPort;
m_controllerConfig.m_pendingAxisMapping = &axisMappingList[trigger];
m_controllerConfig.m_waitForInputRelease = true;
PADBlockInput(true);
}
}
@@ -963,7 +897,7 @@ namespace dusk {
std::string dispName;
if (m_controllerConfig.m_isReading && m_controllerConfig.m_pendingAxisMapping == &axisMappingList[axis]) {
dispName = fmt::format("{}##{}", m_controllerConfig.m_waitForInputRelease ? "Release..." : "Press a Key...", label);
dispName = fmt::format("Press a Key...##{}", label);
} else {
if (axisMappingList[axis].nativeAxis.nativeAxis != -1) {
const char* signStr;
@@ -982,11 +916,10 @@ namespace dusk {
}
bool pressed = ImGui::Button(dispName.c_str(), btnSize);
if (pressed && !m_controllerConfig.m_isReading && !suppressRemapActivationThisFrame) {
if (pressed) {
m_controllerConfig.m_isReading = true;
m_controllerConfig.m_pendingPort = m_controllerConfig.m_selectedPort;
m_controllerConfig.m_pendingAxisMapping = &axisMappingList[axis];
m_controllerConfig.m_waitForInputRelease = true;
PADBlockInput(true);
}
}
@@ -1027,7 +960,7 @@ namespace dusk {
std::string dispName;
if (m_controllerConfig.m_isReading && m_controllerConfig.m_pendingAxisMapping == &axisMappingList[axis]) {
dispName = fmt::format("{}##sub{}", m_controllerConfig.m_waitForInputRelease ? "Release..." : "Press a Key...", label);
dispName = fmt::format("Press a Key...##sub{}", label);
} else {
if (axisMappingList[axis].nativeAxis.nativeAxis != -1) {
const char* signStr;
@@ -1046,11 +979,10 @@ namespace dusk {
}
bool pressed = ImGui::Button(fmt::format("{0}##sub{1}", dispName, label).c_str(), btnSize);
if (pressed && !m_controllerConfig.m_isReading && !suppressRemapActivationThisFrame) {
if (pressed) {
m_controllerConfig.m_isReading = true;
m_controllerConfig.m_pendingPort = m_controllerConfig.m_selectedPort;
m_controllerConfig.m_pendingAxisMapping = &axisMappingList[axis];
m_controllerConfig.m_waitForInputRelease = true;
PADBlockInput(true);
}
}
@@ -1081,7 +1013,7 @@ namespace dusk {
PADSerializeMappings();
}
}
if (PADSupportsRumbleIntensity(m_controllerConfig.m_selectedPort)) {
ImGuiBeginGroupPanel("Rumble Intensity", ImVec2(150 * scale, -1));
u16 low;
@@ -1100,7 +1032,7 @@ namespace dusk {
if (ImGui::Button(fmt::format("{0}...##rumbleTest", m_controllerConfig.m_isRumbling ? "Stop": "Test").c_str(), {-1, 0})) {
PADControlMotor(m_controllerConfig.m_selectedPort, !m_controllerConfig.m_isRumbling ? PAD_MOTOR_RUMBLE : PAD_MOTOR_STOP_HARD);
m_controllerConfig.m_isRumbling ^= 1;
}
}
ImGuiEndGroupPanel();
}
ImGuiEndGroupPanel();
-3
View File
@@ -68,9 +68,6 @@ namespace dusk {
PADButtonMapping* m_pendingButtonMapping = nullptr;
PADAxisMapping* m_pendingAxisMapping = nullptr;
int m_pendingPort = -1;
bool m_waitForInputRelease = false;
bool m_suppressRemapActivationUntilRelease = false;
int m_suppressRemapActivationPort = -1;
bool m_isRumbling = false;
} m_controllerConfig;