mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-12-16 04:09:39 +00:00
Compare commits
2 Commits
386e317aea
...
5a46a976ff
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5a46a976ff | ||
|
|
fbb0f9b578 |
@ -1423,22 +1423,11 @@ class SettingsFragmentPresenter(
|
|||||||
}
|
}
|
||||||
}, R.string.real_balance_board, 0))
|
}, R.string.real_balance_board, 0))
|
||||||
|
|
||||||
sl.add(SwitchSetting(context, object : AbstractBooleanSetting {
|
sl.add(SwitchSetting(context,
|
||||||
override val isOverridden: Boolean = BooleanSetting.SERVERS_ENABLED.isOverridden
|
BooleanSetting.SERVERS_ENABLED,
|
||||||
|
R.string.dualshockudp_client,
|
||||||
override val isRuntimeEditable: Boolean =
|
R.string.dualshockudp_client_description)
|
||||||
BooleanSetting.SERVERS_ENABLED.isRuntimeEditable
|
)
|
||||||
|
|
||||||
override fun delete(settings: Settings): Boolean {
|
|
||||||
return BooleanSetting.SERVERS_ENABLED.delete(settings)
|
|
||||||
}
|
|
||||||
|
|
||||||
override val boolean: Boolean get() = BooleanSetting.SERVERS_ENABLED.boolean;
|
|
||||||
|
|
||||||
override fun setBoolean(settings: Settings, newValue: Boolean) {
|
|
||||||
BooleanSetting.SERVERS_ENABLED.setBoolean(settings, if (newValue) true else false);
|
|
||||||
}
|
|
||||||
}, R.string.dualshockudp_client, R.string.dualshockudp_client_description))
|
|
||||||
|
|
||||||
sl.add(
|
sl.add(
|
||||||
InputStringSetting(
|
InputStringSetting(
|
||||||
|
|||||||
@ -24,7 +24,7 @@
|
|||||||
<string name="wiimote_extension_3">Wii Remote Extension 4</string>
|
<string name="wiimote_extension_3">Wii Remote Extension 4</string>
|
||||||
|
|
||||||
<string name="real_balance_board">Real Balance Board</string>
|
<string name="real_balance_board">Real Balance Board</string>
|
||||||
<string name="dualshockudp_client">DualshockUDP Client (Background Input)</string>
|
<string name="dualshockudp_client">DSU Input</string>
|
||||||
<string name="dualshockudp_entries">DualshockUDP Server Info (Alternate Input Source)</string>
|
<string name="dualshockudp_entries">DualshockUDP Server Info (Alternate Input Source)</string>
|
||||||
<string name="dualshockudp_entries_description">Description:IP:Port;</string>
|
<string name="dualshockudp_entries_description">Description:IP:Port;</string>
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,9 @@
|
|||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
#include "Core/AchievementManager.h"
|
#include "Core/AchievementManager.h"
|
||||||
|
|
||||||
|
// Minimal bridge to notify native code to pause/resume background input updates.
|
||||||
|
extern "C" void SetBackgroundInputExecutionAllowed(bool allowed);
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
@ -17,5 +20,6 @@ Java_org_dolphinemu_dolphinemu_utils_ActivityTracker_setBackgroundExecutionAllow
|
|||||||
|
|
||||||
INFO_LOG_FMT(CORE, "SetBackgroundExecutionAllowed {}", allowed);
|
INFO_LOG_FMT(CORE, "SetBackgroundExecutionAllowed {}", allowed);
|
||||||
AchievementManager::GetInstance().SetBackgroundExecutionAllowed(allowed);
|
AchievementManager::GetInstance().SetBackgroundExecutionAllowed(allowed);
|
||||||
|
SetBackgroundInputExecutionAllowed(static_cast<bool>(allowed));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,6 +9,7 @@
|
|||||||
#include <optional>
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
#include <atomic>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@ -59,7 +60,6 @@
|
|||||||
#include "InputCommon/GCAdapter.h"
|
#include "InputCommon/GCAdapter.h"
|
||||||
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
||||||
|
|
||||||
|
|
||||||
#include "UICommon/GameFile.h"
|
#include "UICommon/GameFile.h"
|
||||||
#include "UICommon/UICommon.h"
|
#include "UICommon/UICommon.h"
|
||||||
|
|
||||||
@ -88,6 +88,8 @@ bool s_need_nonblocking_alert_msg;
|
|||||||
|
|
||||||
Common::Flag s_is_booting;
|
Common::Flag s_is_booting;
|
||||||
bool s_game_metadata_is_valid = false;
|
bool s_game_metadata_is_valid = false;
|
||||||
|
// When false, the controller-update thread will pause updates to save battery.
|
||||||
|
std::atomic<bool> s_background_execution_allowed{true};
|
||||||
} // Anonymous namespace
|
} // Anonymous namespace
|
||||||
|
|
||||||
void UpdatePointer()
|
void UpdatePointer()
|
||||||
@ -566,10 +568,17 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Initialize(J
|
|||||||
AchievementManager::GetInstance().Init(nullptr);
|
AchievementManager::GetInstance().Init(nullptr);
|
||||||
|
|
||||||
// Start a background thread to periodically update controller input (every 10ms).
|
// Start a background thread to periodically update controller input (every 10ms).
|
||||||
// This ensures Android keeps controller state updated even without a dedicated input loop.
|
// The thread checks `s_background_execution_allowed` and pauses updates when
|
||||||
|
// background execution is disallowed (to save battery).
|
||||||
std::thread([]() {
|
std::thread([]() {
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
|
if (!s_background_execution_allowed.load())
|
||||||
|
{
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
g_controller_interface.SetCurrentInputChannel(ciface::InputChannel::Host);
|
g_controller_interface.SetCurrentInputChannel(ciface::InputChannel::Host);
|
||||||
g_controller_interface.UpdateInput();
|
g_controller_interface.UpdateInput();
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||||
@ -589,6 +598,13 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GenerateNewS
|
|||||||
DolphinAnalytics::Instance().GenerateNewIdentity();
|
DolphinAnalytics::Instance().GenerateNewIdentity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Called from Java-side ActivityTracker native shim to allow/disable background
|
||||||
|
// controller updates. Kept minimal: just flip the flag the thread checks.
|
||||||
|
extern "C" void SetBackgroundInputExecutionAllowed(bool allowed)
|
||||||
|
{
|
||||||
|
s_background_execution_allowed.store(allowed);
|
||||||
|
}
|
||||||
|
|
||||||
// Returns the scale factor for imgui rendering.
|
// Returns the scale factor for imgui rendering.
|
||||||
// Based on the scaledDensity of the device's display metrics.
|
// Based on the scaledDensity of the device's display metrics.
|
||||||
static float GetRenderSurfaceScale(JNIEnv* env)
|
static float GetRenderSurfaceScale(JNIEnv* env)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user