Discuss Scratch

dude341
Scratcher
1000+ posts

s2online: Easily run Scratch 2.0 projects in your web browser!

Could a similar thing be done with the 1.x Java Player and the 1.4 Squeak Editor? I think there was an online 1.4 Squeak editor someone made with a JavaScript Squeak VM but it was literally just 1.4. It didn't have the changes this had, like being able to launch projects via a project ID dialog box (that is, if the 3.0 launch didn't wipe out the original .sb files, as they got rid of the option to download a .sb file for older projects). I don't think you could download a project to your computer or upload a project from your computer either.

As for the 1.x Java Player, I don't think there has been any attempt at that.

Placeholder
_nix
Scratcher
1000+ posts

s2online: Easily run Scratch 2.0 projects in your web browser!

dude341 wrote:

Could a similar thing be done with the 1.x Java Player and the 1.4 Squeak Editor? I think there was an online 1.4 Squeak editor someone made with a JavaScript Squeak VM but it was literally just 1.4. It didn't have the changes this had, like being able to launch projects via a project ID dialog box (that is, if the 3.0 launch didn't wipe out the original .sb files, as they got rid of the option to download a .sb file for older projects). I don't think you could download a project to your computer or upload a project from your computer either.

As for the 1.x Java Player, I don't think there has been any attempt at that.
Funnily enough, hacking the 1.x Java Player would probably be the easiest option, since it was already built to open a file from the Scratch site. But then you wouldn't get the editor, of course. (I guess Squeak 1.4 is to Java 1.4 as Flash 2.0 is to Phosphorus.) You could probably hack the Squeak editor to automatically load a file that is loaded in by the VM, though (which could be fetched from the Scratch site). Or if the Squeak VM has networking support, you could make a plain old mod of 1.4 that downloads projects from the website, and upload that directly into the Squeak VM, without any extra external JavaScript like I use for s2online.

══ trans autistic lesbian enbydoggirls // 16 17 18 19 20, she/they
sparrows one word to the paragraph // <3 // ~(quasar) nebula
dude341
Scratcher
1000+ posts

s2online: Easily run Scratch 2.0 projects in your web browser!

_nix wrote:

dude341 wrote:

Could a similar thing be done with the 1.x Java Player and the 1.4 Squeak Editor? I think there was an online 1.4 Squeak editor someone made with a JavaScript Squeak VM but it was literally just 1.4. It didn't have the changes this had, like being able to launch projects via a project ID dialog box (that is, if the 3.0 launch didn't wipe out the original .sb files, as they got rid of the option to download a .sb file for older projects). I don't think you could download a project to your computer or upload a project from your computer either.

As for the 1.x Java Player, I don't think there has been any attempt at that.
Funnily enough, hacking the 1.x Java Player would probably be the easiest option, since it was already built to open a file from the Scratch site. But then you wouldn't get the editor, of course. (I guess Squeak 1.4 is to Java 1.4 as Flash 2.0 is to Phosphorus.) You could probably hack the Squeak editor to automatically load a file that is loaded in by the VM, though (which could be fetched from the Scratch site). Or if the Squeak VM has networking support, you could make a plain old mod of 1.4 that downloads projects from the website, and upload that directly into the Squeak VM, without any extra external JavaScript like I use for s2online.
That's what I was thinking of (squeak VM with networking) for the Squeak 1.4 online thing. Wonder if anyone has had a try at doing that yet.

Placeholder
Wettining
Scratcher
500+ posts

s2online: Easily run Scratch 2.0 projects in your web browser!

dude341 wrote:

_nix wrote:

dude341 wrote:

Could a similar thing be done with the 1.x Java Player and the 1.4 Squeak Editor? I think there was an online 1.4 Squeak editor someone made with a JavaScript Squeak VM but it was literally just 1.4. It didn't have the changes this had, like being able to launch projects via a project ID dialog box (that is, if the 3.0 launch didn't wipe out the original .sb files, as they got rid of the option to download a .sb file for older projects). I don't think you could download a project to your computer or upload a project from your computer either.

