コード例 #1
0
ファイル: ListTests.cs プロジェクト: Gosed/HomeWorks
 public void DeleteTest()
 {
     PointerList list = new PointerList();
     list.Add(4);
     list.Delete(4);
     Assert.IsTrue(list.IsEmpty());
     list.Add(4);
     list.Delete(48);
 }
コード例 #2
0
        protected override void ReadInternal(Reader reader)
        {
            off_entries     = Pointer.Read(reader);
            off_skin_memory = Pointer.Read(reader);
            sz_skin_memory  = reader.ReadUInt32();

            geometricObjects = Load.FromOffsetOrRead <PointerList <GeometricObject> >(reader, off_entries, onPreRead: l => l.length = length);

            //skinnedGeometricObjects = Load.ReadArray<GeometricObject>(length, reader, off_geometric_skin);
        }
コード例 #3
0
        private void PointerList_OnNewPathGenerated(PointerList pointerList, List <Int64> path_offset, List <Pointer> path_address)
        {
            if (path_address.Count > 0)
            {
                Int32 baseSectionID = ProcessManager.mInstance.MappedSectionList.GetMappedSectionID(path_address[path_offset.Count - 1].Address);
                if (fastScan && !ProcessManager.mInstance.MappedSectionList[baseSectionID].Name.StartsWith("executable"))
                {
                    return;
                }

                ScannerThreadUIUpdateInfo view_info = new ScannerThreadUIUpdateInfo(path_offset, path_address, baseSectionID);
                bgWorkerScanner.ReportProgress(95, view_info);
            }
        }
コード例 #4
0
    public void Init()
    {
        R2PS1Loader l = MapLoader.Loader as R2PS1Loader;

        h   = l.levelHeader;
        a1h = l.actor1Header;
        a2h = l.actor2Header;
        if (perso != null && perso.p3dData != null && perso.p3dData.family != null)
        {
            Family fam = perso.p3dData.family;
            if (fam.animations != null)
            {
                PointerList <State> statePtrs  = l.GetStates(perso.p3dData);
                State[]             tempStates = statePtrs.pointers.Select(s => s.Value).ToArray();
                int ind = (int)perso.p3dData.stateIndex;
                if (ind >= tempStates.Length)
                {
                    ind = 0;
                }
                int stateInd = ind;

                states        = fam.states;
                stateNames    = new string[states.Length + 1 + fam.animations.Length];
                stateNames[0] = "Null";
                for (int i = 0; i < states.Length; i++)
                {
                    State s = states[i];
                    stateNames[i + 1] = (s.anim == null || s.anim.index >= fam.animations.Length) ? "Null" : $"State {Array.IndexOf(tempStates, s)}: {fam.animations[s.anim.index].name}";
                }
                for (int i = 0; i < fam.animations.Length; i++)
                {
                    stateNames[i + 1 + states.Length] = $"(Animation {i}) {fam.animations[i].name}";
                }
                hasStates  = true;
                stateIndex = stateInd - (int)fam.startState;
                stateIndex++;                 // After null
                currentState = stateIndex;
                SetState(stateIndex);
            }
        }
        IsLoaded = true;
    }
コード例 #5
0
    public override StateTransition[] GetStateTransitions(int index)
    {
        if (index < 1 || index >= 1 + states.Length)
        {
            return(null);
        }
        State state = states[index - 1];

        if (state != null && state.transitions != null && state.transitions.Length > 0)
        {
            R2PS1Loader            l         = MapLoader.Loader as R2PS1Loader;
            PointerList <State>    statePtrs = l.GetStates(perso.p3dData);
            State[]                states    = statePtrs.pointers.Select(s => s.Value).ToArray();
            List <StateTransition> tr        = new List <StateTransition>();
            foreach (OpenSpace.PS1.StateTransition t in state.transitions)
            {
                State stateToGo   = t.stateToGo.Value;
                State targetState = t.targetState.Value;
                if (stateToGo == null || targetState == null)
                {
                    continue;
                }
                string targetStateName = GetStateName(targetState);
                string stateToGoName   = GetStateName(stateToGo);
                if (targetStateName != null && stateToGoName != null)
                {
                    tr.Add(new StateTransition()
                    {
                        StateToGoName    = stateToGoName,
                        StateToGoIndex   = GetStateIndex(stateToGo),
                        TargetStateName  = targetStateName,
                        TargetStateIndex = GetStateIndex(targetState),
                        LinkingType      = 0
                    });
                }
            }
            return(tr.ToArray());
        }
        return(null);
    }
