early-access version 3965
This commit is contained in:
parent
03533bb00b
commit
5989c4e9ee
@ -1,7 +1,7 @@
|
||||
yuzu emulator early access
|
||||
=============
|
||||
|
||||
This is the source code for early-access 3963.
|
||||
This is the source code for early-access 3965.
|
||||
|
||||
## Legal Notice
|
||||
|
||||
|
@ -252,7 +252,7 @@ object NativeLibrary {
|
||||
|
||||
external fun reloadKeys(): Boolean
|
||||
|
||||
external fun initializeSystem()
|
||||
external fun initializeSystem(reload: Boolean)
|
||||
|
||||
external fun defaultCPUCore(): Int
|
||||
|
||||
|
@ -11,6 +11,7 @@ import java.io.File
|
||||
import org.yuzu.yuzu_emu.utils.DirectoryInitialization
|
||||
import org.yuzu.yuzu_emu.utils.DocumentsTree
|
||||
import org.yuzu.yuzu_emu.utils.GpuDriverHelper
|
||||
import org.yuzu.yuzu_emu.utils.Log
|
||||
|
||||
fun Context.getPublicFilesDir(): File = getExternalFilesDir(null) ?: filesDir
|
||||
|
||||
@ -49,6 +50,7 @@ class YuzuApplication : Application() {
|
||||
DirectoryInitialization.start()
|
||||
GpuDriverHelper.initializeDriverParameters()
|
||||
NativeLibrary.logDeviceInfo()
|
||||
Log.logDeviceInfo()
|
||||
|
||||
createNotificationChannels()
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener {
|
||||
|
||||
val preferences = PreferenceManager.getDefaultSharedPreferences(YuzuApplication.appContext)
|
||||
if (!preferences.getBoolean(Settings.PREF_MEMORY_WARNING_SHOWN, false)) {
|
||||
if (MemoryUtil.isLessThan(MemoryUtil.REQUIRED_MEMORY, MemoryUtil.Gb)) {
|
||||
if (MemoryUtil.isLessThan(MemoryUtil.REQUIRED_MEMORY, MemoryUtil.totalMemory)) {
|
||||
Toast.makeText(
|
||||
this,
|
||||
getString(
|
||||
|
@ -403,7 +403,7 @@ class MainActivity : AppCompatActivity(), ThemeProvider {
|
||||
} else {
|
||||
firmwarePath.deleteRecursively()
|
||||
cacheFirmwareDir.copyRecursively(firmwarePath, true)
|
||||
NativeLibrary.initializeSystem()
|
||||
NativeLibrary.initializeSystem(true)
|
||||
getString(R.string.save_file_imported_success)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
@ -649,7 +649,7 @@ class MainActivity : AppCompatActivity(), ThemeProvider {
|
||||
}
|
||||
|
||||
// Reinitialize relevant data
|
||||
NativeLibrary.initializeSystem()
|
||||
NativeLibrary.initializeSystem(true)
|
||||
gamesViewModel.reloadGames(false)
|
||||
|
||||
return@newInstance getString(R.string.user_data_import_success)
|
||||
|
@ -15,7 +15,7 @@ object DirectoryInitialization {
|
||||
fun start() {
|
||||
if (!areDirectoriesReady) {
|
||||
initializeInternalStorage()
|
||||
NativeLibrary.initializeSystem()
|
||||
NativeLibrary.initializeSystem(false)
|
||||
areDirectoriesReady = true
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,8 @@
|
||||
|
||||
package org.yuzu.yuzu_emu.utils
|
||||
|
||||
import android.os.Build
|
||||
|
||||
object Log {
|
||||
// Tracks whether we should share the old log or the current log
|
||||
var gameLaunched = false
|
||||
@ -16,4 +18,14 @@ object Log {
|
||||
external fun error(message: String)
|
||||
|
||||
external fun critical(message: String)
|
||||
|
||||
fun logDeviceInfo() {
|
||||
info("Device Manufacturer - ${Build.MANUFACTURER}")
|
||||
info("Device Model - ${Build.MODEL}")
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.R) {
|
||||
info("SoC Manufacturer - ${Build.SOC_MANUFACTURER}")
|
||||
info("SoC Model - ${Build.SOC_MODEL}")
|
||||
}
|
||||
info("Total System Memory - ${MemoryUtil.getDeviceRAM()}")
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ object MemoryUtil {
|
||||
const val Pb = Tb * 1024
|
||||
const val Eb = Pb * 1024
|
||||
|
||||
private fun bytesToSizeUnit(size: Float): String =
|
||||
private fun bytesToSizeUnit(size: Float, roundUp: Boolean = false): String =
|
||||
when {
|
||||
size < Kb -> {
|
||||
context.getString(
|
||||
@ -39,63 +39,59 @@ object MemoryUtil {
|
||||
size < Mb -> {
|
||||
context.getString(
|
||||
R.string.memory_formatted,
|
||||
(size / Kb).hundredths,
|
||||
if (roundUp) ceil(size / Kb) else (size / Kb).hundredths,
|
||||
context.getString(R.string.memory_kilobyte)
|
||||
)
|
||||
}
|
||||
size < Gb -> {
|
||||
context.getString(
|
||||
R.string.memory_formatted,
|
||||
(size / Mb).hundredths,
|
||||
if (roundUp) ceil(size / Mb) else (size / Mb).hundredths,
|
||||
context.getString(R.string.memory_megabyte)
|
||||
)
|
||||
}
|
||||
size < Tb -> {
|
||||
context.getString(
|
||||
R.string.memory_formatted,
|
||||
(size / Gb).hundredths,
|
||||
if (roundUp) ceil(size / Gb) else (size / Gb).hundredths,
|
||||
context.getString(R.string.memory_gigabyte)
|
||||
)
|
||||
}
|
||||
size < Pb -> {
|
||||
context.getString(
|
||||
R.string.memory_formatted,
|
||||
(size / Tb).hundredths,
|
||||
if (roundUp) ceil(size / Tb) else (size / Tb).hundredths,
|
||||
context.getString(R.string.memory_terabyte)
|
||||
)
|
||||
}
|
||||
size < Eb -> {
|
||||
context.getString(
|
||||
R.string.memory_formatted,
|
||||
(size / Pb).hundredths,
|
||||
if (roundUp) ceil(size / Pb) else (size / Pb).hundredths,
|
||||
context.getString(R.string.memory_petabyte)
|
||||
)
|
||||
}
|
||||
else -> {
|
||||
context.getString(
|
||||
R.string.memory_formatted,
|
||||
(size / Eb).hundredths,
|
||||
if (roundUp) ceil(size / Eb) else (size / Eb).hundredths,
|
||||
context.getString(R.string.memory_exabyte)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// Devices are unlikely to have 0.5GB increments of memory so we'll just round up to account for
|
||||
// the potential error created by memInfo.totalMem
|
||||
private val totalMemory: Float
|
||||
val totalMemory: Float
|
||||
get() {
|
||||
val memInfo = ActivityManager.MemoryInfo()
|
||||
with(context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager) {
|
||||
getMemoryInfo(memInfo)
|
||||
}
|
||||
|
||||
return ceil(
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
|
||||
memInfo.advertisedMem.toFloat()
|
||||
} else {
|
||||
memInfo.totalMem.toFloat()
|
||||
}
|
||||
)
|
||||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
|
||||
memInfo.advertisedMem.toFloat()
|
||||
} else {
|
||||
memInfo.totalMem.toFloat()
|
||||
}
|
||||
}
|
||||
|
||||
fun isLessThan(minimum: Int, size: Float): Boolean =
|
||||
@ -109,5 +105,7 @@ object MemoryUtil {
|
||||
else -> totalMemory < Kb && totalMemory < minimum
|
||||
}
|
||||
|
||||
fun getDeviceRAM(): String = bytesToSizeUnit(totalMemory)
|
||||
// Devices are unlikely to have 0.5GB increments of memory so we'll just round up to account for
|
||||
// the potential error created by memInfo.totalMem
|
||||
fun getDeviceRAM(): String = bytesToSizeUnit(totalMemory, true)
|
||||
}
|
||||
|
@ -247,11 +247,13 @@ void EmulationSession::ConfigureFilesystemProvider(const std::string& filepath)
|
||||
}
|
||||
}
|
||||
|
||||
void EmulationSession::InitializeSystem() {
|
||||
// Initialize logging system
|
||||
Common::Log::Initialize();
|
||||
Common::Log::SetColorConsoleBackendEnabled(true);
|
||||
Common::Log::Start();
|
||||
void EmulationSession::InitializeSystem(bool reload) {
|
||||
if (!reload) {
|
||||
// Initialize logging system
|
||||
Common::Log::Initialize();
|
||||
Common::Log::SetColorConsoleBackendEnabled(true);
|
||||
Common::Log::Start();
|
||||
}
|
||||
|
||||
// Initialize filesystem.
|
||||
m_system.SetFilesystem(m_vfs);
|
||||
@ -667,12 +669,15 @@ void Java_org_yuzu_yuzu_1emu_NativeLibrary_onTouchReleased(JNIEnv* env, jclass c
|
||||
}
|
||||
}
|
||||
|
||||
void Java_org_yuzu_yuzu_1emu_NativeLibrary_initializeSystem(JNIEnv* env, jclass clazz) {
|
||||
void Java_org_yuzu_yuzu_1emu_NativeLibrary_initializeSystem(JNIEnv* env, jclass clazz,
|
||||
jboolean reload) {
|
||||
// Create the default config.ini.
|
||||
Config{};
|
||||
// Initialize the emulated system.
|
||||
EmulationSession::GetInstance().System().Initialize();
|
||||
EmulationSession::GetInstance().InitializeSystem();
|
||||
if (!reload) {
|
||||
EmulationSession::GetInstance().System().Initialize();
|
||||
}
|
||||
EmulationSession::GetInstance().InitializeSystem(reload);
|
||||
}
|
||||
|
||||
jint Java_org_yuzu_yuzu_1emu_NativeLibrary_defaultCPUCore(JNIEnv* env, jclass clazz) {
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
|
||||
const Core::PerfStatsResults& PerfStats() const;
|
||||
void ConfigureFilesystemProvider(const std::string& filepath);
|
||||
void InitializeSystem();
|
||||
void InitializeSystem(bool reload);
|
||||
Core::SystemResultStatus InitializeEmulation(const std::string& filepath);
|
||||
|
||||
bool IsHandheldOnly();
|
||||
|
@ -1,6 +1,9 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <sys/system_properties.h>
|
||||
#endif
|
||||
#include "common/arm64/native_clock.h"
|
||||
|
||||
namespace Common::Arm64 {
|
||||
@ -65,7 +68,23 @@ bool NativeClock::IsNative() const {
|
||||
|
||||
u64 NativeClock::GetHostCNTFRQ() {
|
||||
u64 cntfrq_el0 = 0;
|
||||
asm("mrs %[cntfrq_el0], cntfrq_el0" : [cntfrq_el0] "=r"(cntfrq_el0));
|
||||
std::string_view board{""};
|
||||
#ifdef ANDROID
|
||||
char buffer[PROP_VALUE_MAX];
|
||||
int len{__system_property_get("ro.product.board", buffer)};
|
||||
board = std::string_view(buffer, static_cast<size_t>(len));
|
||||
#endif
|
||||
if (board == "s5e9925") { // Exynos 2200
|
||||
cntfrq_el0 = 25600000;
|
||||
} else if (board == "exynos2100") { // Exynos 2100
|
||||
cntfrq_el0 = 26000000;
|
||||
} else if (board == "exynos9810") { // Exynos 9810
|
||||
cntfrq_el0 = 26000000;
|
||||
} else if (board == "s5e8825") { // Exynos 1280
|
||||
cntfrq_el0 = 26000000;
|
||||
} else {
|
||||
asm("mrs %[cntfrq_el0], cntfrq_el0" : [cntfrq_el0] "=r"(cntfrq_el0));
|
||||
}
|
||||
return cntfrq_el0;
|
||||
}
|
||||
|
||||
|
@ -1353,7 +1353,7 @@ void Hid::IsUnintendedHomeButtonInputProtectionEnabled(HLERequestContext& ctx) {
|
||||
void Hid::EnableUnintendedHomeButtonInputProtection(HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp{ctx};
|
||||
struct Parameters {
|
||||
bool unintended_home_button_input_protection;
|
||||
bool is_enabled;
|
||||
INSERT_PADDING_BYTES_NOINIT(3);
|
||||
Core::HID::NpadIdType npad_id;
|
||||
u64 applet_resource_user_id;
|
||||
@ -1364,13 +1364,11 @@ void Hid::EnableUnintendedHomeButtonInputProtection(HLERequestContext& ctx) {
|
||||
|
||||
auto& controller = GetAppletResource()->GetController<Controller_NPad>(HidController::NPad);
|
||||
const auto result = controller.SetUnintendedHomeButtonInputProtectionEnabled(
|
||||
parameters.unintended_home_button_input_protection, parameters.npad_id);
|
||||
parameters.is_enabled, parameters.npad_id);
|
||||
|
||||
LOG_WARNING(Service_HID,
|
||||
"(STUBBED) called, unintended_home_button_input_protection={}, npad_id={},"
|
||||
"applet_resource_user_id={}",
|
||||
parameters.unintended_home_button_input_protection, parameters.npad_id,
|
||||
parameters.applet_resource_user_id);
|
||||
LOG_DEBUG(Service_HID,
|
||||
"(STUBBED) called, is_enabled={}, npad_id={}, applet_resource_user_id={}",
|
||||
parameters.is_enabled, parameters.npad_id, parameters.applet_resource_user_id);
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
rb.Push(result);
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include "common/alignment.h"
|
||||
#include "core/memory.h"
|
||||
#include "video_core/control/channel_state.h"
|
||||
#include "video_core/host1x/host1x.h"
|
||||
#include "video_core/memory_manager.h"
|
||||
#include "video_core/renderer_null/null_rasterizer.h"
|
||||
@ -99,8 +100,14 @@ bool RasterizerNull::AccelerateDisplay(const Tegra::FramebufferConfig& config,
|
||||
}
|
||||
void RasterizerNull::LoadDiskResources(u64 title_id, std::stop_token stop_loading,
|
||||
const VideoCore::DiskResourceLoadCallback& callback) {}
|
||||
void RasterizerNull::InitializeChannel(Tegra::Control::ChannelState& channel) {}
|
||||
void RasterizerNull::BindChannel(Tegra::Control::ChannelState& channel) {}
|
||||
void RasterizerNull::ReleaseChannel(s32 channel_id) {}
|
||||
void RasterizerNull::InitializeChannel(Tegra::Control::ChannelState& channel) {
|
||||
CreateChannel(channel);
|
||||
}
|
||||
void RasterizerNull::BindChannel(Tegra::Control::ChannelState& channel) {
|
||||
BindToChannel(channel.bind_id);
|
||||
}
|
||||
void RasterizerNull::ReleaseChannel(s32 channel_id) {
|
||||
EraseChannel(channel_id);
|
||||
}
|
||||
|
||||
} // namespace Null
|
||||
|
Loading…
Reference in New Issue
Block a user