head 1.7; access; symbols start:1.1.1.1 blursoft:1.1.1; locks; strict; comment @// @; 1.7 date 2002.11.01.19.12.26; author steven; state Exp; branches; next 1.6; 1.6 date 2002.10.30.20.33.41; author steven; state Exp; branches; next 1.5; 1.5 date 2002.10.29.20.54.34; author steven; state Exp; branches; next 1.4; 1.4 date 2002.10.29.18.05.14; author steven; state Exp; branches; next 1.3; 1.3 date 2002.10.28.20.49.12; author steven; state Exp; branches; next 1.2; 1.2 date 2002.10.24.00.19.46; author steven; state Exp; branches; next 1.1; 1.1 date 2002.10.21.14.58.28; author steven; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 2002.10.21.14.58.28; author steven; state Exp; branches; next ; desc @@ 1.7 log @Added a client threshold option to set the update threshold. Also added three files so that the project can be opened with Vis Stud .NET @ text @// blimp.cpp : Defines the entry point for the console application. // //TODO: if restart client, it also restarts server //TODO: if client not running, it fires it up, but play doenst begin (and successive attempts to //TODO: start the client will fail ('error receiving message'); #include #include #include #include "blimpcli.h" #include "blimpsrv.h" #include "minigetopt.h" int run_as_server = 0; int run_as_client = 0; char *server_address = NULL; int update_interval = 0; int cli_thresh = 100; char *path_to_winamp = "c:\\program files\\winamp\\winamp.exe"; void show_usage( void ) { printf("blimp (0.01) -- blursoft 2002\n"); printf("USAGE: blimp [-c|s] [-a address] [-u updateinterval] [-t threshold] [-p path_to_winamp]\n"); printf("\t-c : run as client\n"); printf("\t\t-a : connect to the server specified in address\n"); printf("\t\t-t : force sync if client is out of range by threshold (default is 100)\n"); printf("\t\t-p : specify the path to winamp (default is 'c:\\Program Files\\Winamp\\winamp.exe')\n"); printf("\t-s : run as server\n"); printf("\t\t-u : send the client's the server's position every updateinterval msecs\n"); } int main( int argc, char *argv[] ) { extern char *optarg; extern int opterr; int res = 1; while( (res = minigetopt( argc, argv, "sca:u:p:t:?" )) != -1 ) { switch( res ) { case 's': printf("will run as server\n"); run_as_server = 1; break; case 'c': printf("will run as client\n"); run_as_client = 1; break; case 'a': printf("will connect to %s (if running as client, else ignore)\n",optarg); server_address = optarg; break; case 'u': printf("will update every %d\n",atoi(optarg)); update_interval = atoi(optarg); printf("%d\n",update_interval); break; case 'p': printf("path to winamp set to %s\n",optarg); path_to_winamp = optarg; break; case 't': printf("client will sync if time difference is greater than %d msecs\n",atoi(optarg)); cli_thresh = atoi( optarg ); break; case '?': show_usage( ); exit( EXIT_FAILURE ); default: if( opterr != 0 ){ /* zero is the ERRORNONE condition ....change this crap? */ printf("minigetopt had an error parsing (refer to minigetopt.h): %d\n",opterr); show_usage( ); exit(EXIT_FAILURE); } break; } } if( run_as_server == 1 && run_as_client == 1 ){ printf("use either -s or -c, not both. ie, either be a server or a client\n"); return EXIT_FAILURE; } if( run_as_server == 1 ) start_server( ); if( run_as_client == 1 ) start_client( ); else printf("specify either -c (client) or -s (server)\n"); return EXIT_SUCCESS; }@ 1.6 log @More changes all around. Added a 'path_to_winamp' option for the client so that winamp can automatically be started if it's not already. Also added more winamputil functions to open_winamp. @ text @d3 3 a5 1 d18 1 d26 1 a26 1 printf("USAGE: blimp [-c|s] [-a address] [-u updateinterval] [-p path_to_winamp]\n"); d29 1 d44 1 a44 1 while( (res = minigetopt( argc, argv, "sca:u:p:?" )) != -1 ) { d67 4 @ 1.5 log @Added per-client threading for the server connections. Compiles, but doesn't work :( @ text @d16 1 a16 1 d23 1 a23 1 printf("USAGE: blimp [-c|s] [-a address] [-u updateinterval]\n"); d26 1 d40 1 a40 1 while( (res = minigetopt( argc, argv, "sca:u:?" )) != -1 ) { d60 4 d81 2 a82 1 @ 1.4 log @Added winamputil files to abstract some of the ugliness of SendMessage away. Added a -? option to print the usage and program name. Also made sure that if the user uses some incorrect options the show_usage() is called. Also made various cleanups. @ text @d58 1 d81 2 @ 1.3 log @I added support for sync'ing only when the client and server are out of sync by a certain threshold. Lots more work to do, but the base is there. @ text @d18 15 d39 1 a39 1 while( (res = minigetopt( argc, argv, "sca:u:" )) != -1 ) { d58 3 d63 2 a64 1 printf("unk %d\n",opterr); @ 1.2 log @Changed how we handle the commandline. Also added *some* error checking. Paved the way for the client to connect to a specified server (instead of having it hardcoded). Also made an update_interval to specify when updates should be done to the winamp position. @ text @d1 66 a66 66 // blimp.cpp : Defines the entry point for the console application. // #include #include #include #include "blimpcli.h" #include "blimpsrv.h" #include "minigetopt.h" int run_as_server = 0; int run_as_client = 0; char *server_address = NULL; int update_interval = 0; int main( int argc, char *argv[] ) { extern char *optarg; extern int opterr; int res = 1; while( (res = minigetopt( argc, argv, "sca:u:" )) != -1 ) { switch( res ) { case 's': printf("will run as server\n"); run_as_server = 1; break; case 'c': printf("will run as client\n"); run_as_client = 1; break; case 'a': printf("will connect to %s (if running as client, else ignore)\n",optarg); server_address = optarg; break; case 'u': printf("will update every %d\n",atoi(optarg)); update_interval = atoi(optarg); printf("%d\n",update_interval); default: if( opterr != 0 ){ /* zero is the ERRORNONE condition ....change this crap? */ printf("unk %d\n",opterr); exit( EXIT_FAILURE ); } break; } } if( run_as_server == 1 && run_as_client == 1 ){ printf("use either -s or -c, not both. ie, either be a server or a client\n"); return EXIT_FAILURE; } if( run_as_server == 1 ) start_server( ); if( run_as_client == 1 ) start_client( ); return EXIT_SUCCESS; @ 1.1 log @Initial revision @ text @d12 6 d28 2 a29 2 printf("running as server\n"); //run_as_server = 1; d32 2 a33 2 printf("running as client\n"); //run_as_client = 1; d36 2 a37 2 printf("connecting to %s\n",optarg); //server_address = optarg; d40 3 a42 2 printf("updating every %d\n",atoi(optarg)); //update_interval = atoi(optarg); d44 4 a47 2 printf("unk %d\n",opterr); exit( EXIT_FAILURE ); d52 13 a64 10 /* if( strcmp(argv[1],"-server") == 0 ){ printf("starting server up...\n"); start_server( ); } if( strcmp(argv[1],"-client") == 0 ){ printf("starting client up...\n"); start_client( ); } */ @ 1.1.1.1 log @Blimp Project @ text @@