Exemplo n.º 1
0
void retro_run(void)
{
   bool updated = false;
   if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated)
      update_variables();

   if (location_enable && location_cb.get_position)
   {
      double lat, lon, hacc, vacc;
      if (location_cb.get_position(&lat, &lon, &hacc, &vacc))
      {
         previous_location = current_location;

         current_location.latitude = lat;
         current_location.longitude = lon;
         current_location.horizontal_accuracy = hacc;
         current_location.vertical_accuracy = vacc;

         if (display_position)
         {
            struct retro_message msg; 
            char msg_local[512];
            snprintf(msg_local, sizeof(msg_local), "LAT %f LON %f HACC %f VACC %f", current_location.latitude, current_location.longitude,
                  current_location.horizontal_accuracy, current_location.vertical_accuracy);
            msg.msg = msg_local;
            msg.frames = 180;
            environ_cb(RETRO_ENVIRONMENT_SET_MESSAGE, (void*)&msg);
         }
      }
   }

   if (engine_program_cb && engine_program_cb->run)
      engine_program_cb->run();
}
Exemplo n.º 2
0
void retro_run(void)
{
   static int mfirst=1;
   bool updated = false;

   if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated)
      update_variables();

   if(mfirst==1)
   {
      mfirst++;
      printf("MAIN FIRST\n");
      retro_load_ok=true;

      Emu_init();
      return;
   }

   if(pauseg==0)
   {
      retro_loop();
		ScreenUpdate();
		//update_input();
retro_poll_event(0);
      retro_blit();
      if(SHOWKEY==1)app_render(0);
   }
   else if (pauseg==1)app_render(1);
   //app_render(pauseg);

   video_cb(Retro_Screen,retrow,retroh,retrow<<PIXEL_BYTES);

   if(want_quit)retro_shutdown_core();
}
Exemplo n.º 3
0
bool retro_load_game(const struct retro_game_info *game)
{
   update_variables();

   struct retro_input_descriptor desc[] = {
      { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT,  "D-Pad Left" },
      { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP,    "D-Pad Up" },
      { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_DOWN,  "D-Pad Down" },
      { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT, "D-Pad Right" },
      { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B,     "B" },
      { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_A,     "A" },
      { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L,     "L" },
      { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R,     "R" },
      { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_SELECT, "Select" },
      { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_START, "Start" },

      { 0 },
   };

   environ_cb(RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS, desc);

   bool ret = CPULoadRomData((const char*)game->data, game->size);

   gba_init();

   return ret;
}
Exemplo n.º 4
0
void retro_run( void )
{
  bool updated = false;

  if ( env_cb( RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated ) && updated )
  {
    int res = update_variables();
    
    if ( res & UPDATE_RESET )
    {
      retro_reset();
    }
    
    if ( res & UPDATE_AV )
    {
      struct retro_system_av_info info;
      retro_get_system_av_info( &info );
      env_cb( RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO, &info );
    }
  }
  
  input_poll_cb();
  
  uint16_t* fb = TVFB + WinL + WinT * TVP / 2;

  eo_tick();
  keybovl_update( input_state_cb, state.devices, fb, TVP / 2, state.transp, state.scaled, state.ms, 20 );
  video_cb( (void*)fb, WinR - WinL, WinB - WinT, TVP );
}
Exemplo n.º 5
0
void retro_run (void)
{
   int i, j;
   int *jsState;
   const struct KeyboardInfo *thisInput;
	bool updated = false;

   poll_cb();

	if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated)
		update_variables();

   // Keyboard
   thisInput = retroKeys;
   while(thisInput->name)
   {
      retroKeyState[thisInput->code] = input_cb(0, RETRO_DEVICE_KEYBOARD, 0, thisInput->code);
      thisInput ++;
   }

   // Joystick
   jsState = retroJsState;
   for (i = 0; i < 4; i ++)
   {
      for (j = 0; j < 16; j ++)
         *jsState++ = input_cb(i, RETRO_DEVICE_JOYPAD, 0, j);
   }

   mame_frame();

   audio_batch_cb(XsoundBuffer, Machine->sample_rate / Machine->drv->frames_per_second);
}
Exemplo n.º 6
0
void retro_run(void)
{
   int x;

   bool updated = false;

   if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated)
      update_variables();

   if(pauseg==0){

      update_input();

      if(SND==1){
         signed short int *p=(signed short int *)SNDBUF;
         for(x=0;x<snd_sampler;x++)audio_cb(*p++,*p++);			
      }	
   }   

   if(ConfigureParams.Screen.bAllowOverscan || SHOWKEY==1 || STATUTON==1 || pauseg==1 )video_cb(bmp,retrow,retroh, retrow<< 1);
   // EMU ST FULLSCREEN NO BORDER
   else video_cb(bmp,640/*retrow*/,400/*retrow-80*/,retrow << 1);

   co_switch(emuThread);

}
Exemplo n.º 7
0
void retro_run(void)
{
   int x;
   unsigned width = 640;
   unsigned height = 400;

   bool updated = false;

   if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated)
      update_variables();

   if(pauseg==0)
   {
      update_input();

      if(SND==1)
      {
         int16_t *p=(int16_t*)SNDBUF;

         for(x = 0; x < snd_sampler; x++)
            audio_cb(*p++,*p++);
      }
   }

   if(ConfigureParams.Screen.bAllowOverscan || SHOWKEY==1 || STATUTON==1 || pauseg==1 )
   {
      width  = retrow;
      height = retroh;
   }
   video_cb(bmp, width, height, retrow<< 1);

   co_switch(emuThread);
}
Exemplo n.º 8
0
void Emu_init(void)
{
#ifdef RETRO_AND
   MOUSE_EMULATED=1;
#endif 
   update_variables();
   pre_main(RPATH);
}
Exemplo n.º 9
0
void LinearSolver::solve()
{

	//factorize();
	vector<double> at_b_vec;
	vector<double> m_x_(m_solve_matrix_AT_.GetRowNum());
	m_solve_matrix_AT_.MultiplyVector(m_solve_b_vec, at_b_vec);

	//
	std::auto_ptr<hj::sparse::solver> m_solver_;

	// H = JT * J
	SystemStopwatch watch_;
	{
		hj::sparse::spm_csc<double> spm_ATA;

		hj::sparse::spm_csc<double> spm_A;
		CMatrixConverter::CSparseMatrix2hjCscMatrix(spm_A, m_solve_matrix_AT_);

		spm_dmm(false, spm_A, true, spm_A, spm_ATA);

		m_solve_matrix_AT_.ClearData();
		m_solver_.reset(hj::sparse::solver::create(spm_ATA, "cholmod"));
	}
	//
	if (m_is_printf_info){
		watch_.print_elapsed_time();
	}

	//
	m_equation_vec.clear();
	if(!m_solver_.get()) {
		printf("factorize failed.\n");
	}
	m_solve_b_vec.clear();
	m_right_b_vec.clear();
	bool su = m_solver_->solve(&at_b_vec[0], &m_x_[0]);
	
	if (!su)
	{
		printf("solve x failed.!!!\n");
	}

	//
	for(int i=0; i<nb_free_variables_; i++) {
		m_xc_[i] = m_x_[i] ;
	}

	//	
	update_variables();

	if (m_is_printf_info){
		printf("after solving: \n");
		//print_f(m_x_);
	}
}
Exemplo n.º 10
0
bool retro_load_game(const struct retro_game_info *game)
{
    update_variables();

    bool ret = CPULoadRom(game->path);

    gba_init();

    return ret;
}
Exemplo n.º 11
0
bool retro_load_game( const struct retro_game_info* info )
{
  log_cb( RETRO_LOG_ERROR, "\n%s", eo_gitstamp );
  
  enum retro_pixel_format fmt = RETRO_PIXEL_FORMAT_RGB565;
  
  if ( !env_cb( RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt ) )
  {
    log_cb( RETRO_LOG_ERROR, "EightyOne needs RGB565\n" );
    return false;
  }
  
  memset( (void*)&state, 0, sizeof( state ) );
  state.size = info->size;
  state.data = malloc( info->size );
  
  if ( !state.data )
  {
    log_cb( RETRO_LOG_ERROR, "Error allocating memory for game data\n" );
    return false;
  }
  
  memcpy( state.data, info->data, state.size );
  
  state.cfg.machine = MACHINEZX81;
  state.cfg.LambdaColour = COLOURDISABLED;
  state.cfg.LowRAMContents = LOWRAM_ROMSHADOW;
  state.cfg.ProtectROM = 1;
  state.cfg.ZXPrinter = 0;
  state.cfg.NTSC = 0;
  state.cfg.M1Not = 0;
  state.cfg.TS2050 = 0;
  state.cfg.ChrGen = CHRGENSINCLAIR;
  state.cfg.RamPack = RAMPACK16;
  state.cfg.HiRes = HIRESDISABLED;
  state.cfg.SoundCard = AY_TYPE_DISABLED;
  state.cfg.Chroma81 = 0;
  
  state.scaled = -1;
  TZXFile.AddTextBlock( "" ); // prevent a crash if the user does a LOAD ""
  TZXFile.FlashLoad = true;
  
  SHA1Context sha1;
  SHA1Reset( &sha1 );
  SHA1Input( &sha1, (const unsigned char*)info->data, info->size );
  SHA1Result( &sha1 );
  memcpy( state.sha1, sha1.Message_Digest, sizeof(state.sha1) );
  
  update_variables();
  retro_reset();
  keybovl_set( &zx81ovl );
  return true;
}
Exemplo n.º 12
0
void retro_run(void)
{
   bool updated = false;
   if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated)
      update_variables(false);
   if (quit_pressed)
   {
      environ_cb(RETRO_ENVIRONMENT_SHUTDOWN, NULL);
      I_SafeExit(1);
   }

   D_DoomLoop();
   I_UpdateSound();
}
Exemplo n.º 13
0
/* 
 * called when a frame in the stack tree has been selected 
 */
