Beispiel #1
0
void InitSurfaces(void)
{
	SDL_PixelFormat *fmt = screen->format;

	scrSurf[0] = SDL_CreateRGBSurface(SDL_SWSURFACE, WIDTH, HEIGHT, fmt->BitsPerPixel, fmt->Rmask, fmt->Gmask, fmt->Bmask, 0);
	if (scrSurf[0] == NULL) StrikeError("Unable to create primary surface: %s\n", SDL_GetError());

	scrSurf[1] = SDL_CreateRGBSurface(SDL_SWSURFACE, WIDTH, HEIGHT, fmt->BitsPerPixel, fmt->Rmask, fmt->Gmask, fmt->Bmask, 0);
	if (scrSurf[1] == NULL) StrikeError("Unable to create secondary surface: %s\n", SDL_GetError());
}
Beispiel #2
0
void AttachZ80ReadHandler(ptrOnReadByteFunc (* check)(Z80EX_WORD, bool))
{
	if (cnt_z80read >= MAX_HANDLERS) StrikeError("Increase MAX_HANDLERS");

	s_ReadItem item;
	item.check = check;

	hnd_z80read[cnt_z80read++] = item;
}
Beispiel #3
0
void AttachSDLHandler(int eventType, bool (* func)(SDL_Event&))
{
	if (cnt_sdl >= MAX_HANDLERS) StrikeError("Increase MAX_HANDLERS");

	s_SdlItem item;
	item.eventType = eventType;
	item.func = func;

	hnd_sdl[cnt_sdl++] = item;
}
Beispiel #4
0
void AttachZ80OutputHandler(bool (* check)(Z80EX_WORD), bool (* func)(Z80EX_WORD, Z80EX_BYTE))
{
	if (cnt_z80output >= MAX_HANDLERS) StrikeError("Increase MAX_HANDLERS");

	s_OutputItem item;
	item.check = check;
	item.func = func;

	hnd_z80output[cnt_z80output++] = item;
}
Beispiel #5
0
void AttachZ80WriteHandler(bool (* check)(Z80EX_WORD), bool (* func)(Z80EX_WORD, Z80EX_BYTE))
{
	if (cnt_z80write >= MAX_HANDLERS) StrikeError("Increase MAX_HANDLERS");

	s_WriteItem item;
	item.check = check;
	item.func = func;

	hnd_z80write[cnt_z80write++] = item;
}
Beispiel #6
0
void CSndBackendOSS::Init() {
	int tmp;

	audio = open("/dev/dsp", O_WRONLY, 0);
	if (audio == -1) StrikeError("Unable to open /dev/dsp for writing.");

	if (ioctl(audio, SNDCTL_DSP_SETFRAGMENT, &frag) == -1) {close(audio); StrikeError("Unable to set audio fragment size.");}

	tmp = AFMT_S16_NE;
	if (ioctl(audio,SNDCTL_DSP_SETFMT,&tmp) == -1) {close(audio); StrikeError("setting SNDCTL_DSP_SETFMT on audiodev failed.");}

	tmp = 16;
	ioctl(audio, SNDCTL_DSP_SAMPLESIZE, &tmp);
	if (tmp != 16) StrikeError("Unable set samplesize = %d.", tmp);

	tmp = 1;
	if (ioctl(audio, SNDCTL_DSP_STEREO, &tmp) == -1) {close(audio); StrikeError("Unable to set stereo.");}

	tmp = SND_FQ;
	if (ioctl (audio, SNDCTL_DSP_SPEED, &tmp) == -1) {close(audio); StrikeError("Unable to set audio speed = %d.",SND_FQ);}
}
Beispiel #7
0
void AttachResetHandler(void (* func)(void))
{
	if (cnt_reset >= MAX_HANDLERS) StrikeError("Increase MAX_HANDLERS");
	hnd_reset[cnt_reset++] = func;
}
Beispiel #8
0
void AttachAfterFrameRenderHandler(void (* func)(void))
{
	if (cnt_afterFrameRender >= MAX_HANDLERS) StrikeError("Increase MAX_HANDLERS");
	hnd_afterFrameRender[cnt_afterFrameRender++] = func;
}
Beispiel #9
0
void AttachFrameStartHandler(void (* func)(void))
{
	if (cnt_frameStart >= MAX_HANDLERS) StrikeError("Increase MAX_HANDLERS");
	hnd_frameStart[cnt_frameStart++] = func;
}