Ejemplo n.º 1
0
void Java_org_puder_trs80_XTRS_loadState(JNIEnv* env, jclass cls, jstring fileName) {
    const char* fn = (*env)->GetStringUTFChars(env, fileName, NULL);
    trs_state_load(fn);
    (*env)->ReleaseStringUTFChars(env, fileName, fn);
}
Ejemplo n.º 2
0
int SDLmain(int argc, char *argv[])
{
    int debug = FALSE;
    struct stat st;

    /* program_name must be set first because the error
     * printing routines use it. */
    program_name = strrchr(argv[0], '/');
    if (program_name == NULL) {
      program_name = argv[0];
    } else {
      program_name++;
    }

    check_endian();

#ifndef MACOSX
    putenv("SDL_VIDEO_CENTERED=1");
#endif	
    
    if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_AUDIO | SDL_INIT_TIMER) != 0) { 
        fprintf(stderr, "Failed to initialize SDL library");
  	    exit(1);
    }
        
    /* Enable Unicode key translations */
    SDL_EnableUNICODE(TRUE); 

    argc = trs_parse_command_line(argc, argv, &debug);
    if (argc > 1) {
      fprintf(stderr, "%s: erroneous argument %s\n", program_name, argv[1]);
      exit(1);
    }
    
    trs_set_keypad_joystick();    
    trs_open_joystick();
    
    if (stat(trs_disk_dir, &st) < 0) {
      strcpy(trs_disk_dir,".");
    }                   
    if (stat(trs_hard_dir, &st) < 0) {
      strcpy(trs_hard_dir,".");
    }                   
    if (stat(trs_cass_dir, &st) < 0) {
      strcpy(trs_cass_dir,".");
    }                   
    if (stat(trs_state_dir, &st) < 0) {
      strcpy(trs_state_dir,".");
    }                   
    if (stat(trs_disk_set_dir, &st) < 0) {
      strcpy(trs_disk_set_dir,".");
    }                   
    if (stat(trs_printer_dir, &st) < 0) {
      strcpy(trs_printer_dir,".");
    }                   
 
    mem_init();
    trs_disk_init(0);
    trs_rom_init();
    trs_screen_init();
    screen_init();
    trs_timer_init();

    trs_reset(1);
    if (init_state_file[0] != 0) {
      trs_state_load(init_state_file);
      trs_screen_init();
      trs_screen_refresh();
      }
#ifdef MACOSX
	TrsOriginSet();
#endif
	
    if (!debug || fullscreen) {
      /* Run continuously until exit or request to enter debugger */
      z80_run(TRUE);
    }
    printf("Entering debugger.\n");
    debug_init();
    debug_shell();
    printf("Quitting.\n");
#ifdef MACOSX
    trs_mac_save_defaults();
#endif
    exit(0);
}