private void MainWindow_Load(Object sender, EventArgs e)
        {
            FileLog.IsEnabled = false;
            CenterToScreen();

            _setProgressBar   = SetProgressBar;
            _setControlStatus = SetControlStatus;

            checkBoxEnabledLogging.Checked = FileLog.IsEnabled;

            var conanClientDirectory = Path.Combine(Directory.GetCurrentDirectory(), "ConanClient");
            var conanServerDirectory = Path.Combine(Directory.GetCurrentDirectory(), "ConanServer");

            textBoxInstalllocationClient.Text = conanClientDirectory;
            textBoxInstalllocationServer.Text = conanServerDirectory;

            timerCallbacks.Start();
        }
 private static void InjectAllStrings(
     Config config, SCS wscs, List <MainDolString> doltext, MemoryStream ms, HyoutaTools.GameCube.Dol dol, MemchunkStorage memchunks,
     List <(int index, string entry)> j, List <(int index, string entry)> u
 public Decln(String name, SCS scs, ExprType type, Option<Initr> initr) {
     this.name = name;
     this.scs = scs;
     this.type = type;
     this.initr = initr;
 }
Exemple #4
0
        // some skit files reuse the same JP string in cases where the english text is different, this expands this to have a separate entry for each JP string
        public static (Stream newTssStream, SCS wscsnew) MultiplyOutSkitTss(DuplicatableStream stream, SCS wscsorig)
        {
            stream.Position = 0;
            Stream s          = stream.CopyToMemory();
            uint   magic      = s.ReadUInt32().FromEndian(EndianUtils.Endianness.BigEndian);
            uint   codeStart  = s.ReadUInt32().FromEndian(EndianUtils.Endianness.BigEndian);
            uint   unknown3   = s.ReadUInt32().FromEndian(EndianUtils.Endianness.BigEndian);
            uint   dataStart  = s.ReadUInt32().FromEndian(EndianUtils.Endianness.BigEndian);
            uint   unknown5   = s.ReadUInt32().FromEndian(EndianUtils.Endianness.BigEndian);
            uint   codeLength = s.ReadUInt32().FromEndian(EndianUtils.Endianness.BigEndian);
            uint   dataLength = s.ReadUInt32().FromEndian(EndianUtils.Endianness.BigEndian);
            uint   unknown8   = s.ReadUInt32().FromEndian(EndianUtils.Endianness.BigEndian);

            List <(long pos, int number, long len)> strings = new List <(long pos, int number, long len)>();

            s.Position = codeStart;
            while (s.Position < (codeStart + codeLength + 0xC - 1))
            {
                if (s.ReadUInt32().FromEndian(EndianUtils.Endianness.BigEndian) == 0x01000000)
                {
                    if (s.PeekUInt64().FromEndian(EndianUtils.Endianness.BigEndian) == 0x0E000008040C0004)
                    {
                        s.DiscardBytes(8);
                        uint offsetOfOffset = s.ReadUInt32().FromEndian(EndianUtils.Endianness.BigEndian);
                        long pos            = s.Position;
                        s.Position = dataStart + offsetOfOffset;
                        uint offset    = s.ReadUInt32().FromEndian(EndianUtils.Endianness.BigEndian);
                        long stringpos = dataStart + offset;
                        s.Position = stringpos;
                        string str = s.ReadNulltermString(TextUtils.GameTextEncoding.ShiftJIS);
                        // must have specific format
                        if (MatchesSkitFormat(str))
                        {
                            int num = SCS.DecodeNumber(str.Substring(4, str.Length - 5));
                            strings.Add((stringpos, num, str.Length));
                        }
                        s.Position = pos;
                    }
                }
            }

            SortedSet <int> reservedNumbers = new SortedSet <int>();

            for (int i = 0; i < wscsorig.Entries.Count; ++i)
            {
                reservedNumbers.Add(i);
            }
            foreach (var d in strings)
            {
                if (reservedNumbers.Contains(d.number))
                {
                    reservedNumbers.Remove(d.number);
                }
            }

            List <string> newscs = new List <string>(wscsorig.Entries);

            List <(int oldIdx, int newIdx)> idxs = new List <(int oldIdx, int newIdx)>();
            int currentIndex = 0;

            foreach (var d in strings)
            {
                while (reservedNumbers.Contains(currentIndex))
                {
                    ++currentIndex;
                }

                string numstr    = SCS.EncodeNumber(currentIndex);
                string resultstr = "\x1F(1," + numstr + ")";
                if (resultstr.Length > d.len)
                {
                    throw new Exception("don't know how to inject this");
                }
                s.Position = d.pos;
                s.WriteShiftJisNullterm(resultstr);
                PutString(newscs, wscsorig.Entries[d.number], currentIndex);
                ++currentIndex;
            }

            s.Position = 0;
            return(s, new SCS(newscs));
        }
Exemple #5
0
 internal static void PostProcessMainDolReplacements(ToGLocInject.FileFetcher _fc, HyoutaTools.Tales.Graces.CharNameBin charnamesU, SCS w, SCS worig, List <(int index, string entry)> j, List <(int index, string entry)> u, Dictionary <char, (int w1, int w2)> charToWidthMap)