diff --git a/Limelight/Network/HttpManager.h b/Limelight/Network/HttpManager.h index 687f45c..4d23846 100644 --- a/Limelight/Network/HttpManager.h +++ b/Limelight/Network/HttpManager.h @@ -26,8 +26,7 @@ - (NSURLRequest*) newServerInfoRequest:(bool)fastFail; - (NSURLRequest*) newHttpServerInfoRequest:(bool)fastFail; - (NSURLRequest*) newHttpServerInfoRequest; -- (NSURLRequest*) newLaunchRequest:(StreamConfiguration*)config; -- (NSURLRequest*) newResumeRequest:(StreamConfiguration*)config; +- (NSURLRequest*) newLaunchOrResumeRequest:(NSString*)verb config:(StreamConfiguration*)config; - (NSURLRequest*) newQuitAppRequest; - (NSURLRequest*) newAppAssetRequestWithAppId:(NSString*)appId; - (void) executeRequestSynchronously:(HttpRequest*)request; diff --git a/Limelight/Network/HttpManager.m b/Limelight/Network/HttpManager.m index e73a97a..ce60584 100644 --- a/Limelight/Network/HttpManager.m +++ b/Limelight/Network/HttpManager.m @@ -264,7 +264,7 @@ return [self newHttpServerInfoRequest:false]; } -- (NSURLRequest*) newLaunchRequest:(StreamConfiguration*)config { +- (NSURLRequest*) newLaunchOrResumeRequest:(NSString*)verb config:(StreamConfiguration*)config { if (![self ensureHttpsUrlPopulated:NO]) { return nil; } @@ -276,8 +276,8 @@ // indicated by a negative version in the last field. int fps = (config.frameRate > 60 && ![config.appVersion containsString:@".-"]) ? 0 : config.frameRate; - NSString* urlString = [NSString stringWithFormat:@"%@/launch?uniqueid=%@&appid=%@&mode=%dx%dx%d&additionalStates=1&sops=%d&rikey=%@&rikeyid=%d%@&localAudioPlayMode=%d&surroundAudioInfo=%d&remoteControllersBitmap=%d&gcmap=%d", - _baseHTTPSURL, _uniqueId, + NSString* urlString = [NSString stringWithFormat:@"%@/%@?uniqueid=%@&appid=%@&mode=%dx%dx%d&additionalStates=1&sops=%d&rikey=%@&rikeyid=%d%@&localAudioPlayMode=%d&surroundAudioInfo=%d&remoteControllersBitmap=%d&gcmap=%d", + _baseHTTPSURL, verb, _uniqueId, config.appID, config.width, config.height, fps, config.optimizeGameSettings ? 1 : 0, @@ -291,20 +291,6 @@ return [self createRequestFromString:urlString timeout:LONG_TIMEOUT_SEC]; } -- (NSURLRequest*) newResumeRequest:(StreamConfiguration*)config { - if (![self ensureHttpsUrlPopulated:NO]) { - return nil; - } - - NSString* urlString = [NSString stringWithFormat:@"%@/resume?uniqueid=%@&rikey=%@&rikeyid=%d&surroundAudioInfo=%d", - _baseHTTPSURL, _uniqueId, - [Utils bytesToHex:config.riKey], config.riKeyId, - SURROUNDAUDIOINFO_FROM_AUDIO_CONFIGURATION(config.audioConfiguration)]; - Log(LOG_I, @"Requesting: %@", urlString); - // This blocks while the app is resuming - return [self createRequestFromString:urlString timeout:LONG_TIMEOUT_SEC]; -} - - (NSURLRequest*) newQuitAppRequest { if (![self ensureHttpsUrlPopulated:NO]) { return nil; diff --git a/Limelight/Stream/StreamManager.m b/Limelight/Stream/StreamManager.m index 8e10eea..d60d3fc 100644 --- a/Limelight/Stream/StreamManager.m +++ b/Limelight/Stream/StreamManager.m @@ -113,7 +113,7 @@ - (BOOL) launchApp:(HttpManager*)hMan receiveSessionUrl:(NSString**)sessionUrl { HttpResponse* launchResp = [[HttpResponse alloc] init]; - [hMan executeRequestSynchronously:[HttpRequest requestForResponse:launchResp withUrlRequest:[hMan newLaunchRequest:_config]]]; + [hMan executeRequestSynchronously:[HttpRequest requestForResponse:launchResp withUrlRequest:[hMan newLaunchOrResumeRequest:@"launch" config:_config]]]; NSString *gameSession = [launchResp getStringTag:@"gamesession"]; if (![launchResp isStatusOk]) { [_callbacks launchFailed:launchResp.statusMessage]; @@ -131,7 +131,7 @@ - (BOOL) resumeApp:(HttpManager*)hMan receiveSessionUrl:(NSString**)sessionUrl { HttpResponse* resumeResp = [[HttpResponse alloc] init]; - [hMan executeRequestSynchronously:[HttpRequest requestForResponse:resumeResp withUrlRequest:[hMan newResumeRequest:_config]]]; + [hMan executeRequestSynchronously:[HttpRequest requestForResponse:resumeResp withUrlRequest:[hMan newLaunchOrResumeRequest:@"resume" config:_config]]]; NSString* resume = [resumeResp getStringTag:@"resume"]; if (![resumeResp isStatusOk]) { [_callbacks launchFailed:resumeResp.statusMessage];