Skip to content

Commit

Permalink
Merge branch 'pret:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
rawr51919 authored Aug 12, 2023
2 parents 9594de4 + 28b53dc commit fa2ab87
Show file tree
Hide file tree
Showing 420 changed files with 7,543 additions and 2,504 deletions.
29 changes: 18 additions & 11 deletions .github/calcrom/calcrom.pl
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/usr/bin/perl

# Usage:
# calcrom.pl <mapfile> [--data]
#
# mapfile: path to .map file output by LD
# data: set to output % breakdown of data

use IPC::Cmd qw[ run ];
use Getopt::Long;

Expand Down Expand Up @@ -63,14 +69,15 @@
# 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_regex = "'[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\\}'";
# The above may be double counted here, and will need to be filtered out.
my $partial_doc_regex = "'_[0-28][0-9a-fA-F]\\{5,7\\}'";

my $count_cmd = "wc -l";

Expand All @@ -87,15 +94,15 @@

my $undocumented_as_string;
(run (
command => "$base_cmd | $undoc_cmd | $count_cmd",
command => "$base_cmd | grep $undoc_regex | $count_cmd",
buffer => \$undocumented_as_string,
timeout => 60
))
or die "ERROR: Error while filtering for undocumented symbols: $?";

my $partial_documented_as_string;
(run (
command => "$base_cmd | $partial_doc_cmd | $count_cmd",
command => "$base_cmd | grep $partial_doc_regex | grep -v $undoc_regex | $count_cmd",
buffer => \$partial_documented_as_string,
timeout => 60
))
Expand All @@ -104,16 +111,19 @@
# 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)
Expand All @@ -123,9 +133,6 @@
my $srcPct = sprintf("%.4f", 100 * $src / $total);
my $asmPct = sprintf("%.4f", 100 * $asm / $total);

# partial_documented is double-counting the unknown_* and sub_* symbols.
$partial_documented = $partial_documented - $undocumented;

