コード例 #1
0
    void WriteActorPosition(Box actor, Vector3 lowerBound, Vector3 upperBound, Vector3 localPosition, Vector3 worldPosition)
    {
        ProcessMemoryReader processReader = GetComponent <DosBox>().ProcessReader;

        //get object offset
        int index = Actors.GetComponentsInChildren <Box>(true).ToList().IndexOf(actor);

        if (index != -1)
        {
            long offset = GetComponent <DosBox>().GetActorMemoryAddress(index);

            //update to memory
            //bounds
            byte[] buffer = new byte[12];
            buffer.Write(lowerBound, upperBound, 0);
            processReader.Write(buffer, offset + 8, 12);

            //local+world
            buffer.Write(localPosition, 0);
            buffer.Write(worldPosition, 6);
            processReader.Write(buffer, offset + 28, 12);

            actor.LocalPosition = localPosition;
            actor.WorldPosition = worldPosition;
            actor.BoundingLower = lowerBound;
            actor.BoundingUpper = upperBound;
        }
    }
コード例 #2
0
 public void Update()
 {
     if (Input.GetKeyDown(KeyCode.Q))
     {
         totalDelay.Reset();
     }
     if (Input.GetKeyDown(KeyCode.W))
     {
         foreach (Box box in Actors.GetComponentsInChildren <Box>(true))
         {
             box.LastDistance = 0.0f;
         }
     }
     if ((Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) && IsCDROMVersion && ProcessReader != null)
     {
         if (Input.GetKeyDown(KeyCode.Alpha1))
         {
             //internal timer 1
             InternalTimer1 -= 60 * 5;                 //back 5 frames
             memory.Write(InternalTimer1, 0);
             ProcessReader.Write(memory, Shared.ActorsMemoryAdress - 0x83B6 - 6, 4);
         }
         if (Input.GetKeyDown(KeyCode.Alpha2))
         {
             //internal timer 2
             internalTimer2 -= 60 * 5;                 //back 5 frames
             memory.Write(internalTimer2, 0);
             ProcessReader.Write(memory, Shared.ActorsMemoryAdress - 0x83B6 - 6 + 0xA5CE, 2);
         }
     }
 }
コード例 #3
0
    void OnCellChange(InputField cell, Var[] data, int cellIndex)
    {
        int newValueInt;

        if (int.TryParse(cell.text, out newValueInt) || cell.text == string.Empty)
        {
            if (newValueInt > short.MaxValue)
            {
                newValueInt = short.MaxValue;
            }
            if (newValueInt < short.MinValue)
            {
                newValueInt = short.MinValue;
            }

            if (newValueInt != data[cellIndex].value)
            {
                //write new value to memory
                ProcessMemoryReader processReader = GetComponent <DosBox>().ProcessReader;
                byte[] wordValue = new byte[2];
                Utils.WriteShort(newValueInt, wordValue, 0);
                processReader.Write(wordValue, data[cellIndex].memoryAddress, wordValue.Length);
            }
        }
    }
コード例 #4
0
ファイル: WarpDialog.cs プロジェクト: aybe/AITD-roomviewer
    void WriteActorAngle(Box actor, Vector3 angle)
    {
        ProcessMemoryReader processReader = GetComponent <DosBox>().ProcessReader;

        int address = GetComponent <DosBox>().GetActorMemoryAddress(actor.Slot);

        byte[] buffer = new byte[6];
        buffer.Write(angle, 0);
        processReader.Write(buffer, address + 40, buffer.Length);

        actor.Angles = angle;
    }
コード例 #5
0
ファイル: WarpDialog.cs プロジェクト: aybe/AITD-roomviewer
    void WriteActorPosition(Box actor, Vector3 lowerBound, Vector3 upperBound, Vector3 localPosition, Vector3 worldPosition)
    {
        ProcessMemoryReader processReader = GetComponent <DosBox>().ProcessReader;

        //get object offset
        int address = GetComponent <DosBox>().GetActorMemoryAddress(actor.Slot);

        //update to memory
        //bounds
        byte[] buffer = new byte[12];
        buffer.Write(lowerBound, upperBound, 0);
        processReader.Write(buffer, address + 8, 12);

        //local+world
        buffer.Write(localPosition, 0);
        buffer.Write(worldPosition, 6);
        processReader.Write(buffer, address + 28, 12);

        actor.LocalPosition = localPosition;
        actor.WorldPosition = worldPosition;
        actor.BoundingLower = lowerBound;
        actor.BoundingUpper = upperBound;
    }
