1 #line 576 "opt2glkc.pl"
3 #include "macglk_startup.h"
5 static strid_t mac_gamefile;
7 static BOOL hashandle = FALSE;
8 static AliasHandle gamehandle;
9 #line 694 "opt2glkc.pl"
10 strid_t startup_findfile(void)
14 #line 586 "opt2glkc.pl"
15 strid_t intd_filehandle_open(strid_t savefile, glui32 operating_id,
16 glui32 contents_id, glui32 interp_id,
21 if(operating_id != 0x4d414353 /* 'MACS' */)
25 if(interp_id != 0x20202020 /* ' ' */)
28 gamehandle = NewHandle(length);
29 glk_get_buffer_stream(savefile, *gamehandle, length);
31 ResolveAlias(NULL, gamehandle, &file, &wasChanged);
32 return macglk_stream_open_fsspec(&file, 0, 0);
35 void intd_filehandle_make(strid_t savefile)
39 glk_put_string_stream(savefile, "MACS");
40 glk_put_char_stream(savefile, b00000010); /* Flags */
41 glk_put_char_stream(savefile, 0); /* Contents ID */
42 glk_put_char_stream(savefile, 0); /* Reserved */
43 glk_put_char_stream(savefile, 0); /* Reserved */
44 glk_put_string_stream(savefile, " ");/* Interpreter ID */
45 glk_put_buffer_stream(savefile, *gamehandle, *gamehandle->aliasSize);
48 glui32 intd_get_size(void)
52 return *gamehandle->aliasSize + 12;
55 static Boolean mac_whenselected(FSSpec *file, OSType filetype)
57 NewAlias(NULL, file, &gamehandle);
59 return game_use_file(mac_gamefile);
62 static Boolean mac_whenbuiltin()
64 return game_use_file(mac_gamefile);
67 Boolean macglk_startup_code(macglk_startup_t *data)
69 OSType mac_gamefile_types[] = { 0x5a434f44 /* 'ZCOD' */, 0x49465253 /* 'IFRS' */, 0x49465a53 /* 'IFZS' */ };
71 data->startup_model = macglk_model_ChooseOrBuiltIn;
72 data->app_creator = 0x6e695466 /* 'niTf' */;
73 data->gamefile_types = mac_gamefile_types;
74 data->num_gamefile_types = sizeof(mac_gamefile_types) / sizeof(*mac_gamefile_types);
75 data->savefile_type = 0x49465a53 /* 'IFZS' */;
76 data->datafile_type = 0x5a697044 /* 'ZipD' */;
77 data->gamefile = &mac_gamefile;
78 data->when_selected = mac_whenselected;
79 data->when_builtin = mac_whenbuiltin;