Beispiel #1
0
void S9xVideoLogger (void *pixels, int width, int height, int depth, int bytes_per_line)
{
	int	fc = S9xMovieGetFrameCounter();
	if (fc > 0)
		framecounter = fc;
	else
		framecounter++;

	if (video)
	{
		char	*data = (char *) pixels;
		size_t	ignore;

		for (int i = 0; i < height; i++)
			ignore = fwrite(data + i * bytes_per_line, depth, width, video);
		fflush(video);
		fflush(audio);

		if (Settings.DumpStreamsMaxFrames > 0 && framecounter >= Settings.DumpStreamsMaxFrames)
		{
			printf("Logging ended.\n");
			S9xCloseLogger();
		}

	}
}
Beispiel #2
0
void VideoLogger(void *pixels, int width, int height, int depth, int bytes_per_line)
{
	int fc = S9xMovieGetFrameCounter();
	if (fc > 0)
		framecounter = fc;
	else
		framecounter++;
	
	if (video)
	{
		int i;
		char *data = (char*)pixels;
		static int lastwidth = width; // first resolution
		static int lastheight = height;
		if (lastwidth != width || lastheight != height) // this is just for informing the encoder that something has changed
		{
			printf("Frame %d, resolution changed from %dx%d to %dx%d!\n", fc, lastwidth, lastheight, width, height);
			lastwidth = width;
			lastheight = height;
		}
		for (i=0; i < height; i++)
			fwrite(data + i*bytes_per_line, depth, width, video);
		fflush(video);
		fflush(audio);
		drift++;

		if (maxframes > 0 && __builtin_expect((unsigned)framecounter >= maxframes, 0))
		{
			printf("-maxframes hit\ndrift:%d\n",drift);
			S9xExit();
		}

	}

	if (Settings.DisplayPressedKeys==1 || keypressscreen)
	{
		uint16 MovieGetJoypad(int i);

		int buttons = MovieGetJoypad(0);
		static char buffer[128];

		// This string spacing pattern is optimized for the 256 pixel wide screen.
                sprintf(buffer, "%s  %s  %s  %s  %s  %s  %c%c%c%c%c%c",
		buttons & SNES_START_MASK ? "Start" : "_____",
		buttons & SNES_SELECT_MASK ? "Select" : "______",
                buttons & SNES_UP_MASK ? "Up" : "__",
		buttons & SNES_DOWN_MASK ? "Down" : "____",
		buttons & SNES_LEFT_MASK ? "Left" : "____",
		buttons & SNES_RIGHT_MASK ? "Right" : "_____",
		buttons & SNES_A_MASK ? 'A':'_',
		buttons & SNES_B_MASK ? 'B':'_',
                buttons & SNES_X_MASK ? 'X':'_',
                buttons & SNES_Y_MASK ? 'Y':'_',
		buttons & SNES_TL_MASK ? 'L':'_',
		buttons & SNES_TR_MASK ? 'R':'_'
		/*framecounter*/);
		if (Settings.DisplayPressedKeys==1)
			fprintf(stderr, "%s %d           \r", buffer, framecounter);
		//if (keypressscreen)
                S9xSetInfoString(buffer);
	}

	if (__builtin_expect(messageframe >= 0 && framecounter == messageframe, 0))
	{
		S9xMessage(S9X_INFO, S9X_MOVIE_INFO, message);
		GFX.InfoStringTimeout = 300;
		messageframe = -1;
	}

/*	if (__builtin_expect(fastforwardpoint >= 0 && framecounter >= fastforwardpoint, 0))
	{
		Settings.FramesToSkip = fastforwarddistance;
		fastforwardpoint = -1;
	}*/
}
void VideoLogger(void *pixels, int width, int height, int depth)
{
	int fc = S9xMovieGetFrameCounter();
	if (fc > 0)
		framecounter = fc;
	else
		framecounter++;	

	if (video)
	{
//		if (width != 256 || height != 224)
//		{
//			fprintf(stderr, "\nVideoLogger: Warning! width=%d, height=%d\n", width, height);
//			breakpoint();
//		}
		// This stuff is only good for unix code, but since nitsuja broke unix, I might as well break windows
		fwrite(pixels, 1024, 224, video);
		fflush(video);
		fflush(audio);
		drift++;

		if (maxframes > 0 && __builtin_expect(framecounter >= maxframes, 0))
		{
			printf("-maxframes hit\ndrift:%d\n",drift);
			S9xExit();
		}	
		
	}

	if (Settings.DisplayPressedKeys || keypressscreen)
	{
		static char buffer[128];
                sprintf(buffer, "%s  %s  %s  %s  %s  %s  %c%c%c%c%c%c",
		IPPU.Joypads[0] & SNES_START_MASK ? "Start" : "_____",
		IPPU.Joypads[0] & SNES_SELECT_MASK ? "Select" : "______",
                IPPU.Joypads[0] & SNES_UP_MASK ? "Up" : "__",
		IPPU.Joypads[0] & SNES_DOWN_MASK ? "Down" : "____",
		IPPU.Joypads[0] & SNES_LEFT_MASK ? "Left" : "____",
		IPPU.Joypads[0] & SNES_RIGHT_MASK ? "Right" : "_____",
		IPPU.Joypads[0] & SNES_A_MASK ? 'A':'_',
		IPPU.Joypads[0] & SNES_B_MASK ? 'B':'_',
                IPPU.Joypads[0] & SNES_X_MASK ? 'X':'_',
                IPPU.Joypads[0] & SNES_Y_MASK ? 'Y':'_',  
		IPPU.Joypads[0] & SNES_TL_MASK ? 'L':'_',
		IPPU.Joypads[0] & SNES_TR_MASK ? 'R':'_'
		/*framecounter*/);
		if (Settings.DisplayPressedKeys)
			fprintf(stderr, "%s %d           \r", buffer, framecounter);
		if (keypressscreen)
                    S9xSetInfoString(buffer);
	}
	
	if (__builtin_expect(messageframe >= 0 && framecounter == messageframe, 0))
	{
		S9xMessage(S9X_INFO, S9X_MOVIE_INFO, message);
		GFX.InfoStringTimeout = 300;
		messageframe = -1;
	}

	if (__builtin_expect(fastforwardpoint >= 0 && framecounter >= fastforwardpoint, 0))
	{
//		Settings.FramesToSkip = fastforwarddistance;
		fastforwardpoint = -1;
	}
}