コード例 #6
0
    private void WriteActorPosition(Box actor, Vector3 lowerBound, Vector3 upperBound, Vector3 localPosition, Vector3 worldPosition)
    {
        ProcessMemoryReader ProcessReader = GetComponent <DosBox>().ProcessReader;

        //get object offset
        int index = Actors.GetComponentsInChildren <Box>(true).ToList().IndexOf(actor);

        if (index != -1)
        {
            long offset = GetComponent <DosBox>().GetActorMemoryAddress(index);

            //update to memory
            //bounds
            byte[] buffer = new byte[12];
            Utils.WriteShort((int)lowerBound.x, buffer, 0);
            Utils.WriteShort((int)upperBound.x, buffer, 2);
            Utils.WriteShort((int)lowerBound.y, buffer, 4);
            Utils.WriteShort((int)upperBound.y, buffer, 6);
            Utils.WriteShort((int)lowerBound.z, buffer, 8);
            Utils.WriteShort((int)upperBound.z, buffer, 10);
            ProcessReader.Write(buffer, offset + 8, 12);

            //local+world
            Utils.WriteShort((int)localPosition.x, buffer, 0);
            Utils.WriteShort((int)localPosition.y, buffer, 2);
            Utils.WriteShort((int)localPosition.z, buffer, 4);
            Utils.WriteShort((int)worldPosition.x, buffer, 6);
            Utils.WriteShort((int)worldPosition.y, buffer, 8);
            Utils.WriteShort((int)worldPosition.z, buffer, 10);
            ProcessReader.Write(buffer, offset + 28, 12);

            warpActor.LocalPosition = localPosition;
            warpActor.WorldPosition = worldPosition;
            warpActor.BoundingLower = lowerBound;
            warpActor.BoundingUpper = upperBound;
        }
    }
コード例 #7
0
ファイル: DosBox.cs プロジェクト: aybe/AITD-roomviewer
 public void Update()
 {
     if (Input.GetKeyDown(KeyCode.Q))
     {
         totalDelay.Reset();
     }
     if (Input.GetKeyDown(KeyCode.W) && !(Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)))
     {
         foreach (Box box in Boxes)
         {
             if (box != null)
             {
                 box.LastDistance = 0.0f;
             }
         }
     }
     if ((Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) && IsCDROMVersion && ProcessReader != null)
     {
         if (Input.GetKeyDown(KeyCode.Alpha1))
         {
             //internal timer 1
             InternalTimer1 -= 60 * 5;                 //back 5 frames
             byte[] buffer = new byte[4];
             buffer.Write(InternalTimer1, 0);
             ProcessReader.Write(buffer, entryPoint + 0x19D12, buffer.Length);
         }
         if (Input.GetKeyDown(KeyCode.Alpha2))
         {
             //internal timer 2
             internalTimer2 -= 60 * 5;                 //back 5 frames
             byte[] buffer = new byte[2];
             buffer.Write(internalTimer2, 0);
             ProcessReader.Write(buffer, entryPoint + 0x242E0, buffer.Length);
         }
     }
 }
コード例 #8
0
    void WriteActorAngle(Box actor, Vector3 angle)
    {
        ProcessMemoryReader processReader = GetComponent <DosBox>().ProcessReader;

        int index = Actors.GetComponentsInChildren <Box>(true).ToList().IndexOf(actor);

        if (index != -1)
        {
            long   offset   = GetComponent <DosBox>().GetActorMemoryAddress(index);
            byte[] position = new byte[6];
            position.Write(angle, 0);
            processReader.Write(position, offset + 40, position.Length);

            actor.Angles = angle;
        }
    }
コード例 #9
0
    private void WriteActorAngle(Box actor, int angle)
    {
        ProcessMemoryReader ProcessReader = GetComponent <DosBox>().ProcessReader;

        int index = Actors.GetComponentsInChildren <Box>(true).ToList().IndexOf(actor);

        if (index != -1)
        {
            long   offset   = GetComponent <DosBox>().GetActorMemoryAddress(index);
            byte[] position = new byte[2];
            Utils.WriteShort(angle, position, 0);
            ProcessReader.Write(position, offset + 42, 2);

            warpActor.Angles.y = angle;
        }
    }