Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mangoapp: pull engine from gamescope #1498

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions src/app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,29 @@ 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 if (engineName == "gamescope")
return GAMESCOPE;

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 +233,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
Loading