Compare commits

...

3 Commits

Author SHA1 Message Date
lightningterror
3afa9ca403 VMManager: Add available ram info in log. 2025-04-19 13:41:41 +02:00
lightningterror
842190e15e CDVD: Adjust ram requirements when precaching on linux/Mac. 2025-04-19 13:41:41 +02:00
PCSX2 Bot
717775d9ab [ci skip] Qt: Update Base Translation. 2025-04-19 05:39:57 +02:00
6 changed files with 41 additions and 26 deletions

View File

@@ -50,6 +50,27 @@ u64 GetPhysicalMemory()
return getmem;
}
u64 GetAvailablePhysicalMemory()
{
const mach_port_t host_port = mach_host_self();
vm_size_t page_size;
if (host_page_size(host_port, &page_size) != KERN_SUCCESS)
return 0;
vm_statistics64_data_t vm_stat;
mach_msg_type_number_t host_size = sizeof(vm_statistics64_data_t) / sizeof(integer_t);
if (host_statistics64(host_port, HOST_VM_INFO, reinterpret_cast<host_info64_t>(&vm_stat), &host_size) != KERN_SUCCESS)
return 0;
const u64 free_pages = static_cast<u64>(vm_stat.free_count);
const u64 inactive_pages = static_cast<u64>(vm_stat.inactive_count);
const u64 get_available_mem = (free_pages + inactive_pages) * page_size;
return get_available_mem;
}
static mach_timebase_info_data_t s_timebase_info;
static const u64 tickfreq = []() {
if (mach_timebase_info(&s_timebase_info) != KERN_SUCCESS)

View File

@@ -181,10 +181,7 @@ private:
extern u64 GetTickFrequency();
extern u64 GetCPUTicks();
extern u64 GetPhysicalMemory();
#ifdef _WIN32
// TODO: Someone do linux/mac.
extern u64 GetAvailablePhysicalMemory();
#endif
/// Spin for a short period of time (call while spinning waiting for a lock)
/// Returns the approximate number of ns that passed
extern u32 ShortSpin();

View File

@@ -15,6 +15,7 @@
#include <dbus/dbus.h>
#include <spawn.h>
#include <sys/sysinfo.h>
#include <sys/time.h>
#include <sys/wait.h>
#include <unistd.h>
@@ -40,6 +41,15 @@ u64 GetPhysicalMemory()
return pages * getpagesize();
}
u64 GetAvailablePhysicalMemory()
{
struct sysinfo info;
if (sysinfo(&info) != 0)
return 0;
return static_cast<u64>(info.freeram) * info.mem_unit;
}
u64 GetTickFrequency()
{
return 1000000000; // unix measures in nanoseconds

View File

@@ -10879,24 +10879,24 @@ Do you want to load this save and continue?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../pcsx2/GS/Renderers/Vulkan/GSDeviceVK.cpp" line="2687"/>
<location filename="../../pcsx2/GS/Renderers/Vulkan/GSDeviceVK.cpp" line="2688"/>
<source>Stencil buffers and texture barriers are both unavailable, this will break some graphical effects.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../pcsx2/GS/Renderers/Vulkan/GSDeviceVK.cpp" line="5065"/>
<location filename="../../pcsx2/GS/Renderers/Vulkan/GSDeviceVK.cpp" line="5060"/>
<source>Spin GPU During Readbacks is enabled, but calibrated timestamps are unavailable. This might be really slow.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../pcsx2/GS/Renderers/DX11/D3D.cpp" line="391"/>
<location filename="../../pcsx2/GS/Renderers/DX11/D3D.cpp" line="392"/>
<source>Your system has the &quot;OpenCL, OpenGL, and Vulkan Compatibility Pack&quot; installed.
This Vulkan driver crashes PCSX2 on some GPUs.
To use the Vulkan renderer, you should remove this app package.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../pcsx2/GS/Renderers/DX11/D3D.cpp" line="410"/>
<location filename="../../pcsx2/GS/Renderers/DX11/D3D.cpp" line="411"/>
<source>The Vulkan renderer was automatically selected, but no compatible devices were found.
You should update all graphics drivers in your system, including any integrated GPUs
to use the Vulkan renderer.</source>
@@ -19266,12 +19266,12 @@ Ejecting {3} and replacing it with {2}.</source>
<context>
<name>SDLInputSource</name>
<message>
<location filename="../../pcsx2/Input/SDLInputSource.cpp" line="701"/>
<location filename="../../pcsx2/Input/SDLInputSource.cpp" line="767"/>
<source>SDL3 Migration</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../pcsx2/Input/SDLInputSource.cpp" line="702"/>
<location filename="../../pcsx2/Input/SDLInputSource.cpp" line="768"/>
<source>As part of our upgrade to SDL3, we&apos;ve had to migrate your binds
Your controller did not match the Xbox layout and may need rebinding
Please verify your controller settings and amend if required</source>

View File

@@ -266,12 +266,11 @@ bool ThreadedFileReader::Precache2(ProgressCallback* progress, Error* error)
bool ThreadedFileReader::CheckAvailableMemoryForPrecaching(u64 required_size, Error* error)
{
#ifdef _WIN32
// We want to check available physical memory instead of total.
const u64 memory_available = GetAvailablePhysicalMemory();
// Reserve 2GB of available memory for headroom.
constexpr u64 memory_reserve = 2147483648;
const u64 max_precache_size = std::max(0LL, static_cast<s64>(memory_available - memory_reserve));
const u64 max_precache_size = std::max(s64{0}, static_cast<s64>(memory_available - memory_reserve));
if (required_size > max_precache_size)
{
@@ -280,20 +279,6 @@ bool ThreadedFileReader::CheckAvailableMemoryForPrecaching(u64 required_size, Er
(required_size + memory_reserve) / _1gb);
return false;
}
#else
// Don't allow precaching to use more than 50% of system memory.
// Hopefully nobody's running 2-4GB potatoes anymore....
const u64 memory_size = GetPhysicalMemory();
const u64 max_precache_size = memory_size / 2;
if (required_size > max_precache_size)
{
Error::SetStringFmt(error,
TRANSLATE_FS("CDVD", "Required memory ({}GB) is the above the maximum allowed ({}GB)."),
required_size / _1gb, max_precache_size / _1gb);
return false;
}
#endif
return true;
}

View File

@@ -2504,8 +2504,10 @@ void VMManager::LogCPUCapabilities()
Console.WriteLnFmt(
" Operating System = {}\n"
" Physical RAM = {} MB",
" Available RAM = {} MB\n"
" Physical RAM = {} MB\n",
GetOSVersionString(),
GetAvailablePhysicalMemory() / _1mb,
GetPhysicalMemory() / _1mb);
Console.WriteLnFmt(" Processor = {}", cpuinfo_get_package(0)->name);