static void on_select_frame(int frame_number)
{
	frame *f = (frame*)g_list_nth(stack, active_module->get_active_frame())->data;
	markers_remove_current_instruction(f->file, f->line);
	markers_add_frame(f->file, f->line);

	active_module->set_active_frame(frame_number);
	
	/* clear calltips cache */
	g_hash_table_remove_all(calltips);
	
	/* autos */
	GList *autos = active_module->get_autos();
	update_variables(GTK_TREE_VIEW(atree), NULL, autos);
	
	/* watches */
	GList *watches = active_module->get_watches();
	update_variables(GTK_TREE_VIEW(wtree), NULL, watches);

	f = (frame*)g_list_nth(stack, frame_number)->data;
	markers_remove_frame(f->file, f->line);
	markers_add_current_instruction(f->file, f->line);
}
Exemplo n.º 14
0
void retro_init(void)
{
   struct retro_log_callback log;
   int level;

   level = 0;
   environ_cb(RETRO_ENVIRONMENT_SET_PERFORMANCE_LEVEL, &level);

   if (environ_cb(RETRO_ENVIRONMENT_GET_LOG_INTERFACE, &log))
      log_cb = log.log;
   else
      log_cb = NULL;

   environ_cb(RETRO_ENVIRONMENT_SET_DISK_CONTROL_INTERFACE, &disk_control);

#ifdef _3DS
   ctr_svchack_successful = ctr_svchack_init();
#endif

   PicoOpt = POPT_EN_STEREO|POPT_EN_FM|POPT_EN_PSG|POPT_EN_Z80
      | POPT_EN_MCD_PCM|POPT_EN_MCD_CDDA|POPT_EN_MCD_GFX
      | POPT_EN_32X|POPT_EN_PWM
      | POPT_ACC_SPRITES|POPT_DIS_32C_BORDER;
#ifdef __arm__
#ifdef _3DS
   if (ctr_svchack_successful)
#endif
      PicoOpt |= POPT_EN_DRC;
#endif
   PsndRate = 44100;
   PicoAutoRgnOrder = 0x184; // US, EU, JP

   vout_width = 320;
   vout_height = 240;
#ifdef _3DS
   vout_buf = linearMemAlign(VOUT_MAX_WIDTH * VOUT_MAX_HEIGHT * 2, 0x80);
#else
   vout_buf = malloc(VOUT_MAX_WIDTH * VOUT_MAX_HEIGHT * 2);
#endif

   PicoInit();
   PicoDrawSetOutFormat(PDF_RGB555, 0);
   PicoDrawSetOutBuf(vout_buf, vout_width * 2);

   //PicoMessage = plat_status_msg_busy_next;
   PicoMCDopenTray = disk_tray_open;
   PicoMCDcloseTray = disk_tray_close;

   update_variables();
}
Exemplo n.º 15
0
void retro_init (void)
{
   struct retro_log_callback log;
   if (environ_cb(RETRO_ENVIRONMENT_GET_LOG_INTERFACE, &log))
      log_cb = log.log;
   else
      log_cb = NULL;

#ifdef LOG_PERFORMANCE
   environ_cb(RETRO_ENVIRONMENT_GET_PERF_INTERFACE, &perf_cb);
#endif

   update_variables();
   check_system_specs();
}
Exemplo n.º 16
0
void retro_run(void)
{
   bool updated = false;
   if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated)
      update_variables();

   poll_cb();

   
   has_frame = 0;

   do{
      CPULoop(TICKS);
   }while(!has_frame);
}
Exemplo n.º 17
0
bool retro_load_game(const struct retro_game_info *info)
{
   /*
      struct retro_keyboard_callback cb = { keyboard_cb };
      environ_cb(RETRO_ENVIRONMENT_SET_KEYBOARD_CALLBACK, &cb);
      */
   const char *full_path = info->path;

   strcpy(RPATH,full_path);

   update_variables();

   app_init();

   memset(SNDBUF,0,1024*2*2);

   return true;
}
Exemplo n.º 18
0
bool retro_load_game(const struct retro_game_info *game)
{
   update_variables();

   struct retro_input_descriptor input_desc[] = {
      { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT,  "D-Pad Left" },
      { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP,    "D-Pad Up" },
      { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_DOWN,  "D-Pad Down" },
      { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT, "D-Pad Right" },
      { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B,     "B" },
      { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_A,     "A" },
      { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L,     "L" },
      { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R,     "R" },
      { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_SELECT, "Select" },
      { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_START, "Start" },

      { 0 },
   };

   environ_cb(RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS, input_desc);

   bool ret = CPULoadRomData((const char*)game->data, game->size);

   gba_init();

   struct retro_memory_descriptor desc[10];
   memset(desc, 0, sizeof(desc));
   desc[0].start=0x03000000; desc[0].select=0xFF000000; desc[0].len=0x8000;    desc[0].ptr=internalRAM;//fast WRAM
   desc[1].start=0x02000000; desc[1].select=0xFF000000; desc[1].len=0x40000;   desc[1].ptr=workRAM;//slow WRAM
   desc[2].start=0x0E000000; desc[2].select=0xFF000000; desc[2].len=libretro_save_size; desc[2].ptr=flashSaveMemory;//SRAM
   desc[3].start=0x08000000; desc[3].select=0xFC000000; desc[3].len=0x2000000; desc[3].ptr=rom;//ROM, parts 1 and 2
      desc[3].flags=RETRO_MEMDESC_CONST;//we need two mappings since its size is not a power of 2
   desc[4].start=0x0C000000; desc[4].select=0xFE000000; desc[4].len=0x2000000; desc[4].ptr=rom;//ROM part 3
      desc[4].flags=RETRO_MEMDESC_CONST;
   desc[5].start=0x00000000; desc[5].select=0xFF000000; desc[5].len=0x4000;    desc[5].ptr=bios;//BIOS
      desc[5].flags=RETRO_MEMDESC_CONST;
   desc[6].start=0x06000000; desc[6].select=0xFF000000; desc[6].len=0x18000;   desc[6].ptr=vram;//VRAM
   desc[7].start=0x05000000; desc[7].select=0xFF000000; desc[7].len=0x400;     desc[7].ptr=paletteRAM;//palettes
   desc[8].start=0x07000000; desc[8].select=0xFF000000; desc[8].len=0x400;     desc[8].ptr=oam;//OAM
   desc[9].start=0x04000000; desc[9].select=0xFF000000; desc[9].len=0x400;     desc[9].ptr=ioMem;//bunch of registers
   struct retro_memory_map retromap={ desc, sizeof(desc)/sizeof(*desc) };
   if (ret) environ_cb(RETRO_ENVIRONMENT_SET_MEMORY_MAPS, &retromap);
   return ret;
}
Exemplo n.º 19
0
void variables_update()
{
	if(current_function != variables_shown_function || current_function == NULL)
	{
		//if function has changed:
		variables_clear();
	    IExec->NewList (&variable_list);
	    globals_list_populated = 0;
	    locals_list_populated = 0;
	    params_list_populated = 0;
	    variables_init_parents();
		//locals_populate_list(locals_node);
		registers_populate_list();
	}
	else
	{
		update_variables();
	}
	variables_shown_function = current_function;
}
Exemplo n.º 20
0
void retro_run(void)
{
   bool updated = false;
   int pad, i;

   if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated)
      update_variables();

   input_poll_cb();

   PicoPad[0] = PicoPad[1] = 0;
   for (pad = 0; pad < 2; pad++)
      for (i = 0; i < RETRO_PICO_MAP_LEN; i++)
         if (input_state_cb(pad, RETRO_DEVICE_JOYPAD, 0, i))
            PicoPad[pad] |= retro_pico_map[i];

   PicoFrame();

   video_cb((short *)vout_buf + vout_offset,
      vout_width, vout_height, vout_width * 2);
}
Exemplo n.º 21
0
void Emu_init()
{
#ifdef RETRO_AND
   //you can change this after in core option if device support to setup a 832x576 res 
   retrow=640; 
   retroh=480;
   MOUSEMODE=1;
#endif

   update_variables();

   memset(Key_Sate,0,512);
   memset(Key_Sate2,0,512);

   if(!emuThread && !mainThread)
   {
      mainThread = co_active();
      emuThread = co_create(65536*sizeof(void*), retro_wrap_emulator);
   }

}
Exemplo n.º 22
0
void retro_run(void)
{
   bool updated = false;
   if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated)
      update_variables();

   poll_cb();

   u32 J = 0;

   for (unsigned i = 0; i < 10; i++)
   {
      unsigned button = device_type ? binds2[i] : binds[i];

      if (button == RETRO_DEVICE_ID_JOYPAD_LEFT)
      {
         if ((J & (1 << RETRO_DEVICE_ID_JOYPAD_RIGHT)) == RETRO_DEVICE_ID_JOYPAD_RIGHT)
            continue;
      }
      else if (button == RETRO_DEVICE_ID_JOYPAD_RIGHT)
      {
         if ((J & (1 << RETRO_DEVICE_ID_JOYPAD_LEFT)) == RETRO_DEVICE_ID_JOYPAD_LEFT)
            continue;
      }
      J |= input_cb(0, RETRO_DEVICE_JOYPAD, 0, button) << i;
   }

   joy = J;

   has_frame = 0;
   UpdateJoypad();
   do
   {
      CPULoop();
   }while (!has_frame);
}
Exemplo n.º 23
0
gboolean
gnc_exp_parser_parse_separate_vars (const char * expression,
                                    gnc_numeric *value_p,
                                    char **error_loc_p,
                                    GHashTable *varHash )
{
    parser_env_ptr pe;
    var_store_ptr vars;
    struct lconv *lc;
    var_store result;
    char * error_loc;
    ParserNum *pnum;

    if (expression == NULL)
        return FALSE;

    if (!parser_inited)
        gnc_exp_parser_real_init ( (varHash == NULL) );

    result.variable_name = NULL;
    result.value = NULL;
    result.next_var = NULL;

    vars = make_predefined_variables ();

    if ( varHash != NULL )
    {
        g_hash_table_foreach( varHash, make_predefined_vars_from_external_helper, &vars);
    }

    lc = gnc_localeconv ();

    pe = init_parser (vars, lc->mon_decimal_point, lc->mon_thousands_sep,
                      trans_numeric, numeric_ops, negate_numeric, g_free,
                      func_op);

    error_loc = parse_string (&result, expression, pe);

    pnum = result.value;

    if (error_loc == NULL)
    {
        if (gnc_numeric_check (pnum->value))
        {
            if (error_loc_p != NULL)
                *error_loc_p = (char *) expression;

            last_error = NUMERIC_ERROR;
        }
        else
        {
            if (pnum)
            {
                if (value_p)
                    *value_p = gnc_numeric_reduce (pnum->value);

                if (!result.variable_name)
                    g_free (pnum);
            }

            if (error_loc_p != NULL)
                *error_loc_p = NULL;

            last_error = PARSER_NO_ERROR;
        }
    }
    else
    {
        if (error_loc_p != NULL)
            *error_loc_p = error_loc;

        last_error = get_parse_error (pe);
    }

    if ( varHash != NULL )
    {
        var_store_ptr newVars;
        gpointer maybeKey, maybeValue;
        gnc_numeric *numericValue;

        newVars = parser_get_vars( pe );
        for ( ; newVars ; newVars = newVars->next_var )
        {
            pnum = newVars->value;
            if ( g_hash_table_lookup_extended( varHash, newVars->variable_name,
                                               &maybeKey, &maybeValue ) )
            {
                g_hash_table_remove( varHash, maybeKey );
                g_free( maybeKey );
                g_free( maybeValue );
            }
            numericValue = g_new0( gnc_numeric, 1 );
            *numericValue = ((ParserNum*)newVars->value)->value;
            // WTF?
            // numericValue = NULL;
            g_hash_table_insert( varHash,
                                 g_strdup(newVars->variable_name),
                                 numericValue );
        }
    }
    else
    {
        update_variables (vars);
    }

    free_predefined_variables (vars);

    exit_parser (pe);

    return last_error == PARSER_NO_ERROR;
}
Exemplo n.º 24
0
/* 
 * called from debug module when debugger is being stopped 
 */
