Re: [Ohrrpgce] Java help needed
I assume that James' intention is to allow building for Android without having to install the ODK. I'm assuming that libs in project/libs are copied into the .apk rather than expected to be present on the device. On 18 July 2013 03:31, Simon Bradley neworigi...@gmail.com wrote: You can use Class.forName(com.ouya.whatever); to check whether a class exists. Also if you compile it with the libs but never actually call that code, it will still run on a device that doesn't have the jars. I think. On Wed, Jul 17, 2013 at 3:33 PM, James Paige b...@hamsterrepublic.com wrote: I am working on getting access to the OUYA ODK from sdl-android. I have figured out that I need to copy the *.jar files from the ODK into project/libs Then I managed to write code in project/java/MainActivity.java which uses the ODK, just enough to do the detection of whether or not the currently running Android device is an OUYA console. Together with connecting code in project/java/Video.java and project/jni/sdl-1.2/src/video/android/SDL_androidvideo.c and in the ohrrpgce's gfx_sdl.bas I was able to test it, and it works nicely. This makes me feel good because I know that support for in-app purchases is now a realistic goal. However, I notice that if the ODK *.jar files are NOT copied into project/libs then the whole project will not even build. Failure to locate the Java class tv.ouya.console.api.OuyaFacade is a compile-time error, not a runtime error. If this was python, I would simply be wrapping it in a try/except and I could easily make the isRunningOnOUYA() function gracefully fail when the needed jars are not found. It could just log a warning and return false. Does anybody know that Java way to do runtime-checking for whether or not an external class is available? --- James ___ Ohrrpgce mailing list ohrrpgce@lists.motherhamster.org http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org ___ Ohrrpgce mailing list ohrrpgce@lists.motherhamster.org http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org ___ Ohrrpgce mailing list ohrrpgce@lists.motherhamster.org http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
Re: [Ohrrpgce] Java help needed
Actually, I have a branch of sdl-android in which I just added and committed the ouya jars. I guess if it was easy it would be nice to allow compiling without the ouya libs, but it does not seem to be conveneint at all. I tried Class.forName(tv.ouya.console.api.OuyaFacade) to check if the class exists, and that line worked, but I still can't actually create an instance if it without having the jars present. And yes, the jars have to be in the apk, there doesn't seem to be any way that I know about to have shared copies of them for the whole device. On Fri, Jul 19, 2013 at 01:33:00AM +1200, Ralph Versteegen wrote: I assume that James' intention is to allow building for Android without having to install the ODK. I'm assuming that libs in project/libs are copied into the .apk rather than expected to be present on the device. On 18 July 2013 03:31, Simon Bradley neworigi...@gmail.com wrote: You can use Class.forName(com.ouya.whatever); to check whether a class exists. Also if you compile it with the libs but never actually call that code, it will still run on a device that doesn't have the jars. I think. On Wed, Jul 17, 2013 at 3:33 PM, James Paige b...@hamsterrepublic.com wrote: I am working on getting access to the OUYA ODK from sdl-android. I have figured out that I need to copy the *.jar files from the ODK into project/libs Then I managed to write code in project/java/MainActivity.java which uses the ODK, just enough to do the detection of whether or not the currently running Android device is an OUYA console. Together with connecting code in project/java/Video.java and project/jni/sdl-1.2/src/video/android/SDL_androidvideo.c and in the ohrrpgce's gfx_sdl.bas I was able to test it, and it works nicely. This makes me feel good because I know that support for in-app purchases is now a realistic goal. However, I notice that if the ODK *.jar files are NOT copied into project/libs then the whole project will not even build. Failure to locate the Java class tv.ouya.console.api.OuyaFacade is a compile-time error, not a runtime error. If this was python, I would simply be wrapping it in a try/except and I could easily make the isRunningOnOUYA() function gracefully fail when the needed jars are not found. It could just log a warning and return false. Does anybody know that Java way to do runtime-checking for whether or not an external class is available? --- James ___ Ohrrpgce mailing list ohrrpgce@lists.motherhamster.org http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org ___ Ohrrpgce mailing list ohrrpgce@lists.motherhamster.org http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org ___ Ohrrpgce mailing list ohrrpgce@lists.motherhamster.org http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org ___ Ohrrpgce mailing list ohrrpgce@lists.motherhamster.org http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
Re: [Ohrrpgce] Java help needed
On 19 July 2013 02:11, James Paige b...@hamsterrepublic.com wrote: Actually, I have a branch of sdl-android in which I just added and committed the ouya jars. That's a simple solution, but might be a problem for submitting Ouya features upstream :/ I guess if it was easy it would be nice to allow compiling without the ouya libs, but it does not seem to be conveneint at all. I tried Class.forName(tv.ouya.console.api.OuyaFacade) to check if the class exists, and that line worked, but I still can't actually create an instance if it without having the jars present. Do you mean an instance of tv.ouya.console.api.OuyaFacade? I guess you mean an instance of whatever class lives in a file with an import tv.ouya.console.api.OuyaFacade statement at the top? If so I guess it would necessary to import tv.ouya.console.api.OuyaFacade in a dynamic way too (or the class which makes use of it)? And yes, the jars have to be in the apk, there doesn't seem to be any way that I know about to have shared copies of them for the whole device. On Fri, Jul 19, 2013 at 01:33:00AM +1200, Ralph Versteegen wrote: I assume that James' intention is to allow building for Android without having to install the ODK. I'm assuming that libs in project/libs are copied into the .apk rather than expected to be present on the device. On 18 July 2013 03:31, Simon Bradley neworigi...@gmail.com wrote: You can use Class.forName(com.ouya.whatever); to check whether a class exists. Also if you compile it with the libs but never actually call that code, it will still run on a device that doesn't have the jars. I think. On Wed, Jul 17, 2013 at 3:33 PM, James Paige b...@hamsterrepublic.com wrote: I am working on getting access to the OUYA ODK from sdl-android. I have figured out that I need to copy the *.jar files from the ODK into project/libs Then I managed to write code in project/java/MainActivity.java which uses the ODK, just enough to do the detection of whether or not the currently running Android device is an OUYA console. Together with connecting code in project/java/Video.java and project/jni/sdl-1.2/src/video/android/SDL_androidvideo.c and in the ohrrpgce's gfx_sdl.bas I was able to test it, and it works nicely. This makes me feel good because I know that support for in-app purchases is now a realistic goal. However, I notice that if the ODK *.jar files are NOT copied into project/libs then the whole project will not even build. Failure to locate the Java class tv.ouya.console.api.OuyaFacade is a compile-time error, not a runtime error. If this was python, I would simply be wrapping it in a try/except and I could easily make the isRunningOnOUYA() function gracefully fail when the needed jars are not found. It could just log a warning and return false. Does anybody know that Java way to do runtime-checking for whether or not an external class is available? --- James ___ Ohrrpgce mailing list ohrrpgce@lists.motherhamster.org http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org ___ Ohrrpgce mailing list ohrrpgce@lists.motherhamster.org http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org ___ Ohrrpgce mailing list ohrrpgce@lists.motherhamster.org http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org ___ Ohrrpgce mailing list ohrrpgce@lists.motherhamster.org http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org ___ Ohrrpgce mailing list ohrrpgce@lists.motherhamster.org http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
Re: [Ohrrpgce] Java help needed
On Fri, Jul 19, 2013 at 02:35:41AM +1200, Ralph Versteegen wrote: On 19 July 2013 02:11, James Paige b...@hamsterrepublic.com wrote: Actually, I have a branch of sdl-android in which I just added and committed the ouya jars. That's a simple solution, but might be a problem for submitting Ouya features upstream :/ Hmm I would certainly like for ouya-specific stuff to be upstreamable. I guess I can remove them later if I learn a better way to make use of them only if they are present. I guess if it was easy it would be nice to allow compiling without the ouya libs, but it does not seem to be conveneint at all. I tried Class.forName(tv.ouya.console.api.OuyaFacade) to check if the class exists, and that line worked, but I still can't actually create an instance if it without having the jars present. Do you mean an instance of tv.ouya.console.api.OuyaFacade? I guess you mean an instance of whatever class lives in a file with an import tv.ouya.console.api.OuyaFacade statement at the top? If so I guess it would necessary to import tv.ouya.console.api.OuyaFacade in a dynamic way too (or the class which makes use of it)? I guess that is what I mean? I am so new to Java, that I am not sure. I went googling for examples of importing conditionally, but have not yet found anything that works for me. And yes, the jars have to be in the apk, there doesn't seem to be any way that I know about to have shared copies of them for the whole device. On Fri, Jul 19, 2013 at 01:33:00AM +1200, Ralph Versteegen wrote: I assume that James' intention is to allow building for Android without having to install the ODK. I'm assuming that libs in project/libs are copied into the .apk rather than expected to be present on the device. On 18 July 2013 03:31, Simon Bradley neworigi...@gmail.com wrote: You can use Class.forName(com.ouya.whatever); to check whether a class exists. Also if you compile it with the libs but never actually call that code, it will still run on a device that doesn't have the jars. I think. On Wed, Jul 17, 2013 at 3:33 PM, James Paige b...@hamsterrepublic.com wrote: I am working on getting access to the OUYA ODK from sdl-android. I have figured out that I need to copy the *.jar files from the ODK into project/libs Then I managed to write code in project/java/MainActivity.java which uses the ODK, just enough to do the detection of whether or not the currently running Android device is an OUYA console. Together with connecting code in project/java/Video.java and project/jni/sdl-1.2/src/video/android/SDL_androidvideo.c and in the ohrrpgce's gfx_sdl.bas I was able to test it, and it works nicely. This makes me feel good because I know that support for in-app purchases is now a realistic goal. However, I notice that if the ODK *.jar files are NOT copied into project/libs then the whole project will not even build. Failure to locate the Java class tv.ouya.console.api.OuyaFacade is a compile-time error, not a runtime error. If this was python, I would simply be wrapping it in a try/except and I could easily make the isRunningOnOUYA() function gracefully fail when the needed jars are not found. It could just log a warning and return false. Does anybody know that Java way to do runtime-checking for whether or not an external class is available? --- James ___ Ohrrpgce mailing list ohrrpgce@lists.motherhamster.org http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org ___ Ohrrpgce mailing list ohrrpgce@lists.motherhamster.org http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org ___ Ohrrpgce mailing list ohrrpgce@lists.motherhamster.org http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org ___ Ohrrpgce mailing list ohrrpgce@lists.motherhamster.org http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org ___ Ohrrpgce mailing list ohrrpgce@lists.motherhamster.org http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org ___ Ohrrpgce mailing list ohrrpgce@lists.motherhamster.org http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
Re: [Ohrrpgce] Java help needed
You want to do this: http://stackoverflow.com/questions/6857807/is-it-possible-to-dynamically-load-a-library-at-runtime-from-an-android-applicat You would download the ODK JARs to the external storage directory at runtime, then add the JARs to the library path. Then the existing class check you're doing. From: James Paige Sent: 7/18/2013 9:52 AM To: ohrrpgce@lists.motherhamster.org Subject: Re: [Ohrrpgce] Java help needed On Fri, Jul 19, 2013 at 02:35:41AM +1200, Ralph Versteegen wrote: On 19 July 2013 02:11, James Paige b...@hamsterrepublic.com wrote: Actually, I have a branch of sdl-android in which I just added and committed the ouya jars. That's a simple solution, but might be a problem for submitting Ouya features upstream :/ Hmm I would certainly like for ouya-specific stuff to be upstreamable. I guess I can remove them later if I learn a better way to make use of them only if they are present. I guess if it was easy it would be nice to allow compiling without the ouya libs, but it does not seem to be conveneint at all. I tried Class.forName(tv.ouya.console.api.OuyaFacade) to check if the class exists, and that line worked, but I still can't actually create an instance if it without having the jars present. Do you mean an instance of tv.ouya.console.api.OuyaFacade? I guess you mean an instance of whatever class lives in a file with an import tv.ouya.console.api.OuyaFacade statement at the top? If so I guess it would necessary to import tv.ouya.console.api.OuyaFacade in a dynamic way too (or the class which makes use of it)? I guess that is what I mean? I am so new to Java, that I am not sure. I went googling for examples of importing conditionally, but have not yet found anything that works for me. And yes, the jars have to be in the apk, there doesn't seem to be any way that I know about to have shared copies of them for the whole device. On Fri, Jul 19, 2013 at 01:33:00AM +1200, Ralph Versteegen wrote: I assume that James' intention is to allow building for Android without having to install the ODK. I'm assuming that libs in project/libs are copied into the .apk rather than expected to be present on the device. On 18 July 2013 03:31, Simon Bradley neworigi...@gmail.com wrote: You can use Class.forName(com.ouya.whatever); to check whether a class exists. Also if you compile it with the libs but never actually call that code, it will still run on a device that doesn't have the jars. I think. On Wed, Jul 17, 2013 at 3:33 PM, James Paige b...@hamsterrepublic.com wrote: I am working on getting access to the OUYA ODK from sdl-android. I have figured out that I need to copy the *.jar files from the ODK into project/libs Then I managed to write code in project/java/MainActivity.java which uses the ODK, just enough to do the detection of whether or not the currently running Android device is an OUYA console. Together with connecting code in project/java/Video.java and project/jni/sdl-1.2/src/video/android/SDL_androidvideo.c and in the ohrrpgce's gfx_sdl.bas I was able to test it, and it works nicely. This makes me feel good because I know that support for in-app purchases is now a realistic goal. However, I notice that if the ODK *.jar files are NOT copied into project/libs then the whole project will not even build. Failure to locate the Java class tv.ouya.console.api.OuyaFacade is a compile-time error, not a runtime error. If this was python, I would simply be wrapping it in a try/except and I could easily make the isRunningOnOUYA() function gracefully fail when the needed jars are not found. It could just log a warning and return false. Does anybody know that Java way to do runtime-checking for whether or not an external class is available? --- James ___ Ohrrpgce mailing list ohrrpgce@lists.motherhamster.org http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org ___ Ohrrpgce mailing list ohrrpgce@lists.motherhamster.org http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org ___ Ohrrpgce mailing list ohrrpgce@lists.motherhamster.org http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org ___ Ohrrpgce mailing list ohrrpgce@lists.motherhamster.org http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org ___ Ohrrpgce mailing list ohrrpgce@lists.motherhamster.org http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org ___ Ohrrpgce mailing list ohrrpgce@lists.motherhamster.org http://lists.motherhamster.org/listinfo.cgi/ohrrpgce
Re: [Ohrrpgce] Java help needed
On Thu, Jul 18, 2013 at 04:30:43PM +0100, Simon Bradley wrote: Ah, I see. I kind of assumed that the ouya libs would already be present on the Ouya itself, and wouldn't be compiled into the apk. If that's not the case, then I guess we'd need a separate ouya branch. It is possible to create classes and call methods with text names and reflection, but it's really not worth the effort, and it's kind of expensive in performance. I am not opposed to such a method, since none of the ouya-specific code would be stuff run frequently. Mainly just: * checking to see if we are runnong on an OUYA console (done once at startup) * requesting an in-app purchase * checking to see if an in-app purchase has already been purchased I'm guessing the Ouya jars shouldn't be distributed in a regular Android build? I ought to know this stuff, really. I should probably look it up. Actually, there is no harm in that at all, other than you waste a little space. The ouya jars are 2.4 mb. I seem to remember that it is also possible to use fully-qualified class names instead of doing an import, and as long as that code is never reached it won't cause an error. Eg: tv.ouya.console.api.OuyaFacade facade = new tv.ouya.console.api.OuyaFacade(); ...but it will still need the jars to compile. Back when we used to do J2ME I knew more about this stuff. Cheers, Simon On Thu, Jul 18, 2013 at 3:11 PM, James Paige b...@hamsterrepublic.com wrote: Actually, I have a branch of sdl-android in which I just added and committed the ouya jars. I guess if it was easy it would be nice to allow compiling without the ouya libs, but it does not seem to be conveneint at all. I tried Class.forName(tv.ouya.console.api.OuyaFacade) to check if the class exists, and that line worked, but I still can't actually create an instance if it without having the jars present. And yes, the jars have to be in the apk, there doesn't seem to be any way that I know about to have shared copies of them for the whole device. On Fri, Jul 19, 2013 at 01:33:00AM +1200, Ralph Versteegen wrote: I assume that James' intention is to allow building for Android without having to install the ODK. I'm assuming that libs in project/libs are copied into the .apk rather than expected to be present on the device. On 18 July 2013 03:31, Simon Bradley neworigi...@gmail.com wrote: You can use Class.forName(com.ouya.whatever); to check whether a class exists. Also if you compile it with the libs but never actually call that code, it will still run on a device that doesn't have the jars. I think. On Wed, Jul 17, 2013 at 3:33 PM, James Paige b...@hamsterrepublic.com wrote: I am working on getting access to the OUYA ODK from sdl-android. I have figured out that I need to copy the *.jar files from the ODK into project/libs Then I managed to write code in project/java/MainActivity.java which uses the ODK, just enough to do the detection of whether or not the currently running Android device is an OUYA console. Together with connecting code in project/java/Video.java and project/jni/sdl-1.2/src/video/android/SDL_androidvideo.c and in the ohrrpgce's gfx_sdl.bas I was able to test it, and it works nicely. This makes me feel good because I know that support for in-app purchases is now a realistic goal. However, I notice that if the ODK *.jar files are NOT copied into project/libs then the whole project will not even build. Failure to locate the Java class tv.ouya.console.api.OuyaFacade is a compile-time error, not a runtime error. If this was python, I would simply be wrapping it in a try/except and I could easily make the isRunningOnOUYA() function gracefully fail when the needed jars are not found. It could just log a warning and return false. Does anybody know that Java way to do runtime-checking for whether or not an external class is available? --- James ___ Ohrrpgce mailing list ohrrpgce@lists.motherhamster.org http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org ___ Ohrrpgce mailing list ohrrpgce@lists.motherhamster.org http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org ___ Ohrrpgce mailing list
Re: [Ohrrpgce] Java help needed
On 19 July 2013 03:37, James Paige b...@hamsterrepublic.com wrote: On Thu, Jul 18, 2013 at 04:30:43PM +0100, Simon Bradley wrote: Ah, I see. I kind of assumed that the ouya libs would already be present on the Ouya itself, and wouldn't be compiled into the apk. If that's not the case, then I guess we'd need a separate ouya branch. It is possible to create classes and call methods with text names and reflection, but it's really not worth the effort, and it's kind of expensive in performance. I am not opposed to such a method, since none of the ouya-specific code would be stuff run frequently. Mainly just: * checking to see if we are runnong on an OUYA console (done once at startup) * requesting an in-app purchase * checking to see if an in-app purchase has already been purchased An alternative would be to add a compile time switch which performs some substitutions on the java code, or substitutes a dummy class file for another. The sdl-android build system already does lots of code generation (using templates). I'm guessing the Ouya jars shouldn't be distributed in a regular Android build? I ought to know this stuff, really. I should probably look it up. Actually, there is no harm in that at all, other than you waste a little space. The ouya jars are 2.4 mb. No harm unless the jars are copied into the apk. An extra 2.4MB sounds pretty bad to me! And .jars are already compressed! I wonder what's in that, and whether it's all added to the .apk. What's the size of the MainActivity-debug.apk produced? Without Ouya support I have 2.4 MB. I seem to remember that it is also possible to use fully-qualified class names instead of doing an import, and as long as that code is never reached it won't cause an error. Eg: tv.ouya.console.api.OuyaFacade facade = new tv.ouya.console.api.OuyaFacade(); ...but it will still need the jars to compile. Back when we used to do J2ME I knew more about this stuff. Cheers, Simon On Thu, Jul 18, 2013 at 3:11 PM, James Paige b...@hamsterrepublic.com wrote: Actually, I have a branch of sdl-android in which I just added and committed the ouya jars. I guess if it was easy it would be nice to allow compiling without the ouya libs, but it does not seem to be conveneint at all. I tried Class.forName(tv.ouya.console.api.OuyaFacade) to check if the class exists, and that line worked, but I still can't actually create an instance if it without having the jars present. And yes, the jars have to be in the apk, there doesn't seem to be any way that I know about to have shared copies of them for the whole device. On Fri, Jul 19, 2013 at 01:33:00AM +1200, Ralph Versteegen wrote: I assume that James' intention is to allow building for Android without having to install the ODK. I'm assuming that libs in project/libs are copied into the .apk rather than expected to be present on the device. On 18 July 2013 03:31, Simon Bradley neworigi...@gmail.com wrote: You can use Class.forName(com.ouya.whatever); to check whether a class exists. Also if you compile it with the libs but never actually call that code, it will still run on a device that doesn't have the jars. I think. On Wed, Jul 17, 2013 at 3:33 PM, James Paige b...@hamsterrepublic.com wrote: I am working on getting access to the OUYA ODK from sdl-android. I have figured out that I need to copy the *.jar files from the ODK into project/libs Then I managed to write code in project/java/MainActivity.java which uses the ODK, just enough to do the detection of whether or not the currently running Android device is an OUYA console. Together with connecting code in project/java/Video.java and project/jni/sdl-1.2/src/video/android/SDL_androidvideo.c and in the ohrrpgce's gfx_sdl.bas I was able to test it, and it works nicely. This makes me feel good because I know that support for in-app purchases is now a realistic goal. However, I notice that if the ODK *.jar files are NOT copied into project/libs then the whole project will not even build. Failure to locate the Java class tv.ouya.console.api.OuyaFacade is a compile-time error, not a runtime error. If this was python, I would simply be wrapping it in a try/except and I could easily make the isRunningOnOUYA() function gracefully fail when the needed jars are not found. It could just log a warning and return false. Does anybody know that Java way to do runtime-checking for whether or not an external class is available?
Re: [Ohrrpgce] Java help needed
On 19 July 2013 05:04, James Paige b...@hamsterrepublic.com wrote: On Fri, Jul 19, 2013 at 04:55:06AM +1200, Ralph Versteegen wrote: On 19 July 2013 02:52, James Paige b...@hamsterrepublic.com wrote: On Fri, Jul 19, 2013 at 02:35:41AM +1200, Ralph Versteegen wrote: On 19 July 2013 02:11, James Paige b...@hamsterrepublic.com wrote: Actually, I have a branch of sdl-android in which I just added and committed the ouya jars. That's a simple solution, but might be a problem for submitting Ouya features upstream :/ Hmm I would certainly like for ouya-specific stuff to be upstreamable. On the other hand based on the way that all these games are jammed into one repository, pelya might not be fussy :) Haha! A fellow big-ball-of-mudder! I think pelya and I will get along just fine :) Speaking of which, I noticed that since my fork that there was an Ouya-related change upstream: https://github.com/pelya/commandergenius/commit/cfcd40907d5c116909fd701646ebf440a37f2184 Interesting! I should contact pelya and see if I can learn what his long term plans regarding ouya are. There are a few other Ouya-related changes that he's made, as you'll see. That change is indeed an improvement over the old default mapping, but it will not interfere with the SDL_ANDROID_set_java_gamepad_keymap() method. I haven't been following your changes and am quite frankly lost in all of this button mapping madness. (Hint: git log --grep Ouya pelya, where pelya is the name of the pelya/commandergenius remote, which you won't have until you manually add it with git remote add -f -m sdl_android pelya https://github.com/bob-the-hamster/commandergenius.git;) I'll do that! But should that be my url there, or pelyas? Err, right. I was adding yours to my own and copy pasted. I guess I can remove them later if I learn a better way to make use of them only if they are present. I guess if it was easy it would be nice to allow compiling without the ouya libs, but it does not seem to be conveneint at all. I tried Class.forName(tv.ouya.console.api.OuyaFacade) to check if the class exists, and that line worked, but I still can't actually create an instance if it without having the jars present. Do you mean an instance of tv.ouya.console.api.OuyaFacade? I guess you mean an instance of whatever class lives in a file with an import tv.ouya.console.api.OuyaFacade statement at the top? If so I guess it would necessary to import tv.ouya.console.api.OuyaFacade in a dynamic way too (or the class which makes use of it)? I guess that is what I mean? I am so new to Java, that I am not sure. I went googling for examples of importing conditionally, but have not yet found anything that works for me. And yes, the jars have to be in the apk, there doesn't seem to be any way that I know about to have shared copies of them for the whole device. On Fri, Jul 19, 2013 at 01:33:00AM +1200, Ralph Versteegen wrote: I assume that James' intention is to allow building for Android without having to install the ODK. I'm assuming that libs in project/libs are copied into the .apk rather than expected to be present on the device. On 18 July 2013 03:31, Simon Bradley neworigi...@gmail.com wrote: You can use Class.forName(com.ouya.whatever); to check whether a class exists. Also if you compile it with the libs but never actually call that code, it will still run on a device that doesn't have the jars. I think. On Wed, Jul 17, 2013 at 3:33 PM, James Paige b...@hamsterrepublic.com wrote: I am working on getting access to the OUYA ODK from sdl-android. I have figured out that I need to copy the *.jar files from the ODK into project/libs Then I managed to write code in project/java/MainActivity.java which uses the ODK, just enough to do the detection of whether or not the currently running Android device is an OUYA console. Together with connecting code in project/java/Video.java and project/jni/sdl-1.2/src/video/android/SDL_androidvideo.c and in the ohrrpgce's gfx_sdl.bas I was able to test it, and it works nicely. This makes me feel good because I know that support for in-app purchases is now a realistic goal. However, I notice that if the ODK *.jar files are NOT copied into project/libs then the whole project will not even build. Failure to locate the Java class tv.ouya.console.api.OuyaFacade is a compile-time error, not a runtime error. If this was python, I would simply be wrapping it in a try/except and I could easily make the isRunningOnOUYA() function gracefully fail when the needed jars are not found. It could just log a warning and return false. Does anybody know that Java way to do runtime-checking for whether or not an external class is available?
Re: [Ohrrpgce] Java help needed
On Fri, Jul 19, 2013 at 05:25:15AM +1200, Ralph Versteegen wrote: On 19 July 2013 05:04, James Paige b...@hamsterrepublic.com wrote: On Fri, Jul 19, 2013 at 04:55:06AM +1200, Ralph Versteegen wrote: On 19 July 2013 02:52, James Paige b...@hamsterrepublic.com wrote: On Fri, Jul 19, 2013 at 02:35:41AM +1200, Ralph Versteegen wrote: On 19 July 2013 02:11, James Paige b...@hamsterrepublic.com wrote: Actually, I have a branch of sdl-android in which I just added and committed the ouya jars. That's a simple solution, but might be a problem for submitting Ouya features upstream :/ Hmm I would certainly like for ouya-specific stuff to be upstreamable. On the other hand based on the way that all these games are jammed into one repository, pelya might not be fussy :) Haha! A fellow big-ball-of-mudder! I think pelya and I will get along just fine :) Speaking of which, I noticed that since my fork that there was an Ouya-related change upstream: https://github.com/pelya/commandergenius/commit/cfcd40907d5c116909fd701646ebf440a37f2184 Interesting! I should contact pelya and see if I can learn what his long term plans regarding ouya are. There are a few other Ouya-related changes that he's made, as you'll see. That change is indeed an improvement over the old default mapping, but it will not interfere with the SDL_ANDROID_set_java_gamepad_keymap() method. I haven't been following your changes and am quite frankly lost in all of this button mapping madness. Thankfully the actual code in SDL_ANDROID_set_java_gamepad_keymap() is pretty clean and simple. Most of the madness has just been me going crazy on the wiki trying to figure out how to get to that point :) (Hint: git log --grep Ouya pelya, where pelya is the name of the pelya/commandergenius remote, which you won't have until you manually add it with git remote add -f -m sdl_android pelya https://github.com/bob-the-hamster/commandergenius.git;) I'll do that! But should that be my url there, or pelyas? Err, right. I was adding yours to my own and copy pasted. I guess I can remove them later if I learn a better way to make use of them only if they are present. I guess if it was easy it would be nice to allow compiling without the ouya libs, but it does not seem to be conveneint at all. I tried Class.forName(tv.ouya.console.api.OuyaFacade) to check if the class exists, and that line worked, but I still can't actually create an instance if it without having the jars present. Do you mean an instance of tv.ouya.console.api.OuyaFacade? I guess you mean an instance of whatever class lives in a file with an import tv.ouya.console.api.OuyaFacade statement at the top? If so I guess it would necessary to import tv.ouya.console.api.OuyaFacade in a dynamic way too (or the class which makes use of it)? I guess that is what I mean? I am so new to Java, that I am not sure. I went googling for examples of importing conditionally, but have not yet found anything that works for me. And yes, the jars have to be in the apk, there doesn't seem to be any way that I know about to have shared copies of them for the whole device. On Fri, Jul 19, 2013 at 01:33:00AM +1200, Ralph Versteegen wrote: I assume that James' intention is to allow building for Android without having to install the ODK. I'm assuming that libs in project/libs are copied into the .apk rather than expected to be present on the device. On 18 July 2013 03:31, Simon Bradley neworigi...@gmail.com wrote: You can use Class.forName(com.ouya.whatever); to check whether a class exists. Also if you compile it with the libs but never actually call that code, it will still run on a device that doesn't have the jars. I think. On Wed, Jul 17, 2013 at 3:33 PM, James Paige b...@hamsterrepublic.com wrote: I am working on getting access to the OUYA ODK from sdl-android. I have figured out that I need to copy the *.jar files from the ODK into project/libs Then I managed to write code in project/java/MainActivity.java which uses the ODK, just enough to do the detection of whether or not the currently running Android device is an OUYA console. Together with connecting code in project/java/Video.java and project/jni/sdl-1.2/src/video/android/SDL_androidvideo.c and in the ohrrpgce's gfx_sdl.bas I was able to test it, and it works nicely. This makes me feel good because I know that support for in-app purchases is now a realistic goal. However, I notice that if the ODK *.jar files are NOT copied into project/libs then the whole project will not even build. Failure to locate the Java class tv.ouya.console.api.OuyaFacade is a compile-time
[Ohrrpgce] Java help needed
I am working on getting access to the OUYA ODK from sdl-android. I have figured out that I need to copy the *.jar files from the ODK into project/libs Then I managed to write code in project/java/MainActivity.java which uses the ODK, just enough to do the detection of whether or not the currently running Android device is an OUYA console. Together with connecting code in project/java/Video.java and project/jni/sdl-1.2/src/video/android/SDL_androidvideo.c and in the ohrrpgce's gfx_sdl.bas I was able to test it, and it works nicely. This makes me feel good because I know that support for in-app purchases is now a realistic goal. However, I notice that if the ODK *.jar files are NOT copied into project/libs then the whole project will not even build. Failure to locate the Java class tv.ouya.console.api.OuyaFacade is a compile-time error, not a runtime error. If this was python, I would simply be wrapping it in a try/except and I could easily make the isRunningOnOUYA() function gracefully fail when the needed jars are not found. It could just log a warning and return false. Does anybody know that Java way to do runtime-checking for whether or not an external class is available? --- James ___ Ohrrpgce mailing list ohrrpgce@lists.motherhamster.org http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
Re: [Ohrrpgce] Java help needed
You can use Class.forName(com.ouya.whatever); to check whether a class exists. Also if you compile it with the libs but never actually call that code, it will still run on a device that doesn't have the jars. I think. On Wed, Jul 17, 2013 at 3:33 PM, James Paige b...@hamsterrepublic.comwrote: I am working on getting access to the OUYA ODK from sdl-android. I have figured out that I need to copy the *.jar files from the ODK into project/libs Then I managed to write code in project/java/MainActivity.java which uses the ODK, just enough to do the detection of whether or not the currently running Android device is an OUYA console. Together with connecting code in project/java/Video.java and project/jni/sdl-1.2/src/video/android/SDL_androidvideo.c and in the ohrrpgce's gfx_sdl.bas I was able to test it, and it works nicely. This makes me feel good because I know that support for in-app purchases is now a realistic goal. However, I notice that if the ODK *.jar files are NOT copied into project/libs then the whole project will not even build. Failure to locate the Java class tv.ouya.console.api.OuyaFacade is a compile-time error, not a runtime error. If this was python, I would simply be wrapping it in a try/except and I could easily make the isRunningOnOUYA() function gracefully fail when the needed jars are not found. It could just log a warning and return false. Does anybody know that Java way to do runtime-checking for whether or not an external class is available? --- James ___ Ohrrpgce mailing list ohrrpgce@lists.motherhamster.org http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org ___ Ohrrpgce mailing list ohrrpgce@lists.motherhamster.org http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org