CodeWalrus

Development => Calculators => Calculator News, Coding, Help & Talk => Topic started by: Adriweb on July 04, 2015, 11:42:05 PM

Title: A wrapper for TI's JavaScript-based z80/eZ80 emulators
Post by: Adriweb on July 04, 2015, 11:42:05 PM
I've just published on GitHub a wrapper for TI-SmartView's js emulators (https://github.com/TI-Planet/ti_jsemu_wrapper), which makes the emu much more usable for screen-recording purposes, for instance :D
Indeed, when you run the emulator inside a recent browser, it's running much, much faster than from within SmartView (because Java's Webview yield poor JS performance, apparently...)

Screenshot:
(https://i.imgur.com/JHRzH0A.png) (https://i.imgur.com/5xqbh9K.png)

The files/source + readmes on how to set it up are there (there is a bit of setup since you'll need to provide TI's files like the emu(s) core etc.).

What's in it right now:
What's not in it right now:
So, while we wait for an actual community-made emulator that natively provides all kind of nice user+developer-oriented features, this is the next best thing, I guess :)

Feel free to report feedback, or even make pull requests :)


Credits:
- critor, for the hand pointer and key history ideas and initial implementations
- me, for the rest
- TI of course, for the emulators we build things around :P



(Also posted on TI-Planet (https://tiplanet.org/forum/viewtopic.php?f=10&t=16926) and Cemetech (http://www.cemetech.net/forum/viewtopic.php?t=11727))
Title: Re: A wrapper for TI's JavaScript-based z80/eZ80 emulators
Post by: Dream of Omnimaga on July 05, 2015, 05:02:11 AM
Wow, I didn't realize that in a browser it would get faster. I'll have to try it. For screen capture I just used camstudio personally, but it's not really ideal. Thanks a lot for this :)

Will this work if I only have the trial version of the emulator? As in, will it let me use TI-Smartview during the last 25 days or so I have left on my trial period?
Title: Re: A wrapper for TI's JavaScript-based z80/eZ80 emulators
Post by: Adriweb on July 05, 2015, 06:15:12 AM
Quote from: DJ Omnimaga on July 05, 2015, 05:02:11 AMWow, I didn't realize that in a browser it would get faster. I'll have to try it. For screen capture I just used camstudio personally, but it's not really ideal. Thanks a lot for this :)
You sure can continue to use any video capture software, but at least, filming the browser will result in having smoother captures / higher FPS :)

Quote from: DJ Omnimaga on July 05, 2015, 05:02:11 AMWill this work if I only have the trial version of the emulator? As in, will it let me use TI-Smartview during the last 25 days or so I have left on my trial period?
This is not using any of the actual SmartView code, only the JS emulator core, so yes. But I have to remind users of this of what's written in the license:
QuoteAt the end of the trial period you agree to cease use of the Program, unless you have purchased a license to use the Program
which makes the potential "cracking" issue seen by KermM moot, at least as far as I understand it: "Program" is defined as "The software program(s) in this installation and any related documentation", which includes anything from within the SmartView folder, basically, so the JavaScript emu core as well. Thus, it would be the user's fault to use an expired SmartView file with the wrapper, certainly not the fault of the wrapper (nor its creators) :D
Title: Re: A wrapper for TI's JavaScript-based z80/eZ80 emulators
Post by: Dream of Omnimaga on July 05, 2015, 06:39:10 AM
I was actually more wondering if the program would work with a trial version or only with a registered version, because I still had a few days left and did not plan to continue using anything using TI-SmartView code after my trial copy expired. I didn't see Kerm posts about it until now.

That said, that's kinda a gray area if your emulator wrapper still works past expiration, since that's still technically allowing using a paid emulator for free, something we don't encourage (which is the reasons why I am reluctant about making this topic as front-page news), but you are still on the legal side of things from what I can gather. But if TI-Smartview is coded so badly that it can be ran off a webpage at will, then I don't know what to say. Just make sure that your software doesn't include any form of crack, keygen or anything of the like. Ideally, in the future, a third-party emulator should be made.
Title: Re: A wrapper for TI's JavaScript-based z80/eZ80 emulators
Post by: Adriweb on July 05, 2015, 03:45:00 PM
Quote from: DJ Omnimaga on July 05, 2015, 06:39:10 AMI was actually more wondering if the program would work with a trial version or only with a registered version, because I still had a few days left and did not plan to continue using anything using TI-SmartView code after my trial copy expired. I didn't see Kerm posts about it until now.
The wrapper only requires the .js file and some images, and all of that is readily available within SmartView's folder by unzipping the emulators/[thecalcnamehere].jar. So, it won't know if it's from a demo or a registered version of SV.

Quote from: DJ Omnimaga on July 05, 2015, 06:39:10 AMThat said, that's kinda a gray area if your emulator wrapper still works past expiration, since that's still technically allowing using a paid emulator for free, something we don't encourage (which is the reasons why I am reluctant about making this topic as front-page news), but you are still on the legal side of things from what I can gather.
I myself don't encourage bypassing trial and whatnot, obviously. It's also why I copy/pasted the relevant license info about the fact that the user himself should stop using anything included in SV when it expires. That includes the .js.

Quote from: DJ Omnimaga on July 05, 2015, 06:39:10 AMBut if TI-Smartview is coded so badly that it can be ran off a webpage at will, then I don't know what to say.
Well I guess that's the thing with JS code.
However, I'd say the emu core is sufficiently well coded that it is completely independant from the host app, SmartView. I just happen to provide an extremely light host for the JS, so that anyone doesn't have to launch it himself, and with a few convenient tools like image/video capture.

Quote from: DJ Omnimaga on July 05, 2015, 06:39:10 AMJust make sure that your software doesn't include any form of crack, keygen or anything of the like. Ideally, in the future, a third-party emulator should be made.
I don't even think we can call the wrapper a "software", it's just a few dozens of html+js+css lines, and most of them are optional (you could launch the js with very few lines). You can see by yourself it's nothing else than that: https://github.com/TI-Planet/ti_jsemu_wrapper :D
And yeah, whenever there will be a community emulator, then this will probably be rendered pointless. But, as Lionel said, "double bonus points for such an emulator to be open source software" ...
Title: Re: A wrapper for TI's JavaScript-based z80/eZ80 emulators
Post by: Dream of Omnimaga on July 05, 2015, 07:06:11 PM
Yeah I just checked the emulator folders. I am astonished that TI made the emulator this insecure against attempts at using it for free legally. What were they thinking? I guess that's what happens when they spend 99% of their energy locking down the TI-Nspire.

Now that has me thinking: Could someone replace the files with his own emulator and use it from TI-Smartview itself?
Title: Re: A wrapper for TI's JavaScript-based z80/eZ80 emulators
Post by: Adriweb on July 05, 2015, 07:14:35 PM
Quote from: DJ Omnimaga on July 05, 2015, 07:06:11 PMYeah I just checked the emulator folders. I am astonished that TI made the emulator this insecure against attempts at using it for free legally. What were they thinking? I guess that's what happens when they spend 99% of their energy locking down the TI-Nspire.
The thing is that TI has been making JS-based z80 emulator for some years now, though never got released publicly, instead they were used in the context of TI-ExamCalc. And that is integrated into online-exam software, like Pearson stuff etc. Anyone able to correctly use google can actually get ahold of those TI files.
So, these JS emulators have to be usable in a standalone way, since they have to be embedded in non-TI-made hosts.
Here, it's the same thing, and the wrapper just happens to be one more host for these files.

Quote from: DJ Omnimaga on July 05, 2015, 07:06:11 PMNow that has me thinking: Could someone replace the files with his own emulator and use it from TI-Smartview itself?
Technically, sure :) But you'd have to implement all the functions/methods that the host (SV) expects to find/call, and everything. Good luck with that, it would be a huge amount of reverse-engineering :P
Title: Re: A wrapper for TI's JavaScript-based z80/eZ80 emulators
Post by: Lionel Debroux on July 05, 2015, 07:40:36 PM
QuoteBut you'd have to implement all the "interfaces" that the host (SV) expects to find/call, and everything. Good luck with that, it would be a huge amount of reverse-engineering :P
That said, this reverse-engineering could be quite clean-room, through DTrace-style user-space probes in the JVM, or custom JVM builds.
For understanding some aspects of the communication between the Prime CK and the computer version of the Prime software, I patched Wine on my computer.
Title: Re: A wrapper for TI's JavaScript-based z80/eZ80 emulators
Post by: DarkestEx on July 05, 2015, 07:53:46 PM
Sounds pretty interesting.
Can you download SV's trial for free without having the actual device?
Title: Re: A wrapper for TI's JavaScript-based z80/eZ80 emulators
Post by: Dream of Omnimaga on July 05, 2015, 07:57:13 PM
Yes, it's on TI website. The trial lasts 90 days. Keep in mind that it doesn't emulate undocumented stuff like 8 bits mode, though, so Pac-Man CE won't work.
Title: Re: A wrapper for TI's JavaScript-based z80/eZ80 emulators
Post by: DarkestEx on July 05, 2015, 07:59:45 PM
Quote from: DJ Omnimaga on July 05, 2015, 07:57:13 PM
Yes, it's on TI website. The trial lasts 90 days. Keep in mind that it doesn't emulate undocumented stuff like 8 bits mode, though, so Pac-Man CE won't work.
Nice! I can use it forever!
Title: Re: A wrapper for TI's JavaScript-based z80/eZ80 emulators
Post by: Adriweb on July 06, 2015, 12:22:11 AM
Quote from: DarkestEx on July 05, 2015, 07:59:45 PM
Quote from: DJ Omnimaga on July 05, 2015, 07:57:13 PM
Yes, it's on TI website. The trial lasts 90 days. Keep in mind that it doesn't emulate undocumented stuff like 8 bits mode, though, so Pac-Man CE won't work.
Nice! I can use it forever!
Not quite, SmartView itself will still be asking for a license when it expires, and you won't be able to launch it - the .js file, though, will of course be accessible, with or without any kind of wrapper like this one.
But yeah, I'll not copy/paste again the relevant part of the license saying you can't use it ;)
Title: Re: A wrapper for TI's JavaScript-based z80/eZ80 emulators
Post by: DarkestEx on July 06, 2015, 12:28:22 AM
Quote from: Adriweb on July 06, 2015, 12:22:11 AM
Quote from: DarkestEx on July 05, 2015, 07:59:45 PM
Quote from: DJ Omnimaga on July 05, 2015, 07:57:13 PM
Yes, it's on TI website. The trial lasts 90 days. Keep in mind that it doesn't emulate undocumented stuff like 8 bits mode, though, so Pac-Man CE won't work.
Nice! I can use it forever!
Not quite, SmartView itself will still be asking for a license when it expires, and you won't be able to launch it - the .js file, though, will of course be accessible, with or without any kind of wrapper like this one.
But yeah, I'll not copy/paste again the relevant part of the license saying you can't use it ;)
I will just unzip it without reading or accepting the licence :P
Title: Re: A wrapper for TI's JavaScript-based z80/eZ80 emulators
Post by: Adriweb on July 06, 2015, 03:02:51 AM
I believe you still need to go through the installer, which makes you accept the license if you want to install it ;)
Title: Re: A wrapper for TI's JavaScript-based z80/eZ80 emulators
Post by: Dream of Omnimaga on July 06, 2015, 03:06:09 AM
I think what he means is that people generally just scroll down instantly without reading then choose "I accept"
Title: Re: A wrapper for TI's JavaScript-based z80/eZ80 emulators
Post by: Adriweb on July 06, 2015, 04:35:50 AM
Oh, yeah, definitely. But... that becomes the user's problem, then :P
Title: Re: A wrapper for TI's JavaScript-based z80/eZ80 emulators
Post by: DarkestEx on July 06, 2015, 08:02:37 AM
Quote from: Adriweb on July 06, 2015, 03:02:51 AM
I believe you still need to go through the installer, which makes you accept the license if you want to install it ;)
7zip is often able to extract the contents of exe and msi installers.
I will try it.
Title: Re: A wrapper for TI's JavaScript-based z80/eZ80 emulators
Post by: Dream of Omnimaga on July 09, 2015, 12:25:33 AM
Yeah I remember trying that with exe files before and it seemed to work, although not all the time. It depends of what's in it and the format.
Title: Re: A wrapper for TI's JavaScript-based z80/eZ80 emulators
Post by: Unicorn on July 09, 2015, 12:51:06 AM
7zip can extract .img files... I expect it can to the same with .exe
Title: Re: A wrapper for TI's JavaScript-based z80/eZ80 emulators
Post by: Dream of Omnimaga on August 03, 2015, 12:45:31 AM
By the way, I don't know if this emulator is compatible with Chromium and Opera 30, but I cannot get it to work in the latter. It just displays two blank spaces, even after following instructions in the multiple readmes. I don't know if I am missing anything. Could this be my svg path being wrong? (It asked me to replace some text with that)

