android: Added MAC address setting from QT
Some checks are pending
citra-build / source (push) Waiting to run
citra-build / linux (appimage) (push) Waiting to run
citra-build / linux (fresh) (push) Waiting to run
citra-build / macos (arm64) (push) Waiting to run
citra-build / macos (x86_64) (push) Waiting to run
citra-build / macos-universal (push) Blocked by required conditions
citra-build / windows (msvc) (push) Waiting to run
citra-build / windows (msys2) (push) Waiting to run
citra-build / android (push) Waiting to run
citra-build / ios (push) Waiting to run
citra-format / clang-format (push) Waiting to run
citra-transifex / transifex (push) Waiting to run

This commit is contained in:
PabloMK7 2025-03-13 20:50:37 +00:00 committed by OpenSauce04
parent d5745cae8f
commit 58b2ebd5cd
6 changed files with 45 additions and 2 deletions

View file

@ -1,4 +1,4 @@
// Copyright 2023 Citra Emulator Project
// Copyright Citra Emulator Project / Azahar Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
@ -514,6 +514,18 @@ class SettingsAdapter(
.show()
}
fun onClickRegenerateMAC() {
MaterialAlertDialogBuilder(context)
.setTitle(R.string.regenerate_mac_address)
.setMessage(R.string.regenerate_mac_address_description)
.setPositiveButton(android.R.string.ok) { _: DialogInterface, _: Int ->
SystemSaveGame.regenerateMac()
notifyDataSetChanged()
}
.setNegativeButton(android.R.string.cancel, null)
.show()
}
fun closeDialog() {
if (dialog != null) {
if (clickedPosition != -1) {

View file

@ -391,6 +391,16 @@ class SettingsFragmentPresenter(private val fragmentView: SettingsFragmentView)
{ "0x${SystemSaveGame.getConsoleId().toHexString().uppercase()}" }
)
)
add(
RunnableSetting(
R.string.mac_address,
0,
false,
0,
{ settingsAdapter.onClickRegenerateMAC() },
{ SystemSaveGame.getMac() }
)
)
add(HeaderSetting(R.string.birthday))
val systemBirthdayMonthSetting = object : AbstractShortSetting {

View file

@ -209,6 +209,7 @@ class SystemFilesFragment : Fragment() {
textN3ds = getString(R.string.setup_system_files_o3ds_needed)
colorN3ds = R.color.citra_primary_yellow
buttonO3ds.isChecked = true
buttonN3ds.isEnabled = false
} else {
textO3ds = getString(R.string.setup_system_files_completed)
@ -217,9 +218,11 @@ class SystemFilesFragment : Fragment() {
if (!setupStateCached!![1]) {
textN3ds = getString(R.string.setup_system_files_possible)
colorN3ds = R.color.citra_primary_blue
buttonN3ds.isChecked = true
} else {
textN3ds = getString(R.string.setup_system_files_completed)
colorN3ds = R.color.citra_primary_green
buttonO3ds.isChecked = true
}
}

View file

@ -1,4 +1,4 @@
// Copyright 2023 Citra Emulator Project
// Copyright Citra Emulator Project / Azahar Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
@ -44,6 +44,10 @@ object SystemSaveGame {
external fun getConsoleId(): Long
external fun regenerateConsoleId()
external fun getMac(): String
external fun regenerateMac()
}
enum class BirthdayMonth(val code: Int, val days: Int) {

View file

@ -127,4 +127,15 @@ void Java_org_citra_citra_1emu_utils_SystemSaveGame_regenerateConsoleId(
changes_pending = true;
}
jstring Java_org_citra_citra_1emu_utils_SystemSaveGame_getMac(JNIEnv* env,
[[maybe_unused]] jobject obj) {
return ToJString(env, cfg->GetMacAddress());
}
void Java_org_citra_citra_1emu_utils_SystemSaveGame_regenerateMac(JNIEnv* env,
[[maybe_unused]] jobject obj) {
cfg->GetMacAddress() = Service::CFG::GenerateRandomMAC();
cfg->SaveMacAddress();
}
} // extern "C"

View file

@ -782,4 +782,7 @@
<string name="enable_required_online_lle_modules_desc">Enables the LLE modules required for online multiplayer, eShop access, etc.</string>
<string name="emulation_settings">Emulation Settings</string>
<string name="profile_settings">Profile Settings</string>
<string name="mac_address">MAC Address</string>
<string name="regenerate_mac_address">Regenerate MAC Address</string>
<string name="regenerate_mac_address_description">This will replace your current MAC address with a new one. It is not recommended to do this if you got the MAC address from your real console using the setup tool. Continue?</string>
</resources>