mirror of
https://github.com/PCSX2/pcsx2.git
synced 2026-01-31 01:15:24 +01:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
333c7ef61b | ||
|
|
77d5a04aa4 | ||
|
|
d3effdb176 | ||
|
|
d7e1350b95 | ||
|
|
14ac653e45 | ||
|
|
a5e4274cd2 | ||
|
|
16b1095a7b |
2
.github/workflows/windows_build_matrix.yml
vendored
2
.github/workflows/windows_build_matrix.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
||||
lint_vs_proj_files:
|
||||
name: Lint VS Project Files
|
||||
if: github.repository != 'PCSX2/pcsx2' || github.event_name == 'pull_request'
|
||||
runs-on: windows-2019
|
||||
runs-on: windows-2025
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
28
.github/workflows/windows_build_qt.yml
vendored
28
.github/workflows/windows_build_qt.yml
vendored
@@ -12,7 +12,7 @@ on:
|
||||
os:
|
||||
required: false
|
||||
type: string
|
||||
default: windows-2022
|
||||
default: windows-2025
|
||||
platform:
|
||||
required: false
|
||||
type: string
|
||||
@@ -55,13 +55,31 @@ jobs:
|
||||
POWERSHELL_TELEMETRY_OPTOUT: 1
|
||||
|
||||
steps:
|
||||
- name: Tempfix Clang
|
||||
if: inputs.configuration == 'CMake'
|
||||
run: choco uninstall llvm
|
||||
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Configure MSBuild Clang Version
|
||||
if: inputs.configuration != 'CMake'
|
||||
shell: pwsh
|
||||
run: |
|
||||
[string[]] $clang_cl = &clang-cl.exe --version
|
||||
|
||||
$version = [Regex]::Match($clang_cl[0], "(\d+\.\d+\.\d+)")
|
||||
$path = $clang_cl[3].TrimStart("InstalledDir: ").TrimEnd("\bin")
|
||||
|
||||
$output = @"
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<LLVMInstallDir>$path</LLVMInstallDir>
|
||||
<LLVMToolsVersion>$version</LLVMToolsVersion>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
"@
|
||||
|
||||
Write-Host $output
|
||||
|
||||
$output | Out-File Directory.build.props
|
||||
|
||||
# actions/checkout elides tags, fetch them primarily for releases
|
||||
- name: Fetch Tags
|
||||
if: ${{ inputs.fetchTags }}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// SPDX-FileCopyrightText: 2002-2024 PCSX2 Dev Team
|
||||
// SPDX-FileCopyrightText: 2002-2025 PCSX2 Dev Team
|
||||
// SPDX-License-Identifier: GPL-3.0+
|
||||
|
||||
#include "common/Pcsx2Types.h"
|
||||
@@ -22,6 +22,8 @@
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
#include <dbus/dbus.h>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
// Returns 0 on failure (not supported by the operating system).
|
||||
u64 GetPhysicalMemory()
|
||||
@@ -101,6 +103,7 @@ static bool SetScreensaverInhibitDBus(const bool inhibit_requested, const char*
|
||||
DBusMessage* message = nullptr;
|
||||
DBusMessage* response = nullptr;
|
||||
DBusMessageIter message_itr;
|
||||
char* desktop_session = nullptr;
|
||||
|
||||
ScopedGuard cleanup = [&]() {
|
||||
if (dbus_error_is_set(&error_dbus))
|
||||
@@ -122,7 +125,17 @@ static bool SetScreensaverInhibitDBus(const bool inhibit_requested, const char*
|
||||
s_cookie = 0;
|
||||
s_comparison_connection = connection;
|
||||
}
|
||||
message = dbus_message_new_method_call("org.freedesktop.ScreenSaver", "/org/freedesktop/ScreenSaver", "org.freedesktop.ScreenSaver", bus_method);
|
||||
|
||||
desktop_session = std::getenv("DESKTOP_SESSION");
|
||||
if (desktop_session && std::strncmp(desktop_session, "mate", 4) == 0)
|
||||
{
|
||||
message = dbus_message_new_method_call("org.mate.ScreenSaver", "/org/mate/ScreenSaver", "org.mate.ScreenSaver", bus_method);
|
||||
}
|
||||
else
|
||||
{
|
||||
message = dbus_message_new_method_call("org.freedesktop.ScreenSaver", "/org/freedesktop/ScreenSaver", "org.freedesktop.ScreenSaver", bus_method);
|
||||
}
|
||||
|
||||
if (!message)
|
||||
return false;
|
||||
// Initialize an append iterator for the message, gets freed with the message.
|
||||
|
||||
@@ -18195,12 +18195,12 @@ Ejecting {3} and replacing it with {2}.</source>
|
||||
<context>
|
||||
<name>Patch</name>
|
||||
<message>
|
||||
<location filename="../../pcsx2/Patch.cpp" line="350"/>
|
||||
<location filename="../../pcsx2/Patch.cpp" line="352"/>
|
||||
<source>Failed to open {}. Built-in game patches are not available.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<location filename="../../pcsx2/Patch.cpp" line="726"/>
|
||||
<location filename="../../pcsx2/Patch.cpp" line="760"/>
|
||||
<source>%n GameDB patches are active.</source>
|
||||
<comment>OSD Message</comment>
|
||||
<translation type="unfinished">
|
||||
@@ -18209,7 +18209,7 @@ Ejecting {3} and replacing it with {2}.</source>
|
||||
</translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<location filename="../../pcsx2/Patch.cpp" line="733"/>
|
||||
<location filename="../../pcsx2/Patch.cpp" line="767"/>
|
||||
<source>%n game patches are active.</source>
|
||||
<comment>OSD Message</comment>
|
||||
<translation type="unfinished">
|
||||
@@ -18218,7 +18218,7 @@ Ejecting {3} and replacing it with {2}.</source>
|
||||
</translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<location filename="../../pcsx2/Patch.cpp" line="740"/>
|
||||
<location filename="../../pcsx2/Patch.cpp" line="774"/>
|
||||
<source>%n cheat patches are active.</source>
|
||||
<comment>OSD Message</comment>
|
||||
<translation type="unfinished">
|
||||
@@ -18227,7 +18227,7 @@ Ejecting {3} and replacing it with {2}.</source>
|
||||
</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../pcsx2/Patch.cpp" line="755"/>
|
||||
<location filename="../../pcsx2/Patch.cpp" line="789"/>
|
||||
<source>No cheats or patches (widescreen, compatibility or others) are found / enabled.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@@ -21827,177 +21827,177 @@ Error was: {}</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3054"/>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3055"/>
|
||||
<source>Cheats have been disabled due to achievements hardcore mode.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3107"/>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3108"/>
|
||||
<source>Fast CDVD is enabled, this may break games.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3111"/>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3112"/>
|
||||
<source>Cycle rate/skip is not at default, this may crash or make games run too slow.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3121"/>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3122"/>
|
||||
<source>Upscale multiplier is below native, this will break rendering.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3161"/>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3162"/>
|
||||
<source>Mipmapping is disabled. This may break rendering in some games.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3170"/>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3171"/>
|
||||
<source>Renderer is not set to Automatic. This may cause performance problems and graphical issues.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3176"/>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3177"/>
|
||||
<source>Texture filtering is not set to Bilinear (PS2). This will break rendering in some games.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3639"/>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3640"/>
|
||||
<source>No Game Running</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3126"/>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3127"/>
|
||||
<source>Trilinear filtering is not set to automatic. This may break rendering in some games.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3131"/>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3132"/>
|
||||
<source>Blending Accuracy is below Basic, this may break effects in some games.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3136"/>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3137"/>
|
||||
<source>Hardware Download Mode is not set to Accurate, this may break rendering in some games.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3182"/>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3183"/>
|
||||
<source>EE FPU Round Mode is not set to default, this may break some games.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3188"/>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3189"/>
|
||||
<source>EE FPU Clamp Mode is not set to default, this may break some games.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3193"/>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3194"/>
|
||||
<source>VU0 Round Mode is not set to default, this may break some games.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3198"/>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3199"/>
|
||||
<source>VU1 Round Mode is not set to default, this may break some games.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3205"/>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3206"/>
|
||||
<source>VU Clamp Mode is not set to default, this may break some games.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3210"/>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3211"/>
|
||||
<source>128MB RAM is enabled. Compatibility with some games may be affected.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3215"/>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3216"/>
|
||||
<source>Game Fixes are not enabled. Compatibility with some games may be affected.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3220"/>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3221"/>
|
||||
<source>Compatibility Patches are not enabled. Compatibility with some games may be affected.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3224"/>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3225"/>
|
||||
<source>Frame rate for NTSC is not default. This may break some games.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3226"/>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3227"/>
|
||||
<source>Frame rate for PAL is not default. This may break some games.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3245"/>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3246"/>
|
||||
<source>EE Recompiler is not enabled, this will significantly reduce performance.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3250"/>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3251"/>
|
||||
<source>VU0 Recompiler is not enabled, this will significantly reduce performance.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3255"/>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3256"/>
|
||||
<source>VU1 Recompiler is not enabled, this will significantly reduce performance.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3260"/>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3261"/>
|
||||
<source>IOP Recompiler is not enabled, this will significantly reduce performance.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3265"/>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3266"/>
|
||||
<source>EE Cache is enabled, this will significantly reduce performance.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3270"/>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3271"/>
|
||||
<source>EE Wait Loop Detection is not enabled, this may reduce performance.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3275"/>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3276"/>
|
||||
<source>INTC Spin Detection is not enabled, this may reduce performance.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3278"/>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3279"/>
|
||||
<source>Fastmem is not enabled, this will reduce performance.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3282"/>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3283"/>
|
||||
<source>Instant VU1 is disabled, this may reduce performance.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3287"/>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3288"/>
|
||||
<source>mVU Flag Hack is not enabled, this may reduce performance.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3141"/>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3142"/>
|
||||
<source>GPU Palette Conversion is enabled, this may reduce performance.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3146"/>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3147"/>
|
||||
<source>Texture Preloading is not Full, this may reduce performance.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3151"/>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3152"/>
|
||||
<source>Estimate texture region is enabled, this may reduce performance.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3156"/>
|
||||
<location filename="../../pcsx2/VMManager.cpp" line="3157"/>
|
||||
<source>Texture dumping is enabled, this will continually dump textures to disk.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
||||
@@ -23,10 +23,11 @@ namespace
|
||||
// When this happens, the cache still fills with the data and when it gets evicted the data is lost.
|
||||
// We don't emulate memory access on a logic level, so we need to ensure that we don't try to load/store to a non-existant physical address.
|
||||
// This fixes the Find My Own Way demo.
|
||||
bool validPFN = true;
|
||||
|
||||
// The lower parts of a cache tags structure is as follows:
|
||||
// 31 - 12: The physical address cache tag.
|
||||
// 11 - 7: Unused.
|
||||
// 11: Used by PCSX2 to indicate if the physical address is valid.
|
||||
// 10 - 7: Unused.
|
||||
// 6: Dirty flag.
|
||||
// 5: Valid flag.
|
||||
// 4: LRF flag - least recently filled flag.
|
||||
@@ -39,7 +40,8 @@ namespace
|
||||
VALID_FLAG = 0x20,
|
||||
LRF_FLAG = 0x10,
|
||||
LOCK_FLAG = 0x8,
|
||||
ALL_FLAGS = 0xFFF
|
||||
ALL_FLAGS = 0x7FF,
|
||||
ALL_BITS = 0xFFF
|
||||
};
|
||||
|
||||
int flags() const
|
||||
@@ -65,23 +67,36 @@ namespace
|
||||
void clearLocked() { rawValue &= ~LOCK_FLAG; }
|
||||
void toggleLRF() { rawValue ^= LRF_FLAG; }
|
||||
|
||||
uptr addr() const { return rawValue & ~ALL_FLAGS; }
|
||||
uptr addr() const { return rawValue & ~ALL_BITS; }
|
||||
|
||||
void setAddr(uptr addr)
|
||||
{
|
||||
rawValue &= ALL_FLAGS;
|
||||
rawValue |= (addr & ~ALL_FLAGS);
|
||||
rawValue &= ALL_BITS;
|
||||
rawValue |= (addr & ~ALL_BITS);
|
||||
}
|
||||
|
||||
bool matches(uptr other) const
|
||||
{
|
||||
return isValid() && addr() == (other & ~ALL_FLAGS);
|
||||
return isValid() && addr() == (other & ~ALL_BITS);
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
rawValue &= LRF_FLAG;
|
||||
}
|
||||
|
||||
constexpr bool isValidPFN() const
|
||||
{
|
||||
return rawValue & 0x800;
|
||||
}
|
||||
|
||||
constexpr void setValidPFN(bool valid)
|
||||
{
|
||||
if (valid)
|
||||
rawValue |= 0x800;
|
||||
else
|
||||
rawValue &= ~0x800;
|
||||
}
|
||||
};
|
||||
|
||||
struct CacheLine
|
||||
@@ -103,7 +118,7 @@ namespace
|
||||
uptr target = addr();
|
||||
|
||||
CACHE_LOG("Write back at %zx", target);
|
||||
if (tag.validPFN)
|
||||
if (tag.isValidPFN())
|
||||
*reinterpret_cast<CacheData*>(target) = data;
|
||||
tag.clearDirty();
|
||||
}
|
||||
@@ -113,7 +128,7 @@ namespace
|
||||
pxAssertMsg(!tag.isDirtyAndValid(), "Loaded a value into cache without writing back the old one!");
|
||||
|
||||
tag.setAddr(ppf);
|
||||
if (!tag.validPFN)
|
||||
if (!tag.isValidPFN())
|
||||
{
|
||||
// Reading from invalid physical addresses seems to return 0 on hardware
|
||||
std::memset(&data, 0, sizeof(data));
|
||||
@@ -238,7 +253,7 @@ static int getFreeCache(u32 mem, int* way, bool validPFN)
|
||||
|
||||
CacheLine line = cache.lineAt(setIdx, newWay);
|
||||
line.writeBackIfNeeded();
|
||||
line.tag.validPFN = validPFN;
|
||||
line.tag.setValidPFN(validPFN);
|
||||
line.load(ppf);
|
||||
line.tag.toggleLRF();
|
||||
}
|
||||
|
||||
@@ -157,6 +157,7 @@ class FileMemoryCard
|
||||
{
|
||||
protected:
|
||||
std::FILE* m_file[8] = {};
|
||||
s64 m_fileSize[8] = {};
|
||||
std::string m_filenames[8] = {};
|
||||
std::vector<u8> m_currentdata;
|
||||
u64 m_chksum[8] = {};
|
||||
@@ -246,7 +247,13 @@ std::string FileMcd_GetDefaultName(uint slot)
|
||||
return StringUtil::StdStringFromFormat("Mcd%03u.ps2", slot + 1);
|
||||
}
|
||||
|
||||
FileMemoryCard::FileMemoryCard() = default;
|
||||
FileMemoryCard::FileMemoryCard()
|
||||
{
|
||||
for (u8 slot = 0; slot < 8; slot++)
|
||||
{
|
||||
m_fileSize[slot] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
FileMemoryCard::~FileMemoryCard() = default;
|
||||
|
||||
@@ -314,12 +321,14 @@ void FileMemoryCard::Open()
|
||||
}
|
||||
else // Load checksum
|
||||
{
|
||||
m_fileSize[slot] = FileSystem::FSize64(m_file[slot]);
|
||||
|
||||
Console.WriteLnFmt(Color_Green, "McdSlot {} [File]: {} [{} MB, {}]", slot, Path::GetFileName(fname),
|
||||
(FileSystem::FSize64(m_file[slot]) + (MCD_SIZE + 1)) / MC2_MBSIZE,
|
||||
(m_fileSize[slot] + (MCD_SIZE + 1)) / MC2_MBSIZE,
|
||||
FileMcd_IsMemoryCardFormatted(m_file[slot]) ? "Formatted" : "UNFORMATTED");
|
||||
|
||||
m_filenames[slot] = std::move(fname);
|
||||
m_ispsx[slot] = FileSystem::FSize64(m_file[slot]) == 0x20000;
|
||||
m_ispsx[slot] = m_fileSize[slot] == 0x20000;
|
||||
m_chkaddr = 0x210;
|
||||
|
||||
if (!m_ispsx[slot] && FileSystem::FSeek64(m_file[slot], m_chkaddr, SEEK_SET) == 0)
|
||||
@@ -354,30 +363,14 @@ void FileMemoryCard::Close()
|
||||
}
|
||||
|
||||
m_filenames[slot] = {};
|
||||
m_fileSize[slot] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
// Returns FALSE if the seek failed (is outside the bounds of the file).
|
||||
bool FileMemoryCard::Seek(std::FILE* f, u32 adr)
|
||||
{
|
||||
const s64 size = FileSystem::FSize64(f);
|
||||
|
||||
// If anyone knows why this filesize logic is here (it appears to be related to legacy PSX
|
||||
// cards, perhaps hacked support for some special emulator-specific memcard formats that
|
||||
// had header info?), then please replace this comment with something useful. Thanks! -- air
|
||||
|
||||
u32 offset = 0;
|
||||
|
||||
if (size == MCD_SIZE + 64)
|
||||
offset = 64;
|
||||
else if (size == MCD_SIZE + 3904)
|
||||
offset = 3904;
|
||||
else
|
||||
{
|
||||
// perform sanity checks here?
|
||||
}
|
||||
|
||||
return (FileSystem::FSeek64(f, adr + offset, SEEK_SET) == 0);
|
||||
return (FileSystem::FSeek64(f, adr, SEEK_SET) == 0);
|
||||
}
|
||||
|
||||
// returns FALSE if an error occurred (either permission denied or disk full)
|
||||
@@ -415,7 +408,7 @@ void FileMemoryCard::GetSizeInfo(uint slot, McdSizeInfo& outways)
|
||||
|
||||
pxAssert(m_file[slot]);
|
||||
if (m_file[slot])
|
||||
outways.McdSizeInSectors = static_cast<u32>(FileSystem::FSize64(m_file[slot])) / (outways.SectorSize + outways.EraseBlockSizeInSectors);
|
||||
outways.McdSizeInSectors = static_cast<u32>(m_fileSize[slot]) / (outways.SectorSize + outways.EraseBlockSizeInSectors);
|
||||
else
|
||||
outways.McdSizeInSectors = 0x4000;
|
||||
|
||||
@@ -542,7 +535,7 @@ u64 FileMemoryCard::GetCRC(uint slot)
|
||||
if (!Seek(mcfp, 0))
|
||||
return 0;
|
||||
|
||||
const s64 mcfpsize = FileSystem::FSize64(mcfp);
|
||||
const s64 mcfpsize = m_fileSize[slot];
|
||||
if (mcfpsize < 0)
|
||||
return 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user