コード例 #6
0
        protected override void ReadInternal(Reader reader)
        {
            R2PS1Loader l = Load as R2PS1Loader;

            if (Settings.s.game == Settings.Game.RRush)
            {
                off_superObject = Pointer.Read(reader);
            }
            else if (Settings.s.game == Settings.Game.JungleBook)
            {
                reader.ReadBytes(0x98);
            }
            copiedActorData              = reader.ReadBytes(0x18);
            off_states                   = Pointer.Read(reader);
            num_states                   = reader.ReadUInt16();
            ushort_22                    = reader.ReadUInt16();
            off_animPositions            = Pointer.Read(reader);  // 0x6 size
            off_animRotations            = Pointer.Read(reader);  // big array of structs of 0x8 size. 4 ushorts per struct
            off_animScales               = Pointer.Read(reader);
            off_geometricObjects_dynamic = Pointer.Read(reader);
            num_geometricObjects_dynamic = reader.ReadUInt32();
            if (Settings.s.game == Settings.Game.RRush)
            {
                ushort_38         = reader.ReadUInt16();
                ushort_3A         = reader.ReadUInt16();
                off_state_indices = Pointer.Read(reader);
            }
            // Parse
            states = Load.FromOffsetOrRead <PointerList <State> >(reader, off_states, s => s.length = num_states);
            geometricObjectsDynamic = Load.FromOffsetOrRead <ObjectsTable>(reader, off_geometricObjects_dynamic, onPreRead: t => t.length = num_geometricObjects_dynamic - 2);
            animPositions           = Load.ReadArray <PS1AnimationVector>((off_animRotations.offset - off_animPositions.offset) / 6, reader, off_animPositions);
            animRotations           = Load.ReadArray <PS1AnimationQuaternion>((off_animScales.offset - off_animRotations.offset) / 8, reader, off_animRotations);
            animScales = Load.ReadArray <PS1AnimationVector>(l.maxScaleVector[file_index] + 1, reader, off_animScales);

            //Load.print(off_geometricObjects_dynamic + " - " + num_geometricObjects_dynamic);
        }
コード例 #7
0
ファイル: ParameterManager.cs プロジェクト: leodeg/Ghurund
 public ParameterManager(IntPtr ptr) : base(ptr)
 {
     Parameters = new PointerList <Parameter>(ParameterManager_getParameters(NativePtr), p => new Parameter(p));
 }
コード例 #8
0
ファイル: ParameterManager.cs プロジェクト: leodeg/Ghurund
 public ParameterManager()
 {
     Parameters = new PointerList <Parameter>(ParameterManager_getParameters(NativePtr), p => new Parameter(p));
 }
