Opened 15 years ago

Closed 15 years ago

Last modified 6 years ago

#9094 closed patch

MADE engine fixes

Reported by: agent-q Owned by: bluegr
Priority: normal Component: Engine: MADE
Version: Keywords:
Cc: Game:

Description

This patch includes the following fixes: - Call free() on bitmapped surfaces before deleting them. If this isn't done, the surface leaks it's graphics data - In RedReader.cpp, large objects were allocated on the stack. Changed these so they're allocated on the heap instead (The DS doesn't have a large enough stack to cope). - Missing 'virtual' on resource destructors meant that the destuctors were not called, and the game leaked all resources. Made resource destructors virtual to fix this. - In scriptfuncs.cpp, added missing freeResource() when a sound finishes playing. Without this, sound resources never had their reference count decremented and therefore would never be freed from the resource cache. - To speed up script execution, only check shouldQuit() every 500 script cycles rather than on every one. This makes a huge difference to performance on the DS. - The resource cache stored up to 100 cache items before purging. Because the size of the items varies so much, the memory usage of this cache was unpredictable. I changed the cache behaviour to purge when the cache reaches a certain data size instead. kMaxResourceCacheSize in resource.h is used to set the size at which a purge should take place.

With these fixes, Return to Zork is fully playable on the DS.

It would be great if these could be applied to both trunk and 1.0 branch.

Ticket imported from: #2872409. Ticket imported from: patches/1199.

Attachments (1)

made_fixes.patch (8.8 KB ) - added by agent-q 15 years ago.
MADE engine fixes

Download all attachments as: .zip

Change History (4)

by agent-q, 15 years ago

Attachment: made_fixes.patch added

MADE engine fixes

comment:1 by bluegr, 15 years ago

Looks good, applied with a small modification (initialized _soundStarted in the ScriptFunctions constructor). Thanks :)

comment:2 by bluegr, 15 years ago

Owner: set to bluegr
Status: newclosed

comment:3 by digitall, 6 years ago

Component: Engine: MADE
Note: See TracTickets for help on using tickets.