Exemplo n.º 1
0
        private void WriteFileSelect()
        {
            if (cMode.SelectedIndex == 2)
            {
                return;
            }
            ;
            ROMFuncs.ApplyHack(ModsDir + "file-select");
            byte[]       SkyboxDefault = new byte[] { 0x91, 0x78, 0x9B, 0x28, 0x00, 0x28 };
            List <int[]> Addrs         = ROMFuncs.GetAddresses(AddrsDir + "skybox-init");
            Random       R             = new Random();
            int          rot           = R.Next(360);

            for (int i = 0; i < 2; i++)
            {
                Color c = Color.FromArgb(SkyboxDefault[i * 3], SkyboxDefault[i * 3 + 1], SkyboxDefault[i * 3 + 2]);
                float h = c.GetHue();
                h += rot;
                h %= 360f;
                c  = ROMFuncs.FromAHSB(c.A, h, c.GetSaturation(), c.GetBrightness());
                SkyboxDefault[i * 3]     = c.R;
                SkyboxDefault[i * 3 + 1] = c.G;
                SkyboxDefault[i * 3 + 2] = c.B;
            }
            ;
            for (int i = 0; i < 3; i++)
            {
                ROMFuncs.WriteROMAddr(Addrs[i], new byte[] { SkyboxDefault[i * 2], SkyboxDefault[i * 2 + 1] });
            }
            ;
            rot = R.Next(360);
            byte[] FSDefault = new byte[] { 0x64, 0x96, 0xFF, 0x96, 0xFF, 0xFF, 0x64, 0xFF, 0xFF };
            Addrs = ROMFuncs.GetAddresses(AddrsDir + "fs-colour");
            for (int i = 0; i < 3; i++)
            {
                Color c = Color.FromArgb(FSDefault[i * 3], FSDefault[i * 3 + 1], FSDefault[i * 3 + 2]);
                float h = c.GetHue();
                h += rot;
                h %= 360f;
                c  = ROMFuncs.FromAHSB(c.A, h, c.GetSaturation(), c.GetBrightness());
                FSDefault[i * 3]     = c.R;
                FSDefault[i * 3 + 1] = c.G;
                FSDefault[i * 3 + 2] = c.B;
            }
            ;
            for (int i = 0; i < 9; i++)
            {
                if (i < 6)
                {
                    ROMFuncs.WriteROMAddr(Addrs[i], new byte[] { 0x00, FSDefault[i] });
                }
                else
                {
                    ROMFuncs.WriteROMAddr(Addrs[i], new byte[] { FSDefault[i] });
                };
            }
            ;
        }
Exemplo n.º 2
0
        private void WriteTunicColour(byte[] obj, int i)
        {
            Color t = Settings.TunicColor;

            byte[]       c    = { t.R, t.G, t.B };
            List <int[]> locs = ROMFuncs.GetAddresses(AddrsDirectory + "tunic-" + i.ToString());

            for (int j = 0; j < locs.Count; j++)
            {
                ROMFuncs.WriteFileAddr(locs[j], c, obj);
            }
        }
Exemplo n.º 3
0
        private void WriteTunicColour()
        {
            Color t = Settings.TunicColor;

            byte[]       c    = { t.R, t.G, t.B };
            List <int[]> locs = ROMFuncs.GetAddresses(AddrsDirectory + "tunic-colour");

            for (int i = 0; i < locs.Count; i++)
            {
                ROMFuncs.WriteROMAddr(locs[i], c);
            }
        }
