Address review comments and fix compilation issues
This commit is contained in:
parent
fe3fcb0730
commit
01a28edab5
|
@ -3,6 +3,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace Common {
|
||||
|
||||
template <typename Enum>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <fmt/format.h>
|
||||
#include "common/common_funcs.h"
|
||||
#include "common/common_types.h"
|
||||
#include "common/swap.h"
|
||||
|
||||
namespace FileSys {
|
||||
|
||||
|
@ -41,7 +42,10 @@ enum class SaveDataRank : u8 {
|
|||
Secondary = 1,
|
||||
};
|
||||
|
||||
enum class SaveDataFormatType : u8 { Normal = 0, NoJournal = 1 };
|
||||
enum class SaveDataFormatType : u8 {
|
||||
Normal = 0,
|
||||
NoJournal = 1,
|
||||
};
|
||||
|
||||
struct SaveDataSize {
|
||||
u64 normal;
|
||||
|
@ -225,12 +229,4 @@ static_assert(sizeof(SaveDataFilter) == 0x48, "SaveDataFilter has invalid size."
|
|||
static_assert(std::is_trivially_copyable_v<SaveDataFilter>,
|
||||
"Data type must be trivially copyable.");
|
||||
|
||||
struct HashSalt {
|
||||
static constexpr size_t Size = 32;
|
||||
|
||||
std::array<u8, Size> value;
|
||||
};
|
||||
static_assert(std::is_trivially_copyable_v<HashSalt>, "Data type must be trivially copyable.");
|
||||
static_assert(sizeof(HashSalt) == HashSalt::Size);
|
||||
|
||||
} // namespace FileSys
|
||||
|
|
|
@ -23,7 +23,7 @@ ProgramRegistryImpl::~ProgramRegistryImpl() {}
|
|||
|
||||
void ProgramRegistryImpl::Initialize(ProgramRegistryServiceImpl* service) {
|
||||
// Check pre-conditions
|
||||
ASSERT(g_impl != nullptr);
|
||||
ASSERT(service != nullptr);
|
||||
ASSERT(g_impl == nullptr);
|
||||
|
||||
// Set the global service
|
||||
|
|
|
@ -1,33 +1,19 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "common/alignment.h"
|
||||
#include "common/enum_util.h"
|
||||
#include "common/swap.h"
|
||||
#include "core/file_sys/fssrv/impl/fssrv_access_control.h"
|
||||
|
||||
namespace FileSys::FsSrv {
|
||||
|
||||
namespace {
|
||||
constinit bool g_is_debug_flag_enabled = false;
|
||||
}
|
||||
|
||||
bool IsDebugFlagEnabled() {
|
||||
return g_is_debug_flag_enabled;
|
||||
}
|
||||
|
||||
void SetDebugFlagEnabled(bool enabled) {
|
||||
// Set global debug flag
|
||||
g_is_debug_flag_enabled = enabled;
|
||||
}
|
||||
|
||||
namespace Impl {
|
||||
|
||||
namespace {
|
||||
constexpr u8 LatestFsAccessControlInfoVersion = 1;
|
||||
}
|
||||
|
||||
AccessControl::AccessControl(const void* data, s64 data_size, const void* desc, s64 desc_size)
|
||||
: AccessControl(data, data_size, desc, desc_size,
|
||||
g_is_debug_flag_enabled ? AllFlagBitsMask : DebugFlagDisableMask) {}
|
||||
: AccessControl(data, data_size, desc, desc_size, DebugFlagDisableMask) {}
|
||||
|
||||
AccessControl::AccessControl(const void* fac_data, s64 data_size, const void* fac_desc,
|
||||
s64 desc_size, u64 flag_mask) {
|
||||
|
@ -418,7 +404,7 @@ Accessibility AccessControl::GetAccessibilityFor(AccessibilityType type) const {
|
|||
m_flag_bits->CanMountHostWrite());
|
||||
case MountRegisteredUpdatePartition:
|
||||
return Accessibility::MakeAccessibility(
|
||||
m_flag_bits->CanMountRegisteredUpdatePartitionRead() && g_is_debug_flag_enabled, false);
|
||||
m_flag_bits->CanMountRegisteredUpdatePartitionRead(), false);
|
||||
case MountSaveDataInternalStorage:
|
||||
return Accessibility::MakeAccessibility(m_flag_bits->CanOpenSaveDataInternalStorageRead(),
|
||||
m_flag_bits->CanOpenSaveDataInternalStorageWrite());
|
||||
|
@ -510,7 +496,7 @@ bool AccessControl::CanCall(OperationType type) const {
|
|||
case ExtendOthersSystemSaveData:
|
||||
return m_flag_bits->CanExtendOthersSystemSaveData();
|
||||
case RegisterUpdatePartition:
|
||||
return m_flag_bits->CanRegisterUpdatePartition() && g_is_debug_flag_enabled;
|
||||
return m_flag_bits->CanRegisterUpdatePartition();
|
||||
case OpenSaveDataTransferManager:
|
||||
return m_flag_bits->CanOpenSaveDataTransferManager();
|
||||
case OpenSaveDataTransferManagerVersion2:
|
||||
|
|
|
@ -10,13 +10,6 @@
|
|||
#include "common/intrusive_list.h"
|
||||
#include "core/file_sys/fssrv/impl/fssrv_access_control_bits.h"
|
||||
|
||||
namespace FileSys::FsSrv {
|
||||
|
||||
bool IsDebugFlagEnabled();
|
||||
void SetDebugFlagEnabled(bool enabled);
|
||||
|
||||
} // namespace FileSys::FsSrv
|
||||
|
||||
namespace FileSys::FsSrv::Impl {
|
||||
|
||||
struct Accessibility {
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "core/core.h"
|
||||
#include "core/file_sys/fssrv/impl/fssrv_program_info.h"
|
||||
#include "core/hle/kernel/svc.h"
|
||||
#include "core/hle/kernel/svc_common.h"
|
||||
|
||||
namespace FileSys::FsSrv::Impl {
|
||||
|
||||
|
@ -39,12 +40,6 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
constexpr const u32 FileAccessControlForInitialProgram[0x1C / sizeof(u32)] = {
|
||||
0x00000001, 0x00000000, 0x80000000, 0x0000001C, 0x00000000, 0x0000001C, 0x00000000};
|
||||
constexpr const u32 FileAccessControlDescForInitialProgram[0x2C / sizeof(u32)] = {
|
||||
0x00000001, 0x00000000, 0x80000000, 0x00000000, 0x00000000, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF};
|
||||
|
||||
constinit bool g_initialized = false;
|
||||
|
||||
constinit u64 g_initial_process_id_min = 0;
|
||||
|
@ -87,6 +82,12 @@ std::shared_ptr<ProgramInfo> ProgramInfo::GetProgramInfoForInitialProcess() {
|
|||
: ProgramInfo(data, data_size, desc, desc_size) {}
|
||||
};
|
||||
|
||||
constexpr const u32 FileAccessControlForInitialProgram[0x1C / sizeof(u32)] = {
|
||||
0x00000001, 0x00000000, 0x80000000, 0x0000001C, 0x00000000, 0x0000001C, 0x00000000};
|
||||
constexpr const u32 FileAccessControlDescForInitialProgram[0x2C / sizeof(u32)] = {
|
||||
0x00000001, 0x00000000, 0x80000000, 0x00000000, 0x00000000, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF};
|
||||
|
||||
static constinit Common::TypedStorage<std::shared_ptr<ProgramInfo>>
|
||||
s_fls_storage_for_s_initial_program_info{};
|
||||
static constinit bool s_fls_initialized_s_initial_program_info = false;
|
||||
|
|
|
@ -48,9 +48,8 @@ public:
|
|||
static std::shared_ptr<ProgramInfo> GetProgramInfoForInitialProcess();
|
||||
|
||||
private:
|
||||
const u64 InvalidProgramId = {};
|
||||
ProgramInfo(const void* data, s64 data_size, const void* desc, s64 desc_size)
|
||||
: m_process_id(InvalidProcessId), m_program_id(InvalidProgramId),
|
||||
: m_process_id(InvalidProcessId), m_program_id(0),
|
||||
m_storage_id(static_cast<FileSys::StorageId>(0)),
|
||||
m_access_control(data, data_size, desc, desc_size, std::numeric_limits<u64>::max()) {}
|
||||
};
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2020 Alex Barney
|
||||
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
// TODO: Properly credit LibHac before this gets merged
|
||||
// SPDX-License-Identifier: MIT AND GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/kernel/k_resource_limit.h"
|
||||
#include "core/hle/kernel/svc.h"
|
||||
#include "core/hle/kernel/svc_common.h"
|
||||
|
||||
namespace Kernel::Svc {
|
||||
|
||||
|
|
Loading…
Reference in a new issue