my $documented = $total_syms - ($undocumented + $partial_documented);
my $docPct = sprintf("%.4f", 100 * $documented / $total_syms);
my $partialPct = sprintf("%.4f", 100 * $partial_documented / $total_syms);
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@ build/
.vs/
.projects/ARM/
*.diff
porymap.project.cfg
porymap.*.cfg
prefabs.json
1 change: 1 addition & 0 deletions data/maps.s
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "constants/global.h"
#include "constants/layouts.h"
#include "constants/map_types.h"
#include "constants/maps.h"
Expand Down
4 changes: 2 additions & 2 deletions data/maps/AbandonedShip_CaptainsOffice/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@
"y": 6,
"elevation": 3,
"dest_map": "MAP_ABANDONED_SHIP_DECK",
"dest_warp_id": 4
"dest_warp_id": "4"
},
{
"x": 8,
"y": 6,
"elevation": 3,
"dest_map": "MAP_ABANDONED_SHIP_DECK",
"dest_warp_id": 4
"dest_warp_id": "4"
}
],
"coord_events": [],
Expand Down
24 changes: 12 additions & 12 deletions data/maps/AbandonedShip_Corridors_1F/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,84 +44,84 @@
"y": 11,
"elevation": 3,
"dest_map": "MAP_ABANDONED_SHIP_DECK",
"dest_warp_id": 2
"dest_warp_id": "2"
},
{
"x": 8,
"y": 11,
"elevation": 3,
"dest_map": "MAP_ABANDONED_SHIP_DECK",
"dest_warp_id": 2
"dest_warp_id": "2"
},
{
"x": 0,
"y": 11,
"elevation": 3,
"dest_map": "MAP_ABANDONED_SHIP_DECK",
"dest_warp_id": 3
"dest_warp_id": "3"
},
{
"x": 1,
"y": 11,
"elevation": 3,
"dest_map": "MAP_ABANDONED_SHIP_DECK",
"dest_warp_id": 3
"dest_warp_id": "3"
},
{
"x": 11,
"y": 9,
"elevation": 3,
"dest_map": "MAP_ABANDONED_SHIP_ROOMS_1F",
"dest_warp_id": 0
"dest_warp_id": "0"
},
{
"x": 14,
"y": 9,
"elevation": 3,
"dest_map": "MAP_ABANDONED_SHIP_ROOMS_1F",
"dest_warp_id": 3
"dest_warp_id": "3"
},
{
"x": 11,
"y": 3,
"elevation": 3,
"dest_map": "MAP_ABANDONED_SHIP_ROOMS_1F",
"dest_warp_id": 2
"dest_warp_id": "2"
},
{
"x": 14,
"y": 3,
"elevation": 3,
"dest_map": "MAP_ABANDONED_SHIP_ROOMS_1F",
"dest_warp_id": 4
"dest_warp_id": "4"
},
{
"x": 3,
"y": 9,
"elevation": 3,
"dest_map": "MAP_ABANDONED_SHIP_ROOMS2_1F",
"dest_warp_id": 0
"dest_warp_id": "0"
},
{
"x": 16,
"y": 2,
"elevation": 3,
"dest_map": "MAP_ABANDONED_SHIP_CORRIDORS_B1F",
"dest_warp_id": 7
"dest_warp_id": "7"
},
{
"x": 5,
"y": 2,
"elevation": 3,
"dest_map": "MAP_ABANDONED_SHIP_CORRIDORS_B1F",
"dest_warp_id": 6
"dest_warp_id": "6"
},
{
"x": 3,
"y": 3,
"elevation": 3,
"dest_map": "MAP_ABANDONED_SHIP_ROOMS2_1F",
"dest_warp_id": 2
"dest_warp_id": "2"
}
],
"coord_events": [],
Expand Down
16 changes: 8 additions & 8 deletions data/maps/AbandonedShip_Corridors_B1F/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,56 +44,56 @@
"y": 4,
"elevation": 3,
"dest_map": "MAP_ABANDONED_SHIP_ROOMS2_B1F",
"dest_warp_id": 2
"dest_warp_id": "2"
},
{
"x": 3,
"y": 4,
"elevation": 3,
"dest_map": "MAP_ABANDONED_SHIP_ROOMS2_B1F",
"dest_warp_id": 0
"dest_warp_id": "0"
},
{
"x": 5,
"y": 7,
"elevation": 3,
"dest_map": "MAP_ABANDONED_SHIP_ROOMS_B1F",
"dest_warp_id": 0
"dest_warp_id": "0"
},
{
"x": 8,
"y": 7,
"elevation": 3,
"dest_map": "MAP_ABANDONED_SHIP_ROOMS_B1F",
"dest_warp_id": 1
"dest_warp_id": "1"
},
{
"x": 11,
"y": 7,
"elevation": 3,
"dest_map": "MAP_ABANDONED_SHIP_ROOMS_B1F",
"dest_warp_id": 2
"dest_warp_id": "2"
},
{
"x": 11,
"y": 4,
"elevation": 3,
"dest_map": "MAP_ABANDONED_SHIP_ROOM_B1F",
"dest_warp_id": 0
"dest_warp_id": "0"
},
{
"x": 0,
"y": 2,
"elevation": 3,
"dest_map": "MAP_ABANDONED_SHIP_CORRIDORS_1F",
"dest_warp_id": 10
"dest_warp_id": "10"
},
{
"x": 8,
"y": 2,
"elevation": 3,
"dest_map": "MAP_ABANDONED_SHIP_CORRIDORS_1F",
"dest_warp_id": 9
"dest_warp_id": "9"
}
],
"coord_events": [],
Expand Down
10 changes: 5 additions & 5 deletions data/maps/AbandonedShip_Deck/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,35 +17,35 @@
"y": 15,
"elevation": 3,
"dest_map": "MAP_ROUTE108",
"dest_warp_id": 0
"dest_warp_id": "0"
},
{
"x": 14,
"y": 15,
"elevation": 3,
"dest_map": "MAP_ROUTE108",
"dest_warp_id": 0
"dest_warp_id": "0"
},
{
"x": 13,
"y": 9,
"elevation": 3,
"dest_map": "MAP_ABANDONED_SHIP_CORRIDORS_1F",
"dest_warp_id": 1
"dest_warp_id": "1"
},
{
"x": 8,
"y": 9,
"elevation": 3,
"dest_map": "MAP_ABANDONED_SHIP_CORRIDORS_1F",
"dest_warp_id": 2
"dest_warp_id": "2"
},
{
"x": 12,
"y": 5,
"elevation": 3,
"dest_map": "MAP_ABANDONED_SHIP_CAPTAINS_OFFICE",
"dest_warp_id": 0
"dest_warp_id": "0"
}
],
"coord_events": [],
Expand Down
12 changes: 6 additions & 6 deletions data/maps/AbandonedShip_HiddenFloorCorridors/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,42 +17,42 @@
"y": 8,
"elevation": 3,
"dest_map": "MAP_ABANDONED_SHIP_HIDDEN_FLOOR_ROOMS",
"dest_warp_id": 0
"dest_warp_id": "0"
},
{
"x": 6,
"y": 8,
"elevation": 3,
"dest_map": "MAP_ABANDONED_SHIP_HIDDEN_FLOOR_ROOMS",
"dest_warp_id": 2
"dest_warp_id": "2"
},
{
"x": 9,
"y": 8,
"elevation": 3,
"dest_map": "MAP_ABANDONED_SHIP_HIDDEN_FLOOR_ROOMS",
"dest_warp_id": 4
"dest_warp_id": "4"
},
{
"x": 3,
"y": 3,
"elevation": 3,
"dest_map": "MAP_ABANDONED_SHIP_HIDDEN_FLOOR_ROOMS",
"dest_warp_id": 6
"dest_warp_id": "6"
},
{
"x": 6,
"y": 3,
"elevation": 3,
"dest_map": "MAP_ABANDONED_SHIP_HIDDEN_FLOOR_ROOMS",
"dest_warp_id": 7
"dest_warp_id": "7"
},
{
"x": 9,
"y": 3,
"elevation": 3,
"dest_map": "MAP_ABANDONED_SHIP_HIDDEN_FLOOR_ROOMS",
"dest_warp_id": 8
"dest_warp_id": "8"
}
],
"coord_events": [],
Expand Down
Loading

0 comments on commit fa2ab87

Please sign in to comment.