Skip to content

Commit

Permalink
Smash Remix 0.9.5 Patch
Browse files Browse the repository at this point in the history
  • Loading branch information
JSsixtyfour committed Dec 6, 2020
1 parent 3bee5fd commit 867e9b4
Show file tree
Hide file tree
Showing 199 changed files with 9,176 additions and 790 deletions.
3 changes: 3 additions & 0 deletions build/utils/Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
PROGRAM=SSB64ImageFileAppender
PROGRAM2=SSB64FileAppender

# compile and create executable
all:
javac -cp . $(PROGRAM).java
jar cmf $(PROGRAM).mf $(PROGRAM).jar $(PROGRAM).class $(PROGRAM).java
javac -cp . $(PROGRAM2).java
jar cmf $(PROGRAM2).mf $(PROGRAM2).jar $(PROGRAM2).class $(PROGRAM2).java

# clean output
clean:
Expand Down
38 changes: 31 additions & 7 deletions build/utils/README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,48 @@
# SSB64ImageFileAppender
# File Appenders
1. SSB64ImageFileAppender - stupid easy appending of images
2. SSB64FileAppender - generic appending of files

## SSB64ImageFileAppender
A simple tool for appending binary image data to Smash Remix. A lot of this was based off of https://github.com/jordanbarkley/Texture64.

I didn't bother making the code look nice. It works.

## Files Currently Supported
### Files Currently Supported
- 0A04 Stage Icons
- 0A05 Character Portraits

# How to Use
## Stage Icons
### How to Use
#### Stage Icons
1. Grab file 0A04 using the GE Editor and name it 0A04.bin.
2. In the same directory as 0A04.bin, put your stage icon file(s).
3. Drag your stage icon file(s) over StageIconAppender.bat - this will update 0A04.bin.
4. Inject 0A04.bin using the GE Editor.
5. Confirm using GE Editor's Image Tools.

## Character Portraits
#### Character Portraits
Note: Currently, Remix expects the flash portrait to be immediately after the normal portrait.
1. Grab file 0A05 using the GE Editor and name it 0A05.bin.
2. In the same directory as 0A04.bin, put your character portrait file(s).
2. In the same directory as 0A05.bin, put your character portrait file(s).
3. Drag your character portrait file(s) over CharacterIconAppender.bat - this will update 0A05.bin.
4. Inject 0A05.bin using the GE Editor.
5. Confirm using GE Editor's Image Tools.
5. Confirm using GE Editor's Image Tools.

## SSB64FileAppender
A simple tool for appending data of any structure to Smash Remix. Loops through the pointers and adjusts them automatically. A lot of this was based off of https://github.com/jordanbarkley/Texture64.

I didn't bother making the code look nice. It works.

### How to Use
The sequence of events will look like this:

1. You replace some data using the GE Setup Editor in some file.
2. You track down the part of the file that has your change.
3. You take note of the offset in the file where your data begins - this is called the originalOffset.
4. You copy the data that you want to append to a new file.
5. You look in the new file for the first pointer (the format is `XXXXYYYY` where `XXXX * 4` is the offset of the next pointer and `YYYY * 4` is the offset of the data that will be converted by the game to a pointer) - this is called the internalFileTableOffset.
6. Most likely, but optionally, you want to append this to an existing file. You need to know the Internal File Table Offset for this file - this is the internalFileTableOffsetTarget.
7. Open a command line and cd to this directory, then call the jar like so: `java -jar ./SSB64FileAppender.jar /path/to/newFile.bin originalOffset internalFileTableOffset /path/to/targetFileToAppendTo.bin internalFileTableOffsetTarget`.

Example: `java -jar ./SSB64FileAppender.jar "../smashremixprivate/roms/bowser logo.bin" 0xB08 0x6FC "../smashremixprivate/roms/0023-bowser.bin" 0x0004`

The tool should update all pointers in the internal file linked list and update the last pointer in the original file as well (changing it from 0xFFFF). If there are any external file pointers, you will get a warning message that details where in the file they occurred. You'll have to manually adjust those. Too bad!
Binary file added build/utils/SSB64FileAppender.class
Binary file not shown.
Binary file added build/utils/SSB64FileAppender.jar
Binary file not shown.
134 changes: 134 additions & 0 deletions build/utils/SSB64FileAppender.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
import java.io.*;
import java.util.Arrays;
import java.nio.file.*;

