Exemple #1
0
DOMMatrix*
DOMMatrix::SetMatrixValue(const nsAString& aTransformList, ErrorResult& aRv)
{
  SVGTransformListParser parser(aTransformList);
  if (!parser.Parse()) {
    aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
  } else {
    mMatrix3D = nullptr;
    mMatrix2D = new gfx::Matrix();
    gfxMatrix result;
    const nsTArray<nsSVGTransform>& mItems = parser.GetTransformList();

    for (uint32_t i = 0; i < mItems.Length(); ++i) {
      result.PreMultiply(mItems[i].GetMatrix());
    }

    SetA(result._11);
    SetB(result._12);
    SetC(result._21);
    SetD(result._22);
    SetE(result._31);
    SetF(result._32);
  }

  return this;
}
Exemple #2
0
/**
 * Sets control values for closed loop control.
 *
 * @param p Proportional constant.
 * @param i Integration constant.
 * @param d Differential constant.
 * @param f Feedforward constant.
 */
void CANTalon::SetPID(double p, double i, double d, double f)
{
	SetP(p);
	SetI(i);
	SetD(d);
	SetF(f);
}
Exemple #3
0
DOMMatrixReadOnly*
DOMMatrixReadOnly::SetMatrixValue(const nsAString& aTransformList, ErrorResult& aRv)
{
  // An empty string is a no-op.
  if (aTransformList.IsEmpty()) {
    return this;
  }

  gfx::Matrix4x4 transform;
  bool contains3dTransform = false;
  if (!ServoCSSParser::ParseTransformIntoMatrix(aTransformList,
                                                contains3dTransform,
                                                transform.components)) {
    aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
    return nullptr;
  }

  if (!contains3dTransform) {
    mMatrix3D = nullptr;
    mMatrix2D = new gfx::Matrix();

    SetA(transform._11);
    SetB(transform._12);
    SetC(transform._21);
    SetD(transform._22);
    SetE(transform._41);
    SetF(transform._42);
  } else {
    mMatrix3D = new gfx::Matrix4x4(transform);
    mMatrix2D = nullptr;
  }

  return this;
}
Exemple #4
0
void GBCPU::init()
{
    cout << "GBCPU initializng...";

    /* Begin Gameboy (DMG) set up of values to match with boot sequence*/
    // Initialize internal CPU variables
    IME = false;
    halted = false;
    DIV_counter = 0;
    TMA_counter = 0;
    PC = 0x100;

    // For GB, set to this value. For others, will be different
    // Note: Values commented out are not valid! Keeping in case they are used for other configs...
    A = (BYTE) 0x01; //0x11;
    SetF(0xB0);      //0x80;
    B = (BYTE) 0x00;
    C = (BYTE) 0x13; //0x00;
    D = (BYTE) 0x00; //0xFF; 
    E = (BYTE) 0xD8; //0x56;
    H = (BYTE) 0x01; //0x00; 
    L = (BYTE) 0x4D; //0x0D;
    
    SP = (WORD) 0xFFFE;

    MEM[0xFF05] = (BYTE) 0x00; // TIMA
    MEM[0xFF06] = (BYTE) 0x00; // TMA
    MEM[0xFF07] = (BYTE) 0x00; // TAC
    MEM[0xFF10] = (BYTE) 0x80; // NR10
    MEM[0xFF11] = (BYTE) 0xBF; // NR11
    MEM[0xFF12] = (BYTE) 0xF3; // NR12
    MEM[0xFF14] = (BYTE) 0xBF; // NR14
    MEM[0xFF16] = (BYTE) 0x3F; // NR21
    MEM[0xFF17] = (BYTE) 0x00; // NR22
    MEM[0xFF19] = (BYTE) 0xBF; // NR24
    MEM[0xFF1A] = (BYTE) 0x7F; // NR30
    MEM[0xFF1B] = (BYTE) 0xFF; // NR31
    MEM[0xFF1C] = (BYTE) 0x9F; // NR32
    MEM[0xFF1E] = (BYTE) 0xBF; // NR33
    MEM[0xFF20] = (BYTE) 0xFF; // NR41
    MEM[0xFF21] = (BYTE) 0x00; // NR42
    MEM[0xFF22] = (BYTE) 0x00; // NR43
    MEM[0xFF23] = (BYTE) 0xBF; // NR30
    MEM[0xFF24] = (BYTE) 0x77; // NR50
    MEM[0xFF25] = (BYTE) 0xF3; // NR51
    MEM[0xFF26] = (BYTE) 0xF1; // For GB 0xF1, for SGB 0xF0
    MEM[0xFF40] = (BYTE) 0x91; // LCDC
    MEM[0xFF42] = (BYTE) 0x00; // SCY
    MEM[0xFF43] = (BYTE) 0x00; // SCX
    MEM[0xFF45] = (BYTE) 0x00; // LYC
    MEM[0xFF47] = (BYTE) 0xFC; // BGP
    MEM[0xFF48] = (BYTE) 0xFF; // OBP0
    MEM[0xFF49] = (BYTE) 0xFF; // OBP1
    MEM[0xFF4A] = (BYTE) 0x00; // WY
    MEM[0xFF4B] = (BYTE) 0x00; // WX
    MEM[0xFFFF] = (BYTE) 0x00; // IE
    /* End Gameboy (DMG) set up of values to match with boot sequence*/

    // Initialize JOYPAD to no buttons pressed to prevent resets
    MEM[JOYPAD_P1] = 0x3F;

    cout << "done!" << endl;
}