mangoapp: shm struct + gamescope engine

pull/627/head
FlightlessMango 3 years ago
parent fbda58c907
commit 23ed317536

@ -66,11 +66,18 @@ int fd;
char str1[80]; char str1[80];
char *shm_str; char *shm_str;
struct mangoapp {
int pid;
int read;
};
mangoapp *mangoapp_ptr;
void read_thread(){ void read_thread(){
while (1){ while (1){
if (strcmp("read", shm_str)) { if (mangoapp_ptr->read < 1) {
sprintf(shm_str, "%s", "read");
update_hud_info(sw_stats, params, vendorID); update_hud_info(sw_stats, params, vendorID);
mangoapp_ptr->read = 1;
} else { } else {
sleep(0.0001); sleep(0.0001);
} }
@ -163,11 +170,12 @@ int main(int, char**)
} }
init_gpu_stats(vendorID, params); init_gpu_stats(vendorID, params);
init_system_info(); init_system_info();
sw_stats.engine = EngineTypes::GAMESCOPE;
// Our state // Our state
key_t key = ftok("mangoapp",65); key_t key = ftok("mangoapp",65);
int shmid = shmget(key,1024,0666|IPC_CREAT); int shmid = shmget(key,sizeof(mangoapp),0666|IPC_CREAT);
shm_str = (char*) shmat(shmid,(void*)0,0); auto shm_address = shmat(shmid, (void*)0, 0);
mangoapp_ptr = (mangoapp*)shm_address;
std::thread(read_thread).detach(); std::thread(read_thread).detach();
// Main loop // Main loop
while (!glfwWindowShouldClose(window)) while (!glfwWindowShouldClose(window))
@ -182,7 +190,7 @@ int main(int, char**)
// Start the Dear ImGui frame // Start the Dear ImGui frame
ImGui_ImplOpenGL3_NewFrame(); ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplGlfw_NewFrame(); ImGui_ImplGlfw_NewFrame();
window_size.x = window_size.x * 1.1;
ImGui::NewFrame(); ImGui::NewFrame();
{ {
check_keybinds(sw_stats, params, vendorID); check_keybinds(sw_stats, params, vendorID);

@ -41,7 +41,7 @@ struct benchmark_stats benchmark;
struct fps_limit fps_limit_stats {}; struct fps_limit fps_limit_stats {};
ImVec2 real_font_size; ImVec2 real_font_size;
std::vector<logData> graph_data; std::vector<logData> graph_data;
const char* engines[] = {"Unknown", "OpenGL", "VULKAN", "DXVK", "VKD3D", "DAMAVAND", "ZINK", "WINED3D", "Feral3D", "ToGL"}; const char* engines[] = {"Unknown", "OpenGL", "VULKAN", "DXVK", "VKD3D", "DAMAVAND", "ZINK", "WINED3D", "Feral3D", "ToGL", "GAMESCOPE"};
overlay_params *_params {}; overlay_params *_params {};
void update_hw_info(struct swapchain_stats& sw_stats, struct overlay_params& params, uint32_t vendorID) void update_hw_info(struct swapchain_stats& sw_stats, struct overlay_params& params, uint32_t vendorID)

@ -39,6 +39,8 @@ enum EngineTypes
WINED3D, WINED3D,
FERAL3D, FERAL3D,
TOGL, TOGL,
GAMESCOPE
}; };
extern const char* engines[]; extern const char* engines[];

Loading…
Cancel
Save