Пример #1
0
void ShaderRenderable::setMaterial(Shader::ShaderMaterial *material) {
	// TODO: check old surface for usage count decrement.
	_material = material;
	updateProgram();
}
Пример #2
0
int main(void)
{
   bool_t isUserRun = FALSE;
   bool_t displayCountdown = TRUE;
   uint16_t bootByte;
   _ee_getReserved(_AI_EE_RES_ADDR_BOOT, &bootByte);
   if (button_get(0) && button_get(1))
   {
      // Both buttons are pressed so the user
      // wants to run the bootloader.
      isUserRun = TRUE;
   }
   else if (bootByte != _AI_EE_RES_VAL_BOOT_RUN)
   {
      startProgram();
   }
   _ee_putReserved(_AI_EE_RES_ADDR_BOOT, _AI_EE_RES_VAL_DEFAULT);

   led_on(0);
   led_on(1);

   int i, j;
   for (i = 0; i < BOOT_TIMEOUT; i++)
   {
      if (isUserRun)
      {
         // flash LED1
         if (i % 100 == 0)
            led_toggle(1);
         
         // update the countdown
         if (i % 1000 == 0)
         {
            lcd_clear();
            lcd_printf("Aithon Board\n%d", (BOOT_TIMEOUT-i)/1000);
            displayCountdown = TRUE;
         }

         // show the bootloader build date if button 0 pressed
         if (button_get(0) && displayCountdown) {
            if (i > (.1 * BOOT_TIMEOUT)) {
               lcd_clear();
               lcd_printf(DATE);
               displayCountdown = FALSE;
            }
         }
      }

      // check all the interfaces for a SYNC
      for (j = 0; j < NUM_INTERFACES; j++)
      {
         if (sdGetTimeout(_interfaces[j], TIME_IMMEDIATE) == SYNC)
         {
            _interface = _interfaces[j];
            updateProgram();
            // We should never get here...
            while(1);
         }
      }
      chThdSleepMilliseconds(1);
   }
   startProgram();
   return 0;
}
Пример #3
0
void ShaderRenderable::setSurface(Shader::ShaderSurface *surface) {
	// TODO: check old surface for usage count decrement.
	_surface = surface;
	updateProgram();
}
Пример #4
0
/**
 * Update a device entry using the options specified.
 *
 * @param device A pointer to the device map to modify.
 * @param key The option to set.
 * @param value The option value to use.
 * @param option Any extra command line options to add.
 */
