mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-07-04 03:12:48 -04:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f5642f3073 | |||
| cc9c15de54 | |||
| 1fd8a2ca3c | |||
| 0c9c8795ce | |||
| 9eb9acfa11 | |||
| facbf35343 | |||
| 7a34830dc7 | |||
| e4557efb23 | |||
| 42e12eb5ab | |||
| 16cc37ca10 | |||
| 44cb2c84ba | |||
| 8e9d4d624a | |||
| db87b91954 |
+5
-1
@@ -158,7 +158,11 @@
|
||||
"cacheVariables": {
|
||||
"CMAKE_C_COMPILER": "cl",
|
||||
"CMAKE_CXX_COMPILER": "cl",
|
||||
"CMAKE_INSTALL_PREFIX": "${sourceDir}/build/install"
|
||||
"CMAKE_INSTALL_PREFIX": "${sourceDir}/build/install",
|
||||
"CMAKE_DISABLE_FIND_PACKAGE_PkgConfig": {
|
||||
"type": "BOOL",
|
||||
"value": true
|
||||
}
|
||||
},
|
||||
"vendor": {
|
||||
"microsoft.com/VisualStudioSettings/CMake/1.0": {
|
||||
|
||||
Vendored
+1
-1
Submodule extern/aurora updated: f49d3c5f58...22351fb0b7
@@ -1418,6 +1418,8 @@ set(DUSK_FILES
|
||||
include/dusk/scope_guard.hpp
|
||||
src/dusk/dvd_asset.cpp
|
||||
src/d/actor/d_a_alink_dusk.cpp
|
||||
src/dusk/android_frame_rate.hpp
|
||||
src/dusk/android_frame_rate.cpp
|
||||
src/dusk/asserts.cpp
|
||||
src/dusk/batch.cpp
|
||||
src/dusk/batch.hpp
|
||||
|
||||
@@ -4556,6 +4556,7 @@ public:
|
||||
void handleWolfHowl();
|
||||
void handleQuickTransform();
|
||||
bool checkAimContext();
|
||||
bool checkAimInputContext();
|
||||
|
||||
void onIronBallChainInterpCallback();
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.app.ActionBar;
|
||||
import android.app.Activity;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.ClipData;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
@@ -14,12 +15,16 @@ import android.provider.DocumentsContract;
|
||||
import android.provider.OpenableColumns;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import android.view.Display;
|
||||
import android.view.Surface;
|
||||
import android.view.SurfaceHolder;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowInsets;
|
||||
import android.view.WindowInsetsController;
|
||||
|
||||
import org.libsdl.app.SDLActivity;
|
||||
import org.libsdl.app.SDLSurface;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
@@ -27,6 +32,7 @@ import java.util.List;
|
||||
|
||||
public class DuskActivity extends SDLActivity {
|
||||
private static final String TAG = "DuskActivity";
|
||||
private static final float DEFAULT_SURFACE_FRAME_RATE = 60.0f;
|
||||
private static final int FOLDER_DIALOG_REQUEST_CODE = 0x4455;
|
||||
private static final int MANAGE_STORAGE_REQUEST_CODE = 0x4456;
|
||||
private static final String EXTERNAL_STORAGE_AUTHORITY =
|
||||
@@ -88,6 +94,11 @@ public class DuskActivity extends SDLActivity {
|
||||
hideSystemBars();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SDLSurface createSDLSurface(Context context) {
|
||||
return new DuskSurface(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
@@ -139,6 +150,77 @@ public class DuskActivity extends SDLActivity {
|
||||
};
|
||||
}
|
||||
|
||||
public void setPreferredSurfaceFrameRate(float frameRate) {
|
||||
runOnUiThread(() -> {
|
||||
if (mSurface instanceof DuskSurface) {
|
||||
((DuskSurface)mSurface).setPreferredFrameRate(frameRate);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static final class DuskSurface extends SDLSurface {
|
||||
private float preferredFrameRate = DEFAULT_SURFACE_FRAME_RATE;
|
||||
|
||||
DuskSurface(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
|
||||
super.surfaceChanged(holder, format, width, height);
|
||||
setTargetFrameRate(holder);
|
||||
}
|
||||
|
||||
void setPreferredFrameRate(float frameRate) {
|
||||
preferredFrameRate = frameRate;
|
||||
setTargetFrameRate(getHolder());
|
||||
}
|
||||
|
||||
private void setTargetFrameRate(SurfaceHolder holder) {
|
||||
if (!mIsSurfaceReady || Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
|
||||
return;
|
||||
}
|
||||
|
||||
Surface surface = holder != null ? holder.getSurface() : getHolder().getSurface();
|
||||
if (surface == null || !surface.isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
float targetFrameRate = getMaxSupportedFrameRate();
|
||||
if (preferredFrameRate > 0.0f) {
|
||||
targetFrameRate = preferredFrameRate;
|
||||
}
|
||||
if (targetFrameRate <= 0.0f) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
surface.setFrameRate(
|
||||
targetFrameRate, Surface.FRAME_RATE_COMPATIBILITY_DEFAULT);
|
||||
Log.v(TAG, "Requested surface frame rate " + targetFrameRate + " fps");
|
||||
} catch (RuntimeException e) {
|
||||
Log.w(TAG, "Failed to request surface frame rate", e);
|
||||
}
|
||||
}
|
||||
|
||||
private float getMaxSupportedFrameRate() {
|
||||
if (mDisplay == null) {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
float maxFrameRate = mDisplay.getRefreshRate();
|
||||
Display.Mode[] modes = mDisplay.getSupportedModes();
|
||||
if (modes == null) {
|
||||
return maxFrameRate;
|
||||
}
|
||||
|
||||
for (Display.Mode mode : modes) {
|
||||
maxFrameRate = Math.max(maxFrameRate, mode.getRefreshRate());
|
||||
}
|
||||
return maxFrameRate;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String[] getArguments() {
|
||||
Intent intent = getIntent();
|
||||
|
||||
@@ -139,7 +139,6 @@ action-bar {
|
||||
position: absolute;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: stretch;
|
||||
border: 1dp rgba(255, 255, 255, 22%);
|
||||
border-radius: 23dp;
|
||||
background-color: rgba(22, 24, 28, 48%);
|
||||
|
||||
@@ -175,3 +175,13 @@ bool daAlink_c::checkAimContext() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool daAlink_c::checkAimInputContext() {
|
||||
switch (mProcID) {
|
||||
case PROC_HOOKSHOT_ROOF_WAIT:
|
||||
case PROC_HOOKSHOT_WALL_WAIT:
|
||||
return false;
|
||||
default:
|
||||
return checkAimContext();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ BOOL daAlink_c::setBodyAngleToCamera() {
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
if (dusk::getSettings().game.enableMouseAim && checkAimContext()) {
|
||||
if (dusk::getSettings().game.enableMouseAim && checkAimInputContext()) {
|
||||
sp8 = mBodyAngle.x;
|
||||
} else
|
||||
#endif
|
||||
@@ -142,7 +142,7 @@ BOOL daAlink_c::setBodyAngleToCamera() {
|
||||
#if TARGET_PC
|
||||
if ((dusk::getSettings().game.enableGyroAim ||
|
||||
dusk::getSettings().game.enableMouseAim) &&
|
||||
checkAimContext())
|
||||
checkAimInputContext())
|
||||
{
|
||||
f32 gyro_scale = 1.0f;
|
||||
if (checkWolfEyeUp()) {
|
||||
@@ -174,7 +174,7 @@ BOOL daAlink_c::setBodyAngleToCamera() {
|
||||
}
|
||||
}
|
||||
|
||||
if (dusk::getSettings().game.enableTouchControls && checkAimContext()) {
|
||||
if (dusk::getSettings().game.enableTouchControls && checkAimInputContext()) {
|
||||
f32 touchYawDp = 0.0f;
|
||||
f32 touchPitchDp = 0.0f;
|
||||
if (dusk::touch_camera::consume_delta(touchYawDp, touchPitchDp)) {
|
||||
|
||||
+1
-1
@@ -7505,7 +7505,7 @@ static bool sTouchFreeCameraActive = false;
|
||||
|
||||
bool dCamera_c::isAimActive() {
|
||||
auto* link = daAlink_getAlinkActorClass();
|
||||
return link != nullptr && link->checkAimContext() &&
|
||||
return link != nullptr && link->checkAimInputContext() &&
|
||||
dComIfGp_checkCameraAttentionStatus(link->field_0x317c, 0x10);
|
||||
}
|
||||
|
||||
|
||||
+9
-2
@@ -663,8 +663,15 @@ void dMeter2_c::moveLife() {
|
||||
draw_life = true;
|
||||
}
|
||||
|
||||
if (mLifeGaugeScale != g_drawHIO.mLifeParentScale) {
|
||||
mLifeGaugeScale = g_drawHIO.mLifeParentScale;
|
||||
#if TARGET_PC
|
||||
const f32 lifeGaugeScale =
|
||||
g_drawHIO.mLifeParentScale *
|
||||
std::clamp(dusk::getSettings().game.hudScale.getValue(), 0.5f, 2.0f);
|
||||
#else
|
||||
const f32 lifeGaugeScale = g_drawHIO.mLifeParentScale;
|
||||
#endif
|
||||
if (mLifeGaugeScale != lifeGaugeScale) {
|
||||
mLifeGaugeScale = lifeGaugeScale;
|
||||
draw_life = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
#include "dusk/android_frame_rate.hpp"
|
||||
|
||||
#if defined(TARGET_ANDROID) || defined(__ANDROID__) || defined(ANDROID)
|
||||
#include "dusk/settings.h"
|
||||
|
||||
#include <SDL3/SDL_system.h>
|
||||
#include <jni.h>
|
||||
|
||||
namespace dusk::android {
|
||||
namespace {
|
||||
|
||||
float preferred_surface_frame_rate() {
|
||||
switch (getSettings().game.enableFrameInterpolation.getValue()) {
|
||||
case FrameInterpMode::Off:
|
||||
return 30.0f;
|
||||
case FrameInterpMode::Unlimited:
|
||||
default:
|
||||
return 0.0f;
|
||||
case FrameInterpMode::Capped:
|
||||
return static_cast<float>(getSettings().video.maxFrameRate.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
bool clear_pending_exception(JNIEnv* env) {
|
||||
if (env == nullptr || !env->ExceptionCheck()) {
|
||||
return false;
|
||||
}
|
||||
env->ExceptionClear();
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void update_surface_frame_rate() {
|
||||
auto* env = static_cast<JNIEnv*>(SDL_GetAndroidJNIEnv());
|
||||
if (env == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
jobject activity = static_cast<jobject>(SDL_GetAndroidActivity());
|
||||
if (activity == nullptr || clear_pending_exception(env)) {
|
||||
if (activity != nullptr) {
|
||||
env->DeleteLocalRef(activity);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
jclass activityClass = env->GetObjectClass(activity);
|
||||
if (activityClass == nullptr || clear_pending_exception(env)) {
|
||||
env->DeleteLocalRef(activity);
|
||||
return;
|
||||
}
|
||||
|
||||
jmethodID setPreferredFrameRate =
|
||||
env->GetMethodID(activityClass, "setPreferredSurfaceFrameRate", "(F)V");
|
||||
env->DeleteLocalRef(activityClass);
|
||||
if (setPreferredFrameRate == nullptr || clear_pending_exception(env)) {
|
||||
env->DeleteLocalRef(activity);
|
||||
return;
|
||||
}
|
||||
|
||||
jvalue args[1]{};
|
||||
args[0].f = preferred_surface_frame_rate();
|
||||
env->CallVoidMethodA(activity, setPreferredFrameRate, args);
|
||||
env->DeleteLocalRef(activity);
|
||||
clear_pending_exception(env);
|
||||
}
|
||||
|
||||
} // namespace dusk::android
|
||||
#else
|
||||
namespace dusk::android {
|
||||
void update_surface_frame_rate() {}
|
||||
} // namespace dusk::android
|
||||
#endif
|
||||
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
namespace dusk::android {
|
||||
|
||||
void update_surface_frame_rate();
|
||||
|
||||
} // namespace dusk::android
|
||||
@@ -3,9 +3,7 @@
|
||||
#include "aurora/rmlui.hpp"
|
||||
#include "ui.hpp"
|
||||
|
||||
#include "Z2AudioLib/Z2SeMgr.h"
|
||||
#include "m_Do/m_Do_audio.h"
|
||||
#include <imgui.h>
|
||||
|
||||
namespace dusk::ui {
|
||||
namespace {
|
||||
@@ -30,19 +28,19 @@ Document::Document(const Rml::String& source, bool passive)
|
||||
return;
|
||||
}
|
||||
const auto cmd = map_nav_event(event);
|
||||
if (cmd != NavCommand::Menu && !visible()) {
|
||||
if (cmd != NavCommand::Menu && (!visible() || !active())) {
|
||||
event.StopImmediatePropagation();
|
||||
}
|
||||
},
|
||||
true);
|
||||
const auto blockUnlessVisible = [this](Rml::Event& event) {
|
||||
if (!visible()) {
|
||||
const auto blockUnlessActive = [this](Rml::Event& event) {
|
||||
if (!visible() || !active()) {
|
||||
event.StopImmediatePropagation();
|
||||
}
|
||||
};
|
||||
listen(Rml::EventId::Mouseover, blockUnlessVisible, true);
|
||||
listen(Rml::EventId::Click, blockUnlessVisible, true);
|
||||
listen(Rml::EventId::Scroll, blockUnlessVisible, true);
|
||||
listen(Rml::EventId::Mouseover, blockUnlessActive, true);
|
||||
listen(Rml::EventId::Click, blockUnlessActive, true);
|
||||
listen(Rml::EventId::Scroll, blockUnlessActive, true);
|
||||
|
||||
listen(Rml::EventId::Keydown, [this](Rml::Event& event) {
|
||||
if (mPassive) {
|
||||
@@ -124,9 +122,16 @@ bool Document::visible() const {
|
||||
return *mDocument->GetProperty(Rml::PropertyId::Visibility) == Rml::Style::Visibility::Visible;
|
||||
}
|
||||
|
||||
bool Document::active() const {
|
||||
return !mClosed && !mPendingClose;
|
||||
}
|
||||
|
||||
bool Document::handle_nav_event(Rml::Event& event) {
|
||||
if (!active()) {
|
||||
return false;
|
||||
}
|
||||
const auto cmd = map_nav_event(event);
|
||||
if (cmd == NavCommand::None) {
|
||||
if (cmd == NavCommand::None || (cmd != NavCommand::Menu && !visible())) {
|
||||
return false;
|
||||
}
|
||||
return handle_nav_command(event, cmd);
|
||||
|
||||
@@ -18,6 +18,7 @@ public:
|
||||
virtual void update();
|
||||
virtual bool focus();
|
||||
virtual bool visible() const;
|
||||
virtual bool active() const;
|
||||
|
||||
void listen(Rml::Element* element, Rml::EventId event, ScopedEventListener::Callback callback,
|
||||
bool capture = false);
|
||||
@@ -41,12 +42,11 @@ public:
|
||||
push_document(std::move(document));
|
||||
hide(false);
|
||||
}
|
||||
void pop() {
|
||||
void pop(bool show = true) {
|
||||
hide(true);
|
||||
show_top_document();
|
||||
focus_top_document(show);
|
||||
}
|
||||
|
||||
bool pending_close() const { return mPendingClose; }
|
||||
bool closed() const { return mClosed; }
|
||||
|
||||
bool handle_nav_event(Rml::Event& event);
|
||||
|
||||
@@ -715,7 +715,7 @@ Prelaunch::Prelaunch() : Document(kDocumentSource), mRoot(mDocument->GetElementB
|
||||
}
|
||||
|
||||
IsGameLaunched = true;
|
||||
hide(true);
|
||||
pop(false);
|
||||
});
|
||||
apply_intro_animation(mMenuButtons.back()->root(), "delay-1");
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "dusk/app_info.hpp"
|
||||
#include "dusk/audio/DuskAudioSystem.h"
|
||||
#include "dusk/audio/DuskDsp.hpp"
|
||||
#include "dusk/android_frame_rate.hpp"
|
||||
#include "dusk/config.hpp"
|
||||
#include "dusk/hotkeys.h"
|
||||
#include "dusk/data.hpp"
|
||||
@@ -478,14 +479,19 @@ SelectButton& config_percent_select(Pane& leftPane, Pane& rightPane, ConfigVar<f
|
||||
|
||||
SelectButton& config_int_select(Pane& leftPane, Pane& rightPane, ConfigVar<int>& var,
|
||||
Rml::String key, Rml::String helpText, int min, int max, int step = 5,
|
||||
std::function<bool()> isDisabled = {}, std::string suffix = "") {
|
||||
std::function<bool()> isDisabled = {}, std::function<void(int)> onChange = {},
|
||||
std::string suffix = "") {
|
||||
auto& button = leftPane.add_child<NumberButton>(NumberButton::Props{
|
||||
.key = std::move(key),
|
||||
.getValue = [&var] { return var; },
|
||||
.setValue =
|
||||
[&var, min, max](int value) {
|
||||
var.setValue(std::clamp(value, min, max));
|
||||
[&var, min, max, callback = std::move(onChange)](int value) {
|
||||
const int clampedValue = std::clamp(value, min, max);
|
||||
var.setValue(clampedValue);
|
||||
config::Save();
|
||||
if (callback) {
|
||||
callback(clampedValue);
|
||||
}
|
||||
},
|
||||
.isDisabled = std::move(isDisabled),
|
||||
.isModified = [&var] { return var.getValue() != var.getDefaultValue(); },
|
||||
@@ -929,6 +935,7 @@ SettingsWindow::SettingsWindow(bool prelaunch) : mPrelaunch(prelaunch) {
|
||||
.on_pressed([i] {
|
||||
mDoAud_seStartMenu(kSoundItemChange);
|
||||
getSettings().game.enableFrameInterpolation.setValue(static_cast<FrameInterpMode>(i));
|
||||
android::update_surface_frame_rate();
|
||||
config::Save();
|
||||
});
|
||||
}
|
||||
@@ -936,7 +943,8 @@ SettingsWindow::SettingsWindow(bool prelaunch) : mPrelaunch(prelaunch) {
|
||||
});
|
||||
config_int_select(leftPane, rightPane, getSettings().video.maxFrameRate,
|
||||
"Framerate Cap", "Limit the framerate to the specified value.", 30, 540, 1,
|
||||
[] { return getSettings().game.enableFrameInterpolation.getValue() != FrameInterpMode::Capped; });
|
||||
[] { return getSettings().game.enableFrameInterpolation.getValue() != FrameInterpMode::Capped; },
|
||||
[](int) { android::update_surface_frame_rate(); });
|
||||
config_bool_select(leftPane, rightPane, getSettings().game.enableMapBackground,
|
||||
{
|
||||
.key = "Enable Mini-Map Shadows",
|
||||
|
||||
@@ -156,6 +156,10 @@ bool player_attention_locked() noexcept {
|
||||
return player != nullptr && (player->checkAttentionLock() || player->checkEnemyAttentionLock());
|
||||
}
|
||||
|
||||
bool hawkeye_active() noexcept {
|
||||
return dCamera_c::isAimActive() && dComIfGp_checkPlayerStatus0(0, 0x200000);
|
||||
}
|
||||
|
||||
bool item_wheel_active() noexcept {
|
||||
return dMeter2Info_getWindowStatus() == 2;
|
||||
}
|
||||
@@ -174,7 +178,7 @@ enum class StickOutput {
|
||||
};
|
||||
|
||||
StickOutput stick_output_mode() noexcept {
|
||||
if (fishing_controls_active()) {
|
||||
if (fishing_controls_active() || hawkeye_active()) {
|
||||
return StickOutput::CStick;
|
||||
}
|
||||
return StickOutput::MainStick;
|
||||
@@ -693,7 +697,7 @@ void TouchControls::sync_touch_state() noexcept {
|
||||
|
||||
sync_l_lock_state();
|
||||
const bool aimActive = dCamera_c::isAimActive();
|
||||
if (aimActive && mMoveTouch.active) {
|
||||
if (aimActive && !hawkeye_active() && mMoveTouch.active) {
|
||||
if (!mCameraTouch.active) {
|
||||
mCameraTouch = mMoveTouch;
|
||||
mCameraTouch.start = mMoveTouch.current;
|
||||
@@ -1208,7 +1212,26 @@ void TouchControls::handle_touch_down(Rml::Event& event) noexcept {
|
||||
}
|
||||
|
||||
const auto id = touch_event_id(event);
|
||||
const auto dimensions = context->GetDimensions();
|
||||
const float top = mSafeInsets.top + kAnalogZoneTopDp * touch_dp_scale();
|
||||
const float bottom = static_cast<float>(dimensions.y) - mSafeInsets.bottom -
|
||||
kAnalogZoneBottomDp * touch_dp_scale();
|
||||
const auto width = static_cast<float>(dimensions.x);
|
||||
const bool inAnalogZone = position.y >= top && position.y <= bottom;
|
||||
const bool inLeftZone = position.x < width * kLeftZoneWidth;
|
||||
if (dCamera_c::isAimActive()) {
|
||||
if (hawkeye_active() && inAnalogZone && inLeftZone) {
|
||||
if (!mMoveTouch.active) {
|
||||
mMoveTouch = {
|
||||
.id = id,
|
||||
.start = position,
|
||||
.current = position,
|
||||
.active = true,
|
||||
};
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mCameraTouch.active) {
|
||||
mCameraTouch = {
|
||||
.id = id,
|
||||
@@ -1220,16 +1243,11 @@ void TouchControls::handle_touch_down(Rml::Event& event) noexcept {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto dimensions = context->GetDimensions();
|
||||
const float top = mSafeInsets.top + kAnalogZoneTopDp * touch_dp_scale();
|
||||
const float bottom = static_cast<float>(dimensions.y) - mSafeInsets.bottom -
|
||||
kAnalogZoneBottomDp * touch_dp_scale();
|
||||
if (position.y < top || position.y > bottom) {
|
||||
if (!inAnalogZone) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto width = static_cast<float>(dimensions.x);
|
||||
if (!mMoveTouch.active && position.x < width * kLeftZoneWidth) {
|
||||
if (!mMoveTouch.active && inLeftZone) {
|
||||
mMoveTouch = {
|
||||
.id = id,
|
||||
.start = position,
|
||||
|
||||
+9
-5
@@ -195,9 +195,13 @@ Document& push_document(std::unique_ptr<Document> doc, bool show, bool passive)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void show_top_document() noexcept {
|
||||
void focus_top_document(bool show) noexcept {
|
||||
if (auto* doc = top_document()) {
|
||||
doc->show();
|
||||
if (show) {
|
||||
doc->show();
|
||||
} else {
|
||||
doc->focus();
|
||||
}
|
||||
}
|
||||
input::sync_input_block();
|
||||
}
|
||||
@@ -210,13 +214,13 @@ bool any_document_visible() noexcept {
|
||||
bool is_prelaunch_open() noexcept {
|
||||
return std::any_of(sDocumentStack.begin(), sDocumentStack.end(), [](const auto& doc) {
|
||||
const auto* prelaunch = dynamic_cast<const Prelaunch*>(doc.get());
|
||||
return prelaunch != nullptr && !prelaunch->pending_close() && !prelaunch->closed();
|
||||
return prelaunch != nullptr && prelaunch->active();
|
||||
});
|
||||
}
|
||||
|
||||
Document* top_document() noexcept {
|
||||
for (auto& doc : std::views::reverse(sDocumentStack)) {
|
||||
if (!doc->closed() && !doc->pending_close()) {
|
||||
if (doc->active()) {
|
||||
return doc.get();
|
||||
}
|
||||
}
|
||||
@@ -259,7 +263,7 @@ void update() noexcept {
|
||||
context->GetFocusElement() == context->GetRootElement()))
|
||||
{
|
||||
for (auto& doc : std::views::reverse(sDocumentStack)) {
|
||||
if (!doc->closed() && !doc->pending_close() && doc->focus()) {
|
||||
if (doc->active() && doc->focus()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ void update() noexcept;
|
||||
|
||||
Document& push_document(
|
||||
std::unique_ptr<Document> doc, bool show = true, bool passive = false) noexcept;
|
||||
void show_top_document() noexcept;
|
||||
void focus_top_document(bool show) noexcept;
|
||||
bool any_document_visible() noexcept;
|
||||
bool is_prelaunch_open() noexcept;
|
||||
Document* top_document() noexcept;
|
||||
|
||||
+12
-10
@@ -47,6 +47,7 @@
|
||||
#include <system_error>
|
||||
#include <thread>
|
||||
#include "SSystem/SComponent/c_API.h"
|
||||
#include "dusk/android_frame_rate.hpp"
|
||||
#include "dusk/app_info.hpp"
|
||||
#include "dusk/crash_handler.h"
|
||||
#include "dusk/crash_reporting.h"
|
||||
@@ -333,11 +334,21 @@ void main01(void) {
|
||||
mDoAud_Execute();
|
||||
}
|
||||
|
||||
aurora_end_frame();
|
||||
|
||||
FrameMark;
|
||||
|
||||
#ifdef DUSK_DISCORD
|
||||
dusk::discord::run_callbacks();
|
||||
dusk::discord::update_presence();
|
||||
#endif
|
||||
|
||||
static Limiter main_loop_limiter;
|
||||
static double last_fps_setting = 0.0;
|
||||
static Limiter::duration_t target_ns = 0;
|
||||
|
||||
if (dusk::getSettings().game.enableFrameInterpolation.getValue() == dusk::FrameInterpMode::Capped && !dusk::getTransientSettings().skipFrameRateLimit) {
|
||||
ZoneScopedN("Frame limiter");
|
||||
double current_fps = dusk::getSettings().video.maxFrameRate.getValue();
|
||||
if (current_fps != last_fps_setting) {
|
||||
last_fps_setting = current_fps;
|
||||
@@ -349,16 +360,6 @@ void main01(void) {
|
||||
} else {
|
||||
main_loop_limiter.Reset();
|
||||
}
|
||||
|
||||
aurora_end_frame();
|
||||
|
||||
|
||||
FrameMark;
|
||||
|
||||
#ifdef DUSK_DISCORD
|
||||
dusk::discord::run_callbacks();
|
||||
dusk::discord::update_presence();
|
||||
#endif
|
||||
} while (dusk::IsRunning);
|
||||
|
||||
exit:;
|
||||
@@ -555,6 +556,7 @@ int game_main(int argc, char* argv[]) {
|
||||
dusk::resetForSpeedrunMode();
|
||||
}
|
||||
ApplyCVarOverrides(parsed_arg_options["cvar"]);
|
||||
dusk::android::update_surface_frame_rate();
|
||||
dusk::crash_reporting::initialize();
|
||||
dusk::crash_handler::install();
|
||||
// TODO: How to handle this?
|
||||
|
||||
Reference in New Issue
Block a user