xhr.open("GET", "skins\TI83PCE_SmartView_Standard.svg", true); // Point to the skin file you want to use (watch out for CORS issues)
Title: Re: A wrapper for TI's JavaScript-based z80/eZ80 emulators
Post by: Snektron on August 03, 2015, 01:09:40 AM
TI smartview in made in java, meaning it's fairly easy to extract required files. That is, if they didn't pack it in some weird way / the installer doesnt pack it in some weird way. Ofcourse, since it's java, you can modify code too... (With the right tools)(and you're willing to break TI's agreement)
Title: Re: A wrapper for TI's JavaScript-based z80/eZ80 emulators
Post by: Adriweb on August 09, 2015, 11:20:52 PM
Since posts got lost... here's a copy/paste from TI-Planet (https://tiplanet.org/forum/viewtopic.php?p=187002#p187002) about v2 (even though it's 2.1 internally now)

New major version (v2) !
Source code: https://github.com/TI-Planet/ti_jsemu_wrapper
Online demo: https://ti-planet.github.io/ti_jsemu_wrapper/demo/

https://www.youtube.com/watch?v=PHOBrSDKWE0

EDIT (DJ) removed deprecated [youtube] tag
Title: Re: A wrapper for TI's JavaScript-based z80/eZ80 emulators
Post by: Dream of Omnimaga on August 10, 2015, 12:22:26 AM
Thanks for the repost. I'll make sure to check again because I don't remember which version I tested.
Title: Re: A wrapper for TI's JavaScript-based z80/eZ80 emulators
Post by: Adriweb on August 10, 2015, 02:46:40 AM
The current one improves CSS stuff and responsiveness, but still not the zoom resize (yet) :P
Title: Re: A wrapper for TI's JavaScript-based z80/eZ80 emulators
Post by: Dream of Omnimaga on August 10, 2015, 03:18:50 AM
Aaah right, so that's the version I tried last time. Good luck adding the new features :)
Title: Re: A wrapper for TI's JavaScript-based z80/eZ80 emulators
Post by: Unicorn on August 10, 2015, 04:50:46 AM
Indeed, though I still need to get smartveiw... :0
Title: Re: A wrapper for TI's JavaScript-based z80/eZ80 emulators
Post by: Adriweb on August 10, 2015, 07:47:01 PM
There you go, changeable zoom levels :)
(commit: https://github.com/TI-Planet/ti_jsemu_wrapper/commit/003dd25b6f48cc03dde121055e997cc4c9bcf580)

Full source/download: https://github.com/TI-Planet/ti_jsemu_wrapper/
Online demo: https://ti-planet.github.io/ti_jsemu_wrapper/demo/
Title: Re: A wrapper for TI's JavaScript-based z80/eZ80 emulators
Post by: Unicorn on August 10, 2015, 09:01:10 PM
Awesome! Maybe someone would like to take over and allow file transfers.
Title: Re: A wrapper for TI's JavaScript-based z80/eZ80 emulators
Post by: Dream of Omnimaga on August 15, 2015, 02:38:17 AM
Very good Adriweb. The display now looks as crisp as jsTIfied and WabbitEmu for CSE. :)
Title: Re: A wrapper for TI's JavaScript-based z80/eZ80 emulators
Post by: Snektron on December 01, 2015, 11:21:15 PM
I forked the project and added file loading :D
https://github.com/RobinDeWalvis/ti_jsemu_wrapper
(sorry no online demo)
It doesn't load archived variables, and i only tested programs but other types should work too.