int updateDevice(device_map *const device, const char *const key,
                 const char *const value, const char *const option)
{
    device_map *pDevice = (device_map *)device;
    int retVal = 0;
    if (!strcmp(key, "user-config-enabled"))
    {
        if (!strcasecmp(value, "no"))
        {
            bUserConfig = 0;
        }
        retVal = 1;
    }
    else if (!strcmp(key, "wine-script"))
    {
        program_map *pProgram = allocProgram(pDevice, WINE);
        if (pProgram)
        {
            if (bInUserConfig && !option)
            {
                int i = 0;
                if (pProgram->script)
                {
                    free(pProgram->script);
                    pProgram->script = 0;
                }
                while (pProgram->options[i])
                {
                    free(pProgram->options[i]);
                    pProgram->options[i++] = 0;
                }
            }
            if (updateProgram(pProgram, WINE, value, option))
            {
                retVal = 1;
            }
        }
    }
    else if (!strcmp(key, "wine-office-script"))
    {
        program_map *pProgram = allocProgram(pDevice, WINE_OFFICE);
        if (pProgram)
        {
            if (bInUserConfig && !option)
            {
                int i = 0;
                if (pProgram->script)
                {
                    free(pProgram->script);
                    pProgram->script = 0;
                }
                while (pProgram->options[i])
                {
                    free(pProgram->options[i]);
                    pProgram->options[i++] = 0;
                }
            }
            if (updateProgram(pProgram, WINE_OFFICE, value, option))
            {
                retVal = 1;
            }
        }
    }
    else if (!strcmp(key, "dvd-video"))
    {
        program_map *pProgram = allocProgram(pDevice, VIDEO);
        if (pProgram)
        {
            if (bInUserConfig && !option)
            {
                int i = 0;
                if (pProgram->script)
                {
                    free(pProgram->script);
                    pProgram->script = 0;
                }
                while (pProgram->options[i])
                {
                    free(pProgram->options[i]);
                    pProgram->options[i++] = 0;
                }
            }
            if (updateProgram(pProgram, VIDEO, value, option))
            {
                retVal = 1;
            }
        }
    }
    else if (!strcmp(key, "vcd-video"))
    {
        program_map *pProgram = allocProgram(pDevice, VCDVIDEO);
        if (pProgram)
        {
            if (bInUserConfig && !option)
            {
                int i = 0;
                if (pProgram->script)
                {
                    free(pProgram->script);
                    pProgram->script = 0;
                }
                while (pProgram->options[i])
                {
                    free(pProgram->options[i]);
                    pProgram->options[i++] = 0;
                }
            }
            if (updateProgram(pProgram, VCDVIDEO, value, option))
            {
                retVal = 1;
            }
        }
    }
    else if (!strcmp(key, "cd-audio"))
    {
        program_map *pProgram = allocProgram(pDevice, AUDIO);
        if (pProgram)
        {
            if (bInUserConfig && !option)
            {
                int i = 0;
                if (pProgram->script)
                {
                    free(pProgram->script);
                    pProgram->script = 0;
                }
                while (pProgram->options[i])
                {
                    free(pProgram->options[i]);
                    pProgram->options[i++] = 0;
                }
            }
            if (updateProgram(pProgram, AUDIO, value, option))
            {
                retVal = 1;
            }
        }
    }
    else if (!strcmp(key, "cd-data"))
    {
        program_map *pProgram = allocProgram(pDevice, DATA);
        if (pProgram)
        {
            if (bInUserConfig && !option)
            {
                int i = 0;
                if (pProgram->script)
                {
                    free(pProgram->script);
                    pProgram->script = 0;
                }
                while (pProgram->options[i])
                {
                    free(pProgram->options[i]);
                    pProgram->options[i++] = 0;
                }
            }
            if (updateProgram(pProgram, DATA, value, option))
            {
                retVal = 1;
            }
        }
    }
    else if (!strcmp(key, "cd-mixed"))
    {
        program_map *pProgram = allocProgram(pDevice, MIXED);
        if (pProgram)
        {
            if (bInUserConfig && !option)
            {
                int i = 0;
                if (pProgram->script)
                {
                    free(pProgram->script);
                    pProgram->script = 0;
                }
                while (pProgram->options[i])
                {
                    free(pProgram->options[i]);
                    pProgram->options[i++] = 0;
                }
            }
            if (updateProgram(pProgram, MIXED, value, option))
            {
                retVal = 1;
            }
        }
    }
    else if (!strcmp(key, "mount-point"))
    {
       if (!device->mountPoint)
        {
            device->mountPoint = strdup(value);
            retVal = 1;
        }
        else
        {
            free(device->mountPoint);
            device->mountPoint = strdup(value);
            retVal = 1;
        }
    }
    else if (!strcmp(key, "autorun-wine"))
    {
        program_map *pProgram1 = allocProgram(pDevice, WINE);
        program_map *pProgram2 = allocProgram(pDevice, WINE_OFFICE);
        if (pProgram1 && pProgram2)
        {
            if (!strcasecmp(value, "yes"))
            {
                pProgram1->enabled = 1;
                pProgram2->enabled = 1;
                retVal = 1;
            }
            else
            {
                pProgram1->enabled = 0;
                pProgram2->enabled = 0;
                retVal = 1;
            }
        }
    }
    else if (!strcmp(key, "autorun-loki"))
    {
        program_map *pProgram = allocProgram(pDevice, LOKI);
        if (pProgram)
        {
            if (!strcasecmp(value, "yes"))
            {
                pProgram->enabled = 1;
                retVal = 1;
            }
            else
            {
                pProgram->enabled = 0;
                retVal = 1;
            }
        }
    }
    else if (!strcmp(key, "autorun-audio"))
    {
        program_map *pProgram = allocProgram(pDevice, AUDIO);
        if (pProgram)
        {
            if (!strcasecmp(value, "yes"))
            {
                pProgram->enabled = 1;
                retVal = 1;
            }
            else
            {
                pProgram->enabled = 0;
                retVal = 1;
            }
        }
    }
    else if (!strcmp(key, "autorun-video"))
    {
        program_map *pProgram = allocProgram(pDevice, VIDEO);
        if (pProgram)
        {
            if (!strcasecmp(value, "yes"))
            {
                pProgram->enabled = 1;
                retVal = 1;
            }
            else
            {
                pProgram->enabled = 0;
                retVal = 1;
            }
        }
    }
    else if (!strcmp(key, "autorun-vcd"))
    {
        program_map *pProgram = allocProgram(pDevice, VCDVIDEO);
        if (pProgram)
        {
            if (!strcasecmp(value, "yes"))
            {
                pProgram->enabled = 1;
                retVal = 1;
            }
            else
            {
                pProgram->enabled = 0;
                retVal = 1;
            }
        }
    }
    else if (!strcmp(key, "autorun-data"))
    {
        program_map *pProgram = allocProgram(pDevice, DATA);
        if (pProgram)
        {
            if (!strcasecmp(value, "yes"))
            {
                pProgram->enabled = 1;
                retVal = 1;
            }
            else
            {
                pProgram->enabled = 0;
                retVal = 1;
            }
        }
    }
    else if (!strcmp(key, "autorun-mixed"))
    {
        program_map *pProgram = allocProgram(pDevice, MIXED);
        if (pProgram)
        {
            if (!strcasecmp(value, "yes"))
            {
                pProgram->enabled = 1;
                retVal = 1;
            }
            else
            {
                pProgram->enabled = 0;
                retVal = 1;
            }
        }
    }
    else if (!strcmp(key, "type"))
    {
        if (device)
        {
            device->deviceType = strdup(value);
            retVal = 1;
        }
    }

    return retVal;
}