Exemplo n.º 4
0
        private void WriteDungeons()
        {
            if ((cMode.SelectedIndex == 2) || (!cDEnt.Checked))
            {
                return;
            }
            ;
            ROMFuncs.WriteEntrances(ENTRANCE_OLD, ENTRANCE_NEW);
            ROMFuncs.WriteEntrances(EXIT_OLD, EXIT_NEW);
            byte[]       li   = new byte[] { 0x24, 0x02, 0x00, 0x00 };
            List <int[]> addr = new List <int[]>();

            addr = ROMFuncs.GetAddresses(AddrsDir + "d-check");
            for (int i = 0; i < addr.Count; i++)
            {
                li[3] = (byte)NewExts[i];
                ROMFuncs.WriteROMAddr(addr[i], li);
            }
            ;
            ROMFuncs.ApplyHack(ModsDir + "fix-dungeons");
            addr = ROMFuncs.GetAddresses(AddrsDir + "d-exit");
            for (int i = 0; i < addr.Count; i++)
            {
                if (i == 2)
                {
                    ROMFuncs.WriteROMAddr(addr[i], new byte[] { (byte)((EXIT_OLD[NewEnts[i + 1]] & 0xFF00) >> 8), (byte)(EXIT_OLD[NewEnts[i + 1]] & 0xFF) });
                }
                else
                {
                    ROMFuncs.WriteROMAddr(addr[i], new byte[] { (byte)((EXIT_OLD[NewEnts[i]] & 0xFF00) >> 8), (byte)(EXIT_OLD[NewEnts[i]] & 0xFF) });
                };
            }
            ;
            addr = ROMFuncs.GetAddresses(AddrsDir + "dc-flagload");
            for (int i = 0; i < addr.Count; i++)
            {
                ROMFuncs.WriteROMAddr(addr[i], new byte[] { (byte)((DC_FLAG_NEW[i] & 0xFF00) >> 8), (byte)(DC_FLAG_NEW[i] & 0xFF) });
            }
            ;
            addr = ROMFuncs.GetAddresses(AddrsDir + "dc-flagmask");
            for (int i = 0; i < addr.Count; i++)
            {
                ROMFuncs.WriteROMAddr(addr[i], new byte[] { (byte)((DC_MASK_NEW[i] & 0xFF00) >> 8), (byte)(DC_MASK_NEW[i] & 0xFF) });
            }
            ;
        }
Exemplo n.º 5
0
        private void WriteDungeons()
        {
            if ((Settings.LogicMode == LogicMode.Vanilla) || (!Settings.RandomizeDungeonEntrances))
            {
                return;
            }

            ROMFuncs.WriteEntrances(Values.OldEntrances.ToArray(), _newEntrances);
            ROMFuncs.WriteEntrances(Values.OldExits.ToArray(), _newExits);
            byte[]       li   = new byte[] { 0x24, 0x02, 0x00, 0x00 };
            List <int[]> addr = new List <int[]>();

            addr = ROMFuncs.GetAddresses(AddrsDirectory + "d-check");
            for (int i = 0; i < addr.Count; i++)
            {
                li[3] = (byte)_newExts[i];
                ROMFuncs.WriteROMAddr(addr[i], li);
            }

            ROMFuncs.ApplyHack(ModsDirectory + "fix-dungeons");
            addr = ROMFuncs.GetAddresses(AddrsDirectory + "d-exit");

            for (int i = 0; i < addr.Count; i++)
            {
                if (i == 2)
                {
                    ROMFuncs.WriteROMAddr(addr[i], new byte[] { (byte)((Values.OldExits[_newEnts[i + 1]] & 0xFF00) >> 8), (byte)(Values.OldExits[_newEnts[i + 1]] & 0xFF) });
                }
                else
                {
                    ROMFuncs.WriteROMAddr(addr[i], new byte[] { (byte)((Values.OldExits[_newEnts[i]] & 0xFF00) >> 8), (byte)(Values.OldExits[_newEnts[i]] & 0xFF) });
                }
            }

            addr = ROMFuncs.GetAddresses(AddrsDirectory + "dc-flagload");
            for (int i = 0; i < addr.Count; i++)
            {
                ROMFuncs.WriteROMAddr(addr[i], new byte[] { (byte)((_newDCFlags[i] & 0xFF00) >> 8), (byte)(_newDCFlags[i] & 0xFF) });
            }

            addr = ROMFuncs.GetAddresses(AddrsDirectory + "dc-flagmask");
            for (int i = 0; i < addr.Count; i++)
            {
                ROMFuncs.WriteROMAddr(addr[i], new byte[] { (byte)((_newDCMasks[i] & 0xFF00) >> 8), (byte)(_newDCMasks[i] & 0xFF) });
            }
        }
Exemplo n.º 6
0
 private void WriteTatlColour()
 {
     if (cTatl.SelectedIndex != 5)
     {
         byte[]       c    = new byte[8];
         List <int[]> locs = ROMFuncs.GetAddresses(AddrsDir + "tatl-colour");
         for (int i = 0; i < locs.Count; i++)
         {
             ROMFuncs.Arr_WriteU32(c, 0, TATL_COLOURS[cTatl.SelectedIndex, i << 1]);
             ROMFuncs.Arr_WriteU32(c, 4, TATL_COLOURS[cTatl.SelectedIndex, (i << 1) + 1]);
             ROMFuncs.WriteROMAddr(locs[i], c);
         }
         ;
     }
     else
     {
         ROMFuncs.ApplyHack(ModsDir + "rainbow-tatl");
     };
 }