EDIT: Actually, it seems that something goes wrong. It still needs some work...
Title: Re: A wrapper for TI's JavaScript-based z80/eZ80 emulators
Post by: Dream of Omnimaga on December 02, 2015, 04:11:25 AM
What do you think is not working? File transfer/loading would definitively be a big plus for this emulator for those who have Smartview. I don't like TI-Smartview because it's too slow, but this JS wrapper lacks file sending, so it isn't very practical during ASM/C/BASIC testing and development. I didn't know adding file transfer would be possible at all. If you manage to (legally) add such feature successfully, then good job.
Title: Re: A wrapper for TI's JavaScript-based z80/eZ80 emulators
Post by: Adriweb on December 02, 2015, 04:27:56 AM
It sure is fun, but I didn't add that myself because :
- Implementing transfers the right way is insanely complex, let alone on an obfuscated (well, minified) codebase
- implementing the "bad"/hacky way is not very hard on the contrary (as seen in his repo, it's not a whole lot of lines to get things started), but... it is extremely version-dependant: it will only work for a specific version (in this case, SV 5.1 with 84+CE, not the 83PCE and on any other versions)
- TI is probably watching my repo :P
- ... and they may not like such features as it would get closer and closer to SmartView (and less an emu "wrapper" as the name indicates)

For all those reasons, I can't/won't promote the fork on the upstream one, but oh well, have fun, after all it's not open-source for nothing :)
Title: Re: A wrapper for TI's JavaScript-based z80/eZ80 emulators
Post by: Dream of Omnimaga on December 02, 2015, 04:43:50 AM
Good move I think. We don't want those features to be mainstream anyway. I guess it's just for the convenience of being able to use their emu without experiencing severe lag. Trust me, I tried First Fantady in it and not only it ran twice slower, but it also processed keypresses even slower and at one point I was about 1 minute behind in keypresses. Even the TI-OS is slow, which isn't very excusable when the software costs $150 (while HP offers theirs for free)

Perhaps TI need some development help to find a workaround? :P

Title: Re: A wrapper for TI's JavaScript-based z80/eZ80 emulators
Post by: Adriweb on December 02, 2015, 04:44:54 AM
TI perfectly knows it's slow[er] in SmartView, but... it's "fast enough" for teachers and most usecases (which aren't ours :P)
Title: Re: A wrapper for TI's JavaScript-based z80/eZ80 emulators
Post by: Snektron on December 02, 2015, 04:50:43 PM
I found the error :) It had something to do with loading the file and interpreting some characters as 2-byte characters.
I solved it by loading the file into an arraybuffer and making a string of it by first creating a Uint8Array, instead of reading the string in one go.

I'm not entirely sure if things like pictures work, but i tested some and it doesn't crash so thats good :P
Programs seem to work anyway.

Also more people might want this, so be sure to spread the news :3
Title: Re: A wrapper for TI's JavaScript-based z80/eZ80 emulators
Post by: Dream of Omnimaga on December 02, 2015, 05:30:56 PM
Quote from: Adriweb on December 02, 2015, 04:44:54 AM
TI perfectly knows it's slow[er] in SmartView, but... it's "fast enough" for teachers and most usecases (which aren't ours :P)
So they adopted the 3 characters every second is super fast philosophy? 9_9
Quote from: Cumred_Snektron on December 02, 2015, 04:50:43 PM
I found the error :) It had something to do with loading the file and interpreting some characters as 2-byte characters.
I solved it by loading the file into an arraybuffer and making a string of it by first creating a Uint8Array, instead of reading the string in one go.

I'm not entirely sure if things like pictures work, but i tested some and it doesn't crash so thats good :P
Programs seem to work anyway.

Also more people might want this, so be sure to spread the news :3
Good to hear. If a news is made, it should specify that the js wrapper requires a working smartview install to be used, but is much faster.