As for the 1.x Java Player, I don't think there has been any attempt at that.
Funnily enough, hacking the 1.x Java Player would probably be the easiest option, since it was already built to open a file from the Scratch site. But then you wouldn't get the editor, of course. (I guess Squeak 1.4 is to Java 1.4 as Flash 2.0 is to Phosphorus.) You could probably hack the Squeak editor to automatically load a file that is loaded in by the VM, though (which could be fetched from the Scratch site). Or if the Squeak VM has networking support, you could make a plain old mod of 1.4 that downloads projects from the website, and upload that directly into the Squeak VM, without any extra external JavaScript like I use for s2online.
That's what I was thinking of (squeak VM with networking) for the Squeak 1.4 online thing. Wonder if anyone has had a try at doing that yet.
I tried it a couple of years ago, it's not that hard using the Squeak.JS library (it supported mesh networking ).
I think someone also made an archive for old Scratch images but I don't think it had networking.
dude341
Scratcher
1000+ posts

s2online: Easily run Scratch 2.0 projects in your web browser!

Bump. I noticed this doesn't support 1.x projects, perhaps add this as an update? I'm not sure if it's even possible for all 1.x projects though because Scratch changed everything about how the API for downloading old projects work and stuff.

Last edited by dude341 (Jan. 26, 2019 19:17:21)


Placeholder
_nix
Scratcher
1000+ posts

s2online: Easily run Scratch 2.0 projects in your web browser!

dude341 wrote:

Bump. I noticed this doesn't support 1.x projects, perhaps add this as an update? I'm not sure if it's even possible for all 1.x projects though because Scratch changed everything about how the API for downloading old projects work and stuff.
Oh, good idea! It's actually pretty easy to load sb1 projects, especially since the Scratch 2.0 editor already has built-in support for decoding them. I just need to download the asset and recognize it as a 1.x file (via the content-type header), which can be directly loaded into the 2.0 editor using the same function I have for importing sb2 zip files. Hence - I did that! Try it out! (You might need to reset your cache so it loads the up-to-date JS.)

══ trans autistic lesbian enbydoggirls // 16 17 18 19 20, she/they
sparrows one word to the paragraph // <3 // ~(quasar) nebula
dude341
Scratcher
1000+ posts

s2online: Easily run Scratch 2.0 projects in your web browser!

_nix wrote:

dude341 wrote:

Bump. I noticed this doesn't support 1.x projects, perhaps add this as an update? I'm not sure if it's even possible for all 1.x projects though because Scratch changed everything about how the API for downloading old projects work and stuff.
Oh, good idea! It's actually pretty easy to load sb1 projects, especially since the Scratch 2.0 editor already has built-in support for decoding them. I just need to download the asset and recognize it as a 1.x file (via the content-type header), which can be directly loaded into the 2.0 editor using the same function I have for importing sb2 zip files. Hence - I did that! Try it out! (You might need to reset your cache so it loads the up-to-date JS.)
Hmm… Even after resetting my cache, although the message has changed to mention sb1 and the… oh wait. I forgot to enable flash. That explains it. Now it works!… or does it? Every 1.x project seems to load except for this one, which also fails to load in Scratch 3.0. Did it get corrupted during the 3.0 upgrade process or is it just a coincidence that it won't load in both s2online and Scratch 3.0? Could you check it out?

<offtopic>Are we still on 3.0? According to thisandagain Scratch 3/.x would be changing the minor version as well like 1.x and they said 3.1 would come out during the weeks after the release of 3.0. Scratch 3.0/.x doesn't include an about page (although it will be added) so there isn't a way to check.</offtopic>

Last edited by dude341 (Jan. 26, 2019 21:00:22)


Placeholder
_nix
Scratcher
1000+ posts

s2online: Easily run Scratch 2.0 projects in your web browser!

dude341 wrote:

Now it works!… or does it? Every 1.x project seems to load except for this one, which also fails to load in Scratch 3.0. Did it get corrupted during the 3.0 upgrade process or is it just a coincidence that it won't load in both s2online and Scratch 3.0? Could you check it out?

