Compare commits
1 Commits
android-10
...
android-10
Author | SHA1 | Date | |
---|---|---|---|
b3f9290bb6 |
@ -116,8 +116,11 @@ FileSys::VirtualFile GetGameFileFromPath(const FileSys::VirtualFilesystem& vfs,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return FileSys::ConcatenatedVfsFile::MakeConcatenatedFile(dir->GetName(),
|
if (concat.empty()) {
|
||||||
std::move(concat));
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FileSys::ConcatenatedVfsFile::MakeConcatenatedFile(concat, dir->GetName());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Common::FS::IsDir(path)) {
|
if (Common::FS::IsDir(path)) {
|
||||||
|
@ -107,56 +107,62 @@ static u64 romfs_get_hash_table_count(u64 num_entries) {
|
|||||||
|
|
||||||
void RomFSBuildContext::VisitDirectory(VirtualDir romfs_dir, VirtualDir ext_dir,
|
void RomFSBuildContext::VisitDirectory(VirtualDir romfs_dir, VirtualDir ext_dir,
|
||||||
std::shared_ptr<RomFSBuildDirectoryContext> parent) {
|
std::shared_ptr<RomFSBuildDirectoryContext> parent) {
|
||||||
for (auto& child_romfs_file : romfs_dir->GetFiles()) {
|
std::vector<std::shared_ptr<RomFSBuildDirectoryContext>> child_dirs;
|
||||||
const auto name = child_romfs_file->GetName();
|
|
||||||
const auto child = std::make_shared<RomFSBuildFileContext>();
|
|
||||||
// Set child's path.
|
|
||||||
child->cur_path_ofs = parent->path_len + 1;
|
|
||||||
child->path_len = child->cur_path_ofs + static_cast<u32>(name.size());
|
|
||||||
child->path = parent->path + "/" + name;
|
|
||||||
|
|
||||||
if (ext_dir != nullptr && ext_dir->GetFile(name + ".stub") != nullptr) {
|
const auto entries = romfs_dir->GetEntries();
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sanity check on path_len
|
for (const auto& kv : entries) {
|
||||||
ASSERT(child->path_len < FS_MAX_PATH);
|
if (kv.second == VfsEntryType::Directory) {
|
||||||
|
const auto child = std::make_shared<RomFSBuildDirectoryContext>();
|
||||||
|
// Set child's path.
|
||||||
|
child->cur_path_ofs = parent->path_len + 1;
|
||||||
|
child->path_len = child->cur_path_ofs + static_cast<u32>(kv.first.size());
|
||||||
|
child->path = parent->path + "/" + kv.first;
|
||||||
|
|
||||||
child->source = std::move(child_romfs_file);
|
if (ext_dir != nullptr && ext_dir->GetFile(kv.first + ".stub") != nullptr) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (ext_dir != nullptr) {
|
// Sanity check on path_len
|
||||||
if (const auto ips = ext_dir->GetFile(name + ".ips")) {
|
ASSERT(child->path_len < FS_MAX_PATH);
|
||||||
if (auto patched = PatchIPS(child->source, ips)) {
|
|
||||||
child->source = std::move(patched);
|
if (AddDirectory(parent, child)) {
|
||||||
|
child_dirs.push_back(child);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const auto child = std::make_shared<RomFSBuildFileContext>();
|
||||||
|
// Set child's path.
|
||||||
|
child->cur_path_ofs = parent->path_len + 1;
|
||||||
|
child->path_len = child->cur_path_ofs + static_cast<u32>(kv.first.size());
|
||||||
|
child->path = parent->path + "/" + kv.first;
|
||||||
|
|
||||||
|
if (ext_dir != nullptr && ext_dir->GetFile(kv.first + ".stub") != nullptr) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sanity check on path_len
|
||||||
|
ASSERT(child->path_len < FS_MAX_PATH);
|
||||||
|
|
||||||
|
child->source = romfs_dir->GetFile(kv.first);
|
||||||
|
|
||||||
|
if (ext_dir != nullptr) {
|
||||||
|
if (const auto ips = ext_dir->GetFile(kv.first + ".ips")) {
|
||||||
|
if (auto patched = PatchIPS(child->source, ips)) {
|
||||||
|
child->source = std::move(patched);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
child->size = child->source->GetSize();
|
||||||
|
|
||||||
|
AddFile(parent, child);
|
||||||
}
|
}
|
||||||
|
|
||||||
child->size = child->source->GetSize();
|
|
||||||
|
|
||||||
AddFile(parent, child);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& child_romfs_dir : romfs_dir->GetSubdirectories()) {
|
for (auto& child : child_dirs) {
|
||||||
const auto name = child_romfs_dir->GetName();
|
auto subdir_name = std::string_view(child->path).substr(child->cur_path_ofs);
|
||||||
const auto child = std::make_shared<RomFSBuildDirectoryContext>();
|
auto child_romfs_dir = romfs_dir->GetSubdirectory(subdir_name);
|
||||||
// Set child's path.
|
auto child_ext_dir = ext_dir != nullptr ? ext_dir->GetSubdirectory(subdir_name) : nullptr;
|
||||||
child->cur_path_ofs = parent->path_len + 1;
|
|
||||||
child->path_len = child->cur_path_ofs + static_cast<u32>(name.size());
|
|
||||||
child->path = parent->path + "/" + name;
|
|
||||||
|
|
||||||
if (ext_dir != nullptr && ext_dir->GetFile(name + ".stub") != nullptr) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sanity check on path_len
|
|
||||||
ASSERT(child->path_len < FS_MAX_PATH);
|
|
||||||
|
|
||||||
if (!AddDirectory(parent, child)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto child_ext_dir = ext_dir != nullptr ? ext_dir->GetSubdirectory(name) : nullptr;
|
|
||||||
this->VisitDirectory(child_romfs_dir, child_ext_dir, child);
|
this->VisitDirectory(child_romfs_dir, child_ext_dir, child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -287,7 +293,7 @@ std::multimap<u64, VirtualFile> RomFSBuildContext::Build() {
|
|||||||
|
|
||||||
cur_entry.name_size = name_size;
|
cur_entry.name_size = name_size;
|
||||||
|
|
||||||
out.emplace(cur_file->offset + ROMFS_FILEPARTITION_OFS, std::move(cur_file->source));
|
out.emplace(cur_file->offset + ROMFS_FILEPARTITION_OFS, cur_file->source);
|
||||||
std::memcpy(file_table.data() + cur_file->entry_offset, &cur_entry, sizeof(RomFSFileEntry));
|
std::memcpy(file_table.data() + cur_file->entry_offset, &cur_entry, sizeof(RomFSFileEntry));
|
||||||
std::memset(file_table.data() + cur_file->entry_offset + sizeof(RomFSFileEntry), 0,
|
std::memset(file_table.data() + cur_file->entry_offset + sizeof(RomFSFileEntry), 0,
|
||||||
Common::AlignUp(cur_entry.name_size, 4));
|
Common::AlignUp(cur_entry.name_size, 4));
|
||||||
|
@ -377,16 +377,16 @@ static void ApplyLayeredFS(VirtualFile& romfs, u64 title_id, ContentRecordType t
|
|||||||
|
|
||||||
auto romfs_dir = FindSubdirectoryCaseless(subdir, "romfs");
|
auto romfs_dir = FindSubdirectoryCaseless(subdir, "romfs");
|
||||||
if (romfs_dir != nullptr)
|
if (romfs_dir != nullptr)
|
||||||
layers.emplace_back(std::make_shared<CachedVfsDirectory>(std::move(romfs_dir)));
|
layers.push_back(std::make_shared<CachedVfsDirectory>(romfs_dir));
|
||||||
|
|
||||||
auto ext_dir = FindSubdirectoryCaseless(subdir, "romfs_ext");
|
auto ext_dir = FindSubdirectoryCaseless(subdir, "romfs_ext");
|
||||||
if (ext_dir != nullptr)
|
if (ext_dir != nullptr)
|
||||||
layers_ext.emplace_back(std::make_shared<CachedVfsDirectory>(std::move(ext_dir)));
|
layers_ext.push_back(std::make_shared<CachedVfsDirectory>(ext_dir));
|
||||||
|
|
||||||
if (type == ContentRecordType::HtmlDocument) {
|
if (type == ContentRecordType::HtmlDocument) {
|
||||||
auto manual_dir = FindSubdirectoryCaseless(subdir, "manual_html");
|
auto manual_dir = FindSubdirectoryCaseless(subdir, "manual_html");
|
||||||
if (manual_dir != nullptr)
|
if (manual_dir != nullptr)
|
||||||
layers.emplace_back(std::make_shared<CachedVfsDirectory>(std::move(manual_dir)));
|
layers.push_back(std::make_shared<CachedVfsDirectory>(manual_dir));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -400,7 +400,7 @@ static void ApplyLayeredFS(VirtualFile& romfs, u64 title_id, ContentRecordType t
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
layers.emplace_back(std::move(extracted));
|
layers.push_back(std::move(extracted));
|
||||||
|
|
||||||
auto layered = LayeredVfsDirectory::MakeLayeredDirectory(std::move(layers));
|
auto layered = LayeredVfsDirectory::MakeLayeredDirectory(std::move(layers));
|
||||||
if (layered == nullptr) {
|
if (layered == nullptr) {
|
||||||
|
@ -322,8 +322,7 @@ VirtualFile RegisteredCache::OpenFileOrDirectoryConcat(const VirtualDir& open_di
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto name = concat.front()->GetName();
|
return ConcatenatedVfsFile::MakeConcatenatedFile(concat, concat.front()->GetName());
|
||||||
return ConcatenatedVfsFile::MakeConcatenatedFile(std::move(name), std::move(concat));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VirtualFile RegisteredCache::GetFileAtID(NcaID id) const {
|
VirtualFile RegisteredCache::GetFileAtID(NcaID id) const {
|
||||||
|
@ -133,7 +133,7 @@ VirtualDir ExtractRomFS(VirtualFile file, RomFSExtractionType type) {
|
|||||||
out = out->GetSubdirectories().front();
|
out = out->GetSubdirectories().front();
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::make_shared<CachedVfsDirectory>(std::move(out));
|
return std::make_shared<CachedVfsDirectory>(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
VirtualFile CreateRomFS(VirtualDir dir, VirtualDir ext) {
|
VirtualFile CreateRomFS(VirtualDir dir, VirtualDir ext) {
|
||||||
@ -141,7 +141,8 @@ VirtualFile CreateRomFS(VirtualDir dir, VirtualDir ext) {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
RomFSBuildContext ctx{dir, ext};
|
RomFSBuildContext ctx{dir, ext};
|
||||||
return ConcatenatedVfsFile::MakeConcatenatedFile(0, dir->GetName(), ctx.Build());
|
auto file_map = ctx.Build();
|
||||||
|
return ConcatenatedVfsFile::MakeConcatenatedFile(0, file_map, dir->GetName());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace FileSys
|
} // namespace FileSys
|
||||||
|
@ -6,13 +6,13 @@
|
|||||||
|
|
||||||
namespace FileSys {
|
namespace FileSys {
|
||||||
|
|
||||||
CachedVfsDirectory::CachedVfsDirectory(VirtualDir&& source_dir)
|
CachedVfsDirectory::CachedVfsDirectory(VirtualDir& source_dir)
|
||||||
: name(source_dir->GetName()), parent(source_dir->GetParentDirectory()) {
|
: name(source_dir->GetName()), parent(source_dir->GetParentDirectory()) {
|
||||||
for (auto& dir : source_dir->GetSubdirectories()) {
|
for (auto& dir : source_dir->GetSubdirectories()) {
|
||||||
dirs.emplace(dir->GetName(), std::make_shared<CachedVfsDirectory>(std::move(dir)));
|
dirs.emplace(dir->GetName(), std::make_shared<CachedVfsDirectory>(dir));
|
||||||
}
|
}
|
||||||
for (auto& file : source_dir->GetFiles()) {
|
for (auto& file : source_dir->GetFiles()) {
|
||||||
files.emplace(file->GetName(), std::move(file));
|
files.emplace(file->GetName(), file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ namespace FileSys {
|
|||||||
|
|
||||||
class CachedVfsDirectory : public ReadOnlyVfsDirectory {
|
class CachedVfsDirectory : public ReadOnlyVfsDirectory {
|
||||||
public:
|
public:
|
||||||
CachedVfsDirectory(VirtualDir&& source_directory);
|
CachedVfsDirectory(VirtualDir& source_directory);
|
||||||
|
|
||||||
~CachedVfsDirectory() override;
|
~CachedVfsDirectory() override;
|
||||||
VirtualFile GetFile(std::string_view file_name) const override;
|
VirtualFile GetFile(std::string_view file_name) const override;
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
namespace FileSys {
|
namespace FileSys {
|
||||||
|
|
||||||
ConcatenatedVfsFile::ConcatenatedVfsFile(std::string&& name_, ConcatenationMap&& concatenation_map_)
|
ConcatenatedVfsFile::ConcatenatedVfsFile(ConcatenationMap&& concatenation_map_, std::string&& name_)
|
||||||
: concatenation_map(std::move(concatenation_map_)), name(std::move(name_)) {
|
: concatenation_map(std::move(concatenation_map_)), name(std::move(name_)) {
|
||||||
DEBUG_ASSERT(this->VerifyContinuity());
|
DEBUG_ASSERT(this->VerifyContinuity());
|
||||||
}
|
}
|
||||||
@ -30,8 +30,8 @@ bool ConcatenatedVfsFile::VerifyContinuity() const {
|
|||||||
|
|
||||||
ConcatenatedVfsFile::~ConcatenatedVfsFile() = default;
|
ConcatenatedVfsFile::~ConcatenatedVfsFile() = default;
|
||||||
|
|
||||||
VirtualFile ConcatenatedVfsFile::MakeConcatenatedFile(std::string&& name,
|
VirtualFile ConcatenatedVfsFile::MakeConcatenatedFile(const std::vector<VirtualFile>& files,
|
||||||
std::vector<VirtualFile>&& files) {
|
std::string&& name) {
|
||||||
// Fold trivial cases.
|
// Fold trivial cases.
|
||||||
if (files.empty()) {
|
if (files.empty()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -46,21 +46,20 @@ VirtualFile ConcatenatedVfsFile::MakeConcatenatedFile(std::string&& name,
|
|||||||
u64 last_offset = 0;
|
u64 last_offset = 0;
|
||||||
|
|
||||||
for (auto& file : files) {
|
for (auto& file : files) {
|
||||||
const auto size = file->GetSize();
|
|
||||||
|
|
||||||
concatenation_map.emplace_back(ConcatenationEntry{
|
concatenation_map.emplace_back(ConcatenationEntry{
|
||||||
.offset = last_offset,
|
.offset = last_offset,
|
||||||
.file = std::move(file),
|
.file = file,
|
||||||
});
|
});
|
||||||
|
|
||||||
last_offset += size;
|
last_offset += file->GetSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
return VirtualFile(new ConcatenatedVfsFile(std::move(name), std::move(concatenation_map)));
|
return VirtualFile(new ConcatenatedVfsFile(std::move(concatenation_map), std::move(name)));
|
||||||
}
|
}
|
||||||
|
|
||||||
VirtualFile ConcatenatedVfsFile::MakeConcatenatedFile(u8 filler_byte, std::string&& name,
|
VirtualFile ConcatenatedVfsFile::MakeConcatenatedFile(u8 filler_byte,
|
||||||
std::multimap<u64, VirtualFile>&& files) {
|
const std::multimap<u64, VirtualFile>& files,
|
||||||
|
std::string&& name) {
|
||||||
// Fold trivial cases.
|
// Fold trivial cases.
|
||||||
if (files.empty()) {
|
if (files.empty()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -77,8 +76,6 @@ VirtualFile ConcatenatedVfsFile::MakeConcatenatedFile(u8 filler_byte, std::strin
|
|||||||
|
|
||||||
// Iteration of a multimap is ordered, so offset will be strictly non-decreasing.
|
// Iteration of a multimap is ordered, so offset will be strictly non-decreasing.
|
||||||
for (auto& [offset, file] : files) {
|
for (auto& [offset, file] : files) {
|
||||||
const auto size = file->GetSize();
|
|
||||||
|
|
||||||
if (offset > last_offset) {
|
if (offset > last_offset) {
|
||||||
concatenation_map.emplace_back(ConcatenationEntry{
|
concatenation_map.emplace_back(ConcatenationEntry{
|
||||||
.offset = last_offset,
|
.offset = last_offset,
|
||||||
@ -88,13 +85,13 @@ VirtualFile ConcatenatedVfsFile::MakeConcatenatedFile(u8 filler_byte, std::strin
|
|||||||
|
|
||||||
concatenation_map.emplace_back(ConcatenationEntry{
|
concatenation_map.emplace_back(ConcatenationEntry{
|
||||||
.offset = offset,
|
.offset = offset,
|
||||||
.file = std::move(file),
|
.file = file,
|
||||||
});
|
});
|
||||||
|
|
||||||
last_offset = offset + size;
|
last_offset = offset + file->GetSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
return VirtualFile(new ConcatenatedVfsFile(std::move(name), std::move(concatenation_map)));
|
return VirtualFile(new ConcatenatedVfsFile(std::move(concatenation_map), std::move(name)));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ConcatenatedVfsFile::GetName() const {
|
std::string ConcatenatedVfsFile::GetName() const {
|
||||||
|
@ -24,20 +24,22 @@ private:
|
|||||||
};
|
};
|
||||||
using ConcatenationMap = std::vector<ConcatenationEntry>;
|
using ConcatenationMap = std::vector<ConcatenationEntry>;
|
||||||
|
|
||||||
explicit ConcatenatedVfsFile(std::string&& name,
|
explicit ConcatenatedVfsFile(std::vector<ConcatenationEntry>&& concatenation_map,
|
||||||
std::vector<ConcatenationEntry>&& concatenation_map);
|
std::string&& name);
|
||||||
bool VerifyContinuity() const;
|
bool VerifyContinuity() const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
~ConcatenatedVfsFile() override;
|
~ConcatenatedVfsFile() override;
|
||||||
|
|
||||||
/// Wrapper function to allow for more efficient handling of files.size() == 0, 1 cases.
|
/// Wrapper function to allow for more efficient handling of files.size() == 0, 1 cases.
|
||||||
static VirtualFile MakeConcatenatedFile(std::string&& name, std::vector<VirtualFile>&& files);
|
static VirtualFile MakeConcatenatedFile(const std::vector<VirtualFile>& files,
|
||||||
|
std::string&& name);
|
||||||
|
|
||||||
/// Convenience function that turns a map of offsets to files into a concatenated file, filling
|
/// Convenience function that turns a map of offsets to files into a concatenated file, filling
|
||||||
/// gaps with a given filler byte.
|
/// gaps with a given filler byte.
|
||||||
static VirtualFile MakeConcatenatedFile(u8 filler_byte, std::string&& name,
|
static VirtualFile MakeConcatenatedFile(u8 filler_byte,
|
||||||
std::multimap<u64, VirtualFile>&& files);
|
const std::multimap<u64, VirtualFile>& files,
|
||||||
|
std::string&& name);
|
||||||
|
|
||||||
std::string GetName() const override;
|
std::string GetName() const override;
|
||||||
std::size_t GetSize() const override;
|
std::size_t GetSize() const override;
|
||||||
|
@ -38,7 +38,7 @@ VirtualDir LayeredVfsDirectory::GetDirectoryRelative(std::string_view path) cons
|
|||||||
for (const auto& layer : dirs) {
|
for (const auto& layer : dirs) {
|
||||||
auto dir = layer->GetDirectoryRelative(path);
|
auto dir = layer->GetDirectoryRelative(path);
|
||||||
if (dir != nullptr) {
|
if (dir != nullptr) {
|
||||||
out.emplace_back(std::move(dir));
|
out.push_back(std::move(dir));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,11 +62,11 @@ std::vector<VirtualFile> LayeredVfsDirectory::GetFiles() const {
|
|||||||
std::set<std::string, std::less<>> out_names;
|
std::set<std::string, std::less<>> out_names;
|
||||||
|
|
||||||
for (const auto& layer : dirs) {
|
for (const auto& layer : dirs) {
|
||||||
for (auto& file : layer->GetFiles()) {
|
for (const auto& file : layer->GetFiles()) {
|
||||||
auto file_name = file->GetName();
|
auto file_name = file->GetName();
|
||||||
if (!out_names.contains(file_name)) {
|
if (!out_names.contains(file_name)) {
|
||||||
out_names.emplace(std::move(file_name));
|
out_names.emplace(std::move(file_name));
|
||||||
out.emplace_back(std::move(file));
|
out.push_back(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -86,7 +86,7 @@ std::vector<VirtualDir> LayeredVfsDirectory::GetSubdirectories() const {
|
|||||||
std::vector<VirtualDir> out;
|
std::vector<VirtualDir> out;
|
||||||
out.reserve(names.size());
|
out.reserve(names.size());
|
||||||
for (const auto& subdir : names)
|
for (const auto& subdir : names)
|
||||||
out.emplace_back(GetSubdirectory(subdir));
|
out.push_back(GetSubdirectory(subdir));
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ public:
|
|||||||
: ServiceFramework{system_, "IManagerForSystemService"} {
|
: ServiceFramework{system_, "IManagerForSystemService"} {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, &IManagerForSystemService::CheckAvailability, "CheckAvailability"},
|
{0, nullptr, "CheckAvailability"},
|
||||||
{1, nullptr, "GetAccountId"},
|
{1, nullptr, "GetAccountId"},
|
||||||
{2, nullptr, "EnsureIdTokenCacheAsync"},
|
{2, nullptr, "EnsureIdTokenCacheAsync"},
|
||||||
{3, nullptr, "LoadIdTokenCache"},
|
{3, nullptr, "LoadIdTokenCache"},
|
||||||
@ -78,13 +78,6 @@ public:
|
|||||||
|
|
||||||
RegisterHandlers(functions);
|
RegisterHandlers(functions);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
|
||||||
void CheckAvailability(HLERequestContext& ctx) {
|
|
||||||
LOG_WARNING(Service_ACC, "(STUBBED) called");
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
|
||||||
rb.Push(ResultSuccess);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 3.0.0+
|
// 3.0.0+
|
||||||
@ -407,13 +400,13 @@ protected:
|
|||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
const auto base = rp.PopRaw<ProfileBase>();
|
const auto base = rp.PopRaw<ProfileBase>();
|
||||||
|
|
||||||
const auto image_data = ctx.ReadBufferA(0);
|
const auto user_data = ctx.ReadBuffer();
|
||||||
const auto user_data = ctx.ReadBufferX(0);
|
const auto image_data = ctx.ReadBuffer(1);
|
||||||
|
|
||||||
LOG_INFO(Service_ACC, "called, username='{}', timestamp={:016X}, uuid=0x{}",
|
LOG_DEBUG(Service_ACC, "called, username='{}', timestamp={:016X}, uuid=0x{}",
|
||||||
Common::StringFromFixedZeroTerminatedBuffer(
|
Common::StringFromFixedZeroTerminatedBuffer(
|
||||||
reinterpret_cast<const char*>(base.username.data()), base.username.size()),
|
reinterpret_cast<const char*>(base.username.data()), base.username.size()),
|
||||||
base.timestamp, base.user_uuid.RawString());
|
base.timestamp, base.user_uuid.RawString());
|
||||||
|
|
||||||
if (user_data.size() < sizeof(UserData)) {
|
if (user_data.size() < sizeof(UserData)) {
|
||||||
LOG_ERROR(Service_ACC, "UserData buffer too small!");
|
LOG_ERROR(Service_ACC, "UserData buffer too small!");
|
||||||
@ -844,29 +837,6 @@ void Module::Interface::InitializeApplicationInfoV2(HLERequestContext& ctx) {
|
|||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::BeginUserRegistration(HLERequestContext& ctx) {
|
|
||||||
const auto user_id = Common::UUID::MakeRandom();
|
|
||||||
profile_manager->CreateNewUser(user_id, "yuzu");
|
|
||||||
|
|
||||||
LOG_INFO(Service_ACC, "called, uuid={}", user_id.FormattedString());
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 6};
|
|
||||||
rb.Push(ResultSuccess);
|
|
||||||
rb.PushRaw(user_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Module::Interface::CompleteUserRegistration(HLERequestContext& ctx) {
|
|
||||||
IPC::RequestParser rp{ctx};
|
|
||||||
Common::UUID user_id = rp.PopRaw<Common::UUID>();
|
|
||||||
|
|
||||||
LOG_INFO(Service_ACC, "called, uuid={}", user_id.FormattedString());
|
|
||||||
|
|
||||||
profile_manager->WriteUserSaveFile();
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
|
||||||
rb.Push(ResultSuccess);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Module::Interface::GetProfileEditor(HLERequestContext& ctx) {
|
void Module::Interface::GetProfileEditor(HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
Common::UUID user_id = rp.PopRaw<Common::UUID>();
|
Common::UUID user_id = rp.PopRaw<Common::UUID>();
|
||||||
@ -910,17 +880,6 @@ void Module::Interface::StoreSaveDataThumbnailApplication(HLERequestContext& ctx
|
|||||||
StoreSaveDataThumbnail(ctx, uuid, tid);
|
StoreSaveDataThumbnail(ctx, uuid, tid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::GetBaasAccountManagerForSystemService(HLERequestContext& ctx) {
|
|
||||||
IPC::RequestParser rp{ctx};
|
|
||||||
const auto uuid = rp.PopRaw<Common::UUID>();
|
|
||||||
|
|
||||||
LOG_INFO(Service_ACC, "called, uuid=0x{}", uuid.RawString());
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
|
||||||
rb.Push(ResultSuccess);
|
|
||||||
rb.PushIpcInterface<IManagerForSystemService>(system, uuid);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Module::Interface::StoreSaveDataThumbnailSystem(HLERequestContext& ctx) {
|
void Module::Interface::StoreSaveDataThumbnailSystem(HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
const auto uuid = rp.PopRaw<Common::UUID>();
|
const auto uuid = rp.PopRaw<Common::UUID>();
|
||||||
|
@ -33,13 +33,10 @@ public:
|
|||||||
void TrySelectUserWithoutInteraction(HLERequestContext& ctx);
|
void TrySelectUserWithoutInteraction(HLERequestContext& ctx);
|
||||||
void IsUserAccountSwitchLocked(HLERequestContext& ctx);
|
void IsUserAccountSwitchLocked(HLERequestContext& ctx);
|
||||||
void InitializeApplicationInfoV2(HLERequestContext& ctx);
|
void InitializeApplicationInfoV2(HLERequestContext& ctx);
|
||||||
void BeginUserRegistration(HLERequestContext& ctx);
|
|
||||||
void CompleteUserRegistration(HLERequestContext& ctx);
|
|
||||||
void GetProfileEditor(HLERequestContext& ctx);
|
void GetProfileEditor(HLERequestContext& ctx);
|
||||||
void ListQualifiedUsers(HLERequestContext& ctx);
|
void ListQualifiedUsers(HLERequestContext& ctx);
|
||||||
void ListOpenContextStoredUsers(HLERequestContext& ctx);
|
void ListOpenContextStoredUsers(HLERequestContext& ctx);
|
||||||
void StoreSaveDataThumbnailApplication(HLERequestContext& ctx);
|
void StoreSaveDataThumbnailApplication(HLERequestContext& ctx);
|
||||||
void GetBaasAccountManagerForSystemService(HLERequestContext& ctx);
|
|
||||||
void StoreSaveDataThumbnailSystem(HLERequestContext& ctx);
|
void StoreSaveDataThumbnailSystem(HLERequestContext& ctx);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -23,7 +23,7 @@ ACC_SU::ACC_SU(std::shared_ptr<Module> module_, std::shared_ptr<ProfileManager>
|
|||||||
{99, nullptr, "DebugActivateOpenContextRetention"},
|
{99, nullptr, "DebugActivateOpenContextRetention"},
|
||||||
{100, nullptr, "GetUserRegistrationNotifier"},
|
{100, nullptr, "GetUserRegistrationNotifier"},
|
||||||
{101, nullptr, "GetUserStateChangeNotifier"},
|
{101, nullptr, "GetUserStateChangeNotifier"},
|
||||||
{102, &ACC_SU::GetBaasAccountManagerForSystemService, "GetBaasAccountManagerForSystemService"},
|
{102, nullptr, "GetBaasAccountManagerForSystemService"},
|
||||||
{103, nullptr, "GetBaasUserAvailabilityChangeNotifier"},
|
{103, nullptr, "GetBaasUserAvailabilityChangeNotifier"},
|
||||||
{104, nullptr, "GetProfileUpdateNotifier"},
|
{104, nullptr, "GetProfileUpdateNotifier"},
|
||||||
{105, nullptr, "CheckNetworkServiceAvailabilityAsync"},
|
{105, nullptr, "CheckNetworkServiceAvailabilityAsync"},
|
||||||
@ -40,8 +40,8 @@ ACC_SU::ACC_SU(std::shared_ptr<Module> module_, std::shared_ptr<ProfileManager>
|
|||||||
{152, nullptr, "LoadSignedDeviceIdentifierCacheForNintendoAccount"},
|
{152, nullptr, "LoadSignedDeviceIdentifierCacheForNintendoAccount"},
|
||||||
{190, nullptr, "GetUserLastOpenedApplication"},
|
{190, nullptr, "GetUserLastOpenedApplication"},
|
||||||
{191, nullptr, "ActivateOpenContextHolder"},
|
{191, nullptr, "ActivateOpenContextHolder"},
|
||||||
{200, &ACC_SU::BeginUserRegistration, "BeginUserRegistration"},
|
{200, nullptr, "BeginUserRegistration"},
|
||||||
{201, &ACC_SU::CompleteUserRegistration, "CompleteUserRegistration"},
|
{201, nullptr, "CompleteUserRegistration"},
|
||||||
{202, nullptr, "CancelUserRegistration"},
|
{202, nullptr, "CancelUserRegistration"},
|
||||||
{203, nullptr, "DeleteUser"},
|
{203, nullptr, "DeleteUser"},
|
||||||
{204, nullptr, "SetUserPosition"},
|
{204, nullptr, "SetUserPosition"},
|
||||||
|
@ -96,10 +96,9 @@ public:
|
|||||||
bool SetProfileBaseAndData(Common::UUID uuid, const ProfileBase& profile_new,
|
bool SetProfileBaseAndData(Common::UUID uuid, const ProfileBase& profile_new,
|
||||||
const UserData& data_new);
|
const UserData& data_new);
|
||||||
|
|
||||||
void WriteUserSaveFile();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ParseUserSaveFile();
|
void ParseUserSaveFile();
|
||||||
|
void WriteUserSaveFile();
|
||||||
std::optional<std::size_t> AddToProfiles(const ProfileInfo& profile);
|
std::optional<std::size_t> AddToProfiles(const ProfileInfo& profile);
|
||||||
bool RemoveProfileAtIndex(std::size_t index);
|
bool RemoveProfileAtIndex(std::size_t index);
|
||||||
|
|
||||||
|
@ -210,8 +210,8 @@ IDisplayController::IDisplayController(Core::System& system_)
|
|||||||
{21, nullptr, "ClearAppletTransitionBuffer"},
|
{21, nullptr, "ClearAppletTransitionBuffer"},
|
||||||
{22, nullptr, "AcquireLastApplicationCaptureSharedBuffer"},
|
{22, nullptr, "AcquireLastApplicationCaptureSharedBuffer"},
|
||||||
{23, nullptr, "ReleaseLastApplicationCaptureSharedBuffer"},
|
{23, nullptr, "ReleaseLastApplicationCaptureSharedBuffer"},
|
||||||
{24, &IDisplayController::AcquireLastForegroundCaptureSharedBuffer, "AcquireLastForegroundCaptureSharedBuffer"},
|
{24, nullptr, "AcquireLastForegroundCaptureSharedBuffer"},
|
||||||
{25, &IDisplayController::ReleaseLastForegroundCaptureSharedBuffer, "ReleaseLastForegroundCaptureSharedBuffer"},
|
{25, nullptr, "ReleaseLastForegroundCaptureSharedBuffer"},
|
||||||
{26, &IDisplayController::AcquireCallerAppletCaptureSharedBuffer, "AcquireCallerAppletCaptureSharedBuffer"},
|
{26, &IDisplayController::AcquireCallerAppletCaptureSharedBuffer, "AcquireCallerAppletCaptureSharedBuffer"},
|
||||||
{27, &IDisplayController::ReleaseCallerAppletCaptureSharedBuffer, "ReleaseCallerAppletCaptureSharedBuffer"},
|
{27, &IDisplayController::ReleaseCallerAppletCaptureSharedBuffer, "ReleaseCallerAppletCaptureSharedBuffer"},
|
||||||
{28, nullptr, "TakeScreenShotOfOwnLayerEx"},
|
{28, nullptr, "TakeScreenShotOfOwnLayerEx"},
|
||||||
@ -239,22 +239,6 @@ void IDisplayController::TakeScreenShotOfOwnLayer(HLERequestContext& ctx) {
|
|||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IDisplayController::AcquireLastForegroundCaptureSharedBuffer(HLERequestContext& ctx) {
|
|
||||||
LOG_WARNING(Service_AM, "(STUBBED) called");
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 4};
|
|
||||||
rb.Push(ResultSuccess);
|
|
||||||
rb.Push(1U);
|
|
||||||
rb.Push(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IDisplayController::ReleaseLastForegroundCaptureSharedBuffer(HLERequestContext& ctx) {
|
|
||||||
LOG_WARNING(Service_AM, "(STUBBED) called");
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
|
||||||
rb.Push(ResultSuccess);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IDisplayController::AcquireCallerAppletCaptureSharedBuffer(HLERequestContext& ctx) {
|
void IDisplayController::AcquireCallerAppletCaptureSharedBuffer(HLERequestContext& ctx) {
|
||||||
LOG_WARNING(Service_AM, "(STUBBED) called");
|
LOG_WARNING(Service_AM, "(STUBBED) called");
|
||||||
|
|
||||||
@ -1573,7 +1557,7 @@ ILibraryAppletSelfAccessor::ILibraryAppletSelfAccessor(Core::System& system_)
|
|||||||
{100, nullptr, "CreateGameMovieTrimmer"},
|
{100, nullptr, "CreateGameMovieTrimmer"},
|
||||||
{101, nullptr, "ReserveResourceForMovieOperation"},
|
{101, nullptr, "ReserveResourceForMovieOperation"},
|
||||||
{102, nullptr, "UnreserveResourceForMovieOperation"},
|
{102, nullptr, "UnreserveResourceForMovieOperation"},
|
||||||
{110, &ILibraryAppletSelfAccessor::GetMainAppletAvailableUsers, "GetMainAppletAvailableUsers"},
|
{110, nullptr, "GetMainAppletAvailableUsers"},
|
||||||
{120, nullptr, "GetLaunchStorageInfoForDebug"},
|
{120, nullptr, "GetLaunchStorageInfoForDebug"},
|
||||||
{130, nullptr, "GetGpuErrorDetectedSystemEvent"},
|
{130, nullptr, "GetGpuErrorDetectedSystemEvent"},
|
||||||
{140, nullptr, "SetApplicationMemoryReservation"},
|
{140, nullptr, "SetApplicationMemoryReservation"},
|
||||||
@ -1668,25 +1652,6 @@ void ILibraryAppletSelfAccessor::GetCallerAppletIdentityInfo(HLERequestContext&
|
|||||||
rb.PushRaw(applet_info);
|
rb.PushRaw(applet_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ILibraryAppletSelfAccessor::GetMainAppletAvailableUsers(HLERequestContext& ctx) {
|
|
||||||
const Service::Account::ProfileManager manager{};
|
|
||||||
bool is_empty{true};
|
|
||||||
s32 user_count{-1};
|
|
||||||
|
|
||||||
LOG_INFO(Service_AM, "called");
|
|
||||||
|
|
||||||
if (manager.GetUserCount() > 0) {
|
|
||||||
is_empty = false;
|
|
||||||
user_count = static_cast<s32>(manager.GetUserCount());
|
|
||||||
ctx.WriteBuffer(manager.GetAllUsers());
|
|
||||||
}
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 4};
|
|
||||||
rb.Push(ResultSuccess);
|
|
||||||
rb.Push<u8>(is_empty);
|
|
||||||
rb.Push(user_count);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ILibraryAppletSelfAccessor::PushInShowAlbum() {
|
void ILibraryAppletSelfAccessor::PushInShowAlbum() {
|
||||||
const Applets::CommonArguments arguments{
|
const Applets::CommonArguments arguments{
|
||||||
.arguments_version = Applets::CommonArgumentVersion::Version3,
|
.arguments_version = Applets::CommonArgumentVersion::Version3,
|
||||||
|
@ -124,8 +124,6 @@ public:
|
|||||||
private:
|
private:
|
||||||
void GetCallerAppletCaptureImageEx(HLERequestContext& ctx);
|
void GetCallerAppletCaptureImageEx(HLERequestContext& ctx);
|
||||||
void TakeScreenShotOfOwnLayer(HLERequestContext& ctx);
|
void TakeScreenShotOfOwnLayer(HLERequestContext& ctx);
|
||||||
void AcquireLastForegroundCaptureSharedBuffer(HLERequestContext& ctx);
|
|
||||||
void ReleaseLastForegroundCaptureSharedBuffer(HLERequestContext& ctx);
|
|
||||||
void AcquireCallerAppletCaptureSharedBuffer(HLERequestContext& ctx);
|
void AcquireCallerAppletCaptureSharedBuffer(HLERequestContext& ctx);
|
||||||
void ReleaseCallerAppletCaptureSharedBuffer(HLERequestContext& ctx);
|
void ReleaseCallerAppletCaptureSharedBuffer(HLERequestContext& ctx);
|
||||||
};
|
};
|
||||||
@ -347,7 +345,6 @@ private:
|
|||||||
void GetLibraryAppletInfo(HLERequestContext& ctx);
|
void GetLibraryAppletInfo(HLERequestContext& ctx);
|
||||||
void ExitProcessAndReturn(HLERequestContext& ctx);
|
void ExitProcessAndReturn(HLERequestContext& ctx);
|
||||||
void GetCallerAppletIdentityInfo(HLERequestContext& ctx);
|
void GetCallerAppletIdentityInfo(HLERequestContext& ctx);
|
||||||
void GetMainAppletAvailableUsers(HLERequestContext& ctx);
|
|
||||||
|
|
||||||
void PushInShowAlbum();
|
void PushInShowAlbum();
|
||||||
void PushInShowCabinetData();
|
void PushInShowCabinetData();
|
||||||
|
@ -23,17 +23,6 @@
|
|||||||
#include "core/hle/service/ipc_helpers.h"
|
#include "core/hle/service/ipc_helpers.h"
|
||||||
#include "core/memory.h"
|
#include "core/memory.h"
|
||||||
|
|
||||||
namespace {
|
|
||||||
static thread_local std::array read_buffer_data_a{
|
|
||||||
Common::ScratchBuffer<u8>(),
|
|
||||||
Common::ScratchBuffer<u8>(),
|
|
||||||
};
|
|
||||||
static thread_local std::array read_buffer_data_x{
|
|
||||||
Common::ScratchBuffer<u8>(),
|
|
||||||
Common::ScratchBuffer<u8>(),
|
|
||||||
};
|
|
||||||
} // Anonymous namespace
|
|
||||||
|
|
||||||
namespace Service {
|
namespace Service {
|
||||||
|
|
||||||
SessionRequestHandler::SessionRequestHandler(Kernel::KernelCore& kernel_, const char* service_name_)
|
SessionRequestHandler::SessionRequestHandler(Kernel::KernelCore& kernel_, const char* service_name_)
|
||||||
@ -339,57 +328,26 @@ std::vector<u8> HLERequestContext::ReadBufferCopy(std::size_t buffer_index) cons
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::span<const u8> HLERequestContext::ReadBufferA(std::size_t buffer_index) const {
|
|
||||||
static thread_local std::array read_buffer_a{
|
|
||||||
Core::Memory::CpuGuestMemory<u8, Core::Memory::GuestMemoryFlags::SafeRead>(memory, 0, 0),
|
|
||||||
Core::Memory::CpuGuestMemory<u8, Core::Memory::GuestMemoryFlags::SafeRead>(memory, 0, 0),
|
|
||||||
};
|
|
||||||
|
|
||||||
ASSERT_OR_EXECUTE_MSG(
|
|
||||||
BufferDescriptorA().size() > buffer_index, { return {}; },
|
|
||||||
"BufferDescriptorA invalid buffer_index {}", buffer_index);
|
|
||||||
auto& read_buffer = read_buffer_a[buffer_index];
|
|
||||||
return read_buffer.Read(BufferDescriptorA()[buffer_index].Address(),
|
|
||||||
BufferDescriptorA()[buffer_index].Size(),
|
|
||||||
&read_buffer_data_a[buffer_index]);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::span<const u8> HLERequestContext::ReadBufferX(std::size_t buffer_index) const {
|
|
||||||
static thread_local std::array read_buffer_x{
|
|
||||||
Core::Memory::CpuGuestMemory<u8, Core::Memory::GuestMemoryFlags::SafeRead>(memory, 0, 0),
|
|
||||||
Core::Memory::CpuGuestMemory<u8, Core::Memory::GuestMemoryFlags::SafeRead>(memory, 0, 0),
|
|
||||||
};
|
|
||||||
|
|
||||||
ASSERT_OR_EXECUTE_MSG(
|
|
||||||
BufferDescriptorX().size() > buffer_index, { return {}; },
|
|
||||||
"BufferDescriptorX invalid buffer_index {}", buffer_index);
|
|
||||||
auto& read_buffer = read_buffer_x[buffer_index];
|
|
||||||
return read_buffer.Read(BufferDescriptorX()[buffer_index].Address(),
|
|
||||||
BufferDescriptorX()[buffer_index].Size(),
|
|
||||||
&read_buffer_data_x[buffer_index]);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::span<const u8> HLERequestContext::ReadBuffer(std::size_t buffer_index) const {
|
std::span<const u8> HLERequestContext::ReadBuffer(std::size_t buffer_index) const {
|
||||||
static thread_local std::array read_buffer_a{
|
static thread_local std::array read_buffer_a{
|
||||||
Core::Memory::CpuGuestMemory<u8, Core::Memory::GuestMemoryFlags::SafeRead>(memory, 0, 0),
|
Core::Memory::CpuGuestMemory<u8, Core::Memory::GuestMemoryFlags::SafeRead>(memory, 0, 0),
|
||||||
Core::Memory::CpuGuestMemory<u8, Core::Memory::GuestMemoryFlags::SafeRead>(memory, 0, 0),
|
Core::Memory::CpuGuestMemory<u8, Core::Memory::GuestMemoryFlags::SafeRead>(memory, 0, 0),
|
||||||
};
|
};
|
||||||
|
static thread_local std::array read_buffer_data_a{
|
||||||
|
Common::ScratchBuffer<u8>(),
|
||||||
|
Common::ScratchBuffer<u8>(),
|
||||||
|
};
|
||||||
static thread_local std::array read_buffer_x{
|
static thread_local std::array read_buffer_x{
|
||||||
Core::Memory::CpuGuestMemory<u8, Core::Memory::GuestMemoryFlags::SafeRead>(memory, 0, 0),
|
Core::Memory::CpuGuestMemory<u8, Core::Memory::GuestMemoryFlags::SafeRead>(memory, 0, 0),
|
||||||
Core::Memory::CpuGuestMemory<u8, Core::Memory::GuestMemoryFlags::SafeRead>(memory, 0, 0),
|
Core::Memory::CpuGuestMemory<u8, Core::Memory::GuestMemoryFlags::SafeRead>(memory, 0, 0),
|
||||||
};
|
};
|
||||||
|
static thread_local std::array read_buffer_data_x{
|
||||||
|
Common::ScratchBuffer<u8>(),
|
||||||
|
Common::ScratchBuffer<u8>(),
|
||||||
|
};
|
||||||
|
|
||||||
const bool is_buffer_a{BufferDescriptorA().size() > buffer_index &&
|
const bool is_buffer_a{BufferDescriptorA().size() > buffer_index &&
|
||||||
BufferDescriptorA()[buffer_index].Size()};
|
BufferDescriptorA()[buffer_index].Size()};
|
||||||
const bool is_buffer_x{BufferDescriptorX().size() > buffer_index &&
|
|
||||||
BufferDescriptorX()[buffer_index].Size()};
|
|
||||||
|
|
||||||
if (is_buffer_a && is_buffer_x) {
|
|
||||||
LOG_WARNING(Input, "Both buffer descriptors are available a.size={}, x.size={}",
|
|
||||||
BufferDescriptorA()[buffer_index].Size(),
|
|
||||||
BufferDescriptorX()[buffer_index].Size());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_buffer_a) {
|
if (is_buffer_a) {
|
||||||
ASSERT_OR_EXECUTE_MSG(
|
ASSERT_OR_EXECUTE_MSG(
|
||||||
BufferDescriptorA().size() > buffer_index, { return {}; },
|
BufferDescriptorA().size() > buffer_index, { return {}; },
|
||||||
|
@ -253,12 +253,6 @@ public:
|
|||||||
return domain_message_header.has_value();
|
return domain_message_header.has_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Helper function to get a span of a buffer using the buffer descriptor A
|
|
||||||
[[nodiscard]] std::span<const u8> ReadBufferA(std::size_t buffer_index = 0) const;
|
|
||||||
|
|
||||||
/// Helper function to get a span of a buffer using the buffer descriptor X
|
|
||||||
[[nodiscard]] std::span<const u8> ReadBufferX(std::size_t buffer_index = 0) const;
|
|
||||||
|
|
||||||
/// Helper function to get a span of a buffer using the appropriate buffer descriptor
|
/// Helper function to get a span of a buffer using the appropriate buffer descriptor
|
||||||
[[nodiscard]] std::span<const u8> ReadBuffer(std::size_t buffer_index = 0) const;
|
[[nodiscard]] std::span<const u8> ReadBuffer(std::size_t buffer_index = 0) const;
|
||||||
|
|
||||||
|
@ -58,8 +58,14 @@ private:
|
|||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
const auto process_id = rp.PopRaw<u64>();
|
const auto process_id = rp.PopRaw<u64>();
|
||||||
|
|
||||||
const auto data1 = ctx.ReadBufferA(0);
|
const auto data1 = ctx.ReadBuffer(0);
|
||||||
const auto data2 = ctx.ReadBufferX(0);
|
const auto data2 = [&ctx] {
|
||||||
|
if (ctx.CanReadBuffer(1)) {
|
||||||
|
return ctx.ReadBuffer(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return std::span<const u8>{};
|
||||||
|
}();
|
||||||
|
|
||||||
LOG_DEBUG(Service_PREPO,
|
LOG_DEBUG(Service_PREPO,
|
||||||
"called, type={:02X}, process_id={:016X}, data1_size={:016X}, data2_size={:016X}",
|
"called, type={:02X}, process_id={:016X}, data1_size={:016X}, data2_size={:016X}",
|
||||||
@ -79,8 +85,14 @@ private:
|
|||||||
const auto user_id = rp.PopRaw<u128>();
|
const auto user_id = rp.PopRaw<u128>();
|
||||||
const auto process_id = rp.PopRaw<u64>();
|
const auto process_id = rp.PopRaw<u64>();
|
||||||
|
|
||||||
const auto data1 = ctx.ReadBufferA(0);
|
const auto data1 = ctx.ReadBuffer(0);
|
||||||
const auto data2 = ctx.ReadBufferX(0);
|
const auto data2 = [&ctx] {
|
||||||
|
if (ctx.CanReadBuffer(1)) {
|
||||||
|
return ctx.ReadBuffer(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return std::span<const u8>{};
|
||||||
|
}();
|
||||||
|
|
||||||
LOG_DEBUG(Service_PREPO,
|
LOG_DEBUG(Service_PREPO,
|
||||||
"called, type={:02X}, user_id={:016X}{:016X}, process_id={:016X}, "
|
"called, type={:02X}, user_id={:016X}{:016X}, process_id={:016X}, "
|
||||||
@ -125,8 +137,14 @@ private:
|
|||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
const auto title_id = rp.PopRaw<u64>();
|
const auto title_id = rp.PopRaw<u64>();
|
||||||
|
|
||||||
const auto data1 = ctx.ReadBufferA(0);
|
const auto data1 = ctx.ReadBuffer(0);
|
||||||
const auto data2 = ctx.ReadBufferX(0);
|
const auto data2 = [&ctx] {
|
||||||
|
if (ctx.CanReadBuffer(1)) {
|
||||||
|
return ctx.ReadBuffer(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return std::span<const u8>{};
|
||||||
|
}();
|
||||||
|
|
||||||
LOG_DEBUG(Service_PREPO, "called, title_id={:016X}, data1_size={:016X}, data2_size={:016X}",
|
LOG_DEBUG(Service_PREPO, "called, title_id={:016X}, data1_size={:016X}, data2_size={:016X}",
|
||||||
title_id, data1.size(), data2.size());
|
title_id, data1.size(), data2.size());
|
||||||
@ -143,8 +161,14 @@ private:
|
|||||||
const auto user_id = rp.PopRaw<u128>();
|
const auto user_id = rp.PopRaw<u128>();
|
||||||
const auto title_id = rp.PopRaw<u64>();
|
const auto title_id = rp.PopRaw<u64>();
|
||||||
|
|
||||||
const auto data1 = ctx.ReadBufferA(0);
|
const auto data1 = ctx.ReadBuffer(0);
|
||||||
const auto data2 = ctx.ReadBufferX(0);
|
const auto data2 = [&ctx] {
|
||||||
|
if (ctx.CanReadBuffer(1)) {
|
||||||
|
return ctx.ReadBuffer(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return std::span<const u8>{};
|
||||||
|
}();
|
||||||
|
|
||||||
LOG_DEBUG(Service_PREPO,
|
LOG_DEBUG(Service_PREPO,
|
||||||
"called, user_id={:016X}{:016X}, title_id={:016X}, data1_size={:016X}, "
|
"called, user_id={:016X}{:016X}, title_id={:016X}, data1_size={:016X}, "
|
||||||
|
@ -46,8 +46,8 @@ TEST_CASE("UniqueFunction", "[common]") {
|
|||||||
Noisy noisy;
|
Noisy noisy;
|
||||||
REQUIRE(noisy.state == "Default constructed");
|
REQUIRE(noisy.state == "Default constructed");
|
||||||
|
|
||||||
Common::UniqueFunction<void> func = [noisy_inner = std::move(noisy)] {
|
Common::UniqueFunction<void> func = [noisy = std::move(noisy)] {
|
||||||
REQUIRE(noisy_inner.state == "Move constructed");
|
REQUIRE(noisy.state == "Move constructed");
|
||||||
};
|
};
|
||||||
REQUIRE(noisy.state == "Moved away");
|
REQUIRE(noisy.state == "Moved away");
|
||||||
func();
|
func();
|
||||||
@ -101,7 +101,7 @@ TEST_CASE("UniqueFunction", "[common]") {
|
|||||||
};
|
};
|
||||||
Foo object{&num_destroyed};
|
Foo object{&num_destroyed};
|
||||||
{
|
{
|
||||||
Common::UniqueFunction<void> func = [object_inner = std::move(object)] {};
|
Common::UniqueFunction<void> func = [object = std::move(object)] {};
|
||||||
REQUIRE(num_destroyed == 0);
|
REQUIRE(num_destroyed == 0);
|
||||||
}
|
}
|
||||||
REQUIRE(num_destroyed == 1);
|
REQUIRE(num_destroyed == 1);
|
||||||
|
@ -62,11 +62,7 @@ using BufferId = SlotId;
|
|||||||
using VideoCore::Surface::PixelFormat;
|
using VideoCore::Surface::PixelFormat;
|
||||||
using namespace Common::Literals;
|
using namespace Common::Literals;
|
||||||
|
|
||||||
#ifdef __APPLE__
|
|
||||||
constexpr u32 NUM_VERTEX_BUFFERS = 16;
|
|
||||||
#else
|
|
||||||
constexpr u32 NUM_VERTEX_BUFFERS = 32;
|
constexpr u32 NUM_VERTEX_BUFFERS = 32;
|
||||||
#endif
|
|
||||||
constexpr u32 NUM_TRANSFORM_FEEDBACK_BUFFERS = 4;
|
constexpr u32 NUM_TRANSFORM_FEEDBACK_BUFFERS = 4;
|
||||||
constexpr u32 NUM_GRAPHICS_UNIFORM_BUFFERS = 18;
|
constexpr u32 NUM_GRAPHICS_UNIFORM_BUFFERS = 18;
|
||||||
constexpr u32 NUM_COMPUTE_UNIFORM_BUFFERS = 8;
|
constexpr u32 NUM_COMPUTE_UNIFORM_BUFFERS = 8;
|
||||||
|
@ -19,7 +19,6 @@ set(SHADER_FILES
|
|||||||
block_linear_unswizzle_2d.comp
|
block_linear_unswizzle_2d.comp
|
||||||
block_linear_unswizzle_3d.comp
|
block_linear_unswizzle_3d.comp
|
||||||
convert_abgr8_to_d24s8.frag
|
convert_abgr8_to_d24s8.frag
|
||||||
convert_abgr8_to_d32f.frag
|
|
||||||
convert_d32f_to_abgr8.frag
|
convert_d32f_to_abgr8.frag
|
||||||
convert_d24s8_to_abgr8.frag
|
convert_d24s8_to_abgr8.frag
|
||||||
convert_depth_to_float.frag
|
convert_depth_to_float.frag
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
#version 450
|
|
||||||
|
|
||||||
layout(binding = 0) uniform sampler2D color_texture;
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
ivec2 coord = ivec2(gl_FragCoord.xy);
|
|
||||||
vec4 color = texelFetch(color_texture, coord, 0).abgr;
|
|
||||||
|
|
||||||
float value = color.a * (color.r + color.g + color.b) / 3.0f;
|
|
||||||
|
|
||||||
gl_FragDepth = value;
|
|
||||||
}
|
|
@ -3,16 +3,16 @@
|
|||||||
|
|
||||||
#version 450
|
#version 450
|
||||||
|
|
||||||
precision mediump int;
|
|
||||||
precision highp float;
|
|
||||||
|
|
||||||
layout(binding = 0) uniform sampler2D depth_tex;
|
layout(binding = 0) uniform sampler2D depth_tex;
|
||||||
layout(binding = 1) uniform usampler2D stencil_tex;
|
layout(binding = 1) uniform isampler2D stencil_tex;
|
||||||
|
|
||||||
layout(location = 0) out vec4 color;
|
layout(location = 0) out vec4 color;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
ivec2 coord = ivec2(gl_FragCoord.xy);
|
ivec2 coord = ivec2(gl_FragCoord.xy);
|
||||||
|
uint depth = uint(textureLod(depth_tex, coord, 0).r * (exp2(24.0) - 1.0f));
|
||||||
|
uint stencil = uint(textureLod(stencil_tex, coord, 0).r);
|
||||||
|
|
||||||
highp uint depth_val =
|
highp uint depth_val =
|
||||||
uint(textureLod(depth_tex, coord, 0).r * (exp2(32.0) - 1.0));
|
uint(textureLod(depth_tex, coord, 0).r * (exp2(32.0) - 1.0));
|
||||||
lowp uint stencil_val = textureLod(stencil_tex, coord, 0).r;
|
lowp uint stencil_val = textureLod(stencil_tex, coord, 0).r;
|
||||||
|
@ -9,6 +9,6 @@ layout(location = 0) out vec4 color;
|
|||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
ivec2 coord = ivec2(gl_FragCoord.xy);
|
ivec2 coord = ivec2(gl_FragCoord.xy);
|
||||||
float depth = texelFetch(depth_tex, coord, 0).r;
|
float depth = textureLod(depth_tex, coord, 0).r;
|
||||||
color = vec4(depth, depth, depth, 1.0);
|
color = vec4(depth, depth, depth, 1.0);
|
||||||
}
|
}
|
||||||
|
@ -3,16 +3,16 @@
|
|||||||
|
|
||||||
#version 450
|
#version 450
|
||||||
|
|
||||||
precision mediump int;
|
|
||||||
precision highp float;
|
|
||||||
|
|
||||||
layout(binding = 0) uniform sampler2D depth_tex;
|
layout(binding = 0) uniform sampler2D depth_tex;
|
||||||
layout(binding = 1) uniform usampler2D stencil_tex;
|
layout(binding = 1) uniform isampler2D stencil_tex;
|
||||||
|
|
||||||
layout(location = 0) out vec4 color;
|
layout(location = 0) out vec4 color;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
ivec2 coord = ivec2(gl_FragCoord.xy);
|
ivec2 coord = ivec2(gl_FragCoord.xy);
|
||||||
|
uint depth = uint(textureLod(depth_tex, coord, 0).r * (exp2(24.0) - 1.0f));
|
||||||
|
uint stencil = uint(textureLod(stencil_tex, coord, 0).r);
|
||||||
|
|
||||||
highp uint depth_val =
|
highp uint depth_val =
|
||||||
uint(textureLod(depth_tex, coord, 0).r * (exp2(32.0) - 1.0));
|
uint(textureLod(depth_tex, coord, 0).r * (exp2(32.0) - 1.0));
|
||||||
lowp uint stencil_val = textureLod(stencil_tex, coord, 0).r;
|
lowp uint stencil_val = textureLod(stencil_tex, coord, 0).r;
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
#include "common/settings.h"
|
#include "common/settings.h"
|
||||||
#include "video_core/host_shaders/blit_color_float_frag_spv.h"
|
#include "video_core/host_shaders/blit_color_float_frag_spv.h"
|
||||||
#include "video_core/host_shaders/convert_abgr8_to_d24s8_frag_spv.h"
|
#include "video_core/host_shaders/convert_abgr8_to_d24s8_frag_spv.h"
|
||||||
#include "video_core/host_shaders/convert_abgr8_to_d32f_frag_spv.h"
|
|
||||||
#include "video_core/host_shaders/convert_d24s8_to_abgr8_frag_spv.h"
|
#include "video_core/host_shaders/convert_d24s8_to_abgr8_frag_spv.h"
|
||||||
#include "video_core/host_shaders/convert_d32f_to_abgr8_frag_spv.h"
|
#include "video_core/host_shaders/convert_d32f_to_abgr8_frag_spv.h"
|
||||||
#include "video_core/host_shaders/convert_depth_to_float_frag_spv.h"
|
#include "video_core/host_shaders/convert_depth_to_float_frag_spv.h"
|
||||||
@ -435,7 +434,6 @@ BlitImageHelper::BlitImageHelper(const Device& device_, Scheduler& scheduler_,
|
|||||||
convert_depth_to_float_frag(BuildShader(device, CONVERT_DEPTH_TO_FLOAT_FRAG_SPV)),
|
convert_depth_to_float_frag(BuildShader(device, CONVERT_DEPTH_TO_FLOAT_FRAG_SPV)),
|
||||||
convert_float_to_depth_frag(BuildShader(device, CONVERT_FLOAT_TO_DEPTH_FRAG_SPV)),
|
convert_float_to_depth_frag(BuildShader(device, CONVERT_FLOAT_TO_DEPTH_FRAG_SPV)),
|
||||||
convert_abgr8_to_d24s8_frag(BuildShader(device, CONVERT_ABGR8_TO_D24S8_FRAG_SPV)),
|
convert_abgr8_to_d24s8_frag(BuildShader(device, CONVERT_ABGR8_TO_D24S8_FRAG_SPV)),
|
||||||
convert_abgr8_to_d32f_frag(BuildShader(device, CONVERT_ABGR8_TO_D32F_FRAG_SPV)),
|
|
||||||
convert_d32f_to_abgr8_frag(BuildShader(device, CONVERT_D32F_TO_ABGR8_FRAG_SPV)),
|
convert_d32f_to_abgr8_frag(BuildShader(device, CONVERT_D32F_TO_ABGR8_FRAG_SPV)),
|
||||||
convert_d24s8_to_abgr8_frag(BuildShader(device, CONVERT_D24S8_TO_ABGR8_FRAG_SPV)),
|
convert_d24s8_to_abgr8_frag(BuildShader(device, CONVERT_D24S8_TO_ABGR8_FRAG_SPV)),
|
||||||
convert_s8d24_to_abgr8_frag(BuildShader(device, CONVERT_S8D24_TO_ABGR8_FRAG_SPV)),
|
convert_s8d24_to_abgr8_frag(BuildShader(device, CONVERT_S8D24_TO_ABGR8_FRAG_SPV)),
|
||||||
@ -561,13 +559,6 @@ void BlitImageHelper::ConvertABGR8ToD24S8(const Framebuffer* dst_framebuffer,
|
|||||||
Convert(*convert_abgr8_to_d24s8_pipeline, dst_framebuffer, src_image_view);
|
Convert(*convert_abgr8_to_d24s8_pipeline, dst_framebuffer, src_image_view);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BlitImageHelper::ConvertABGR8ToD32F(const Framebuffer* dst_framebuffer,
|
|
||||||
const ImageView& src_image_view) {
|
|
||||||
ConvertPipelineDepthTargetEx(convert_abgr8_to_d32f_pipeline, dst_framebuffer->RenderPass(),
|
|
||||||
convert_abgr8_to_d32f_frag);
|
|
||||||
Convert(*convert_abgr8_to_d32f_pipeline, dst_framebuffer, src_image_view);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BlitImageHelper::ConvertD32FToABGR8(const Framebuffer* dst_framebuffer,
|
void BlitImageHelper::ConvertD32FToABGR8(const Framebuffer* dst_framebuffer,
|
||||||
ImageView& src_image_view) {
|
ImageView& src_image_view) {
|
||||||
ConvertPipelineColorTargetEx(convert_d32f_to_abgr8_pipeline, dst_framebuffer->RenderPass(),
|
ConvertPipelineColorTargetEx(convert_d32f_to_abgr8_pipeline, dst_framebuffer->RenderPass(),
|
||||||
|
@ -67,8 +67,6 @@ public:
|
|||||||
|
|
||||||
void ConvertABGR8ToD24S8(const Framebuffer* dst_framebuffer, const ImageView& src_image_view);
|
void ConvertABGR8ToD24S8(const Framebuffer* dst_framebuffer, const ImageView& src_image_view);
|
||||||
|
|
||||||
void ConvertABGR8ToD32F(const Framebuffer* dst_framebuffer, const ImageView& src_image_view);
|
|
||||||
|
|
||||||
void ConvertD32FToABGR8(const Framebuffer* dst_framebuffer, ImageView& src_image_view);
|
void ConvertD32FToABGR8(const Framebuffer* dst_framebuffer, ImageView& src_image_view);
|
||||||
|
|
||||||
void ConvertD24S8ToABGR8(const Framebuffer* dst_framebuffer, ImageView& src_image_view);
|
void ConvertD24S8ToABGR8(const Framebuffer* dst_framebuffer, ImageView& src_image_view);
|
||||||
@ -132,7 +130,6 @@ private:
|
|||||||
vk::ShaderModule convert_depth_to_float_frag;
|
vk::ShaderModule convert_depth_to_float_frag;
|
||||||
vk::ShaderModule convert_float_to_depth_frag;
|
vk::ShaderModule convert_float_to_depth_frag;
|
||||||
vk::ShaderModule convert_abgr8_to_d24s8_frag;
|
vk::ShaderModule convert_abgr8_to_d24s8_frag;
|
||||||
vk::ShaderModule convert_abgr8_to_d32f_frag;
|
|
||||||
vk::ShaderModule convert_d32f_to_abgr8_frag;
|
vk::ShaderModule convert_d32f_to_abgr8_frag;
|
||||||
vk::ShaderModule convert_d24s8_to_abgr8_frag;
|
vk::ShaderModule convert_d24s8_to_abgr8_frag;
|
||||||
vk::ShaderModule convert_s8d24_to_abgr8_frag;
|
vk::ShaderModule convert_s8d24_to_abgr8_frag;
|
||||||
@ -152,7 +149,6 @@ private:
|
|||||||
vk::Pipeline convert_d16_to_r16_pipeline;
|
vk::Pipeline convert_d16_to_r16_pipeline;
|
||||||
vk::Pipeline convert_r16_to_d16_pipeline;
|
vk::Pipeline convert_r16_to_d16_pipeline;
|
||||||
vk::Pipeline convert_abgr8_to_d24s8_pipeline;
|
vk::Pipeline convert_abgr8_to_d24s8_pipeline;
|
||||||
vk::Pipeline convert_abgr8_to_d32f_pipeline;
|
|
||||||
vk::Pipeline convert_d32f_to_abgr8_pipeline;
|
vk::Pipeline convert_d32f_to_abgr8_pipeline;
|
||||||
vk::Pipeline convert_d24s8_to_abgr8_pipeline;
|
vk::Pipeline convert_d24s8_to_abgr8_pipeline;
|
||||||
vk::Pipeline convert_s8d24_to_abgr8_pipeline;
|
vk::Pipeline convert_s8d24_to_abgr8_pipeline;
|
||||||
|
@ -1436,7 +1436,6 @@ void QueryCacheRuntime::Barriers(bool is_prebarrier) {
|
|||||||
.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT,
|
.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT,
|
||||||
.dstAccessMask = VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT,
|
.dstAccessMask = VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT,
|
||||||
};
|
};
|
||||||
impl->scheduler.RequestOutsideRenderPassOperationContext();
|
|
||||||
if (is_prebarrier) {
|
if (is_prebarrier) {
|
||||||
impl->scheduler.Record([](vk::CommandBuffer cmdbuf) {
|
impl->scheduler.Record([](vk::CommandBuffer cmdbuf) {
|
||||||
cmdbuf.PipelineBarrier(VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
|
cmdbuf.PipelineBarrier(VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
|
||||||
|
@ -975,19 +975,6 @@ void RasterizerVulkan::UpdateScissorsState(Tegra::Engines::Maxwell3D::Regs& regs
|
|||||||
if (!state_tracker.TouchScissors()) {
|
if (!state_tracker.TouchScissors()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!regs.viewport_scale_offset_enabled) {
|
|
||||||
const auto x = static_cast<float>(regs.surface_clip.x);
|
|
||||||
const auto y = static_cast<float>(regs.surface_clip.y);
|
|
||||||
const auto width = static_cast<float>(regs.surface_clip.width);
|
|
||||||
const auto height = static_cast<float>(regs.surface_clip.height);
|
|
||||||
VkRect2D scissor;
|
|
||||||
scissor.offset.x = static_cast<u32>(x);
|
|
||||||
scissor.offset.y = static_cast<u32>(y);
|
|
||||||
scissor.extent.width = static_cast<u32>(width != 0.0f ? width : 1.0f);
|
|
||||||
scissor.extent.height = static_cast<u32>(height != 0.0f ? height : 1.0f);
|
|
||||||
scheduler.Record([scissor](vk::CommandBuffer cmdbuf) { cmdbuf.SetScissor(0, scissor); });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
u32 up_scale = 1;
|
u32 up_scale = 1;
|
||||||
u32 down_shift = 0;
|
u32 down_shift = 0;
|
||||||
if (texture_cache.IsRescaling()) {
|
if (texture_cache.IsRescaling()) {
|
||||||
|
@ -19,7 +19,7 @@ VkAttachmentDescription AttachmentDescription(const Device& device, PixelFormat
|
|||||||
VkSampleCountFlagBits samples) {
|
VkSampleCountFlagBits samples) {
|
||||||
using MaxwellToVK::SurfaceFormat;
|
using MaxwellToVK::SurfaceFormat;
|
||||||
return {
|
return {
|
||||||
.flags = {},
|
.flags = VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT,
|
||||||
.format = SurfaceFormat(device, FormatType::Optimal, true, format).format,
|
.format = SurfaceFormat(device, FormatType::Optimal, true, format).format,
|
||||||
.samples = samples,
|
.samples = samples,
|
||||||
.loadOp = VK_ATTACHMENT_LOAD_OP_LOAD,
|
.loadOp = VK_ATTACHMENT_LOAD_OP_LOAD,
|
||||||
|
@ -1194,11 +1194,6 @@ void TextureCacheRuntime::ConvertImage(Framebuffer* dst, ImageView& dst_view, Im
|
|||||||
return blit_image_helper.ConvertD16ToR16(dst, src_view);
|
return blit_image_helper.ConvertD16ToR16(dst, src_view);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PixelFormat::A8B8G8R8_SRGB:
|
|
||||||
if (src_view.format == PixelFormat::D32_FLOAT) {
|
|
||||||
return blit_image_helper.ConvertD32FToABGR8(dst, src_view);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case PixelFormat::A8B8G8R8_UNORM:
|
case PixelFormat::A8B8G8R8_UNORM:
|
||||||
if (src_view.format == PixelFormat::S8_UINT_D24_UNORM) {
|
if (src_view.format == PixelFormat::S8_UINT_D24_UNORM) {
|
||||||
return blit_image_helper.ConvertD24S8ToABGR8(dst, src_view);
|
return blit_image_helper.ConvertD24S8ToABGR8(dst, src_view);
|
||||||
@ -1210,16 +1205,6 @@ void TextureCacheRuntime::ConvertImage(Framebuffer* dst, ImageView& dst_view, Im
|
|||||||
return blit_image_helper.ConvertD32FToABGR8(dst, src_view);
|
return blit_image_helper.ConvertD32FToABGR8(dst, src_view);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PixelFormat::B8G8R8A8_SRGB:
|
|
||||||
if (src_view.format == PixelFormat::D32_FLOAT) {
|
|
||||||
return blit_image_helper.ConvertD32FToABGR8(dst, src_view);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case PixelFormat::B8G8R8A8_UNORM:
|
|
||||||
if (src_view.format == PixelFormat::D32_FLOAT) {
|
|
||||||
return blit_image_helper.ConvertD32FToABGR8(dst, src_view);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case PixelFormat::R32_FLOAT:
|
case PixelFormat::R32_FLOAT:
|
||||||
if (src_view.format == PixelFormat::D32_FLOAT) {
|
if (src_view.format == PixelFormat::D32_FLOAT) {
|
||||||
return blit_image_helper.ConvertD32ToR32(dst, src_view);
|
return blit_image_helper.ConvertD32ToR32(dst, src_view);
|
||||||
@ -1237,12 +1222,6 @@ void TextureCacheRuntime::ConvertImage(Framebuffer* dst, ImageView& dst_view, Im
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PixelFormat::D32_FLOAT:
|
case PixelFormat::D32_FLOAT:
|
||||||
if (src_view.format == PixelFormat::A8B8G8R8_UNORM ||
|
|
||||||
src_view.format == PixelFormat::B8G8R8A8_UNORM ||
|
|
||||||
src_view.format == PixelFormat::A8B8G8R8_SRGB ||
|
|
||||||
src_view.format == PixelFormat::B8G8R8A8_SRGB) {
|
|
||||||
return blit_image_helper.ConvertABGR8ToD32F(dst, src_view);
|
|
||||||
}
|
|
||||||
if (src_view.format == PixelFormat::R32_FLOAT) {
|
if (src_view.format == PixelFormat::R32_FLOAT) {
|
||||||
return blit_image_helper.ConvertR32ToD32(dst, src_view);
|
return blit_image_helper.ConvertR32ToD32(dst, src_view);
|
||||||
}
|
}
|
||||||
@ -2055,7 +2034,7 @@ void TextureCacheRuntime::TransitionImageLayout(Image& image) {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
scheduler.RequestOutsideRenderPassOperationContext();
|
scheduler.RequestOutsideRenderPassOperationContext();
|
||||||
scheduler.Record([barrier](vk::CommandBuffer cmdbuf) {
|
scheduler.Record([barrier = barrier](vk::CommandBuffer cmdbuf) {
|
||||||
cmdbuf.PipelineBarrier(VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
|
cmdbuf.PipelineBarrier(VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
|
||||||
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, 0, barrier);
|
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, 0, barrier);
|
||||||
});
|
});
|
||||||
|
@ -10,23 +10,19 @@
|
|||||||
#include "video_core/texture_cache/image_info.h"
|
#include "video_core/texture_cache/image_info.h"
|
||||||
#include "video_core/texture_cache/image_view_base.h"
|
#include "video_core/texture_cache/image_view_base.h"
|
||||||
#include "video_core/texture_cache/render_targets.h"
|
#include "video_core/texture_cache/render_targets.h"
|
||||||
#include "video_core/texture_cache/samples_helper.h"
|
|
||||||
|
|
||||||
namespace VideoCommon {
|
namespace VideoCommon {
|
||||||
|
|
||||||
std::string Name(const ImageBase& image) {
|
std::string Name(const ImageBase& image) {
|
||||||
const GPUVAddr gpu_addr = image.gpu_addr;
|
const GPUVAddr gpu_addr = image.gpu_addr;
|
||||||
const ImageInfo& info = image.info;
|
const ImageInfo& info = image.info;
|
||||||
u32 width = info.size.width;
|
const u32 width = info.size.width;
|
||||||
u32 height = info.size.height;
|
const u32 height = info.size.height;
|
||||||
const u32 depth = info.size.depth;
|
const u32 depth = info.size.depth;
|
||||||
const u32 num_layers = image.info.resources.layers;
|
const u32 num_layers = image.info.resources.layers;
|
||||||
const u32 num_levels = image.info.resources.levels;
|
const u32 num_levels = image.info.resources.levels;
|
||||||
std::string resource;
|
std::string resource;
|
||||||
if (image.info.num_samples > 1) {
|
if (image.info.num_samples > 1) {
|
||||||
const auto [samples_x, samples_y] = VideoCommon::SamplesLog2(image.info.num_samples);
|
|
||||||
width >>= samples_x;
|
|
||||||
height >>= samples_y;
|
|
||||||
resource += fmt::format(":{}xMSAA", image.info.num_samples);
|
resource += fmt::format(":{}xMSAA", image.info.num_samples);
|
||||||
}
|
}
|
||||||
if (num_layers > 1) {
|
if (num_layers > 1) {
|
||||||
|
@ -24,7 +24,7 @@ namespace VideoCommon {
|
|||||||
return {2, 2};
|
return {2, 2};
|
||||||
}
|
}
|
||||||
ASSERT_MSG(false, "Invalid number of samples={}", num_samples);
|
ASSERT_MSG(false, "Invalid number of samples={}", num_samples);
|
||||||
return {0, 0};
|
return {1, 1};
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] inline int NumSamples(Tegra::Texture::MsaaMode msaa_mode) {
|
[[nodiscard]] inline int NumSamples(Tegra::Texture::MsaaMode msaa_mode) {
|
||||||
|
@ -167,13 +167,6 @@ template <u32 GOB_EXTENT>
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] constexpr Extent3D TileShift(const LevelInfo& info, u32 level) {
|
[[nodiscard]] constexpr Extent3D TileShift(const LevelInfo& info, u32 level) {
|
||||||
if (level == 0 && info.num_levels == 1) {
|
|
||||||
return Extent3D{
|
|
||||||
.width = info.block.width,
|
|
||||||
.height = info.block.height,
|
|
||||||
.depth = info.block.depth,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
const Extent3D blocks = NumLevelBlocks(info, level);
|
const Extent3D blocks = NumLevelBlocks(info, level);
|
||||||
return Extent3D{
|
return Extent3D{
|
||||||
.width = AdjustTileSize(info.block.width, GOB_SIZE_X, blocks.width),
|
.width = AdjustTileSize(info.block.width, GOB_SIZE_X, blocks.width),
|
||||||
@ -1300,9 +1293,9 @@ u32 MapSizeBytes(const ImageBase& image) {
|
|||||||
|
|
||||||
static_assert(CalculateLevelSize(LevelInfo{{1920, 1080, 1}, {0, 2, 0}, {1, 1}, 2, 0, 1}, 0) ==
|
static_assert(CalculateLevelSize(LevelInfo{{1920, 1080, 1}, {0, 2, 0}, {1, 1}, 2, 0, 1}, 0) ==
|
||||||
0x7f8000);
|
0x7f8000);
|
||||||
static_assert(CalculateLevelSize(LevelInfo{{32, 32, 1}, {0, 0, 4}, {1, 1}, 4, 0, 1}, 0) == 0x40000);
|
static_assert(CalculateLevelSize(LevelInfo{{32, 32, 1}, {0, 0, 4}, {1, 1}, 4, 0, 1}, 0) == 0x4000);
|
||||||
|
|
||||||
static_assert(CalculateLevelSize(LevelInfo{{128, 8, 1}, {0, 4, 0}, {1, 1}, 4, 0, 1}, 0) == 0x40000);
|
static_assert(CalculateLevelSize(LevelInfo{{128, 8, 1}, {0, 4, 0}, {1, 1}, 4, 0, 1}, 0) == 0x4000);
|
||||||
|
|
||||||
static_assert(CalculateLevelOffset(PixelFormat::R8_SINT, {1920, 1080, 1}, {0, 2, 0}, 0, 7) ==
|
static_assert(CalculateLevelOffset(PixelFormat::R8_SINT, {1920, 1080, 1}, {0, 2, 0}, 0, 7) ==
|
||||||
0x2afc00);
|
0x2afc00);
|
||||||
|
Reference in New Issue
Block a user