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

Detects the base game of a decompilation project. More...

#include <base_game_detector.hpp>

Public Member Functions

 BaseGameDetector (std::filesystem::path project_root, gsl::not_null< const TextFormatter * > format, gsl::not_null< const UserDiagnostics * > diag)
 
ChainableResult< BaseGamedetect () const
 Detects the base game for the project.
 

Detailed Description

Detects the base game of a decompilation project.

Inspects the project's include/global.fieldmap.h header to determine which of the four supported base games the project targets: pokeemerald, pokefirered, pokeruby, or pokeemerald-expansion. Detection is based on content heuristics within the header file:

  • METATILE_ATTRIBUTE_BEHAVIOR (enum-based) -> pokefirered
  • METATILE_ATTR_BEHAVIOR_MASK + MAPGRID_METATILE_ID_SHIFT + swapPalettes -> pokeemerald-expansion
  • METATILE_ATTR_BEHAVIOR_MASK + MAPGRID_METATILE_ID_SHIFT -> pokeemerald
  • METATILE_ATTR_BEHAVIOR_MASK only -> pokeruby

Emits a diagnostic remark with tag "base-game-detection" on successful detection.

Definition at line 29 of file base_game_detector.hpp.

Constructor & Destructor Documentation

◆ BaseGameDetector()

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

Definition at line 31 of file base_game_detector.hpp.

Member Function Documentation

◆ detect()

ChainableResult< BaseGame > porytiles::BaseGameDetector::detect ( ) const

Detects the base game for the project.

Reads include/global.fieldmap.h and scans for content markers that uniquely identify each supported base game. Returns an error if the file is missing, unreadable, or contains no recognized markers.

Returns
The detected BaseGame, or an error if detection fails

Definition at line 9 of file base_game_detector.cpp.


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