mirror of
https://github.com/mikage-emu/mikage-dev.git
synced 2025-01-06 21:40:59 +01:00
Add various formatting changes that ease maintenance
This commit is contained in:
parent
0f284da7b5
commit
808736f34c
16 changed files with 43 additions and 41 deletions
|
@ -27,6 +27,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|||
# Prefer Conan-provided packages over system ones
|
||||
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE)
|
||||
|
||||
|
||||
# TODO: Move these flags into a "boost" cmake target
|
||||
add_definitions(-DBOOST_FILESYSTEM_NO_DEPRECATED -DBOOST_COROUTINES_NO_DEPRECATION_WARNING)
|
||||
|
||||
|
|
|
@ -67,6 +67,7 @@ target_sources(mikage PRIVATE
|
|||
ui/key_database.cpp
|
||||
utility/simple_tcp.cpp)
|
||||
|
||||
|
||||
if (Pistache_FOUND)
|
||||
target_sources(mikage PRIVATE
|
||||
debug_server.cpp
|
||||
|
@ -86,13 +87,17 @@ if (STD_FILESYSTEM_LIBRARY)
|
|||
target_link_libraries(mikage PRIVATE ${STD_FILESYSTEM_LIBRARY})
|
||||
endif ()
|
||||
|
||||
|
||||
|
||||
target_link_libraries(mikage PRIVATE Boost::boost Boost::context Boost::filesystem Boost::iostreams Boost::program_options Boost::thread)
|
||||
|
||||
if (Pistache_FOUND)
|
||||
target_link_libraries(mikage PRIVATE Pistache::Pistache)
|
||||
endif()
|
||||
|
||||
|
||||
target_link_libraries(mikage PRIVATE SDL2::SDL2)
|
||||
|
||||
target_link_libraries(mikage PRIVATE spdlog::spdlog)
|
||||
target_link_libraries(mikage PRIVATE Tracy::TracyClient)
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ struct BootToHomeMenu : Config::BooleanOption<BootToHomeMenu> {
|
|||
static constexpr const char* name = "BootToHomeMenu";
|
||||
};
|
||||
|
||||
|
||||
// Use the native HID module upon OS startup
|
||||
struct UseNativeHID : Config::BooleanOption<UseNativeHID> {
|
||||
static constexpr const char* name = "UseNativeHID";
|
||||
|
@ -51,6 +52,7 @@ struct UseNativeFS : Config::BooleanOption<UseNativeFS> {
|
|||
static constexpr const char* name = "UseNativeFS";
|
||||
};
|
||||
|
||||
|
||||
// Dump displayed frames to a series of binary files
|
||||
struct DumpFrames : Config::BooleanOption<DumpFrames> {
|
||||
static constexpr const char* name = "DumpFrames";
|
||||
|
|
|
@ -41,8 +41,11 @@
|
|||
|
||||
#include <vulkan/vulkan.hpp>
|
||||
|
||||
|
||||
|
||||
void InstallCIA(std::filesystem::path, spdlog::logger&, const KeyDatabase&, HLE::PXI::FS::FileContext&, HLE::PXI::FS::File&);
|
||||
|
||||
|
||||
using boost::endian::big_uint32_t;
|
||||
|
||||
static const char* app_name = "Mikage";
|
||||
|
@ -53,27 +56,11 @@ std::mutex g_vulkan_queue_mutex; // TODO: Turn into a proper interface
|
|||
|
||||
namespace bpo = boost::program_options;
|
||||
|
||||
|
||||
static volatile int wait_debugger = 0;
|
||||
|
||||
namespace Settings {
|
||||
|
||||
inline std::istream& operator>>(std::istream& is, CPUEngine& engine) {
|
||||
std::string str;
|
||||
is >> str;
|
||||
if (str == "narmive") {
|
||||
engine = CPUEngine::NARMive;
|
||||
} else {
|
||||
is.setstate(std::ios_base::failbit);
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& os, CPUEngine engine) {
|
||||
switch (engine) {
|
||||
case CPUEngine::NARMive:
|
||||
return (os << "narmive");
|
||||
}
|
||||
}
|
||||
|
||||
inline std::istream& operator>>(std::istream& is, ShaderEngine& engine) {
|
||||
std::string str;
|
||||
|
@ -124,6 +111,7 @@ int main(int argc, char* argv[]) {
|
|||
std::string filename;
|
||||
bool enable_debugging;
|
||||
|
||||
|
||||
bpo::options_description desc("Allowed options");
|
||||
desc.add_options()
|
||||
("help", "produce help message")
|
||||
|
@ -181,7 +169,6 @@ int main(int argc, char* argv[]) {
|
|||
settings.set<Settings::AttachToProcessOnStartup>(vm["attach_to_process"].as<unsigned>());
|
||||
}
|
||||
settings.set<Settings::AppMemType>(vm["appmemtype"].as<unsigned>());
|
||||
settings.set<Settings::CPUEngineTag>(Settings::CPUEngine::NARMive);
|
||||
if (vm["render_on_cpu"].as<bool>()) {
|
||||
settings.set<Settings::RendererTag>(Settings::Renderer::Software);
|
||||
if (!vm.count("shader_engine")) {
|
||||
|
@ -648,6 +635,7 @@ if (bootstrap_nand) // Experimental system bootstrapper
|
|||
break;
|
||||
}
|
||||
|
||||
|
||||
case CustomEvents::CirclePadPosition:
|
||||
{
|
||||
float x, y;
|
||||
|
@ -833,7 +821,6 @@ quit_application_loop:
|
|||
display->present_queue.waitIdle();
|
||||
display->device->waitIdle();
|
||||
|
||||
frontend_logger->info("Shutting down DSP JIT...");
|
||||
|
||||
session.reset();
|
||||
}
|
||||
|
|
|
@ -432,6 +432,7 @@ public:
|
|||
|
||||
virtual void OnVirtualMemoryUnmapped(uint32_t vaddr, uint32_t size) = 0;
|
||||
|
||||
|
||||
std::unique_ptr<ExecutionContext> CreateExecutionContext() {
|
||||
return std::unique_ptr<ExecutionContext> { CreateExecutionContextImpl() };
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ Memory::PhysicalMemory* g_mem = nullptr; // TODO: Remove
|
|||
bool g_dsp_running = false; // TODO: Remove
|
||||
bool g_dsp_just_reset = false; // TODO: Remove
|
||||
|
||||
|
||||
namespace Pica {
|
||||
struct Context;
|
||||
}
|
||||
|
@ -614,7 +615,6 @@ struct SPI : MemoryAccessHandler {
|
|||
struct CONFIG11 : MemoryAccessHandler {
|
||||
std::shared_ptr<spdlog::logger> logger;
|
||||
|
||||
// TODO: Is this still needed?
|
||||
Teakra::Teakra *teakra = new Teakra::Teakra(Teakra::CreateInterpreterEngine);
|
||||
|
||||
uint16_t unknown0x1c0 = 0;
|
||||
|
@ -1015,6 +1015,7 @@ struct DSPMMIO : MemoryAccessHandler {
|
|||
}
|
||||
|
||||
if (!config.trigger_reset() && prev_config.trigger_reset()) {
|
||||
|
||||
std::vector<std::uint8_t> temp(0x80000);
|
||||
memcpy(temp.data(), g_teakra->GetDspMemory().data(), temp.size());
|
||||
delete g_teakra;
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "pica.hpp"
|
||||
#include "video_core/src/video_core/vulkan/renderer.hpp" // TODO: Get rid of this
|
||||
|
||||
|
||||
#include <framework/exceptions.hpp>
|
||||
#include <framework/formats.hpp>
|
||||
#include <framework/logging.hpp>
|
||||
|
@ -46,6 +47,7 @@
|
|||
#include "processes/pdn.hpp"
|
||||
#include "processes/ssl.hpp"
|
||||
|
||||
|
||||
#include "platform/ns.hpp"
|
||||
#include "platform/sm.hpp"
|
||||
|
||||
|
@ -1046,6 +1048,7 @@ public:
|
|||
continue;
|
||||
}
|
||||
|
||||
|
||||
GetLogger()->info("Launching FIRM title {:#x}", title_id);
|
||||
auto firm_file = HLE::PXI::FS::OpenNCCHSubFile(*this, info, 0, 1, std::basic_string_view<uint8_t>(exefs_section, sizeof(exefs_section)), nullptr);
|
||||
auto [offset, num_bytes] = firm_titles.at(title_id);
|
||||
|
@ -1070,6 +1073,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
GetLogger()->info("{}FakeThread \"BootThread\" exiting", ThreadPrinter{*this});
|
||||
CallSVC(&OS::SVCExitThread);
|
||||
} catch (HLE::OS::FakeThread* stopped_thread) {
|
||||
|
@ -1825,6 +1829,7 @@ EmuProcess::EmuProcess(OS& os, Interpreter::Setup& setup, uint32_t pid, std::sha
|
|||
case Settings::CPUEngine::NARMive:
|
||||
processor = Interpreter::CreateInterpreter(setup);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2191,6 +2196,7 @@ SVCFuture<OS::Result,uint32_t> OS::SVCControlProcessMemory(Thread& source, Proce
|
|||
auto success = process.MapVirtualMemory(*paddr_opt, size, *vaddr_opt, permissions);
|
||||
ValidateContract(success);
|
||||
|
||||
|
||||
Reschedule(source.GetPointer());
|
||||
return MakeFuture(RESULT_OK, addr0);
|
||||
}
|
||||
|
@ -4394,6 +4400,7 @@ SVCFuture<OS::Result,HandleTable::Entry<Process>> OS::SVCCreateProcess(Thread& s
|
|||
|
||||
process->name = codeset->app_name;
|
||||
|
||||
|
||||
// Finally, add the new process to the global process list
|
||||
RegisterProcess(process);
|
||||
|
||||
|
@ -5237,6 +5244,7 @@ SVCCallbackType OS::SVCRaw(Thread& source, unsigned svc_id, Interpreter::Executi
|
|||
return EncodeFuture(SVCControlProcessMemory(source, process, addr0, addr1, size, operation, permissions));
|
||||
}
|
||||
|
||||
|
||||
case 0x73: // CreateCodeSet
|
||||
{
|
||||
uint32_t code_set_info_addr = input_regs.reg[1];
|
||||
|
@ -6253,10 +6261,12 @@ void OS::Run(std::shared_ptr<Interpreter::Setup> setup) {
|
|||
hle_titles["hid"].create = FakeProcessFactoryFor<FakeHID>;
|
||||
}
|
||||
|
||||
|
||||
if (!settings.get<Settings::UseNativeFS>()) {
|
||||
hle_titles["fs"].create = FakeProcessFactoryFor<FakeFS>;
|
||||
}
|
||||
|
||||
|
||||
hle_titles["act"].create = FakeProcessFactoryFor<FakeACT>;
|
||||
hle_titles["am"].create = FakeProcessFactoryFor<FakeAM>;
|
||||
hle_titles["cam"].create = FakeProcessFactoryFor<FakeCAM>;
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include <framework/exceptions.hpp>
|
||||
|
||||
|
||||
namespace HLE {
|
||||
|
||||
namespace OS {
|
||||
|
@ -66,6 +67,7 @@ struct DspService : SessionToPort {
|
|||
channel, num_bytes, peer == 0 ? "DSP" : peer == 1 ? "ARM" : "unknown peer");
|
||||
Session::OnRequest(hypervisor, thread, session, description);
|
||||
|
||||
|
||||
response.OnResponse([this](Hypervisor&, Thread& thread, Result result, uint32_t num_bytes_read, IPC::StaticBuffer data) {
|
||||
if (result != RESULT_OK || !num_bytes_read) {
|
||||
throw std::runtime_error("Unexpected error in ReadPipeIfPossible");
|
||||
|
@ -85,16 +87,6 @@ struct DspService : SessionToPort {
|
|||
signature[i] = thread.ReadMemory(data.addr + i);
|
||||
}
|
||||
|
||||
{
|
||||
auto filename = fmt::format("dsp.{:x}.dsp1", fmt::join(signature.begin(), signature.begin() + 16, ""));
|
||||
fprintf(stderr, "%s\n", filename.c_str());
|
||||
std::ofstream dump(filename, /*std::ios::out |*/ std::ios::binary);
|
||||
for (uint32_t i = 0; i < size; ++i) {
|
||||
uint8_t val = thread.ReadMemory(data.addr + i);
|
||||
dump.write((char*)&val, sizeof(val));
|
||||
}
|
||||
}
|
||||
|
||||
pipe_read_state = PipeReadState::Reset;
|
||||
});
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ using Platform::NS::AppletCommand;
|
|||
using Platform::NS::AppletPos;
|
||||
using Platform::PXI::PM::ProgramInfo;
|
||||
|
||||
|
||||
template<typename RangeIn>
|
||||
static uint32_t GetDecompressedLZSSDataSize(const RangeIn& compressed_reverse) {
|
||||
// Reverse the input buffer
|
||||
|
@ -136,6 +137,7 @@ static void DecompressLZSSData(const RangeIn& compressed_reverse, const RangeOut
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
HandleTable::Entry<Process> LoadProcessFromFile(FakeThread& source,
|
||||
bool from_firm,
|
||||
const FileFormat::ExHeader& exheader,
|
||||
|
@ -408,6 +410,7 @@ OS::ResultAnd<ProcessId> LaunchTitleInternal(FakeThread& source, bool from_firm,
|
|||
return std::make_tuple(RESULT_OK, process_id);
|
||||
}
|
||||
|
||||
|
||||
} // namespace OS
|
||||
|
||||
} // namespace HLE
|
||||
|
|
|
@ -519,7 +519,7 @@ static void PXIPSCommandHandler(FakeThread& thread, Context& context, const IPC:
|
|||
throw IPC::IPCError{header.raw, 0xdeadbef1};
|
||||
}
|
||||
} catch (const IPC::IPCError& err) {
|
||||
throw std::runtime_error(fmt::format("Unknown PxiPM service command with header {:#010x}", err.header));
|
||||
throw std::runtime_error(fmt::format("Unknown pxi:ps9 service command with header {:#010x}", err.header));
|
||||
}
|
||||
|
||||
void FakePXI::PSThread(FakeThread& thread, Context& context) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "fs_common.hpp"
|
||||
#include "fs_common.hpp"
|
||||
#include "pxi.hpp"
|
||||
#include "os.hpp"
|
||||
|
||||
|
|
|
@ -11,12 +11,14 @@ namespace Config {
|
|||
template<>
|
||||
bool BooleanOption<Settings::BootToHomeMenu>::default_val = false;
|
||||
|
||||
|
||||
template<>
|
||||
bool BooleanOption<Settings::UseNativeHID>::default_val = false;
|
||||
|
||||
template<>
|
||||
bool BooleanOption<Settings::UseNativeFS>::default_val = false;
|
||||
|
||||
|
||||
template<>
|
||||
bool BooleanOption<Settings::DumpFrames>::default_val = false;
|
||||
|
||||
|
|
|
@ -54,8 +54,6 @@ KeyDatabase LoadKeyDatabase(spdlog::logger& logger, const std::filesystem::path&
|
|||
// Ignore
|
||||
} else if (line.starts_with("dlp") || line.starts_with("nfc")) {
|
||||
// Not currently used
|
||||
} else {
|
||||
logger.warn("Ignoring line in {}: {}", filename.string(), line);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ if (PISTACHE_FOUND)
|
|||
target_sources(video_core PRIVATE src/debug/gpu.cpp)
|
||||
endif()
|
||||
|
||||
|
||||
target_include_directories(video_core PRIVATE src/support src/ externals/nihstro/include)
|
||||
target_include_directories(video_core PRIVATE ../)
|
||||
# target_include_directories(video_core PRIVATE externals/vulkan-hpp/vulkan) TODO: Need to also include Vulkan headers with matching version... For now, I'm just using the headers shipping with my Linux distribution
|
||||
|
|
|
@ -150,6 +150,7 @@ static bool IsNopDraw(const Regs& registers) {
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
static inline void WritePicaReg(Context& context, u32 id, u32 value, u32 mask, CommandListIterator& next_command) {
|
||||
auto& registers = context.registers;
|
||||
if (id >= registers.NumIds())
|
||||
|
@ -273,6 +274,7 @@ static inline void WritePicaReg(Context& context, u32 id, u32 value, u32 mask, C
|
|||
if (g_debug_context)
|
||||
g_debug_context->OnEvent(DebugContext::Event::IncomingPrimitiveBatch, nullptr);
|
||||
|
||||
|
||||
const auto& attribute_config = registers.vertex_attributes;
|
||||
|
||||
VertexLoader vertex_loader(context, attribute_config);
|
||||
|
@ -284,6 +286,7 @@ static inline void WritePicaReg(Context& context, u32 id, u32 value, u32 mask, C
|
|||
const uint32_t index_address = attribute_config.GetPhysicalBaseAddress() + index_info.offset;
|
||||
const bool index_u16 = index_info.format != 0;
|
||||
|
||||
|
||||
const bool render_on_cpu = (context.settings->get<Settings::RendererTag>() == Settings::Renderer::Software);
|
||||
|
||||
ZoneNamedN(TriangleBatch, "Triangle Batch", true);
|
||||
|
@ -423,11 +426,6 @@ Vulkan::preassembled_triangles = true;
|
|||
id <= PICA_REG_INDEX(fixed_vertex_attribute_sink.data[2]));
|
||||
};
|
||||
|
||||
// context.shader_uniforms.f[95].x = float24::FromFloat32(1.0);
|
||||
// context.shader_uniforms.f[95].y = float24::FromFloat32(1.0);
|
||||
// context.shader_uniforms.f[95].z = float24::FromFloat32(1.0);
|
||||
// context.shader_uniforms.f[95].w = float24::FromFloat32(1.0);
|
||||
|
||||
auto& sink = registers.fixed_vertex_attribute_sink;
|
||||
if (sink.IsImmediateSubmission()) {
|
||||
const bool render_on_cpu = (context.settings->get<Settings::RendererTag>() == Settings::Renderer::Software);
|
||||
|
@ -445,6 +443,7 @@ Vulkan::preassembled_triangles = true;
|
|||
break;
|
||||
}
|
||||
|
||||
|
||||
VertexShader::InputVertex input {};
|
||||
auto& engine = context.shader_engines.GetOrCompile(context, context.settings->get<Settings::ShaderEngineTag>(), registers.vs_main_offset);
|
||||
engine.Reset(registers.vs_input_register_map, input, 1 + registers.max_shader_input_attribute_index());
|
||||
|
@ -467,7 +466,6 @@ Vulkan::preassembled_triangles = true;
|
|||
throw std::runtime_error("Submitted other commands before vertex was complete");
|
||||
}
|
||||
data_buffer[word_index] = next_command.Value();
|
||||
fprintf(stderr, "WritePicaReg_cont: %#04x <- %#010x & %#010x\n", next_command.Id(), next_command.Value(), next_command.Mask());
|
||||
++next_command;
|
||||
}
|
||||
first = false;
|
||||
|
@ -692,7 +690,7 @@ fprintf(stderr, "WritePicaReg_cont: %#04x <- %#010x & %#010x\n", next_command.Id
|
|||
void ProcessCommandList(Context& context, PAddr list_addr, u32 size) {
|
||||
CommandListIterator it(*context.mem, list_addr, size);
|
||||
|
||||
fprintf(stderr, "\nWritePicaReg: Incoming command list\n");
|
||||
|
||||
while (it) {
|
||||
auto id = it.Id();
|
||||
auto value = it.Value();
|
||||
|
|
|
@ -131,6 +131,7 @@ public:
|
|||
Event active_breakpoint;
|
||||
bool at_breakpoint = false;
|
||||
|
||||
|
||||
private:
|
||||
/**
|
||||
* Private default constructor to make sure people always construct this through Construct()
|
||||
|
|
Loading…
Reference in a new issue