コード例 #9
0
        protected override void ReadInternal(Reader reader)
        {
            R2PS1Loader l = Load as R2PS1Loader;

            if (Settings.s.game == Settings.Game.RRush)
            {
                reader.ReadBytes(0x40);
            }
            else if (Settings.s.game == Settings.Game.DD)
            {
                reader.ReadBytes(0x58);
            }
            else if (Settings.s.game == Settings.Game.VIP)
            {
                reader.ReadBytes(0x28);
            }
            else if (Settings.s.game == Settings.Game.JungleBook)
            {
                reader.ReadBytes(0xEC);
            }
            else
            {
                reader.ReadBytes(0xCC);
                num_geometricObjectsDynamic_cine = reader.ReadUInt32();
                reader.ReadBytes(0x20);                 // after this we're at 0xf0
            }
            off_dynamicWorld         = Pointer.Read(reader);
            off_fatherSector         = Pointer.Read(reader);
            off_inactiveDynamicWorld = Pointer.Read(reader);
            num_always    = reader.ReadUInt32();
            off_always    = Pointer.Read(reader);          //
            num_wayPoints = reader.ReadUInt32();           // x
            num_graphs    = reader.ReadUInt32();
            off_wayPoints = Pointer.Read(reader);          // x structs of 0x14 waypoints
            off_graphs    = Pointer.Read(reader);          // graphs. structs of 0x68
            num_persos    = reader.ReadUInt16();
            ushort_116    = reader.ReadUInt16();
            off_persos    = Pointer.Read(reader);
            Load.print(off_dynamicWorld + " - " + off_fatherSector + " - " + off_inactiveDynamicWorld + " - " + off_always + " - " + off_wayPoints + " - " + off_graphs + " - " + off_persos);
            off_states      = Pointer.Read(reader);
            num_states      = reader.ReadUInt16();
            ushort_122      = reader.ReadUInt16();
            uint_124        = reader.ReadUInt32();
            uint_128        = reader.ReadUInt32();
            off_12C         = Pointer.Read(reader);     // this + 0x10 = main character
            off_130         = Pointer.Read(reader);
            uint_134        = reader.ReadUInt32();
            uint_138        = reader.ReadUInt32();
            uint_13C        = reader.ReadUInt32();      // same as mainChar_states count
            uint_140        = reader.ReadUInt32();
            uint_144        = reader.ReadUInt32();
            initialStreamID = reader.ReadInt32();             // -1
            Load.print(Pointer.Current(reader));
            off_animPositions = Pointer.Read(reader);         // 0x6 size
            off_animRotations = Pointer.Read(reader);         // big array of structs of 0x8 size. 4 ushorts per struct
            off_animScales    = Pointer.Read(reader);
            Load.print(off_12C + " - " + off_130 + " - " + off_animPositions + " - " + off_animRotations + " - " + off_animScales);
            //Load.print(Pointer.Current(reader));
            if (Settings.s.game == Settings.Game.DD)
            {
                // Also stuff for big textures, but names and amount is stored in exe
                Pointer.Read(reader);
                Pointer.Read(reader);
                Pointer.Read(reader);
                Pointer.Read(reader);
                Pointer.Read(reader);
                reader.ReadUInt32();
                reader.ReadUInt32();
                Pointer.Read(reader);

                off_geometricObjects_dynamic = Pointer.Read(reader);
                num_skinnableObjects         = reader.ReadUInt32();
                int num_skins = 5;
                off_skins = new Pointer[num_skins];
                skins     = new SkinnableGeometricObjectList[num_skins];
                for (int i = 0; i < num_skins; i++)
                {
                    off_skins[i] = Pointer.Read(reader);
                    skins[i]     = Load.FromOffsetOrRead <SkinnableGeometricObjectList>(reader, off_skins[i], onPreRead: s => s.length = num_skinnableObjects);
                }
                off_current_skin_memory = Pointer.Read(reader);
                reader.ReadUInt32();                 // total skin memory size?
                off_geometricObjects_static  = Pointer.Read(reader);
                num_geometricObjects_dynamic = reader.ReadUInt32();
            }
            else if (Settings.s.game == Settings.Game.VIP || Settings.s.game == Settings.Game.JungleBook)
            {
                reader.ReadUInt32();
                reader.ReadUInt32();
                reader.ReadUInt32();
                reader.ReadUInt32();
                reader.ReadUInt32();
                off_geometricObjects_dynamic = Pointer.Read(reader);
                off_geometricObjects_static  = Pointer.Read(reader);
                num_geometricObjects_dynamic = reader.ReadUInt32();
            }
            else
            {
                // Vignette stuff, big textures
                num_ui_textures          = reader.ReadByte();
                byte_159                 = reader.ReadByte();
                ushort_15A               = reader.ReadUInt16();
                off_ui_textures_names    = Pointer.Read(reader);
                off_ui_textures_width    = Pointer.Read(reader);              // num_vignettes * ushort
                off_ui_textures_height   = Pointer.Read(reader);              // num_vignettes * ushort
                off_ui_textures_pageInfo = Pointer.Read(reader);              // num_vignettes * ushort
                off_ui_textures_palette  = Pointer.Read(reader);
                off_ui_textures_xInPage  = Pointer.Read(reader);
                off_ui_textures_yInPage  = Pointer.Read(reader);                // still related to the vignette stuff

                ParseUITextures(reader);

                // Something else
                off_178 = Pointer.Read(reader);
                int_17C = reader.ReadInt32();                 // -1

                off_geometricObjects_dynamic = Pointer.Read(reader);
                off_geometricObjects_static  = Pointer.Read(reader);
                num_geometricObjects_dynamic = reader.ReadUInt32();
            }
            if (Settings.s.game != Settings.Game.VIP)
            {
                ushort_18C       = reader.ReadUInt16();
                ushort_18E       = reader.ReadUInt16();
                short_190        = reader.ReadInt16();
                ushort_192       = reader.ReadUInt16();
                num_ipoCollision = reader.ReadUInt32();                 // y
                off_ipoCollision = Pointer.Read(reader);                // y structs of 0x3c
                //Load.print(off_ipoCollision + " - " + num_ipoCollision);
                num_meshCollision = reader.ReadUInt32();

                /*if (num_meshCollision > 0) {
                 *      Load.print(num_meshCollision);
                 *      off_meshCollision = Pointer.Read(reader);
                 * } else {*/
                off_meshCollision_ = reader.ReadUInt32();
                //}
            }
            else
            {
                ushort_18C = reader.ReadUInt16();
                ushort_18E = reader.ReadUInt16();
                short_190  = reader.ReadInt16();
                ushort_192 = reader.ReadUInt16();
                reader.ReadUInt32();                 // y
                reader.ReadUInt32();
                reader.ReadUInt32();
                reader.ReadUInt32();                 //Pointer.Read(reader);
            }
            off_sectors = Pointer.Read(reader);      // num_1A8 structs of 0x54
            num_sectors = reader.ReadUInt16();       // actual sectors
            //Load.print(off_sector_minus_one_things + " - " + bad_off_1A0 + " - " + off_sectors);

            ushort_1AA = reader.ReadUInt16();
            Load.print(Pointer.Current(reader));
            if (Settings.s.game != Settings.Game.DD)
            {
                num_cameraModifiers = reader.ReadUInt32();
                uint_1B0            = reader.ReadUInt32();
                uint_1B4            = reader.ReadUInt32();
                uint_1B8            = reader.ReadUInt32();
                if (Settings.s.game != Settings.Game.VIP)
                {
                    off_cameraModifiers_volumes = Pointer.Read(reader);             // uint_1B4 * 0x70
                    off_cameraModifiers         = Pointer.Read(reader);             // uint_1ac * 0x68. lights? first with type (first byte) = 9 is camera related? position is at 0x14, 0x18, 0x1c?
                }
                else
                {
                    reader.ReadUInt32();
                    reader.ReadUInt32();
                }

                if (Settings.s.game == Settings.Game.RRush)
                {
                    off_rush_114    = Pointer.Read(reader);
                    ushort_rush_118 = reader.ReadUInt16();
                    ushort_rush_11A = reader.ReadUInt16();
                }
            }

            off_gameMaterials         = Pointer.Read(reader);
            num_gameMaterials         = reader.ReadUInt32();
            uint_1CC                  = reader.ReadUInt32();
            ushort_1D0                = reader.ReadUInt16();
            ushort_1D2                = reader.ReadUInt16();
            off_1D4                   = Pointer.Read(reader);
            num_ago_textures          = reader.ReadUInt32();
            off_ago_textures_pageInfo = Pointer.Read(reader);
            off_ago_textures_palette  = Pointer.Read(reader);
            off_ago_textures_xInPage  = Pointer.Read(reader);
            off_ago_textures_yInPage  = Pointer.Read(reader);
            off_ago_textures_globalX  = Pointer.Read(reader);
            off_ago_textures_globalY  = Pointer.Read(reader);
            if (Settings.s.game == Settings.Game.RRush)
            {
                off_ago_textures_width  = Pointer.Read(reader);
                off_ago_textures_height = Pointer.Read(reader);
                //Load.print(Pointer.Current(reader));
                ParseAGOTextures(reader);
            }
            else if (Settings.s.game == Settings.Game.R2)
            {
                uint_1F4 = reader.ReadUInt32();
                uint_1F8 = reader.ReadUInt32();
                uint_1FC = reader.ReadUInt32();
                ParseAGOTextures(reader);
            }

            // Parse
            states = Load.FromOffsetOrRead <PointerList <State> >(reader, off_states, s => s.length = num_states);
            persos = Load.ReadArray <Perso>(num_persos, reader, off_persos);
            geometricObjectsDynamic = Load.FromOffsetOrRead <ObjectsTable>(reader, off_geometricObjects_dynamic, onPreRead: t => t.length = num_geometricObjects_dynamic - 2);
            geometricObjectsStatic  = Load.FromOffsetOrRead <ObjectsTable>(reader, off_geometricObjects_static, onPreRead: t => {
                if (Settings.s.game == Settings.Game.R2)
                {
                    t.length = num_ipoCollision;
                }
            });
            ipoCollision          = Load.ReadArray <GeometricObjectCollide>(num_ipoCollision, reader, off_ipoCollision);
            meshCollision         = Load.ReadArray <GeometricObjectCollide>(num_meshCollision, reader, off_meshCollision);
            gameMaterials         = Load.ReadArray <GameMaterial>(num_gameMaterials, reader, off_gameMaterials);
            wayPoints             = Load.ReadArray <WayPoint>(num_wayPoints, reader, off_wayPoints);
            graphs                = Load.ReadArray <Graph>(num_graphs, reader, off_graphs);
            cameraModifiers       = Load.ReadArray <CameraModifier>(num_cameraModifiers, reader, off_cameraModifiers);
            cameraModifierVolumes = Load.ReadArray <CameraModifierVolume>(num_cameraModifiers, reader, off_cameraModifiers_volumes);
            always                = Load.ReadArray <AlwaysList>(num_always, reader, off_always);
            sectors               = Load.ReadArray <Sector>(num_sectors, reader, off_sectors);

            animPositions = Load.ReadArray <PS1AnimationVector>((off_animRotations.offset - off_animPositions.offset) / 6, reader, off_animPositions);
            animRotations = Load.ReadArray <PS1AnimationQuaternion>((off_animScales.offset - off_animRotations.offset) / 8, reader, off_animRotations);
            animScales    = Load.ReadArray <PS1AnimationVector>(l.maxScaleVector[0] + 1, reader, off_animScales);
        }
