Files
dolphin/Source/Core/DolphinNoGUI/PlatformHeadless.cpp
T
Yaya48 54f5a74bbf Track exact StarletOS bootstrap integration and checkpoint provenance
Recover 16 modified and 6 previously untracked integration files. All 22 source SHA-256s match the pre-publication StarletOS snapshot. Add handoff instructions, byte-preserving attributes and private backup exclusion. This commit publishes existing behavior; it does not claim a new full build or hardware qualification. The two preceding local commits and staged files were screened before publication.
2026-10-03 16:27:07 +02:00

88 lines
2.5 KiB
C++

// Copyright 2018 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include <cstdio>
#include <thread>
#include "Common/Logging/Log.h"
#include "Core/Core.h"
#include "Core/HW/Memmap.h"
#include "Core/System.h"
#include "DolphinNoGUI/Platform.h"
namespace
{
class PlatformHeadless final : public Platform
{
public:
void SetTitle(const std::string& title) override;
void MainLoop() override;
WindowSystemInfo GetWindowSystemInfo() const override;
};
void PlatformHeadless::SetTitle(const std::string& title)
{
std::fprintf(stdout, "%s\n", title.c_str());
}
void PlatformHeadless::MainLoop()
{
bool diff_observed = false;
while (m_running.IsSet())
{
UpdateRunningFlag();
auto& system = Core::System::GetInstance();
Core::HostDispatchJobs(system);
if (!diff_observed && Core::IsRunning(system))
{
auto& memory = system.GetMemory();
const u32 status = memory.Read_U32(0x00003c00);
if (status == 0x52500004 || (status & 0xffffff00) == 0x5250e100)
{
diff_observed = true;
INFO_LOG_FMT(IOS, "IOS_PROBE_DIFF_DONE status={:#010x}", status);
constexpr u32 trace_base = 0x00003d00;
const u32 count = memory.Read_U32(trace_base);
if (count > 8)
{
ERROR_LOG_FMT(IOS, "IOS_PROBE_DIFF_BAD_COUNT count={}", count);
}
else
{
for (u32 index = 0; index < count; ++index)
{
const u32 record = trace_base + 0x20 + index * 24;
INFO_LOG_FMT(IOS,
"IOS_PROBE_JSON {{\"schema\":1,\"index\":{},\"operation\":{},"
"\"argument\":{},\"return\":{},\"output\":{},\"ticks\":{},"
"\"status\":{}}}",
index, memory.Read_U32(record), memory.Read_U32(record + 4),
static_cast<s32>(memory.Read_U32(record + 8)),
memory.Read_U32(record + 12), memory.Read_U32(record + 16),
memory.Read_U32(record + 20));
}
}
}
}
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
}
WindowSystemInfo PlatformHeadless::GetWindowSystemInfo() const
{
WindowSystemInfo wsi;
wsi.type = WindowSystemType::Headless;
wsi.display_connection = nullptr;
wsi.render_window = nullptr;
wsi.render_surface = nullptr;
return wsi;
}
} // namespace
std::unique_ptr<Platform> Platform::CreateHeadlessPlatform()
{
return std::make_unique<PlatformHeadless>();
}