+char *random_state_encode(random_state *state);
+random_state *random_state_decode(char *input);
+/* random.c also exports SHA, which occasionally comes in useful. */
+typedef unsigned long uint32;
+typedef struct {
+ uint32 h[5];
+ unsigned char block[64];
+ int blkused;
+ uint32 lenhi, lenlo;
+} SHA_State;
+void SHA_Init(SHA_State *s);
+void SHA_Bytes(SHA_State *s, void *p, int len);
+void SHA_Final(SHA_State *s, unsigned char *output);
+void SHA_Simple(void *p, int len, unsigned char *output);
+
+/*
+ * Data structure containing the function calls and data specific
+ * to a particular game. This is enclosed in a data structure so
+ * that a particular platform can choose, if it wishes, to compile
+ * all the games into a single combined executable rather than
+ * having lots of little ones.
+ */
+struct game {
+ const char *name;
+ const char *winhelp_topic;
+ game_params *(*default_params)(void);
+ int (*fetch_preset)(int i, char **name, game_params **params);
+ void (*decode_params)(game_params *, char const *string);
+ char *(*encode_params)(game_params *, int full);
+ void (*free_params)(game_params *params);
+ game_params *(*dup_params)(game_params *params);
+ int can_configure;
+ config_item *(*configure)(game_params *params);
+ game_params *(*custom_params)(config_item *cfg);
+ char *(*validate_params)(game_params *params);
+ char *(*new_desc)(game_params *params, random_state *rs,
+ char **aux, int interactive);
+ char *(*validate_desc)(game_params *params, char *desc);
+ game_state *(*new_game)(midend_data *me, game_params *params, char *desc);
+ game_state *(*dup_game)(game_state *state);
+ void (*free_game)(game_state *state);
+ int can_solve;
+ char *(*solve)(game_state *orig, game_state *curr,
+ char *aux, char **error);
+ int can_format_as_text;
+ char *(*text_format)(game_state *state);
+ game_ui *(*new_ui)(game_state *state);
+ void (*free_ui)(game_ui *ui);
+ char *(*encode_ui)(game_ui *ui);
+ void (*decode_ui)(game_ui *ui, char *encoding);
+ void (*changed_state)(game_ui *ui, game_state *oldstate,
+ game_state *newstate);
+ char *(*interpret_move)(game_state *state, game_ui *ui, game_drawstate *ds,
+ int x, int y, int button);
+ game_state *(*execute_move)(game_state *state, char *move);
+ void (*size)(game_params *params, game_drawstate *ds, int *x, int *y,
+ int expand);
+ float *(*colours)(frontend *fe, game_state *state, int *ncolours);
+ game_drawstate *(*new_drawstate)(game_state *state);
+ void (*free_drawstate)(game_drawstate *ds);
+ void (*redraw)(frontend *fe, game_drawstate *ds, game_state *oldstate,
+ game_state *newstate, int dir, game_ui *ui, float anim_time,
+ float flash_time);
+ float (*anim_length)(game_state *oldstate, game_state *newstate, int dir,
+ game_ui *ui);
+ float (*flash_length)(game_state *oldstate, game_state *newstate, int dir,
+ game_ui *ui);
+ int (*wants_statusbar)(void);
+ int is_timed;
+ int (*timing_state)(game_state *state);
+ int mouse_priorities;
+};