| version 1.8, 2003/11/28 16:29:57 | version 1.13, 2004/01/15 16:14:02 | 
| Line 27 | Line 27 | 
 |  |  | 
 | #include "compiler.h" | #include "compiler.h" | 
 |  |  | 
 |  | #include <sys/stat.h> | 
 | #include <getopt.h> | #include <getopt.h> | 
 | #include <signal.h> | #include <signal.h> | 
 |  |  | 
| Line 43 | Line 44 | 
 | #include "toolkit.h" | #include "toolkit.h" | 
 |  |  | 
 | #include "kdispwin.h" | #include "kdispwin.h" | 
 |  | #include "sysmenu.h" | 
 | #include "toolwin.h" | #include "toolwin.h" | 
 |  | #include "viewer.h" | 
 |  |  | 
 | #include "commng.h" | #include "commng.h" | 
 |  | #include "fontmng.h" | 
 |  | #include "inputmng.h" | 
 | #include "joymng.h" | #include "joymng.h" | 
 | #include "kbdmng.h" | #include "kbdmng.h" | 
 | #include "mousemng.h" | #include "mousemng.h" | 
 | #include "scrnmng.h" | #include "scrnmng.h" | 
 | #include "soundmng.h" | #include "soundmng.h" | 
 | #include "sysmng.h" | #include "sysmng.h" | 
 |  | #include "taskmng.h" | 
 |  |  | 
 |  |  | 
 | /* | /* | 
| Line 95  static struct option longopts[] = { | Line 101  static struct option longopts[] = { | 
 | { "config",             required_argument,      0,      'c' }, | { "config",             required_argument,      0,      'c' }, | 
 | { "timidity-config",    required_argument,      0,      'C' }, | { "timidity-config",    required_argument,      0,      'C' }, | 
 | { "shared-pixmap",      no_argument,            0,      'p' }, | { "shared-pixmap",      no_argument,            0,      'p' }, | 
 |  | #if defined(USE_SDL) || defined(USE_SYSMENU) | 
 |  | { "ttfont",             required_argument,      0,      't' }, | 
 |  | #endif | 
 | { "help",               no_argument,            0,      'h' }, | { "help",               no_argument,            0,      'h' }, | 
 | { 0,                    0,                      0,      0   }, | { 0,                    0,                      0,      0   }, | 
 | }; | }; | 
| Line 105  static void | Line 114  static void | 
 | usage(void) | usage(void) | 
 | { | { | 
 |  |  | 
| printf("Usage: %s [options] [[FD1 image] [[FD2 image] [[FD3 image] [FD4 image]]]]\n", progname); | printf("Usage: %s [options] [[FD1 image] [[FD2 image] [[FD3 image] [FD4 image]]]]\n\n", progname); | 
|  | printf("options:\n"); | 
|  | printf("\t--help            [-h]        : print this message\n"); | 
|  | printf("\t--config          [-c] <file> : specify config file\n"); | 
|  | printf("\t--timidity-config [-C] <file> : specify timidity config file\n"); | 
|  | printf("\t--shared-pixmap   [-p]        : use MIT-SHM pixmap extention\n"); | 
|  | #if defined(USE_SDL) || defined(USE_SYSMENU) | 
|  | printf("\t--ttfont          [-t] <file> : specify TrueType font\n"); | 
|  | #endif | 
 | exit(1); | exit(1); | 
 | } | } | 
 |  |  | 
| Line 128  main(int argc, char *argv[]) | Line 145  main(int argc, char *argv[]) | 
 | toolkit_initialize(); | toolkit_initialize(); | 
 | toolkit_arginit(&argc, &argv); | toolkit_arginit(&argc, &argv); | 
 |  |  | 
| while ((ch = getopt_long(argc, argv, "c:C:nh", longopts, NULL)) != -1) { | while ((ch = getopt_long(argc, argv, "c:C:t:ph", longopts, NULL)) != -1) { | 
 | switch (ch) { | switch (ch) { | 
 | case 'c': | case 'c': | 
 | if (stat(optarg, &sb) < 0 || !S_ISREG(sb.st_mode)) { | if (stat(optarg, &sb) < 0 || !S_ISREG(sb.st_mode)) { | 
| Line 151  main(int argc, char *argv[]) | Line 168  main(int argc, char *argv[]) | 
 | sizeof(timidity_cfgfile_path)); | sizeof(timidity_cfgfile_path)); | 
 | break; | break; | 
 |  |  | 
 |  | case 't': | 
 |  | if (stat(optarg, &sb) < 0 || !S_ISREG(sb.st_mode)) { | 
 |  | fprintf(stderr, "Can't access %s.\n", optarg); | 
 |  | exit(1); | 
 |  | } | 
 |  | milstr_ncpy(fontfilename, optarg, sizeof(fontfilename)); | 
 |  | break; | 
 |  |  | 
 | case 'p': | case 'p': | 
 | shared_pixmap_flag = TRUE; | shared_pixmap_flag = TRUE; | 
 | break; | break; | 
| Line 234  main(int argc, char *argv[]) | Line 259  main(int argc, char *argv[]) | 
 |  |  | 
 | TRACEINIT(); | TRACEINIT(); | 
 |  |  | 
| keystat_reset(); | if (fontmng_init() != SUCCESS) | 
|  | goto fontmng_failure; | 
 |  |  | 
 | kdispwin_initialize(); | kdispwin_initialize(); | 
 |  | viewer_init(); | 
 |  |  | 
 | toolkit_widget_create(); | toolkit_widget_create(); | 
 | scrnmng_initialize(); | scrnmng_initialize(); | 
 | kbdmng_init(); | kbdmng_init(); | 
 |  | inputmng_init(); | 
 |  | keystat_reset(); | 
 |  |  | 
 | scrnmode = 0; | scrnmode = 0; | 
 | if (np2cfg.RASTER) { | if (np2cfg.RASTER) { | 
 | scrnmode |= SCRNMODE_HIGHCOLOR; | scrnmode |= SCRNMODE_HIGHCOLOR; | 
 | } | } | 
 |  | if (sysmenu_create() != SUCCESS) | 
 |  | goto sysmenu_failure; | 
 | if (scrnmng_create(scrnmode) != SUCCESS) | if (scrnmng_create(scrnmode) != SUCCESS) | 
| goto resource_cleanup; | goto scrnmng_failure; | 
 |  |  | 
 | if (soundmng_initialize() == SUCCESS) { | if (soundmng_initialize() == SUCCESS) { | 
 | result = soundmng_pcmload(SOUND_PCMSEEK, file_getcd("fddseek.wav")); | result = soundmng_pcmload(SOUND_PCMSEEK, file_getcd("fddseek.wav")); | 
| Line 274  main(int argc, char *argv[]) | Line 305  main(int argc, char *argv[]) | 
 |  |  | 
 | commng_initialize(); | commng_initialize(); | 
 | sysmng_initialize(); | sysmng_initialize(); | 
 |  | taskmng_initialize(); | 
 |  |  | 
 | joy_init(); | joy_init(); | 
 | pccore_init(); | pccore_init(); | 
| Line 307  main(int argc, char *argv[]) | Line 339  main(int argc, char *argv[]) | 
 | setup_signal(SIGINT, sighandler); | setup_signal(SIGINT, sighandler); | 
 | setup_signal(SIGTERM, sighandler); | setup_signal(SIGTERM, sighandler); | 
 |  |  | 
 | np2running = TRUE; |  | 
 | toolkit_widget_mainloop(); | toolkit_widget_mainloop(); | 
 | np2running = FALSE; |  | 
 | rv = 0; | rv = 0; | 
 |  |  | 
 | kdispwin_destroy(); | kdispwin_destroy(); | 
| Line 331  main(int argc, char *argv[]) | Line 361  main(int argc, char *argv[]) | 
 | soundmng_deinitialize(); | soundmng_deinitialize(); | 
 | scrnmng_destroy(); | scrnmng_destroy(); | 
 |  |  | 
| resource_cleanup: | scrnmng_failure: | 
|  | sysmenu_destroy(); | 
|  |  | 
|  | sysmenu_failure: | 
|  | fontmng_terminate(); | 
|  |  | 
|  | fontmng_failure: | 
 | if (sys_updates & (SYS_UPDATECFG|SYS_UPDATEOSCFG)) { | if (sys_updates & (SYS_UPDATECFG|SYS_UPDATEOSCFG)) { | 
 | initsave(); | initsave(); | 
 | toolwin_writeini(); | toolwin_writeini(); | 
| Line 341  resource_cleanup: | Line 377  resource_cleanup: | 
 | TRACETERM(); | TRACETERM(); | 
 | dosio_term(); | dosio_term(); | 
 |  |  | 
 |  | viewer_term(); | 
 | toolkit_terminate(); | toolkit_terminate(); | 
 |  |  | 
 | return rv; | return rv; |