# HG changeset patch # User koda # Date 1278115284 -7200 # Node ID cfd3c6536a09193a1c43806b00c89781fe67a980 # Parent b50215a8a43de96e2be3c09cc74ae88650ac68cd make runtime quality check for iDevices diff -r b50215a8a43d -r cfd3c6536a09 hedgewars/hwengine.pas --- a/hedgewars/hwengine.pas Sat Jul 03 01:31:18 2010 +0200 +++ b/hedgewars/hwengine.pas Sat Jul 03 02:01:24 2010 +0200 @@ -73,7 +73,7 @@ var isTerminated: boolean = false; alsoShutdownFrontend: boolean = false; {$IFDEF HWLIBRARY} -type arrayofpchar = array[0..8] of PChar; +type arrayofpchar = array[0..9] of PChar; procedure initEverything(complete:boolean); procedure freeEverything(complete:boolean); @@ -256,7 +256,6 @@ cVSyncInUse:= true; cTimerInterval:= 8; PathPrefix:= 'Data'; - cReducedQuality:= rqBlurryLand; //FIXME cShowFPS:= true; cInitVolume:= 100; @@ -269,6 +268,15 @@ val(gameArgs[6], cScreenHeight); val(gameArgs[7], cScreenWidth); recordFileName:= gameArgs[8]; + + if (gameArgs[9] = '2') then + cReducedQuality:= rqLowRes or rqBlurryLand + else + if (gameArgs[9] = '1') then + cReducedQuality:= rqBlurryLand + else + cReducedQuality:= rqNone; + {$ENDIF} initEverything(true); WriteLnToConsole('Hedgewars ' + cVersionString + ' engine (network protocol: ' + inttostr(cNetProtoVersion) + ')'); @@ -576,7 +584,7 @@ cShowFPS:= ParamStr(13) = '1'; val(ParamStr(14), cTimerInterval); if (ParamStr(15) = '1') then //HACK - cReducedQuality:= $FFFFFFFF xor rqLowRes + cReducedQuality:= $FFFFFFFF xor rqLowRes else val(ParamStr(15), cReducedQuality); end diff -r b50215a8a43d -r cfd3c6536a09 hedgewars/uMisc.pas --- a/hedgewars/uMisc.pas Sat Jul 03 01:31:18 2010 +0200 +++ b/hedgewars/uMisc.pas Sat Jul 03 02:01:24 2010 +0200 @@ -88,7 +88,7 @@ //pathPrefix is in uConsts cShowFPS : boolean = false; cAltDamage : boolean = true; - cReducedQuality : LongInt = 0; + cReducedQuality : LongInt = rqNone; recordFileName : shortstring = ''; @@ -297,7 +297,6 @@ procedure SetTextureParameters(enableClamp: Boolean); begin - //if enableClamp and not cReducedQuality then if enableClamp and ((cReducedQuality and rqClampLess) = 0) then begin glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); diff -r b50215a8a43d -r cfd3c6536a09 project_files/HedgewarsMobile/Classes/GameSetup.m --- a/project_files/HedgewarsMobile/Classes/GameSetup.m Sat Jul 03 01:31:18 2010 +0200 +++ b/project_files/HedgewarsMobile/Classes/GameSetup.m Sat Jul 03 02:01:24 2010 +0200 @@ -364,27 +364,28 @@ CGRect screenBounds = [[UIScreen mainScreen] bounds]; NSString *wSize = [[NSString alloc] initWithFormat:@"%d", (int) screenBounds.size.width]; NSString *hSize = [[NSString alloc] initWithFormat:@"%d", (int) screenBounds.size.height]; - const char **gameArgs = (const char**) malloc(sizeof(char *) * 9); + const char **gameArgs = (const char**) malloc(sizeof(char *) * 10); - /* size_t size; // Set 'oldp' parameter to NULL to get the size of the data returned so we can allocate appropriate amount of space sysctlbyname("hw.machine", NULL, &size, NULL, 0); - char *name = malloc(size); + char *name = (char *)malloc(sizeof(char) * size); // Get the platform name sysctlbyname("hw.machine", name, &size, NULL, 0); - NSString *machine = [[NSString alloc] initWithUTF8String:name]; + NSString *modelId = [[NSString alloc] initWithUTF8String:name]; free(name); - - const char **gameArgs = (const char**) malloc(sizeof(char*) * 9); - // if the machine is less than iphone 3gs or less than ipod touch 3g use reduced graphics (land array) - if ([machine hasPrefix:@"iPhone1"] || ([machine hasPrefix:@"iPod"] && ([machine hasSuffix:@"1,1"] || [machine hasSuffix:@"2,1"]))) - gameArgs[8] = "1"; - else - gameArgs[8] = "0"; - [machine release]; - */ + if ([modelId hasPrefix:@"iPhone1"] || // = iPhone or iPhone 3G + [modelId hasPrefix:@"iPod1,1"] || [modelId hasPrefix:@"iPod2,1"]) // = iPod Touch or iPod Touch 2G + gameArgs[9] = "2"; // rqLowRes & rqBlurryLand + else if ([modelId hasPrefix:@"iPhone2"] || // = iPhone 3GS + [modelId hasPrefix:@"iPad1"] || // = iPad + [modelId hasPrefix:@"iPod3"]) // = iPod Touch 3G + gameArgs[9] = "1"; // rqBlurryLand + else // = everything else + gameArgs[9] = "0"; // full quality + [modelId release]; + // prevents using an empty nickname NSString *username;