Skip to content

Commit

Permalink
pull engine from gamescope
Browse files Browse the repository at this point in the history
  • Loading branch information
pac85 committed Dec 5, 2024
1 parent 975815c commit 77b9b8d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,26 @@ static void gamescope_frametime(uint64_t app_frametime_ns, uint64_t latency_ns){
HUDElements.gamescope_debug_latency.erase(HUDElements.gamescope_debug_latency.begin());
}

static EngineTypes engine_type_from_str(std::string engineName) {
if (engineName == "DXVK")
return DXVK;

else if (engineName == "vkd3d")
return VKD3D;

else if(engineName == "mesa zink")
return ZINK;

else if (engineName == "Damavand")
return DAMAVAND;

else if (engineName == "Feral3D")
return FERAL3D;

else
return VULKAN;
}

static void msg_read_thread(){
for (size_t i = 0; i < 200; i++){
HUDElements.gamescope_debug_app.push_back(0);
Expand Down Expand Up @@ -210,6 +230,13 @@ static void msg_read_thread(){
screenWidth = mangoapp_v1->outputWidth;
screenHeight = mangoapp_v1->outputHeight;
}

if (msg_size > offsetof(mangoapp_msg_v1, engineName)) {
if (!steam_focused)
sw_stats.engine = engine_type_from_str(std::string(mangoapp_v1->engineName));
} else {
sw_stats.engine = EngineTypes::GAMESCOPE;
}
}
} else {
printf("Unsupported mangoapp struct version: %i\n", hdr->version);
Expand Down
5 changes: 5 additions & 0 deletions src/app/mangoapp_proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ struct mangoapp_msg_v1 {
uint64_t latency_ns;
uint32_t outputWidth;
uint32_t outputHeight;
uint16_t displayRefresh;
bool bAppWantsHDR : 1;
bool bSteamFocused : 1;
char engineName[40];

// WARNING: Always ADD fields, never remove or repurpose fields
} __attribute__((packed));

Expand Down

0 comments on commit 77b9b8d

Please sign in to comment.