コード例 #1
0
int init_vice(const char *c64Dir) {
	printf("Initing vice from %s", c64Dir);
	maincpu_early_init();
	machine_setup_context();
	drive_setup_context();
	machine_early_init();
	sysfile_init("C64");
	gfxoutput_early_init();
	if(init_resources() < 0) {
		archdep_startup_log_error("Failed to init resources");
		return -1;
	}

	if(resources_set_defaults() < 0) {
		archdep_startup_log_error("Cannot set defaults.\n");
		return -2;
	}

	resources_set_int("SidResidSampling", 0);
	resources_set_int("VICIIVideoCache", 0);
	resources_set_string("Directory", c64Dir);
	if(init_main() < 0) {
		archdep_startup_log_error("Failed to init main");
		return -3;
	}

	fprintf(stderr, "All is OK");
	return 0;
}
コード例 #2
0
ファイル: menudefs.c プロジェクト: bobsummerwill/VICE
static TUI_MENU_CALLBACK(restore_default_settings_callback)
{
    if (been_activated) {
        resources_set_defaults();
        tui_message("Default settings restored.");
        ui_update_menus();
    }

    return NULL;
}
コード例 #3
0
ファイル: VICEPlugin.cpp プロジェクト: lioncash/droidsound
JNIEXPORT void JNICALL Java_com_ssb_droidsound_plugins_VICEPlugin_N_1setDataDir(JNIEnv *env, jclass cl, jstring path)
{
    const char* cpath = env->GetStringUTFChars(path, 0);

    __android_log_print(ANDROID_LOG_VERBOSE, "VICEPlugin", "setRootDir() to %s", cpath);
    maincpu_early_init();
    machine_setup_context();
    drive_setup_context();
    machine_early_init();
    sysfile_init("C64");

    gfxoutput_early_init(0);

    if (init_resources() < 0)
    {
        archdep_startup_log_error("Failed to init resources");
        return;
    }

    /* Set factory defaults.  */
    if (resources_set_defaults() < 0)
    {
        archdep_startup_log_error("Cannot set defaults.\n");
        return;
    }

    resources_set_int("SidResidSampling", 0);
    resources_set_int("VICIIVideoCache", 0);
    resources_set_string("Directory", cpath);

    if (init_main() < 0)
    {
        archdep_startup_log_error("Failed to init main");
        return;
    }

    env->ReleaseStringUTFChars(path, cpath);
}
コード例 #4
0
ファイル: vsidui.c プロジェクト: AreaScout/vice
static void handle_wm_command(WPARAM wparam, LPARAM lparam, HWND hwnd)
{
    TCHAR *st_name = NULL;
    char *name = NULL;
    int i;

    switch (wparam) {
        case IDM_LOAD_PSID_FILE:
            st_name = uilib_select_file(hwnd, translate_text(IDS_PSID_FILE), UILIB_FILTER_ALL, UILIB_SELECTOR_TYPE_FILE_LOAD, UILIB_SELECTOR_STYLE_DEFAULT);
            if (st_name != NULL) {
                name = system_wcstombs_alloc(st_name);
                if (machine_autodetect_psid(st_name) >= 0) {
                    vsid_disp(0, 0,  NULL, NULL);
                    psid_init_driver();
                    vsid_ui_init();
                    machine_play_psid(0);
                    for (i = 0; i < VSID_S_LASTLINE; i++) {
                        *vsidstrings[i] = 0;
                    }
                    machine_trigger_reset(MACHINE_RESET_MODE_SOFT);
                    songs = psid_tunes(&default_song);
                    current_song = default_song;
                    psid_ui_set_tune(uint_to_void_ptr(current_song), NULL);
                    vsid_ui_display_tune_nr(current_song);
                    vsid_ui_set_default_tune(default_song);
                    vsid_ui_display_nr_of_tunes(songs);
                }
                system_wcstombs_free(name);
                lib_free(st_name);
            }
            break;
        case IDM_SELECT_TUNE:
            ui_select_vsid_tune(hwnd);
            break;
        case IDM_NEXT_TUNE:
            if (current_song < songs) {
                current_song++;
                psid_ui_set_tune(uint_to_void_ptr(current_song), NULL);
                vsid_ui_display_tune_nr(current_song);
                vsid_ui_set_default_tune(default_song);
                vsid_ui_display_nr_of_tunes(songs);
            }
            break;
        case IDM_PREVIOUS_TUNE:
            if (current_song > 1) {
                current_song--;
                psid_ui_set_tune(uint_to_void_ptr(current_song), NULL);
                vsid_ui_display_tune_nr(current_song);
                vsid_ui_set_default_tune(default_song);
                vsid_ui_display_nr_of_tunes(songs);
            }
            break;
        case IDM_RESET_HARD:
            machine_trigger_reset(MACHINE_RESET_MODE_HARD);
            break;
        case IDM_RESET_SOFT:
            machine_trigger_reset(MACHINE_RESET_MODE_SOFT);
            break;
        case IDM_MONITOR:
            monitor_startup_trap();
            break;
        case IDM_EXIT:
            PostMessage(hwnd, WM_CLOSE, wparam, lparam);
            break;
        case IDM_SOUND_RECORD_START:
            ui_sound_record_settings_dialog(hwnd);
            break;
        case IDM_SOUND_RECORD_STOP:
            resources_set_string("SoundRecordDeviceName", "");
            break;
        case IDM_MAXIMUM_SPEED_CUSTOM:
            ui_speed_settings_dialog(hwnd);
            break;
        case IDM_SOUND_SETTINGS:
            ui_sound_settings_dialog(hwnd);
            break;
        case IDM_SID_SETTINGS:
            ui_sid_settings_dialog(hwnd, c64_sid_baseaddress);
            break;
        case IDM_SETTINGS_SAVE_FILE:
            if ((st_name = uilib_select_file(hwnd, translate_text(IDS_SAVE_CONFIG_FILE), UILIB_FILTER_ALL, UILIB_SELECTOR_TYPE_FILE_SAVE, UILIB_SELECTOR_STYLE_DEFAULT)) != NULL) {
                char *name;

                name = system_wcstombs_alloc(st_name);

                if (resources_save(st_name) < 0) {
                    ui_error(translate_text(IDS_CANNOT_SAVE_SETTINGS));
                } else {
                    ui_message(translate_text(IDS_SETTINGS_SAVED_SUCCESS));
                }
                system_wcstombs_free(name);
                lib_free(st_name);
            }
            break;
        case IDM_SETTINGS_LOAD_FILE:
            if ((st_name = uilib_select_file(hwnd, translate_text(IDS_LOAD_CONFIG_FILE), UILIB_FILTER_ALL, UILIB_SELECTOR_TYPE_FILE_LOAD, UILIB_SELECTOR_STYLE_DEFAULT)) != NULL) {
                char *name;

                name = system_wcstombs_alloc(st_name);

                if (resources_load(st_name) < 0) {
                    ui_error(translate_text(IDS_CANNOT_LOAD_SETTINGS));
                } else {
                    ui_message(translate_text(IDS_SETTINGS_LOADED_SUCCESS));
                }
                system_wcstombs_free(name);
                lib_free(st_name);
            }
            break;
        case IDM_SETTINGS_SAVE:
            if (resources_save(NULL) < 0) {
                ui_error(translate_text(IDS_CANNOT_SAVE_SETTINGS));
            } else {
                ui_message(translate_text(IDS_SETTINGS_SAVED_SUCCESS));
            }
            break;
        case IDM_SETTINGS_LOAD:
            if (resources_load(NULL) < 0) {
                ui_error(translate_text(IDS_CANNOT_LOAD_SETTINGS));
            } else {
                ui_message(translate_text(IDS_SETTINGS_LOADED_SUCCESS));
            }
            break;
        case IDM_SETTINGS_DEFAULT:
            resources_set_defaults();
            ui_message(translate_text(IDS_DEFAULT_SETTINGS_RESTORED));
            break;
        case IDM_LANG_EN:
        case IDM_LANG_DA:
        case IDM_LANG_DE:
        case IDM_LANG_ES:
        case IDM_LANG_FR:
        case IDM_LANG_HU:
        case IDM_LANG_IT:
        case IDM_LANG_KO:
        case IDM_LANG_NL:
        case IDM_LANG_PL:
        case IDM_LANG_RU:
        case IDM_LANG_SV:
        case IDM_LANG_TR:
            ui_set_language((unsigned int)wparam);
            vsid_ui_translate();
            break;
        case IDM_ABOUT:
        case IDM_HELP:
        case IDM_CONTRIBUTORS:
        case IDM_LICENSE:
        case IDM_WARRANTY:
        case IDM_CMDLINE:
            uihelp_dialog(hwnd, wparam);
            break;
        default:
            handle_default_command(wparam, lparam, hwnd);
    }
}
コード例 #5
0
ファイル: initcmdline.c プロジェクト: r-type/vice-libretro
static int cmdline_default(const char *param, void *extra_param)
{
    return resources_set_defaults();
}
コード例 #6
0
ファイル: uisettings.c プロジェクト: bobsummerwill/VICE
static UI_CALLBACK(set_default_resources)
{
    vsync_suspend_speed_eval();
    resources_set_defaults();
    ui_update_menus();
}
コード例 #7
0
ファイル: vsidui.c プロジェクト: bobsummerwill/VICE
static int vsid_menu_handle(int idm)
{
    char *fname = NULL;
    char *curlang;
    int i;

    switch (idm) {
        case IDM_NEXT_TUNE:
            if (current_song < songs) {
                current_song++;
                psid_ui_set_tune(uint_to_void_ptr(current_song), NULL);
                vsid_ui_display_tune_nr(current_song);
                vsid_ui_set_default_tune(default_song);
                vsid_ui_display_nr_of_tunes(songs);
            }
            break;
        case IDM_PREVIOUS_TUNE:
            if (current_song > 1) {
                current_song--;
                psid_ui_set_tune(uint_to_void_ptr(current_song), NULL);
                vsid_ui_display_tune_nr(current_song);
                vsid_ui_set_default_tune(default_song);
                vsid_ui_display_nr_of_tunes(songs);
            }
            break;
        case IDM_LOAD_PSID_FILE:
            fname = VSID_BrowseFile(translate_text(IDS_PSID_SELECT), "#?");
            if (fname != NULL) {
                if (machine_autodetect_psid(fname) >= 0) {
                    psid_init_driver();
                    machine_play_psid(0);
                    for (i = 0; i < VSID_S_LASTLINE; i++) {
                        *vsidstrings[i] = 0;
                    }
                    machine_trigger_reset(MACHINE_RESET_MODE_SOFT);
                    songs = psid_tunes(&default_song);
                    current_song = default_song;
                    psid_ui_set_tune(uint_to_void_ptr(current_song), NULL);
                    vsid_ui_display_tune_nr(current_song);
                    vsid_ui_set_default_tune(default_song);
                    vsid_ui_display_nr_of_tunes(songs);
                }
            }
            break;
        case IDM_RESET_HARD:
            machine_trigger_reset(MACHINE_RESET_MODE_HARD);
            break;
        case IDM_RESET_SOFT:
            machine_trigger_reset(MACHINE_RESET_MODE_SOFT);
            break;
        case IDM_EXIT:
            do_quit_vice = 1;
            break;
        case IDM_SETTINGS_SAVE_FILE:
            fname = VSID_BrowseFile(translate_text(IDS_CONFIG_FILENAME_SELECT), "#?");
            if (fname != NULL) {
                if (resources_save(fname) < 0) {
                    ui_error(translate_text(IDMES_CANNOT_SAVE_SETTINGS));
                } else {
                    ui_message(translate_text(IDMES_SETTINGS_SAVED_SUCCESS));
                }
            }
            break;
        case IDM_SETTINGS_LOAD_FILE:
            fname = VSID_BrowseFile(translate_text(IDS_CONFIG_FILENAME_SELECT), "#?");
            if (fname != NULL) {
                if (resources_load(fname) < 0) {
                    ui_error(translate_text(IDMES_CANNOT_LOAD_SETTINGS));
                } else {
                    ui_message(translate_text(IDMES_SETTINGS_LOAD_SUCCESS));
                }
            }
            break;
        case IDM_SETTINGS_SAVE:
            if (resources_save(NULL) < 0) {
                ui_error(translate_text(IDMES_CANNOT_SAVE_SETTINGS));
            } else {
                ui_message(translate_text(IDMES_SETTINGS_SAVED_SUCCESS));
            }
            break;
        case IDM_SETTINGS_LOAD:
            if (resources_load(NULL) < 0) {
                ui_error(translate_text(IDMES_CANNOT_LOAD_SETTINGS));
            } else {
                ui_message(translate_text(IDMES_SETTINGS_LOAD_SUCCESS));
            }
            break;
        case IDM_SETTINGS_DEFAULT:
            resources_set_defaults();
            ui_message(translate_text(IDMES_DFLT_SETTINGS_RESTORED));
            break;
        case IDM_SAMPLE_RATE:
            i = vsid_requester(translate_text(IDS_SAMPLE_RATE), translate_text(IDS_SAMPLE_RATE), "11025 Hz | 22050 Hz | 44100 Hz | 8000 Hz", 0);
            resources_set_int("SoundSampleRate", vsid_sample_rates[i]);
            break;
        case IDM_BUFFER_SIZE:
            i = vsid_requester(translate_text(IDS_BUFFER_SIZE), translate_text(IDS_BUFFER_SIZE), "150 msec | 200 msec | 250 msec | 300 msec | 350 msec | 100 msec", 0);
            resources_set_int("SoundBufferSize", vsid_buffer_sizes[i]);
            break;
        case IDM_FRAGMENT_SIZE:
            fname = util_concat(translate_text(IDS_MEDIUM), " | ", translate_text(IDS_LARGE), " | ", translate_text(IDS_SMALL), NULL);
            i = vsid_requester(translate_text(IDS_FRAGMENT_SIZE), translate_text(IDS_FRAGMENT_SIZE), fname, 0);
            resources_set_int("SoundFragmentSize", vsid_fragment_sizes[i]);
            lib_free(fname);
            break;
        case IDM_SPEED_ADJUSTMENT:
            fname = util_concat(translate_text(IDS_ADJUSTING), " | ", translate_text(IDS_EXACT), " | ", translate_text(IDS_FLEXIBLE), NULL);
            i = vsid_requester(translate_text(IDS_SPEED_ADJUSTMENT), translate_text(IDS_SPEED_ADJUSTMENT), fname, 0);
            resources_set_int("SoundSpeedAdjustment", vsid_speed_adjustments[i]);
            lib_free(fname);
            break;
        case IDM_VOLUME:
            i = vsid_requester(translate_text(IDS_VOLUME), translate_text(IDS_VOLUME), "50% | 25% | 10% | 5% | 0% | 100%", 0);
            resources_set_int("SoundVolume", vsid_volumes[i]);
            break;
        case IDM_SOUND_OUTPUT_MODE:
            fname = util_concat(translate_text(IDS_MONO), " | ", translate_text(IDS_STEREO), " | ", translate_text(IDS_SYSTEM), NULL);
            i = vsid_requester(translate_text(IDS_SOUND_OUTPUT_MODE), translate_text(IDS_SOUND_OUTPUT_MODE), fname, 0);
            resources_set_int("SoundOutput", vsid_output_modes[i]);
            lib_free(fname);
            break;
        case IDM_SID_ENGINE_MODEL:
            fname = util_concat(
#ifdef HAVE_RESID
                                "ReSID | ",
#endif
#ifdef HAVE_CATWEASELMKIII
                                "Catweasel MK3 | ",
#endif
#ifdef HAVE_HARDSID
                                "HardSID | ",
#endif
#ifdef HAVE_RESID_FP
                                "ReSID-fp | ",
#endif
                                "Fast SID", NULL);
            i = vsid_requester(translate_text(IDS_SID_ENGINE), translate_text(IDS_SID_ENGINE), fname, 0);
            resources_set_int("SidEngine", vsid_sid_engines[i]);
            lib_free(fname);
            switch (vsid_sid_engines[i]) {
                case SID_ENGINE_FASTSID:
                    i = vsid_requester(translate_text(IDS_SID_MODEL), translate_text(IDS_SID_MODEL), "8580 | 6581", 0);
                    resources_set_int("SidModel", vsid_fastsid_models[i]);
                    break;
#ifdef HAVE_RESID
                case SID_ENGINE_RESID:
                    i = vsid_requester(translate_text(IDS_SID_MODEL), translate_text(IDS_SID_MODEL), "8580 | 8580D | 6581", 0);
                    resources_set_int("SidModel", vsid_resid_models[i]);
                    break;
#endif
#ifdef HAVE_RESID_FP
                case SID_ENGINE_RESID_FP:
                    i = vsid_requester(translate_text(IDS_SID_MODEL), translate_text(IDS_SID_MODEL), "6581R3 0486S | 6581R3 3984 | 6581R4AR 3789 | 6581R3 4485 | 6581R4 1986S | 8580R5 3691 | 8580R5 3691D | 8580R5 1489 | 8580R5 1489D | 6581R3 4885", 0);
                    resources_set_int("SidModel", vsid_residfp_models[i]);
                    break;
#endif
            }
            break;
        case IDM_AMOUNT_OF_EXTRA_SIDS:
            i = vsid_requester(translate_text(IDS_AMOUNT_OF_EXTRA_SIDS), translate_text(IDS_AMOUNT_OF_EXTRA_SIDS), "1 | 2 | 0", 0);
            resources_get_int("SidStereo", i);
            break;
#ifdef HAVE_RESID
        case IDM_SAMPLE_METHOD:
            fname = util_concat(translate_text(IDS_INTERPOLATING), " | ", translate_text(IDS_RESAMPLING), " | ", translate_text(IDS_FAST_RESAMPLING), " | ", translate_text(IDS_FAST), NULL);
            i = vsid_requester(translate_text(IDS_SAMPLE_METHOD), translate_text(IDS_SAMPLE_METHOD), fname, 0);
            resources_set_int("SidResidSampling", i);
            lib_free(fname);
            break;
#endif
        case IDM_SOUND_RECORD_START:
#ifndef USE_LAMEMP3
            i = vsid_requester(translate_text(IDS_SOUND_RECORD_FORMAT), translate_text(IDS_SOUND_RECORD_FORMAT), "AIFF | VOC | WAV | IFF", 0);
#else
            i = vsid_requester(translate_text(IDS_SOUND_RECORD_FORMAT), translate_text(IDS_SOUND_RECORD_FORMAT), "AIFF | VOC | WAV | MP3 | IFF", 0);
#endif
            resources_set_string("SoundRecordDeviceName", "");
            resources_set_string("SoundRecordDeviceName", vsid_sound_formats[i]);
            break;
        case IDM_SOUND_RECORD_STOP:
            resources_set_string("SoundRecordDeviceName", "");
            break;
        case IDM_LANGUAGE_ENGLISH:
            resources_get_value("Language", (void *)&curlang);
            if (strcasecmp(curlang, "en")) {
                resources_set_value("Language", (resource_value_t *)"en");
                vsid_menu_rebuild();
            }
            break;
        case IDM_LANGUAGE_DANISH:
            resources_get_value("Language", (void *)&curlang);
            if (strcasecmp(curlang, "da")) {
                resources_set_value("Language", (resource_value_t *)"da");
                vsid_menu_rebuild();
            }
            break;
        case IDM_LANGUAGE_GERMAN:
            resources_get_value("Language", (void *)&curlang);
            if (strcasecmp(curlang, "de")) {
                resources_set_value("Language", (resource_value_t *)"de");
                vsid_menu_rebuild();
            }
            break;
        case IDM_LANGUAGE_SPANISH:
            resources_get_value("Language", (void *)&curlang);
            if (strcasecmp(curlang, "es")) {
                resources_set_value("Language", (resource_value_t *)"es");
                vsid_menu_rebuild();
            }
            break;
        case IDM_LANGUAGE_FRENCH:
            resources_get_value("Language", (void *)&curlang);
            if (strcasecmp(curlang, "fr")) {
                resources_set_value("Language", (resource_value_t *)"fr");
                vsid_menu_rebuild();
            }
            break;
        case IDM_LANGUAGE_ITALIAN:
            resources_get_value("Language", (void *)&curlang);
            if (strcasecmp(curlang, "it")) {
                resources_set_value("Language", (resource_value_t *)"it");
                vsid_menu_rebuild();
            }
            break;
        case IDM_LANGUAGE_KOREAN:
            resources_get_value("Language", (void *)&curlang);
            if (strcasecmp(curlang, "ko")) {
                resources_set_value("Language", (resource_value_t *)"ko");
                vsid_menu_rebuild();
            }
            break;
        case IDM_LANGUAGE_DUTCH:
            resources_get_value("Language", (void *)&curlang);
            if (strcasecmp(curlang, "nl")) {
                resources_set_value("Language", (resource_value_t *)"nl");
                vsid_menu_rebuild();
            }
            break;
        case IDM_LANGUAGE_POLISH:
            resources_get_value("Language", (void *)&curlang);
            if (strcasecmp(curlang, "pl")) {
                resources_set_value("Language", (resource_value_t *)"pl");
                vsid_menu_rebuild();
            }
            break;
        case IDM_LANGUAGE_HUNGARIAN:
            resources_get_value("Language", (void *)&curlang);
            if (strcasecmp(curlang, "hu")) {
                resources_set_value("Language", (resource_value_t *)"hu");
                vsid_menu_rebuild();
            }
            break;
        case IDM_LANGUAGE_RUSSIAN:
            resources_get_value("Language", (void *)&curlang);
            if (strcasecmp(curlang, "ru")) {
                resources_set_value("Language", (resource_value_t *)"ru");
                vsid_menu_rebuild();
            }
            break;
        case IDM_LANGUAGE_SWEDISH:
            resources_get_value("Language", (void *)&curlang);
            if (strcasecmp(curlang, "sv")) {
                resources_set_value("Language", (resource_value_t *)"sv");
                vsid_menu_rebuild();
            }
            break;
        case IDM_LANGUAGE_TURKISH:
            resources_get_value("Language", (void *)&curlang);
            if (strcasecmp(curlang, "tr")) {
                resources_set_value("Language", (resource_value_t *)"tr");
                vsid_menu_rebuild();
            }
            break;
        default:
            {
                int i, j, command_found = 0;

                for (i = 0; toggle_list[i].name != NULL && !command_found; i++) {
                    if (toggle_list[i].idm == idm) {
                        resources_toggle(toggle_list[i].name, NULL);
                        command_found = 1;
                    }
                }

                for (i = 0; value_list[i].name != NULL && !command_found; i++) {
                    for (j = 0; value_list[i].vals[j].idm != 0 && !command_found; j++) {
                        if (value_list[i].vals[j].idm == idm) {
                            resources_set_value(value_list[i].name, (resource_value_t) value_list[i].vals[j].value);
                            command_found = 1;
                        }
                    }
                }
            }
            break;
    }

    return 0;
}
コード例 #8
0
ファイル: main.c プロジェクト: r-type/vice-libretro
/* This is the main program entry point.  Call this from `main()'.  */
int main_program(int argc, char **argv)
{
    int i, n;
    char *program_name;
    char *tmp;
    int ishelp = 0;

    lib_init_rand();

    /* Check for -config and -console before initializing the user interface.
       -config  => use specified configuration file
       -console => no user interface
    */
    DBG(("main:early cmdline(argc:%d)\n", argc));
    for (i = 0; i < argc; i++) {
#ifndef __OS2__
        if ((!strcmp(argv[i], "-console")) || (!strcmp(argv[i], "--console"))) {
            console_mode = 1;
            video_disabled_mode = 1;
        } else
#endif
        if ((!strcmp(argv[i], "-config")) || (!strcmp(argv[i], "--config"))) {
            if ((i + 1) < argc) {
                vice_config_file = lib_stralloc(argv[++i]);
            }
        } else if ((!strcmp(argv[i], "-help")) ||
                   (!strcmp(argv[i], "--help")) ||
                   (!strcmp(argv[i], "-h")) ||
                   (!strcmp(argv[i], "-?"))) {
            ishelp = 1;
        }
    }

#ifdef ENABLE_NLS
    /* gettext stuff, not needed in Gnome, but here I can
       overrule the default locale path */
    setlocale(LC_ALL, "");
    bindtextdomain(PACKAGE, NLS_LOCALEDIR);
    textdomain(PACKAGE);
#endif

    DBG(("main:archdep_init(argc:%d)\n", argc));
    if (archdep_init(&argc, argv) != 0) {
        archdep_startup_log_error("archdep_init failed.\n");
        return -1;
    }

#ifndef __LIBRETRO__
//retro fix atexit in other thread
    if (atexit(main_exit) < 0) {
        archdep_startup_log_error("atexit failed.\n");
        return -1;
    }
#endif

    maincpu_early_init();
    machine_setup_context();
    drive_setup_context();
    machine_early_init();

    /* Initialize system file locator.  */
    sysfile_init(machine_name);

    gfxoutput_early_init(ishelp);
    if ((init_resources() < 0) || (init_cmdline_options() < 0)) {
        return -1;
    }

    /* Set factory defaults.  */
    if (resources_set_defaults() < 0) {
        archdep_startup_log_error("Cannot set defaults.\n");
        return -1;
    }

    /* Initialize the user interface.  `ui_init()' might need to handle the
       command line somehow, so we call it before parsing the options.
       (e.g. under X11, the `-display' option is handled independently).  */
    DBG(("main:ui_init(argc:%d)\n", argc));
    if (!console_mode && ui_init(&argc, argv) < 0) {
        archdep_startup_log_error("Cannot initialize the UI.\n");
        return -1;
    }

#ifdef HAS_TRANSLATION
    /* set the default arch language */
    translate_arch_language_init();
#endif

    if (!ishelp) {
        /* Load the user's default configuration file.  */
        if (resources_load(NULL) < 0) {
            /* The resource file might contain errors, and thus certain
            resources might have been initialized anyway.  */
            if (resources_set_defaults() < 0) {
                archdep_startup_log_error("Cannot set defaults.\n");
                return -1;
            }
        }
    }

    if (log_init() < 0) {
        archdep_startup_log_error("Cannot startup logging system.\n");
    }

    DBG(("main:initcmdline_check_args(argc:%d)\n", argc));
    if (initcmdline_check_args(argc, argv) < 0) {
        return -1;
    }

    program_name = archdep_program_name();

    /* VICE boot sequence.  */
    log_message(LOG_DEFAULT, " ");
#ifdef USE_SVN_REVISION
    log_message(LOG_DEFAULT, "*** VICE Version %s, rev %s ***", VERSION, VICE_SVN_REV_STRING);
#else
    log_message(LOG_DEFAULT, "*** VICE Version %s ***", VERSION);
#endif
    log_message(LOG_DEFAULT, "OS compiled for: %s", platform_get_compile_time_os());
    log_message(LOG_DEFAULT, "GUI compiled for: %s", platform_get_ui());
    log_message(LOG_DEFAULT, "CPU compiled for: %s", platform_get_compile_time_cpu());
    log_message(LOG_DEFAULT, "Compiler used: %s", platform_get_compile_time_compiler());
    log_message(LOG_DEFAULT, "Current OS: %s", platform_get_runtime_os());
    log_message(LOG_DEFAULT, "Current CPU: %s", platform_get_runtime_cpu());
    log_message(LOG_DEFAULT, " ");
    if (machine_class == VICE_MACHINE_VSID) {
        log_message(LOG_DEFAULT, "Welcome to %s, the free portable SID Player.",
                    program_name);
    } else {
        log_message(LOG_DEFAULT, "Welcome to %s, the free portable %s Emulator.",
                    program_name, machine_name);
    }
    log_message(LOG_DEFAULT, " ");

    log_message(LOG_DEFAULT, "Current VICE team members:");
    tmp = lib_malloc(80);
    n = 0; *tmp = 0;
    for (i = 0; core_team[i].name; i++) {
        n += strlen(core_team[i].name);
        if (n > 74) {
            log_message(LOG_DEFAULT, tmp);
            n = 0; *tmp = 0;
        }
        strcat(tmp, core_team[i].name);
        if (core_team[i + 1].name) {
            strcat(tmp, ", ");
        } else {
            strcat(tmp, ".");
            log_message(LOG_DEFAULT, tmp);
        }
    }
    lib_free(tmp);

    log_message(LOG_DEFAULT, " ");
    log_message(LOG_DEFAULT, "This is free software with ABSOLUTELY NO WARRANTY.");
    log_message(LOG_DEFAULT, "See the \"About VICE\" command for more info.");
    log_message(LOG_DEFAULT, " ");

    lib_free(program_name);

    /* Complete the GUI initialization (after loading the resources and
       parsing the command-line) if necessary.  */
    if (!console_mode && ui_init_finish() < 0) {
        return -1;
    }

    if (!console_mode && video_init() < 0) {
        return -1;
    }

    if (initcmdline_check_psid() < 0) {
        return -1;
    }

    if (init_main() < 0) {
        return -1;
    }

    initcmdline_check_attach();

    init_done = 1;
#ifdef __LIBRETRO__
#ifndef NO_LIBCO
	resources_save("./vicerc0");
	co_switch(mainThread);
#endif
#endif
    /* Let's go...  */
    log_message(LOG_DEFAULT, "Main CPU: starting at ($FFFC).");
    maincpu_mainloop();

    log_error(LOG_DEFAULT, "perkele!");

    return 0;
}
コード例 #9
0
ファイル: main.c プロジェクト: twinaphex/vice-next
int main_program(int argc, char **argv)
{
	int i;
	char *program_name;

	/* Check for -config, -console and -vsid before initializing the user interface.
	   -config  => use specified configuration file
	   -console => no user interface
	   -vsid    => user interface in separate process */

	console_mode = 0;
	video_disabled_mode = 0;
	vsid_mode=0;
	machine_class = VICE_MACHINE_C64;
	//machine_class = VICE_MACHINE_CBM6x0;

	archdep_init(&argc, argv);

	if (atexit(emulator_shutdown) < 0) {
		archdep_startup_log_error("atexit");
		return -1;
	}

	maincpu_early_init();
	machine_setup_context();
	drive_setup_context();
	machine_early_init();

	/* Initialize system file locator.  */
	sysfile_init(machine_name);

	gfxoutput_early_init();

	if (init_resources() < 0 || init_cmdline_options() < 0)
		return -1;

	/* Set factory defaults.  */
	if (resources_set_defaults() < 0) {
		archdep_startup_log_error("Cannot set defaults.\n");
		return -1;
	}

	/* Initialize the user interface.  `ui_init()' might need to handle the
	   command line somehow, so we call it before parsing the options.
	   (e.g. under X11, the `-display' option is handled independently).  */
	if (!console_mode && ui_init(&argc, argv) < 0) {
		archdep_startup_log_error("Cannot initialize the UI.\n");
		return -1;
	}

	if (initcmdline_check_args(argc, argv) < 0)
		return -1;

	program_name = archdep_program_name();

	/* VICE boot sequence.  */
	#if 0
	log_message(LOG_DEFAULT, "*** VICE Version %s ***", VERSION);
	log_message(LOG_DEFAULT, "OS compiled for: %s", platform_get_compile_time_os());
	log_message(LOG_DEFAULT, "GUI compiled for: %s", platform_get_ui());
	log_message(LOG_DEFAULT, "CPU compiled for: %s", platform_get_compile_time_cpu());
	log_message(LOG_DEFAULT, "Compiler used: %s", platform_get_compile_time_compiler());
	log_message(LOG_DEFAULT, "Current OS: %s", platform_get_runtime_os());
	log_message(LOG_DEFAULT, "Current CPU: %s", platform_get_runtime_cpu());
	log_message(LOG_DEFAULT, " ");
	log_message(LOG_DEFAULT, "Welcome to %s, the free portable %s Emulator.",
			program_name, machine_name);
	log_message(LOG_DEFAULT, " ");
	log_message(LOG_DEFAULT, "Current VICE team members:");
	log_message(LOG_DEFAULT, "A. Boose, D. Lem, T. Biczo, A. Dehmel, T. Bretz, A. Matthies,");
	log_message(LOG_DEFAULT, "M. Pottendorfer, M. Brenner, S. Trikaliotis, M. van den Heuvel,");
	log_message(LOG_DEFAULT, "C. Vogelgsang, F. Gennari, H. Nuotio, D. Kahlin, A. Lankila.");
	log_message(LOG_DEFAULT, " ");
	log_message(LOG_DEFAULT, "This is free software with ABSOLUTELY NO WARRANTY.");
	log_message(LOG_DEFAULT, "See the \"About VICE\" command for more info.");
	log_message(LOG_DEFAULT, " ");
	#endif

	lib_free(program_name);

	/* Complete the GUI initialization (after loading the resources and
	   parsing the command-line) if necessary.  */
	if (!console_mode && ui_init_finish() < 0)
		return -1;

	if (!console_mode && video_init() < 0)
		return -1;

	if (initcmdline_check_psid() < 0)
		return -1;

	if (init_main() < 0)
		return -1;

	initcmdline_check_attach();

	init_done = 1;

	/* Let's go...  */
	#ifdef CELL_DEBUG
	printf("Main CPU: starting at ($FFFC).\n");
	#endif
	maincpu_mainloop();

	#ifdef CELL_DEBUG
	printf("perkele!\n");
	#endif

	return 0;
}