<offtopic>Are we still on 3.0? According to thisandagain Scratch 3/.x would be changing the minor version as well like 1.x and they said 3.1 would come out during the weeks after the release of 3.0. Scratch 3.0/.x doesn't include an about page (although it will be added) so there isn't a way to check.</offtopic>
Hmm… Yeah, it looks like that file was damaged, unfortunately. When I download it and open it in Scratch 1.4, it shows an error message: “Could not read project; file may be damaged: (bad header)”.

<offtopic>Yeah, I saw the comment where he mentioned that… they haven't said anything more about it though, I think. I'm pretty sure there's nowhere in the code where those semantic versions are actually stored (let alone displayed). Plus, I don't think Scratch 3 uses “patch” versions – the “y” in 3.x.y. Most of the recent changes would be patch changes, I think. But maybe not all of them, so, I'm not sure what the plan is. I guess our best bet is to..ask thisandagain to plz explain in further detail! :P (When he's back on Monday anyway. Or via an issue in LLK/scratch-gui. :P)</offtopic>

Last edited by _nix (Jan. 27, 2019 16:10:34)


══ trans autistic lesbian enbydoggirls // 16 17 18 19 20, she/they
sparrows one word to the paragraph // <3 // ~(quasar) nebula
dude341
Scratcher
1000+ posts

s2online: Easily run Scratch 2.0 projects in your web browser!

_nix wrote:

dude341 wrote:

Now it works!… or does it? Every 1.x project seems to load except for this one, which also fails to load in Scratch 3.0. Did it get corrupted during the 3.0 upgrade process or is it just a coincidence that it won't load in both s2online and Scratch 3.0? Could you check it out?

<offtopic>Are we still on 3.0? According to thisandagain Scratch 3/.x would be changing the minor version as well like 1.x and they said 3.1 would come out during the weeks after the release of 3.0. Scratch 3.0/.x doesn't include an about page (although it will be added) so there isn't a way to check.</offtopic>
Hmm… Yeah, it looks like that file was damaged, unfortunately. When I download it and open it in Scratch 1.4, it shows an error message: “Could not read project; file may be damaged: (bad header)”.

<offtopic>Yeah, I saw the comment where he mentioned that… they haven't said anything more about it though, I think. I'm pretty sure there's nowhere in the code where those semantic versions are actually stored (let alone displayed). Plus, I don't think Scratch 3 uses “patch” versions – the “y” in 3.x.y. Most of the recent changes would be patch changes, I think. But maybe not all of them, so, I'm not sure what the plan is. I guess our best bet is to..ask thisandagain to plz explain in further detail! :P (When he's back on Monday anyway. Or via an issue in LLK/scratch-gui. :P)</offtopic>
Ah… Oh well. I have asked Paddle2See to pass it on to thisandagain that the project is most likely corrupted, so perhaps it could be recovered? I know the ST makes backups of projects but I'm not sure exactly when they make backups.
EDIT: I know the sb format is completely different from sb2 and sb3 so it will be hard to do this, but maybe the file could be opened to check what is actually corrupted about it? I remember opening a .sb file in a text editor and seeing some sort of human readable data at the top, which is most likely the header. Since you're getting a bad header error perhaps it could be sorted out?
<offtopic>Interesting. As I said an about dialog should be coming soon so I guess we'll see what exact version Scratch 3 is on then :P</offtopic>

Last edited by dude341 (Jan. 27, 2019 16:56:24)


Placeholder
Jonathan50
Scratcher
1000+ posts

s2online: Easily run Scratch 2.0 projects in your web browser!

_nix wrote:

Hmm… Yeah, it looks like that file was damaged, unfortunately. When I download it and open it in Scratch 1.4, it shows an error message: “Could not read project; file may be damaged: (bad header)”.
It's a Scratch 2.0 project.json.

Not yet a Knight of the Mu Calculus.
_nix
Scratcher
1000+ posts

s2online: Easily run Scratch 2.0 projects in your web browser!

Jonathan50 wrote:

_nix wrote:

