housekeeping for GfxContext and Room logging

This commit is contained in:
scawful
2024-01-28 12:05:50 -05:00
parent e006702df1
commit ee179a5598
5 changed files with 21 additions and 20 deletions

View File

@@ -129,10 +129,7 @@ void SetTabBarTab(ImGuiTabBar* tab_bar, ImGuiID tab_id) {
if (tab_bar == NULL) return;
// Find the tab item with the specified tab_id
// for (int i = 0; i < tab_bar->Tabs.Size; i++) {
ImGuiTabItem* tab_item = &tab_bar->Tabs[tab_id];
// if (tab_item->ID == tab_id) {
// Set the tab item as active
tab_item->LastFrameVisible = -1;
tab_item->LastFrameSelected = -1;
tab_bar->VisibleTabId = tab_id;
@@ -141,10 +138,6 @@ void SetTabBarTab(ImGuiTabBar* tab_bar, ImGuiID tab_id) {
tab_bar->NextSelectedTabId = tab_id;
tab_bar->ReorderRequestTabId = tab_id;
tab_bar->CurrFrameVisible = -1;
// break;
// }
// }
}
} // namespace

View File

@@ -72,8 +72,9 @@ void Room::LoadHeader() {
// Existing room size address calculation...
auto room_size_address = 0xF8000 + (room_id_ * 3);
std::cout << "Room #" << room_id_ << " Address: " << std::hex
<< room_size_address << std::endl;
if (flags()->kLogToConsole)
std::cout << "Room #" << room_id_ << " Address: " << std::hex
<< room_size_address << std::endl;
// Reading bytes for long address construction
uint8_t low = rom()->data()[room_size_address];
@@ -82,13 +83,15 @@ void Room::LoadHeader() {
// Constructing the long address
int long_address = (bank << 16) | (high << 8) | low;
std::cout << std::hex << std::setfill('0') << std::setw(6) << long_address
<< std::endl;
if (flags()->kLogToConsole)
std::cout << std::hex << std::setfill('0') << std::setw(6) << long_address
<< std::endl;
room_size_pointer_ = long_address;
if (long_address == 0x0A8000) {
// Blank room disregard in size calculation
std::cout << "Size of Room #" << room_id_ << ": 0 bytes" << std::endl;
if (flags()->kLogToConsole)
std::cout << "Size of Room #" << room_id_ << ": 0 bytes" << std::endl;
room_size_ = 0;
} else {
// use the long address to calculate the size of the room
@@ -97,8 +100,9 @@ void Room::LoadHeader() {
int next_room_address = 0xF8000 + ((room_id_ + 1) * 3);
std::cout << "Next Room Address: " << std::hex << next_room_address
<< std::endl;
if (flags()->kLogToConsole)
std::cout << "Next Room Address: " << std::hex << next_room_address
<< std::endl;
// Reading bytes for long address construction
uint8_t next_low = rom()->data()[next_room_address];
@@ -108,17 +112,19 @@ void Room::LoadHeader() {
// Constructing the long address
int next_long_address = (next_bank << 16) | (next_high << 8) | next_low;
std::cout << std::hex << std::setfill('0') << std::setw(6)
<< next_long_address << std::endl;
if (flags()->kLogToConsole)
std::cout << std::hex << std::setfill('0') << std::setw(6)
<< next_long_address << std::endl;
// Calculate the size of the room
int room_size = next_long_address - long_address;
std::cout << "Size of Room #" << room_id_ << ": " << std::dec << room_size
<< " bytes" << std::endl;
room_size_ = room_size;
if (flags()->kLogToConsole)
std::cout << "Size of Room #" << room_id_ << ": " << std::dec
<< room_size << " bytes" << std::endl;
}
} catch (const std::exception& e) {
std::cout << "Error: " << e.what() << std::endl;
if (flags()->kLogToConsole) std::cout << "Error: " << e.what() << std::endl;
}
}

View File

@@ -117,7 +117,7 @@ struct ChestData {
struct StaircaseRooms {};
class Room : public SharedROM {
class Room : public SharedROM, public core::ExperimentFlags {
public:
Room() = default;
Room(int room_id) : room_id_(room_id) {}

View File

@@ -7,6 +7,7 @@ add_executable(
app/core/common.cc
app/core/labeling.cc
app/gui/pipeline.cc
app/editor/context/gfx_context.cc
${YAZE_APP_EMU_SRC}
${YAZE_APP_GFX_SRC}
${YAZE_APP_ZELDA3_SRC}

View File

@@ -31,6 +31,7 @@ add_executable(
../src/app/emu/video/ppu.cc
../src/app/emu/audio/dsp.cc
../src/app/emu/audio/spc700.cc
../src/app/editor/context/gfx_context.cc
../src/app/gfx/bitmap.cc
../src/app/gfx/snes_tile.cc
../src/app/gfx/snes_palette.cc