yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::util Namespace Reference

Namespaces

namespace  anonymous_namespace{bps.cc}
 
namespace  anonymous_namespace{hex.cc}
 

Classes

class  FileDialogWrapper
 
class  Flag
 
class  FlagParser
 
class  FlagRegistry
 
struct  HexStringParams
 
class  IFlag
 
class  LogManager
 A singleton that manages all logging configuration and output. More...
 
class  NotifyValue
 A class to manage a value that can be modified and notify when it changes. More...
 
class  PlatformPaths
 Cross-platform utilities for file system paths. More...
 
struct  SDL_Deleter
 Deleter for SDL_Window and SDL_Renderer. More...
 
struct  SDL_Surface_Deleter
 
struct  SDL_Texture_Deleter
 

Enumerations

enum class  Platform {
  kUnknown , kMacOS , kiOS , kWindows ,
  kLinux
}
 
enum class  LogLevel {
  YAZE_DEBUG , INFO , WARNING , ERROR ,
  FATAL
}
 Defines the severity levels for log messages. This allows for filtering messages based on their importance. More...
 

Functions

absl::Status ApplyBpsPatch (const std::vector< uint8_t > &source, const std::vector< uint8_t > &patch, std::vector< uint8_t > &output)
 
absl::Status CreateBpsPatch (const std::vector< uint8_t > &source, const std::vector< uint8_t > &target, std::vector< uint8_t > &patch)
 
std::string GetFileExtension (const std::string &filename)
 Gets the file extension from a filename.
 
std::string GetFileName (const std::string &filename)
 Gets the filename from a full path.
 
std::string LoadFile (const std::string &filename)
 Loads the entire contents of a file into a string.
 
std::string LoadFileFromConfigDir (const std::string &filename)
 Loads a file from the user's config directory.
 
void SaveFile (const std::string &filename, const std::string &contents)
 
std::string GetResourcePath (const std::string &resource_path)
 
std::string GetBundleResourcePath ()
 GetBundleResourcePath returns the path to the bundle resource directory. Specific to MacOS.
 
FlagRegistryglobal_flag_registry ()
 
std::string HexByte (uint8_t byte, HexStringParams params)
 
std::string HexWord (uint16_t word, HexStringParams params)
 
std::string HexLong (uint32_t dword, HexStringParams params)
 
std::string HexLongLong (uint64_t qword, HexStringParams params)
 
template<typename... Args>
void logf (const absl::FormatSpec< Args... > &format, Args &&... args)
 
void logf (absl::string_view message)
 

Enumeration Type Documentation

◆ Platform

enum class yaze::util::Platform
strong
Enumerator
kUnknown 
kMacOS 
kiOS 
kWindows 
kLinux 

Definition at line 52 of file file_util.h.

◆ LogLevel

enum class yaze::util::LogLevel
strong

Defines the severity levels for log messages. This allows for filtering messages based on their importance.

Enumerator
YAZE_DEBUG 
INFO 
WARNING 
ERROR 
FATAL 

Definition at line 27 of file log.h.

Function Documentation

◆ ApplyBpsPatch()

absl::Status yaze::util::ApplyBpsPatch ( const std::vector< uint8_t > &  source,
const std::vector< uint8_t > &  patch,
std::vector< uint8_t > &  output 
)

◆ CreateBpsPatch()

absl::Status yaze::util::CreateBpsPatch ( const std::vector< uint8_t > &  source,
const std::vector< uint8_t > &  target,
std::vector< uint8_t > &  patch 
)

Definition at line 85 of file bps.cc.

◆ GetFileExtension()

std::string yaze::util::GetFileExtension ( const std::string &  filename)

Gets the file extension from a filename.

Uses std::filesystem for cross-platform consistency.

Parameters
filenameThe name of the file.
Returns
The file extension, or an empty string if none is found.

Definition at line 15 of file file_util.cc.

Referenced by yaze::editor::AgentChatWidget::CreateNewFileInEditor(), yaze::editor::EditorManager::DrawMenuBar(), yaze::editor::AgentChatWidget::OpenFileInEditor(), and yaze::emu::ui::RenderNavBar().

◆ GetFileName()

std::string yaze::util::GetFileName ( const std::string &  filename)

Gets the filename from a full path.

Uses std::filesystem for cross-platform consistency.

Parameters
filenameThe full path to the file.
Returns
The filename, including the extension.

Definition at line 19 of file file_util.cc.

Referenced by yaze::gui::ThemeManager::DiscoverAvailableThemeFiles(), yaze::editor::EditorManager::DrawMenuBar(), yaze::editor::AgentChatWidget::LoadAgentSettingsFromProject(), yaze::emu::ui::RenderNavBar(), and yaze::editor::AgentChatWidget::RenderSystemPromptEditor().

◆ LoadFile()

std::string yaze::util::LoadFile ( const std::string &  filename)

Loads the entire contents of a file into a string.

Throws a std::runtime_error if the file cannot be opened.

Parameters
filenameThe full, absolute path to the file.
Returns
The contents of the file as a string.

Definition at line 23 of file file_util.cc.

