diff --git a/.github/calcrom/calcrom.pl b/.github/calcrom/calcrom.pl
index 4858babb95..9fbd959945 100755
--- a/.github/calcrom/calcrom.pl
+++ b/.github/calcrom/calcrom.pl
@@ -1,9 +1,15 @@
#!/usr/bin/perl
use IPC::Cmd qw[ run ];
+use Getopt::Long;
+
+my $usage = "Usage: calcrom.pl file.map [--data]\n";
+
+my $showData;
+GetOptions("data" => \$showData) or die $usage;
(@ARGV == 1)
- or die "ERROR: no map file specified.\n";
+ or die $usage;
open(my $file, $ARGV[0])
or die "ERROR: could not open file '$ARGV[0]'.\n";
@@ -57,14 +63,14 @@ while (my $line = <$file>)
# though. Uniq is pretty fast!
my $base_cmd = "nm $elffname | awk '{print \$3}' | grep '^[^_].\\{4\\}' | uniq";
-# This looks for Unknown_, Unknown_, or sub_, followed by just numbers. Note that
+# This looks for Unknown_, Unknown_, or sub_, followed by an address. Note that
# it matches even if stuff precedes the unknown, like sUnknown/gUnknown.
-my $undoc_cmd = "grep '[Uu]nknown_[0-9a-fA-F]*\\|sub_[0-9a-fA-F]*'";
+my $undoc_cmd = "grep '[Uu]nknown_[0-9a-fA-F]\\{5,7\\}\\|sub_[0-9a-fA-F]\\{5,7\\}'";
# This looks for every symbol with an address at the end of it. Some things are
# given a name based on their type / location, but still have an unknown purpose.
# For example, FooMap_EventScript_FFFFFFF.
-my $partial_doc_cmd = "grep '_[0-28][0-9a-fA-F]\\{5,6\\}'";
+my $partial_doc_cmd = "grep '_[0-28][0-9a-fA-F]\\{5,7\\}'";
my $count_cmd = "wc -l";
@@ -98,16 +104,19 @@ my $partial_documented_as_string;
# Performing addition on a string converts it to a number. Any string that fails
# to convert to a number becomes 0. So if our converted number is 0, but our string
# is nonzero, then the conversion was an error.
+$undocumented_as_string =~ s/^\s+|\s+$//g;
my $undocumented = $undocumented_as_string + 0;
-(($undocumented != 0) and ($undocumented_as_string ne "0"))
+(($undocumented != 0) or (($undocumented == 0) and ($undocumented_as_string eq "0")))
or die "ERROR: Cannot convert string to num: '$undocumented_as_string'";
+$partial_documented_as_string =~ s/^\s+|\s+$//g;
my $partial_documented = $partial_documented_as_string + 0;
-(($partial_documented != 0) and ($partial_documented_as_string ne "0"))
+(($partial_documented != 0) or (($partial_documented == 0) and ($partial_documented_as_string eq "0")))
or die "ERROR: Cannot convert string to num: '$partial_documented_as_string'";
+$total_syms_as_string =~ s/^\s+|\s+$//g;
my $total_syms = $total_syms_as_string + 0;
-(($total_syms != 0) and ($total_syms_as_string ne "0"))
+(($total_syms != 0) or (($total_syms == 0) and ($total_syms_as_string eq "0")))
or die "ERROR: Cannot convert string to num: '$total_syms_as_string'";
($total_syms != 0)
@@ -149,17 +158,13 @@ else
print "$undocumented symbols undocumented ($undocPct%)\n";
}
-print "\n";
-my $dataTotal = $srcdata + $data;
-my $srcDataPct = sprintf("%.4f", 100 * $srcdata / $dataTotal);
-my $dataPct = sprintf("%.4f", 100 * $data / $dataTotal);
+if ($showData)
+{
+ print "\n";
+ my $dataTotal = $srcdata + $data;
+ my $srcDataPct = sprintf("%.4f", 100 * $srcdata / $dataTotal);
+ my $dataPct = sprintf("%.4f", 100 * $data / $dataTotal);
-if ($data == 0)
-{
- print "Data porting to C is 100% complete\n"
-}
-else
-{
print "$dataTotal total bytes of data\n";
print "$srcdata bytes of data in src ($srcDataPct%)\n";
print "$data bytes of data in data ($dataPct%)\n";
diff --git a/.github/calcrom/webhook.sh b/.github/calcrom/webhook.sh
index 2a3015969e..fd54b660b6 100755
--- a/.github/calcrom/webhook.sh
+++ b/.github/calcrom/webhook.sh
@@ -8,4 +8,4 @@ if [ ! -f $map_file ]; then
fi
output=$(perl $(dirname "$0")/calcrom.pl $build_name.map | sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g')
-curl -d "{\"username\": \"$CALCROM_DISCORD_WEBHOOK_USERNAME\", \"avatar_url\": \"$CALCROM_DISCORD_WEBHOOK_AVATAR_URL\", \"content\":\"\`\`\`$build_name progress:\\n$output\`\`\`\"}" -H "Content-Type: application/json" -X POST "$CALCROM_DISCORD_WEBHOOK_URL"
+curl -d "{\"username\": \"$CALCROM_DISCORD_WEBHOOK_USERNAME\", \"avatar_url\": \"$CALCROM_DISCORD_WEBHOOK_AVATAR_URL\", \"content\":\"\`\`\`\\n$build_name progress:\\n$output\\n\`\`\`\"}" -H "Content-Type: application/json" -X POST "$CALCROM_DISCORD_WEBHOOK_URL"
diff --git a/.gitignore b/.gitignore
index 38c3e02d67..cac4a07e61 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@
*.i
*.elf
*.gba
+!data/*.gba
*.sgm
*.sa1
*.ss[0-9]
@@ -34,3 +35,6 @@ porymap.project.cfg
*.a
.fuse_hidden*
*.sna
+*.diff
+*.sym
+*.js
diff --git a/INSTALL.md b/INSTALL.md
index 1ad3b4b0c9..02851644ad 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -125,12 +125,12 @@ Otherwise, ask for help on Discord or IRC (see [README.md](README.md)), or conti
Note that in msys2, Copy is Ctrl+Insert and Paste is Shift+Insert.
-1. Open msys2 at C:\devkitPro\msys2\msys2_shell.bat.
+1. Open msys2 at C:\devkitPro\msys2\mingw64.exe or run `C:\devkitPro\msys2\msys2_shell.bat -mingw64`.
2. Certain packages are required to build pokeemerald. Install these by running the following command:
```bash
- pacman -S make gcc zlib-devel git
+ pacman -S make zlib-devel git mingw-w64-x86_64-gcc mingw-w64-x86_64-libpng
```
Note...
@@ -138,39 +138,6 @@ Note that in msys2, Copy is Ctrl+Insert and Paste is Shift+Insert.
> This command will ask for confirmation, just enter the yes action when prompted.
-3. Download [libpng](https://sourceforge.net/projects/libpng/files/libpng16/1.6.37/libpng-1.6.37.tar.xz/download).
-
-4. Change directory to where libpng was downloaded. By default, msys2 will start in the current user's profile folder, located at **C:\Users\\_\_**, where *\* is your Windows username. In most cases, libpng should be saved within a subfolder of the profile folder. For example, if libpng was saved to **C:\Users\\_\_\Downloads** (the Downloads location for most users), enter this command:
-
- ```bash
- cd Downloads
- ```
-
-
- Notes...
-
- > Note 1: While not shown, msys uses forward slashes `/` instead of backwards slashes `\` as the directory separator.
- > Note 2: If the path has spaces, then the path must be wrapped with quotations, e.g. `cd "Downloads/My Downloads"`.
- > Note 3: Windows path names are case-insensitive so adhering to capitalization isn’t needed.
- > Note 4: If libpng was saved elsewhere, you will need to specify the full path to where libpng was downloaded, e.g. `cd c:/devkitpro/msys2` if it was saved there.
-
-
-5. Run the following commands to uncompress and install libpng.
-
- ```bash
- tar xf libpng-1.6.37.tar.xz
- cd libpng-1.6.37
- ./configure --prefix=/usr
- make check
- make install
- ```
-
-6. Then finally, run the following command to change back to the user profile folder.
-
- ```bash
- cd
- ```
-
### Choosing where to store pokeemerald (msys2)
At this point, you can choose a folder to store pokeemerald into. If you're okay with storing pokeemerald in the user profile folder, then proceed to [Installation](#installation). Otherwise, you'll need to account for where pokeemerald is stored when changing directory to the pokeemerald folder.
@@ -338,6 +305,20 @@ Then proceed to [Choosing where to store pokeemerald (Linux)](#choosing-where-to
> then you will have to install devkitARM. Install all the above packages except binutils-arm-none-eabi, and follow the instructions to
> [install devkitARM on Debian/Ubuntu-based distributions](#installing-devkitarm-on-debianubuntu-based-distributions).
+
+### Arch Linux
+Run this command as root to install the necessary packages:
+```bash
+pacman -S base-devel arm-none-eabi-binutils git libpng
+```
+Then proceed to [Choosing where to store pokeemerald (Linux)](#choosing-where-to-store-pokeemerald-linux).
+
+ Note for legacy repos...
+
+> If the repository you plan to build has an **[older revision of the INSTALL.md](https://github.com/pret/pokeemerald/blob/571c598/INSTALL.md)**,
+> then you will have to install devkitARM. Install all the above packages except binutils-arm-none-eabi, and follow the instructions to
+> [install devkitARM on Arch Linux](#installing-devkitarm-on-arch-linux).
+
### Other distributions
_(Specific instructions for other distributions would be greatly appreciated!)_
@@ -437,21 +418,16 @@ If you aren't in the pokeemerald directory already, then **change directory** to
```bash
cd pokeemerald
```
-To build **pokeemerald.gba** for the first time and confirm it matches the official ROM image (Note: to speed up builds, see [Parallel builds](#parallel-builds)):
+To build **pokeemerald.gba** (Note: to speed up builds, see [Parallel builds](#parallel-builds)):
```bash
-make compare
+make
```
-If an OK is returned, then the installation went smoothly.
+If it has built successfully you will have the output file **pokeemerald.gba** in your project folder.
Note for Windows...
> If you switched terminals since the last build (e.g. from msys2 to WSL1), you must run `make clean-tools` once before any subsequent `make` commands.
-To build **pokeemerald.gba** with your changes:
-```bash
-make
-```
-
# Building guidance
## Parallel builds
@@ -470,11 +446,20 @@ Replace `