mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-11-17 06:42:30 +00:00
Compare commits
6 Commits
2d571ba372
...
c01100b82e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c01100b82e | ||
|
|
0fdf1cc386 | ||
|
|
999e13b3b3 | ||
|
|
a7d1c1cf1e | ||
|
|
d1526157df | ||
|
|
df5f351add |
@ -35,6 +35,7 @@ import org.dolphinemu.dolphinemu.model.GpuDriverMetadata
|
||||
import org.dolphinemu.dolphinemu.ui.main.MainPresenter
|
||||
import org.dolphinemu.dolphinemu.utils.*
|
||||
import java.util.*
|
||||
import java.util.function.BooleanSupplier
|
||||
import kotlin.collections.ArrayList
|
||||
import kotlin.math.ceil
|
||||
import kotlin.math.floor
|
||||
@ -2593,7 +2594,7 @@ class SettingsFragmentPresenter(
|
||||
fragmentView.fragmentActivity,
|
||||
R.string.wii_converting,
|
||||
0,
|
||||
{ context.resources.getString(if (f.get()) R.string.wii_convert_success else R.string.wii_convert_failure) }
|
||||
{ context.resources.getString(if (f.getAsBoolean()) R.string.wii_convert_success else R.string.wii_convert_failure) }
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@ import org.dolphinemu.dolphinemu.fragments.AboutDialogFragment
|
||||
import org.dolphinemu.dolphinemu.model.GameFileCache
|
||||
import org.dolphinemu.dolphinemu.services.GameFileCacheManager
|
||||
import org.dolphinemu.dolphinemu.utils.AfterDirectoryInitializationRunner
|
||||
import org.dolphinemu.dolphinemu.utils.BooleanSupplier
|
||||
import java.util.function.BooleanSupplier
|
||||
import org.dolphinemu.dolphinemu.utils.CompletableFuture
|
||||
import org.dolphinemu.dolphinemu.utils.ContentHandler
|
||||
import org.dolphinemu.dolphinemu.utils.DirectoryInitialization
|
||||
|
||||
@ -1,29 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
package org.dolphinemu.dolphinemu.utils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class BiMap<K, V>
|
||||
{
|
||||
|
||||
private Map<K, V> forward = new HashMap<>();
|
||||
private Map<V, K> backward = new HashMap<>();
|
||||
|
||||
public synchronized void add(K key, V value)
|
||||
{
|
||||
forward.put(key, value);
|
||||
backward.put(value, key);
|
||||
}
|
||||
|
||||
public synchronized V getForward(K key)
|
||||
{
|
||||
return forward.get(key);
|
||||
}
|
||||
|
||||
public synchronized K getBackward(V key)
|
||||
{
|
||||
return backward.get(key);
|
||||
}
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
package org.dolphinemu.dolphinemu.utils;
|
||||
|
||||
import androidx.annotation.Keep;
|
||||
|
||||
public interface BooleanSupplier
|
||||
{
|
||||
@Keep
|
||||
boolean get();
|
||||
}
|
||||
@ -2,6 +2,8 @@
|
||||
|
||||
package org.dolphinemu.dolphinemu.utils
|
||||
|
||||
import java.util.function.BooleanSupplier
|
||||
|
||||
object WiiUtils {
|
||||
const val RESULT_SUCCESS = 0
|
||||
const val RESULT_ERROR = 1
|
||||
|
||||
@ -52,7 +52,7 @@ static jmethodID s_network_helper_get_network_prefix_length;
|
||||
static jmethodID s_network_helper_get_network_gateway;
|
||||
|
||||
static jclass s_boolean_supplier_class;
|
||||
static jmethodID s_boolean_supplier_get;
|
||||
static jmethodID s_boolean_supplier_get_as_boolean;
|
||||
|
||||
static jclass s_ar_cheat_class;
|
||||
static jfieldID s_ar_cheat_pointer;
|
||||
@ -310,9 +310,9 @@ jmethodID GetNetworkHelperGetNetworkGateway()
|
||||
return s_network_helper_get_network_gateway;
|
||||
}
|
||||
|
||||
jmethodID GetBooleanSupplierGet()
|
||||
jmethodID GetBooleanSupplierGetAsBoolean()
|
||||
{
|
||||
return s_boolean_supplier_get;
|
||||
return s_boolean_supplier_get_as_boolean;
|
||||
}
|
||||
|
||||
jclass GetARCheatClass()
|
||||
@ -669,10 +669,10 @@ JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved)
|
||||
env->GetStaticMethodID(s_network_helper_class, "GetNetworkGateway", "()I");
|
||||
env->DeleteLocalRef(network_helper_class);
|
||||
|
||||
const jclass boolean_supplier_class =
|
||||
env->FindClass("org/dolphinemu/dolphinemu/utils/BooleanSupplier");
|
||||
const jclass boolean_supplier_class = env->FindClass("java/util/function/BooleanSupplier");
|
||||
s_boolean_supplier_class = reinterpret_cast<jclass>(env->NewGlobalRef(boolean_supplier_class));
|
||||
s_boolean_supplier_get = env->GetMethodID(s_boolean_supplier_class, "get", "()Z");
|
||||
s_boolean_supplier_get_as_boolean =
|
||||
env->GetMethodID(s_boolean_supplier_class, "getAsBoolean", "()Z");
|
||||
env->DeleteLocalRef(boolean_supplier_class);
|
||||
|
||||
const jclass ar_cheat_class =
|
||||
|
||||
@ -51,7 +51,7 @@ jmethodID GetNetworkHelperGetNetworkIpAddress();
|
||||
jmethodID GetNetworkHelperGetNetworkPrefixLength();
|
||||
jmethodID GetNetworkHelperGetNetworkGateway();
|
||||
|
||||
jmethodID GetBooleanSupplierGet();
|
||||
jmethodID GetBooleanSupplierGetAsBoolean();
|
||||
|
||||
jclass GetARCheatClass();
|
||||
jfieldID GetARCheatPointer();
|
||||
|
||||
@ -87,7 +87,7 @@ JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_utils_WiiUtils_importWiiSa
|
||||
{
|
||||
const std::string path = GetJString(env, jFile);
|
||||
const auto can_overwrite = [&] {
|
||||
const jmethodID get = IDCache::GetBooleanSupplierGet();
|
||||
const jmethodID get = IDCache::GetBooleanSupplierGetAsBoolean();
|
||||
return static_cast<bool>(env->CallBooleanMethod(jCanOverwrite, get));
|
||||
};
|
||||
|
||||
|
||||
@ -57,10 +57,19 @@ void DolphinAnalytics::AndroidSetGetValFunc(std::function<std::string(std::strin
|
||||
|
||||
DolphinAnalytics::DolphinAnalytics()
|
||||
{
|
||||
m_last_analytics_enabled = Config::Get(Config::MAIN_ANALYTICS_ENABLED);
|
||||
|
||||
ReloadConfig();
|
||||
MakeBaseBuilder();
|
||||
|
||||
m_config_changed_callback_id = Config::AddConfigChangedCallback([this] { ReloadConfig(); });
|
||||
m_config_changed_callback_id = Config::AddConfigChangedCallback([this] {
|
||||
bool current_analytics_enabled = Config::Get(Config::MAIN_ANALYTICS_ENABLED);
|
||||
if (m_last_analytics_enabled != current_analytics_enabled)
|
||||
{
|
||||
m_last_analytics_enabled = current_analytics_enabled;
|
||||
ReloadConfig();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
DolphinAnalytics::~DolphinAnalytics()
|
||||
@ -80,7 +89,7 @@ void DolphinAnalytics::ReloadConfig()
|
||||
|
||||
// Install the HTTP backend if analytics support is enabled.
|
||||
std::unique_ptr<Common::AnalyticsReportingBackend> new_backend;
|
||||
if (Config::Get(Config::MAIN_ANALYTICS_ENABLED))
|
||||
if (m_last_analytics_enabled)
|
||||
{
|
||||
new_backend = std::make_unique<Common::HttpAnalyticsBackend>(ANALYTICS_ENDPOINT);
|
||||
}
|
||||
|
||||
@ -203,4 +203,5 @@ private:
|
||||
std::mutex m_reporter_mutex;
|
||||
Common::AnalyticsReporter m_reporter;
|
||||
Config::ConfigChangedCallbackID m_config_changed_callback_id{};
|
||||
bool m_last_analytics_enabled = false;
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user