Example #1
0
File: client.c Project: rsenn/tichu
/* -------------------------------------------------------------------------- *
 * Client Shutdown                                                            *
 * -------------------------------------------------------------------------- */
void client_shutdown(void)
{
  if(client_ini)
    ini_close(client_ini);
  
  /* Bilder freigeben */
  client_free(client_buffer);  
/*  client_free_image(client_background);*/
  
  /* Client-Module herunterfahren */
  sound_shutdown();
  card_shutdown();
  net_shutdown();
  
  /* Bibliotheken herunterfahren */
  SDL_Quit();
  sgQuit();
  
#if MDEBUG_ENABLE
  mdebug_shutdown();
#endif /* MDEBUG_ENABLE */
  
  client_log(STATUS, "Baba! *Winke-Wink*");
  exit(0);
}
Example #2
0
void system_shutdown(void)
{
#ifdef DEBUG
    int i;

    /*error("PC:%04X\tSP:%04X\n", z80_get_reg(Z80_PC), z80_get_reg(Z80_SP));
    error("AF:%04X\tAF:%04X\n", z80_get_reg(Z80_AF), z80_get_reg(Z80_AF2));
    error("BC:%04X\tBC:%04X\n", z80_get_reg(Z80_BC), z80_get_reg(Z80_BC2));
    error("DE:%04X\tDE:%04X\n", z80_get_reg(Z80_DE), z80_get_reg(Z80_DE2));
    error("HL:%04X\tHL:%04X\n", z80_get_reg(Z80_HL), z80_get_reg(Z80_HL2));
    error("IX:%04X\tIY:%04X\n", z80_get_reg(Z80_IX), z80_get_reg(Z80_IY));

    for(i = 0; i <= 0x0A; i++)
        error("%02X ", vdp.reg[i]);
    error("\n");

    error("MODE:%02X\n", vdp.mode & 7);
    error("PN:%04X\n", vdp.pn);
    error("CT:%04X\n", vdp.ct);
    error("PG:%04X\n", vdp.pg);
    error("SA:%04X\n", vdp.sa);
    error("SG:%04X\n", vdp.sg);

    error("\n");*/
#endif

    sms_shutdown();
    pio_shutdown();
    vdp_shutdown();
    render_shutdown();
    sound_shutdown();
}
Example #3
0
int sound_init(void)
{
    /* If we are reinitializing, shut down sound emulation */
    if(snd.enabled)
    {
        sound_shutdown();
    }

    /* Disable sound until initialization is complete */
    snd.enabled = 0;

    /* Check if sample rate is invalid */
    if(snd.sample_rate < 8000 || snd.sample_rate > 48000)
        return 0;

    // Init sound emulation
	SN76489Init(0, snd.psg_clock, 0);
	SN76496SetRoute(0, 0.70, BURN_SND_ROUTE_BOTH);

	FM_Init();

    /* Inform other functions that we can use sound */
    snd.enabled = 1;

    return 1;
}
Example #4
0
int coleco_shutdown(void) {
    coleco_mem_shutdown();
    sms_z80_shutdown();

    sms_vdp_shutdown();
    sound_shutdown();

    /* Reset a few things in case we reinit later. */
    colecovision_cons._base.initialized = 0;

    return 0;
}
Example #5
0
int nes_shutdown(void) {
    if(!nes_cons._base.initialized)
        return -1;

    nes_ppu_shutdown();
    nes_mem_shutdown();
    nes_apu_shutdown();
    sound_shutdown();

    nes_cons._base.initialized = 0;

    return 0;
}
Example #6
0
static int chip8_shutdown(void) {
    if(!chip8_cons._base.initialized)
        return -1;

    chip8_mem_clear_fb(NULL);
    Chip8CPU_reset(&cpu);
    chip8_mem_shutdown();
    sound_shutdown();

    chip8_cons._base.initialized = 0;

    return 0;
}
Example #7
0
int sound_init(void)
{
    uint8 *buf = NULL;
    int restore_fm = 0;
    int i;

    /* Save register settings */
    if(snd.enabled && sms.use_fm)
    {
        restore_fm = 1;
        buf = malloc(FM_GetContextSize());
        FM_GetContext(buf);
    }

    /* If we are reinitializing, shut down sound emulation */
    if(snd.enabled)
    {
        sound_shutdown();
    }

    /* Disable sound until initialization is complete */
    snd.enabled = 0;

    /* Check if sample rate is invalid */
    if(snd.sample_rate < 8000 || snd.sample_rate > 48000)
        return 0;

    /* Assign stream mixing callback if none provided */
    if(!snd.mixer_callback)
        snd.mixer_callback = sound_mixer_callback;

    /* Calculate number of samples generated per frame */
#ifdef PSP
    /* PSP version requires a sample count divisible by 64 */
    snd.sample_count = ((snd.sample_rate / snd.fps) + 63) & ~63;
#else
    snd.sample_count = (snd.sample_rate / snd.fps);
#endif

    /* Calculate size of sample buffer */
    snd.buffer_size = snd.sample_count * 2;

    /* Free sample buffer position table if previously allocated */
    if(smptab)
    {
        free(smptab);
        smptab = NULL;
    }

	/* Prepare incremental info */
    snd.done_so_far = 0;
    smptab_len = (sms.display == DISPLAY_NTSC) ? 262 : 313;
    smptab = malloc(smptab_len * sizeof(int));
    if(!smptab) return 0;
    for (i = 0; i < smptab_len; i++)
    {
    	double calc = (snd.sample_count * i);
        calc = calc / (double)smptab_len;
    	smptab[i] = (int)calc;
    }

    /* Allocate emulated sound streams */
    for(i = 0; i < STREAM_MAX; i++)
    {
        snd.stream[i] = malloc(snd.buffer_size);
        if(!snd.stream[i]) return 0;
        memset(snd.stream[i], 0, snd.buffer_size);
    }

    /* Allocate sound output streams */
    snd.output[0] = calloc(snd.sample_count, sizeof(int16));
    snd.output[1] = calloc(snd.sample_count, sizeof(int16));
    if(!snd.output[0] || !snd.output[1]) return 0;

    /* Set up buffer pointers */
    fm_buffer = (int16 **)&snd.stream[STREAM_FM_MO];
    psg_buffer = (int16 **)&snd.stream[STREAM_PSG_L];

    /* Set up SN76489 emulation */
    SN76489_Init(0, snd.psg_clock, snd.sample_rate);

    /* Set up YM2413 emulation */
    FM_Init();

    /* Inform other functions that we can use sound */
    snd.enabled = 1;

    /* Restore YM2413 register settings */
    if(restore_fm)
    {
        FM_SetContext(buf);
    }

    return 1;
}