protected void refreshPointer3Bytes() { for (int i = 0; i < primaryPointer_address.Length; i++) { primaryPointer_address[i] = PointerRead.LongRead_LoHiBank(primaryPointer_location[i]); } }
internal indoor_damagepits() { POINTER_LOCATION = ConstantsReader.GetAddress("pit_pointer"); DATALENGTH_VALUE_LOCATION = ConstantsReader.GetAddress("pit_count"); dataAddress = PointerRead.LongRead_LoHiBank(POINTER_LOCATION); maxLength = Conversion.toUShort(ROM.DATA[DATALENGTH_VALUE_LOCATION + 1], ROM.DATA[DATALENGTH_VALUE_LOCATION + 0]) + embedded2; readData(); }
/// <summary> /// Reads the pointer, which is byte swapped /// </summary> private void getPointers() { secondayPointers = new int[numberOfRooms]; byte[] rawData = new byte[pointerSize]; Array.Copy(ROM.DATA, primaryPointer_address[1], rawData, 0, pointerSize); updatePointer(rawData, ref secondayPointers, rawData.Length); layoutPointers = new int[numberOfLayouts]; for (int i = 0; i < numberOfLayouts; i++) { layoutPointers[i] = PointerRead.LongRead_LoHiBank(layoutPointersLocation + (i * 3)); } }
private void updatePointers() { bool match = true; byte[] b = new byte[originalCode.Length]; Array.Copy(ROM.DATA, codePointer, b, 0, originalCode.Length); for (int i = 0; i < originalCode.Length; i++) { if (originalCode[i] != b[i]) { match = false; break; } } if (match) { secondaryPointer = PointerRead.ShortRead_LoHi(primaryPointer); } else if (b[0] == specialPatchByte) { int Codeaddress = PointerRead.LongRead_LoHiBank(codePointer + 1); byte[] patch = new byte[patchByConn.Length]; Array.Copy(ROM.DATA, Codeaddress, patch, 0, patchByConn.Length); for (int i = 0; i < patchByConn.Length; i++) { if (patchByConn[i] != patch[i] && i != connPointerByteNo && i != connPointerByteNo + 1) { throw new Exception(patchError); } } secondaryPointer = PointerRead.ShortRead_LoHi(codePointer + connPointerByteNo); } else { throw new Exception(patchError); } roomPointers = new int[size / bytesPerRoomEntry]; for (int i = 0; i < size / bytesPerRoomEntry; i++) { roomPointers[i] = PointerRead.ShortRead_LoHi(secondaryPointer + (i * bytesPerRoomEntry)); } isConnPatched = !match; }
public Layout() { int primaryPointer_location; switch (RegionId.myRegion) { case ((int)RegionId.Region.USA): primaryPointer_location = 0x26F2F; break; case ((int)RegionId.Region.Japan): primaryPointer_location = 0x26C0F; break; default: throw new NotImplementedException(); } int location = PointerRead.LongRead_LoHiBank(primaryPointer_location); }
public void DecompressAllMapTiles() { //locat functions int genPointer(int address, int i) => PointerRead.LongRead_LoHiBank(address + i * 3); byte[] Decomp(int pointer, ref int compressedSize) => Decompress.ALTTPDecompressOverworld(ROM.DATA, pointer, 1000, ref compressedSize); int npos = 0; for (int i = 0; i < 160; i++) { int p1 = genPointer(ConstantsReader.GetAddress("compressedAllMap32PointersHigh"), i), p2 = genPointer(ConstantsReader.GetAddress("compressedAllMap32PointersLow"), i); int ttpos = 0, compressedSize1 = 0, compressedSize2 = 0; byte[] bytes = Decomp(p2, ref compressedSize1), bytes2 = Decomp(p1, ref compressedSize2); for (int y = 0; y < 16; y++) { for (int x = 0, tpos; x < 16; x++, npos++, ttpos++) { tpos = (ushort)((bytes2[ttpos] << 8) + bytes[ttpos]); if (tpos < tiles32.Count) { map16tiles[npos] = new Tile32(tiles32[tpos].tile0, tiles32[tpos].tile1, tiles32[tpos].tile2, tiles32[tpos].tile3); } else { Console.WriteLine("Found 0,0,0,0"); map16tiles[npos] = new Tile32(0, 0, 0, 0); } } } } }
private void readPointer() { if (ROM.Read(primaryPointer + bankOffset1) != ROM.Read(primaryPointer + bankOffset2)) { throw new Exception(); } secondaryPointer = PointerRead.LongRead_LoHiBank(primaryPointer); secondaryPointer = PointerRead.LongRead_LoHiBank(primaryPointer, primaryPointer + 1, pointer_bank); roomHeaderPointers = new int[numberOfHeaders]; for (int i = 0; i < numberOfHeaders; i++) { int temp = secondaryPointer + i * 2; roomHeaderPointers[i] = AddressLoROM.SnesToPc( ROM.Read(temp + 0), ROM.Read(temp + 1), AddressLoROM.PcToSnes_Bank(secondaryPointer)); roomHeaders[i] = new i_roomHeader(ROM.Read(roomHeaderPointers[i], sizeOfEachHeader)); } }
private void readPrimaryPointers() { primaryPointer_val = PointerRead.LongRead_LoHiBank(primaryPointer_location); }