public override void WriteScroll(ROM rom) { rom.PushOffset(romOffset); rom.Write8(acts, 0x02); rom.Write16(X, 0x04); rom.Write16(Y, 0x06); rom.Write32(segmentedAddress, 0x10); rom.Write32(behavior, 0x14); rom.PopOffset(); }
private static void RelocationParse_cmd24(ROM rom, RelocationTable table, RegionParseState state) { int behaviour = rom.Read32(0x14); if (behaviour == scrollBehaviour || behaviour == scrollBehaviourLegacy) { int address = 0; int intX = rom.Read16(0x04); float X = intX; byte[] Xdata = BitConverter.GetBytes(X); address += Xdata[2] * 0x10000; address += (ushort)rom.Read16(0x10); int segmentedAddress = address - 0x20000 + 0x0E000000; int newSegmentedAddress = table.Relocate((int)state.area, segmentedAddress); if (newSegmentedAddress == -1) { throw new ArgumentException("Failed to relocate scrolling texture!"); } int newAddress = newSegmentedAddress - 0x0E000000 + 0x20000; Xdata[2] = (byte)((newAddress >> 16) & 0xFF); float newX = BitConverter.ToSingle(Xdata, 0); int newIntX = Convert.ToInt16(newX); rom.Write16(newIntX, 0x04); rom.Write16(newAddress & 0xFFFF, 0x10); rom.Write32(scrollBehaviourLegacy, 0x14); } }
private static void HeaderFix_cmd17(ROM rom, ROM initROM, out bool isFixed) { int segment = rom.Read8(3); int startAddress = initROM.GetSegmentDescriptor(0x0E).start; int endAddress = startAddress + initROM.GetSegmentDescriptor(0x0E).length; if (segment != 0x0E) { isFixed = false; return; } rom.Write32(startAddress, 4); rom.Write32(endAddress, 8); isFixed = true; }
public override void WriteScroll(ROM rom) { rom.PushOffset(romOffset); rom.Write8(acts, 0x02); rom.Write16(X, 0x04); rom.Write16(Y, 0x06); rom.Write16(Z, 0x08); rom.Write16(BParam, 0x10); rom.Write16(BParam2, 0x12); rom.Write32(behavior, 0x14); rom.PopOffset(); }
public void RelocateOffset(object key, ROM rom, int romOffset) { int segment = rom.Read8(romOffset); if (segment != 0x0e && segment != 0x19) { return; } int segmentedAddress = rom.Read32(romOffset); int newSegmentedAddress = Relocate(key, segmentedAddress); if (newSegmentedAddress == -1) { throw new ArgumentException(String.Format("Relocation Table does not have address {0:x}", segmentedAddress)); } rom.Write32(newSegmentedAddress, romOffset); }