Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / T1 - Detect iOS version

Author
Message
LittlePIC
13
Years of Service
User Offline
Joined: 19th Oct 2011
Location:
Posted: 18th Jun 2014 11:27
Ok, Have searched the forum and found this isn't possible in T1

My questions is can I 'hijack' an existing unused AppGameKit function as per here in Android http://forum.thegamecreators.com/?m=forum_view&t=207017&b=46 for xcode?

Open to all creative solutions

I need to detect when a iphone is running iOS7 as the app icon placement is slightly different (its for a Wallpaper creation app)

Cheers
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 18th Jun 2014 14:41
GetDeviceName should provide enough information for getting iOS version
LittlePIC
13
Years of Service
User Offline
Joined: 19th Oct 2011
Location:
Posted: 19th Jun 2014 02:06
Thanks baxslash but unfortunately is only the model details - eg 'The first number is the major model number, the second is the minor model number...'

So can detect if its a iphone4 or iphone5 but not if its iOS6 or iOS7

Thanks anyway

Cheers
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 19th Jun 2014 03:07 Edited at: 19th Jun 2014 03:13
You should be able to repurpose a T1 function for this. You'll need to write a method in obj c that can be called - put that method in the Core.m file. In AGKCommandsTable.cpp you can alter the contents of on of the cases. You' limited to a single line (not sure why). I'd suggest altering case AGKI_GETDEVICENAMER_STRING on line 3687 (AGK 10821). In there you should make a call to your method that will return the OS version.

I do something similar for Chartboost, but I don't deal with a return value so there might be some sticky stuff there. If there is you might want an alternative method in Core.m that actually writes the data to a file where you can retrieve it later.

Let us know of your progress. This would be much more useful than the major/minor model numbers.

Here's the obj c command to call
http://stackoverflow.com/questions/1543925/how-do-i-detect-whether-i-have-iphone-2g-3g-3gs
You cold actually probably stuff that right of the *(char**)g_p[0] = in AGKCommandsTable.cpp on line 3688

LittlePIC
13
Years of Service
User Offline
Joined: 19th Oct 2011
Location:
Posted: 19th Jun 2014 23:09
Your a Champion Naphier! Perfect! This is just the sort of thing I was hoping for but want sure where to start.

Will let you know my progress.

Maybe I'm over stepping a line but cant see why TGC wouldn't have 'encouraged' a few of these 'third party' additional commands in there compiled T1 engine? Would have made it easier for unsupported features to be plugged while V2 is being developed. Would have kept a few Indians from charging down the hill looking for scalps LOL
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 19th Jun 2014 23:20
I can understand not implementing customization too much. It could be messy. I have suggested that there are simply a half dozen dummy commands in T1 that accept different combinations of parameters and returns. Then in the obj-c or java we could define methods for information to be passed back and forth. It would give us some flexibility at least.
I'm also wondering if we can dig in and alter the commands list and command table to do our bidding a bit more.
I'm trying to avoid moving to T2 because my biggest project is in T1 and it will take forever to convert.

Good luck with the override.

If anyone knows why the AGKCommandsTable.cpp file is restircted to single-line cases please let me know (or let m know how to write multi-line cases in it).

LittlePIC
13
Years of Service
User Offline
Joined: 19th Oct 2011
Location:
Posted: 21st Jun 2014 05:44
OK, messed around with this for awhile without success

Unfortunately cant just add the syntax to the right of an existing Agk command.

Tried adding a method without success

Could you provide me what you implemented with Chartboost? both the code for core.m and the repurposed Agk command?

I'm pretty close as the project cleans and compiles

Cheers

LittlePIC
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 21st Jun 2014 06:10
Chartboost has it's own library. so the changes made in core.m aren't going to help.

In the commands table file I just replace the line with the call to agk::SetAdvertVisible(int something);
with


It's a bit different. Apparently there is a singleton(?) called (Chartboost *)sharedChartboost and showInterstitial is a method.


If the method is in core.m I think you should be ok.
The method would be something like this:


In the command tables I'd just try


I'm not sure if that will work. The [] might need an object or something. I really don't know anything about obj-c so I don't know if I can help much further than this.

What did you try?

LittlePIC
13
Years of Service
User Offline
Joined: 19th Oct 2011
Location:
Posted: 5th Jul 2014 07:50
Sorry for the late reply - Just as feedback, blew sometime playing (and learning) about Xcode to get this partly working

End result is hijacking one of the commands as below (this case GetAppName)

case AGKI_GETAPPNAMER_STRING : inl_handleparams();\
*(NSString**)g_p[0] = [[UIDevice currentDevice]systemVersion];\
break;\

Don't need (or can seem to call) an additional method in core.m

I know this isn't correct way to call the systemVersion value because I can't seem to convert the return as int or float as per online docs?

Anyway,In my case, this will do as iOS 7 at least returns a string with one char as '9'. Its enough for me to then at least know if the device is iOS7 or not

I'm sure reverse engineering other iOS versions could then be detected the same way. I'm just using 'CountStringTokens' to find if the char of '9' is present in the return value

Many thanks Naphier for all your help. Wouldn't have got this far without your lead

Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 5th Jul 2014 10:45
A 9 is pretty weird... Maybe there's some incompatibility between NSString and C++ chars. I don't really know. AGK's GetDeviceName should just return this, it's fairly worthless to only get the platform out of it. Paul should work on this.

Login to post a reply

Server time is: 2024-11-25 06:44:42
Your offset time is: 2024-11-25 06:44:42