Skip to content

Commit

Permalink
Smash Remix 1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
JSsixtyfour committed Feb 2, 2023
1 parent 4efb87f commit da3f2c6
Show file tree
Hide file tree
Showing 486 changed files with 30,259 additions and 2,618 deletions.
2 changes: 1 addition & 1 deletion build/credits.bin

Large diffs are not rendered by default.

Binary file modified build/utils/SSB64FileAppender.class
Binary file not shown.
Binary file modified build/utils/SSB64FileAppender.jar
Binary file not shown.
80 changes: 43 additions & 37 deletions build/utils/SSB64FileAppender.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,69 +24,71 @@ public void run(String filenameNewData, Integer originalOffset, Integer internal
int existingDataLength = 0;
byte outArray[] = new byte[0];
int offset = internalFileTableOffset;

// this correction value will be applied to all pointers we find
// initially it is the originalOffset, but if a target file is specified we must account for the internal file table offset of that file
int correction = 0 - originalOffset;

try {
// read data of file to add
newData = Files.readAllBytes(Paths.get(filenameNewData));
newDataLength = newData.length;

// read data of file to add to
if (filenameTarget != null) {
existingData = Files.readAllBytes(Paths.get(filenameTarget));
existingDataLength = existingData.length;

// correction value needs to be increased by the size of the file
correction += existingDataLength;

offset += existingDataLength;
}
} catch (IOException e) {
// close when file is not present
System.out.println("File not found!");
System.exit(0);

} catch (Exception e) {
// generic error catch
System.out.println("Unknown error occured!");
System.exit(0);
}

// combine the files
outArray = new byte[existingDataLength + newDataLength];
System.arraycopy(existingData, 0, outArray, 0, existingDataLength);
System.arraycopy(newData, 0, outArray, existingDataLength, newDataLength);

//System.out.println("correction: " + String.format("0x%08X", correction) + " (" + correction + ")");

// now loop through file's pointers, updating as we go
// first, update the final pointer in the target file to the first pointer address in the added file
if (filenameTarget != null) {
int offsetTarget = internalFileTableOffsetTarget;

while (offsetTarget < outArray.length) {
int[] pointers = getPointers(outArray, offsetTarget);
//System.out.println("next: " + String.format("0x%08X", pointers[0]) + ", data: " + String.format("0x%08X", pointers[1]));

if (pointers[0] == 0xFFFFFFFC) {
outArray[offsetTarget] = (byte) ((offset / 4) >> 8);
outArray[offsetTarget + 0x01] = (byte) (offset / 4);
break;
if (internalFileTableOffsetTarget > 0) {
int offsetTarget = internalFileTableOffsetTarget;

while (offsetTarget < outArray.length) {
int[] pointers = getPointers(outArray, offsetTarget);
// System.out.println("next: " + String.format("0x%08X", pointers[0]) + ", data: " + String.format("0x%08X", pointers[1]));

if (pointers[0] == 0xFFFFFFFC || pointers[0] == 0x0003FFFC) {
outArray[offsetTarget] = (byte) ((offset / 4) >> 8);
outArray[offsetTarget + 0x01] = (byte) (offset / 4);
break;
}

offsetTarget = pointers[0];
}

offsetTarget = pointers[0];
}
}
// next, update pointers in the new added data
while (offset < outArray.length && offset >= 0) {
int[] pointers = getPointers(outArray, offset);
//System.out.println("next: " + String.format("0x%08X", pointers[0]) + ", data: " + String.format("0x%08X", pointers[1]));
//System.out.println("next: " + String.format("0x%08X", pointers[0] + correction) + ", data: " + String.format("0x%08X", pointers[1] + correction));
// System.out.println("next: " + String.format("0x%08X", pointers[0]) + ", data: " + String.format("0x%08X", pointers[1]));
// System.out.println("next: " + String.format("0x%08X", pointers[0] + correction) + ", data: " + String.format("0x%08X", pointers[1] + correction));

if ((pointers[0] != 0xFFFFFFFC) && ((pointers[0] + correction) < outArray.length) && ((pointers[0] + correction) >= 0)) {
if (!(pointers[0] == 0xFFFFFFFC || pointers[0] == 0x0003FFFC) && ((pointers[0] + correction) < outArray.length) && ((pointers[0] + correction) >= 0)) {
outArray[offset] = (byte) (((pointers[0] + correction) / 4) >> 8);
outArray[offset + 0x01] = (byte) ((pointers[0] + correction) / 4);
} else {
Expand All @@ -96,20 +98,20 @@ public void run(String filenameNewData, Integer originalOffset, Integer internal
}
outArray[offset + 0x02] = (byte) (((pointers[1] + correction) / 4) >> 8);
outArray[offset + 0x03] = (byte) ((pointers[1] + correction) / 4);

if ((pointers[1] - originalOffset) < 0) {
System.out.println("Warning! Data pointer at " + String.format("0x%08X", offset) + " references external offset (before start of added file):" + String.format("0x%08X", pointers[1] + correction));
} else if ((pointers[1] - originalOffset) >= newDataLength) {
System.out.println("Warning! Data pointer at " + String.format("0x%08X", offset) + " references external offset (after end of added file):" + String.format("0x%08X", pointers[1] + correction));
}
if (pointers[0] == 0xFFFFFFFC) {

if (pointers[0] == 0xFFFFFFFC || pointers[0] == 0x0003FFFC) {
break;
}

offset = pointers[0] + correction;
}

// output the file
try (FileOutputStream fos = new FileOutputStream("./output.bin")) {
fos.write(outArray);
Expand All @@ -118,16 +120,20 @@ public void run(String filenameNewData, Integer originalOffset, Integer internal
System.exit(0);
}
}

public int[] getPointers(byte[] dataArray, int offset) {
//System.out.println("offset: " + String.format("0x%08X", offset));
//System.out.println("next: " + String.format("0x%02X", dataArray[offset]) + " " + String.format("0x%02X", dataArray[offset + 0x01]) + ", data: " + String.format("0x%08X", dataArray[offset + 0x02]) + " " + String.format("0x%08X", dataArray[offset + 0x03]));

int nextPointer = (int) (((dataArray[offset] << 8) | (dataArray[offset + 0x01] & 0xFF)) * 4);
int dataPointer = (int) (((dataArray[offset + 0x02] << 8) | (dataArray[offset + 0x03] & 0xFF)) * 4);

// System.out.println("offset: " + String.format("0x%08X", offset));
// System.out.println("next: " + String.format("0x%02X", dataArray[offset]) + " " + String.format("0x%02X", dataArray[offset + 0x01]) + ", data: " + String.format("0x%08X", dataArray[offset + 0x02]) + " " + String.format("0x%08X", dataArray[offset + 0x03]));
// System.out.println("nextPointer upper: " + String.format("0x%08X", (dataArray[offset] << 8) & 0xFF00));

int nextPointer = (int) ((((dataArray[offset] << 8) & 0xFF00) | (dataArray[offset + 0x01] & 0xFF)) * 4);
int dataPointer = (int) ((((dataArray[offset + 0x02] << 8) & 0xFF00) | (dataArray[offset + 0x03] & 0xFF)) * 4);

// System.out.println("nextPointer: " + String.format("0x%08X", nextPointer));
// System.out.println("dataPointer: " + String.format("0x%08X", dataPointer));

int[] returnVal = {nextPointer, dataPointer};

return returnVal;
}

Expand Down
Binary file modified build/utils/SSB64ImageFileAppender.jar
Binary file not shown.
32 changes: 29 additions & 3 deletions main.asm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ include "src/Moveset.asm"
include "src/Command.asm"
include "src/Timeouts.asm"
include "src/GFX.asm"
include "src/AI.asm"
include "src/BGM.asm"
include "src/Camera.asm"
include "src/Color.asm"
Expand All @@ -54,7 +53,7 @@ include "src/Cheats.asm"
include "src/TimedStock.asm"
include "src/Shield.asm"
include "src/Training.asm"
include "src/VsCombo.asm"
include "src/ComboMeter.asm"
include "src/VsStats.asm"
include "src/Widescreen.asm"
include "src/AA.asm"
Expand Down Expand Up @@ -83,8 +82,12 @@ include "src/Practice_1P.asm"
include "src/SinglePlayerEnemy.asm"
include "src/PlayerTag.asm"
include "src/Reflect.asm"
include "src/Transitions.asm"
include "src/ZCancel.asm"
include "src/Tripping.asm"
// CHARACTER
include "src/Character.asm"
include "src/AI.asm"
include "src/CharacterSelect.asm"
include "src/CharacterSelectDebugMenu.asm"
include "src/Costumes.asm"
Expand All @@ -104,6 +107,7 @@ include "src/Falco/Falco.asm"
// GANONDORF
include "src/Ganondorf/Ganondorf.asm"
// YOUNG LINK
include "src/YoungLink/YoungLinkSpecial.asm"
include "src/YoungLink/YoungLink.asm"
// DR MARIO
include "src/DrMario/DrMario.asm"
Expand Down Expand Up @@ -175,6 +179,28 @@ include "src/SSonic/SSonic.asm"
// SHEIK
include "src/Sheik/SheikSpecial.asm"
include "src/Sheik/Sheik.asm"
// NWARIO
include "src/NWario/NWario.asm"
// NLUCAS
include "src/NLucas/NLucas.asm"
// MARINA
include "src/Marina/MarinaSpecial.asm"
include "src/Marina/Marina.asm"
// NBOWSER
include "src/NBowser/NBowser.asm"
// NWOLF
include "src/NWolf/NWolf.asm"
// NDRM
include "src/NDrMario/NDrMario.asm"
// NSONIC
include "src/NSonic/NSonic.asm"
// NSHEIK
include "src/NSheik/NSheik.asm"
// DEDEDE
include "src/Dedede/DededeSpecial.asm"
include "src/Dedede/Dedede.asm"
// NMARINA
include "src/NMarina/NMarina.asm"

// KIRBY
include "src/Kirby/Kirby.asm"
Expand All @@ -191,7 +217,7 @@ fill MIDI.largest_midi // Allocate as much space as we need!

OS.align(16)
file_table: // This is where we move the file table to in order to load more files
fill 0x480
fill 0x580

custom_heap: // This is where we move the heap to when we need to increase its size

Expand Down
Binary file modified original.xdelta
Binary file not shown.
Loading

0 comments on commit da3f2c6

Please sign in to comment.