Beispiel #1
0
 public void SetConstantsMapping(ConstantsMapping mapping)
 {
     this.mapping = mapping;
     foreach (string key in mapping.GetAllStrings())
     {
         combobox1.AppendText(key);
     }
 }
Beispiel #2
0
 public void SetData(Data d)
 {
     data = d;
     if (data != null && constantsMappingString != null)
     {
         constantsMapping = (ConstantsMapping)typeof(Project).GetField(constantsMappingString).GetValue(data.Project);
     }
 }
Beispiel #3
0
 public ValueReference(ValueReference r)
 {
     data                   = r.data;
     valueIndex             = r.valueIndex;
     ValueType              = r.ValueType;
     Name                   = r.Name;
     startBit               = r.startBit;
     endBit                 = r.endBit;
     Editable               = r.Editable;
     constantsMappingString = r.constantsMappingString;
     constantsMapping       = r.constantsMapping;
 }
Beispiel #4
0
 public void SetData(Data d)
 {
     data = d;
     if (data != null && constantsMappingString != null)
     {
         constantsMapping = (ConstantsMapping)typeof(Project).GetField(constantsMappingString).GetValue(data.Project);
         if (_documentation == null)
         {
             _documentation      = constantsMapping.OverallDocumentation;
             _documentation.Name = "Field: " + Name;
         }
     }
 }
Beispiel #5
0
        public void SetConstantsMapping(ConstantsMapping mapping)
        {
            this.mapping = mapping;
            keyText      = new string[mapping.GetAllStrings().Count];

            int i = 0;

            foreach (string key in mapping.GetAllStrings())
            {
                string text  = mapping.RemovePrefix(key);
                int    value = mapping.StringToByte(key);
                combobox1.AppendText(text);

                keyText[i] = key;
                i++;
            }
        }
Beispiel #6
0
        public Project(string d)
        {
            baseDirectory   = d + '/';
            configDirectory = baseDirectory + "LynnaLab/";
            System.IO.Directory.CreateDirectory(configDirectory);

            logAppender = new log4net.Appender.RollingFileAppender();
            logAppender.AppendToFile = true;
            logAppender.Layout       = new log4net.Layout.PatternLayout(
                "%date{ABSOLUTE} [%logger] %level - %message%newline%exception");
            logAppender.File               = configDirectory + "Log.txt";
            logAppender.Threshold          = log4net.Core.Level.All;
            logAppender.MaxFileSize        = 2 * 1024 * 1024;
            logAppender.MaxSizeRollBackups = 3;
            logAppender.RollingStyle       = log4net.Appender.RollingFileAppender.RollingMode.Composite;
            logAppender.ActivateOptions();
            LogHelper.AddAppenderToRootLogger(logAppender);

            log.Info("Opened project at \"" + baseDirectory + "\".");


            // Before parsing anything, create the "ROM_AGES" or "ROM_SEASONS" definition for ifdefs
            // to work
            definesDictionary.Add("ROM_" + GameString.ToUpper(), "");

            // Parse everything in constants/
            foreach (string f in Directory.EnumerateFiles(baseDirectory + "constants/"))
            {
                if (f.Substring(f.LastIndexOf('.')) == ".s")
                {
                    string filename = "constants/" + f.Substring(f.LastIndexOf('/') + 1);
                    GetFileParser(filename);
                }
            }

            // Initialize constantsMappings
            UniqueGfxMapping = new ConstantsMapping(
                GetFileParser("constants/uniqueGfxHeaders.s"),
                "UNIQGFXH_");
            MainGfxMapping = new ConstantsMapping(
                GetFileParser("constants/gfxHeaders.s"),
                "GFXH_");
            PaletteHeaderMapping = new ConstantsMapping(
                GetFileParser("constants/paletteHeaders.s"),
                "PALH_");
            MusicMapping = new ConstantsMapping(
                GetFileParser("constants/music.s"),
                new string[] { "MUS_", "SND_" });
            SourceTransitionMapping = new ConstantsMapping(
                GetFileParser("constants/transitions.s"),
                "TRANSITION_SRC_");
            DestTransitionMapping = new ConstantsMapping(
                GetFileParser("constants/transitions.s"),
                "TRANSITION_DEST_");
            InteractionMapping = new ConstantsMapping(
                GetFileParser("constants/interactionTypes.s"),
                "INTERACID_");
            EnemyMapping = new ConstantsMapping(
                GetFileParser("constants/enemyTypes.s"),
                "ENEMYID_");
            PartMapping = new ConstantsMapping(
                GetFileParser("constants/partTypes.s"),
                "PARTID_");
            ItemMapping = new ConstantsMapping(
                GetFileParser("constants/itemTypes.s"),
                "ITEMID_");
            SpecialObjectMapping = new ConstantsMapping(
                GetFileParser("constants/specialObjectTypes.s"),
                "SPECIALOBJECTID_");

            // Parse everything in data/
            // A few files need to be loaded before others through
            GetFileParser("data/" + GameString + "/tilesetMappings.s");
            GetFileParser("data/" + GameString + "/tilesetCollisions.s");
            GetFileParser("data/" + GameString + "/tilesetHeaders.s");
            foreach (string f in Directory.EnumerateFiles(baseDirectory + "data/"))
            {
                if (f.Substring(f.LastIndexOf('.')) == ".s")
                {
                    string filename = "data/" + f.Substring(f.LastIndexOf('/') + 1);
                    GetFileParser(filename);
                }
            }
            // Parse data/{game}/
            string gameSpecificDataFolder = "data/" + GameString + "/";

            foreach (string f in Directory.EnumerateFiles(baseDirectory + gameSpecificDataFolder))
            {
                if (f.Substring(f.LastIndexOf('.')) == ".s")
                {
                    string filename = gameSpecificDataFolder + f.Substring(f.LastIndexOf('/') + 1);
                    GetFileParser(filename);
                }
            }

            // Parse wram.s
            GetFileParser("include/wram.s");
            // Parse everything in objects/
            foreach (string f in Directory.EnumerateFiles(baseDirectory + "objects/" + GameString + "/"))
            {
                string basename = f.Substring(f.LastIndexOf('/') + 1);
                if (basename == "macros.s")
                {
                    continue;                         // LynnaLab doesn't understand macros
                }
                if (f.Substring(f.LastIndexOf('.')) == ".s")
                {
                    string filename = "objects/" + GameString + "/" + basename;
                    GetFileParser(filename);
                }
            }
        }
Beispiel #7
0
 public void SetData(Data d)
 {
     data = d;
     if (data != null && constantsMappingString != null) {
         constantsMapping = (ConstantsMapping)typeof(Project).GetField(constantsMappingString).GetValue(data.Project);
     }
 }
Beispiel #8
0
 public ValueReference(ValueReference r)
 {
     data = r.data;
     valueIndex = r.valueIndex;
     ValueType = r.ValueType;
     Name = r.Name;
     startBit = r.startBit;
     endBit = r.endBit;
     Editable = r.Editable;
     constantsMappingString = r.constantsMappingString;
     constantsMapping = r.constantsMapping;
 }
 public void SetConstantsMapping(ConstantsMapping mapping) {
     this.mapping = mapping;
     foreach (string key in mapping.GetAllStrings()) {
         combobox1.AppendText(key);
     }
 }