static void on_debugger_stopped (int thread_id)
{
	/* update debug state */
	debug_state = DBS_STOPPED;

	/* update buttons panel state */
	if (!interrupt_data)
	{
		btnpanel_set_debug_state(debug_state);
	}

	/* clear calltips cache */
	g_hash_table_remove_all(calltips);

	/* if a stop was requested for asyncronous exiting -
	 * stop debug module and exit */
	if (exit_pending)
	{
		active_module->stop();
		exit_pending = FALSE;
		return;
	}

	/* check for async activities pending */
	if (interrupt_data)
	{
		interrupt_cb(interrupt_data);
		interrupt_data = NULL;
		
		active_module->resume();
		
		return;
	}

	/* clear stack tree view */
	stree_set_active_thread_id(thread_id);

	/* get current stack trace and put in the tree view */
	stack = active_module->get_stack();
	
	GList *iter = stack;
	while (iter)
	{
		frame *f = (frame*)iter->data;
		stree_add(f);
		iter = g_list_next(iter);
	}
	stree_select_first_frame(TRUE);

	/* files */
	GList *files = active_module->get_files();
	/* remove from list and make writable those files,
	that are not in the current list */
	iter = read_only_pages;
	while (iter)
	{
		if (!g_list_find_custom(files, iter->data, (GCompareFunc)g_strcmp0))
		{
			/* set document writable */
			GeanyDocument *doc = document_find_by_real_path((const gchar*)iter->data);
			if (doc)
				scintilla_send_message(doc->editor->sci, SCI_SETREADONLY, 0, 0);

			/* free file name */
			g_free(iter->data);
			/* save next item pointer */
			GList *next = iter->next;
			/* remove current item */
			read_only_pages = g_list_delete_link(read_only_pages, iter);

			/* set next item and continue */
			iter = next;
			continue;
		}

		iter = iter->next;
	}
	/* add to the list and make readonly those files
	from the current list that are new */
	iter = files;
	while (iter)
	{
		if (!g_list_find_custom(read_only_pages, iter->data, (GCompareFunc)g_strcmp0))
		{
			/* set document readonly */
			GeanyDocument *doc = document_find_by_real_path((const gchar*)iter->data);
			if (doc)
				scintilla_send_message(doc->editor->sci, SCI_SETREADONLY, 1, 0);

			/* add new file to the list */
			read_only_pages = g_list_append(read_only_pages, g_strdup((gchar*)iter->data));
		}
		iter = iter->next;
	}
	g_list_free(files);

	/* autos */
	GList *autos = active_module->get_autos();
	update_variables(GTK_TREE_VIEW(atree), NULL, autos);
	
	/* watches */
	GList *watches = active_module->get_watches();
	update_variables(GTK_TREE_VIEW(wtree), NULL, watches);

	if (stack)
	{
		frame *current = (frame*)stack->data;

		if (current->have_source)
		{
			/* open current instruction position */
			editor_open_position(current->file, current->line);
		}

		/* add current instruction marker */
		add_stack_markers();
	}

	/* enable widgets */
	enable_sensitive_widgets(TRUE);

	/* remove breaks readonly if current module doesn't support run-time breaks operation */
	if (!(active_module->features & MF_ASYNC_BREAKS))
		bptree_set_readonly(FALSE);
}
Exemplo n.º 25
0
/*
 * Implementation of the Hierarchical Linear SubSpace Indexing Model
 * for content-based retrieval.
 *
 */
