예제 #1
0
void Atari_Initialise(int *argc, char *argv[])
{
#ifdef SOUND
	Sound_Initialise(argc, argv);
#endif

	if (gron(argc, argv))
	{
		perror("Graphics initialization failed");
		exit(1);
	}
	if(initinput())
	{
		perror("Input initialization failed");
		exit(1);
	}

	/* backlight */
	REG_bat = REG_ac = REG_disp = 2 * 60 * 60 * 1000; /* 2hrs should do it */
	backlight_xchg();
	SystemParametersInfo(SPI_GETBATTERYIDLETIMEOUT, 0, (void *) &bat_timeout, 0);
	SystemParametersInfo(SPI_SETBATTERYIDLETIMEOUT, 60 * 60 * 2, NULL, SPIF_SENDCHANGE);

	clearkb();
}
예제 #2
0
int PLATFORM_Initialise(int *argc, char *argv[])
{
#ifdef SOUND
	if (!Sound_Initialise(argc, argv))
		return FALSE;
#endif

	return TRUE;
}
예제 #3
0
파일: main.c 프로젝트: dmlloyd/atari800
int PLATFORM_Initialise(int *argc, char *argv[])
{
	int i, j;
	int help_only = FALSE;

	for (i = j = 1; i < *argc; i++) {
		if (strcmp(argv[i], "-help") == 0) {
			help_only = TRUE;
		}
		argv[j++] = argv[i];
	}
	*argc = j;

	if (!help_only) {
		i = SDL_INIT_JOYSTICK
#if HAVE_WINDOWS_H
/* Timers are used to avoid one Windows 7 glitch, see src/sdl/input.c */
		    | SDL_INIT_TIMER
#endif /* HAVE_WINDOWS_H */
		;
		if (SDL_InitSubSystem(i) != 0) {
			Log_print("SDL_InitSubSystem FAILED: %s", SDL_GetError());
			Log_flushlog();
			exit(-1);
		}
	}

	if (!SDL_VIDEO_Initialise(argc, argv)
#ifdef SOUND
	    || !Sound_Initialise(argc, argv)
#endif
	    || !SDL_INPUT_Initialise(argc, argv))
		return FALSE;

	return TRUE;
}
예제 #4
0
void Atari_Initialise(int *argc, char *argv[])
{
        int i;
        int j;
        int use_lpt1=0,use_lpt2=0,use_lpt3=0;
        int help_only = FALSE;

        for (i = j = 1; i < *argc; i++) {
                if (strcmp(argv[i], "-interlace") == 0) {
                        ypos_inc = 2;
                        vga_ptr_inc = 320 + 320;
                        scr_ptr_inc = ATARI_WIDTH + ATARI_WIDTH;
                }
                else if (strcmp(argv[i], "-LPTjoy1") == 0)
                        use_lpt1=test_LPTjoy(1,NULL);
                else if (strcmp(argv[i], "-LPTjoy2") == 0)
                        use_lpt2=test_LPTjoy(2,NULL);
                else if (strcmp(argv[i], "-LPTjoy3") == 0)
                        use_lpt3=test_LPTjoy(3,NULL);

                else if (strcmp(argv[i], "-joyswap") == 0)
                        joyswap = TRUE;

                else if (strcmp(argv[i], "-video") == 0)
                {
                  i++;
                  video_mode=atoi(argv[i]);
                  if (video_mode<0 || video_mode>3)
                  {
                    Aprint("Invalid video mode, using default.");
                    video_mode=0;
                  }
                }
                else if (strcmp(argv[i],"-novesa") == 0)
                {
                  use_vesa=FALSE;
                }
                else if (strcmp(argv[i],"-vretrace") == 0)
                {
                  use_vret=TRUE;
                }
		else if (strcmp(argv[i],"-keyboard") == 0)
		{
			i++;
			if (strcmp(argv[i],"0") == 0)
				PC_keyboard = TRUE;
			else
				PC_keyboard = FALSE;
		}
                else {
                        if (strcmp(argv[i], "-help") == 0) {
                                help_only = TRUE;
                                Aprint("\t-interlace       Generate screen with interlace");
                                Aprint("\t-LPTjoy1         Read joystick connected to LPT1");
                                Aprint("\t-LPTjoy2         Read joystick connected to LPT2");
                                Aprint("\t-LPTjoy3         Read joystick connected to LPT3");
                                Aprint("\t-joyswap         Swap joysticks");
                                Aprint("\t-video x         Set video mode:");
                                Aprint("\t\t0 - 320x200\n\t\t1 - 320x240");
                                Aprint("\t\t2 - 320x240, interlaced with black lines");
                                Aprint("\t\t3 - 320x240, interlaced with darker lines (slower!)");
                                Aprint("\t-novesa          Do not use vesa2 videomodes");
                                Aprint("\t-vretrace        Use vertical retrace control");
                                Aprint("\t-keyboard 0      PC keyboard layout");
                                Aprint("\t-keyboard 1      Atari keyboard layout");
                        }
                        argv[j++] = argv[i];
                }
        }

        *argc = j;

#ifdef SOUND
        /* initialise sound routines */
        Sound_Initialise(argc, argv);
#endif

        if (help_only)
                return;

        /* check if joystick is connected */
        printf("Joystick is checked...\n");
        fflush(stdout);
        outportb(0x201, 0xff);
        usleep(100000UL);
        joy_in = ((inportb(0x201) & 3) == 0);
        if (joy_in)
                joystick0(&js0_centre_x, &js0_centre_y);
        if (! joy_in)
                Aprint("Sorry, I see no joystick. Use numeric pad");

        /*find number of VESA2 video mode*/
        if (use_vesa)
        {
          switch(video_mode)
          {
            case 0:
              use_vesa=VESA_getmode(320,200,&vesa_mode,&vesa_memptr,&vesa_linelenght,&vesa_memsize);
              break;
            case 1:
              use_vesa=VESA_getmode(320,240,&vesa_mode,&vesa_memptr,&vesa_linelenght,&vesa_memsize);
              break;
            case 2:
            case 3:
              use_vesa=VESA_getmode(320,480,&vesa_mode,&vesa_memptr,&vesa_linelenght,&vesa_memsize);
              break;
          }
        }

        /* setup joystick */
        stick0 = stick1 = stick2 = stick3 = STICK_CENTRE;
        trig0 = trig1 = trig2 = trig3 = 1;
        /* for compatibility with older versions' command line parameters */
        if (use_lpt3)
        {
          for (i=3;i>0;i--) joytypes[i]=joytypes[i-1]; /*shift joystick types up*/
          joytypes[0]=joy_lpt3;   /*joystick 0 is on lpt3 */
        }
        if (use_lpt2)
        {
          for (i=3;i>0;i--) joytypes[i]=joytypes[i-1]; /*see above*/
          joytypes[0]=joy_lpt2;
        }
        if (use_lpt1)
        {
          for (i=3;i>0;i--) joytypes[i]=joytypes[i-1];
          joytypes[0]=joy_lpt1;
        }
        if (joy_in && !joycfg)
        {
          for (i=3;i>0;i--) joytypes[i]=joytypes[i-1];
          joytypes[0]=joy_analog;
        }
        if (joyswap)
        {
          int help=joytypes[0];
          joytypes[0]=joytypes[1];
          joytypes[1]=help;
        }
        /*end of compatibility part*/


        /*check, if joystick configuration is valid*/
        for (i=0;i<4;i++)
          switch (joytypes[i])
          {
            case joy_lpt1:
              if (!test_LPTjoy(1,lptport+i)) joytypes[i]=joy_off;
              break;
            case joy_lpt2:
              if (!test_LPTjoy(2,lptport+i)) joytypes[i]=joy_off;
              break;
            case joy_lpt3:
              if (!test_LPTjoy(3,lptport+i)) joytypes[i]=joy_off;
              break;
            case joy_analog:
              if (!joy_in) joytypes[i]=joy_off;
              break;
          }

        /* do not forget any scancode */
        for (i=0;i<256;i++)
          keyforget[i]=0;
        /* mark all used scancodes to forget*/
        for (i=0;i<4;i++)
        {
          j=0;
          while (j<4 && joytypes[j]!=(i+joy_keyset0)) j++;
          if (j<4)  /*keyset i is used */
            for (j=0;j<9;j++) keyforget[keysets[i][j]]=1;
          else
            keyset_used[i]=0;
        }

        SetupVgaEnvironment();

}
예제 #5
0
void Atari_Initialise(int *argc, char *argv[])
{
#ifdef SOUND
    Sound_Initialise(argc, argv);
#endif
}