コード例 #1
0
ファイル: CSharpContext.cs プロジェクト: crazyants/Odachi
        public void Save(string path)
        {
            foreach (var package in Packages)
            {
                foreach (var module in package.Modules)
                {
                    foreach (var fragment in module.Fragments)
                    {
                        foreach (var mapping in fragment.CreateMappings(this, package, module))
                        {
                            if (Mapping.Any(m => m.Type == mapping.Type))
                            {
                                throw new InvalidOperationException($"Mapping for type '{mapping.Type}' already exists");
                            }

                            Mapping.Add(mapping);
                        }
                    }
                }
            }

            foreach (var package in Packages)
            {
                var packagePath = Path.Combine(path, package.Name);

                package.Save(this, packagePath);
            }
        }
コード例 #2
0
        public MyCatSchemaCollection(DataTable dt) : this()
        {
            // cache the original datatable to avoid the overhead of creating again whenever possible.
            _table = dt;
            int i = 0;

            foreach (DataColumn dc in dt.Columns)
            {
                columns.Add(new SchemaColumn()
                {
                    Name = dc.ColumnName, Type = dc.DataType
                });
                Mapping.Add(dc.ColumnName, i++);
                LogicalMappings[columns.Count - 1] = columns.Count - 1;
            }

            foreach (DataRow dr in dt.Rows)
            {
                MyCatSchemaRow row = new MyCatSchemaRow(this);
                for (i = 0; i < columns.Count; i++)
                {
                    row[i] = dr[i];
                }
                rows.Add(row);
            }
        }
コード例 #3
0
 private static void AddClasses(Mapping map, IEnumerable <TypeDefinition> types)
 {
     foreach (TypeDefinition type in types.Where(t => t.IsClass && !t.IsAbstract))
     {
         map.Add(type, type, DuplicateKeyBehavior.RemoveAll, Lifetime.Transient);
     }
 }
コード例 #4
0
        public void Rename(string fromName, string toName)
        {
            OntologyAttribute ontology = store[fromName];

            store.Remove(fromName);
            store.Add(toName, ontology);
        }
コード例 #5
0
    private void AddSettingsMap(Settings settings, Mapping map, IEnumerable <TypeDefinition> types)
    {
        Dictionary <string, TypeDefinition> allTypes = types.ToDictionary(x => x.FullName);

        foreach (string typeName in allTypes.Keys)
        {
            foreach (Map settingsMap in settings.Maps)
            {
                if (settingsMap.TryGetMap(allTypes[typeName], out string mappedType))
                {
                    if (allTypes.TryGetValue(mappedType, out TypeDefinition mapped))
                    {
                        if (settingsMap.Force || CanBeCastToType(allTypes[typeName], mapped))
                        {
                            map.Add(allTypes[typeName], mapped, DuplicateKeyBehavior.Replace, settingsMap.Lifetime);
                        }
                        else
                        {
                            InternalLogDebug($"Found map '{typeName}' => '{mappedType}', but {mappedType} cannot be cast to '{typeName}'. Ignoring.", DebugLogLevel.Verbose);
                        }
                    }
                    else
                    {
                        InternalLogDebug($"Found map '{typeName}' => '{mappedType}', but {mappedType} does not exist. Ignoring.", DebugLogLevel.Verbose);
                    }
                }
            }
        }
        map.UpdateCreation(settings.Types);
    }
コード例 #6
0
    private static void AddSingleInterfaceImplementation(Mapping map, IEnumerable <TypeDefinition> allTypes)
    {
        var types = new Dictionary <TypeReference, List <TypeDefinition> >(TypeComparer.FullName);

        foreach (TypeDefinition type in allTypes.Where(t => t.IsClass && !t.IsAbstract))
        {
            foreach (var @interface in type.Interfaces)
            {
                if (!types.TryGetValue(@interface.InterfaceType, out List <TypeDefinition> list))
                {
                    types.Add(@interface.InterfaceType, list = new List <TypeDefinition>());
                }
                list.Add(type);
                //TODO: Base types
            }
        }

        foreach (KeyValuePair <TypeReference, List <TypeDefinition> > kvp in types)
        {
            if (kvp.Value.Count != 1)
            {
                continue;
            }
            map.Add(kvp.Key.Resolve(), kvp.Value[0], DuplicateKeyBehavior.RemoveAll, Lifetime.LazySingleton);
        }
    }
コード例 #7
0
        // Mapping

        public WriterConventions AddWriter(Action <object, ObjectNodeBase, INode, Options> writer,
                                           Func <object, ObjectNodeBase, INode, Options, bool> when)
        {
            Mapping.Add((s, t, o) => writer(s.Value, s, t, o),
                        (s, t, o) => when(s.Value, s, t, o));
            return(this);
        }
コード例 #8
0
 public WriterConventions AddWriter <T>(Action <T, ObjectNodeBase, INode, Options> writer,
                                        Func <T, ObjectNodeBase, INode, Options, bool> where)
 {
     Mapping.Add((s, t, o) => writer(s.Value.As <T>(), s, t, o),
                 (s, t, o) => s.ActualType.Type.CanBeCastTo <T>() && where (s.Value.As <T>(), s, t, o));
     return(this);
 }
コード例 #9
0
        private void SerializeMapping(Mapping mapping)
        {
            var keys = new List <Node>(mapping.Keys);

            foreach (var node in keys)
            {
                Node key   = node;
                Node value = mapping[key];

                if (anchorList.Contains(key))
                {
                    Alias aliasKey = anchorList.GetAlias(key);
                    mapping.Remove(key);
                    mapping.Add(aliasKey, value);
                    key = aliasKey;
                }
                else
                {
                    Serialize(key);
                }

                if (anchorList.Contains(value))
                {
                    Alias aliasValue = anchorList.GetAlias(value);
                    mapping[key] = aliasValue;
                }
                else
                {
                    Serialize(value);
                }
            }
        }
コード例 #10
0
ファイル: MM_Element.cs プロジェクト: sylvainr/MacomberMap
        /// <summary>
        /// Create a new element
        /// </summary>
        /// <param name="TEID"></param>
        /// <param name="ElemType"></param>
        /// <param name="AddIfNew"></param>
        ///  <param name="BaseElement"></param>
        ///  <param name="mI"></param>
        /// <returns></returns>
        public static MM_Element CreateElement(Int32 TEID, Type ElemType, bool AddIfNew, MM_Element BaseElement, MemberInfo mI)
        {
            MM_Element OutElement;

            if (MM_Repository.TEIDs.TryGetValue(TEID, out OutElement))
            {
                return(OutElement);
            }

            OutElement      = Activator.CreateInstance(ElemType) as MM_Element;
            OutElement.TEID = TEID;

            if (AddIfNew)
            {
                MM_Repository.TEIDs.Add(TEID, OutElement);
                if (ElemType == typeof(MM_Element) || OutElement.ElemType == null)
                {
                    Dictionary <MM_Element, MemberInfo> Mapping;
                    if (!UnknownElements.TryGetValue(TEID, out Mapping))
                    {
                        UnknownElements.Add(TEID, Mapping = new Dictionary <MM_Element, MemberInfo>(5));
                    }
                    Mapping.Add(BaseElement, mI);
                }
            }
            return(OutElement);
        }
