This commit is contained in:
linkmauve 2025-01-11 21:27:07 +02:00 committed by GitHub
commit 528e8a17d9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 44 additions and 22 deletions

View file

@ -8,7 +8,7 @@ class MikageConan(ConanFile):
requires = [
#"boost/1.79.0",
"boost/1.84.0",
"spdlog/1.10.0",
"spdlog/1.15.0",
"cryptopp/8.5.0",
"sdl/2.30.7", # 2.0.18 fixed swapped X/Y buttons on Switch Pro Controller
"range-v3/0.12.0",
@ -17,7 +17,7 @@ class MikageConan(ConanFile):
"spirv-tools/1.3.268.0",
"tracy/0.11.1",
"xxhash/0.8.0",
"fmt/8.1.1",
"fmt/11.1.1",
]
options = {

View file

@ -36,7 +36,7 @@ enum class GenericImageFormat {
template<> struct fmt::formatter<GenericImageFormat> : fmt::formatter<std::string_view> {
template<typename FormatContext>
auto format(GenericImageFormat format, FormatContext& ctx) -> decltype(ctx.out()) {
auto format(GenericImageFormat format, FormatContext& ctx) const -> decltype(ctx.out()) {
std::string_view name = std::invoke([format]() -> std::string_view {
switch (format) {
case GenericImageFormat::RGBA8: return "RGBA8";

View file

@ -800,8 +800,9 @@ std::optional<std::string> GDBStub::HandlePacket(const std::string& command) {
auto emu_process = std::dynamic_pointer_cast<HLE::OS::EmuProcess>(process);
if (!emu_process) {
auto process_printer = HLE::OS::ProcessPrinter { *process.get() };
logger->warn("Debugger attempting to attach to non-emulated process {} ({})",
pid_opt->first, process);
pid_opt->first, process_printer);
return "E02";
}

View file

@ -1406,7 +1406,7 @@ void MemoryManager::TransferOwnership( std::shared_ptr<MemoryBlockOwner> old_ow
const uint32_t chunk_addr = block_it->first;
const uint32_t chunk_size = block_it->second.size_bytes;
fmt::print("Chunk: {:#x}-{:#x} (owner {})\n", chunk_addr, chunk_addr + chunk_size, fmt::ptr(block_it->second.owner.lock()));
fmt::print("Chunk: {:#x}-{:#x} (owner {})\n", chunk_addr, chunk_addr + chunk_size, fmt::ptr(block_it->second.owner.lock().get()));
ValidateContract(!block_it->second.owner.expired());
@ -3494,7 +3494,7 @@ void OS::TranslateIPCMessage(Thread& source, Thread& dest, bool is_reply) {
}
source.GetLogger()->info("{}Copying {}/{} bytes of static buffer data from {:#010x} to {:#010x} in thread {}:",
ThreadPrinter{source}, descriptor.static_buffer.size, dest_buffer_size, source_data_addr,
ThreadPrinter{source}, descriptor.static_buffer.size.Value(), dest_buffer_size, source_data_addr,
dest_buffer_addr, ThreadPrinter{dest});
std::string data;
auto max_size = std::min<uint32_t>(64, descriptor.static_buffer.size);
@ -3544,7 +3544,7 @@ void OS::TranslateIPCMessage(Thread& source, Thread& dest, bool is_reply) {
uint32_t static_buffer_offset = 0;
source.GetLogger()->info("{}Setting up PXI buffer table {:#x} at address {:#x} in target process",
ThreadPrinter{source}, descriptor.pxi_buffer.id, dest_buffer_addr);
ThreadPrinter{source}, descriptor.pxi_buffer.id.Value(), dest_buffer_addr);
auto base_physical_chunk = ResolveVirtualAddrWithSize(source.GetParentProcess(), buffer_address);
if (!base_physical_chunk) {
@ -3581,7 +3581,7 @@ void OS::TranslateIPCMessage(Thread& source, Thread& dest, bool is_reply) {
dest.WriteMemory32(dest_buffer_addr + static_buffer_offset + 4, buffer_size);
source.GetLogger()->info("Added PXI physical memory chunk {:#x} of size {:#x} in static buffer {} at {:#x}",
base_physical_chunk->first, buffer_size, descriptor.pxi_buffer.id, dest_buffer_addr + static_buffer_offset);
base_physical_chunk->first, buffer_size, descriptor.pxi_buffer.id.Value(), dest_buffer_addr + static_buffer_offset);
static_buffer_offset += 8;
@ -3613,7 +3613,7 @@ void OS::TranslateIPCMessage(Thread& source, Thread& dest, bool is_reply) {
dest.WriteMemory32(dest_buffer_addr + static_buffer_offset + 4, chunk_size);
source.GetLogger()->info("Added PXI physical memory chunk {:#x} of size {:#x} in static buffer {} at {:#x}",
physical_chunk_address, chunk_size, descriptor.pxi_buffer.id, dest_buffer_addr + static_buffer_offset);
physical_chunk_address, chunk_size, descriptor.pxi_buffer.id.Value(), dest_buffer_addr + static_buffer_offset);
static_buffer_offset += 8;

View file

@ -2044,5 +2044,11 @@ std::ostream& operator<<(std::ostream& os, const HandlePrinter& printer);
} // namespace HLE
template <> struct fmt::formatter<HLE::OS::ProcessPrinter> : ostream_formatter {};
template <> struct fmt::formatter<HLE::OS::ThreadPrinter> : ostream_formatter {};
template <> struct fmt::formatter<HLE::OS::ObjectRefPrinter> : ostream_formatter {};
template <> struct fmt::formatter<HLE::OS::ObjectPrinter> : ostream_formatter {};
template <> struct fmt::formatter<HLE::OS::HandlePrinter> : ostream_formatter {};
// Now that we're done with the definitions, include some definitions that are required to instantiate the above structs (e.g. due to unique_ptr being used on incomplete types)
#include "gdb_stub.h"

View file

@ -3,6 +3,7 @@
#include "os.hpp"
#include <platform/am.hpp>
#include <fmt/ranges.h>
namespace HLE {

View file

@ -785,7 +785,7 @@ void FakeDSP::OnIPCRequest(FakeThread& thread, Handle sender, const IPC::Command
default:
// TODO: Throw and catch IPCError instead
throw std::runtime_error(fmt::format("Unknown DSP IPC request {:#x}", header.command_id));
throw std::runtime_error(fmt::format("Unknown DSP IPC request {:#x}", header.command_id.Value()));
}
}

View file

@ -35,6 +35,8 @@
#include <iostream>
#include <sstream>
#include <fmt/std.h>
using namespace Platform::FS;
namespace HLE {
@ -1818,7 +1820,7 @@ static decltype(HLE::OS::ServiceHelper::SendReply) OnFileIPCRequest(FakeThread&
return HLE::OS::ServiceHelper::SendReply;
} catch (std::ios_base::failure& err) {
thread.GetLogger()->error("Unexpected fstream exception in File IPC command {:#x} handled via object {}: {}",
header.command_id, boost::core::demangle(typeid(*file).name()),
header.command_id.Value(), boost::core::demangle(typeid(*file).name()),
IosExceptionInfo(err));
throw;
}
@ -1860,7 +1862,7 @@ static decltype(HLE::OS::ServiceHelper::SendReply) OnDirIPCRequest(FakeThread& t
return HLE::OS::ServiceHelper::SendReply;
} catch (std::ios_base::failure& err) {
thread.GetLogger()->error("Unexpected fstream exception in Directory IPC command {:#x} handled via object {}: {}",
header.command_id, boost::core::demangle(typeid(dir).name()),
header.command_id.Value(), boost::core::demangle(typeid(dir).name()),
IosExceptionInfo(err));
throw;
}

View file

@ -8,6 +8,8 @@
#include <codecvt>
#include <fmt/std.h>
namespace HLE {
CommonPath CommonPath::FromUtf16(std::u16string_view utf16_data) {

View file

@ -17,6 +17,8 @@
#include <codecvt>
#include <variant>
#include <fmt/ranges.h>
namespace HLE {
namespace OS {

View file

@ -24,6 +24,8 @@
#include <iostream>
#include <sstream>
#include <fmt/ostream.h>
std::vector<uint64_t>* nand_titles = nullptr;
namespace std {
@ -36,6 +38,8 @@ static std::ostream& operator<<(std::ostream& os, const Platform::PXI::PM::Progr
} // namespace std
template <> struct fmt::formatter<Platform::PXI::PM::ProgramInfo> : ostream_formatter {};
namespace HLE {
// namespace OS {

View file

@ -25,6 +25,8 @@
#include <sstream>
#include <iomanip>
#include <fmt/ranges.h>
// Hardcoded size for PXI buffers.
// TODO: These buffers should only be 0x1000 bytes large, but our PXI tables currently may span more than that because they map individual pages as entries
const auto pxi_static_buffer_size = 0x2000;

View file

@ -4,8 +4,8 @@
#include <platform/pxi.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/filesystem/path.hpp>
#include <fstream>
#include <filesystem>
#include <boost/optional.hpp>
namespace HLE {
@ -133,8 +133,8 @@ public:
};
private:
const boost::filesystem::path path;
boost::filesystem::fstream stream;
const std::filesystem::path path;
std::fstream stream;
Policy policy;

View file

@ -3,9 +3,9 @@
#include "pxi_fs_file_buffer_emu.hpp"
#include <framework/exceptions.hpp>
#include <fmt/std.h>
#include <boost/filesystem.hpp>
#include <framework/exceptions.hpp>
#include <iostream>
@ -25,7 +25,7 @@ HostFile::HostFile(std::string_view path, Policy policy) : path(std::begin(path)
ResultAnd<> HostFile::Open(FileContext& context, OpenFlags flags) {
context.logger.info("Attempting to open {} (create={})", path, flags.create);
if (!flags.create && !boost::filesystem::exists(path)) {
if (!flags.create && !std::filesystem::exists(path)) {
return std::make_tuple(-1);
}
@ -58,7 +58,7 @@ void HostFile::Close(/*FakeThread& thread*/) {
ResultAnd<uint64_t> HostFile::GetSize(FileContext& context) {
context.logger.info("Attempting to get size of file {}", path);
uint64_t size = boost::filesystem::file_size(path);
uint64_t size = std::filesystem::file_size(path);
return std::make_tuple(OS::RESULT_OK, size);
}
@ -68,7 +68,7 @@ ResultAnd<> HostFile::SetSize(FakeThread& thread, uint64_t size) {
// TODO: Does this zero-fill the file as expected?
// TODO: Expected by whom? If these are not the 3DS semantics, we still would want to have deterministic buffer contents here!
boost::filesystem::resize_file(path, size);
std::filesystem::resize_file(path, size);
return std::make_tuple(OS::RESULT_OK);
}

View file

@ -17,6 +17,8 @@
#include <filesystem>
#include <fmt/ranges.h>
namespace HLE::PXI {
std::array<uint8_t, 16> GenerateAESKey(const std::array<uint8_t, 16>& key_x, const std::array<uint8_t, 16>& key_y);
}

View file

@ -1554,7 +1554,7 @@ std::unique_ptr<ShaderEngine> CreateMicroCodeRecompiler(Context& context) try {
auto vis = VisualizeShaderControlFlowGraph(prog, context.shader_memory.data(), context.shader_memory.size(),
context.swizzle_data.data(), context.swizzle_data.size());
// std::cerr << vis << "\n";
throw std::runtime_error(fmt::format("OMG: {:#x}", context.registers.vs_main_offset));
throw std::runtime_error(fmt::format("OMG: {:#x}", context.registers.vs_main_offset.Value()));
}
} // namespace Pica::VertexShader