extern "C" void JAVA_EXPORT_NAME(DemoActivity_setPrefs) ( JNIEnv* env, jobject thiz, jstring rom, jstring romkey, jstring hddir, jstring hdfile, jstring floppy1, jstring floppy2, jstring floppy3, jstring floppy4, jint frameskip, jint floppyspeed, jint cpu_model, jint chip_mem, jint slow_mem, jint fast_mem, jint chipset, jint cpu_speed, jint change_sound, jint sound, jint change_disk, jint reset, jint drive_status, jint ntsc ) { if (rom) { const char *srom = (env)->GetStringUTFChars(rom, 0); strcpy(romfile, srom); (env)->ReleaseStringUTFChars(rom, srom); } if (romkey) { const char *sromkey = (env)->GetStringUTFChars(romkey, 0); strcpy(romkeyfile, sromkey); (env)->ReleaseStringUTFChars(romkey, sromkey); } if (change_disk) { savestate_state = 0; } default_prefs_uae (&currprefs); default_prefs(); mainMenu_floppyspeed = floppyspeed; mainMenu_CPU_model = cpu_model; // m68020 mainMenu_chipMemory = chip_mem; // 2MB mainMenu_slowMemory = slow_mem; mainMenu_fastMemory = fast_mem; mainMenu_chipset = chipset; // aga mainMenu_CPU_speed = cpu_speed; // 500/5T/a1200/12T/12T2 __android_log_print(ANDROID_LOG_INFO, "UAE", "floppyspeed= %d, cpu_model= %d, chip_mem= %d, slow_mem= %d, fast_mem= %d, chipset= %d, cpu_speed= %d", floppyspeed, cpu_model, chip_mem, slow_mem, fast_mem, chipset, cpu_speed); UpdateCPUModelSettings(&changed_prefs); UpdateMemorySettings(&changed_prefs); UpdateChipsetSettings(&changed_prefs); if (change_disk && uae4all_hard_dir[0] != '\0' && currprefs.mountinfo) { __android_log_print(ANDROID_LOG_INFO, "UAE", "kill_filesys_unit hd dir: %s", uae4all_hard_dir); kill_filesys_unit(currprefs.mountinfo, 0); mainMenu_filesysUnits--; hd_dir_unit_nr = -1; uae4all_hard_dir[0] = '\0'; } if (hddir && currprefs.mountinfo) { const char *hddir1 = (env)->GetStringUTFChars(hddir, 0); strcpy(uae4all_hard_dir, hddir1); (env)->ReleaseStringUTFChars(hddir, hddir1); __android_log_print(ANDROID_LOG_INFO, "UAE", "add_filesys_unit hd dir: %s", uae4all_hard_dir); char *s2 = add_filesys_unit (currprefs.mountinfo, "HD0", uae4all_hard_dir, 1, 0, 0, 0, 0); if (s2) __android_log_print(ANDROID_LOG_ERROR, "UAE", "%s\n", s2); hd_dir_unit_nr = mainMenu_filesysUnits++; } if (change_disk && uae4all_hard_file[0] != '\0' && currprefs.mountinfo) { __android_log_print(ANDROID_LOG_INFO, "UAE", "kill_filesys_unit hd file: %s", uae4all_hard_file); kill_filesys_unit(currprefs.mountinfo, 0); mainMenu_filesysUnits--; hd_file_unit_nr = -1; uae4all_hard_file[0] = '\0'; } if (hdfile && currprefs.mountinfo) { const char *hdfile1 = (env)->GetStringUTFChars(hdfile, 0); strcpy(uae4all_hard_file, hdfile1); (env)->ReleaseStringUTFChars(hdfile, hdfile1); __android_log_print(ANDROID_LOG_INFO, "UAE", "add_filesys_unit hd file: %s", uae4all_hard_file); char *s2 = add_filesys_unit (currprefs.mountinfo, 0, uae4all_hard_file, 0, 32, 1, 2, 512); if (s2) __android_log_print(ANDROID_LOG_ERROR, "UAE", "%s\n", s2); hd_file_unit_nr = mainMenu_filesysUnits++; } if (floppy1) { const char *sfloppy1 = (env)->GetStringUTFChars(floppy1, 0); if (change_disk) { strcpy(changed_df[0], sfloppy1); real_changed_df[0]=1; __android_log_print(ANDROID_LOG_INFO, "UAE", "change floppy1: %s", changed_df[0]); } else strcpy(prefs_df[0], sfloppy1); (env)->ReleaseStringUTFChars(floppy1, sfloppy1); } else strcpy (prefs_df[0], "/sdcard/df0.adf"); if (floppy2) { const char *sfloppy2 = (env)->GetStringUTFChars(floppy2, 0); if (change_disk) { strcpy(changed_df[1], sfloppy2); real_changed_df[1]=1; } else strcpy(prefs_df[1], sfloppy2); (env)->ReleaseStringUTFChars(floppy2, sfloppy2); //__android_log_print(ANDROID_LOG_INFO, "UAE", "prefs_df[1]: %s", prefs_df[1]); } else strcpy (prefs_df[1], "/sdcard/df1.adf"); if (floppy3) { const char *sfloppy3 = (env)->GetStringUTFChars(floppy3, 0); if (change_disk) { strcpy(changed_df[2], sfloppy3); real_changed_df[2]=1; } else strcpy(prefs_df[2], sfloppy3); (env)->ReleaseStringUTFChars(floppy3, sfloppy3); //__android_log_print(ANDROID_LOG_INFO, "UAE", "prefs_df[1]: %s", prefs_df[1]); } else strcpy (prefs_df[2], "/sdcard/df2.adf"); if (floppy4) { const char *sfloppy4 = (env)->GetStringUTFChars(floppy4, 0); if (change_disk) { strcpy(changed_df[3], sfloppy4); real_changed_df[3]=1; } else strcpy(prefs_df[3], sfloppy4); (env)->ReleaseStringUTFChars(floppy4, sfloppy4); //__android_log_print(ANDROID_LOG_INFO, "UAE", "prefs_df[1]: %s", prefs_df[1]); } else strcpy (prefs_df[3], "/sdcard/df3.adf"); mainMenu_showStatus = drive_status; mainMenu_ntsc = ntsc; if (change_sound) changed_produce_sound = sound; else { produce_sound = sound; changed_produce_sound = sound; } if (frameskip >= 100) prefs_gfx_framerate = -1; else prefs_gfx_framerate = frameskip; changed_gfx_framerate = prefs_gfx_framerate; __android_log_print(ANDROID_LOG_INFO, "UAE", "prefs_gfx_framerate: %d", prefs_gfx_framerate); m68k_speed = 0; check_prefs_changed_cpu(); check_prefs_changed_audio(); //DISK_init(); //__android_log_print(ANDROID_LOG_INFO, "UAE", "prefs_df[0]: %s", prefs_df[0]); //__android_log_print(ANDROID_LOG_INFO, "UAE", "prefs_df[1]: %s", prefs_df[1]); //__android_log_print(ANDROID_LOG_INFO, "UAE", "m68k_speed: %d / timeslice_mode: %d", m68k_speed, timeslice_mode); if (reset) { uae_reset(); } }
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 (); }