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) }); } ; }
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) }); } }