Long story, short: win32 defaults to a "text" mode for all file I/O using fopen and open unless explicitly told to be binary. This doesn't matter much to FreeSCI, except for creat() which is used to create the "heap" file in savegame.c(fsml). sciunpack.c had a comment that creat() doesn't work as expected on win32, and I used it as an example to #ifdef a special case for win32. It worked, to my amazement. I tested in LSL2 and KQ4, picking up an object and then saving the game. Restoring the game (both quick-start and in-game), and looking in the inventory for the item. There seem to be some minor bugs, though. When I save a game in LSL2, quit, then start LSL2 again and restore in-game, I see: Restarting with replay() Memtesting E:\src\freesci\src\engine\vm.c: line 1633 Memtest succeeded! Attempt to set invalid attribute of menu 4, item 1: 0x001a Resuming on handle 0000 (value 0000) Attempt to resume invalid handle 0000 I do have SATISFY_PURIFY defined, and tried initializing all of state_t after it's malloc'd. Neither helps. The savegames are at: http://www.clock.org/~matt/tmp/lsl2-save.tar . When restoring in-game, the free(s) at vm.c:1617 has already been free'd somewhere else. When running under a debugger, or on some platforms, this will cause a crash. This does not happen when doing a "quick-start". I have another bug, but will report it in the next message. Hopefully I will have a patch for Christoph tomorrow that can be applied to CVS. phew. -- http://www.clock.org/~matt