int main( int argc, char **argv )
{
    /* get data from user's input */
    assign_user_input(argv);

    /* open SQL connection */
	SQLHENV henv = SQL_NULL_HANDLE;
	henv = sql_allocate_env(henv);

	/* initialize SQl connection variable */
	SQLHDBC hdbc = SQL_NULL_HANDLE;
	hdbc = sql_connect_database(hdbc, henv, "SQL Server Native Client 12.0", "CATARINAMORB1C0", "master");

	/* track running time */
	clock_t t1, t2;

	/*									INDEXING PHASE								  */
	/* ****************************************************************************** */
	if( BILLION_DATASET == 0 )
		project_database(hdbc);
	else
	{
		int i;
		for( i = 99; i <= 100; i++ )
		{
			/* if the indexing option is on, then index the dataset */
			project_database(hdbc);

			/* update variables: table name, dataset path and dataset root name */
			update_variables(i);
		}
	}
	/* ****************************************************************************** */



	/*									QUERY PHASE								  */
	/* ****************************************************************************** */

    /* if the query option is on, then perform queries */
	/* variable to hold the time of start of the process */
	int run;
	float *diff = (float*)malloc(sizeof(float)*5);

	double NUM_RUNS = 5;
	float avg_diffs = 0;

	long *IDs;

	/* compute each query 10x */
	for( run = 0; run < NUM_RUNS; run++ )
	{
		/* save starting time */
		t1 = clock();   

		/* find more similar vectors */
		IDs = performQuery(hdbc);
  
		/* save ending time */
		 t2 = clock();

		 /* compute running time for each query */
		 diff[run] = (((float)t2 - (float)t1) / 1000000.0F ) * 1000;   
		 avg_diffs += diff[run];
	}

	/* compute the average query time */
	for( run = 0; run < NUM_RUNS; run++ )
		printf("Run #%d: %f\n", run, diff[run]);

	printf("\nAverage Time for query1 = %f\n", avg_diffs / NUM_RUNS );
	printf("\nNumber of similar vectors returned = %ld\n", NUM_ITEMS);
	
	/* preview the computed vectors */
	int i;
	for( i = 0; i < NUM_ITEMS; i++ )
		if( i >= 10 ) break;
		else
			printf("%d\n", IDs[i]);

	/* free memory */
	free( IDs );

	/* close database connections */
	sql_close_connection(hdbc);
	sql_close_connection_handler(hdbc);
	sql_close_env_handler(henv);

	system("PAUSE");

    return EXIT_SUCCESS;
}
Exemplo n.º 26
0
void retro_run (void)
{
   int i;
   bool pointer_pressed;
   const struct KeyboardInfo *thisInput;
   bool updated = false;

   poll_cb();

   if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated)
      update_variables();

   /* Keyboard */
   thisInput = retroKeys;
   while(thisInput->name)
   {
      retroKeyState[thisInput->code] = input_cb(0, RETRO_DEVICE_KEYBOARD, 0, thisInput->code);
      thisInput ++;
   }
   
   for (i = 0; i < 4; i ++)
   {
      /* Analog joystick */
      analogjoy[i][0] = input_cb(i, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_X);
      analogjoy[i][1] = input_cb(i, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_Y);
      analogjoy[i][2] = input_cb(i, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_X);
      analogjoy[i][3] = input_cb(i, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_Y);
      
      unsigned int offset = (i * 18);
      
      /* Joystick */
      if (rstick_to_btns)
      {
         /* if less than 0.5 force, ignore and read buttons as usual */
         retroJsState[0 + offset] = analogjoy[i][3] >  0x4000 ? 1 : input_cb(i, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B);
         retroJsState[1 + offset] = analogjoy[i][2] < -0x4000 ? 1 : input_cb(i, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_Y);
      }
      else
      {
         retroJsState[0 + offset] = input_cb(i, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B);
         retroJsState[1 + offset] = input_cb(i, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_Y);
      }
      retroJsState[2 + offset] = input_cb(i, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_SELECT);
      retroJsState[3 + offset] = input_cb(i, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_START);
      retroJsState[4 + offset] = input_cb(i, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP);
      retroJsState[5 + offset] = input_cb(i, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_DOWN);
      retroJsState[6 + offset] = input_cb(i, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT);
      retroJsState[7 + offset] = input_cb(i, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT);
      if (rstick_to_btns)
      {
         retroJsState[8 + offset] = analogjoy[i][2] >  0x4000 ? 1 : input_cb(i, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_A);
         retroJsState[9 + offset] = analogjoy[i][3] < -0x4000 ? 1 : input_cb(i, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_X);
      }
      else
      {
         retroJsState[8 + offset] = input_cb(i, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_A);
         retroJsState[9 + offset] = input_cb(i, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_X);
      }
      retroJsState[10 + offset] = input_cb(i, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L);
      retroJsState[11 + offset] = input_cb(i, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R);
      retroJsState[12 + offset] = input_cb(i, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L2);
      retroJsState[13 + offset] = input_cb(i, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R2);
      retroJsState[14 + offset] = input_cb(i, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L3);
      retroJsState[15 + offset] = input_cb(i, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R3);
      
      /* Mouse
       * Currently libretro only supports 1 mouse, so port is hard-coded.
       * MAME seems to support 4 mice/trackballs, so could be changed
       * in the future. */
      if (i == 0 && mouse_device)
      {
         if (mouse_device == RETRO_DEVICE_MOUSE)
         {
            retroJsState[16 + offset] = input_cb(0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_LEFT);
            retroJsState[17 + offset] = input_cb(0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_RIGHT);
            mouse_x[i] = input_cb(0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_X);
            mouse_y[i] = input_cb(0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_Y);
         }
         else // RETRO_DEVICE_POINTER
         {
            pointer_pressed = input_cb(0, RETRO_DEVICE_POINTER, 0, RETRO_DEVICE_ID_POINTER_PRESSED);
            retroJsState[16 + offset] = pointer_pressed;
            retroJsState[17 + offset] = 0; // padding
            mouse_x[i] = pointer_pressed ? get_pointer_delta(input_cb(0, RETRO_DEVICE_POINTER, 0, RETRO_DEVICE_ID_POINTER_X), &prev_pointer_x) : 0;
            mouse_y[i] = pointer_pressed ? get_pointer_delta(input_cb(0, RETRO_DEVICE_POINTER, 0, RETRO_DEVICE_ID_POINTER_Y), &prev_pointer_y) : 0;
         }
      }
      else
      {
         retroJsState[16 + offset] = 0;
         retroJsState[17 + offset] = 0;
      }
   }

   mame_frame();

   audio_batch_cb(XsoundBuffer, Machine->sample_rate / Machine->drv->frames_per_second);
}
Exemplo n.º 27
0
bool retro_load_game(const struct retro_game_info *info)
{
   int argc = 0;
   static char *argv[32] = {NULL};

   struct retro_input_descriptor desc[] = {
      { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT,  "D-Pad Left" },
      { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP,    "D-Pad Up" },
      { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_DOWN,  "D-Pad Down" },
      { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT, "D-Pad Right" },
      { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B,     "Strafe" },
      { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_A,     "Use" },
      { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_X,     "Fire" },
      { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_Y,     "Run" },
      { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L,     "Strafe Left" },
      { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R,     "Strafe Right" },
      { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L2,     "Previous Weapon" },
      { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R2,     "Next Weapon" },
      { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_SELECT,    "Show/Hide Map" },
      { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_START,    "Settings" },

      { 0 },
   };

   environ_cb(RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS, desc);

   update_variables(true);


   extract_directory(g_wad_dir, info->path, sizeof(g_wad_dir));
   extract_basename(g_basename, info->path, sizeof(g_basename));


   argv[argc++] = strdup("prboom");
   if(info->path)
   {
      argv[argc++] = strdup("-iwad");
      argv[argc++] = strdup(g_basename);
   }

   myargc = argc;
   myargv = argv;

   if (!Z_Init()) /* 1/18/98 killough: start up memory stuff first */
      goto failed;

   /* cphipps - call to video specific startup code */
   if (!I_PreInitGraphics())
      goto failed;

   if (!D_DoomMainSetup())
      goto failed;

   return true;

failed:
   {
      struct retro_message msg;
      char msg_local[256];

      snprintf(msg_local, sizeof(msg_local),
            "ROM loading failed...");
      msg.msg    = msg_local;
      msg.frames = 360;
      if (environ_cb)
         environ_cb(RETRO_ENVIRONMENT_SET_MESSAGE, (void*)&msg);
   }
   if (screen_buf)
      free(screen_buf);
   I_SafeExit(-1);
   return false;
}
Exemplo n.º 28
0
bool retro_load_game(const struct retro_game_info *info)
{
   retro_variable var;

   if (!info)
      return false;

   strcpy(retro_path_info, info->path);
   if (strstr(info->path, ".obj") || strstr(info->path, ".mtl"))
      engine_program_cb = &engine_program_modelviewer;
   else
      engine_program_cb = &engine_program_instancingviewer;

   update_variables();

   var.key = "3dengine-sensor-enable";
   var.value = NULL;

   if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
   {

      if (!strcmp(var.value, "enabled"))
      {
         if (sensor_initialized)
            return true;

         log_cb(RETRO_LOG_INFO, "Sensor interface found, enabling...\n");
         if (sensor_cb.set_sensor_state)
         {
            sensor_cb.set_sensor_state(0, RETRO_SENSOR_ACCELEROMETER_ENABLE, FPS);
            sensor_enable = true;
         }

         sensor_initialized = true;
      }
      if (!strcmp(var.value, "disabled"))
      {
         if (sensor_initialized)
            return true;

         log_cb(RETRO_LOG_INFO, "Sensor interface found, disabling...\n");
         if (sensor_cb.set_sensor_state)
         {
            sensor_cb.set_sensor_state(0, RETRO_SENSOR_ACCELEROMETER_DISABLE, FPS);
            sensor_enable = false;
         }
      }
   }

   var.key = "3dengine-location-enable";
   var.value = NULL;

   if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
   {
      if (!strcmp(var.value, "enabled"))
      {
         location_enable = true;
         location_cb.initialized = location_initialized;
         location_cb.deinitialized = location_deinitialized;
         environ_cb(RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE, &location_cb);
      }
   }

   memset(&camera_cb, 0, sizeof(camera_cb));

   enum retro_pixel_format fmt = RETRO_PIXEL_FORMAT_XRGB8888;
   if (!environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt))
   {
      if (log_cb)
         log_cb(RETRO_LOG_ERROR, "XRGB8888 is not supported.\n");
      return false;
   }

   var.key = "3dengine-camera-enable";
   var.value = NULL;

   if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
   {
      if (!strcmp(var.value, "enabled"))
      {
         camera_enable = true;
         var.key = "3dengine-camera-type";
         var.value = NULL;

         if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
         {
            if (!strcmp(var.value, "texture"))
            {
               camera_cb.caps = (1 << RETRO_CAMERA_BUFFER_OPENGL_TEXTURE);
               camera_cb.frame_opengl_texture = camera_gl_callback;
            }
            else
            {
               camera_cb.caps = (1 << RETRO_CAMERA_BUFFER_RAW_FRAMEBUFFER);
               camera_cb.frame_raw_framebuffer = camera_raw_fb_callback;
            }
         }

         camera_cb.initialized = camera_initialized;

         if (camera_enable && !environ_cb(RETRO_ENVIRONMENT_GET_CAMERA_INTERFACE, &camera_cb))
         {
            if (log_cb)
               log_cb(RETRO_LOG_ERROR, "camera is not supported.\n");
            return false;
         }
      }
   }

