Porytiles
Loading...
Searching...
No Matches
porytiles::MetatileAttributeScanner Class Reference

Scans a decomp project's fieldmap sources for the raw metatile attribute facts. More...

#include <metatile_attribute_scanner.hpp>

Public Member Functions

 MetatileAttributeScanner (std::filesystem::path project_root, gsl::not_null< const TextFormatter * > format, gsl::not_null< const UserDiagnostics * > diag)
 Constructs a MetatileAttributeScanner.
 
MetatileAttributeScan scan_project () const
 Scans the project's fieldmap sources and returns the gathered facts.
 

Detailed Description

Scans a decomp project's fieldmap sources for the raw metatile attribute facts.

This class just gathers facts about the sources, it does not try to interpret those facts. The scanner reads three pre-defined files:

  • include/global.fieldmap.h: every integer #define and enum member, the ambiguous-define set, and the raw pointed-to type of struct Tileset's metatileAttributes member.
  • src/fieldmap.c: the exact-name sMetatileAttrMasks and sMetatileAttrShifts tables, seeded with the header's symbols so FRLG-macro entries resolve. A missing file or missing table simply leaves the tables empty.
  • include/constants/metatile_behaviors.h: what sits where the behavior constants header should be, as a four-way fact (absent, unreadable, scanned but declaring no MB_ name, or declaring at least one, whether as #defines on pokefirered or enum members on pokeemerald) plus the path looked at.

What the facts mean (candidate mask layouts, field names, widths) is decided by the domain inference and reconciliation. A missing fieldmap header is not an error: the scan simply comes back empty and the caller can treat the project as stating nothing about its attribute layout. A file that exists but cannot be read is a different matter, and one the scanner records rather than flattening into "absent": it warns, and lists the path in unreadable_sources so the missing facts are not mistaken for facts the project never stated.

Definition at line 32 of file metatile_attribute_scanner.hpp.

Constructor & Destructor Documentation

◆ MetatileAttributeScanner()

porytiles::MetatileAttributeScanner::MetatileAttributeScanner ( std::filesystem::path  project_root,
gsl::not_null< const TextFormatter * >  format,
gsl::not_null< const UserDiagnostics * >  diag 
)

Constructs a MetatileAttributeScanner.

Parameters
project_rootThe root directory of the decomp project
formatThe formatter used by the tolerant C parser
diagThe sink the recoverable scan warnings are emitted to

Definition at line 103 of file metatile_attribute_scanner.cpp.

Member Function Documentation

◆ scan_project()

MetatileAttributeScan porytiles::MetatileAttributeScanner::scan_project ( ) const

Scans the project's fieldmap sources and returns the gathered facts.

Recoverable scan problems (an unreadable file, a conflicting redefinition in an undecidable region) are emitted to diagnostics under the "metatile-attribute-inference" tag.

Returns
The raw facts and the paths they were read from

Definition at line 111 of file metatile_attribute_scanner.cpp.


The documentation for this class was generated from the following files: