コード例 #1
0
ファイル: PortInterop.cs プロジェクト: xbox3601112/J-Runner
    public static void setPort(short p, byte val)
    {
        /* Initialize static out_word register bits just once */
        if (once)
        {
            out_world.one  = 1;
            out_world.zero = 0;
            out_world.Bit5 = 0;
            out_world.Bit6 = 0;
            out_world.Bit7 = 0;
            once           = true;
        }

        /* Update the local out_word copy of the JTAG signal to the new value. */
        if (p == TMS)
        {
            out_world.TMS = val;
        }
        if (p == TDI)
        {
            out_world.TDI = val;
        }
        if (p == TCK)
        {
            out_world.TCK = val;
            //    (void) _outp( (unsigned short) (base_port + 0), out_word.value );
            NativeMethods.Out32((short)(base_port + DATA_OFFSET), (short)PrimitiveConversion.ToLong(out_world));

            /* To save HW write cycles, this example only writes the local copy
             * of the JTAG signal values to the HW register when TCK changes. */
        }
    }
コード例 #2
0
ファイル: AD7291.cs プロジェクト: EliArad/Drivers
            public void ClearMux(CHANNEL channel)
            {
                byte val = 0;

                switch (channel)
                {
                case CHANNEL.CHANNEL0:
                    m_cmdReg.MuxCH7 = val;
                    break;

                case CHANNEL.CHANNEL1:
                    m_cmdReg.MuxCH6 = val;
                    break;

                case CHANNEL.CHANNEL2:
                    m_cmdReg.MuxCH5 = val;
                    break;

                case CHANNEL.CHANNEL3:
                    m_cmdReg.MuxCH4 = val;
                    break;

                case CHANNEL.CHANNEL4:
                    m_cmdReg.MuxCH3 = val;
                    break;

                case CHANNEL.CHANNEL5:
                    m_cmdReg.MuxCH2 = val;
                    break;

                case CHANNEL.CHANNEL6:
                    m_cmdReg.MuxCH1 = val;
                    break;

                case CHANNEL.CHANNEL7:
                    m_cmdReg.MuxCH0 = val;
                    break;
                }
                ushort data = (ushort)(PrimitiveConversion.ToLong(m_cmdReg));

                SetCommandRegister(data);
            }
コード例 #3
0
ファイル: AD7291.cs プロジェクト: EliArad/Drivers
            public AD7291(byte slaveAddress, DiolanI2CController i2c)
            {
                m_slaveAddress = slaveAddress;
                m_i2c          = i2c;
                SetVREF(VREF);


                /* It is recommended to enable AD7291_COMMAND_DELAY feature for
                 * normal operation. */
                m_cmdReg.AutocycleMode = 1;
                m_cmdReg.EXT_REF       = 0;
                m_cmdReg.NoiseDelayedBitTrialAndSampling = 1;
                m_cmdReg.TSense = 1;

                ushort data = (ushort)(PrimitiveConversion.ToLong(m_cmdReg));

                SetCommandRegister(data);

                Console.WriteLine("Command resgister {0}", data);
            }
コード例 #4
0
ファイル: Npc.cs プロジェクト: stephan-schwarz/EnraptureXIV
        public void loadNpcTemplate(uint id)
        {
            using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
            {
                try
                {
                    conn.Open();

                    string query = @"
                                    SELECT                 
                                    base,
                                    size,
                                    hairStyle,
                                    hairHighlightColor,
                                    hairVariation,
                                    faceType,
                                    characteristics,
                                    characteristicsColor,
                                    faceEyebrows,
                                    faceIrisSize,
                                    faceEyeShape,
                                    faceNose,
                                    faceFeatures,
                                    faceMouth,
                                    ears,
                                    hairColor,
                                    skinColor,
                                    eyeColor,
                                    voice,
                                    mainHand,
                                    offHand,
                                    spMainHand,
                                    spOffHand,
                                    throwing,
                                    pack,
                                    pouch,
                                    head,
                                    body,
                                    legs,
                                    hands,
                                    feet,
                                    waist,
                                    neck,
                                    leftEar,
                                    rightEar,
                                    leftIndex,
                                    rightIndex,
                                    leftFinger,
                                    rightFinger
                                    FROM gamedata_actor_appearance
                                    WHERE id = @templateId
                                    ";

                    MySqlCommand cmd = new MySqlCommand(query, conn);
                    cmd.Parameters.AddWithValue("@templateId", id);

                    using (MySqlDataReader reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            //Handle Appearance
                            modelId = reader.GetUInt32(0);
                            appearanceIds[Character.SIZE]           = reader.GetUInt32(1);
                            appearanceIds[Character.COLORINFO]      = (uint)(reader.GetUInt32(16) | (reader.GetUInt32(15) << 10) | (reader.GetUInt32(17) << 20)); //17 - Skin Color, 16 - Hair Color, 18 - Eye Color
                            appearanceIds[Character.FACEINFO]       = PrimitiveConversion.ToUInt32(CharacterUtils.getFaceInfo(reader.GetByte(6), reader.GetByte(7), reader.GetByte(5), reader.GetByte(14), reader.GetByte(13), reader.GetByte(12), reader.GetByte(11), reader.GetByte(10), reader.GetByte(9), reader.GetByte(8)));
                            appearanceIds[Character.HIGHLIGHT_HAIR] = (uint)(reader.GetUInt32(3) | reader.GetUInt32(2) << 10);                                    //5- Hair Highlight, 4 - Hair Style
                            appearanceIds[Character.VOICE]          = reader.GetUInt32(17);
                            appearanceIds[Character.MAINHAND]       = reader.GetUInt32(19);
                            //appearanceIds[Character.WEAPON2] = reader.GetUInt32(22);
                            appearanceIds[Character.HEADGEAR]     = reader.GetUInt32(26);
                            appearanceIds[Character.BODYGEAR]     = reader.GetUInt32(27);
                            appearanceIds[Character.LEGSGEAR]     = reader.GetUInt32(28);
                            appearanceIds[Character.HANDSGEAR]    = reader.GetUInt32(29);
                            appearanceIds[Character.FEETGEAR]     = reader.GetUInt32(30);
                            appearanceIds[Character.WAISTGEAR]    = reader.GetUInt32(31);
                            appearanceIds[Character.R_EAR]        = reader.GetUInt32(32);
                            appearanceIds[Character.L_EAR]        = reader.GetUInt32(33);
                            appearanceIds[Character.R_RINGFINGER] = reader.GetUInt32(36);
                            appearanceIds[Character.L_RINGFINGER] = reader.GetUInt32(37);
                        }
                    }
                }
                catch (MySqlException e)
                { Console.WriteLine(e); }
                finally
                {
                    conn.Dispose();
                }
            }
        }
コード例 #5
0
 public ValueManglingFeature(TypeSig type)
 {
     Type             = type;
     AlternativeTypes = PrimitiveConversion.Get(type.ElementType);
 }
