void psClientCharManager::HandleMessage ( MsgEntry* me )
{
    switch ( me->GetType() )
    {
        case MSGTYPE_CHANGE_TRAIT:
        {
            ChangeTrait(me);
            break;
        }

        case MSGTYPE_USERACTION:
        {
            HandleAction( me );
            break;
        }
        case MSGTYPE_CHARREJECT:
        {
            HandleRejectCharMessage( me );
            break;
        }

        case MSGTYPE_EQUIPMENT:
        {
            HandleEquipment(me);
            return;
        }

        case MSGTYPE_EFFECT:
        {
            HandleEffect(me);
            return;
        }

        case MSGTYPE_EFFECT_STOP:
        {
            HandleEffectStop(me);
            return;
        }

        case MSGTYPE_PLAYSOUND:
        {
            if(psengine->GetSoundStatus())
            {
                HandlePlaySound(me);
            }
            return;
        }

        case MSGTYPE_GUITARGETUPDATE:
        {
            HandleTargetUpdate(me);
            return;
        }

        default:
        {
            ready = true;
            return;
        }
    }
}
Exemple #2
0
usbMsgLen_t usbFunctionSetup(uchar data[8]) {
  usbRequest_t *rq = (void *)data;
  static uchar dataBuffer[4];
  currentRequest = rq->bRequest;
  currentValue = rq->wValue.word;
  currentIndex = rq->wIndex.word;

  usbMsgPtr = (int)dataBuffer;
  switch (rq->bRequest) {
  case WL_REQUEST_ECHO:
    dataBuffer[0] = rq->wValue.bytes[0];
    dataBuffer[1] = rq->wValue.bytes[1];
    dataBuffer[2] = rq->wIndex.bytes[0];
    dataBuffer[3] = rq->wIndex.bytes[1];
    return 4;
  case WL_REQUEST_COLOR:
  case WL_REQUEST_TRANSITION:
  case WL_REQUEST_PAUSE:
    currentPosition = 0;
    bytesRemaining = rq->wLength.word;
    if (bytesRemaining > sizeof(buffer)) {
      bytesRemaining = sizeof(buffer);
    }
    return USB_NO_MSG;
  case WL_REQUEST_SET_WEBUSB_URLS:
    currentPosition = 0;
    bytesRemaining = rq->wLength.word;
    return USB_NO_MSG;
  case WL_REQUEST_HALT:
    HandleHALT();
    break;
  case WL_REQUEST_RECORD:
    Record();
    break;
  case WL_REQUEST_PLAY:
    Play();
    break;
  case WL_REQUEST_STOP:
    Stop();
    break;
  case WL_REQUEST_SAVE:
    Save();
    break;
  case WL_REQUEST_LOAD:
    Load();
    break;
  case WL_REQUEST_EFFECT:
    HandleEffect(rq->wValue.word);
    break;
  case WL_REQUEST_RESET_WATCHDOG:
    ResetAppWatchdog(rq->wValue.word * 1000);
    break;
  case WL_REQUEST_WEBUSB: {
    switch (rq->wIndex.word) {
    case WEBUSB_REQUEST_GET_ALLOWED_ORIGINS:
      pmResponsePtr = WEBUSB_ALLOWED_ORIGINS;
      pmResponseBytesRemaining = sizeof(WEBUSB_ALLOWED_ORIGINS);
      return USB_NO_MSG;
    case WEBUSB_REQUEST_GET_URL:
      switch (rq->wValue.word) {
        case 1:
          pmResponsePtr = WEBUSB_ORIGIN_1;
          pmResponseBytesRemaining = sizeof(WEBUSB_ORIGIN_1);
          return USB_NO_MSG;
        case 2:
          pmResponsePtr = WEBUSB_ORIGIN_2;
          pmResponseBytesRemaining = sizeof(WEBUSB_ORIGIN_2);
          return USB_NO_MSG;
      }
    }
    break;
  }
  case WL_REQUEST_WINUSB: {
    switch (rq->wIndex.word) {
    case WINUSB_REQUEST_DESCRIPTOR:
      pmResponsePtr = MS_OS_20_DESCRIPTOR_SET;
      pmResponseBytesRemaining = sizeof(MS_OS_20_DESCRIPTOR_SET);
      return USB_NO_MSG;
    }
    break;
  }
  case WL_REQUEST_RESET_DEVICE:
    forceReset();
    break;
  }

  return 0;
}