#ifdef HAVE_OPENGLES
   hw_render.context_type = RETRO_HW_CONTEXT_OPENGLES2;
#else
   hw_render.context_type = RETRO_HW_CONTEXT_OPENGL;
#endif
   hw_render.context_reset = context_reset;
   hw_render.depth = true;
   if (!camera_enable)
      hw_render.bottom_left_origin = true;
   if (!environ_cb(RETRO_ENVIRONMENT_SET_HW_RENDER, &hw_render))
      return false;

#ifdef HAVE_OPENGLES
   if (camera_enable && camera_cb.caps & (1 << RETRO_CAMERA_BUFFER_RAW_FRAMEBUFFER) && !gl_query_extension("BGRA8888"))
   {
      if (log_cb)
         log_cb(RETRO_LOG_ERROR, "no BGRA8888 support for raw framebuffer, exiting...\n");
      return false;
   }
   support_unpack_row_length = gl_query_extension("GL_EXT_unpack_subimage");
#else
   support_unpack_row_length = true;
#endif

   if (log_cb)
      log_cb(RETRO_LOG_INFO, "Loaded game!\n");


   if (engine_program_cb && engine_program_cb->load_game)
      engine_program_cb->load_game(info);

   return true;
}
Exemplo n.º 29
0
void vIMU_tasks()
{
	uint8_t time_count;
	portTickType ticks_now,ticks_old = 0;
	uint8_t IMU_update_count = 0;

   	IMU_setup();
   	Baro_init();

    if(RCC_GetFlagStatus(RCC_FLAG_SFTRST) == RESET)		//if it was a hardware reset
	{
		NVIC_SystemReset();								//force software reset so that MPU sensitivity returns to normal range
	}
    NVIC_Configuration();
	SD_Init();

//////////////////////////****************************//////////////////////////////
//	create_log_file();		//Uncomment to enable log on start, else log will start only when the button on GCS is pressed
//////////////////////////****************************//////////////////////////////

	for(int y=0; y<=5; y++)   // Read first initial ADC values for offset.
		AN_OFFSET[y] = 0;

    for(;;)
	{
    	WDT_status |= 1;		//update status for IMU tasks
    	if(log_init_flag)
		{
			log_data();			//append new data to buffer
		}
    	ticks_now = xTaskGetTickCount()*2;

    	if((ticks_now - ticks_old) >= 17)		//do the following every 17ms
    	{
    		G_Dt = (ticks_now - ticks_old)/1000.0;
    		ticks_old = ticks_now;

    		if((!calibrating_IMU) && (!calibrating_mag))	//update IMU only if not calibrating IMU or MAG
    		{
    			IMU_Update_ARDU();
    			HMC5883_calculate(roll,pitch);
    			Matrix_update();
    		    Normalize();
    		    Drift_correction();
    		    Euler_angles();
    		    update_variables();
    		}
    		else if(calibrating_mag)						//if calibrating MAG then do not process IMU, only get raw values and obtain MAG offsets
    		{
    		    if(IMU_update_count >= 5)
    			{
    		    	IMU_Update_ARDU();
    				IMU_update_count = 0;
    			}
    			else
    				IMU_update_count++;
    		}
			altitude = ((Baro_update(G_Dt*1000)) - ground_alt_offset);		//time in ms

			innerloop();									//set servo output
		    if(time_count == 5)								//do this every 5*17ms ~= 100ms
		    {
		    	send_attitude();
		    	send_attitude_RAW();
		    	time_count = 0;
		    }
		    else
		    	time_count++;
    	}
		vTaskDelay( 17/ portTICK_RATE_MS );					//3ms less to compensate for IMU update time
	}
}