Ejemplo n.º 1
0
        public void ProcessExportedFiles(string defaultDataFolder, IGraphicsInfo gInfo)
        {
            if (!(gInfo is StlConstants stlInfo))
            {
                return;
            }
            LINK.Unpack(Path.Combine(defaultDataFolder, stlInfo.Link), Path.Combine(defaultDataFolder, stlInfo.LinkFolder), true, 4);
            var    ncer   = NCER.Load(Path.Combine(defaultDataFolder, stlInfo.Ncer));
            string data   = Path.Combine(defaultDataFolder, stlInfo.TexData ?? stlInfo.Data);
            string info   = Path.Combine(defaultDataFolder, stlInfo.TexInfo ?? stlInfo.Info);
            bool   tiled  = stlInfo.TexData == null;
            string pngDir = Path.Combine(defaultDataFolder, stlInfo.PngFolder);

            STLCollection.Load(data, info).SaveAsPngs(pngDir, ncer, tiled);
        }
Ejemplo n.º 2
0
    public ValueTask ExecuteAsync(IConsole console)
    {
        if (DestinationFolder == null)
        {
            DestinationFolder = Path.Combine(Path.GetDirectoryName(FilePath), Path.GetFileNameWithoutExtension(FilePath) + " - Unpacked");
        }
        Directory.CreateDirectory(DestinationFolder);

        NCER ncer = NCER.Load(NcerPath);

        using var br = new BinaryReader(File.OpenRead(FilePath));

        STLCollection
        .Load(FilePath, InfoFile)
        .SaveAsPngs(DestinationFolder, ncer, tiled: Tiled);

        console.Output.WriteLine("Complete!");

        return(default);
Ejemplo n.º 3
0
    public ValueTask ExecuteAsync(IConsole console)
    {
        if (DestinationDataFile == null)
        {
            DestinationDataFile = Path.Combine(Path.GetDirectoryName(DirPath), Path.GetFileNameWithoutExtension(DirPath) + " - PackedData.dat");
        }
        if (DestinationInfoFile == null)
        {
            DestinationInfoFile = Path.Combine(Path.GetDirectoryName(DirPath), Path.GetFileNameWithoutExtension(DirPath) + " - PackedInfo.dat");
        }

        NCER ncer = NCER.Load(NcerPath);

        STLCollection
        .LoadPngs(DirPath, ncer, tiled: Tiled)
        .Save(stlDataFile: DestinationDataFile, stlInfoFile: DestinationInfoFile);

        console.Output.WriteLine("Complete!");

        return(default);
Ejemplo n.º 4
0
        public TestForm(string[] args)
        {
            InitializeComponent();

            nds = new NDS(File.OpenRead(args[0]));
            MainArchive mainArchive = new MainArchive(nds.FileSystem.OpenFile(args[1]));

            NCLR       nclr       = new NCLR(mainArchive.OpenFile(int.Parse(args[2])));
            SubArchive subArchive = new SubArchive(mainArchive.OpenFile(int.Parse(args[3])));
            NCGR       ncgr       = new NCGR(subArchive.OpenFile(2));
            NANR       nanr       = new NANR(subArchive.OpenFile(1));
            NCER       ncer       = new NCER(subArchive.OpenFile(0));

            NANR.Animation anim = nanr.animations[int.Parse(args[4])];

            //imgDisp.Image = cell.DrawOamBoxes(Color.Red);

            player = new AnimationPlayer_WinForms(anim, ncgr, nclr, ncer, imgDisp);
            player.Start();
        }
Ejemplo n.º 5
0
        public void GetFilesToPatch(ConcurrentBag <FileToPatch> filesToPatch, IGraphicsInfo gInfo)
        {
            if (!(gInfo is StlConstants stlInfo))
            {
                return;
            }

            var spriteFiles = _overrideSpriteProvider.GetAllSpriteFiles(stlInfo.Type);

            if (!spriteFiles.Any(i => i.IsOverride))
            {
                return;
            }

            string[] filesToPack = spriteFiles.Select(i => i.File).ToArray();
            var      ncer        = NCER.Load(Path.Combine(_graphicsProviderFolder, stlInfo.Ncer));

            if (stlInfo.TexInfo != null)
            {
                string texData = Path.GetTempFileName();
                string texInfo = Path.GetTempFileName();
                STLCollection
                .LoadPngs(filesToPack, ncer, tiled: false)
                .Save(texData, texInfo);
                filesToPatch.Add(new FileToPatch(stlInfo.TexInfo, texInfo, FilePatchOptions.DeleteSourceWhenDone | FilePatchOptions.VariableLength));
                filesToPatch.Add(new FileToPatch(stlInfo.TexData, texData, FilePatchOptions.DeleteSourceWhenDone | FilePatchOptions.VariableLength));
            }

            if (stlInfo.Info != null)
            {
                string info = Path.GetTempFileName();
                string data = Path.GetTempFileName();
                STLCollection
                .LoadPngs(filesToPack, ncer, tiled: true)
                .Save(data, info);
                filesToPatch.Add(new FileToPatch(stlInfo.Info, info, FilePatchOptions.DeleteSourceWhenDone | FilePatchOptions.VariableLength));
                filesToPatch.Add(new FileToPatch(stlInfo.Data, data, FilePatchOptions.DeleteSourceWhenDone | FilePatchOptions.VariableLength));
            }
        }
        public AnimationPlayer_WinForms(NANR.Animation animation, NCGR ncgr, NCLR nclr, NCER ncer, PictureBox pb) : base(animation, ncgr, nclr, ncer)
        {
            PictureBox = pb;
            generateBitmaps();

            Timer          = new Timer();
            Timer.Interval = 1000 / 60;
            Timer.Tick    += Timer_Tick;
        }
 public AnimationPlayer_WinForms(NANR.Animation animation, NCGR ncgr, NCLR nclr, NCER ncer) : this(animation, ncgr, nclr, ncer, new PictureBox())
 {
 }