コード例 #10
0
ファイル: Renderer.cs プロジェクト: leodeg/Ghurund
 public Renderer(IntPtr ptr) : base(ptr)
 {
     Steps = new PointerList <RenderStep>(Renderer_getSteps(NativePtr), p => new RenderStep(p));
 }
コード例 #11
0
ファイル: Renderer.cs プロジェクト: leodeg/Ghurund
 public Renderer()
 {
     Steps = new PointerList <RenderStep>(Renderer_getSteps(NativePtr), p => new RenderStep(p));
 }
コード例 #12
0
ファイル: RenderStep.cs プロジェクト: leodeg/Ghurund
 public RenderStep(IntPtr ptr) : base(ptr)
 {
     Entities = new PointerList <Entity>(RenderStep_getEntities(NativePtr), p => Game.Entities.MakeEntity(p));
 }
コード例 #13
0
ファイル: ListTests.cs プロジェクト: Gosed/HomeWorks
 public void DeleteTest()
 {
     PointerList list = new PointerList();
     list.Delete(56);
 }
コード例 #14
0
ファイル: ListTests.cs プロジェクト: Gosed/HomeWorks
 public void AddTest()
 {
     PointerList list = new PointerList();
     list.Add(7);
     Assert.IsFalse(list.IsEmpty());
 }