comparison blastem.c @ 463:a1d298119153

Added -h help text option
author Mike Pavone <pavone@retrodev.com>
date Tue, 10 Sep 2013 20:32:59 -0700
parents 848a3db9d0b0
children 226ed16b1fb6
comparison
equal deleted inserted replaced
462:5677c053edd6 463:a1d298119153
1722 } 1722 }
1723 1723
1724 int main(int argc, char ** argv) 1724 int main(int argc, char ** argv)
1725 { 1725 {
1726 if (argc < 2) { 1726 if (argc < 2) {
1727 fputs("Usage: blastem FILENAME [options]\n", stderr); 1727 fputs("Usage: blastem ROMFILE [OPTIONS] [WIDTH] [HEIGHT]\n", stderr);
1728 return 1;
1729 }
1730 if(!load_rom(argv[1])) {
1731 fprintf(stderr, "Failed to open %s for reading\n", argv[1]);
1732 return 1; 1728 return 1;
1733 } 1729 }
1734 config = load_config(argv[0]); 1730 config = load_config(argv[0]);
1735 detect_region(); 1731 detect_region();
1736 int width = -1; 1732 int width = -1;
1737 int height = -1; 1733 int height = -1;
1738 int debug = 0; 1734 int debug = 0;
1739 int ym_log = 0; 1735 int ym_log = 0;
1736 int loaded = 0;
1740 FILE *address_log = NULL; 1737 FILE *address_log = NULL;
1741 char * statefile = NULL; 1738 char * statefile = NULL;
1742 uint8_t fullscreen = 0; 1739 uint8_t fullscreen = 0;
1743 for (int i = 2; i < argc; i++) { 1740 for (int i = 1; i < argc; i++) {
1744 if (argv[i][0] == '-') { 1741 if (argv[i][0] == '-') {
1745 switch(argv[i][1]) { 1742 switch(argv[i][1]) {
1746 case 'd': 1743 case 'd':
1747 debug = 1; 1744 debug = 1;
1748 break; 1745 break;
1750 fullscreen = 1; 1747 fullscreen = 1;
1751 break; 1748 break;
1752 case 'l': 1749 case 'l':
1753 address_log = fopen("address.log", "w"); 1750 address_log = fopen("address.log", "w");
1754 break; 1751 break;
1755 case 'v': 1752 // case 'v':
1756 headless = 1; 1753 // headless = 1;
1757 break; 1754 // break;
1758 case 'n': 1755 case 'n':
1759 z80_enabled = 0; 1756 z80_enabled = 0;
1760 break; 1757 break;
1761 case 'r': 1758 case 'r':
1762 i++; 1759 i++;
1792 statefile = argv[i]; 1789 statefile = argv[i];
1793 break; 1790 break;
1794 case 'y': 1791 case 'y':
1795 ym_log = 1; 1792 ym_log = 1;
1796 break; 1793 break;
1794 case 'h':
1795 puts(
1796 "Usage: blastem ROMFILE [OPTIONS] [WIDTH] [HEIGHT]\n"
1797 "Options:\n"
1798 " -h Print this help text\n"
1799 " -r (J|U|E) Force region to Japan, US or Europe respectively\n"
1800 " -f Start in fullscreen mode\n"
1801 " -s FILE Load a GST format savestate from FILE\n"
1802 " -d Enter debugger on startup\n"
1803 " -n Disable Z80\n"
1804 " -l Log 68K code addresses (useful for assemblers)\n"
1805 " -y Log individual YM-2612 channels to WAVE files\n"
1806 );
1807 return 0;
1797 default: 1808 default:
1798 fprintf(stderr, "Unrecognized switch %s\n", argv[i]); 1809 fprintf(stderr, "Unrecognized switch %s\n", argv[i]);
1799 return 1; 1810 return 1;
1800 } 1811 }
1812 } else if (!loaded) {
1813 if(!load_rom(argv[i])) {
1814 fprintf(stderr, "Failed to open %s for reading\n", argv[1]);
1815 return 1;
1816 }
1817 loaded = 1;
1801 } else if (width < 0) { 1818 } else if (width < 0) {
1802 width = atoi(argv[i]); 1819 width = atoi(argv[i]);
1803 } else if (height < 0) { 1820 } else if (height < 0) {
1804 height = atoi(argv[i]); 1821 height = atoi(argv[i]);
1805 } 1822 }
1823 }
1824 if (!loaded) {
1825 fputs("You must specify a ROM filename!\n", stderr);
1826 return 1;
1806 } 1827 }
1807 update_title(); 1828 update_title();
1808 int def_width = 0; 1829 int def_width = 0;
1809 char *config_width = tern_find_ptr(config, "videowidth"); 1830 char *config_width = tern_find_ptr(config, "videowidth");
1810 if (config_width) { 1831 if (config_width) {