Beispiel #1
0
void S9xDeinitDisplay (void)
{
	TakedownImage();
#ifdef USE_SDL
	SDL_Quit();
#endif

}
Beispiel #2
0
void S9xDeinitDisplay (void)
{
	S9xTextMode();
	TakedownImage();
	XSync(GUI.display, False);
	XCloseDisplay(GUI.display);
	S9xBlitFilterDeinit();
	S9xBlit2xSaIFilterDeinit();
	S9xBlitHQ2xFilterDeinit();
}
Beispiel #3
0
void S9xDeinitDisplay (void)
{
	TakedownImage();

	SDL_Quit();

	S9xBlitFilterDeinit();
	S9xBlit2xSaIFilterDeinit();
	S9xBlitHQ2xFilterDeinit();
}
Beispiel #4
0
void S9xDeinitDisplay (void)
{
	TakedownImage();

	SDL_Quit();

	S9xBlitFilterDeinit();
#if 0 // AWH
	S9xBlit2xSaIFilterDeinit();
	S9xBlitHQ2xFilterDeinit();
#endif // AWH
}
Beispiel #5
0
static void SetupImage (void)
{
	TakedownImage();

	// domaemon: The whole unix code basically assumes output=(original * 2);
	// This way the code can handle the SNES filters, which does the 2X.
	GFX.Pitch = SNES_WIDTH * 2 * 2;
	GUI.snes_buffer = (uint8 *) calloc(GFX.Pitch * ((SNES_HEIGHT_EXTENDED + 4) * 2), 1);
	if (!GUI.snes_buffer)
		FatalError("Failed to allocate GUI.snes_buffer.");

	// domaemon: Add 2 lines before drawing.
	GFX.Screen = (uint16 *) (GUI.snes_buffer + (GFX.Pitch * 2 * 2));

	if (GUI.fullscreen == TRUE)
	{
fprintf(stderr, "Using fullscreen mode\n");
		int offset_height_pix;
		int offset_width_pix;
		int offset_byte;

		offset_height_pix = (GUI.sdl_screen->h - (SNES_HEIGHT * 2)) / 2;
		offset_width_pix = (GUI.sdl_screen->w - (SNES_WIDTH * 2)) / 2;
		offset_byte = (GUI.sdl_screen->w * offset_height_pix + offset_width_pix) * 2;

		GUI.blit_screen       = (uint8 *) GUI.sdl_screen->pixels + offset_byte;
		GUI.blit_screen_pitch = GUI.sdl_screen->pitch;
	}
	else 
	{
#if 0 // AWH
		GUI.blit_screen       = (uint8 *) GUI.sdl_screen->pixels;
		GUI.blit_screen_pitch = SNES_WIDTH * 2 * 2; // window size =(*2); 2 byte pir pixel =(*2)
#else
                // NTSC GUI.blit_screen       = (uint8 *) GUI.sdl_screen->pixels + 208 + GUI.sdl_screen->pitch * 14;
#if defined(CAPE_LCD3)
                GUI.blit_screen = (uint8 *) GUI.sdl_screen->pixels + 64 + GUI.sdl_screen->pitch * 7;
#else
		GUI.blit_screen = (uint8 *) GUI.sdl_screen->pixels + 128 + GUI.sdl_screen->pitch * 14;
#endif
                GUI.blit_screen_pitch = GUI.sdl_screen->pitch;
#endif // AWH
	}

	S9xGraphicsInit();
}
Beispiel #6
0
static void SetupImage (void)
{
	TakedownImage();

	// domaemon: The whole unix code basically assumes output=(original * 2);
	// This way the code can handle the SNES filters, which does the 2X.

	GFX.Pitch = SNES_WIDTH * 2 * GFX_SCALE;

	GUI.snes_buffer = (uint8 *) calloc(GFX.Pitch * ((SNES_HEIGHT_EXTENDED + 4) * GFX_SCALE), 1);

	if (!GUI.snes_buffer)
		FatalError("Failed to allocate GUI.snes_buffer.");

	// domaemon: Add 2 lines before drawing.
	GFX.Screen = (uint16 *) (GUI.snes_buffer + (GFX.Pitch * 2 * GFX_SCALE));
#ifdef USE_SDL
    GUI.blit_screen       = (uint8 *) GUI.sdl_screen->pixels;
    GUI.blit_screen_pitch = SNES_WIDTH  * GFX_SCALE * (BPP/8);
#endif
	S9xGraphicsInit();
}
Beispiel #7
0
static void SetupImage (void)
{
	TakedownImage();

#ifdef MITSHM
	GUI.use_shared_memory = TRUE;

	int		major, minor;
	Bool	shared;

	if (!XShmQueryVersion(GUI.display, &major, &minor, &shared) || !shared)
		GUI.image = NULL;
	else
		GUI.image = XShmCreateImage(GUI.display, GUI.visual, GUI.depth, ZPixmap, NULL, &GUI.sm_info, SNES_WIDTH * 2, SNES_HEIGHT_EXTENDED * 2);

	if (!GUI.image)
		GUI.use_shared_memory = FALSE;
	else
	{
		GUI.sm_info.shmid = shmget(IPC_PRIVATE, GUI.image->bytes_per_line * GUI.image->height, IPC_CREAT | 0777);
		if (GUI.sm_info.shmid < 0)
		{
			XDestroyImage(GUI.image);
			GUI.use_shared_memory = FALSE;
		}
		else
		{
			GUI.image->data = GUI.sm_info.shmaddr = (char *) shmat(GUI.sm_info.shmid, 0, 0);
			if (!GUI.image->data)
			{
				XDestroyImage(GUI.image);
				shmctl(GUI.sm_info.shmid, IPC_RMID, 0);
				GUI.use_shared_memory = FALSE;
			}
			else
			{
				GUI.sm_info.readOnly = False;

				XSetErrorHandler(ErrorHandler);
				XShmAttach(GUI.display, &GUI.sm_info);
				XSync(GUI.display, False);

				// X Error handler might clear GUI.use_shared_memory if XShmAttach failed.
				if (!GUI.use_shared_memory)
				{
					XDestroyImage(GUI.image);
					shmdt(GUI.sm_info.shmaddr);
					shmctl(GUI.sm_info.shmid, IPC_RMID, 0);
				}
			}
		}
	}

	if (!GUI.use_shared_memory)
	{
		fprintf(stderr, "use_shared_memory failed, switching to XPutImage.\n");
#endif
		GUI.image = XCreateImage(GUI.display, GUI.visual, GUI.depth, ZPixmap, 0, NULL, SNES_WIDTH * 2, SNES_HEIGHT_EXTENDED * 2, BitmapUnit(GUI.display), 0);
		GUI.image->data = (char *) malloc(GUI.image->bytes_per_line * GUI.image->height);
		if (!GUI.image || !GUI.image->data)
			FatalError("XCreateImage failed.");
#ifdef MITSHM
	}
#endif

#ifdef LSB_FIRST
	GUI.image->byte_order = LSBFirst;
#else
	GUI.image->byte_order = MSBFirst;
#endif

	GFX.Pitch = SNES_WIDTH * 2 * 2;
	GUI.snes_buffer = (uint8 *) calloc(GFX.Pitch * ((SNES_HEIGHT_EXTENDED + 4) * 2), 1);
	if (!GUI.snes_buffer)
		FatalError("Failed to allocate GUI.snes_buffer.");

	GFX.Screen = (uint16 *) (GUI.snes_buffer + (GFX.Pitch * 2 * 2));

	GUI.filter_buffer = (uint8 *) calloc((SNES_WIDTH * 2) * 2 * (SNES_HEIGHT_EXTENDED * 2), 1);
	if (!GUI.filter_buffer)
		FatalError("Failed to allocate GUI.filter_buffer.");

	if (GUI.depth == 15 || GUI.depth == 16)
	{
		GUI.blit_screen_pitch = GUI.image->bytes_per_line;
		GUI.blit_screen       = (uint8 *) GUI.image->data;
		GUI.need_convert      = FALSE;
	}
	else
	{
		GUI.blit_screen_pitch = (SNES_WIDTH * 2) * 2;
		GUI.blit_screen       = GUI.filter_buffer;
		GUI.need_convert      = TRUE;
	}

	S9xGraphicsInit();
}