mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-05-19 16:20:15 +00:00
Improve manually added Steam app detection heuristic to prevent FPs on apps with "Steam" in the name
This commit is contained in:
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
@property (nullable, nonatomic, retain) NSString *id;
|
@property (nullable, nonatomic, retain) NSString *id;
|
||||||
@property (nullable, nonatomic, retain) NSString *name;
|
@property (nullable, nonatomic, retain) NSString *name;
|
||||||
|
@property (nullable, nonatomic, retain) NSString *installPath;
|
||||||
@property (nonatomic) BOOL hdrSupported;
|
@property (nonatomic) BOOL hdrSupported;
|
||||||
@property (nullable, nonatomic, retain) TemporaryHost *host;
|
@property (nullable, nonatomic, retain) TemporaryHost *host;
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ static const char* TAG_APP = "App";
|
|||||||
static const char* TAG_APP_TITLE = "AppTitle";
|
static const char* TAG_APP_TITLE = "AppTitle";
|
||||||
static const char* TAG_APP_ID = "ID";
|
static const char* TAG_APP_ID = "ID";
|
||||||
static const char* TAG_HDR_SUPPORTED = "IsHdrSupported";
|
static const char* TAG_HDR_SUPPORTED = "IsHdrSupported";
|
||||||
|
static const char* TAG_APP_INSTALL_PATH = "AppInstallPath";
|
||||||
|
|
||||||
- (void)populateWithData:(NSData *)xml {
|
- (void)populateWithData:(NSData *)xml {
|
||||||
self.data = xml;
|
self.data = xml;
|
||||||
@@ -68,6 +69,7 @@ static const char* TAG_HDR_SUPPORTED = "IsHdrSupported";
|
|||||||
NSString* appName = @"";
|
NSString* appName = @"";
|
||||||
NSString* appId = nil;
|
NSString* appId = nil;
|
||||||
NSString* hdrSupported = @"0";
|
NSString* hdrSupported = @"0";
|
||||||
|
NSString* appInstallPath = nil;
|
||||||
while (appInfoNode != NULL) {
|
while (appInfoNode != NULL) {
|
||||||
if (!xmlStrcmp(appInfoNode->name, (xmlChar*)TAG_APP_TITLE)) {
|
if (!xmlStrcmp(appInfoNode->name, (xmlChar*)TAG_APP_TITLE)) {
|
||||||
xmlChar* nodeVal = xmlNodeListGetString(docPtr, appInfoNode->xmlChildrenNode, 1);
|
xmlChar* nodeVal = xmlNodeListGetString(docPtr, appInfoNode->xmlChildrenNode, 1);
|
||||||
@@ -87,7 +89,14 @@ static const char* TAG_HDR_SUPPORTED = "IsHdrSupported";
|
|||||||
hdrSupported = [[NSString alloc] initWithCString:(const char*)nodeVal encoding:NSUTF8StringEncoding];
|
hdrSupported = [[NSString alloc] initWithCString:(const char*)nodeVal encoding:NSUTF8StringEncoding];
|
||||||
xmlFree(nodeVal);
|
xmlFree(nodeVal);
|
||||||
}
|
}
|
||||||
|
} else if (!xmlStrcmp(appInfoNode->name, (xmlChar*)TAG_APP_INSTALL_PATH)) {
|
||||||
|
xmlChar* nodeVal = xmlNodeListGetString(docPtr, appInfoNode->xmlChildrenNode, 1);
|
||||||
|
if (nodeVal != NULL) {
|
||||||
|
appInstallPath = [[NSString alloc] initWithCString:(const char*)nodeVal encoding:NSUTF8StringEncoding];
|
||||||
|
xmlFree(nodeVal);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
appInfoNode = appInfoNode->next;
|
appInfoNode = appInfoNode->next;
|
||||||
}
|
}
|
||||||
if (appId != nil) {
|
if (appId != nil) {
|
||||||
@@ -95,6 +104,7 @@ static const char* TAG_HDR_SUPPORTED = "IsHdrSupported";
|
|||||||
app.name = appName;
|
app.name = appName;
|
||||||
app.id = appId;
|
app.id = appId;
|
||||||
app.hdrSupported = [hdrSupported intValue] != 0;
|
app.hdrSupported = [hdrSupported intValue] != 0;
|
||||||
|
app.installPath = appInstallPath;
|
||||||
[_appList addObject:app];
|
[_appList addObject:app];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -114,14 +124,16 @@ static const char* TAG_HDR_SUPPORTED = "IsHdrSupported";
|
|||||||
TemporaryApp* officialSteamApp = nil;
|
TemporaryApp* officialSteamApp = nil;
|
||||||
TemporaryApp* manuallyAddedSteamApp = nil;
|
TemporaryApp* manuallyAddedSteamApp = nil;
|
||||||
for (TemporaryApp* app in _appList) {
|
for (TemporaryApp* app in _appList) {
|
||||||
|
if (app.installPath != nil && [app.installPath hasSuffix:@"\\Steam\\"]) {
|
||||||
// The official Steam app is marked as HDR supported, while manually added ones are not.
|
// The official Steam app is marked as HDR supported, while manually added ones are not.
|
||||||
if ([app.name isEqualToString:@"Steam"] && app.hdrSupported) {
|
if ([app.name isEqualToString:@"Steam"] && app.hdrSupported) {
|
||||||
officialSteamApp = app;
|
officialSteamApp = app;
|
||||||
}
|
}
|
||||||
else if ([app.name containsString:@"steam"] || [app.name containsString:@"Steam"]) {
|
else {
|
||||||
manuallyAddedSteamApp = app;
|
manuallyAddedSteamApp = app;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// To be safe, don't do anything if we didn't find an HDR-enabled Steam app.
|
// To be safe, don't do anything if we didn't find an HDR-enabled Steam app.
|
||||||
if (officialSteamApp != nil) {
|
if (officialSteamApp != nil) {
|
||||||
|
|||||||
Reference in New Issue
Block a user