public class SSB64FileAppender {

public static void main(String[] args) {
SSB64FileAppender appender = new SSB64FileAppender();
if (args.length != 3 && args.length != 5) {
System.out.println("usage: java -jar SSB64FileAppender.jar <path/to/file_containing_new_data> <offset_in_original_file> <internal_file_table_offset> [<path/to/file_to_append> <internal_file_table_offset>]");
System.exit(0);
}
if (args.length == 3) {
appender.run(args[0], Integer.decode(args[1]), Integer.decode(args[2]), null, null);
} else {
appender.run(args[0], Integer.decode(args[1]), Integer.decode(args[2]), args[3], Integer.decode(args[4]));
}
}

public void run(String filenameNewData, Integer originalOffset, Integer internalFileTableOffset, String filenameTarget, Integer internalFileTableOffsetTarget) {
byte[] newData = new byte[0];
int newDataLength = 0;
byte[] existingData = new byte[0];
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;
}

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

if ((pointers[0] != 0xFFFFFFFC) && ((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 {
// if this is the last pointer, set to 0xFFFF
outArray[offset] = (byte) 0xFF;
outArray[offset + 0x01] = (byte) 0xFF;
}
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) {
break;
}

offset = pointers[0] + correction;
}

// output the file
try (FileOutputStream fos = new FileOutputStream("./output.bin")) {
fos.write(outArray);
} catch (Exception e) {
System.out.println("Unknown error occured!");
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);

int[] returnVal = {nextPointer, dataPointer};

return returnVal;
}

}
2 changes: 2 additions & 0 deletions build/utils/SSB64FileAppender.mf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Manifest-Version: 1.0
Main-Class: SSB64FileAppender
13 changes: 11 additions & 2 deletions main.asm
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ include "src/GameEnd.asm"
include "src/Global.asm"
include "src/Hazards.asm"
include "src/Hitbox.asm"
include "src/Item.asm"
include "src/Joypad.asm"
include "src/Menu.asm"
include "src/Pause.asm"
Expand All @@ -62,6 +63,8 @@ include "src/Skeleton.asm"
include "src/Surface.asm"
include "src/Multiman.asm"
include "src/TwelveCharBattle.asm"
include "src/Size.asm"
include "src/CharEnvColor.asm"
// CHARACTER
include "src/Character.asm"
include "src/CharacterSelect.asm"
Expand Down Expand Up @@ -117,8 +120,6 @@ include "src/EPika/EPika.asm"
include "src/JPuff/JPuff.asm"
// EPUFF
include "src/EPuff/EPuff.asm"
// JKIRBY
include "src/JKirby/JKirby.asm"
// JYOSHI
include "src/JYoshi/JYoshi.asm"
// JPIKA
Expand All @@ -130,7 +131,15 @@ include "src/Bowser/BowserSpecial.asm"
include "src/Bowser/Bowser.asm"
// GBOWSER
include "src/GBowser/GBowser.asm"
// PIANO
include "src/Piano/PianoSpecial.asm"
include "src/Piano/Piano.asm"

// KIRBY
include "src/Kirby/Kirby.asm"
include "src/KirbyHats.asm"
// JKIRBY
include "src/JKirby/JKirby.asm"

// MIDI
include "src/MIDI.asm"
Expand Down
Binary file modified original.xdelta
Binary file not shown.
4 changes: 2 additions & 2 deletions patch.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
assembler\bass.exe -o "ssb64asm.z64" main.asm -sym logfile.log
assembler\chksum64.exe "ssb64asm.z64"
assembler\rn64crc.exe -u
assembler\chksum64.exe "ssb64asm.z64" > nul
assembler\rn64crc.exe -u > nul
pause
28 changes: 23 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Computer controlled players have recieved a variety of improvements.
#### Toggle Names: _VS Mode Combo Meter_, _1v1 Combo Meter Swap_

### Expanded Character Select Screen
- The character select screen is now expanded 24 slots including 7 custom characters.
- The character select screen is now expanded to 24 slots including 8 custom characters.
- Metal Mario, Giant DK, and polygon versions of the original cast are available via d-pad up or down.
- Japanese versions of the original cast are available via d-pad left.
- European versions of some of the original cast are available via d-pad right.
Expand Down Expand Up @@ -84,6 +84,18 @@ Computer controlled players have recieved a variety of improvements.
- Best character for each player is tracked as the number of TKOs the opposing player experiences against your character.
- Only ports 1 and 2 work with this mode.

### Additional Items
- New items available in training mode and in VS mode.
- VS Mode Item Switch expanded to allowing toggling new items.
#### Cloaking Device
- Renders the player invisible and impervious to damage for 10 seconds.
#### Super Mushroom
- Player grows into giant form with added passive armor while dealing higher damage.
- Lasts 10 seconds.
#### Poison Mushroom
- Player shrinks into tiny form and deals less damage.
- Lasts 10 seconds.

## Customization
### Costume Selection Improvements
- Access all available costumes by scrolling with the left and right C buttons.
Expand Down Expand Up @@ -148,10 +160,10 @@ Use the toggle or cycle using D-Pad down in Training Mode.
### Crash Debugger
- When a game crash occurs, attempts to display a screen with detailed information on what went wrong.

### Disable Cinematic Camera
- Disables the cinematic camera zooms which occasionally occur at the start of a versus match.
### Cinematic Camera
- Controls the cinematic camera zooms which occasionally occur at the start of a versus match.

#### Toggle Name: _Disable Cinematic Camera_
#### Toggle Name: _Cinematic Camera_

### Idle Timeouts Disabled
- Remaining idle on various menu screen for 5 minutes no longer results in returning to the START screen.
Expand Down Expand Up @@ -238,6 +250,11 @@ Use the toggle or cycle using D-Pad down in Training Mode.

#### Toggle Name: _Japanese Shield Stun_

### Japanese Whispy
- Use the Japanese version's wind speed for Whispy.

#### Toggle Name: _Japanese Whispy_

## Single Player
### Bonus 3 (Race to the Finish)
- Record best times for completing the RTTF stage using all characters just like for Bonus 1 and Bonus 2.
Expand All @@ -256,7 +273,7 @@ Use the toggle or cycle using D-Pad down in Training Mode.
Toggle | Community | Tournament | Japanese
---------------------------|--------------------|-------------------|-------------------
Color Overlays | Off | Off | Off
Disable Cinematic Camera | Off | Off | Off
Cinematic Camera | Default | Default | Default
Flash On Z-Cancel | Off | Off | Off
FPS Display *BETA | Off | Off | Off
Special Model Display | Off | Off | Off
Expand Down Expand Up @@ -292,6 +309,7 @@ Toggle | Community | Tournament | Japan
--------------------------------|--------------------|-------------------|-------------------
Stage Select Layout | NORMAL | TOURNAMENT | NORMAL
Hazard Mode | Off | Off | Off
Japanese Whispy | Off | Off | On
_Random Toggles for All Stages_ | On | Off* | On

\* These stages are set to on in the Tournament profile:
Expand Down
Loading

0 comments on commit 867e9b4

Please sign in to comment.