public static MxeEntryType GetEntryType(MxeIndexEntry mie) { int length = BitConverter.ToInt32(mie.TypeCode.GetBytes(), 0); string name = mie.GetVmTitle(); MxeEntryType ret = _other; if (_knownTypes.ContainsKey(name)) { ret = CheckTypeLength(mie, name, ret); } else if (name.StartsWith(VIM_PART)) { string oldName = StripAdditionalName(name); if (_knownTypes.ContainsKey(oldName)) { MxeEntryType newType = new MxeEntryType(name, mie.GetExpectedByteWords()); newType.Headers = _knownTypes[oldName].Headers.ToArray().ToList(); //cheater clone? while (newType.Headers.Count < newType.Length) { newType.Headers.Add(String.Empty); } ConfigDiscovery.AddNewMxeType(newType); _knownTypes.Add(newType.Type1, newType); ret = newType; } } return(ret); }
private static MxeEntryType CheckTypeLength(MxeIndexEntry mie, string name, MxeEntryType ret) { MxeEntryType met = _knownTypes[name]; int indexLength = mie.GetExpectedByteWords(); if (met.Length == indexLength) { ret = met; } else { Console.Out.WriteLine(String.Format(ERROR_FORMAT, name, met.Length, indexLength)); } return(ret); }
public MxeBlockEntry(MxeIndexEntry mie, int position) { _type = MxeEntryType.GetEntryType(mie); _position = position; _entries = new List <MxeWord>(); for (int i = 0; i < _type.Length && _type.Headers != null && _type.Headers.Count > i; i++) { _entries.Add(new MxeWord(position + i * 4, _type.Headers[i])); } if (_type.Equals(MxeEntryType.Other) && _entries.Count < 1) { for (int i = 0; i < mie.GetExpectedByteWords(); i++) { _entries.Add(new MxeWord(position + i * 4, String.Empty)); } } }
public MxeBlockEntry( MxeIndexEntry mie, int position ) { _type = MxeEntryType.GetEntryType(mie); _position = position; _entries = new List<MxeWord>(); for (int i = 0; i < _type.Length && _type.Headers != null && _type.Headers.Count > i; i++) { _entries.Add(new MxeWord(position + i * 4, _type.Headers[i])); } if(_type.Equals(MxeEntryType.Other) && _entries.Count < 1) { for (int i = 0; i < mie.GetExpectedByteWords(); i++) { _entries.Add(new MxeWord(position + i * 4, String.Empty)); } } }
static MxeEntryType() { string otherName = "Other"; _other = new MxeEntryType(otherName, 0); _knownTypes = new Dictionary<string, MxeEntryType>(); try { using (var stream = new StreamReader(CONFIG_FILE)) { string line; while ((line = stream.ReadLine()) != null) { string[] info = line.Split(','); List<string> headers = info.ToList(); headers.RemoveAt(0); _knownTypes.Add(info[0], new MxeEntryType(info[0], headers)); } stream.Close(); } } catch (Exception exc) { Console.Out.WriteLine(exc.ToString()); } // i, p, f, h, l, b // int, pointer, float, hex, l one-by-one, binary /* HyColor,iId,f,f,f MxParameterFog,,,,,,,, MxParameterLight,,,,,,,,,,,,,,,,,,,,,,,, VlMxAddEsdInfo,,,, VlMxCharacterAffinityInfo,iUnit1,iUnit2,iPercentage, VlMxCharacterCommonInfo,,,,,,,,,,,,,,,,,,,,,,,, VlMxCharacterEachInfo,iId1,iId2,iModel,,,,iGrowthRate,,,,fHp,fAccuracy,fEvasion,,,,,,,fOverHp,fOverAccuracy,fOverEvade,fOverAp,fOverDef,iOverLevel,iOverCp,,,,,,,,,,,,,,,,,,,,,,,,,,,,,iAccess1,iAccess2,,,iAccess3,iAccess4,,,,,,,,,,iPersonalPotential1,iPersonalPotential2,iPersonalPotential3,iPersonalPotential4,iPersonalPotDefault1,iPersonalPotDefault2,iPersonalPotDefault3,iPersonalPotDefault4,,,,,,,,,,,,,,,,,hVoice1,hVoice2,hVoice3,hVoice4,,,,,iClassPotential1,iClassPotential2,iClassPotential3,iClassPotential4,,,,,iClassPotLevel1,iClassPotLevel2,iClassPotLevel3,iClassPotLevel4,,,,,,,,,,,,,hVoice5,hVoice6,hVoice7,hVoice8,,iAnimation1,iAnimation2,,,, VlMxCharacterInfo,iModel,pFirstName1,pLastName,pFirstName2,pFirstName3,,pFirstName4,,,,,,,,,,,,, VlMxClothesInfo,pDescription,pName,,iBlastProtection,iRating,iChapter,iEpisode,iCost,fArmor,,, VlMxExplosiveInfo,,,,,,,, VlMxForceInfo,pDescription,pName,,iBlastProtection,iRating,iChapter,iEpisode,iCost,fArmor,,, VlMxGalliaRareWeaponCandidateInfo,,,,,,hWeaponId8Pair,hWeaponId8Pair2, VlMxGeneralCharInfo,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, VlMxGeneralCharParamSetInfo,,,,,,,,,,,,,,,,,,,,,,,, VlMxJobInfo,,iClassType,pName1,pEliteName,,,fGrassDetect,,iLevel1,iLevel2,iLevel3,iLevel4,iLevel5,iLevel6,iLevel7,iLevel8,iLevel9,iLevel10,iLevel11,iLevel12,iLevel13,iLevel14,iLevel15,iLevel16,iLevel17,iLevel18,iLevel19,iLevel20,,,fInterceptAngle,f,fAssistAngle,f,fBaseHp,fBaseAccuracy,fBaseEvade,fBaseAp,fBaseDefense,fEliteHp,fEliteAccuracy,fEliteEvade,fEliteAp,fEliteDefense,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, VlMxMapObjectCommonInfo,,,, VlMxMapObjectInfo,,,,,,,,,,,, VlMxNewsPaperInfo,,,,,,,, VlMxOrderDirectionInfo,iId,f,f,f VlMxOrderInfo,iId,pName1,pDescription,,,,lPowerminPowermax,fRange,iEffect,lCp,,,,,,,,,,,,,, VlMxParameterConvertTable,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,fRadiatorCrit,f,f,f,f,f,fHeadshotCrit,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f VlMxPotentialInfo,iId,pName1,pDescription,lAccuracyEvasionVspersonVsarmor,lDefenseShotsHpGrassdetect,lRagnaid,hSpecial1,hAnimation,hSpecial2,iActivationCondition,fActivationRate, VlMxSlgInfo,,,,,,,,,,,, VlMxSlgLandformInfo,,,,,,,, VlMxSlgStrongholdCommonInfo,,,,,,,,,,,, VlMxVehicleCommonInfo,pDescription,pName,,iBlastProtection,iRating,iChapter,iEpisode,iCost,fArmor,,, VlMxVehicleDevChangeParamInfo,,,, VlMxVehicleDevInfo,pName1,pDescription1,pDescription2,,iId1,iId2,hId3,iChapter?,iEpisode?,iPreviousUpgrade?,,hUnlock,iPrice,lVsizeHsizeNothingNothing,iStats1,iStats2,iStats3,iStats4,iStats5,,hWeaponry,hBodyHp,hTreadHp,fAp,iAmmo,fBodyDef,fTreadDef,fCritDef,fAccuracy,hGridSize,, VlMxVehicleEachInfo,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, VlMxVehicleInfo,iId,,pName1,pName2,pWeaponName1,pWeaponName2,pWeaponName3,,,,pWeaponName4,,,,fInterceptAngle,,fAssistAngle,,,,fBodyHp,fTreadHp,,,fAp,fBodyDef,fTreadDef,,,,,,,fCrit,fFlamethrower,,fWeaponAccuracy1?,fWeaponAccuracy2?,iWeaponId1,iWeaponId2,iWeaponId3,iWeaponId4,,,,,,,,,, VlMxUnitCommonInfo,,,,,,,,,,,,,,,,,,,,,,,,,,,, VlMxUnitGrowthTypeInfo,iId,f,f,f VlMxWeaponBringOnUnwholesomeInfo,,,,,,,, VlMxWeaponCommonInfo,,,, VlMxWeaponInfo,pDescription,pName,,iModel,hId1,hId2,hId3,hId4,hId5,hId6,hId7,hId8,iChapter,iEpisode,iElite,iPrice,,,,,,,,,,iStatusDown,bWhoCanEquip,iInterception,,,,iAmmo,iShots,fZoom,fAccuracy,iExplosion1,iExplosion2,iExplosion3,fExplosion4,,,,,,f,fMaxEffectiveRange,f,fRange,f,fRangeAttackReduction,i,fVsPerson,fVsArmor,,,,,,,,,,, * */ }
private static MxeEntryType CheckTypeLength(MxeIndexEntry mie, string name, MxeEntryType ret) { MxeEntryType met = _knownTypes[name]; int indexLength = mie.GetExpectedByteWords(); if (met.Length == indexLength) { ret = met; } else { Console.Out.WriteLine(String.Format(ERROR_FORMAT, name, met.Length, indexLength)); } return ret; }
public bool Equals(MxeEntryType met) { return _type.Equals(met.Type1); }
public static MxeEntryType GetEntryType( MxeIndexEntry mie ) { int length = BitConverter.ToInt32(mie.TypeCode.GetBytes(),0); string name = mie.GetVmTitle(); MxeEntryType ret = _other; if (_knownTypes.ContainsKey(name)) { ret = CheckTypeLength(mie, name, ret); } else if(name.StartsWith(VIM_PART)) { string oldName = StripAdditionalName(name); if (_knownTypes.ContainsKey(oldName)) { MxeEntryType newType = new MxeEntryType(name, mie.GetExpectedByteWords()); newType.Headers = _knownTypes[oldName].Headers.ToArray().ToList(); //cheater clone? while (newType.Headers.Count < newType.Length) { newType.Headers.Add(String.Empty); } ConfigDiscovery.AddNewMxeType(newType); _knownTypes.Add(newType.Type1, newType); ret = newType; } } return ret; }
static MxeEntryType() { string otherName = "Other"; _other = new MxeEntryType(otherName, 0); _knownTypes = new Dictionary <string, MxeEntryType>(); try { using (var stream = new StreamReader(CONFIG_FILE)) { string line; while ((line = stream.ReadLine()) != null) { string[] info = line.Split(','); List <string> headers = info.ToList(); headers.RemoveAt(0); _knownTypes.Add(info[0], new MxeEntryType(info[0], headers)); } stream.Close(); } } catch (Exception exc) { Console.Out.WriteLine(exc.ToString()); } // i, p, f, h, l, b // int, pointer, float, hex, l one-by-one, binary /* * HyColor,iId,f,f,f * MxParameterFog,,,,,,,, * MxParameterLight,,,,,,,,,,,,,,,,,,,,,,,, * VlMxAddEsdInfo,,,, * VlMxCharacterAffinityInfo,iUnit1,iUnit2,iPercentage, * VlMxCharacterCommonInfo,,,,,,,,,,,,,,,,,,,,,,,, * VlMxCharacterEachInfo,iId1,iId2,iModel,,,,iGrowthRate,,,,fHp,fAccuracy,fEvasion,,,,,,,fOverHp,fOverAccuracy,fOverEvade,fOverAp,fOverDef,iOverLevel,iOverCp,,,,,,,,,,,,,,,,,,,,,,,,,,,,,iAccess1,iAccess2,,,iAccess3,iAccess4,,,,,,,,,,iPersonalPotential1,iPersonalPotential2,iPersonalPotential3,iPersonalPotential4,iPersonalPotDefault1,iPersonalPotDefault2,iPersonalPotDefault3,iPersonalPotDefault4,,,,,,,,,,,,,,,,,hVoice1,hVoice2,hVoice3,hVoice4,,,,,iClassPotential1,iClassPotential2,iClassPotential3,iClassPotential4,,,,,iClassPotLevel1,iClassPotLevel2,iClassPotLevel3,iClassPotLevel4,,,,,,,,,,,,,hVoice5,hVoice6,hVoice7,hVoice8,,iAnimation1,iAnimation2,,,, * VlMxCharacterInfo,iModel,pFirstName1,pLastName,pFirstName2,pFirstName3,,pFirstName4,,,,,,,,,,,,, * VlMxClothesInfo,pDescription,pName,,iBlastProtection,iRating,iChapter,iEpisode,iCost,fArmor,,, * VlMxExplosiveInfo,,,,,,,, * VlMxForceInfo,pDescription,pName,,iBlastProtection,iRating,iChapter,iEpisode,iCost,fArmor,,, * VlMxGalliaRareWeaponCandidateInfo,,,,,,hWeaponId8Pair,hWeaponId8Pair2, * VlMxGeneralCharInfo,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, * VlMxGeneralCharParamSetInfo,,,,,,,,,,,,,,,,,,,,,,,, * VlMxJobInfo,,iClassType,pName1,pEliteName,,,fGrassDetect,,iLevel1,iLevel2,iLevel3,iLevel4,iLevel5,iLevel6,iLevel7,iLevel8,iLevel9,iLevel10,iLevel11,iLevel12,iLevel13,iLevel14,iLevel15,iLevel16,iLevel17,iLevel18,iLevel19,iLevel20,,,fInterceptAngle,f,fAssistAngle,f,fBaseHp,fBaseAccuracy,fBaseEvade,fBaseAp,fBaseDefense,fEliteHp,fEliteAccuracy,fEliteEvade,fEliteAp,fEliteDefense,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, * VlMxMapObjectCommonInfo,,,, * VlMxMapObjectInfo,,,,,,,,,,,, * VlMxNewsPaperInfo,,,,,,,, * VlMxOrderDirectionInfo,iId,f,f,f * VlMxOrderInfo,iId,pName1,pDescription,,,,lPowerminPowermax,fRange,iEffect,lCp,,,,,,,,,,,,,, * VlMxParameterConvertTable,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,fRadiatorCrit,f,f,f,f,f,fHeadshotCrit,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f * VlMxPotentialInfo,iId,pName1,pDescription,lAccuracyEvasionVspersonVsarmor,lDefenseShotsHpGrassdetect,lRagnaid,hSpecial1,hAnimation,hSpecial2,iActivationCondition,fActivationRate, * VlMxSlgInfo,,,,,,,,,,,, * VlMxSlgLandformInfo,,,,,,,, * VlMxSlgStrongholdCommonInfo,,,,,,,,,,,, * VlMxVehicleCommonInfo,pDescription,pName,,iBlastProtection,iRating,iChapter,iEpisode,iCost,fArmor,,, * VlMxVehicleDevChangeParamInfo,,,, * VlMxVehicleDevInfo,pName1,pDescription1,pDescription2,,iId1,iId2,hId3,iChapter?,iEpisode?,iPreviousUpgrade?,,hUnlock,iPrice,lVsizeHsizeNothingNothing,iStats1,iStats2,iStats3,iStats4,iStats5,,hWeaponry,hBodyHp,hTreadHp,fAp,iAmmo,fBodyDef,fTreadDef,fCritDef,fAccuracy,hGridSize,, * VlMxVehicleEachInfo,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, * VlMxVehicleInfo,iId,,pName1,pName2,pWeaponName1,pWeaponName2,pWeaponName3,,,,pWeaponName4,,,,fInterceptAngle,,fAssistAngle,,,,fBodyHp,fTreadHp,,,fAp,fBodyDef,fTreadDef,,,,,,,fCrit,fFlamethrower,,fWeaponAccuracy1?,fWeaponAccuracy2?,iWeaponId1,iWeaponId2,iWeaponId3,iWeaponId4,,,,,,,,,, * VlMxUnitCommonInfo,,,,,,,,,,,,,,,,,,,,,,,,,,,, * VlMxUnitGrowthTypeInfo,iId,f,f,f * VlMxWeaponBringOnUnwholesomeInfo,,,,,,,, * VlMxWeaponCommonInfo,,,, * VlMxWeaponInfo,pDescription,pName,,iModel,hId1,hId2,hId3,hId4,hId5,hId6,hId7,hId8,iChapter,iEpisode,iElite,iPrice,,,,,,,,,,iStatusDown,bWhoCanEquip,iInterception,,,,iAmmo,iShots,fZoom,fAccuracy,iExplosion1,iExplosion2,iExplosion3,fExplosion4,,,,,,f,fMaxEffectiveRange,f,fRange,f,fRangeAttackReduction,i,fVsPerson,fVsArmor,,,,,,,,,,, * */ }
public bool Equals(MxeEntryType met) { return(_type.Equals(met.Type1)); }
private Dictionary<string, MxeEntryType> DiscoverTypes(FileStream stream) { Dictionary<string, List<string>> discoveredTypes = new Dictionary<string, List<string>>(); foreach (MxeIndexEntry mie in _indexes.Values) { if (mie.Block.Type == MxeEntryType.Other) { string key = mie.GetVmTitle(); List<string> currTypes = mie.SuggestTypes(stream); if (!discoveredTypes.ContainsKey(key)) { discoveredTypes[key] = currTypes; } else { MergeTypeLists(discoveredTypes[key], currTypes); } } } Dictionary<string, MxeEntryType> dts = new Dictionary<string, MxeEntryType>(); foreach (KeyValuePair<string, List<string>> entry in discoveredTypes) { MxeEntryType newType = new MxeEntryType(entry.Key, entry.Value); MxeEntryType.KnownTypes.Add(entry.Key, newType); dts.Add(entry.Key, newType); ConfigDiscovery.AddNewMxeType(newType); } return dts; }
public static void AddNewMxeType(MxeEntryType newType) { Console.Out.WriteLine(String.Format(ADDITIONAL_FORMAT, newType.Type1, newType.ToString())); _mxeTypes.Add(newType); }