Exemplo n.º 7
0
 private void WriteTatlColour()
 {
     if (Settings.TatlColorSchema != TatlColorSchema.Random)
     {
         var          selectedColorSchemaIndex = (int)Settings.TatlColorSchema;
         byte[]       c    = new byte[8];
         List <int[]> locs = ROMFuncs.GetAddresses(AddrsDirectory + "tatl-colour");
         for (int i = 0; i < locs.Count; i++)
         {
             ROMFuncs.Arr_WriteU32(c, 0, Values.TatlColours[selectedColorSchemaIndex, i << 1]);
             ROMFuncs.Arr_WriteU32(c, 4, Values.TatlColours[selectedColorSchemaIndex, (i << 1) + 1]);
             ROMFuncs.WriteROMAddr(locs[i], c);
         }
     }
     else
     {
         ROMFuncs.ApplyHack(ModsDirectory + "rainbow-tatl");
     }
 }
Exemplo n.º 8
0
        private void WriteLinkAppearance()
        {
            if (cLink.SelectedIndex == 0)
            {
                WriteTunicColour();
            }
            else if (cLink.SelectedIndex < 4)
            {
                int          i   = cLink.SelectedIndex;
                BinaryReader b   = new BinaryReader(File.Open(ObjsDir + "link-" + i.ToString(), FileMode.Open));
                byte[]       obj = new byte[b.BaseStream.Length];
                b.Read(obj, 0, obj.Length);
                b.Close();
                if (i < 3)
                {
                    WriteTunicColour(obj, i);
                }
                ;
                ROMFuncs.ApplyHack(ModsDir + "fix-link-" + i.ToString());
                ROMFuncs.InsertObj(obj, 0x11);
                if (i == 3)
                {
                    b   = new BinaryReader(File.Open(ObjsDir + "kafei", FileMode.Open));
                    obj = new byte[b.BaseStream.Length];
                    b.Read(obj, 0, obj.Length);
                    b.Close();
                    WriteTunicColour(obj, i);
                    ROMFuncs.InsertObj(obj, 0x1C);
                    ROMFuncs.ApplyHack(ModsDir + "fix-kafei");
                }
                ;
            }
            ;
            List <int[]> Others = ROMFuncs.GetAddresses(AddrsDir + "tunic-forms");

            ROMFuncs.UpdateFormTunics(Others, bTunic.BackColor);
        }
Exemplo n.º 9
0
        private void WriteLinkAppearance()
        {
            if (Settings.Character == Character.LinkMM)
            {
                WriteTunicColour();
            }
            else if (Settings.Character == Character.LinkOOT ||
                     Settings.Character == Character.AdultLink ||
                     Settings.Character == Character.Kafei)
            {
                int          characterIndex = (int)Settings.Character;
                BinaryReader b   = new BinaryReader(File.Open(ObjsDirectory + "link-" + characterIndex.ToString(), FileMode.Open));
                byte[]       obj = new byte[b.BaseStream.Length];
                b.Read(obj, 0, obj.Length);
                b.Close();
                if (characterIndex < 3)
                {
                    WriteTunicColour(obj, characterIndex);
                }

                ROMFuncs.ApplyHack(ModsDirectory + "fix-link-" + characterIndex.ToString());
                ROMFuncs.InsertObj(obj, 0x11);
                if (characterIndex == 3)
                {
                    b   = new BinaryReader(File.Open(ObjsDirectory + "kafei", FileMode.Open));
                    obj = new byte[b.BaseStream.Length];
                    b.Read(obj, 0, obj.Length);
                    b.Close();
                    WriteTunicColour(obj, characterIndex);
                    ROMFuncs.InsertObj(obj, 0x1C);
                    ROMFuncs.ApplyHack(ModsDirectory + "fix-kafei");
                }
            }
            List <int[]> Others = ROMFuncs.GetAddresses(AddrsDirectory + "tunic-forms");

            ROMFuncs.UpdateFormTunics(Others, Settings.TunicColor);
        }