Index: mbtofhm.c ================================================================== --- mbtofhm.c +++ mbtofhm.c @@ -453,11 +453,13 @@ levelid[ord]=i; sprintf(nam,"%d.LVL",i); hamarc_begin(fp); fputc(0,fp); fputc(0,fp); // Level version fputc(ord,fp); fputc(ord>>8,fp); // Level code - fputc(29,fp); fputc(21,fp); // Width/height + fputc(28,fp); fputc(20,fp); // One less than width/height + // (Width/height can each be up to 64 (stored as 63). Bit6 and bit7 of + // these numbers are extra header flags, currently unused.) i=fgetc(stdin); i|=fgetc(stdin)<<8; // fputc(17,fp); // Select proportional font while(i--) { switch(j=fgetc(stdin)) { Index: notes ================================================================== --- notes +++ notes @@ -18,10 +18,11 @@ * You can use the "har" program to extract and alter lumps. * There will be less bugs because it is simpler than SQLite. Disadvantages of using Hamster archive: * It is necessary to rewrite the entire file when it changes. +* It is necessary to read the entire file to find the lumps. Advantages of using SQLite: * You can read parts of the file at a time. * You can alter records without having to rewrite everything. * SQL can now be used for user queries and user scripts. @@ -29,6 +30,22 @@ Disadvantages of using SQLite: * There will be extra overhead due to b-trees and other stuff. * It may be necessary to deal with untrusted database schemas (unsure). * Now SQLite must be included in this program. + +Another way would be a hybrid approach. Another file containing the user +session data is a SQLite database, which is recreated if it was deleted or +if the level or solution file is newer than it, and stores an index. + +Advantages of hybrid: +* It is only necessary to create an index once. +* SQL can now be used for user queries and user scripts. +* User session data can be recorded. + +Disadvantages of hybrid: +* SQLite must be included in this program. +* Level/solution files must still be rewritten entirely when it changes. + +Hero Mesh will rewrite the puzzle set file only on exit, so it is possible +to do the similar thing in this case, by using the session database.