Пример #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] });
                };
            }
            ;
        }
Пример #2
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);
            }
        }
Пример #3
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) });
            }
            ;
        }
Пример #4
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) });
            }
        }
Пример #5
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");
     };
 }
Пример #6
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");
     }
 }