mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
Revamp of the Windows command-line parsing and puzzle-loading code.
The Windows puzzles now accept similar command-line syntax to the GTK ones, in that you can give them either a game ID (descriptive, random or just plain params) or the name of a save file. Unlike the GTK ones, however, the save file interpretation is tried first; this is because some puzzles (e.g. Black Box) will interpret any old string as a valid (if boring) game ID, and unlike the GTK puzzles it's not feasible to require users to disambiguate via a command-line option, because on Windows a thing that might easily happen is that a user passes a save file to a puzzle binary via 'Open With' in the GUI shell, where they don't get the chance to add extra options. In order to make this work sensibly in the all-in-one Windows app, I had to get round to another thing I've been planning to do for a while, which is to write a function to examine a saved game file and find out which puzzle it's for. So the combined Windows binary will auto-switch to the right game if you pass a save file on its command line, and also if you use Load while the program is running. Another utility function I needed is one to split the WinMain single command line string into argv. For this I've imported a copy of split_into_argv() from Windows PuTTY (which doesn't affect this package's list of copyright holders, since that function was all my own code anyway). [originally from svn r9749]
This commit is contained in:
@ -228,6 +228,7 @@ void print_line_dotted(drawing *dr, int dotted);
|
||||
midend *midend_new(frontend *fe, const game *ourgame,
|
||||
const drawing_api *drapi, void *drhandle);
|
||||
void midend_free(midend *me);
|
||||
const game *midend_which_game(midend *me);
|
||||
void midend_set_params(midend *me, game_params *params);
|
||||
game_params *midend_get_params(midend *me);
|
||||
void midend_size(midend *me, int *x, int *y, int user_size);
|
||||
@ -264,6 +265,8 @@ void midend_serialise(midend *me,
|
||||
char *midend_deserialise(midend *me,
|
||||
int (*read)(void *ctx, void *buf, int len),
|
||||
void *rctx);
|
||||
char *identify_game(char **name, int (*read)(void *ctx, void *buf, int len),
|
||||
void *rctx);
|
||||
/* Printing functions supplied by the mid-end */
|
||||
char *midend_print_puzzle(midend *me, document *doc, int with_soln);
|
||||
int midend_tilesize(midend *me);
|
||||
|
Reference in New Issue
Block a user