Exemplo n.º 1
0
static void read_frame_controller_data(bool addFrame, void (*resetFunc)() = NULL)
{
	// reset code check
	while (Movie.InputBufferPtr[0] == 0xff)
	{
		bool reset = true;
		for (int i = 1; i < (int) Movie.BytesPerSample; i++)
		{
			if (Movie.InputBufferPtr[i] != 0xff)
			{
				reset = false;
				break;
			}
		}

		if (reset)
		{
			Movie.InputBufferPtr += Movie.BytesPerSample;
			if (resetFunc != (void(*)())NULL)
				(*resetFunc)();
			return;
		}
	}

	for(int i=0; i<8; ++i)
	{
		if(Movie.ControllersMask & (1<<i))
		{
			MovieSetJoypad(i, Read16(Movie.InputBufferPtr));
		}
		else
		{
			MovieSetJoypad(i, 0);		// pretend the controller is disconnected
		}
	}
#ifdef PERIPHERAL_SUPPORT
	for(int port=0;port<2;port++)
	{
		if(Movie.PortType[port] == CTL_MOUSE)
		{
			uint8 buf [MOUSE_DATA_SIZE];
			memcpy(buf, Movie.InputBufferPtr, MOUSE_DATA_SIZE); Movie.InputBufferPtr += MOUSE_DATA_SIZE;
			MovieSetMouse(port, buf, !addFrame);
		}
		if(Movie.PortType[port] == CTL_SUPERSCOPE)
		{
			uint8 buf [SCOPE_DATA_SIZE];
			memcpy(buf, Movie.InputBufferPtr, SCOPE_DATA_SIZE); Movie.InputBufferPtr += SCOPE_DATA_SIZE;
			MovieSetScope(port, buf);
		}
		if(Movie.PortType[port] == CTL_JUSTIFIER)
		{
			uint8 buf [JUSTIFIER_DATA_SIZE];
			memcpy(buf, Movie.InputBufferPtr, JUSTIFIER_DATA_SIZE); Movie.InputBufferPtr += JUSTIFIER_DATA_SIZE;
			MovieSetJustifier(port, buf);
		}
	}
#endif
}
Exemplo n.º 2
0
static void S9xMovieResetControls ()
{
	for(int i=0; i<8; i++)
		MovieSetJoypad(i, 0);

#ifdef PERIPHERAL_SUPPORT
	uint8 clearedMouse [MOUSE_DATA_SIZE];
	memset(clearedMouse, 0, MOUSE_DATA_SIZE);
	clearedMouse[4] = 1; // mouse[n].buttons = 1;

	uint8 clearedScope [SCOPE_DATA_SIZE];
	memset(clearedScope, 0, SCOPE_DATA_SIZE);

	uint8 clearedJustifier [JUSTIFIER_DATA_SIZE];
	memset(clearedJustifier, 0, JUSTIFIER_DATA_SIZE);

	for(int i=0; i<2; i++){
		MovieSetMouse(i,clearedMouse,true);
		MovieSetScope(i,clearedScope);
		MovieSetJustifier(i,clearedJustifier);
	}

#endif
}
Exemplo n.º 3
0
static void read_frame_controller_data(bool addFrame)
{
	int i;

	// one sample of all 1 bits = reset code
	// (the SNES controller doesn't have enough buttons to possibly generate this sequence)
	// (a single bit indicator was not used, to avoid having to special-case peripheral recording here)
	if(Movie.InputBufferPtr[0] == 0xFF)
	{
		bool reset = true;
		for(i=1; i<(int)Movie.BytesPerSample; i++)
		{
			if(Movie.InputBufferPtr[i] != 0xFF)
			{
				reset = false;
				break;
			}
		}
		if(reset)
		{
			Movie.InputBufferPtr += Movie.BytesPerSample;
			S9xSoftReset();
			return;
		}
	}

	for(i=0; i<8; ++i)
	{
		if(Movie.ControllersMask & (1<<i))
		{
			MovieSetJoypad(i, Read16(Movie.InputBufferPtr));
		}
		else
		{
			MovieSetJoypad(i, 0);		// pretend the controller is disconnected
		}
	}
#ifdef PERIPHERAL_SUPPORT
	for(int port=0;port<2;port++)
	{
		if(Movie.PortType[port] == CTL_MOUSE)
		{
			uint8 buf [MOUSE_DATA_SIZE];
			memcpy(buf, Movie.InputBufferPtr, MOUSE_DATA_SIZE); Movie.InputBufferPtr += MOUSE_DATA_SIZE;
			MovieSetMouse(port, buf, !addFrame);
		}
		if(Movie.PortType[port] == CTL_SUPERSCOPE)
		{
			uint8 buf [SCOPE_DATA_SIZE];
			memcpy(buf, Movie.InputBufferPtr, SCOPE_DATA_SIZE); Movie.InputBufferPtr += SCOPE_DATA_SIZE;
			MovieSetScope(port, buf);
		}
		if(Movie.PortType[port] == CTL_JUSTIFIER)
		{
			uint8 buf [JUSTIFIER_DATA_SIZE];
			memcpy(buf, Movie.InputBufferPtr, JUSTIFIER_DATA_SIZE); Movie.InputBufferPtr += JUSTIFIER_DATA_SIZE;
			MovieSetJustifier(port, buf);
		}
	}
#endif
}