コード例 #11
0
        public void AddMapping(ScalarProperty property, SSDL.Property.Property column)
        {
            if (property == null || column == null)
            {
                throw new ArgumentNullException();
            }

            if (Mapping.ContainsKey(property))
            {
                var propertyMapping = Mapping[property];
                if (propertyMapping.ContainsKey(column.EntityType))
                {
                    propertyMapping[column.EntityType] = column;
                }
                else
                {
                    propertyMapping.Add(column.EntityType, column);
                }
            }
            else
            {
                Mapping.Add(property, new Dictionary <SSDL.EntityType.EntityType, SSDL.Property.Property>()
                {
                    { column.EntityType, column }
                });
            }
            EntityType.Mapping.OnPropertyChanged("IsCompletlyMapped");
        }
コード例 #12
0
 static AbstractMapping()
 {
     foreach (var item in Enum.GetValues(typeof(HttpMethod)))
     {
         HttpMethod castItem = (HttpMethod)item;
         Mapping.Add(castItem, new Dictionary <string, MappingInfo <AbstractMapping> >());
     }
 }
コード例 #13
0
 protected void CreateMappingForProfileBase(string key, string value)
 {
     Mapping.Add(new MappingElement
     {
         Key   = key,
         Value =
             JsonConvert.DeserializeObject <MappingLookup>(value)
     });
 }
コード例 #14
0
        public override void UpdatePropertiesFrom(IUpdatable source, ICloneManager cloneManager)
        {
            base.UpdatePropertiesFrom(source, cloneManager);
            var valueMapping = source as ValueMappingGroupingDefinition;

            if (valueMapping == null)
            {
                return;
            }
            valueMapping.Mapping.KeyValues.Each(kv => Mapping.Add(kv.Key, cloneManager.Clone(kv.Value)));
        }
コード例 #15
0
ファイル: TypeMap.cs プロジェクト: ARLM-Attic/cs-native
 internal TypeMap(NamedTypeSymbol containingType, ImmutableArray <TypeParameterSymbol> typeParameters, ImmutableArray <TypeSymbol> typeArguments)
     : base(ForType(containingType))
 {
     for (int i = 0; i < typeParameters.Length; i++)
     {
         TypeParameterSymbol tp = typeParameters[i];
         TypeSymbol          ta = typeArguments[i];
         if (!ReferenceEquals(tp, ta))
         {
             Mapping.Add(tp, ta);
         }
     }
 }
コード例 #16
0
ファイル: TypeMap.cs プロジェクト: stark-lang/stark
 internal TypeMap(NamedTypeSymbol containingType, ImmutableArray <TypeParameterSymbol> typeParameters, ImmutableArray <TypeSymbolWithAnnotations> typeArguments)
     : base(ForType(containingType))
 {
     for (int i = 0; i < typeParameters.Length; i++)
     {
         TypeParameterSymbol       tp = typeParameters[i];
         TypeSymbolWithAnnotations ta = typeArguments[i];
         if (!ta.Is(tp))
         {
             Mapping.Add(tp, ta);
         }
     }
 }
コード例 #17
0
    private static void AddBaseClasses(Mapping map, IEnumerable <TypeDefinition> types)
    {
        TypeDefinition GetBaseType(TypeDefinition type)
        {
            return(type.BaseType?.Resolve());
        }

        foreach (TypeDefinition type in types.Where(t => t.IsClass && !t.IsAbstract && t.BaseType != null))
        {
            for (TypeDefinition t = GetBaseType(type); t != null; t = GetBaseType(t))
            {
                if (t.FullName != typeof(object).FullName)
                {
                    map.Add(t, type, DuplicateKeyBehavior.RemoveAll, Lifetime.Transient);
                }
            }
        }
    }
コード例 #18
0
        public virtual void MapInput()
        {
            var enumInts = Enum.GetValues(typeof(TArguments)).Cast <int>().ToList();

            if (!enumInts.Any())
            {
                return;
            }
            if (Context.MsgArray.Count >= enumInts.Max())
            {
                var enums = Enum.GetValues(typeof(TArguments)).Cast <TArguments>().ToList();
                for (int i = 0; i <= enumInts.Max(); i++)
                {
                    var enumtype = enums[i];
                    Mapping.Add(enumtype, Context.MsgArray[i]);
                }
            }
        }
コード例 #19
0
ファイル: CSharpContext.cs プロジェクト: crazyants/Odachi
 public CSharpContext()
 {
     Mapping.Add(new CSharpMapping(typeof(bool)));
     Mapping.Add(new CSharpMapping(typeof(sbyte)));
     Mapping.Add(new CSharpMapping(typeof(byte)));
     Mapping.Add(new CSharpMapping(typeof(short)));
     Mapping.Add(new CSharpMapping(typeof(ushort)));
     Mapping.Add(new CSharpMapping(typeof(int)));
     Mapping.Add(new CSharpMapping(typeof(uint)));
     Mapping.Add(new CSharpMapping(typeof(float)));
     Mapping.Add(new CSharpMapping(typeof(double)));
     Mapping.Add(new CSharpMapping(typeof(decimal)));
     Mapping.Add(new CSharpMapping(typeof(string)));
     Mapping.Add(new CSharpMapping(typeof(DateTime)));
     Mapping.Add(new CSharpMapping(typeof(Nullable <>)));
     Mapping.Add(new CSharpMapping(typeof(IEnumerable <>)));
     Mapping.Add(new CSharpMapping(typeof(ICollection <>)));
 }
