1
0
Fork 0
forked from suyu/suyu

Experimental Changes

This commit is contained in:
Crunch (Chaz9) 2024-09-29 22:15:35 +01:00
parent 63a7be030f
commit 6803515773
4 changed files with 116 additions and 1 deletions

View file

@ -23,4 +23,9 @@ void LoopProcess(Core::System& system) {
ServerManager::RunServer(std::move(server_manager));
}
bool IsFirmwareVersionSupported(u32 version) {
// Add support for firmware version 18.0.0
return version <= 180000; // 18.0.0 = 180000
}
} // namespace Service::Set

View file

@ -0,0 +1,76 @@
// SPDX-FileCopyrightText: Copyright 2024 suyu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include <algorithm>
#include <string>
#include <vector>
#include "common/logging/log.h"
#include "core/core.h"
#include "core/file_sys/content_archive.h"
#include "core/file_sys/patch_manager.h"
#include "core/file_sys/registered_cache.h"
#include "core/hle/service/filesystem/filesystem.h"
#include "core/loader/loader.h"
#include "core/nintendo_switch_library.h"
namespace Core {
NintendoSwitchLibrary::NintendoSwitchLibrary(Core::System& system) : system(system) {}
std::vector<NintendoSwitchLibrary::GameInfo> NintendoSwitchLibrary::GetInstalledGames() {
std::vector<GameInfo> games;
const auto& cache = system.GetContentProvider().GetUserNANDCache();
for (const auto& nca : cache.GetAllEntries()) {
if (nca.second == FileSys::ContentRecordType::Program) {
const auto program_id = nca.first;
const auto title_name = GetGameName(program_id);
const auto file_path = cache.GetEntryUnparsed(program_id, FileSys::ContentRecordType::Program);
if (title_name.empty() || file_path.empty()) {
continue;
}
games.push_back({program_id, title_name, file_path});
}
}
return games;
}
std::string NintendoSwitchLibrary::GetGameName(u64 program_id) {
const auto& patch_manager = system.GetFileSystemController().GetPatchManager(program_id);
const auto metadata = patch_manager.GetControlMetadata();
if (metadata.first != nullptr) {
return metadata.first->GetApplicationName();
}
return "";
}
bool NintendoSwitchLibrary::LaunchGame(u64 program_id) {
const auto file_path = system.GetContentProvider().GetUserNANDCache().GetEntryUnparsed(program_id, FileSys::ContentRecordType::Program);
if (file_path.empty()) {
LOG_ERROR(Core, "Failed to launch game. File not found for program_id={:016X}", program_id);
return false;
}
const auto loader = Loader::GetLoader(system, file_path);
if (!loader) {
LOG_ERROR(Core, "Failed to create loader for game. program_id={:016X}", program_id);
return false;
}
const auto result = system.Load(*loader);
if (result != ResultStatus::Success) {
LOG_ERROR(Core, "Failed to load game. Error: {}, program_id={:016X}", result, program_id);
return false;
}
return true;
}
} // namespace Core

View file

@ -0,0 +1,33 @@
// SPDX-FileCopyrightText: Copyright 2024 suyu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <string>
#include <vector>
#include "common/common_types.h"
namespace Core {
class System;
class NintendoSwitchLibrary {
public:
struct GameInfo {
u64 program_id;
std::string title;
std::string file_path;
};
explicit NintendoSwitchLibrary(Core::System& system);
std::vector<GameInfo> GetInstalledGames();
std::string GetGameName(u64 program_id);
bool LaunchGame(u64 program_id);
private:
Core::System& system;
};
} // namespace Core

View file

@ -24,6 +24,7 @@
#include "video_core/renderer_vulkan/vk_update_descriptor.h"
#include "video_core/vulkan_common/vulkan_memory_allocator.h"
#include "video_core/vulkan_common/vulkan_wrapper.h"
#include "video_core/optimized_rasterizer.h"
namespace Core {
class System;
@ -73,7 +74,7 @@ private:
Scheduler& scheduler;
};
class RasterizerVulkan final : public VideoCore::RasterizerInterface,
class RasterizerVulkan final : public VideoCore::OptimizedRasterizer,
protected VideoCommon::ChannelSetupCaches<VideoCommon::ChannelInfo> {
public:
explicit RasterizerVulkan(Core::Frontend::EmuWindow& emu_window_, Tegra::GPU& gpu_,