Coder Social home page Coder Social logo

Fix project saving about squeakjs HOT 3 CLOSED

codefrau avatar codefrau commented on June 11, 2024
Fix project saving

from squeakjs.

Comments (3)

codefrau avatar codefrau commented on June 11, 2024

Implemented the primitive in e20591b (for non-Spur images).
It's working correctly according to ImageSegment>>deepCopyTest:.

However, while saving an Etoys project succeeds now, loading it back in still fails with an error. Since loading existing projects works fine, the problem must be in saving.

I assume there is a bug in writing the SmartRefStream. This could be the same issue as mentioned in #146 (comment) where saving a Scratch Project works only if the sounds are removed.

The actual error happens when loading a Bitmap from the Etoys project's SmartRefStream. I don't know the error in Scratch but sounds are related to binary objects too so that seems to be an area worth investigating.

from squeakjs.

codefrau avatar codefrau commented on June 11, 2024

The load error happens when the ImageSegment's WordArrayForSegment is read from the SmartRefStream because there are not enough bytes. E.g. a project just containing an ellipse is written as a 6520 byte segment (i.e. the WordArray created by storeImageSegment()). But when loading it, the byteSize is read correctly as 6520 but only 3269 bytes are available before the end of the stream.

That means for some reason, storing of the ImageSegment's WordArray in the SmartRefStream failed, or maybe it was cut short when writing it to the zip (.pr files are actually .zip files containing the actual project and other files).

from squeakjs.

codefrau avatar codefrau commented on June 11, 2024

Fixed the file writing bug in d94aaed.
The segment is stored as words in the file but primitiveFileWrite took the word count as bytes so it only stored the first quarter of the segment.
Works in release 1.1.0.

from squeakjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.