public KK_ResourceMappingHelper()
        {
            AddKnownLevels(24, 50, 51, 52, 53, 54, 55, 56);

            if (IsStudio)
            {
                WhiteListPaths.Add("abdata/studio/info");
            }
            else
            {
                WhiteListPaths.Add("abdata/list/characustom");
                WhiteListPaths.Add("abdata/adv/scenario");
                WhiteListPaths.Add("abdata/communication");
                WhiteListPaths.Add("abdata/h/list");
                WhiteListPaths.Add("abdata/custom/customscenelist");
            }
            // ADV: most lines duplicated 3 times
            // adv/scenario/c[personality]/[*num]/[asset_num]
            RegisterMapping(AdvChecker, AdvMapper, ResourceMappingMode.SyncAndReplacement, ResourceGameMode.GameOnly);

            // communication: most lines duplicated between 7 times (some 35)
            // add extra mapping between 'communication_03' <=> 'communication_off_03': most lines 11, up to 55
            // communication/info_[*num]/[asset]
            RegisterMapping(CommunicationChecker, CommunicationMapper, ResourceMappingMode.SyncAndReplacement, ResourceGameMode.GameOnly);


            // Maker lists, very little duplication
            //  abdata/list/characustom/[*num]/[list_type]_[*num]

            // Subs
            //  abdata/h/list/[*num1]/personality_voice_c[personality]_[*num2]_[num3]
            // up to 38 dupes ignoring num1 + num2
            RegisterMapping(SubsChecker, SubsMapper, ResourceMappingMode.SyncAndReplacement, ResourceGameMode.GameOnly);


            // maker post lists
            //   - abdata/custom/customscenelist/cus_pose*
            RegisterMapping(MakerPoseChecker, MakerPoseMapper, ResourceMappingMode.SyncAndReplacement, ResourceGameMode.GameOnly);


            // studio item lists
            // abdata/studio/info/*/itemlist_*_01_*
            // Sync only due to startup slowdown
            RegisterMapping(StudioItemListChecker, StudioItemListMapper, ResourceMappingMode.Sync);

            // studio voice
            // abdata/studio/info/[*num1]/voice_[personality]_[*num2]_00
            // Sync only due to startup slowdown
            RegisterMapping(StudioVoiceChecker, StudioVoiceMapper, ResourceMappingMode.SyncAndReplacement, ResourceGameMode.StudioOnly);

            // studio voice category
            // abdata/studio/info/[*num1]/voicecategory_[*num1]_[personality]
            // same across ALL personalities though so heavy during studio load
            RegisterMapping(StudioVoiceCategoryChecker, StudioVoiceCategoryMapper, ResourceMappingMode.SyncAndReplacement, ResourceGameMode.StudioOnly);

            // personality names (in both studio and main game, sometimes even spelled the same)
            // abdata/list/characustom/[*num1]/cha_sample_voice_[*num1]
            // abdata/studio/info/[*num1]/voicegroup_[*num1]
            RegisterMapping(PersonalityNameChecker, PersonalityNameMapper, ResourceMappingMode.SyncAndReplacement);
        }
Пример #2
0
        public MakerCustomDataHandler(TextResourceRedirector plugin) : base(plugin, true)
        {
            WhiteListPaths.Add("abdata/custom");

            var baseHandler = plugin.ExcelDataHandler;

            SupportedColumnNames.AddRange(baseHandler.SupportedColumnNames.ToList());
            foreach (var pth in WhiteListPaths)
            {
                baseHandler.BlackListPaths.Add(pth);
            }
        }
        protected void RegisterMapping(ResourceMappingChecker checker, ResourceMappingMapper mapper,
                                       ResourceMappingMode mappingMode, ResourceGameMode replacementGameMode = ResourceGameMode.All,
                                       string pathToWhitelist = null)
        {
            // turn off replacement if not supported by current mode
            if (!IsCurrentGameMode(replacementGameMode))
            {
                mappingMode &= ~ResourceMappingMode.Replacement;
            }

            if (mappingMode == ResourceMappingMode.None)
            {
                return;
            }
            var mapperId      = GetMapperId(mapper);
            var mapperEntries = _checkers.GetOrInit(checker);

            var entry = mapperEntries.FirstOrDefault(e => e.MapperId == mapperId);

            if (entry == null)
            {
                mapperEntries.Add(new MapperEntry(mapperId, mappingMode));
            }
            else
            {
                entry.Mode |= mappingMode;
            }

            if (_checkerModes.ContainsKey(checker))
            {
                _checkerModes[checker] |= mappingMode;
            }
            else
            {
                _checkerModes[checker] = mappingMode;
            }

            if (!pathToWhitelist.IsNullOrEmpty())
            {
                WhiteListPaths.Add(pathToWhitelist);
            }

            if (!HasReplacementMappingsForCurrentGameMode &&
                (mappingMode & ResourceMappingMode.Replacement) == ResourceMappingMode.Replacement &&
                (replacementGameMode & _currentModeFlag) == _currentModeFlag)
            {
                HasReplacementMappingsForCurrentGameMode = true;
            }

            ResetCaches();
        }