Hmm… Yeah, it looks like that file was damaged, unfortunately. When I download it and open it in Scratch 1.4, it shows an error message: “Could not read project; file may be damaged: (bad header)”.
It's a Scratch 2.0 project.json.
Oh, wonky, you're right. Yet it's served from the Scratch servers as a .sb file (application/octet-stream).

It's invalid JSON, though – I think it was made in an old version of the editor. So the multiline text is stored in the JSON as something like this:
{
text: "Hello!
I like!
Multiline text!"}
Hence, I can't even load it into s2online – because I can't parse the JSON in order to download the assets!

I could probably copy over Scratch 2.0's JSON parsing code though (which I imagine can handle this).

══ trans autistic lesbian enbydoggirls // 16 17 18 19 20, she/they
sparrows one word to the paragraph // <3 // ~(quasar) nebula
dude341
Scratcher
1000+ posts

s2online: Easily run Scratch 2.0 projects in your web browser!

_nix wrote:

Jonathan50 wrote:

_nix wrote:

Hmm… Yeah, it looks like that file was damaged, unfortunately. When I download it and open it in Scratch 1.4, it shows an error message: “Could not read project; file may be damaged: (bad header)”.
It's a Scratch 2.0 project.json.
Oh, wonky, you're right. Yet it's served from the Scratch servers as a .sb file (application/octet-stream).

It's invalid JSON, though – I think it was made in an old version of the editor. So the multiline text is stored in the JSON as something like this:
{
text: "Hello!
I like!
Multiline text!"}
Hence, I can't even load it into s2online – because I can't parse the JSON in order to download the assets!

I could probably copy over Scratch 2.0's JSON parsing code though (which I imagine can handle this).
Huh… I'm guessing the project was created during the Alpha stage of 2.0. That would explain why that project is missing a “Shared” date too. The project in question is actually a remix of a project that was originally made in 1.x.

Last edited by dude341 (Jan. 28, 2019 16:00:52)


Placeholder
dude341
Scratcher
1000+ posts

s2online: Easily run Scratch 2.0 projects in your web browser!

The json parsing code from 2.0 should handle this, as the project worked during 2.0.

Placeholder
_nix
Scratcher
1000+ posts

s2online: Easily run Scratch 2.0 projects in your web browser!

dude341 wrote:

The json parsing code from 2.0 should handle this, as the project worked during 2.0.
Yes, exactly! I ported over the code and it opens now https://s2online.github.io/#10006824

══ trans autistic lesbian enbydoggirls // 16 17 18 19 20, she/they
sparrows one word to the paragraph // <3 // ~(quasar) nebula
dude341
Scratcher
1000+ posts

s2online: Easily run Scratch 2.0 projects in your web browser!

_nix wrote:

dude341 wrote:

The json parsing code from 2.0 should handle this, as the project worked during 2.0.
Yes, exactly! I ported over the code and it opens now https://s2online.github.io/#10006824
It seems to work now, other than the fact that the “1.0 text” doesn't load. This seems to happen with all projects that were made in 1.x and then were updated to 2.0 without changing the text. 2.0 rendered the fonts but this doesn't. Hmm… I wonder what causes that?

Placeholder
_nix
Scratcher
1000+ posts

s2online: Easily run Scratch 2.0 projects in your web browser!

dude341 wrote:

It seems to work now, other than the fact that the “1.0 text” doesn't load. This seems to happen with all projects that were made in 1.x and then were updated to 2.0 without changing the text. 2.0 rendered the fonts but this doesn't. Hmm… I wonder what causes that?
Oh, right – this is actually an issue I brought up in Scratch 3.0. (They fixed it in 3.0, yay!) Basically, the text part of 1.x costumes is stored in a separate bitmap file in sb2s, so their asset needs to be fetched separately. Scratch 2.0 was capable of dealing with this and displaying them separately, in a pseudo-editable way (details here). In Scratch 3.0, they're flattened into a single bitmap image.

I'll see if I can load the textLayerMD5 images into the .zip – that isn't implemented in MegaApuTurkUltra's project backup tool, and I haven't messed with his code too much, but hopefully it'll be doable.

══ trans autistic lesbian enbydoggirls // 16 17 18 19 20, she/they
sparrows one word to the paragraph // <3 // ~(quasar) nebula
dude341
Scratcher
1000+ posts

s2online: Easily run Scratch 2.0 projects in your web browser!

_nix wrote:

dude341 wrote:

It seems to work now, other than the fact that the “1.0 text” doesn't load. This seems to happen with all projects that were made in 1.x and then were updated to 2.0 without changing the text. 2.0 rendered the fonts but this doesn't. Hmm… I wonder what causes that?
Oh, right – this is actually an issue I brought up in Scratch 3.0. (They fixed it in 3.0, yay!) Basically, the text part of 1.x costumes is stored in a separate bitmap file in sb2s, so their asset needs to be fetched separately. Scratch 2.0 was capable of dealing with this and displaying them separately, in a pseudo-editable way (details here). In Scratch 3.0, they're flattened into a single bitmap image.

I'll see if I can load the textLayerMD5 images into the .zip – that isn't implemented in MegaApuTurkUltra's project backup tool, and I haven't messed with his code too much, but hopefully it'll be doable.
That's a good explanation of the special “1.0 text mode” thing you have on that bug fix request! I always wondered how that actually worked.

Last edited by dude341 (Feb. 1, 2019 13:06:29)


Placeholder
_nix
Scratcher
1000+ posts

s2online: Easily run Scratch 2.0 projects in your web browser!

dude341 wrote:

_nix wrote:

(details here). In Scratch 3.0, they're flattened into a single bitmap image.

I'll see if I can load the textLayerMD5 images into the .zip – that isn't implemented in MegaApuTurkUltra's project backup tool, and I haven't messed with his code too much, but hopefully it'll be doable.
That's a good explanation of the special “1.0 text mode” thing you have on that bug fix request! I always wondered how that actually worked.
Thanks! I'm..actually having a bit more trouble with this than I expected. The textLayerID for every costume is -1, for some reason (even in another .sb1-turned-.sb2 project I saw), so I don't think that's what I'm supposed to be setting it to. I'd like to look at an sb2 of a project that contains 1.4 text, so I can see how an actual project downloaded from the real Scratch 2.0 editor works, but I don't have any on my computer.

..Wait a sec, I can just upload a 1.4 project into s2online and then download it and see what the format is like that..duh..

══ trans autistic lesbian enbydoggirls // 16 17 18 19 20, she/they
sparrows one word to the paragraph // <3 // ~(quasar) nebula
_nix
Scratcher
1000+ posts

s2online: Easily run Scratch 2.0 projects in your web browser!

_nix wrote:

..Wait a sec, I can just upload a 1.4 project into s2online and then download it and see what the format is like that..duh..
Or not, because scratch-flash can't download files because Flash is evil >_> (I suppose I could apply, like, the reverse solution for importing projects…, so, using JS as the backend for downloading the project…)

══ trans autistic lesbian enbydoggirls // 16 17 18 19 20, she/they
sparrows one word to the paragraph // <3 // ~(quasar) nebula
dude341
Scratcher
1000+ posts

s2online: Easily run Scratch 2.0 projects in your web browser!

_nix wrote:

dude341 wrote:

_nix wrote:

(details here). In Scratch 3.0, they're flattened into a single bitmap image.

I'll see if I can load the textLayerMD5 images into the .zip – that isn't implemented in MegaApuTurkUltra's project backup tool, and I haven't messed with his code too much, but hopefully it'll be doable.
That's a good explanation of the special “1.0 text mode” thing you have on that bug fix request! I always wondered how that actually worked.
Thanks! I'm..actually having a bit more trouble with this than I expected. The textLayerID for every costume is -1, for some reason (even in another .sb1-turned-.sb2 project I saw), so I don't think that's what I'm supposed to be setting it to. I'd like to look at an sb2 of a project that contains 1.4 text, so I can see how an actual project downloaded from the real Scratch 2.0 editor works, but I don't have any on my computer.

..Wait a sec, I can just upload a 1.4 project into s2online and then download it and see what the format is like that..duh..
Alright, hopefully you should be able to figure it out!

Placeholder

Powered by DjangoBB