Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
OUYA - The new (upcoming) Android console - Page 6 — Gideros Forum

OUYA - The new (upcoming) Android console

13468911

Comments

  • MobAmuseMobAmuse Member
    edited July 2013
    Did we end up finding out if it is a converted key string problem or a problem with the plugin perhaps?

    I was looking at tostring() but cant use that and at least this thread explains why... http://stackoverflow.com/questions/11464433/create-an-x509certicate-from-a-der-decoded-string

    Can't make any more progress until we get this fixed one way or another anyway.
  • ar2rsawseenar2rsawseen Maintainer
    @MobAmuse not to kill your motivation, but it is very hard to debug something when you can't run the code, so I would not get your hopes up much until we get an Ouya, or someone of you starts debugging it :)

    Likes: MobAmuse

    +1 -1 (+1 / -0 )Share on Facebook
  • ar2rsawseenar2rsawseen Maintainer
    I think I've found a bug in both requestPurchase and requestReceipts and fixing it now.

    @SinisterSoft it would be cool if you could bind to error listeners, which might provide error info why purchase does nothing (most probably it already provides error event, but you are not listening to it, like unknown key type passed to RSA if its a key problem)
    ouya:addEventListener(Event.PRODUCT_REQUEST_FAILED, function(e)
    	print("PRODUCT_REQUEST_FAILED", e.error)
    end)
     
    ouya:addEventListener(Event.PURCHASE_REQUEST_FAILED, function(e)
    	print("PURCHASE_REQUEST_FAILED", e.error)
    end)
     
    ouya:addEventListener(Event.RECEIPT_REQUEST_FAILED, function(e)
    	print("RECEIPT_REQUEST_FAILED", e.error)
    end)
     
    ouya:addEventListener(Event.USER_REQUEST_FAILED, function(e)
    	print("USER_REQUEST_FAILED", e.error)
    end)
  • SinisterSoftSinisterSoft Maintainer
    I'm not at home at present, but I'll do that as soon as I get back and post the answer. Should be within a couple of hours.
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • SinisterSoftSinisterSoft Maintainer
    I think I put those failed events in with no result. Will double check when I get back.
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • SinisterSoftSinisterSoft Maintainer
    Ar2rsawseen: are you in the uk?
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • ar2rsawseenar2rsawseen Maintainer
    noup I'm in Latvia :) or else my English would be much better :D
  • ar2rsawseenar2rsawseen Maintainer
    For now let me fix current bugs and upgrade to a player from newer release, then you can go on testing :)

    Likes: MobAmuse

    +1 -1 (+1 / -0 )Share on Facebook
  • You guys need an ouya! Why not open a donation account on PayPal so that can happen - take my money! :)

    Likes: SinisterSoft

    +1 -1 (+1 / -0 )Share on Facebook
  • ar2rsawseenar2rsawseen Maintainer
    @MobAmuse well money is not really an issue, but delivering it to our part of the world, with all the customs is (although game.co.uk option seems quite feasible for Latvia). But if someone would visit us and brought Ouya with, that would have been awesome :)
  • eBay would prolly be better.
  • ar2rsawseenar2rsawseen Maintainer
    in Latvia there is a huge tax importing electronics from outside of Eurozone, so unfortunately ebay in most cases is not better :(
  • Ah ok not good :P
  • Duty Rates
    The duty rates applied to imports into Latvia typically range between 0% (for example books) and 17% (for example Wellington Boots). Some products, such as Laptops, Mobile Phones, Digital cameras and Video Game consoles, are duty free. Certain goods may be subject to additional duties depending on the country of manufacture, for example Bicycles made in China carry an additional (anti dumping) duty of 48.5%.
  • ar2rsawseenar2rsawseen Maintainer
    @MobAmuse that seems to be outdated, lots have changed since Latvia has started moving into Eurozone, last time my friend ordered Raspberry Pi (or something like that), he paid almost 3x the price and had to go to airport to take it manually from custom.

    Likes: MobAmuse

    +1 -1 (+1 / -0 )Share on Facebook
  • ar2rsawseenar2rsawseen Maintainer
    edited July 2013
    I've updated OUYA in the labs.

    1) I upgraded it to use latest Gideros release
    2) Updated to latest OUYA SDK
    3) fixed bug with requestPorducts, requestReceipts
    4) reimplemented ouya:init so appId which is read from key.der file gets passed to Java as bytes (and not as String)
    5) updated example Gideros project to include iap test
    6) added iap.html with simple description of iaps I've posted somehwere above in the forum
    7) separated ouya code from plugin code and tested plugin, so I know it works, only thing I'm not sure is ouya part of the code :)
    +1 -1 (+3 / -0 )Share on Facebook
  • MobAmuseMobAmuse Member
    edited July 2013
    I will check it all out on Friday - thank you for your hard work.
  • SinisterSoftSinisterSoft Maintainer
    @ar2rsawseen

    for 'ouya:requestReceipts()' it would either crash out or display one of these, more often than not 'unknown block type' though.

    RECEIPT_REQUEST_FAILED unknown block type

    RECEIPT_REQUEST_FAILED org.apache.http.client.ClientProtocolException

    for 'ouya:requestPurchase("BacteriaUnlimitedPlay")' it went to make the purchase (things looked very good), but got stuck and didn't return.

    Then i tried the ouya:requestReceipts() again and got this:

    RECEIPT_REQUEST_FAILED input too large for RSA cipher.

    next try:

    RECEIPT_REQUEST_FAILED unknown block type

    next try:

    RECEIPT_REQUEST_FAILED org.apache.http.client.ClientProtocolException

    I made another attempt at purchase, this time clicking cancel. I got this back:

    PURCHASE_REQUEST_FAILED User canceled purchase

    But the screen went black, the audio kept playing and the control was there - I could hear proper game sounds when clicking, etc - but no video - all black.

    I tried again to make a purchase - it just gets stuck after saying ok to make the purchase.


    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • SinisterSoftSinisterSoft Maintainer
    @ar2rsawseen

    In the Ouya ODK (available as a free download) there are 2 .apk files to make an emulator or another Android device act like an Ouya. Could you not install these on your Android device to test the IAP?

    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • SinisterSoftSinisterSoft Maintainer
    Tried the user id request and got:

    USER_REQUEST_SUCCESS e9c3e (plus the rest of my user id).

    Tried the product list:

    ouya:addEventListener(Event.PRODUCT_REQUEST_SUCCESS, function(e)
    print("PRODUCT_REQUEST_SUCCESS")
    print_r(e.products)
    end)

    ouya:requestProducts({"BacteriaUnlimitedPlay"})


    got:

    PRODUCT_REQUEST_SUCCESS
    main.lua:210: attempt to call global 'print_r' (a nil value)
    stack traceback:
    main.lua:210: in function
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • ar2rsawseenar2rsawseen Maintainer
    @SinisterSoft yes I've tried those two apk files, unfortunately, they are higher level API then my phone allows.
    Ok so at least requestUserId works, thats great.
    Here is the code for print_r, it's also included with new example
    function print_r (t, indent, done)
      done = done or {}
      indent = indent or ''
      local nextIndent -- Storage for next indentation value
      for key, value in pairs (t) do
        if type (value) == "table" and not done [value] then
          nextIndent = nextIndent or
              (indent .. string.rep(' ',string.len(tostring (key))+2))
              -- Shortcut conditional allocation
          done [value] = true
          print (indent .. "[" .. tostring (key) .. "] => Table {");
          print  (nextIndent .. "{");
          print_r (value, nextIndent .. string.rep(' ',2), done)
          print  (nextIndent .. "}");
        else
          print  (indent .. "[" .. tostring (key) .. "] => " .. tostring (value).."")
        end
      end
    end
    will try to come up with something for requestPurchase and requestReceipts
  • ar2rsawseenar2rsawseen Maintainer
    edited July 2013
    Ah "unknown block type" can indicate bad padding/byte sequence, thus appKey seems still not to work.

    If anyone is using exported modified ouya project instead of OuyaPlayer, you can help me to confirm that.
    Download your key.der from ouya portal.
    Use a free program called Hexplorer (http://sourceforge.net/projects/hexplorer/)

    You can use that to open key.der and see the hex values - go to the Edit menu, Select All, Copy As-> C Data, and then you can ctrl-v it into any text editor to get the table data. Put a (byte) in front of each value, make sure you end the last value with a comma, and you're gold!

    Then go to /src/com/giderosmobile/android/plugins/ouya/GOuya.java
    Find method:
    static public void setUp(String devId, byte[] appId)

    And modify it to look like that (copying you bytes there)
     static public void setUp(String devId, byte[] appId){
        	ouyaFacade.init(sActivity.get(), devId);
     
        	//copy you key here
        	private static final byte[] APPLICATION_KEY = {
                (byte) 0x30,(byte) 0x81,(byte) 0x9f,(byte) 0x30,(byte) 0x0d,(byte) 0x06,(byte) 0x09,(byte) 0x2a,
                (byte) 0x86,(byte) 0x48,(byte) 0x86,(byte) 0xf7,(byte) 0x0d,(byte) 0x01,(byte) 0x01,(byte) 0x01,
                (byte) 0x05,(byte) 0x00,(byte) 0x03,(byte) 0x81,(byte) 0x8d,(byte) 0x00,(byte) 0x30,(byte) 0x81,
                (byte) 0x89,(byte) 0x02,(byte) 0x81,(byte) 0x81,(byte) 0x00,(byte) 0xdc,(byte) 0xbe,(byte) 0x5f,
                (byte) 0x43,(byte) 0x14,(byte) 0x48,(byte) 0xb1,(byte) 0xb3,(byte) 0x0d,(byte) 0x2f,(byte) 0x7d,
                (byte) 0x69,(byte) 0x02,(byte) 0xda,(byte) 0xae,(byte) 0x19,(byte) 0xcd,(byte) 0x0f,(byte) 0xc8,
                (byte) 0x70,(byte) 0x58,(byte) 0x72,(byte) 0x30,(byte) 0xf5,(byte) 0xd1,(byte) 0x18,(byte) 0xea,
                (byte) 0x98,(byte) 0x3d,(byte) 0x50,(byte) 0x3c,(byte) 0xcb,(byte) 0xb2,(byte) 0x1b,(byte) 0xf7,
                (byte) 0x65,(byte) 0x4c,(byte) 0xb0,(byte) 0x82,(byte) 0x0e,(byte) 0x43,(byte) 0xc4,(byte) 0x67,
                (byte) 0x58,(byte) 0x05,(byte) 0x18,(byte) 0xf9,(byte) 0x45,(byte) 0x20,(byte) 0xcb,(byte) 0x14,
                (byte) 0x4a,(byte) 0xb7,(byte) 0xa7,(byte) 0x55,(byte) 0x83,(byte) 0x45,(byte) 0x6e,(byte) 0x5d,
                (byte) 0x93,(byte) 0xf7,(byte) 0xe2,(byte) 0x5d,(byte) 0x8e,(byte) 0x3b,(byte) 0xf3,(byte) 0x93,
                (byte) 0x6c,(byte) 0x30,(byte) 0xe0,(byte) 0x13,(byte) 0xd5,(byte) 0x21,(byte) 0xf1,(byte) 0x21,
                (byte) 0x90,(byte) 0xa4,(byte) 0xed,(byte) 0x07,(byte) 0x51,(byte) 0x78,(byte) 0x56,(byte) 0xa6,
                (byte) 0xcb,(byte) 0x15,(byte) 0x99,(byte) 0x46,(byte) 0xc4,(byte) 0xb8,(byte) 0xc7,(byte) 0xbd,
                (byte) 0xd8,(byte) 0x1c,(byte) 0x87,(byte) 0x76,(byte) 0xc8,(byte) 0x54,(byte) 0x85,(byte) 0x2a,
                (byte) 0x51,(byte) 0xcf,(byte) 0x5b,(byte) 0xd2,(byte) 0xc7,(byte) 0x3a,(byte) 0xbd,(byte) 0x1b,
                (byte) 0x42,(byte) 0x11,(byte) 0x65,(byte) 0xae,(byte) 0x17,(byte) 0xbb,(byte) 0x55,(byte) 0xf4,
                (byte) 0x58,(byte) 0x54,(byte) 0x9f,(byte) 0xfa,(byte) 0x59,(byte) 0x5c,(byte) 0xbf,(byte) 0xda,
                (byte) 0xfe,(byte) 0xbe,(byte) 0x34,(byte) 0xc6,(byte) 0xc3,(byte) 0x02,(byte) 0x03,(byte) 0x01,
                (byte) 0x00,(byte) 0x01,
        };
        	 try {
        	//enter APPLICATION_KEY here
                 X509EncodedKeySpec keySpec = new X509EncodedKeySpec(APPLICATION_KEY);
                 KeyFactory keyFactory = KeyFactory.getInstance("RSA");
                 mPublicKey = keyFactory.generatePublic(keySpec);
             } catch (Exception e) {
             }
        }
    Thus for each request it will be using this appKey instead of the one provided from lua (note you still need to call ouya:init in lua and provide any value as appKey :) )

    If this works, then all we need to do is to figure out how to properly pass key
    If this does not work, problem is probably somewhere else :)
  • ar2rsawseenar2rsawseen Maintainer
    edited July 2013
    Hmm, on the other hand
    I've just compared byte array I got from key.der in hexplorer with the byte array provided from lua to Java by reading key.der and they match completely.
    So the problem is probably somewhere else. :-/
    Still just in case, if someone could do the test above, it would be great :)
  • I got as far as this with my own dev id and key etc...
    image.jpg
    2592 x 1936 - 1M
  • ar2rsawseenar2rsawseen Maintainer
    edited July 2013
    @MobAmuse so it works for you?
    If you are the developer of the app (who created the purchasable product) and also logged in Ouya with same developer account, you should not be charged for purchase (this is how you actually supposed to test purchases) but its based on docs and I don't know what happens in real life.

    Does it get back to your game correctly after canceling, etc?
  • MobAmuseMobAmuse Member
    edited July 2013
    @ar2rsawseen Well AFAIK the transaction/purchase it supposed to complete but the developer is not charged so no it's not working.

    If I hit cancel my app is is still running but the screen goes black so I cant see anything but the main loop still runs and sound is present - odd.

    I only attempt purchase of the $2.99 entitlement to the game at this stage on the Blue U button on Ouya (that's what you see happen in the picture).

    As I said I use my own dev id, key.der (d/l from the OUYA dev portal for this app) and request the unlock as named in the portal.

    Almost there but not quite :) I only 'just about' know what I'm doing with all this and think Sinistersoft will be better able to answer any technical questions you may have.
  • For the record: I just attempted to buy somebody else's app on the OUYA store and everything followed the same process but the transaction was successful using the same Gamer Profile/card and account.
  • SinisterSoftSinisterSoft Maintainer
    I think I know what the problem was, I had to make my own player with the id 'com.sinistersoft.bacteria' - to match the one for the key/purchases.

    Now I get:

    USER_REQUEST_SUCCESS e9cxxxx-xxx-xxx-x-x-x-x
    PRODUCT_REQUEST_SUCCESS
    RECEIPT_REQUEST_SUCCESS

    The product request doesn't return anything except success though. On a purchase or a cancel I get a black screen - but the game is still running and controllable.

    Likes: MobAmuse

    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
    +1 -1 (+1 / -0 )Share on Facebook
  • SinisterSoftSinisterSoft Maintainer
    @MobAmuse Could you get the product_request to return any data (apart from success), also if you use the same Ouya account email address as the one registered to the same developer then your card isn't charged.

    @ar2rsawseen But shouldn't it register as purchased when you do a receipt request? I get nothing back - but empty data - but that might also be the same problem as the product request returning empty data too? It might in reality be returning a receipt?

    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • The problem seems to be related to the length of time it sits saying 'Hold Tight Just a Sec - Processing Payment' and the event listener prints 'purchasing' ...then after waiting about a minute or more it shows the screen in the picture above. The event listener then prints 'PURCHASE REQUEST FAILED '. Note: Sometimes it never even gets that far and it just hangs on 'Processing Payment'. If you go to purchase but actually don't and hit cancel instead, the screen also goes black I found. I tried a few times now and it just hangs on the purchase and never even gets to the screen above any longer even after reseting everything. Hope that helps.
Sign In or Register to comment.