Skip to content

Commit 21f244c

Browse files
committed
Added some support for some overlays
- Added support for actors and effect SS2 overlays - fixed formatting
1 parent 04dac66 commit 21f244c

18 files changed

Lines changed: 1059 additions & 1079 deletions

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,19 @@
33

44
This can load a Majora's Mask ROM either as a single file or as a file system.
55

6-
When a ROM is loaded as a "Single File", the loader will create the nintendo 64's memory layout, load and decompress the "code" file and load the overlay files specified by the overlay table used by the graph thread.
6+
When a ROM is loaded as a "Single File", the loader will create the nintendo 64's memory layout, load the "code" file and load all the overlay files it can find (see [Loaded overlays](#loaded-overlays) for more details).
77

88
<img src="https://raw.githubusercontent.com/Random0666/Useless-stuff/master/Mm64Loader/ghidra_loader.png" width=40%/>
99

1010
When a ROM is loaded as a "File System", the loader will simply parse the DMA entries and let you extract them.
1111

1212
<img src="https://raw.githubusercontent.com/Random0666/Useless-stuff/master/Mm64Loader/ghidra_fs.png" width=50%/>
13+
14+
# Loaded overlays
15+
The overlays the loader will seek for are the following:
16+
- Overlays specified by a table used by the "graph" thread (e.g. ovl_title)
17+
- Actor overlays
18+
- "Effect Soft Sprite" (aka "Effect SS2") overlays
1319

1420
# Currently supported versions:
1521
- Japan 1.0 (zelda@srd44 00-03-31 02:22:11)

extension.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=@extname@
2-
description=The extension description can be customized by editing the extension.properties file.
3-
author=
2+
description=Ghidra Loader for Majora's Mask 64 ROMs
3+
author=Random0666
44
createdOn=
55
version=@extversion@

src/main/java/mm64/MemPerm.java

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,28 @@
22

33
import java.util.regex.Pattern;
44

5-
public class MemPerm
6-
{
7-
public boolean R;
8-
public boolean W;
9-
public boolean X;
10-
11-
public MemPerm(boolean r, boolean w, boolean x)
12-
{
13-
R = r;
14-
W = w;
15-
X = x;
16-
}
17-
18-
public MemPerm(String s)
19-
{
20-
R = false;
21-
W = false;
22-
X = false;
23-
24-
Pattern p = Pattern.compile("^(R|r|-)(W|w|-)(X|x|-)$");
25-
if (p.matcher(s).matches())
26-
{
27-
R = s.charAt(0) != '-';
28-
W = s.charAt(1) != '-';
29-
X = s.charAt(2) != '-';
30-
}
31-
}
5+
public class MemPerm {
6+
public boolean R;
7+
public boolean W;
8+
public boolean X;
9+
10+
public MemPerm(boolean r, boolean w, boolean x) {
11+
R = r;
12+
W = w;
13+
X = x;
14+
}
15+
16+
public MemPerm(String s) {
17+
R = false;
18+
W = false;
19+
X = false;
20+
21+
Pattern p = Pattern.compile("^(R|r|-)(W|w|-)(X|x|-)$");
22+
if (p.matcher(s).matches()) {
23+
R = s.charAt(0) != '-';
24+
W = s.charAt(1) != '-';
25+
X = s.charAt(2) != '-';
26+
}
27+
}
3228

3329
}
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
package mm64;
22

3-
public class Mm64Exception extends Exception
4-
{
5-
public Mm64Exception(String s)
6-
{
7-
super(s);
8-
}
3+
public class Mm64Exception extends Exception {
4+
public Mm64Exception(String s) {
5+
super(s);
6+
}
97
}

src/main/java/mm64/Mm64File.java

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22

33
import mm64.Mm64Game.DmaDataEntry;
44

5-
public class Mm64File
6-
{
7-
public boolean Compressed;
5+
public class Mm64File {
6+
public boolean Compressed;
87
public int VRomStart;
98
public int VRomEnd;
109
public int RomStart;
@@ -13,36 +12,34 @@ public class Mm64File
1312
public boolean Deleted;
1413
DmaDataEntry DmaData;
1514

16-
public Mm64File()
17-
{
18-
15+
public Mm64File() {
16+
1917
}
20-
public Mm64File(byte[] data, int vrom, int rom, boolean comp, int compSize)
21-
{
18+
19+
public Mm64File(byte[] data, int vrom, int rom, boolean comp, int compSize) {
2220
Data = data;
2321
VRomStart = vrom;
24-
VRomEnd = vrom+ (data != null ? data.length : compSize);
25-
RomStart = rom;
26-
RomEnd = rom+compSize;
22+
VRomEnd = vrom + (data != null ? data.length : compSize);
23+
RomStart = rom;
24+
RomEnd = rom + compSize;
2725
Compressed = comp;
2826
Deleted = false;
2927
}
30-
public static Mm64File DeletedFile(int vrom, int rom, int size)
31-
{
32-
Mm64File file = new Mm64File();
33-
file.Data = new byte[size];
34-
file.Compressed = false;
35-
file.Deleted = true;
36-
file.VRomStart = vrom;
37-
file.VRomEnd = vrom+size;
38-
file.RomStart = rom;
39-
file.RomEnd = rom+size;
40-
41-
return file;
28+
29+
public static Mm64File DeletedFile(int vrom, int rom, int size) {
30+
Mm64File file = new Mm64File();
31+
file.Data = new byte[size];
32+
file.Compressed = false;
33+
file.Deleted = true;
34+
file.VRomStart = vrom;
35+
file.VRomEnd = vrom + size;
36+
file.RomStart = rom;
37+
file.RomEnd = rom + size;
38+
39+
return file;
4240
}
4341

44-
public boolean Valid()
45-
{
42+
public boolean Valid() {
4643
return Data != null;
4744
}
4845
}

0 commit comments

Comments
 (0)