Referenced by yaze::cli::anonymous_namespace{tui.cc}::ApplyBpsPatchComponent(), yaze::editor::AssemblyEditor::ChangeActiveFile(), yaze::cli::handlers::ProjectBuildCommandHandler::Execute(), yaze::editor::UserSettings::Load(), yaze::editor::WorkspaceManager::RefreshPresets(), and yaze::editor::AgentChatWidget::RenderSystemPromptEditor().

◆ LoadFileFromConfigDir()

std::string yaze::util::LoadFileFromConfigDir ( const std::string &  filename)

Loads a file from the user's config directory.

Parameters
filenameThe name of the file inside the config directory.
Returns
The contents of the file, or an empty string if not found.

Definition at line 38 of file file_util.cc.

References yaze::util::PlatformPaths::GetConfigDirectory().

Referenced by yaze::editor::EditorSelectionDialog::LoadRecentEditors().

Here is the call graph for this function:

◆ SaveFile()

void yaze::util::SaveFile ( const std::string &  filename,
const std::string &  contents 
)

◆ GetResourcePath()

std::string yaze::util::GetResourcePath ( const std::string &  resource_path)

◆ GetBundleResourcePath()

std::string yaze::util::GetBundleResourcePath ( )

GetBundleResourcePath returns the path to the bundle resource directory. Specific to MacOS.

Referenced by GetResourcePath(), yaze::AssetLoader::GetSearchPaths(), yaze::gui::ThemeManager::GetThemeSearchPaths(), and yaze::anonymous_namespace{font_loader.cc}::SetFontPath().

◆ global_flag_registry()

FlagRegistry * yaze::util::global_flag_registry ( )
inline

Definition at line 115 of file flag.h.

Referenced by main(), and yaze::util::FlagParser::Parse().

◆ HexByte()

◆ HexWord()

◆ HexLong()

std::string yaze::util::HexLong ( uint32_t  dword,
HexStringParams  params 
)

◆ HexLongLong()

std::string yaze::util::HexLongLong ( uint64_t  qword,
HexStringParams  params 
)

◆ logf() [1/2]

template<typename... Args>
void yaze::util::logf ( const absl::FormatSpec< Args... > &  format,
Args &&...  args 
)
inline

Definition at line 116 of file log.h.

References INFO, yaze::util::LogManager::instance(), and yaze::util::LogManager::log().

Referenced by yaze::zelda3::Overworld::AssembleMap16Tiles(), yaze::zelda3::Overworld::AssembleMap32Tiles(), yaze::editor::Tile16Editor::CommitChangesToOverworld(), yaze::editor::Tile16Editor::CyclePalette(), yaze::zelda3::Overworld::DecompressAllMapTilesParallel(), yaze::editor::Tile16Editor::DiscardChanges(), yaze::editor::Tile16Editor::DrawPaletteSettings(), yaze::editor::Tile16Editor::DrawToCurrentTile16(), yaze::zelda3::Overworld::EnsureMapBuilt(), yaze::zelda3::Overworld::LoadOverworldMaps(), yaze::editor::OverworldEditor::LoadScratchToSelection(), yaze::editor::Tile16Editor::LoadTile8(), yaze::editor::ParseMessageToData(), yaze::editor::Tile16Editor::PickTile8FromTile16(), yaze::editor::Tile16Editor::RefreshAllPalettes(), yaze::editor::Tile16Editor::RefreshTile16Blockset(), yaze::editor::Tile16Editor::RegenerateTile16BitmapFromROM(), yaze::zelda3::Overworld::SaveAreaSizes(), yaze::zelda3::Overworld::SaveAreaSpecificBGColors(), yaze::zelda3::Overworld::SaveCustomOverworldASM(), yaze::zelda3::Overworld::SaveEntrances(), yaze::zelda3::Overworld::SaveExits(), yaze::zelda3::Overworld::SaveItems(), yaze::zelda3::Overworld::SaveLargeMaps(), yaze::zelda3::Overworld::SaveLargeMapsExpanded(), yaze::zelda3::Overworld::SaveMap16Tiles(), yaze::zelda3::Overworld::SaveMap32Tiles(), yaze::zelda3::Overworld::SaveMapOverlays(), yaze::zelda3::Overworld::SaveMapProperties(), yaze::zelda3::Overworld::SaveMusic(), yaze::zelda3::Overworld::SaveOverworldMaps(), yaze::zelda3::Overworld::SaveOverworldTilesType(), yaze::editor::Tile16Editor::set_palette(), yaze::editor::Tile16Editor::SetCurrentTile(), yaze::editor::EditorManager::SwitchToSession(), yaze::editor::Tile16Editor::UpdateBlockset(), yaze::editor::Tile16Editor::UpdateROMTile16Data(), yaze::editor::Tile16Editor::UpdateTile16Edit(), and yaze::editor::Tile16Editor::UpdateTile8Palette().

Here is the call graph for this function:

◆ logf() [2/2]

void yaze::util::logf ( absl::string_view  message)
inline

Definition at line 121 of file log.h.

References INFO, yaze::util::LogManager::instance(), and yaze::util::LogManager::log().

Here is the call graph for this function: