Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: Using E-Readers to view controls data.  (Read 3392 times)

0 Members and 1 Guest are viewing this topic.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19428
  • Last login:Today at 11:06:50 am
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Using E-Readers to view controls data.
« on: August 28, 2011, 09:16:47 pm »
So as many of you know a popular chain of book stores is going under.  I picked up a Kobo for 50 bucks, which I thought was a pretty good deal even if I'm not particularly interested in an e-reader. 

The thing is black and white BUT it uses the e-ink display, meaning that it uses very little power and the picture is always crisp and readable regardless of lighting conditions. 

Anyway, aside from the slow page loading (which is inheriant in all e-ink displays) I've been very impressed with the device, particularly how small you can make the text and still have it perfectly readable. 

Remember those fighting games moves lists we were talking about a few weeks ago?  (BTW... how's that going Monkey?)  I put one of those on there (rotated of course) and it looked great!

I have more projects than I know what to do with atm but I think we need an e-reader platform to automatically load up instruction manuals and such to our e-readers and tablets. 

I think the Kobo is a particularly good choice as a base because:

1.  It's cheap!  (Find another brand new e-reader for under 80 bucks.)
2.  The OS is open source!  (Runs a flavor of linux... source and drivers for the e-display and wifi are included).
3.  Built in wifi, which means no cables to update it. 
4.  In managment mode the device shows up as a harddrive, meaning it is easy to add new files to the device.
5.  Supports PDF files. PDFs are fairly standardized so it's easy to make them and put them on any device.
6.  Holding down the "select" button during boot will force the kobo to boot a OS off of the external SD cart slot, meaning we can hack the os without damaging the reader!

There are a few hiccups though, namely the reader app.  While the OS is open-source, the e-commerce and book reading app are not.  Considering the device only supports the epub and pdf formats, I don't think it would be terribly hard for someone to write a linux app that displays these files. 


Here is how I was thinking it could work. 

1.  The user has a SD card with the custom OS and pdf files of all the instruction cards, movelists, ect...  on it as well as a linux-based pdf reader.
2.  The pdf reader is constantly looking for a host app via wifi.
3.  The host app (in thinking mamhooker could do this), simply sends the romname of the game currently being played and the pdf app on the e-reader automatically switches books based on which romname is sent. 
3b.  If the pdf app can't find a book for the rom in question it requests it from the host app.  If the host app sends back a URL the pdf viewer on the e-reader prompts you to download it. 

I'm wondering if any linux gurus with Kobo's or people willing to buy a Kobo would like to look into that. 

For the smart phones and tablets it would be trivial to adapt to this system as well considering you can actually write apps for them without having to hack anything. 

Anyway, just a thought.  If anyone is interested I'll take a few snaps and post them tomorrow.

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: Using E-Readers to view controls data.
« Reply #1 on: August 29, 2011, 02:30:11 am »
At the end of this blog post there is the toolchain for compiling applications that can run on a hacked Kobo. There is a Windows installer so it looks like you don't even need linux to develop for it. The first thing I would try is get a helloworld app executing and then try to communicate over wifi and display an image. That is all you'd really need to use it as an external display.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19428
  • Last login:Today at 11:06:50 am
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Using E-Readers to view controls data.
« Reply #2 on: August 29, 2011, 08:33:14 pm »
Thanks man.  You know I'm really bad about not posting links.  I was reading that page when I posted the first comment!

I've been playing around with it a bit more.  There are settings in the config file that allow you to redirect the shop channel. 

The file looks something like this:  (It varies depending upon where you purchased the device and what version you have)

=====================
[General]
EulaURL=http://www.borders.com/online/store/BordersMediaView_ebookstermsandconditions
ImageHandlerURL=http://ecimages.kobobooks.com/Image.ashx
LastSyncTime=@Variant(\0\0\0\x10\0%x\xfb\x4OL\a\0)
LastWebSyncTime=@Variant(\0\0\0\x10\0%x\xfb\x4U\x92\x1\0)
PartnerProxyHandlerURL=https://mobilepartner.kobobooks.com/mobileRequest.ashx
PasswordRetrievalURL=https://www.borders.com/online/store/MobilePasswordResetView
PurchaseURL=https://partner.kobobooks.com/checkout.html
RegistrationPageURL=https://www.kobobooks.com/mobilesupport/createaccount.html
RequestURL=http://mobile.kobobooks.com/mobileRequest.ashx
StaticSpacePercentage=75
ThankYouURL=http://www.kobobooks.com/mobilesupport/thankyou.html
Version=0.1
WebsiteURL=http://www.kobobooks.com
WebstoreProxyURL=https://partner.kobobooks.com
WebstoreURL=http://webstore.kobobooks.com
cookies="@ByteArray(NID=50=DWybJA3aVdk9ShCtb6s0JIDH6xS742pfIl1EuodMb5nMFzZo1EqgPOnPR_e2-2M-P_Ma_R09YEs2869NQhnAnABmEiWpTIi44SwRDPr72T6DDLuQ3YT5PxxXzMxEWqVo; HttpOnly; expires=Tue, 28-Feb-2012 23:08:57 GMT; domain=.google.com; path=/)", "@ByteArray(PREF=ID=9cb255a07423b138:U=4425a8b210b723dd:FF=0:TM=1314659268:LM=1314659470:S=7NPOQzLdkqMT6PgH; expires=Wed, 28-Aug-2013 23:11:10 GMT; domain=.google.com; path=/)", "@ByteArray(wsa=BordersUS; domain=.kobobooks.com; path=/)", "@ByteArray(wsuid=f9ec57c2-5715-460b-a1bd-04b648d8f06e; domain=.kobobooks.com; path=/)", "@ByteArray(pwspid=00000000-0000-0000-0000-000000000210; domain=.kobobooks.com; path=/)", "@ByteArray(pwsav=1.9; domain=.kobobooks.com; path=/)", "@ByteArray(persistent=culture=en; expires=Wed, 28-Sep-2011 23:12:23 GMT; domain=.kobobooks.com; path=/)", "@ByteArray(ASP.NET_SessionId=lalk1g45jkkjktfdlzbtbavv; HttpOnly; domain=webstore.kobobooks.com; path=/)", "@ByteArray(wscf=kxml; domain=.kobobooks.com; path=/)", "@ByteArray(wscfv=2.0; domain=.kobobooks.com; path=/)", "@ByteArray(__utmz=1.1314659545.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); expires=Tue, 28-Feb-2012 11:12:25 GMT; domain=.kobobooks.com; path=/)", "@ByteArray(__utma=1.1421490188.1314659545.1314659545.1314659545.1; expires=Wed, 28-Aug-2013 23:12:25 GMT; domain=.kobobooks.com; path=/)", "@ByteArray(__utmc=1; domain=.kobobooks.com; path=/)", "@ByteArray(__utmv=1.|1=d=00000000-0000-0000-0000-000000000210=1; domain=webstore.kobobooks.com; path=/)", "@ByteArray(2=a=Kobo=1; domain=webstore.kobobooks.com; path=/)", "@ByteArray(3=customerid=f9ec57c2-5715-460b-a1bd-04b648d8f06e=1; domain=webstore.kobobooks.com; path=/)", "@ByteArray(__utmb=1.1.10.1314659545; expires=Mon, 29-Aug-2011 23:42:26 GMT; domain=.kobobooks.com; path=/)"
last_wifi_state=true
readingFontFace=0
readingFontSize=4
showBookCoverWhenOff=true
showBookCoverWhenSuspended=true
useDaylightSavings=true
================================


You can change the "WebstoreURL" part you any url you like and it will load it just fine.  The reader will overwrite your setting if you choose to update the store or sync though.  This can be bypassed though if you remove all of the kobo related settings so that the device doesn't know where to get it's store data. 

It is unknown exactly which ones you have to remove though. 


But basically it runs a version of QT to access the webstore, so it will render webpages, even ones with scripting, pretty well. 


So a more universal method might be to make a special webpage that can be locally hosted or hosted on a website.  I've been playing around with such a method for mamehooker's display files but my html/scripting isn't good enough to do what I want. 

Basically what I want to make is a webpage that does a re-direct to a webpage that is essentially a image of the display file.  (That part is easy, just a simple redirect).  I also want the page I'm browsing to constantly check if that redirect URL has changed, and refresh the page if it has.  That part is a bit more difficult as constantly refreshing an image or the page causes errors. 

Anybody know how to have a webpage constantly check a txt file for a URL and navigate to the URL only if it's different from the previous URL?  Really fancy scripting isn't going to work as it needs to run on mobile devices. 


It would also be nice if we could do really fancy things like screen rotation and image resizing on the html end of things, but I know how complex that could get.

I think this could be applied not only to generic instruction card images, but to controls.dat viewers as well.  Users could make a webpage with their control panel and generic labels and the viewer could update the label text in the html. 

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: Using E-Readers to view controls data.
« Reply #3 on: August 29, 2011, 09:06:38 pm »
GameEx has a feature called "Game Extender" which will post graphics for a game to a webpage. That would probably work for this.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19428
  • Last login:Today at 11:06:50 am
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Using E-Readers to view controls data.
« Reply #4 on: August 29, 2011, 10:43:11 pm »
Well generating a webpage is trivial.  Mamehooker does that right now. 

The issue is making the webpage smart enough so that it updates itself. 

Lets say you are playing MK2, and are browsing through the move lists and then decide to quit and fire up sfII.  The webpage should automatically navigate to sfII info without having to hit refresh or anything.  I can do auto refresh scripts and stuff but they waste BW and are glitchy. 

We need something smart. 

newmanfamilyvlogs

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1694
  • Last login:June 15, 2022, 05:20:38 pm
    • forum.arcadecontrols.com/index.php/topic,103584.msg1096585.html#msg1096585
    • Newman Family Vlogs
Re: Using E-Readers to view controls data.
« Reply #5 on: August 30, 2011, 10:14:41 am »
What you're looking for is some kind of ajaxy stuff... I believe it's generically referred to as "AJAX Push", so something along the lines of this:
http://www.ape-project.org/

That's probably a little heavier than what you're going for.

You're probably going to have the best luck with the webpage on the client polling your target document and then using javascript to replace a divs contents with your game data, rather than your server pushing to the client.

To lower the amount of traffic going on perhaps you could have two pages, one with just the current games's name in mame in a flat text file that gets polled by the browser and stored in a variable, then a stupid text compare each poll with the previously polled value, if changed, do the content replace.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19428
  • Last login:Today at 11:06:50 am
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Using E-Readers to view controls data.
« Reply #6 on: August 30, 2011, 02:15:49 pm »
Thanks man, I'll look into it. 

But at first glance, yeah that might be a bit intensive, we'll see.

newmanfamilyvlogs

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1694
  • Last login:June 15, 2022, 05:20:38 pm
    • forum.arcadecontrols.com/index.php/topic,103584.msg1096585.html#msg1096585
    • Newman Family Vlogs
Re: Using E-Readers to view controls data.
« Reply #7 on: August 30, 2011, 02:41:50 pm »
The first part would be intensive. the second part, not so much, assuming the browser on the device parses javascript well enough.

Do you have any idea what sort of webserver you'd be running on your arcade machine?  I bet something like this would be ideal:
http://www.rejetto.com/hfs/

What you should try is see if this demo works on your ereader:
http://www.dhtmlgoodies.com/index.html?whichScript=ajax-dynamic-pages

The current example loads more content on user interaction like this:
Code: [Select]
<a href="#" onclick="dynPageObj.setUrl('getPage.php?pageNo=2');dynPageObj.loadPage();this.style.display='none';return false">Next page</a>
This is all client side code.

What we would want to do is change that javascript from being called onclick to something more like this:
Code: [Select]
<script type="text/javascript">
var c=0;
var t;
var timer_is_on=0;

function timedCount()
{
document.getElementById('txt').value=c;
c=c 1;
t=setTimeout("timedCount()",1000);
}

function doTimer()
{
if (!timer_is_on)
  {
  timer_is_on=1;
   dynPageObj.setUrl('getPage.php?pageNo=2');
   dynPageObj.loadPage();;
  }
}

Then call doTimer() in the html body onLoad tag.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19428
  • Last login:Today at 11:06:50 am
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Using E-Readers to view controls data.
« Reply #8 on: September 01, 2011, 06:24:07 pm »
Heh... I can't even get that example to run on my PC, so I'm guessing it has too many dependancies to run on a e-reader/smart phone.

I like the server to linked to though... that's probably what I will use. 

I terms of what I want it to do (at least for the cards) is the following:

1.  The page should be incredibly simple.  Just a blank page with the current image scaled to fit the entire screen.  Tiny left, right and home buttons should overlay the graphic at the bottom. 

2.  The way the page is coded, I should be able to point to a folder, and it gets the images from said folder and puts them into the page as described above, essentially like an image viewer. 

3.  The script should store the current image that is being viewed and constantly check a plain text file for the folder URL (the one used to setup the gallery).  If the URL just retrieved doesn't match the current URL, the script should simply set the current image variable back to 0 and update the folder URL... this should essentially reset the viewer without really having to reload the page.  (Images are loaded upon navigation, so it would simply be reloading a single image). 

I am really dumb with html, only being able to do a bit of javascript.  I don't have a clue how to read from a text file without excessive dependances.  Any help would be appreciated.