yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::core::AsarWrapper Class Reference

Modern C++ wrapper for Asar 65816 assembler integration. More...

#include <asar_wrapper.h>

Public Member Functions

 AsarWrapper ()
 
 ~AsarWrapper ()
 
 AsarWrapper (const AsarWrapper &)=delete
 
AsarWrapperoperator= (const AsarWrapper &)=delete
 
 AsarWrapper (AsarWrapper &&)=default
 
AsarWrapperoperator= (AsarWrapper &&)=default
 
absl::Status Initialize ()
 
void Shutdown ()
 
bool IsInitialized () const
 
std::string GetVersion () const
 
int GetApiVersion () const
 
absl::StatusOr< AsarPatchResultApplyPatch (const std::string &patch_path, std::vector< uint8_t > &rom_data, const std::vector< std::string > &include_paths={})
 
absl::StatusOr< AsarPatchResultApplyPatchFromString (const std::string &patch_content, std::vector< uint8_t > &rom_data, const std::string &base_path="")
 
absl::StatusOr< std::vector< AsarSymbol > > ExtractSymbols (const std::string &asm_path, const std::vector< std::string > &include_paths={})
 
absl::Status LoadSymbolsFromFile (const std::string &symbol_path)
 
std::map< std::string, AsarSymbolGetSymbolTable () const
 
std::optional< AsarSymbolFindSymbol (const std::string &name) const
 
std::vector< AsarSymbolGetSymbolsAtAddress (uint32_t address) const
 
void Reset ()
 
std::vector< std::string > GetLastErrors () const
 
std::vector< std::string > GetLastWarnings () const
 
absl::Status CreatePatch (const std::vector< uint8_t > &original_rom, const std::vector< uint8_t > &modified_rom, const std::string &patch_path)
 
absl::Status ValidateAssembly (const std::string &asm_path)
 

Private Member Functions

absl::StatusOr< AsarPatchResultApplyPatchWithBinary (const std::string &patch_path, std::vector< uint8_t > &rom_data, const std::vector< std::string > &include_paths)
 
absl::StatusOr< AsarPatchResultApplyPatchWithLibrary (const std::string &patch_path, std::vector< uint8_t > &rom_data, const std::vector< std::string > &include_paths)
 
std::optional< std::string > ResolveAsarBinary () const
 
void ProcessErrors ()
 
void ProcessWarnings ()
 
void ExtractSymbolsFromLastOperation ()
 
AsarSymbol ConvertAsarSymbol (const void *asar_symbol_data) const
 

Private Attributes

bool initialized_
 
bool library_enabled_
 
std::map< std::string, AsarSymbolsymbol_table_
 
std::vector< std::string > last_errors_
 
std::vector< std::string > last_warnings_
 

Detailed Description

Modern C++ wrapper for Asar 65816 assembler integration.

Provides a high-level interface for:

  • Patching ROMs with assembly code
  • Extracting symbol names and opcodes
  • Cross-platform compatibility (Windows, macOS, Linux)

Definition at line 48 of file asar_wrapper.h.

Constructor & Destructor Documentation

◆ AsarWrapper() [1/3]

yaze::core::AsarWrapper::AsarWrapper ( )

Definition at line 23 of file asar_wrapper.cc.

◆ ~AsarWrapper()

yaze::core::AsarWrapper::~AsarWrapper ( )

Definition at line 25 of file asar_wrapper.cc.

References initialized_, and Shutdown().

Here is the call graph for this function:

◆ AsarWrapper() [2/3]

yaze::core::AsarWrapper::AsarWrapper ( const AsarWrapper & )
delete

◆ AsarWrapper() [3/3]

yaze::core::AsarWrapper::AsarWrapper ( AsarWrapper && )
default

Member Function Documentation

◆ operator=() [1/2]

AsarWrapper & yaze::core::AsarWrapper::operator= ( const AsarWrapper & )
delete

◆ operator=() [2/2]

AsarWrapper & yaze::core::AsarWrapper::operator= ( AsarWrapper && )
default

◆ Initialize()

◆ Shutdown()

void yaze::core::AsarWrapper::Shutdown ( )

Definition at line 56 of file asar_wrapper.cc.

References initialized_, and library_enabled_.

Referenced by ~AsarWrapper().

◆ IsInitialized()

bool yaze::core::AsarWrapper::IsInitialized ( ) const
inline

Definition at line 61 of file asar_wrapper.h.

References initialized_.

◆ GetVersion()

std::string yaze::core::AsarWrapper::GetVersion ( ) const

Definition at line 64 of file asar_wrapper.cc.

References initialized_, and library_enabled_.

◆ GetApiVersion()

int yaze::core::AsarWrapper::GetApiVersion ( ) const

Definition at line 85 of file asar_wrapper.cc.

References initialized_, and library_enabled_.

◆ ApplyPatch()

absl::Status yaze::core::AsarWrapper::ApplyPatch ( const std::string & patch_path,
std::vector< uint8_t > & rom_data,
const std::vector< std::string > & include_paths = {} )

◆ ApplyPatchFromString()