コード例 #20
0
        internal override bool ParseNodeBodyElement(string id, VRMLParser parser)
        {
            int line = parser.Line;

            if (id == "address")
            {
                Address = parser.ParseStringValue();
            }
            else if (id == "applicationID")
            {
                ApplicationID = parser.ParseIntValue();
            }
            else if (id == "mapping")
            {
                List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue();
                foreach (X3DNode node in nodes)
                {
                    IX3DDISEntityTypeMappingNode disetm = node as IX3DDISEntityTypeMappingNode;
                    if (disetm == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                    else
                    {
                        Mapping.Add(disetm);
                    }
                }
            }
            else if (id == "port")
            {
                Port = parser.ParseIntValue();
            }
            else if (id == "siteID")
            {
                SiteID = parser.ParseIntValue();
            }
            else
            {
                return(false);
            }
            return(true);
        }
コード例 #21
0
    private Mapping CreateMappingFromInput()
    {
        ListItem externalItem = ExternalAttributeDropDownListEx.SelectedItem;
        Mapping  mapping      = new Mapping
        {
            ExternalIdentifierAttributeName  = (externalItem != null ? externalItem.Value : String.Empty),
            ExternalIdentifierAttributeLabel = (externalItem != null ? externalItem.Text : String.Empty)
        };

        foreach (MappingEditorItem control in MappingItems.Values)
        {
            MappingItem item = control.MappingItem;
            if (item != null)
            {
                mapping.Add(item);
            }
        }

        return(mapping);
    }
コード例 #22
0
            private void TryAddValue(object value)
            {
#if NETSTANDARD1_4
                if (value == null)
#else
                if (value == null || value is DBNull)
#endif
                {
                    if (!hasMissingValue)
                    {
                        hasMissingValue = true;
                        missingValue    = (T)System.Convert.ChangeType(null, typeof(T));
                    }
                }
                else
                {
                    T key = (T)value;
                    if (!Mapping.ContainsKey(key))
                    {
                        Mapping.Add(key, Mapping.Count); // And register the String->Integer mapping
                    }
                }
            }
コード例 #23
0
            /// <summary>
            /// Learns a model that can map the given inputs to the desired outputs.
            /// </summary>
            /// <param name="x">The model inputs.</param>
            /// <param name="weights">The weight of importance for each input sample.</param>
            /// <returns>A model that has learned how to produce suitable outputs
            /// given the input data <paramref name="x" />.</returns>
            /// <exception cref="System.ArgumentException">Weights are not supported and should be null.</exception>
            public Options Learn(DataTable x, double[] weights = null)
            {
                if (weights != null)
                {
                    throw new ArgumentException("Weights are not supported and should be null.");
                }

                this.NumberOfInputs  = 1;
                this.NumberOfOutputs = 1;

                if (CanBeCodified)
                {
                    // Do a select distinct to get distinct values
                    DataTable d = x.DefaultView.ToTable(true, ColumnName);

                    // For each distinct value, create a corresponding integer
                    for (int i = 0; i < d.Rows.Count; i++)
                    {
                        Mapping.Add((T)d.Rows[i][0], i); // And register the String->Integer mapping
                    }
                }

                return(this);
            }
コード例 #24
0
 public ReaderConventions AddReader <T>(Action <INode, ObjectNodeBase, Options> reader, bool includeNullable) where T : struct
 {
     Mapping.Add(reader, (s, t, o) => t.SpecifiedType.Type.CanBeCastTo <T>(includeNullable));
     return(this);
 }
コード例 #25
0
    private Mapping CreateMappingFromInput()
    {
        ListItem externalItem = ExternalAttributeDropDownListEx.SelectedItem;
        Mapping mapping = new Mapping
        {
            ExternalIdentifierAttributeName = (externalItem != null ? externalItem.Value : String.Empty),
            ExternalIdentifierAttributeLabel = (externalItem != null ? externalItem.Text : String.Empty)
        };
        foreach (MappingEditorItem control in MappingItems.Values)
        {
            MappingItem item = control.MappingItem;
            if (item != null)
            {
                mapping.Add(item);
            }
        }

        return mapping;
    }
コード例 #26
0
        // Readers

        public ReaderConventions AddReader(Action <INode, ObjectNodeBase, Options> reader,
                                           Func <INode, ObjectNodeBase, Options, bool> when)
        {
            Mapping.Add(reader, when);
            return(this);
        }
コード例 #27
0
ファイル: TKMapping.cs プロジェクト: TD-user/doorproject
        public TKMapping()
        {
            Mapping.Add("Id", new IJ()
            {
                I = 1, J = 10
            });
            Mapping.Add("Brigade", new IJ()
            {
                I = 5, J = 1
            });
            Mapping.Add("Date", new IJ()
            {
                I = 5, J = 12
            });
            Mapping.Add("OfficialPerson", new IJ()
            {
                I = 7, J = 4
            });
            Mapping.Add("OfficialForPrinting", new IJ()
            {
                I = 8, J = 4
            });
            Mapping.Add("BlockId", new IJ()
            {
                I = 11, J = 1
            });
            Mapping.Add("CuttingType", new IJ()
            {
                I = 11, J = 2
            });
            Mapping.Add("AdditionalInfo", new IJ()
            {
                I = 11, J = 4
            });
            Mapping.Add("Door1", new IJ()
            {
                I = 11, J = 6
            });
            Mapping.Add("Door2", new IJ()
            {
                I = 11, J = 8
            });
            Mapping.Add("DoorBox", new IJ()
            {
                I = 11, J = 10
            });
            Mapping.Add("Hinge1", new IJ()
            {
                I = 11, J = 12
            });
            Mapping.Add("Hinge2", new IJ()
            {
                I = 11, J = 13
            });
            Mapping.Add("HingeCount", new IJ()
            {
                I = 11, J = 14
            });
            Mapping.Add("LockType", new IJ()
            {
                I = 11, J = 15
            });
            Mapping.Add("InsertingSecret", new IJ()
            {
                I = 11, J = 17
            });
            Mapping.Add("DoorStep", new IJ()
            {
                I = 11, J = 19
            });
            Mapping.Add("Note", new IJ()
            {
                I = 11, J = 21
            });
            Mapping.Add("OrderNumber", new IJ()
            {
                I = 11, J = 23
            });

            Mapping.Add("TechnoCardValid", new IJ()
            {
                I = 1, J = 4
            });
            Mapping.Add("BlockValid", new IJ()
            {
                I = 10, J = 1
            });
            Mapping.Add("OrderValid", new IJ()
            {
                I = 10, J = 23
            });

            ValidationMap.Add(this.Mapping["TechnoCardValid"], "технологічна карта");
            ValidationMap.Add(this.Mapping["BlockValid"], "блок");
            ValidationMap.Add(this.Mapping["OrderValid"], "номер заказа");
        }
コード例 #28
0
ファイル: ProcessManager.cs プロジェクト: Kloppie5/Narrative
        public void Init_Mapping( )
        {
            // 433468 Stats
            // 433954 numStats
            // 433958 musicIndex2
            // 43395C musicIndex

            // [...]

            // Level variables:
            // > 433EC4 Array<Boolean> allCharsCompletion
            // > 433EC8 Array<Boolean> allCharsCompletionDLC
            // > 433ECC String todaysRandSeedString
            // > 433ED0 String randSeedString
            // > 433ED4 String justUnlocked
            // > 433ED8 Array<Single> constMapLightValues
            // > 433EDC Array<Single> mapLightValues

            // 433EE0 String GAMEDATA_VERSION
            mapping.Add("GAMEDATA_VERSION", new AddressRange <UInt32>("Memory", 0x433EE0));

            // Player variables:
            // > 433EE4 Array<Int32> AltHeadWidths
            // > 433EE8 Array<Int32> AltHeadHeights
            // > 433EEC String lastDeadlyDamageSource  <<<<< Cause of death

            // Audio variables:
            // > 433EF0 String songName
            // > 433EF4 String beatDataString
            // > 433EF8 Array<Int32> beatIndicatorData
            // > 433EFC Array<Int32> beatIndicatorFade
            // > 433F00 String beatDataString2
            // > 433F04 String lastSongName
            // > 433F08 String customPlayList

            // Input variables:
            mapping.Add("stickLeft", new AddressRange <UInt32>("Memory", 0x433F0C));  // Array<Boolean>
            mapping.Add("stickRight", new AddressRange <UInt32>("Memory", 0x433F10)); // Array<Boolean>
            mapping.Add("stickUp", new AddressRange <UInt32>("Memory", 0x433F14));    // Array<Boolean>
            mapping.Add("stickDown", new AddressRange <UInt32>("Memory", 0x433F18));  // Array<Boolean>
            // > 433F1C Array<Single> lastJoyX
            // > 433F20 Array<Single> lastJoyY
            // > 433F24 Array<Boolean> stickLeft2
            // > 433F28 Array<Boolean> stickRight2
            // > 433F2C Array<Boolean> stickUp2
            // > 433F30 Array<Boolean> stickDown2
            // > 433F34 Array<Single> lastJoyX2
            // > 433F38 Array<Single> lastJoyY2
            mapping.Add("movementBuffer", new AddressRange <UInt32>("Memory", 0x433F3C)); // Array<Int32>
            // > 433F40 Array<Int32> movementBufferFrame
            // > 433F44 Array<Int32> offbeatMovementBuffer
            // > 433F48 Array<Int32> offbeatMovementBufferFrame
            // > 433F4C Array<Int32> lastBeatMovedOn
            // > 433F50 Array<Int32> lastOffbeatMovedOn
            // > 433F54 Array<Int32> lastBeatMissed
            // > 433F58 Array<Int32> punishmentBeatToSkip
            // > 433F5C Array<Int32> punishmentBeatToSkipQueue
            mapping.Add("keysHitLastFrame", new AddressRange <UInt32>("Memory", 0x433F60)); // Array<Boolean>
            // > 433F64 Array<Boolean> keysHit2FramesAgo

            mapping.Add("bb_controller_game_players", new AddressRange <UInt32>("Memory", 0x433F68)); // Array<Player>

            // Item variables:
            // > 433F6C String lastChestItemClass1
            // > 433F70 String lastChestItemClass2
            // > 433F74 Array<Item> itemPoolChest
            // > 433F78 Array<Item> itemPoolChest2
            // > 433F7C Array<Item> itemPoolLockedChest
            // > 433F80 Array<Item> itemPoolLockedChest2
            // > 433F84 Array<Item> itemPoolAnyChest
            // > 433F88 Array<Item> itemPoolAnyChest2
            // > 433F8C Array<Item> itemPoolShop
            // > 433F90 Array<Item> itemPoolShop2
            // > 433F94 Array<Item> itemPoolLockedShop
            // > 433F98 Array<Item> itemPoolLockedShop2
            // > 433F9C Array<Item> itemPoolUrn
            // > 433FA0 Array<Item> itemPoolUrn2

            // 433FA4 String lastSaleItemClass1
            // 433FA8 String lastSaleItemClass2

            // 433FAC Array<Boolean> waitingForFirstMovement

            // Spells:
            // > 433FB0 String spellSlot1
            // > 433FB4 String spellSlot2
            // > 433FB8 Array<Sprite> fireballInWorld

            // 433FBC Array<Int32> bb_controller_game_beatData
            // 433FC0 String lastSavedReplayFile
            // 433FC4 Array<Int32> bb_controller_game_lastPlayerMoveBeat
            // 433FC8 NIL

            // [...]

            // 435578 List dopplegangers
            // 43557C Boolean showingBossIntro
            // 4355C8 List bombList
            // 4355CC List arrowList
            // 4355DC List allBatteries << Conductor boss
            // 43560C Map spellCoolKills
            // 435614 List currentSaleChests
            // 43561C Boolean anyPlayerHaveRingOfLuckCached
            // 43561D Boolean anyPlayerHaveRingOfShadowsCached
            // 43561E Boolean anyPlayerHaveCompassCached
            // 43561F Boolean anyPlayerHaveZoneMapCached
            mapping.Add("anyPlayerHaveMonocleCached", new AddressRange <UInt32>("Memory", 0x435628)); // Boolean
            // 435629 Boolean lastShrineVal
            // 43562A Boolean castingFireBall << Dragon
            // 43562B Boolean killingAllEnemies << WHAT?!
            // 43562C List pendingTilesList
            // 435630 List floorRecededList
            // 435634 List floorRisingList

            mapping.Add("camera_y", new AddressRange <UInt32>("Memory", 0x435670)); // Single
            mapping.Add("camera_x", new AddressRange <UInt32>("Memory", 0x435678)); // Single

            // 43569C Int32 lastGrooveLevel
            // 4356A0 Int32 lastGrooveColor
            // 4356AC List crateList
            // 4356B8 Int curExplosionKills
            // 4356CC List npcList
            // 4356D0 List currentSaleItems
            // 4356D4 List itemPoolRandom2
            // 4356D8 List itemPoolRandom
            // 4356DC List seenItems
            // 4356E4 List familiarList
            // 4356E8 List particleSystems
            // 4356EC List particlePool
            // 4356F4 Single CHARISMA_DISCOUNT
            // 4356F8 List shrineList
            // 4356FC Int32 usedShrinerInZone
            // 435700 IntSet usedShrines
            // 435704 Player noReturnShrinePlayer
            // 435708 Boolean noReturnShrineActive
            // 435709 Boolean warShrineActive
            mapping.Add("bb_controller_game_DEBUG_ALL_TILES_VISIBLE", new AddressRange <UInt32>("Memory", 0x43570A)); // Bool
            // 435769 Boolean bb_necrodancergame_CHRISTMAS_MODE
            mapping.Add("showMinimap", new AddressRange <UInt32>("Memory", 0x43576A));                                // Bool
            // 43576C Boolean bb_necrodancergame_DEBUG_STOP_ENEMY_MOVEMENT
            // 43576D Boolean riskShrineActive
            // 435770 Player lastActor
            // 435774 Player riskShrinePlayer
            // 435791 Boolean isMonstrous << Shopkeeper
            // 435792 Boolean rhythmShrineActive
            // 435798 Int32 shopkeeperStartX
            // 43579C Int32 shopkeeperStartY
            // 43589A Boolean anyPlayerHaveNazarCharmCached
            // 43589B Boolean anyPlayerHaveWallsTorchCached

            // 4358C8 Boolean anyPlayerHaveForesightTorchCached
            // 4358C9 Boolean anyPlayerHaveGlassTorchCached
            // 4358CA Boolean anyPlayerHaveCircletCached
            mapping.Add("anyPlayerHaveCircletCached", new AddressRange <UInt32>("Memory", 0x4358CA)); // Bool

            // 4358E0 Int32 bb_controller_game_totalPlaytimeMilliseconds

            // 4355D8 KingConga
            // 4358A8 Conductor theConductor
            // 4358C4 Nightmare nightmare
            // 4359DC Necrodancer necrodancer
            // 435A14 Shriner shriner


            // 435A8A Boolean seenLeprechaun
            // 435AA0 IntMap tiles
            // 435AE8 currentFloorRNG
            // 435AEC wholeRunRNG
            // 435AF4 UInt32 randSeed
            // 435B40 Boolean shopkeeperDead

            mapping.Add("currentScaleYOff", new AddressRange <UInt32>("Memory", 0x435B54));   // Int32
            mapping.Add("currentScaleXOff", new AddressRange <UInt32>("Memory", 0x435B58));   // Int32
            mapping.Add("currentScaleFactor", new AddressRange <UInt32>("Memory", 0x435B5C)); // Single

            // 435BB0 List familiarList <<< again?


            mapping.Add("bb_controller_game_player1", new AddressRange <UInt32>("Memory", 0x435BF0)); // UInt32
            // 435C0C Int32 bb_controller_game_currentZone
            // 435C10 String bb_controller_game_currentLevel

            // 435C20 UInt32 something
            // + 0x18 give management

            /*
             * ECX = object
             * EAX = vtable
             * call EAX + 0xc8
             * mov EAX [object + 18]
             * mov EAX [eax + esi*4 + 14]
             */

            // 433DE4
            // 433DEC
            // 0x433F68 Game
            // ] 0x14 + i * 0x4: Player
            // ] ] 0x14 Position X
            // ] ] 0x18 Position Y
            // ] ] 0x11C Character ID
            // ] ] 0x134 ] 0x10 Inventory red black tree
            // ] ] 0x15C Health Component
            // ] ] ] 0x1C Health Max
            // ] ] ] 0x20 Health Temp
            // ] ] ] 0x24 Heatlh Current
            // ] ] 0x19C Kills
            // ] ] 0x214 Bombs

            mapping.Add("SongTime", new AddressRange <UInt32>("Memory", 0x435808, 0x43580C));
            mapping.Add("PlayerTime", new AddressRange <UInt32>("Memory", 0x435810, 0x435814));

            mapping.Add("WorldTime", new AddressRange <UInt32>("Memory", 0x435864, 0x435868));
            mapping.Add("WallsVisible", new AddressRange <UInt32>("Memory", 0x43589B, 0x43589C));        // "ReadOnly"
            mapping.Add("SessionMaxGold", new AddressRange <UInt32>("Memory", 0x4358AC, 0x4358B0));
            mapping.Add("CoinXOR", new AddressRange <UInt32>("Memory", 0x4358B0, 0x4358B4));
            mapping.Add("Gold", new AddressRange <UInt32>("Memory", 0x4358B4, 0x4358B8));
            mapping.Add("EnemiesVisible", new AddressRange <UInt32>("Memory", 0x4358CA, 0x4358CB));      // "ReadOnly"
            mapping.Add("EntityCount", new AddressRange <UInt32>("Memory", 0x4358CC, 0x4358D0));
            mapping.Add("EntityList", new AddressRange <UInt32>("Memory", 0x4358D0, 0x4358D4));
            mapping.Add("DeadEntityList", new AddressRange <UInt32>("Memory", 0x4358DC, 0x4358E0));

            mapping.Add("DarknessShrineActive", new AddressRange <UInt32>("Memory", 0x4358E4));
            mapping.Add("PaceShrineActive", new AddressRange <UInt32>("Memory", 0x4358E5));
            mapping.Add("ChestList", new AddressRange <UInt32>("Memory", 0x435938));
            mapping.Add("SpaceShrineActive", new AddressRange <UInt32>("Memory", 0x43596E));
            mapping.Add("BossShrineActive", new AddressRange <UInt32>("Memory", 0x43596F));
            mapping.Add("NumDiamonds", new AddressRange <UInt32>("Memory", 0x435970));
            mapping.Add("PickupList", new AddressRange <UInt32>("Memory", 0x435978));
            mapping.Add("TrapList", new AddressRange <UInt32>("Memory", 0x43597C));
            mapping.Add("EnemyList", new AddressRange <UInt32>("Memory", 0x4359E0));

            mapping.Add("Flawless", new AddressRange <UInt32>("Memory", 0x435A13, 0x435A14));
            mapping.Add("SpecialRoomEntranceY", new AddressRange <UInt32>("Memory", 0x435A18, 0x435A1C));
            mapping.Add("SpecialRoomEntranceX", new AddressRange <UInt32>("Memory", 0x435A1C, 0x435A20));
            mapping.Add("LevelConstraintH", new AddressRange <UInt32>("Memory", 0x435A54, 0x435A58));
            mapping.Add("LevelConstraintW", new AddressRange <UInt32>("Memory", 0x435A58, 0x435A5C));
            mapping.Add("LevelConstraintY", new AddressRange <UInt32>("Memory", 0x435A5C, 0x435A60));
            mapping.Add("LevelConstraintX", new AddressRange <UInt32>("Memory", 0x435A60, 0x435A64));

            mapping.Add("CoinMultiplierStreak", new AddressRange <UInt32>("Memory", 0x435AA4, 0x435AA8));

            mapping.Add("LowPercentage", new AddressRange <UInt32>("Memory", 0x435AC2, 0x435AC3));

            mapping.Add("MapSeed", new AddressRange <UInt32>("Memory", 0x435AF4, 0x435AF8));

            mapping.Add("MinLevelY", new AddressRange <UInt32>("Memory", 0x435BCC, 0x435BD0));
            mapping.Add("MaxLevelY", new AddressRange <UInt32>("Memory", 0x435BD0, 0x435BD4));
            mapping.Add("MinLevelX", new AddressRange <UInt32>("Memory", 0x435BD4, 0x435BD8));
            mapping.Add("MaxLevelX", new AddressRange <UInt32>("Memory", 0x435BD8, 0x435BDC));

            mapping.Add("RenderableObjectList", new AddressRange <UInt32>("Memory", 0x435BEC, 0x435BF0));
        }
コード例 #29
0
ファイル: Character.cs プロジェクト: Kloppie5/Narrative
        // [exe+0x02C95B27+r8*4]
        public void Init_Mapping( )
        {
            mapping.Add("UNKNOWN_000000_000004", new AddressRange <UInt64>("Savefile", 0x000000, 0x000004), new AddressRange <UInt64>("Memory", 0x000048, 0x00004C));
            mapping.Add("name", new AddressRange <UInt64>("Savefile", 0x000004, 0x000044), new AddressRange <UInt64>("Memory", 0x000050, 0x000090));                // 40
            mapping.Add("HR", new AddressRange <UInt64>("Savefile", 0x000044, 0x000048), new AddressRange <UInt64>("Memory", 0x000090, 0x000094));
            mapping.Add("MR", new AddressRange <UInt64>("Savefile", 0x000048, 0x00004C), new AddressRange <UInt64>("Memory", 0x0000D4, 0x0000D8));
            mapping.Add("zenny", new AddressRange <UInt64>("Savefile", 0x00004C, 0x000050), new AddressRange <UInt64>("Memory", 0x000094, 0x000098));
            mapping.Add("researchPoints", new AddressRange <UInt64>("Savefile", 0x000050, 0x000054), new AddressRange <UInt64>("Memory", 0x000098, 0x00009C));
            mapping.Add("HRXP", new AddressRange <UInt64>("Savefile", 0x000054, 0x000058), new AddressRange <UInt64>("Memory", 0x00009C, 0x0000A0));
            mapping.Add("MRXP", new AddressRange <UInt64>("Savefile", 0x000058, 0x00005C), new AddressRange <UInt64>("Memory", 0x0000DC, 0x0000E0));
            mapping.Add("playtime", new AddressRange <UInt64>("Savefile", 0x00005C, 0x000060), new AddressRange <UInt64>("Memory", 0x0000A0, 0x0000A4));            // Seconds
            mapping.Add("UNKNOWN_000060_000064", new AddressRange <UInt64>("Savefile", 0x000060, 0x000064), new AddressRange <UInt64>("Memory", 0x0000A4, 0x0000A8));
            mapping.Add("hunterAppearance", new AddressRange <UInt64>("Savefile", 0x000064, 0x000108), new AddressRange <UInt64>("Memory", 0x0000E8, 0x00018C));    // <0xA4>
            mapping.Add("UNKNOWN_000108_00020C", new AddressRange <UInt64>("Savefile", 0x000108, 0x00020C), new AddressRange <UInt64>("Memory", 0x0002E8, 0x0003EC));
            mapping.Add("UNKNOWN_00020C_00020D", new AddressRange <UInt64>("Savefile", 0x00020C, 0x00020D), new AddressRange <UInt64>("Memory", 0x0003EC, 0x0003ED));
            mapping.Add("UNKNOWN_00020D_000285", new AddressRange <UInt64>("Savefile", 0x00020D, 0x000285), new AddressRange <UInt64>("Memory", 0x0003F8, 0x000470));
            mapping.Add("UNKNOWN_000285_000286", new AddressRange <UInt64>("Savefile", 0x000285, 0x000286), new AddressRange <UInt64>("Memory", 0x000470, 0x000471));
            mapping.Add("palicoAppearance", new AddressRange <UInt64>("Savefile", 0x000286, 0x0002B2), new AddressRange <UInt64>("Memory", 0x000198, 0x0001C4)); // <0x2C>
            mapping.Add("guildcard", new AddressRange <UInt64>("Savefile", 0x0002B2, 0x00211D), new AddressRange <UInt64>("Memory", 0x17FA20, 0x181AE0));        // <0x1E6B>
            mapping.Add("guildcards", new AddressRange <UInt64>("Savefile", 0x00211D, 0x0C02E9), new AddressRange <UInt64>("Memory", 0x181AE0, 0x24E5E0));       // 100*<0x1E6B>
            mapping.Add("guildcardIndices", new AddressRange <UInt64>("Savefile", 0x0C02E9, 0x0C03B1));                                                          // 100*<0x2>
            mapping.Add("UNKNOWN_0C03B1_0C05B5", new AddressRange <UInt64>("Savefile", 0x0C03B1, 0x0C05B5));                                                     //
            // ~ [0x24E6A8 // <0x78>]
            // ~ [0x251588]
            mapping.Add("guildcardBuffer", new AddressRange <UInt64>("Savefile", 0x0C05B5, 0x0E6611));       // 20*<0x1E6B>
            mapping.Add("UNKNOWN_0E6611_0E6815", new AddressRange <UInt64>("Savefile", 0x0E6611, 0x0E6815)); // 0x204
            // ~ [0x0002DC] <0x4>
            // ~ [0x0000A8] <0x4>
            // ~ [0x0002C8] <0x4>
            // ~ [0x0000D0] <0x4>
            // ~ [0x0F4CC2] <0x100>
            // ~ [0x0F4DC2] <0x80>
            // ~ [0x0F4E50]
            // ~ [0x0F4E68]
            // ~ [0x0F4E80]
            // ~ [0x0F4E98]
            // Monster Field Guide
            mapping.Add("monsterCaptures", new AddressRange <UInt64>("Savefile", 0x0E6815, 0x0E6A15));       // ~ [0x0F4EA8] <0x200>
            mapping.Add("monsterSlain", new AddressRange <UInt64>("Savefile", 0x0E6A15, 0x0E6C15));          // ~ [0x0F50A8] <0x200>
            mapping.Add("UNKNOWN_0E6C15_0E6E15", new AddressRange <UInt64>("Savefile", 0x0E6C15, 0x0E6E15)); // ~ [0x0F52A8] <0x200>
            mapping.Add("UNKNOWN_0E6E15_0E7015", new AddressRange <UInt64>("Savefile", 0x0E6E15, 0x0E7015)); // ~ [0x0F54A8] <0x200>
            mapping.Add("UNKNOWN_0E7015_0E7215", new AddressRange <UInt64>("Savefile", 0x0E7015, 0x0E7215)); // ~ [0x0F56A8] <0x200>
            mapping.Add("UNKNOWN_0E7215_0E7415", new AddressRange <UInt64>("Savefile", 0x0E7215, 0x0E7415)); // ~ [0x0F58A8] <0x200>

            mapping.Add("UNKNOWN_0E7415_0E7431", new AddressRange <UInt64>("Savefile", 0x0E7415, 0x0E7431)); // ~ [0x0F64D8] Assumed padding, but something is copied over

            mapping.Add("monsterLargest", new AddressRange <UInt64>("Savefile", 0x07431, 0x0E7631));         // ~ [0x0F5AA8] <0x200>
            mapping.Add("monsterSmallest", new AddressRange <UInt64>("Savefile", 0x0E7631, 0x0E7831));       // ~ [0x0F5CA8] <0x200>
            mapping.Add("UNKNOWN_0E7831_0E7A31", new AddressRange <UInt64>("Savefile", 0x0E7831, 0x0E7A31)); // ~ [0x0F5EA8] <0x200> floats
            mapping.Add("monsterResearchLevel", new AddressRange <UInt64>("Savefile", 0x0E7A31, 0x0E7C31));  // ~ [0x0F60A8] <0x200>
            mapping.Add("UNKNOWN_0E7C31_0E7E31", new AddressRange <UInt64>("Savefile", 0x0E7C31, 0x0E7E31)); // ~ [0x0F62A8] <0x200> floats

            mapping.Add("UNKNOWN_0E7E31_0E8073", new AddressRange <UInt64>("Savefile", 0x0E7E31, 0x0E8073)); // 0x242

            mapping.Add("UNKNOWN_0E8073_0E8223", new AddressRange <UInt64>("Savefile", 0x0E8073, 0x0E8223)); // 0x1B0

            mapping.Add("UNKNOWN_0E8223_0F3510", new AddressRange <UInt64>("Savefile", 0x0E8223, 0x0F3510));

            // ~ [0x0F64B0]
            // ~ [0x0F64C8]
            // ~ [0x0F6500] <0x80>

            // ~ [0x0F64F4] Single
            // ~ [0x0F6D70] <0x4>
            // ~ [0x0F6D74] <0x4>
            // ~ [0x0F6D78] <0x4>
            // ~ [0x0F6D80] <0x4>

            // ~ ?

            // ~ [0x0F6D90]
            // ~ [0x0F6D98] 400

            // ~ [0x0F6F28] 3*<0x8E0>

            // ~ [0x0F89C8] <0x470>
            // ~ [0x0F8E38] <0x470>
            // ~ [0x0F92A8] <0x200>

            // ~ [0x0F94A8]
            // ~ [0x0F99E0]
            // ~ [0x0F99E8] 24*<0x530>

            // ~ [0x101668] <0x300>
            // ~ [0x101968]
            // ~ [0x1021D0] <0x80>
            // ~ [0x102250] <0x80>
            // ~ [0x1022D8]
            // ~ [0x1022E8]
            // ~ [0x1022F8]
            // ~ [0x102310]
            // ~ [0x102328]
            // ~ [0x102340]
            // ~ [0x102358]
            // ~ [0x102380]
            // ~ [0x1023A8]
            // ~ [0x1023B8]
            // ~ [0x1023C8]
            // ~ [0x1023E0]
            // ~ [0x102400]
            // ~ [0x102410] <0x8>
            // ~ [0x102418] <0x1>
            // ~ [0x10241A]
            // ~ [0x102420]
            mapping.Add("itemLoadouts", new AddressRange <UInt64>("Savefile", 0x0F3510, 0x116010), new AddressRange <UInt64>("Memory", 0x000738, 0x037FF8)); // 120*<0x4A0>
            mapping.Add("itemLoadoutIndices", new AddressRange <UInt64>("Savefile", 0x116010, 0x116088));                                                    // 120*<0x1>
            mapping.Add("itemPouch", new AddressRange <UInt64>("Savefile", 0x116098, 0x116158), new AddressRange <UInt64>("Memory", 0x038080));              // 24*<0x8>
            mapping.Add("ammoPouch", new AddressRange <UInt64>("Savefile", 0x116158, 0x1161D8), new AddressRange <UInt64>("Memory", 0x038200));              // 16*<0x8>
            mapping.Add("materialPouch", new AddressRange <UInt64>("Savefile", 0x1161D8, 0x116298), new AddressRange <UInt64>("Memory", 0x038380));          // 24*<0x8>
            mapping.Add("specialPouch", new AddressRange <UInt64>("Savefile", 0x116298, 0x116300), new AddressRange <UInt64>("Memory", 0x038500));           // 13 or 5*<0x8>
            mapping.Add("itemBox", new AddressRange <UInt64>("Savefile", 0x116300, 0x116940), new AddressRange <UInt64>("Memory", 0x038A08));                // 200**<0x8>
            mapping.Add("ammoBox", new AddressRange <UInt64>("Savefile", 0x116940, 0x116F80), new AddressRange <UInt64>("Memory", 0x039688));                // 200*<0x8>
            mapping.Add("materialBox", new AddressRange <UInt64>("Savefile", 0x116F80, 0x119690), new AddressRange <UInt64>("Memory", 0x03A308));            // 1250*<0x8>
            mapping.Add("decorationBox", new AddressRange <UInt64>("Savefile", 0x119690, 0x11A630), new AddressRange <UInt64>("Memory", 0x03F128));          // 500*<0x8>
            mapping.Add("equipmentBox", new AddressRange <UInt64>("Savefile", 0x11A630, 0x1674A8), new AddressRange <UInt64>("Memory", 0x041068));           // 2500*<0x7E>
            mapping.Add("invalidEquipment", new AddressRange <UInt64>("Savefile", 0x1674A8, 0x176FAC));                                                      // 510*<0x7E> Memory copy does 3010 at once
            mapping.Add("emptyEquipment", new AddressRange <UInt64>("Savefile", 0x176FAC, 0x19D6E8), new AddressRange <UInt64>("Memory", 0x0B0B98));         // 1250*<0x7E>
            mapping.Add("equipmentBoxIndices", new AddressRange <UInt64>("Savefile", 0x19D6E8, 0x19FDF8));                                                   // 2500*<0x4>
            // ~ [0x0DF1C8] <12000>
            // ~ [0x0E20A8] <5000>
            mapping.Add("EMPTY_19FDF8_1A05C8", new AddressRange <UInt64>("Savefile", 0x19FDF8, 0x1A05C8));                                             // 2500*<0x4>
            mapping.Add("emptyEquipmentIndices", new AddressRange <UInt64>("Savefile", 0x1A05C8, 0x1A194C));                                           // 1250*<0x4>
            mapping.Add("UNKNOWN_1A194C_1A8D48", new AddressRange <UInt64>("Savefile", 0x1A194C, 0x1A8D48));
            mapping.Add("NPCConversations", new AddressRange <UInt64>("Savefile", 0x1A8D48, 0x1ACD48), new AddressRange <UInt64>("Memory", 0x0E6430)); // 2048*<0x8>
            mapping.Add("UNKNOWN_1ACD48_1AD5DF", new AddressRange <UInt64>("Savefile", 0x1ACD48, 0x1AD5DF));
            // ~ [0x0E6C30] <1024>
            // ~ [0x0E7030] <1024>
            // ~ [0x0E7430]
            // ~ [0x0E7450
            // ~ [0x0E79F0] 14*<0x40>
            // ~ [0x0E7D70] 6*<0x80>
            // ~ [0x0E8070] x*<0x40>
            // ~ [0x0E83F0] x*<0x80>
            // ~ [0x0E86F0]
            // ~ [0x0E8730] 2*<0x80>
            // ~ [0x0E8830]
            // ~ [0x0E8870] <0x80>
            // ~ [0x0E8970]
            // ~ [0x0E89B0]
            // ~ [0x0E89F0]
            // ~ [0x0E7434]
            // ~ [0x0E8A18]
            // ~ [0x0E8A58]
            // ~ [0x0E8A80] 2048
            // ~ [0x0E9284]
            // ~ [0x0E9280]
            // ~ [0x0E9288]
            // ~ [0x0E92A4]
            // ~ [0x0E92A0]
            // ~ [0x0E92A8]
            // ~ [0x0E92C4]
            // ~ [0x0E92C0]
            // ~ [0x0E92C8]
            // ~ [0x0F4938]

            // ~ [0x0EDF38] <0xA0>
            // ~ [0x0EDFD8] <0xA0>
            // ~ [0x0EE078] <0x3200>
            mapping.Add("investigations", new AddressRange <UInt64>("Savefile", 0x1AD5DF, 0x1B177F), new AddressRange <UInt64>("Memory", 0x105898));        // 400*<0x2A>
            mapping.Add("UNKNOWN_1B177F_1B21B1", new AddressRange <UInt64>("Savefile", 0x1B177F, 0x1B21B1));
            mapping.Add("UNKNOWN_1B21B1_1B60B1", new AddressRange <UInt64>("Savefile", 0x1B21B1, 0x1B60B1), new AddressRange <UInt64>("Memory", 0x0E92E8)); // 128*<0x7E>
            mapping.Add("UNKNOWN_1B60B1_1B6955", new AddressRange <UInt64>("Savefile", 0x1B60B1, 0x1B6955));                                                // ~ [] <0x400>
            mapping.Add("equipmentLoadouts", new AddressRange <UInt64>("Savefile", 0x1B6955, 0x1DB8D5), new AddressRange <UInt64>("Memory", 0x11E758));     // 224*<0x2A4>
            mapping.Add("layeredArmorLoadouts", new AddressRange <UInt64>("Savefile", 0x1DB8D5, 0x1E4315), new AddressRange <UInt64>("Memory", 0x144158));  // 112*<0x13C>
            mapping.Add("palicoLoadouts", new AddressRange <UInt64>("Savefile", 0x1E4315, 0x1E5ED5), new AddressRange <UInt64>("Memory", 0x14D0D8));        // 24*<0x128>

            mapping.Add("cultivating", new AddressRange <UInt64>("Savefile", 0x1E5ED5, 0x1E5EF5));                                                          // ~ [0x103028] 4*<0x4+0x4>
            mapping.Add("fertilizer", new AddressRange <UInt64>("Savefile", 0x1E5EF5, 0x1E5F1D));                                                           // ~ [0x103068] 5*<0x4+0x4>
            mapping.Add("harvestBox", new AddressRange <UInt64>("Savefile", 0x1E5F1D, 0x1E60AD));                                                           // ~ [0x1030B8] 50*<0x4+0x4>

            mapping.Add("UNKNOWN_1E60AD_2098C0", new AddressRange <UInt64>("Savefile", 0x1E60AD, 0x2098C0));

            // ~ [] 4*<0x540> tailraider safari teams? why 4; current and 3 options?

            // ~ [] x*<0xF8>

            // ~ [0x27B5E8] inventory

            // ~ [0x16C948] 100*<0x218>
            // ~ [0x179C38] 400*<0x218>

            // ~ [] <0x2800>
            mapping.Add("hash", new AddressRange <UInt64>("Savefile", 0x2098C0, 0x209AC0));
        }
コード例 #30
0
 public ReaderConventions AddReader <T>(Action <INode, ObjectNodeBase, Options> reader,
                                        Func <INode, ObjectNodeBase, Options, bool> where)
 {
     Mapping.Add(reader, (s, t, o) => t.SpecifiedType.Type.CanBeCastTo <T>() && where (s, t, o));
     return(this);
 }
コード例 #31
0
        public IEnumerator ToUnity(Module.ProgressCallback progress_callback = null)
        {
            unityRoot = null;

            if (root_node != null)
            {
                GameObject node_template = new GameObject("Node");
                GameObject mesh_template = new GameObject("Mesh");
                mesh_template.AddComponent <MeshFilter>();
                mesh_template.AddComponent <MeshRenderer>();

                unityMapping    = new Mapping();
                unityReferences = new HashSet <UnityReference>();

                uint nb_steps = CountNodes(root_node);
                nb_steps += (uint)(meshes != null ? meshes.Length : 0);
                nb_steps += (uint)(materials != null ? materials.Length : 0);
                nb_steps += (uint)(textures != null ? textures.Length : 0);

                Utils.Progress progress = new Utils.Progress();
                progress.Init(nb_steps, progress_callback);

                IEnumerator it = root_node.ToUnity(this, null, node_template, mesh_template, progress);

                while (it.MoveNext())
                {
                    progress.Display();

                    yield return(it.Current);
                }

                // Destroy templates
                if (Application.isPlaying)
                {
                    UnityEngine.Object.Destroy(node_template);
                    UnityEngine.Object.Destroy(mesh_template);
                }
                else
                {
                    UnityEngine.Object.DestroyImmediate(node_template);
                    UnityEngine.Object.DestroyImmediate(mesh_template);
                }

                if (root_node.UnityNodes != null && root_node.UnityNodes.Length > 0)
                {
                    GameObject[] nodes = root_node.UnityNodes;

                    // This can happen if we have a single original mesh splitted into multiple unity meshes
                    if (nodes.Length > 1)
                    {
                        unityRoot = new GameObject(nodes[0].name);

                        // Regiter an ID for this object
                        unityMapping.Add(unityRoot, unityMapping.GetNewId());

                        unityRoot.SetActive(false);

                        unityRoot.transform.position   = nodes[0].transform.position;
                        unityRoot.transform.rotation   = nodes[0].transform.rotation;
                        unityRoot.transform.localScale = nodes[0].transform.localScale;

                        foreach (GameObject go in nodes)
                        {
                            go.transform.parent = unityRoot.transform;

                            go.SetActive(root_node.Active);
                        }
                    }
                    else
                    {
                        unityRoot = nodes[0];
                    }
                }

                // Resolve references
                foreach (UnityReference reference in unityReferences)
                {
                    reference.ToUnity(this);
                }

                if (unityRoot != null)
                {
                    unityRoot.SetActive(root_node.Active);
                }

                // Clean up
                unityReferences = null;
            }
        }