Giter Club home page Giter Club logo

reclassicfication's People

Contributors

srussellextensis avatar uliwitness avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

reclassicfication's Issues

Fix resource file writing

We can read MacOS resource files just fine, but when writing them out again we still do something wrong.

Implement LoadResource

Currently we load all resources when the file is opened. The real resource manager only loads the resource map and defers loading the data until LoadResource is called. Our FakeLoadResource is a no-op.

Fix RemoveResource to free its data

Inside Macintosh: More Macintosh Toolbox says:

The RemoveResource procedure doesn’t immediately release the memory occupied
by the resource data; instead, the Resource Manager releases the memory when
your application quits, when you call `UpdateResFile`, or when you call `CloseResFile`
(which in turn calls `UpdateResFile`).

Our current implementation never disposes of the Handle, and requires clients to call DisposeHandle() themselves.

I think we'd be improving things if FakeRemoveResource() just called FakeDisposeHandle() once it has removed the resource. That might make some code crash/corrupt memory that relies on Handles staying around longer, but would at least make all other code work perfectly and without leaking.

Ideally, we would keep around the FakeReferenceListEntry in a separate list. Then we could release this data from UpdateResFile(). This entry could also be extended to keep track the resource's offset in the file. That would mean we'd know about unused areas of the resource file and could drop new resources into empty spots in the file, which we'd need for correct WriteResource() and UpdateResource() implementations anyway.

Make ChangedResource more selective

Currently, our FakeChangedResource simply sets a dirty flag on the entire file. We should instead set one on the individual resource data or the resource map (if appropriate) and then selectively write out only those.

Implement WriteResource

Our FakeWriteResource function does only sanity checks. We just write out the entire file if anything has changed. FakeWriteResource should selectively write out all modified resource data (and if resource attributes have been modified or a resource has been deleted, should also write out the resource map).

Implement SetResLoad

Currently, we load all resources into RAM when a file is opened. The real resource manager loads only the resource map, and keeps track of the offsets of the resource data to load that on an as-needed basis.

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.