mangoapp: split proto details into separate header

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
pull/941/head
Emil Velikov 1 year ago committed by jackun
parent 8a1c56ba25
commit 8e1c389f22

@ -1,6 +1,10 @@
#include <sys/ipc.h>
#include <sys/msg.h>
#include <string.h>
#include <stdio.h>
#include "mangoapp.h"
#include <stdlib.h>
#include "mangoapp_proto.h"
void help_and_quit() {
fprintf(stderr, "Usage: mangohudctl [set|toggle] attribute [value]\n");

@ -3,6 +3,9 @@
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
// Read online: https://github.com/ocornut/imgui/tree/master/docs
#include <sys/ipc.h>
#include <sys/msg.h>
#include "imgui.h"
#include "imgui_impl_glfw.h"
#include "imgui_impl_opengl3.h"
@ -12,6 +15,7 @@
#include "../overlay.h"
#include "notify.h"
#include "mangoapp.h"
#include "mangoapp_proto.h"
#include <GL/glew.h>
#include <GLFW/glfw3.h>

@ -1,48 +1,10 @@
#include <stdint.h>
#ifndef _WIN32
#include <sys/ipc.h>
#include <sys/msg.h>
#endif
#include <mutex>
#include <condition_variable>
#include <vector>
extern std::mutex mangoapp_m;
extern std::condition_variable mangoapp_cv;
struct mangoapp_msg_header {
long msg_type; // Message queue ID, never change
uint32_t version; /* for major changes in the way things work */
} __attribute__((packed));
struct mangoapp_msg_v1 {
struct mangoapp_msg_header hdr;
uint32_t pid;
uint64_t visible_frametime_ns;
uint8_t fsrUpscale;
uint8_t fsrSharpness;
// For debugging
uint64_t app_frametime_ns;
uint64_t latency_ns;
// WARNING: Always ADD fields, never remove or repurpose fields
} __attribute__((packed));
struct mangoapp_ctrl_header {
long msg_type; // Message queue ID, never change
uint32_t ctrl_msg_type; /* This is a way to share the same thread between multiple types of messages */
uint32_t version; /* version of the message type, for backwards incompatible changes */
} __attribute__((packed));
struct mangoapp_ctrl_msgid1_v1 {
struct mangoapp_ctrl_header hdr;
// When a field is set to 0, it should always mean "ignore" or "no changes"
uint8_t no_display; // 0x0 = ignore; 0x1 = disable; 0x2 = enable; 0x3 = toggle
uint8_t log_session; // 0x0 = ignore; 0x1 = start a session; 0x2 = stop the current session; 0x3 = toggle logging
char log_session_name[64]; // if byte 0 is NULL, ignore. Needs to be set when starting/toggling a session if we want to override the default name
// WARNING: Always ADD fields, never remove or repurpose fields
} __attribute__((packed));
extern uint8_t g_fsrUpscale;
extern uint8_t g_fsrSharpness;

@ -0,0 +1,36 @@
#include <stdint.h>
struct mangoapp_msg_header {
long msg_type; // Message queue ID, never change
uint32_t version; /* for major changes in the way things work */
} __attribute__((packed));
struct mangoapp_msg_v1 {
struct mangoapp_msg_header hdr;
uint32_t pid;
uint64_t visible_frametime_ns;
uint8_t fsrUpscale;
uint8_t fsrSharpness;
// For debugging
uint64_t app_frametime_ns;
uint64_t latency_ns;
// WARNING: Always ADD fields, never remove or repurpose fields
} __attribute__((packed));
struct mangoapp_ctrl_header {
long msg_type; // Message queue ID, never change
uint32_t ctrl_msg_type; /* This is a way to share the same thread between multiple types of messages */
uint32_t version; /* version of the message type, for backwards incompatible changes */
} __attribute__((packed));
struct mangoapp_ctrl_msgid1_v1 {
struct mangoapp_ctrl_header hdr;
// When a field is set to 0, it should always mean "ignore" or "no changes"
uint8_t no_display; // 0x0 = ignore; 0x1 = disable; 0x2 = enable; 0x3 = toggle
uint8_t log_session; // 0x0 = ignore; 0x1 = start a session; 0x2 = stop the current session; 0x3 = toggle logging
char log_session_name[64]; // if byte 0 is NULL, ignore. Needs to be set when starting/toggling a session if we want to override the default name
// WARNING: Always ADD fields, never remove or repurpose fields
} __attribute__((packed));
Loading…
Cancel
Save