summaryrefslogtreecommitdiff
path: root/str-player.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'str-player.cpp')
-rw-r--r--str-player.cpp27
1 files changed, 22 insertions, 5 deletions
diff --git a/str-player.cpp b/str-player.cpp
index 7d9f47b..b20b795 100644
--- a/str-player.cpp
+++ b/str-player.cpp
@@ -2,6 +2,7 @@
#include <string.h>
#include <SDL/SDL.h>
#include <SDL/SDL_audio.h>
+#include <getopt.h>
#include "Input.h"
#include "psxdev/bs.h"
#include "generic.h"
@@ -44,6 +45,8 @@ struct STR_Header {
Byte * video = 0, * audio = 0, * audio2 = 0;
+int channel = -1;
+
int width, height;
SDL_Surface * screen = 0;
@@ -77,6 +80,9 @@ void process_one_sector(Handle * f) {
printm(M_BARE, "SubHeader SM : %x\n", sector[2]);
printm(M_BARE, "SubHeader CI : %x\n", sector[3]);
*/
+ if ((channel != -1) && (channel != sector[1]))
+ return;
+
if ((sector[2] == 0x48) || (sector[2] == 0x42)) {
// printm(M_BARE, "Video sector\n");
/* printm(M_BARE, "Status : %04x\n", h->StSTATUS);
@@ -185,6 +191,7 @@ void process_one_sector(Handle * f) {
int main(int argc, char ** argv) {
Handle * file = 0;
+ int c;
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER) < 0) {
printm(M_ERROR, "Couldn't initialise SDL: %s\n", SDL_GetError());
@@ -193,13 +200,23 @@ int main(int argc, char ** argv) {
atexit(SDL_Quit);
SDL_ShowCursor(SDL_DISABLE);
-
- switch (argc) {
- case 1:
+ while ((c = getopt(argc, argv, "c:")) != EOF) {
+ switch (c) {
+ case 'c':
+ channel = atoi(optarg);
+ break;
+ default:
+ printm(M_ERROR, "Unknow argument.\n");
+ break;
+ }
+ }
+
+ switch (argc - optind) {
+ case 0:
file = &Stdin;
break;
- case 2:
- file = new Input(argv[1]);
+ case 1:
+ file = new Input(argv[optind]);
break;
default:
printm(M_ERROR, "Too much arguments.\n");