// In this procedure, we use changed_prefs int loadconfig_old(struct uae_prefs *p, const char *orgpath) { char path[MAX_PATH]; int cpu_level; strcpy(path, orgpath); char *ptr = strstr(path, ".uae"); if(ptr > 0) { *(ptr + 1) = '\0'; strcat(path, "conf"); } FILE *f=fopen(path,"rt"); if (!f){ write_log ("No config file %s!\n",path); return 0; } else { // Set everthing to default and clear HD settings default_prefs(p, 0); SetDefaultMenuSettings(p); char filebuffer[256]; int dummy; fscanf(f,"kickstart=%d\n",&kickstart); #if defined(PANDORA) || defined(ANDROIDSDL) fscanf(f,"scaling=%d\n",&dummy); #else fscanf(f,"scaling=%d\n",&mainMenu_enableHWscaling); #endif fscanf(f,"showstatus=%d\n", &p->leds_on_screen); fscanf(f,"mousemultiplier=%d\n", &p->input_joymouse_multiplier); p->input_joymouse_multiplier *= 10; #if defined(PANDORA) || defined(ANDROIDSDL) fscanf(f,"systemclock=%d\n",&dummy); // mainMenu_throttle never changes -> removed fscanf(f,"syncthreshold=%d\n", &dummy); // timeslice_mode never changes -> removed #else fscanf(f,"systemclock=%d\n",&mainMenu_throttle); fscanf(f,"syncthreshold=%d\n", ×lice_mode); #endif fscanf(f,"frameskip=%d\n", &p->gfx_framerate); fscanf(f,"sound=%d\n",&p->produce_sound ); if(p->produce_sound >= 10) { p->sound_stereo = 1; p->produce_sound -= 10; if(p->produce_sound > 0) p->produce_sound += 1; } else p->sound_stereo = 0; fscanf(f,"soundrate=%d\n",&p->sound_freq); fscanf(f,"autosave=%d\n", &dummy); fscanf(f,"gp2xclock=%d\n", &dummy); int joybuffer = 0; fscanf(f,"joyconf=%d\n",&joybuffer); fscanf(f,"autofireRate=%d\n",&p->input_autofire_linecnt); p->input_autofire_linecnt = p->input_autofire_linecnt * 312; fscanf(f,"autofire=%d\n", &dummy); fscanf(f,"stylusOffset=%d\n",&dummy); fscanf(f,"tapDelay=%d\n",&p->pandora_tapDelay); fscanf(f,"scanlines=%d\n", &dummy); #if defined(PANDORA) || defined(ANDROIDSDL) fscanf(f,"ham=%d\n",&dummy); #else fscanf(f,"ham=%d\n",&mainMenu_ham); #endif fscanf(f,"enableScreenshots=%d\n", &dummy); fscanf(f,"floppyspeed=%d\n",&p->floppy_speed); fscanf(f,"drives=%d\n", &p->nr_floppies); fscanf(f,"videomode=%d\n", &p->ntscmode); if(p->ntscmode) p->chipset_refreshrate = 60; else p->chipset_refreshrate = 50; fscanf(f,"mainMenu_cpuSpeed=%d\n",&p->pandora_cpu_speed); fscanf(f,"presetModeId=%d\n",&presetModeId); fscanf(f,"moveX=%d\n", &p->pandora_horizontal_offset); fscanf(f,"moveY=%d\n", &p->pandora_vertical_offset); fscanf(f,"displayedLines=%d\n",&p->gfx_size.height); fscanf(f,"screenWidth=%d\n", &p->gfx_size_fs.width); fscanf(f,"cutLeft=%d\n", &dummy); fscanf(f,"cutRight=%d\n", &dummy); fscanf(f,"customControls=%d\n",&p->pandora_customControls); fscanf(f,"custom_dpad=%d\n",&dummy); fscanf(f,"custom_up=%d\n",&customControlMap[SDLK_UP]); fscanf(f,"custom_down=%d\n",&customControlMap[SDLK_DOWN]); fscanf(f,"custom_left=%d\n",&customControlMap[SDLK_LEFT]); fscanf(f,"custom_right=%d\n",&customControlMap[SDLK_RIGHT]); fscanf(f,"custom_A=%d\n",&customControlMap[SDLK_HOME]); fscanf(f,"custom_B=%d\n",&customControlMap[SDLK_END]); fscanf(f,"custom_X=%d\n",&customControlMap[SDLK_PAGEDOWN]); fscanf(f,"custom_Y=%d\n",&customControlMap[SDLK_PAGEUP]); fscanf(f,"custom_L=%d\n",&customControlMap[SDLK_RSHIFT]); fscanf(f,"custom_R=%d\n",&customControlMap[SDLK_RCTRL]); fscanf(f,"cpu=%d\n", &cpu_level); if(cpu_level > 0) // M68000 // Was old format cpu_level = 2; // M68020 fscanf(f,"chipset=%d\n", &p->chipset_mask); p->immediate_blits = (p->chipset_mask & 0x100) == 0x100; switch (p->chipset_mask & 0xff) { case 1: p->chipset_mask = CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE; break; case 2: p->chipset_mask = CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE | CSMASK_AGA; break; default: p->chipset_mask = CSMASK_ECS_AGNUS; break; } fscanf(f,"cpu=%d\n", &p->m68k_speed); if(p->m68k_speed < 0) { // New version of this option p->m68k_speed = -p->m68k_speed; } else { // Old version (500 5T 1200 12T 12T2) if(p->m68k_speed >= 2) { // 1200: set to 68020 with 14 MHz cpu_level = 2; // M68020 p->m68k_speed--; if(p->m68k_speed > 2) p->m68k_speed = 2; } } if(p->m68k_speed == 1) p->m68k_speed = M68K_SPEED_14MHZ_CYCLES; if(p->m68k_speed == 2) p->m68k_speed = M68K_SPEED_25MHZ_CYCLES; p->cachesize = 0; p->cpu_compatible = 0; switch(cpu_level) { case 0: p->cpu_model = 68000; p->fpu_model = 0; break; case 1: p->cpu_model = 68010; p->fpu_model = 0; break; case 2: p->cpu_model = 68020; p->fpu_model = 0; break; case 3: p->cpu_model = 68020; p->fpu_model = 68881; break; case 4: p->cpu_model = 68040; p->fpu_model = 68881; break; } disk_eject(0); disk_eject(1); disk_eject(2); disk_eject(3); fscanf(f,"df0=%s\n",&filebuffer); replace(filebuffer,' ','|'); if(DISK_validate_filename(p, filebuffer, 0, NULL, NULL, NULL)) strcpy(p->floppyslots[0].df, filebuffer); else p->floppyslots[0].df[0] = 0; disk_insert(0, filebuffer); if(p->nr_floppies > 1) { memset(filebuffer, 0, 256); fscanf(f,"df1=%s\n",&filebuffer); replace(filebuffer,' ','|'); if(DISK_validate_filename(p, filebuffer, 0, NULL, NULL, NULL)) strcpy(p->floppyslots[1].df, filebuffer); else p->floppyslots[1].df[0] = 0; disk_insert(1, filebuffer); } if(p->nr_floppies > 2) { memset(filebuffer, 0, 256); fscanf(f,"df2=%s\n",&filebuffer); replace(filebuffer,' ','|'); if(DISK_validate_filename(p, filebuffer, 0, NULL, NULL, NULL)) strcpy(p->floppyslots[2].df, filebuffer); else p->floppyslots[2].df[0] = 0; disk_insert(2, filebuffer); } if(p->nr_floppies > 3) { memset(filebuffer, 0, 256); fscanf(f,"df3=%s\n",&filebuffer); replace(filebuffer,' ','|'); if(DISK_validate_filename(p, filebuffer, 0, NULL, NULL, NULL)) strcpy(p->floppyslots[3].df, filebuffer); else p->floppyslots[3].df[0] = 0; disk_insert(3, filebuffer); } for(int i=0; i<4; ++i) { if(i < p->nr_floppies) p->floppyslots[i].dfxtype = DRV_35_DD; else p->floppyslots[i].dfxtype = DRV_NONE; } fscanf(f,"chipmemory=%d\n",&p->chipmem_size); if(p->chipmem_size < 10) // Was saved in old format p->chipmem_size = 0x80000 << p->chipmem_size; fscanf(f,"slowmemory=%d\n",&p->bogomem_size); if(p->bogomem_size > 0 && p->bogomem_size < 10) // Was saved in old format p->bogomem_size = (p->bogomem_size <= 2) ? 0x080000 << p->bogomem_size : (p->bogomem_size == 3) ? 0x180000 : 0x1c0000; fscanf(f,"fastmemory=%d\n",&p->fastmem_size); if(p->fastmem_size > 0 && p->fastmem_size < 10) // Was saved in old format p->fastmem_size = 0x080000 << p->fastmem_size; #ifdef ANDROIDSDL fscanf(f,"onscreen=%d\n",&mainMenu_onScreen); fscanf(f,"onScreen_textinput=%d\n",&mainMenu_onScreen_textinput); fscanf(f,"onScreen_dpad=%d\n",&mainMenu_onScreen_dpad); fscanf(f,"onScreen_button1=%d\n",&mainMenu_onScreen_button1); fscanf(f,"onScreen_button2=%d\n",&mainMenu_onScreen_button2); fscanf(f,"onScreen_button3=%d\n",&mainMenu_onScreen_button3); fscanf(f,"onScreen_button4=%d\n",&mainMenu_onScreen_button4); fscanf(f,"onScreen_button5=%d\n",&mainMenu_onScreen_button5); fscanf(f,"onScreen_button6=%d\n",&mainMenu_onScreen_button6); fscanf(f,"custom_position=%d\n",&mainMenu_custom_position); fscanf(f,"pos_x_textinput=%d\n",&mainMenu_pos_x_textinput); fscanf(f,"pos_y_textinput=%d\n",&mainMenu_pos_y_textinput); fscanf(f,"pos_x_dpad=%d\n",&mainMenu_pos_x_dpad); fscanf(f,"pos_y_dpad=%d\n",&mainMenu_pos_y_dpad); fscanf(f,"pos_x_button1=%d\n",&mainMenu_pos_x_button1); fscanf(f,"pos_y_button1=%d\n",&mainMenu_pos_y_button1); fscanf(f,"pos_x_button2=%d\n",&mainMenu_pos_x_button2); fscanf(f,"pos_y_button2=%d\n",&mainMenu_pos_y_button2); fscanf(f,"pos_x_button3=%d\n",&mainMenu_pos_x_button3); fscanf(f,"pos_y_button3=%d\n",&mainMenu_pos_y_button3); fscanf(f,"pos_x_button4=%d\n",&mainMenu_pos_x_button4); fscanf(f,"pos_y_button4=%d\n",&mainMenu_pos_y_button4); fscanf(f,"pos_x_button5=%d\n",&mainMenu_pos_x_button5); fscanf(f,"pos_y_button5=%d\n",&mainMenu_pos_y_button5); fscanf(f,"pos_x_button6=%d\n",&mainMenu_pos_x_button6); fscanf(f,"pos_y_button6=%d\n",&mainMenu_pos_y_button6); fscanf(f,"quick_switch=%d\n",&mainMenu_quickSwitch); fscanf(f,"FloatingJoystick=%d\n",&mainMenu_FloatingJoystick); #endif fclose(f); } SetPresetMode(presetModeId, p); CheckKickstart(p); return 1; }
void real_main (int argc, char **argv) { #ifdef USE_SDL SDL_Init (SDL_INIT_VIDEO | SDL_INIT_JOYSTICK #if !defined(NO_SOUND) && !defined(GP2X) | SDL_INIT_AUDIO #endif ); #endif getcwd(launchDir,250); /* PocketUAE prefs */ default_prefs_uae (&currprefs); default_prefs(); #ifdef GP2X gp2x_init(argc, argv); #endif // Set everthing to default and clear HD settings SetDefaultMenuSettings(1); loadconfig (1); if (! graphics_setup ()) { exit (1); } rtarea_init (); hardfile_install(); if (! setup_sound ()) { write_log ("Sound driver unavailable: Sound output disabled\n"); produce_sound = 0; } init_joystick (); int err = gui_init (); if (err == -1) { write_log ("Failed to initialize the GUI\n"); } else if (err == -2) { exit (0); } if (sound_available && produce_sound > 1 && ! init_audio ()) { write_log ("Sound driver unavailable: Sound output disabled\n"); produce_sound = 0; } /* Install resident module to get 8MB chipmem, if requested */ rtarea_setup (); keybuf_init (); /* Must come after init_joystick */ #ifdef USE_AUTOCONFIG expansion_init (); #endif memory_init (); filesys_install (); native2amiga_install (); custom_init (); /* Must come after memory_init */ DISK_init (); m68k_init(0); gui_update (); #ifdef GP2X switch_to_hw_sdl(1); #endif { start_program (); } leave_program (); }
void real_main (int argc, char **argv) { int numb; char pattern[100]; char txt[100]; #ifdef USE_SDL SDL_Init (SDL_INIT_VIDEO | SDL_INIT_JOYSTICK #if !defined(NO_SOUND) && !defined(GP2X) | SDL_INIT_AUDIO #endif ); #endif // Initialize timebase g_uae_epoch = read_processor_time(); syncbase = 1000000; // Microseconds //------------------------------------------ //just safe the game conf file for later use //------------------------------------------ if (argc > 1) { if (strlen(argv[1]) < 255) { strcpy(uae4all_game_conf_file0, argv[1]); strcpy(uae4all_game_conf_file1, argv[1]); strcpy(uae4all_game_conf_file2, argv[1]); strcpy(uae4all_game_conf_file3, argv[1]); strcpy(uae4all_game_conf_file4, argv[1]); strcpy(uae4all_game_conf_file5, argv[1]); strcpy(uae4all_game_conf_file6, argv[1]); strcpy(uae4all_game_conf_file7, argv[1]); getNumber(uae4all_game_conf_file0, "disk 1 of %", &numb); strcpy(pattern, "disk %"); sprintf(txt, " of %d", numb); strcat(pattern, txt); replaceNumber(uae4all_game_conf_file1, pattern, '2'); strcpy(pattern, "disk %"); sprintf(txt, " of %d", numb); strcat(pattern, txt); replaceNumber(uae4all_game_conf_file2, pattern, '3'); strcpy(pattern, "disk %"); sprintf(txt, " of %d", numb); strcat(pattern, txt); replaceNumber(uae4all_game_conf_file3, pattern, '4'); strcpy(pattern, "disk %"); sprintf(txt, " of %d", numb); strcat(pattern, txt); replaceNumber(uae4all_game_conf_file4, pattern, '5'); strcpy(pattern, "disk %"); sprintf(txt, " of %d", numb); strcat(pattern, txt); replaceNumber(uae4all_game_conf_file5, pattern, '6'); strcpy(pattern, "disk %"); sprintf(txt, " of %d", numb); strcat(pattern, txt); replaceNumber(uae4all_game_conf_file6, pattern, '7'); strcpy(pattern, "disk %"); sprintf(txt, " of %d", numb); strcat(pattern, txt); replaceNumber(uae4all_game_conf_file7, pattern, '8'); } } getcwd(launchDir,250); /* PocketUAE prefs */ default_prefs_uae (&currprefs); default_prefs(); #ifdef GP2X gp2x_init(argc, argv); #endif // Set everthing to default and clear HD settings SetDefaultMenuSettings(1); loadconfig (1); if (! graphics_setup ()) { exit (1); } rtarea_init (); hardfile_install(); if (! setup_sound ()) { write_log ("Sound driver unavailable: Sound output disabled\n"); produce_sound = 0; } init_joystick (); int err = gui_init (); if (err == -1) { write_log ("Failed to initialize the GUI\n"); } else if (err == -2) { exit (0); } if (sound_available && produce_sound > 1 && ! init_audio ()) { write_log ("Sound driver unavailable: Sound output disabled\n"); produce_sound = 0; } /* Install resident module to get 8MB chipmem, if requested */ rtarea_setup (); keybuf_init (); /* Must come after init_joystick */ #ifdef USE_AUTOCONFIG expansion_init (); #endif memory_init (); filesys_install (); native2amiga_install (); custom_init (); /* Must come after memory_init */ DISK_init (); m68k_init(0); gui_update (); #ifdef GP2X switch_to_hw_sdl(1); #endif { start_program (); } leave_program (); }