ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/SIDPlayer/src/main_sdl.cpp
(Generate patch)

Comparing SIDPlayer/src/main_sdl.cpp (file contents):
Revision 1.1 by cebix, 2000-09-19T15:34:11Z vs.
Revision 1.4 by cebix, 2001-01-16T14:12:54Z

# Line 25 | Line 25
25   #include <stdlib.h>
26  
27   #include "main.h"
28 + #include "prefs.h"
29 + #include "sid.h"
30  
31  
32   /*
# Line 33 | Line 35
35  
36   static void usage(const char *prg_name)
37   {
38 <        printf("\nUsage: %s [file [song]]\n", prg_name);
38 >        printf("\nUsage: %s [options] FILE [song_number]]\n", prg_name);
39          exit(0);
40   }
41  
# Line 59 | Line 61 | int main(int argc, char **argv)
61          // Parse arguments
62          if (argc < 2)
63                  usage(argv[0]);
64 <        char *file_name = argv[1];
64 >        char *file_name = argv[argc - 1];
65          int song = 0;
66 <        if (argc == 3)
67 <                song = atoi(argv[2]);
66 >        if (argc >= 3) {
67 >                bool only_numbers = true;
68 >                for (int i=0; i<strlen(file_name); i++)
69 >                        if (!isdigit(file_name[i])) {
70 >                                only_numbers = false;
71 >                                break;
72 >                        }
73 >                if (only_numbers) {
74 >                        song = atoi(file_name);
75 >                        file_name = argv[argc - 2];
76 >                }
77 >        }
78  
79          // Initialize everything
80          if (SDL_Init(SDL_INIT_AUDIO) < 0) {
# Line 70 | Line 82 | int main(int argc, char **argv)
82                  exit(1);
83          }
84          atexit(quit);
85 <        InitAll();
85 >        InitAll(argc, argv);
86  
87          // Load given PSID file
88 <        if (!LoadPSIDFile(argv[1])) {
89 <                fprintf(stderr, "Couldn't load '%s' (not a PSID file?)\n", argv[1]);
88 >        if (!LoadPSIDFile(file_name)) {
89 >                fprintf(stderr, "Couldn't load '%s' (not a PSID file?)\n", file_name);
90                  exit(1);
91          }
92  
# Line 92 | Line 104 | int main(int argc, char **argv)
104          printf("Playing song %d/%d\n", current_song + 1, number_of_songs);
105  
106          // Start replay and enter main loop
107 +        SIDAdjustSpeed(PrefsFindInt32("speed"));
108          SDL_PauseAudio(false);
109          while (true) {
110                  SDL_Event e;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines