Exemple #1
0
//------------------------------------------------------------------------------------------------------------------------------------------------------
void FDrive_Update(void)
{
    if (gBF.needToMountFlash == 1)      // Если обнаружено физическое подключение внешнего диска
    {
        uint timeStart = gTimerMS;
        gBF.needToMountFlash = 0;
        Display_SetDrawMode(DrawMode_Hand, FuncDrawDisplay);
        Timer_Enable(kTimerMountFlash, 10, Display_Update);
        if (f_mount(&USBDISKFatFs, (TCHAR const*)USBDISKPath, 1) != FR_OK)
        {
            Display_ShowWarning(WrongFileSystem);
        }
        else
        {
            gFlashDriveIsConnected = true;
            FM_Init();
            ChangeStateFlashDrive();
        }
        while (gTimerMS - timeStart < 3000)
        {
        };
        Timer_Disable(kTimerMountFlash);
        Display_SetDrawMode(DrawMode_Auto, 0);
    }
    else
    {
        USBH_Process(&handleUSBH);
    }
}
Exemple #2
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;
}
Exemple #3
0
//------------------------------------------------------------------------------------------------------------------------------------------------------
void FDrive_Mount(void)
{
    FM_Init();
    ChangeStateFlashDrive();
    if (f_mount(&USBDISKFatFs, (TCHAR const*)USBDISKPath, 0) != FR_OK)
    {
        LOG_ERROR("Не могу примонтировать диск");
    }
}
Exemple #4
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;
}