예제 #1
0
        public ADSPlayer(Resource.ADS ads)
        {
            screen   = new Bitmap(640, 480);
            g        = Graphics.FromImage(screen);
            this.ads = ads;
            bwads.WorkerReportsProgress      = true;
            bwads.WorkerSupportsCancellation = true;
            bwads.DoWork             += play;
            bwads.RunWorkerCompleted += bw_RunWorkerCompleted;
            //Debug.WriteLine("Properties:");
            //Debug.WriteLine("id\tname:");
            foreach (Resource.ADS.ResourceProperty rp in ads.resourceproperties)
            {
                //Debug.WriteLine(rp.id.ToString("X4") + "\t" + rp.name);
                Resource.TTM ttm       = (Resource.TTM)ResourceManager.get(rp.name);
                TTMPlayer    ttmplayer = new TTMPlayer(ttm, screen);
                //ttmplayer.bw.RunWorkerCompleted += bw_RunWorkerCompleted;
                ttmplayer.bw.ProgressChanged += bw_ProgressChanged;
                ttms.Add(rp.id, ttmplayer);

                /*foreach (UInt16 key in ttm.tags.Keys)
                 * {
                 * Debug.WriteLine("\t" + key.ToString("X4") + "\t" + ttm.tags[key]);
                 * }*/
            }
        }
예제 #2
0
        public void dump(string filename)
        {
            List <DataTable> sheets     = new List <DataTable>();
            DataTable        properties = new DataTable("Properties");

            properties.Columns.Add("id", typeof(string));
            properties.Columns.Add("adsname", typeof(string));
            properties.Columns.Add("ttmname", typeof(string));
            foreach (ResourceProperty rp in resourceproperties)
            {
                DataRow row = properties.NewRow();
                row["id"]      = rp.id.ToString("X4");
                row["adsname"] = rp.name;
                row["ttmname"] = "";
                properties.Rows.Add(row);
                TTM ttm = (TTM)ResourceManager.get(rp.name);
                foreach (UInt16 key in ttm.tags.Keys)
                {
                    DataRow r = properties.NewRow();
                    r["id"]      = "";
                    r["adsname"] = key.ToString("X4");
                    r["ttmname"] = ttm.tags[key];
                    properties.Rows.Add(r);
                }
            }
            Excel excel = new Excel();

            sheets.Add(properties);

            foreach (UInt16 key in tags.Keys)
            {
                string    name  = key.ToString("X2") + " " + tags[key];
                DataTable sheet = new DataTable(name);
                sheet.Columns.Add("opcode", typeof(string));
                sheet.Columns.Add("properties", typeof(string));
                sheet.Columns.Add("ttm tag", typeof(string));
                foreach (ResourceProperty rp in resourceproperties)
                {
                    foreach (Instruction i in sequences[key])
                    {
                        DataRow row = sheet.NewRow();
                        row["opcode"] = i.code.ToString("X4");
                        string strprop = "";
                        foreach (UInt16 prop in i.data)
                        {
                            strprop += prop.ToString("X4") + " ";
                        }
                        row["properties"] = strprop.Trim();
                        // lookup ttm tag name
                        sheet.Rows.Add(row);
                    }
                }
                sheets.Add(sheet);
            }

            File.WriteAllText(filename, excel.DataTablesToExcelXml(sheets, false));
        }
예제 #3
0
        public TTMPlayer(Resource.TTM ttmobj, Bitmap scr)
        {
            ttm    = ttmobj;
            screen = scr;
            g      = Graphics.FromImage(screen);
            g.DrawRectangle(new Pen(Color.Red), new Rectangle(0, 0, 640, 480));

            //scripts = scriptlist;
            bw.WorkerReportsProgress      = true;
            bw.WorkerSupportsCancellation = true;
            bw.DoWork += play;
        }
        public static Resource.Resource get(string name)
        {
            if (resources.ContainsKey(name.ToLower()))
            {
                return(resources[name]);
            }
            else
            {
                if (map == null)
                {
                    map = new Map();

                    map.parse(resourcemap);
                }
                FileParser reader = new FileParser(SCRANTIC.ResourceManager.map.ResourceFile);
                int        index  = SCRANTIC.ResourceManager.map.getResourceIndex(name);
                if (index < 0)
                {
                    return(null);
                }
                UInt32 offset = SCRANTIC.ResourceManager.map.getOffset(index);
                reader.setOffset(offset);
                string filename = reader.getStringBlock(12);
                UInt32 size     = reader.getDWord();
                byte[] data     = reader.getBytes(size);
                string ext      = name.Substring(name.LastIndexOf(".") + 1).ToLower();
                switch (ext)
                {
                case "ads":
                    Resource.ADS adsres = new Resource.ADS(name);
                    adsres.parse(data);
                    resources.Add(name.ToLower(), adsres);
                    return(adsres);

                case "bmp":
                    Resource.BMP bmpres = new Resource.BMP(name);
                    bmpres.parse(data);
                    resources.Add(name.ToLower(), bmpres);
                    return(bmpres);

                case "pal":
                    Resource.PAL palres = new Resource.PAL(name);
                    palres.parse(data);
                    resources.Add(name.ToLower(), palres);
                    return(palres);

                case "scr":
                    Resource.SCR scrres = new Resource.SCR(name);
                    scrres.parse(data);
                    resources.Add(name.ToLower(), scrres);
                    return(scrres);

                case "ttm":
                    Resource.TTM ttmres = new Resource.TTM(name);
                    ttmres.parse(data);
                    resources.Add(name.ToLower(), ttmres);
                    return(ttmres);

                case "vin":
                    break;
                }
            }
            return(null);
        }