absl::StatusOr< AsarPatchResult > yaze::core::AsarWrapper::ApplyPatchFromString ( const std::string & patch_content,
std::vector< uint8_t > & rom_data,
const std::string & base_path = "" )

Definition at line 121 of file asar_wrapper.cc.

References ApplyPatch(), initialized_, and Reset().

Here is the call graph for this function:

◆ ExtractSymbols()

absl::StatusOr< std::vector< AsarSymbol > > yaze::core::AsarWrapper::ExtractSymbols ( const std::string & asm_path,
const std::vector< std::string > & include_paths = {} )

Definition at line 154 of file asar_wrapper.cc.

References ApplyPatch(), initialized_, library_enabled_, and Reset().

Here is the call graph for this function:

◆ LoadSymbolsFromFile()

absl::Status yaze::core::AsarWrapper::LoadSymbolsFromFile ( const std::string & symbol_path)

◆ GetSymbolTable()

std::map< std::string, AsarSymbol > yaze::core::AsarWrapper::GetSymbolTable ( ) const

◆ FindSymbol()

std::optional< AsarSymbol > yaze::core::AsarWrapper::FindSymbol ( const std::string & name) const

Definition at line 186 of file asar_wrapper.cc.

References symbol_table_.

◆ GetSymbolsAtAddress()

std::vector< AsarSymbol > yaze::core::AsarWrapper::GetSymbolsAtAddress ( uint32_t address) const

Definition at line 194 of file asar_wrapper.cc.

References symbol_table_.

◆ Reset()

void yaze::core::AsarWrapper::Reset ( )

◆ GetLastErrors()

std::vector< std::string > yaze::core::AsarWrapper::GetLastErrors ( ) const
inline

Definition at line 86 of file asar_wrapper.h.

References last_errors_.

◆ GetLastWarnings()

std::vector< std::string > yaze::core::AsarWrapper::GetLastWarnings ( ) const
inline

Definition at line 87 of file asar_wrapper.h.

References last_warnings_.

◆ CreatePatch()

absl::Status yaze::core::AsarWrapper::CreatePatch ( const std::vector< uint8_t > & original_rom,
const std::vector< uint8_t > & modified_rom,
const std::string & patch_path )

Definition at line 215 of file asar_wrapper.cc.

◆ ValidateAssembly()

absl::Status yaze::core::AsarWrapper::ValidateAssembly ( const std::string & asm_path)

Definition at line 227 of file asar_wrapper.cc.

References ApplyPatch(), and library_enabled_.

Referenced by yaze::editor::AssemblyEditor::ValidateCurrentFile().

Here is the call graph for this function:

◆ ApplyPatchWithBinary()

absl::StatusOr< AsarPatchResult > yaze::core::AsarWrapper::ApplyPatchWithBinary ( const std::string & patch_path,
std::vector< uint8_t > & rom_data,
const std::vector< std::string > & include_paths )
private
Todo
CRC32 for CLI path

Definition at line 346 of file asar_wrapper.cc.

References yaze::core::AsarPatchResult::crc32, last_errors_, last_warnings_, ResolveAsarBinary(), yaze::core::AsarPatchResult::rom_size, and yaze::core::AsarPatchResult::success.

Referenced by ApplyPatch().

Here is the call graph for this function:

◆ ApplyPatchWithLibrary()

absl::StatusOr< AsarPatchResult > yaze::core::AsarWrapper::ApplyPatchWithLibrary ( const std::string & patch_path,
std::vector< uint8_t > & rom_data,
const std::vector< std::string > & include_paths )
private

◆ ResolveAsarBinary()

std::optional< std::string > yaze::core::AsarWrapper::ResolveAsarBinary ( ) const
private

Definition at line 454 of file asar_wrapper.cc.

Referenced by ApplyPatchWithBinary().

◆ ProcessErrors()

void yaze::core::AsarWrapper::ProcessErrors ( )
private

Definition at line 256 of file asar_wrapper.cc.

References last_errors_.

Referenced by ApplyPatchWithLibrary().

◆ ProcessWarnings()

void yaze::core::AsarWrapper::ProcessWarnings ( )
private

Definition at line 269 of file asar_wrapper.cc.

References last_warnings_.

Referenced by ApplyPatchWithLibrary().

◆ ExtractSymbolsFromLastOperation()

◆ ConvertAsarSymbol()

AsarSymbol yaze::core::AsarWrapper::ConvertAsarSymbol ( const void * asar_symbol_data) const
private

Definition at line 549 of file asar_wrapper.cc.

Member Data Documentation

◆ initialized_

bool yaze::core::AsarWrapper::initialized_
private

◆ library_enabled_

bool yaze::core::AsarWrapper::library_enabled_
private

◆ symbol_table_

std::map<std::string, AsarSymbol> yaze::core::AsarWrapper::symbol_table_
private

◆ last_errors_

std::vector<std::string> yaze::core::AsarWrapper::last_errors_
private

◆ last_warnings_

std::vector<std::string> yaze::core::AsarWrapper::last_warnings_
private

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