コード例 #6
0
        public static String BuildForCharaList(Character chara, Appearance appearance)
        {
            byte[] data;

            using (MemoryStream stream = new MemoryStream())
            {
                using (BinaryWriter writer = new BinaryWriter(stream))
                {
                    //Build faceinfo for later
                    FaceInfo faceInfo = new FaceInfo();
                    faceInfo.characteristics      = appearance.characteristics;
                    faceInfo.characteristicsColor = appearance.characteristicsColor;
                    faceInfo.type     = appearance.faceType;
                    faceInfo.ears     = appearance.ears;
                    faceInfo.features = appearance.faceFeatures;
                    faceInfo.eyebrows = appearance.faceEyebrows;
                    faceInfo.eyeShape = appearance.faceEyeShape;
                    faceInfo.irisSize = appearance.faceIrisSize;
                    faceInfo.mouth    = appearance.faceMouth;
                    faceInfo.nose     = appearance.faceNose;

                    string location1 = "prv0Inn01\0";
                    string location2 = "defaultTerritory\0";

                    writer.Write((UInt32)0x000004c0);
                    writer.Write((UInt32)0x232327ea);
                    writer.Write((UInt32)System.Text.Encoding.UTF8.GetBytes(chara.name + '\0').Length);
                    writer.Write(System.Text.Encoding.UTF8.GetBytes(chara.name + '\0'));
                    writer.Write((UInt32)0x1c);
                    writer.Write((UInt32)0x04);
                    writer.Write((UInt32)GetTribeModel(chara.tribe));
                    writer.Write((UInt32)appearance.size);
                    uint colorVal = appearance.skinColor | (uint)(appearance.hairColor << 10) | (uint)(appearance.eyeColor << 20);
                    writer.Write((UInt32)colorVal);

                    var bitfield = PrimitiveConversion.ToUInt32(faceInfo);

                    writer.Write((UInt32)bitfield); //FACE, Figure this out!
                    uint hairVal = appearance.hairHighlightColor | (uint)(appearance.hairStyle << 10) | (uint)(appearance.characteristicsColor << 20);
                    writer.Write((UInt32)hairVal);
                    writer.Write((UInt32)appearance.voice);
                    writer.Write((UInt32)appearance.mainHand);
                    writer.Write((UInt32)appearance.offHand);

                    writer.Write((UInt32)0);
                    writer.Write((UInt32)0);
                    writer.Write((UInt32)0);
                    writer.Write((UInt32)0);
                    writer.Write((UInt32)0);

                    writer.Write((UInt32)appearance.head);
                    writer.Write((UInt32)appearance.body);
                    writer.Write((UInt32)appearance.legs);
                    writer.Write((UInt32)appearance.hands);
                    writer.Write((UInt32)appearance.feet);
                    writer.Write((UInt32)appearance.waist);

                    writer.Write((UInt32)0);

                    writer.Write((UInt32)appearance.rightEar);
                    writer.Write((UInt32)appearance.leftEar);

                    writer.Write((UInt32)0);
                    writer.Write((UInt32)0);

                    writer.Write((UInt32)appearance.rightFinger);
                    writer.Write((UInt32)appearance.leftFinger);

                    for (int i = 0; i < 0x8; i++)
                    {
                        writer.Write((byte)0);
                    }

                    writer.Write((UInt32)1);
                    writer.Write((UInt32)1);

                    writer.Write((byte)chara.currentClass);
                    writer.Write((UInt16)chara.currentLevel);
                    writer.Write((byte)chara.currentJob);
                    writer.Write((UInt16)1);
                    writer.Write((byte)chara.tribe);

                    writer.Write((UInt32)0xe22222aa);

                    writer.Write((UInt32)System.Text.Encoding.UTF8.GetBytes(location1).Length);
                    writer.Write(System.Text.Encoding.UTF8.GetBytes(location1));
                    writer.Write((UInt32)System.Text.Encoding.UTF8.GetBytes(location2).Length);
                    writer.Write(System.Text.Encoding.UTF8.GetBytes(location2));

                    writer.Write((byte)chara.guardian);
                    writer.Write((byte)chara.birthMonth);
                    writer.Write((byte)chara.birthDay);

                    writer.Write((UInt16)0x17);
                    writer.Write((UInt32)4);
                    writer.Write((UInt32)4);

                    writer.BaseStream.Seek(0x10, SeekOrigin.Current);

                    writer.Write((UInt32)chara.initialTown);
                    writer.Write((UInt32)chara.initialTown);
                }

                data = stream.GetBuffer();
            }

            return(Convert.ToBase64String(data).Replace('+', '-').Replace('/', '_'));
        }