Exemplo n.º 1
0
void TailsAdvBank0Hacks::addStartOnLevelHack(
                   WritableROM& rom,
                   Tbyte area,
                   Tbyte map,
                   Tbyte spawn) {
  rom.directWrite(startOnLevelHackAddress1,
                  startOnLevelHackData1,
                  startOnLevelHackLength1);
  // Fill in area, map, spawn num
  rom.directWrite(startOnLevelHackAddress1
                    + startOnLevelHackData1AreaOffset,
                  &area,
                  ByteSizes::uint8Size);
  rom.directWrite(startOnLevelHackAddress1
                    + startOnLevelHackData1MapOffset,
                  &map,
                  ByteSizes::uint8Size);
  rom.directWrite(startOnLevelHackAddress1
                    + startOnLevelHackData1SpawnOffset,
                  &spawn,
                  ByteSizes::uint8Size);
  
  rom.directWrite(startOnLevelHackAddress2,
                  startOnLevelHackData2,
                  startOnLevelHackLength2);
  
  // Copy and shift block
  Tbyte copyTemp[startOnLevelHackCopyLength];
  std::memcpy(copyTemp,
              rom.directRead(startOnLevelHackCopySrcAddress),
              startOnLevelHackCopyLength);
  std::memcpy(rom.directWrite(startOnLevelHackCopyDstAddress),
              copyTemp,
              startOnLevelHackCopyLength);
  
  // Fill in data
  rom.directWrite(startOnLevelHackAddress3,
                  startOnLevelHackData3,
                  startOnLevelHackLength3);
  
  rom.directWrite(startOnLevelHackAddress4,
                  startOnLevelHackData4,
                  startOnLevelHackLength4);
}
Exemplo n.º 2
0
void TailsAdvBank0Hacks::addDoubleJumpFixHack(
                   WritableROM& rom) {
  // Copy the original jump height
  Tbyte jHeight[1];
  std::memcpy(jHeight,
              rom.directRead(doubleJumpFixHackJumpHeightAddress),
              1);
  
  // Decrement jump height by 1 for hack
  jHeight[0] = (jHeight[0] - 1);
                   
  // Write fix to ROM
  rom.directWrite(doubleJumpFixHackAddress,
                  doubleJumpFixHackData,
                  doubleJumpFixHackLength);
                  
  // Copy jump height + 1
  rom.directWrite(doubleJumpFixHackAddress
                    + doubleJumpFixHackJumpHeightOffset,
                  jHeight,
                  1);
}