Files
Eli Yarson b8607f4ced feat(videoout): write pad and present telemetry to APS5_VIDEOOUT_TELEMETRY_DIR
APS5_VIDEOOUT_TELEMETRY_DIR=<directory> appends one JSON object per line to <directory>/videoout.jsonl: a contract line for the run (commit and pid), a pad line whenever the published pad state changes in its buttons, sticks, L2 or R2, a present line after the first present and every 30 after that with the count and rate the window title shows, and a drops line with the number of lines the writer discarded, reported every ten seconds while it grows and once at a normal exit. A bounded queue of 4096 lines and one writer thread batch the file, so neither the present nor the input path waits for it; a pad change that the full queue refused stays pending for a later publish, and the frame count moves from UpdateTitle's function-static to DisplayWindow so the input path can name the present it belongs to.

Without the variable no file is opened and no thread is started: a present or an input update costs one call that checks a guard variable and returns null.
2026-10-19 15:27:49 +02:00

42 lines
1.5 KiB
C++

#ifndef CORE_LIBS_PRX_LIBSCEVIDEOOUT_INCLUDE_DISPLAYWINDOW_HPP
#define CORE_LIBS_PRX_LIBSCEVIDEOOUT_INCLUDE_DISPLAYWINDOW_HPP
#include <cstdint>
#include "SDL.h"
inline constexpr std::uint32_t DisplayWindowMinimumWidth = 320;
inline constexpr std::uint32_t DisplayWindowMinimumHeight = 180;
inline constexpr std::uint32_t DisplayWindowInitialSizePercent = 60;
class DisplayWindow {
public:
DisplayWindow() = default;
~DisplayWindow();
DisplayWindow(const DisplayWindow&) = delete;
DisplayWindow& operator=(const DisplayWindow&) = delete;
void Ensure(std::uint32_t sourceWidth, std::uint32_t sourceHeight);
void Destroy() noexcept;
SDL_Window* Handle() const;
void DrawableSize(std::uint32_t& width, std::uint32_t& height) const;
void UpdateTitle();
std::uint64_t FrameNumber() const { return frameNum; }
void ToggleFullscreen();
private:
void create(std::uint32_t sourceWidth, std::uint32_t sourceHeight);
void updateAspectRatio(std::uint32_t sourceWidth, std::uint32_t sourceHeight);
void installSubclass();
void removeSubclass() noexcept;
void applyAspectRatio(void* hwnd, std::uintptr_t edge, void* rect) const;
static std::intptr_t windowProc(void* hwnd, unsigned int message, std::uintptr_t wParam, std::intptr_t lParam, std::uintptr_t subclassId, std::uintptr_t referenceData);
SDL_Window* window = nullptr;
std::uint32_t aspectWidth = 0;
std::uint32_t aspectHeight = 0;
std::uint64_t frameNum = 0;
};
#endif