5#include <unordered_map>
8#include "absl/status/status.h"
9#include "absl/strings/str_format.h"
25#include "imgui/imgui.h"
26#include "imgui_memory_editor.h"
46 [
this]() { DrawOverworldCanvas(); });
48 [
this]() { status_ = DrawTileSelector(); });
50 if (rom_->is_loaded()) {
51 status_ = UpdateUsageStats();
55 [
this]() { DrawToolset(); });
57 if (rom_->is_loaded()) {
58 status_ = tile16_editor_.Update();
62 if (rom_->is_loaded()) {
63 status_ = gfx_group_editor_.Update();
75 return absl::OkStatus();
91 static bool use_work_area =
true;
92 static ImGuiWindowFlags flags = ImGuiWindowFlags_NoDecoration |
93 ImGuiWindowFlags_NoMove |
94 ImGuiWindowFlags_NoSavedSettings;
95 const ImGuiViewport *viewport = ImGui::GetMainViewport();
96 ImGui::SetNextWindowPos(use_work_area ? viewport->WorkPos : viewport->Pos);
97 ImGui::SetNextWindowSize(use_work_area ? viewport->WorkSize : viewport->Size);
108 static bool show_gfx_group =
false;
109 static bool show_properties =
false;
188 std::vector<uint8_t> png_data;
190 if (png_data.size() > 0) {
194 "Failed to convert overworld map surface to PNG");
204 [&]() { Checkbox(
"Properties", &show_properties); });
212 ImGuiWindowFlags_MenuBar);
217 if (show_gfx_group) {
223 if (show_properties) {
224 ImGui::Begin(
"Properties", &show_properties);
230 if (!ImGui::IsAnyItemActive()) {
231 if (ImGui::IsKeyDown(ImGuiKey_1)) {
233 }
else if (ImGui::IsKeyDown(ImGuiKey_2)) {
235 }
else if (ImGui::IsKeyDown(ImGuiKey_3)) {
237 }
else if (ImGui::IsKeyDown(ImGuiKey_4)) {
239 }
else if (ImGui::IsKeyDown(ImGuiKey_5)) {
241 }
else if (ImGui::IsKeyDown(ImGuiKey_6)) {
243 }
else if (ImGui::IsKeyDown(ImGuiKey_7)) {
245 }
else if (ImGui::IsKeyDown(ImGuiKey_8)) {
252 "##WorldId",
"##GfxId",
"##PalId",
"##SprGfxId",
253 "##5thCol",
"##6thCol",
"##7thCol",
"##8thCol"};
258 ImGui::TableSetupColumn(name);
261 ImGui::SetNextItemWidth(120.f);
268 ->mutable_area_graphics(),
279 ->mutable_area_palette(),
312 ImGui::SetNextItemWidth(100.f);
319 HOVER_HINT(
"Enable Mosaic effect for the current map");
328 ImGui::TableSetupColumn(name);
331 ImGui::SetNextItemWidth(120.f);
334 static const std::array<std::string, 8> kCustomMapSettingsColumnNames = {
335 "TileGfx0",
"TileGfx1",
"TileGfx2",
"TileGfx3",
336 "TileGfx4",
"TileGfx5",
"TileGfx6",
"TileGfx7"};
337 for (
int i = 0; i < 8; ++i) {
342 ->mutable_custom_tileset(i),
354 ->mutable_area_palette(),
387 ImGui::SetNextItemWidth(100.f);
394 HOVER_HINT(
"Enable Mosaic effect for the current map");
403 for (
int i = 0; i < 0x40; i++) {
436 int mouse_x = mouse_position.x;
437 int mouse_y = mouse_position.y;
443 auto &selected_world =
446 :
overworld_.mutable_map_tiles()->special_world;
448 int index_x = superX * 32 + tile16_x;
449 int index_y = superY * 32 + tile16_y;
455 const ImVec2 &click_position,
const std::vector<uint8_t> &tile_data) {
463 ImVec2 start_position;
494 if (ImGui::IsMouseClicked(ImGuiMouseButton_Left) ||
495 ImGui::IsMouseDragging(ImGuiMouseButton_Left)) {
496 auto &selected_world =
500 :
overworld_.mutable_map_tiles()->special_world;
511 if (start_x > end_x) std::swap(start_x, end_x);
512 if (start_y > end_y) std::swap(start_y, end_y);
514 constexpr int local_map_size = 512;
516 constexpr int tiles_per_local_map = local_map_size /
kTile16Size;
518 for (
int y = start_y, i = 0; y <= end_y; y +=
kTile16Size) {
519 for (
int x = start_x; x <= end_x; x +=
kTile16Size, ++i) {
521 int local_map_x = x / local_map_size;
522 int local_map_y = y / local_map_size;
529 int index_x = local_map_x * tiles_per_local_map + tile16_x;
530 int index_y = local_map_y * tiles_per_local_map + tile16_y;
531 int tile16_id =
overworld_.GetTileFromPosition(
533 selected_world[index_x][index_y] = tile16_id;
552 static std::vector<int> tile16_ids;
555 if (tile16_ids.size() != 0) {
561 tile16_ids.push_back(
overworld_.GetTileFromPosition(each));
571 const auto mouse_position = ImGui::GetIO().MousePos;
572 const int large_map_size = 1024;
592 const int highlight_parent =
593 overworld_.overworld_map(current_highlighted_map)->parent();
594 const int parent_map_x = highlight_parent % 8;
595 const int parent_map_y = highlight_parent / 8;
600 const int current_map_x = current_highlighted_map % 8;
601 const int current_map_y = current_highlighted_map / 8;
608 ImGui::IsMouseClicked(ImGuiMouseButton_Right)) {
615 return absl::OkStatus();
619 if (ImGui::IsMouseDragging(ImGuiMouseButton_Middle)) {
625 if (ImGui::IsMouseReleased(ImGuiMouseButton_Middle) &&
673 if (ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows) &&
674 ImGui::IsMouseDragging(ImGuiMouseButton_Middle)) {
675 ImGui::SetScrollX(ImGui::GetScrollX() + ImGui::GetIO().MouseWheelH * 16.0f);
676 ImGui::SetScrollY(ImGui::GetScrollY() + ImGui::GetIO().MouseWheel * 16.0f);
694 int grid_x =
static_cast<int>(tile_pos.x / 32);
695 int grid_y =
static_cast<int>(tile_pos.y / 32);
696 int id = grid_x + grid_y * 8;
712 return absl::OkStatus();
721 int offset = 0x40 * (key + 1);
726 auto texture = value.texture();
728 (ImTextureID)(intptr_t)texture,
766 return absl::OkStatus();
771 ImGuiTabBarFlags_FittingPolicyScroll)) {
772 if (BeginTabItem(
"Tile16")) {
776 if (BeginTabItem(
"Tile8")) {
784 if (BeginTabItem(
"Area Graphics")) {
790 return absl::OkStatus();
799 auto color = ImVec4(255, 255, 0, 100);
801 color = ImVec4(255, 255, 255, 200);
811 ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)) {
816 ImGui::IsMouseClicked(ImGuiMouseButton_Right)) {
829 auto deleted_entrance_id =
overworld_.deleted_entrances().back();
831 auto &entrance =
overworld_.entrances()[deleted_entrance_id];
833 entrance.entrance_id_ = deleted_entrance_id;
836 entrance.deleted =
false;
840 const auto is_hovering =
843 if (!is_hovering && ImGui::IsMouseClicked(ImGuiMouseButton_Right)) {
844 ImGui::OpenPopup(
"Entrance Inserter");
852 overworld_.mutable_deleted_entrances()->emplace_back(
861 for (
auto &each : *
overworld_.mutable_exits()) {
865 ImVec4(255, 255, 255, 150));
873 ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)) {
878 ImGui::IsMouseClicked(ImGuiMouseButton_Right)) {
883 ImGui::OpenPopup(
"Exit editor");
899 if (!hovering && ImGui::IsMouseClicked(ImGuiMouseButton_Right)) {
900 ImGui::OpenPopup(
"Exit Inserter");
912 for (
auto &item : *
overworld_.mutable_all_items()) {
916 ow_map_canvas_.DrawRect(item.x_, item.y_, 16, 16, ImVec4(255, 0, 0, 150));
926 if (hovering && ImGui::IsMouseClicked(ImGuiMouseButton_Right)) {
932 std::string item_name =
"";
936 item_name = absl::StrFormat(
"0x%02X", item.id_);
949 if (!hovering && ImGui::IsMouseClicked(ImGuiMouseButton_Right)) {
950 ImGui::OpenPopup(
"Item Inserter");
963 if (!sprite.deleted()) {
964 int map_x = sprite.map_x();
965 int map_y = sprite.map_y();
967 ImVec4(255, 0, 255, 150));
974 ImGui::IsMouseClicked(ImGuiMouseButton_Right)) {
986 ow_map_canvas_.DrawText(absl::StrFormat(
"%s", sprite.name()), map_x,
998 if (!hovering && ImGui::IsMouseClicked(ImGuiMouseButton_Right)) {
999 ImGui::OpenPopup(
"Sprite Inserter");
1029 return absl::OkStatus();
1033 util::logf(
"Loading overworld.");
1038 util::logf(
"Loading overworld graphics.");
1044 util::logf(
"Loading overworld tileset.");
1047 0x80, 0x2000, 0x08,
overworld_.tile16_blockset_data(),
1052 auto tile16_blockset_data =
overworld_.tile16_blockset_data();
1054 util::logf(
"Loading overworld tile16 graphics.");
1064 uint8_t value = tile16_blockset_data[(i % 8 *
kTile16Size) +
1075 util::logf(
"Loading overworld maps.");
1079 auto palette =
overworld_.current_area_palette();
1084 }
catch (
const std::bad_alloc &e) {
1085 std::cout <<
"Error: " << e.what() << std::endl;
1094 return absl::OkStatus();
1099 const int depth = 0x10;
1100 for (
int i = 0; i < 3; i++)
1101 for (
auto const &sprite : *
overworld_.mutable_sprites(i)) {
1102 int width = sprite.width();
1103 int height = sprite.height();
1104 if (width == 0 || height == 0) {
1111 *sprite.preview_graphics());
1115 return absl::OkStatus();
1119 overworld_.mutable_overworld_map(map_index)->LoadAreaGraphics();
1128 overworld_.mutable_overworld_map(map_index)->bitmap_data());
1129 maps_bmp_[map_index].set_modified(
true);
1134 std::vector<std::future<void>> futures;
1137 auto refresh_map_async = [
this](
int map_index) {
1146 for (
int i = 1; i < 4; i++) {
1147 int sibling_index =
overworld_.overworld_map(source_map_id)->parent() + i;
1148 if (i >= 2) sibling_index += 6;
1150 std::async(std::launch::async, refresh_map_async, sibling_index));
1151 indices[i] = sibling_index;
1154 indices[0] = source_map_id;
1156 std::async(std::launch::async, refresh_map_async, source_map_id));
1158 for (
auto &each : futures) {
1162 int n = is_large ? 4 : 1;
1164 for (
int i = 0; i < n; ++i) {
1172 const auto current_map_palette =
overworld_.current_area_palette();
1176 for (
int i = 1; i < 4; i++) {
1178 if (i >= 2) sibling_index += 6;
1180 overworld_.mutable_overworld_map(sibling_index)->LoadPalette());
1181 maps_bmp_[sibling_index].SetPalette(current_map_palette);
1186 return absl::OkStatus();
1191 if (current_ow_map.is_large_map()) {
1193 for (
int i = 1; i < 4; i++) {
1194 int sibling_index = current_ow_map.parent() + i;
1198 auto &map = *
overworld_.mutable_overworld_map(sibling_index);
1199 map.set_area_graphics(current_ow_map.area_graphics());
1200 map.set_area_palette(current_ow_map.area_palette());
1205 map.set_message_id(current_ow_map.message_id());
1213 return absl::OkStatus();
1224 const auto tile16_data =
overworld_.tile16_blockset_data();
1227 std::vector<std::future<absl::Status>> futures;
1229 futures.push_back(std::async(
1231 [&](
int index) -> absl::Status {
1232 std::vector<uint8_t> tile_data(16 * 16, 0x00);
1233 for (
int ty = 0; ty < 16; ty++) {
1234 for (
int tx = 0; tx < 16; tx++) {
1235 int position = tx + (ty * 0x10);
1237 tile16_data[(index % 8 * 16) + (index / 8 * 16 * 0x80) +
1239 tile_data[position] = value;
1244 return absl::OkStatus();
1249 for (
auto &future : futures) {
1259 return absl::OkStatus();
1263 static bool init_properties =
false;
1265 if (!init_properties) {
1266 for (
int i = 0; i < 0x40; i++) {
1267 std::string area_graphics_str = absl::StrFormat(
1268 "%02hX",
overworld_.overworld_map(i)->area_graphics());
1270 ->push_back(area_graphics_str);
1272 area_graphics_str = absl::StrFormat(
1273 "%02hX",
overworld_.overworld_map(i + 0x40)->area_graphics());
1275 ->push_back(area_graphics_str);
1277 std::string area_palette_str =
1278 absl::StrFormat(
"%02hX",
overworld_.overworld_map(i)->area_palette());
1280 ->push_back(area_palette_str);
1282 area_palette_str = absl::StrFormat(
1283 "%02hX",
overworld_.overworld_map(i + 0x40)->area_palette());
1285 ->push_back(area_palette_str);
1286 std::string sprite_gfx_str = absl::StrFormat(
1287 "%02hX",
overworld_.overworld_map(i)->sprite_graphics(1));
1289 ->push_back(sprite_gfx_str);
1291 sprite_gfx_str = absl::StrFormat(
1292 "%02hX",
overworld_.overworld_map(i)->sprite_graphics(2));
1294 ->push_back(sprite_gfx_str);
1296 sprite_gfx_str = absl::StrFormat(
1297 "%02hX",
overworld_.overworld_map(i + 0x40)->sprite_graphics(1));
1299 ->push_back(sprite_gfx_str);
1301 sprite_gfx_str = absl::StrFormat(
1302 "%02hX",
overworld_.overworld_map(i + 0x40)->sprite_graphics(2));
1304 ->push_back(sprite_gfx_str);
1306 std::string sprite_palette_str = absl::StrFormat(
1307 "%02hX",
overworld_.overworld_map(i)->sprite_palette(1));
1309 ->push_back(sprite_palette_str);
1311 sprite_palette_str = absl::StrFormat(
1312 "%02hX",
overworld_.overworld_map(i)->sprite_palette(2));
1314 ->push_back(sprite_palette_str);
1316 sprite_palette_str = absl::StrFormat(
1317 "%02hX",
overworld_.overworld_map(i + 0x40)->sprite_palette(1));
1319 ->push_back(sprite_palette_str);
1321 sprite_palette_str = absl::StrFormat(
1322 "%02hX",
overworld_.overworld_map(i + 0x40)->sprite_palette(2));
1324 ->push_back(sprite_palette_str);
1326 init_properties =
true;
1329 Text(
"Area Gfx LW/DW");
1337 Text(
"Sprite Gfx LW/DW");
1351 Text(
"Area Pal LW/DW");
1358 static bool show_gfx_group =
false;
1359 Checkbox(
"Show Gfx Group Editor", &show_gfx_group);
1360 if (show_gfx_group) {
1368 if (BeginTable(
"UsageStatsTable", 3,
kOWEditFlags, ImVec2(0, 0))) {
1369 TableSetupColumn(
"Entrances");
1370 TableSetupColumn(
"Grid", ImGuiTableColumnFlags_WidthStretch,
1371 ImGui::GetContentRegionAvail().x);
1372 TableSetupColumn(
"Usage", ImGuiTableColumnFlags_WidthFixed, 256);
1377 if (BeginChild(
"UnusedSpritesetScroll", ImVec2(0, 0),
true,
1378 ImGuiWindowFlags_HorizontalScrollbar)) {
1379 for (
int i = 0; i < 0x81; i++) {
1380 auto entrance_name =
rom_->resource_label()->CreateOrGetLabel(
1383 std::string str = absl::StrFormat(
"%#x - %s", i, entrance_name);
1386 ? ImGuiSelectableFlags_Disabled
1392 if (IsItemHovered()) {
1394 Text(
"Entrance ID: %d", i);
1395 Text(
"Map ID: %d",
overworld_.entrances().at(i).map_id_);
1396 Text(
"Entrance ID: %d",
overworld_.entrances().at(i).entrance_id_);
1397 Text(
"X: %d",
overworld_.entrances().at(i).x_);
1398 Text(
"Y: %d",
overworld_.entrances().at(i).y_);
1400 overworld_.entrances().at(i).deleted ?
"Yes" :
"No");
1415 return absl::OkStatus();
1420 int total_squares = 128;
1421 int squares_wide = 8;
1422 int squares_tall = (total_squares + squares_wide - 1) /
1426 for (
int row = 0; row < squares_tall; ++row) {
1429 for (
int col = 0; col < squares_wide; ++col) {
1430 if (row * squares_wide + col >= total_squares) {
1438 PushStyleColor(ImGuiCol_Button,
1439 ImVec4(1.0f, 0.5f, 0.0f,
1444 if (Button(
"##square", ImVec2(20, 20))) {
1456 if (IsItemHovered()) {
1469 int relative_x = (int)
ow_map_canvas_.drawn_tile_position().x % 512;
1470 int relative_y = (int)
ow_map_canvas_.drawn_tile_position().y % 512;
1471 Text(
"Current Tile16 Drawn Position (Relative): %d, %d", relative_x,
1475 Text(
"Light World Map Tiles: %d",
1476 (
int)
overworld_.mutable_map_tiles()->light_world.size());
1477 Text(
"Dark World Map Tiles: %d",
1478 (
int)
overworld_.mutable_map_tiles()->dark_world.size());
1479 Text(
"Special World Map Tiles: %d",
1480 (
int)
overworld_.mutable_map_tiles()->special_world.size());
1482 static bool view_lw_map_tiles =
false;
1483 static MemoryEditor mem_edit;
1485 if (Button(
"View Light World Map Tiles")) {
1486 view_lw_map_tiles = !view_lw_map_tiles;
1489 if (view_lw_map_tiles) {
1490 mem_edit.DrawContents(
1512 return absl::OkStatus();
1518 bmp.CleanupUnusedTexture(current_time, timeout);
1521 bmp.CleanupUnusedTexture(current_time, timeout);
static GraphicsSheetManager & GetInstance()
absl::Status Clear() override
gui::zeml::Node layout_node_
zelda3::OverworldItem current_item_
bool overworld_canvas_fullscreen_
bool map_blockset_loaded_
absl::Status UpdateUsageStats()
zelda3::OverworldEntranceTileTypes entrance_tiletypes_
zelda3::OverworldEntrance current_entrance_
zelda3::Sprite current_sprite_
absl::Status CheckForCurrentMap()
Check for changes to the overworld map. Calls RefreshOverworldMap and RefreshTile16Blockset on the cu...
void DrawOverworldEdits()
gfx::Bitmap current_gfx_bmp_
bool middle_mouse_dragging_
Tile16Editor tile16_editor_
gui::Canvas ow_map_canvas_
void DrawOverworldExits(ImVec2 zero, ImVec2 scrolling)
absl::Status Undo() override
void DrawOverworldItems()
zelda3::GameEntity * dragged_entity_
std::array< gfx::Bitmap, zelda3::kNumOverworldMaps > maps_bmp_
void RefreshOverworldMap()
void CheckForOverworldEdits()
Check for changes to the overworld map.
zelda3::OverworldExit current_exit_
void RefreshMapProperties()
void RenderUpdatedMapBitmap(const ImVec2 &click_position, const std::vector< uint8_t > &tile_data)
gui::Canvas current_gfx_canvas_
void DrawCustomOverworldMapSettings()
absl::Status DrawTileSelector()
void Initialize() override
absl::Status Redo() override
void DrawFullscreenCanvas()
void DrawOverworldProperties()
absl::Status RefreshMapPalette()
void DrawOverworldMapSettings()
void DrawOverworldCanvas()
gui::Canvas blockset_canvas_
absl::Status RefreshTile16Blockset()
void CheckForSelectRectangle()
Draw and create the tile16 IDs that are currently selected.
void RefreshChildMap(int i)
absl::Status Load() override
std::vector< gfx::Bitmap > sprite_previews_
absl::Status DrawAreaGraphics()
GfxGroupEditor gfx_group_editor_
absl::Status Update() final
void DrawOverworldSprites()
EditingMode previous_mode
gui::Table toolset_table_
gui::Canvas graphics_bin_canvas_
gfx::BitmapTable current_graphics_set_
zelda3::Overworld overworld_
absl::Status LoadGraphics()
Load the Bitmap objects for each OverworldMap.
void CleanupUnusedTextures(uint64_t current_time, uint64_t timeout) override
std::array< gfx::Bitmap, zelda3::kNumTile16Individual > tile16_individual_
absl::Status LoadSpriteGraphics()
absl::Status Save() override
void DrawOverworldEntrances(ImVec2 canvas_p, ImVec2 scrolling, bool holes=false)
zelda3::GameEntity * current_entity_
gui::Canvas properties_canvas_
gfx::SnesPalette palette_
gfx::Bitmap tile16_blockset_bmp_
absl::Status DrawTile16Selector()
static Renderer & GetInstance()
Represents a bitmap image.
void WriteToPixel(int position, uint8_t value)
Write a value to a pixel at the given position.
void set_modified(bool modified)
#define ICON_MD_GRID_VIEW
#define ICON_MD_MORE_VERT
#define ICON_MD_OPEN_IN_FULL
#define ICON_MD_TABLE_CHART
#define ICON_MD_DOOR_BACK
#define ICON_MD_MUSIC_NOTE
#define ICON_MD_DOOR_FRONT
#define ICON_MD_ADD_LOCATION
#define ICON_MD_PEST_CONTROL_RODENT
#define ICON_MD_CONTENT_COPY
#define ICON_MD_PAN_TOOL_ALT
#define PRINT_IF_ERROR(expression)
#define RETURN_IF_ERROR(expression)
#define ASSIGN_OR_RETURN(type_variable_name, expression)
#define HOVER_HINT(string)
void CopyImageToClipboard(const std::vector< uint8_t > &data)
Editors are the view controllers for the application.
void DrawExitInserterPopup()
constexpr absl::string_view kOWMapTable
constexpr ImGuiTableFlags kOWMapFlags
constexpr unsigned int kOverworldMapSize
bool DrawSpriteEditorPopup(zelda3::Sprite &sprite)
void DrawItemInsertPopup()
bool DrawEntranceInserterPopup()
void DrawSpriteInserterPopup()
constexpr absl::string_view kWorldList
constexpr absl::string_view kGamePartComboString
void HandleEntityDragging(zelda3::GameEntity *entity, ImVec2 canvas_p0, ImVec2 scrolling, bool &is_dragging_entity, zelda3::GameEntity *&dragged_entity, zelda3::GameEntity *¤t_entity, bool free_movement)
bool DrawOverworldEntrancePopup(zelda3::OverworldEntrance &entrance)
bool IsMouseHoveringOverEntity(const zelda3::GameEntity &entity, ImVec2 canvas_p0, ImVec2 scrolling)
absl::Status DisplayPalette(gfx::SnesPalette &palette, bool loaded)
bool DrawItemEditorPopup(zelda3::OverworldItem &item)
constexpr int kTile16Size
constexpr ImGuiTableFlags kOWEditFlags
constexpr float kInputFieldSize
constexpr absl::string_view kTileSelectorTab
constexpr std::array< const char *, 8 > kMapSettingsColumnNames
bool DrawExitEditorPopup(zelda3::OverworldExit &exit)
void Render(Node &node)
Render a zeml tree.
std::string LoadFile(const std::string &filename)
void Bind(Node *node, std::function< void()> callback)
Bind a callback to a node.
Node Parse(const std::string &yazon_input, const std::map< std::string, void * > &data_bindings)
Parse a zeml string.
void BeginChildBothScrollbars(int id)
bool InputHexWord(const char *label, uint16_t *data, float input_width, bool no_step)
void AddTableColumn(Table &table, const std::string &label, GuiElement element)
void DrawTable(Table ¶ms)
void EndWindowWithDisplaySettings()
void BeginWindowWithDisplaySettings(const char *id, bool *active, const ImVec2 &size, ImGuiWindowFlags flags)
bool InputHexByte(const char *label, uint8_t *data, float input_width, bool no_step)
void BeginChildWithScrollbar(const char *str_id)
std::string HexByte(uint8_t byte, HexStringParams params)
constexpr std::string_view kEntranceNames[]
constexpr int kNumTile16Individual
constexpr int kNumOverworldMaps
const std::vector< std::string > kSecretItemNames
absl::StatusOr< OverworldEntranceTileTypes > LoadEntranceTileTypes(Rom *rom)
Main namespace for the application.