Exemplo n.º 1
0
int main(int argc, char *argv[]) {
    program_name = argv[0] ? argv[0] : "nesalizer";
#ifndef RUN_TESTS
    if (argc != 2) {
        fprintf(stderr, "usage: %s <rom file>\n", program_name);
        exit(EXIT_FAILURE);
    }
#else
    (void)argc; // Suppress warning
#endif

    install_fatal_signal_handlers();

    // One-time initialization of various components
    init_apu();
    init_input();
    init_mappers();

#ifndef RUN_TESTS
    load_rom(argv[1], true);
#endif

    // Create a separate emulation thread and use this thread as the rendering
    // thread

    init_sdl();
    SDL_Thread *emu_thread;
    fail_if(!(emu_thread = SDL_CreateThread(emulation_thread, "emulation", 0)),
            "failed to create emulation thread: %s", SDL_GetError());
    sdl_thread();
    SDL_WaitThread(emu_thread, 0);
    deinit_sdl();

#ifndef RUN_TESTS
    unload_rom();
#endif

    puts("Shut down cleanly");
}
Exemplo n.º 2
0
int main(void)
{
    struct test_Parameters test_para;
    int i;
    int test_order_array_size = 0;
    formatting_card();

    if (init_res(&test_para) < 0)
	exit(0);

    if (init_result_flag(&test_para) < 0)
	exit(0);

    if (init_sdl(&test_para) < 0)
	exit(0);
#ifdef H350
    init_key_pad();
#endif
    test_para.test_offset = -1;
    test_para.select_mode = False;
    while(1)
    {
	result_show(&test_para);
	if( select_test_key_loop(&test_para) == False )
	    break;
    }

    test_order_array_size = sizeof(test_order_array) / sizeof(test_orders_);
    debug_print("test order array size is %d\n",test_order_array_size);
#ifdef H350
    /*flush_screen(1);*/
#endif
    if(test_para.total_num > 0 && test_para.total_num <= test_order_array_size)
    {
	if(test_para.select_mode == True)
	{
	    debug_print("test_offset is %d\n",test_para.test_offset);
	    test_loop(&test_para,test_para.test_offset,test_order_array_size);
	}
	else
	{
	    for(i = 0; i < test_para.total_num; i++)
		test_loop(&test_para,i,test_order_array_size);
	}
    }
    else
    {
	debug_print("Get test order num error!\n");
    }

    /*result_show(&test_para);*/
    /*press_A_go_on();*/
#ifdef H350
    /*flush_screen(0);*/
    deinit_key_pad();
#endif
    deinit_res(&test_para);
    deinit_result_conf();
    deinit_sdl();
    return 0;
}