fix all unhandled status return type compiler warnings

This commit is contained in:
scawful
2024-05-28 17:29:21 -04:00
parent 092ca78a6e
commit be32ee9797
11 changed files with 138 additions and 109 deletions

View File

@@ -211,10 +211,6 @@ uint16_t ldle16b_i(uint8_t const *const p_arr, size_t const p_index);
uint16_t ldle16b(uint8_t const *const p_arr);
void stle16b(uint8_t *const p_arr, uint16_t const p_val);
void stle32b(uint8_t *const p_arr, uint32_t const p_val);
void stle32b_i(uint8_t *const p_arr, size_t const p_index,
uint32_t const p_val);
} // namespace core
} // namespace app

View File

@@ -41,7 +41,7 @@ absl::Status DungeonEditor::Update() {
TAB_BAR("##DungeonEditorTabBar")
TAB_ITEM("Room Editor")
UpdateDungeonRoomView();
status_ = UpdateDungeonRoomView();
END_TAB_ITEM()
TAB_ITEM("Usage Statistics")
if (is_loaded_) {
@@ -107,8 +107,8 @@ absl::Status DungeonEditor::RefreshGraphics() {
auto sprites_aux1_pal_group = rom()->palette_group().sprites_aux1;
for (int i = 9; i < 16; i++) {
int block = rooms_[current_room_id_].blocks()[i];
graphics_bin_[block].get()->ApplyPaletteWithTransparent(
sprites_aux1_pal_group[current_palette_id_], 0);
RETURN_IF_ERROR(graphics_bin_[block].get()->ApplyPaletteWithTransparent(
sprites_aux1_pal_group[current_palette_id_], 0));
rom()->UpdateBitmap(graphics_bin_[block].get(), true);
}
return absl::OkStatus();
@@ -833,8 +833,8 @@ void DungeonEditor::DrawUsageGrid() {
ImGui::Text("Floor1: %#02x", room.floor1);
ImGui::Text("Floor2: %#02x", room.floor2);
ImGui::Text("Message ID: %#04x", room.message_id_);
ImGui::Text("Size: %#06x", room.room_size());
ImGui::Text("Size Pointer: %#06x", room.room_size_ptr());
ImGui::Text("Size: %#016llx", room.room_size());
ImGui::Text("Size Pointer: %#016llx", room.room_size_ptr());
ImGui::EndTooltip();
}

View File

@@ -141,6 +141,8 @@ class DungeonEditor : public Editor,
std::unordered_map<int, int> room_size_addresses_;
std::unordered_map<int, ImVec4> room_palette_;
absl::Status status_;
};
} // namespace editor

View File

@@ -435,7 +435,7 @@ absl::Status GraphicsEditor::UpdateScadView() {
if (super_donkey_) {
if (refresh_graphics_) {
for (int i = 0; i < graphics_bin_.size(); i++) {
graphics_bin_[i].ApplyPalette(
status_ = graphics_bin_[i].ApplyPalette(
col_file_palette_group_[current_palette_index_]);
rom()->UpdateBitmap(&graphics_bin_[i]);
}
@@ -740,9 +740,9 @@ absl::Status GraphicsEditor::DecompressImportData(int size) {
auto palette_group = rom()->palette_group().overworld_animated;
z3_rom_palette_ = palette_group[current_palette_];
if (col_file_) {
bin_bitmap_.ApplyPalette(col_file_palette_);
status_ = bin_bitmap_.ApplyPalette(col_file_palette_);
} else {
bin_bitmap_.ApplyPalette(z3_rom_palette_);
status_ = bin_bitmap_.ApplyPalette(z3_rom_palette_);
}
}
@@ -765,7 +765,7 @@ absl::Status GraphicsEditor::DecompressSuperDonkey() {
gfx::Bitmap(core::kTilesheetWidth, core::kTilesheetHeight,
core::kTilesheetDepth, converted_sheet);
if (col_file_) {
graphics_bin_[i].ApplyPalette(
status_ = graphics_bin_[i].ApplyPalette(
col_file_palette_group_[current_palette_index_]);
} else {
// ROM palette
@@ -773,7 +773,7 @@ absl::Status GraphicsEditor::DecompressSuperDonkey() {
auto palette_group = rom()->palette_group().get_group(
kPaletteGroupAddressesKeys[current_palette_]);
z3_rom_palette_ = *palette_group->mutable_palette(current_palette_index_);
graphics_bin_[i].ApplyPalette(z3_rom_palette_);
status_ = graphics_bin_[i].ApplyPalette(z3_rom_palette_);
}
rom()->RenderBitmap(&graphics_bin_[i]);
@@ -791,14 +791,14 @@ absl::Status GraphicsEditor::DecompressSuperDonkey() {
gfx::Bitmap(core::kTilesheetWidth, core::kTilesheetHeight,
core::kTilesheetDepth, converted_sheet);
if (col_file_) {
graphics_bin_[i].ApplyPalette(
status_ = graphics_bin_[i].ApplyPalette(
col_file_palette_group_[current_palette_index_]);
} else {
// ROM palette
auto palette_group = rom()->palette_group().get_group(
kPaletteGroupAddressesKeys[current_palette_]);
z3_rom_palette_ = *palette_group->mutable_palette(current_palette_index_);
graphics_bin_[i].ApplyPalette(z3_rom_palette_);
status_ = graphics_bin_[i].ApplyPalette(z3_rom_palette_);
}
rom()->RenderBitmap(&graphics_bin_[i]);

View File

@@ -261,7 +261,7 @@ void PaletteEditor::DisplayPalette(gfx::SnesPalette& palette, bool loaded) {
// Generate a default palette. The palette will persist and can be edited.
static bool init = false;
if (loaded && !init) {
InitializeSavedPalette(palette);
status_ = InitializeSavedPalette(palette);
init = true;
}
@@ -333,7 +333,7 @@ void PaletteEditor::DisplayPalette(gfx::SnesPalette& palette, bool loaded) {
void PaletteEditor::DrawPortablePalette(gfx::SnesPalette& palette) {
static bool init = false;
if (!init) {
InitializeSavedPalette(palette);
status_ = InitializeSavedPalette(palette);
init = true;
}

View File

@@ -818,7 +818,7 @@ absl::Status OverworldEditor::DrawTileSelector() {
if (BeginTabBar(kTileSelectorTab.data(),
ImGuiTabBarFlags_FittingPolicyScroll)) {
if (BeginTabItem("Tile16")) {
RETURN_IF_ERROR(DrawTile16Selector());
status_ = DrawTile16Selector();
EndTabItem();
}
if (BeginTabItem("Tile8")) {
@@ -830,7 +830,7 @@ absl::Status OverworldEditor::DrawTileSelector() {
EndTabItem();
}
if (BeginTabItem("Area Graphics")) {
DrawAreaGraphics();
status_ = DrawAreaGraphics();
EndTabItem();
}
EndTabBar();
@@ -1601,12 +1601,14 @@ absl::Status OverworldEditor::LoadGraphics() {
palette_ = overworld_.AreaPalette();
// Create the area graphics image
rom()->CreateAndRenderBitmap(0x80, 0x200, 0x40, overworld_.current_graphics(),
current_gfx_bmp_, palette_);
RETURN_IF_ERROR(rom()->CreateAndRenderBitmap(0x80, 0x200, 0x40,
overworld_.current_graphics(),
current_gfx_bmp_, palette_));
// Create the tile16 blockset image
rom()->CreateAndRenderBitmap(0x80, 0x2000, 0x08, overworld_.Tile16Blockset(),
tile16_blockset_bmp_, palette_);
RETURN_IF_ERROR(rom()->CreateAndRenderBitmap(0x80, 0x2000, 0x08,
overworld_.Tile16Blockset(),
tile16_blockset_bmp_, palette_));
map_blockset_loaded_ = true;
// Copy the tile16 data into individual tiles.

View File

@@ -74,7 +74,7 @@ void ScreenEditor::DrawInventoryMenuEditor() {
tilesheet_canvas_.DrawOverlay();
ImGui::TableNextColumn();
gui::DisplayPalette(palette_, create);
status_ = gui::DisplayPalette(palette_, create);
ImGui::EndTable();
}
@@ -233,8 +233,8 @@ absl::Status ScreenEditor::LoadDungeonMapTile16() {
tile16_sheet_.ComposeTile16(rom()->graphics_buffer(), t1, t2, t3, t4);
}
tile16_sheet_.mutable_bitmap()->ApplyPalette(
*rom()->mutable_dungeon_palette(3));
RETURN_IF_ERROR(tile16_sheet_.mutable_bitmap()->ApplyPalette(
*rom()->mutable_dungeon_palette(3)));
rom()->RenderBitmap(&*tile16_sheet_.mutable_bitmap().get());
for (int i = 0; i < tile16_sheet_.num_tiles(); ++i) {

View File

@@ -83,6 +83,8 @@ class ScreenEditor : public SharedRom {
gfx::BitmapTable sheets_;
gfx::Tilesheet tile16_sheet_;
absl::Status status_;
};
} // namespace editor

View File

@@ -330,10 +330,11 @@ absl::Status Rom::SavePalette(int index, const std::string& group_name,
}
absl::Status Rom::SaveAllPalettes() {
palette_groups_.for_each([&](gfx::PaletteGroup& group) {
palette_groups_.for_each([&](gfx::PaletteGroup& group) -> absl::Status {
for (size_t i = 0; i < group.size(); ++i) {
RETURN_IF_ERROR(SavePalette(i, group.name(), *group.mutable_palette(i)));
}
return absl::OkStatus();
});
return absl::OkStatus();

View File

@@ -209,89 +209,114 @@ class RoomEntrance {
}
}
void Save(Rom& rom, int entrance_id, bool is_spawn_point = false) {
absl::Status Save(Rom& rom, int entrance_id, bool is_spawn_point = false) {
if (!is_spawn_point) {
rom.WriteShort(entrance_room + (entrance_id * 2), room_);
rom.WriteShort(entrance_yposition + (entrance_id * 2), y_position_);
rom.WriteShort(entrance_xposition + (entrance_id * 2), x_position_);
rom.WriteShort(entrance_yscroll + (entrance_id * 2), camera_y_);
rom.WriteShort(entrance_xscroll + (entrance_id * 2), camera_x_);
rom.WriteShort(entrance_cameraxtrigger + (entrance_id * 2),
camera_trigger_x_);
rom.WriteShort(entrance_cameraytrigger + (entrance_id * 2),
camera_trigger_y_);
rom.WriteShort(entrance_exit + (entrance_id * 2), exit_);
rom.Write(entrance_blockset + entrance_id, (uint8_t)(blockset_ & 0xFF));
rom.Write(entrance_music + entrance_id, (uint8_t)(music_ & 0xFF));
rom.Write(entrance_dungeon + entrance_id, (uint8_t)(dungeon_id_ & 0xFF));
rom.Write(entrance_door + entrance_id, (uint8_t)(door_ & 0xFF));
rom.Write(entrance_floor + entrance_id, (uint8_t)(floor_ & 0xFF));
rom.Write(entrance_ladderbg + entrance_id, (uint8_t)(ladder_bg_ & 0xFF));
rom.Write(entrance_scrolling + entrance_id, (uint8_t)(scrolling_ & 0xFF));
rom.Write(entrance_scrollquadrant + entrance_id,
(uint8_t)(scroll_quadrant_ & 0xFF));
rom.Write(entrance_scrolledge + 0 + (entrance_id * 8),
camera_boundary_qn_);
rom.Write(entrance_scrolledge + 1 + (entrance_id * 8),
camera_boundary_fn_);
rom.Write(entrance_scrolledge + 2 + (entrance_id * 8),
camera_boundary_qs_);
rom.Write(entrance_scrolledge + 3 + (entrance_id * 8),
camera_boundary_fs_);
rom.Write(entrance_scrolledge + 4 + (entrance_id * 8),
camera_boundary_qw_);
rom.Write(entrance_scrolledge + 5 + (entrance_id * 8),
camera_boundary_fw_);
rom.Write(entrance_scrolledge + 6 + (entrance_id * 8),
camera_boundary_qe_);
rom.Write(entrance_scrolledge + 7 + (entrance_id * 8),
camera_boundary_fe_);
RETURN_IF_ERROR(
rom.WriteShort(entrance_yposition + (entrance_id * 2), y_position_));
RETURN_IF_ERROR(
rom.WriteShort(entrance_xposition + (entrance_id * 2), x_position_));
RETURN_IF_ERROR(
rom.WriteShort(entrance_yscroll + (entrance_id * 2), camera_y_));
RETURN_IF_ERROR(
rom.WriteShort(entrance_xscroll + (entrance_id * 2), camera_x_));
RETURN_IF_ERROR(rom.WriteShort(
entrance_cameraxtrigger + (entrance_id * 2), camera_trigger_x_));
RETURN_IF_ERROR(rom.WriteShort(
entrance_cameraytrigger + (entrance_id * 2), camera_trigger_y_));
RETURN_IF_ERROR(rom.WriteShort(entrance_exit + (entrance_id * 2), exit_));
RETURN_IF_ERROR(rom.Write(entrance_blockset + entrance_id,
(uint8_t)(blockset_ & 0xFF)));
RETURN_IF_ERROR(
rom.Write(entrance_music + entrance_id, (uint8_t)(music_ & 0xFF)));
RETURN_IF_ERROR(rom.Write(entrance_dungeon + entrance_id,
(uint8_t)(dungeon_id_ & 0xFF)));
RETURN_IF_ERROR(
rom.Write(entrance_door + entrance_id, (uint8_t)(door_ & 0xFF)));
RETURN_IF_ERROR(
rom.Write(entrance_floor + entrance_id, (uint8_t)(floor_ & 0xFF)));
RETURN_IF_ERROR(rom.Write(entrance_ladderbg + entrance_id,
(uint8_t)(ladder_bg_ & 0xFF)));
RETURN_IF_ERROR(rom.Write(entrance_scrolling + entrance_id,
(uint8_t)(scrolling_ & 0xFF)));
RETURN_IF_ERROR(rom.Write(entrance_scrollquadrant + entrance_id,
(uint8_t)(scroll_quadrant_ & 0xFF)));
RETURN_IF_ERROR(rom.Write(entrance_scrolledge + 0 + (entrance_id * 8),
camera_boundary_qn_));
RETURN_IF_ERROR(rom.Write(entrance_scrolledge + 1 + (entrance_id * 8),
camera_boundary_fn_));
RETURN_IF_ERROR(rom.Write(entrance_scrolledge + 2 + (entrance_id * 8),
camera_boundary_qs_));
RETURN_IF_ERROR(rom.Write(entrance_scrolledge + 3 + (entrance_id * 8),
camera_boundary_fs_));
RETURN_IF_ERROR(rom.Write(entrance_scrolledge + 4 + (entrance_id * 8),
camera_boundary_qw_));
RETURN_IF_ERROR(rom.Write(entrance_scrolledge + 5 + (entrance_id * 8),
camera_boundary_fw_));
RETURN_IF_ERROR(rom.Write(entrance_scrolledge + 6 + (entrance_id * 8),
camera_boundary_qe_));
RETURN_IF_ERROR(rom.Write(entrance_scrolledge + 7 + (entrance_id * 8),
camera_boundary_fe_));
} else {
rom.WriteShort(startingentrance_room + (entrance_id * 2), room_);
rom.WriteShort(startingentrance_yposition + (entrance_id * 2),
y_position_);
rom.WriteShort(startingentrance_xposition + (entrance_id * 2),
x_position_);
rom.WriteShort(startingentrance_yscroll + (entrance_id * 2), camera_y_);
rom.WriteShort(startingentrance_xscroll + (entrance_id * 2), camera_x_);
rom.WriteShort(startingentrance_cameraxtrigger + (entrance_id * 2),
camera_trigger_x_);
rom.WriteShort(startingentrance_cameraytrigger + (entrance_id * 2),
camera_trigger_y_);
rom.WriteShort(startingentrance_exit + (entrance_id * 2), exit_);
rom.Write(startingentrance_blockset + entrance_id,
(uint8_t)(blockset_ & 0xFF));
rom.Write(startingentrance_music + entrance_id, (uint8_t)(music_ & 0xFF));
rom.Write(startingentrance_dungeon + entrance_id,
(uint8_t)(dungeon_id_ & 0xFF));
rom.Write(startingentrance_door + entrance_id, (uint8_t)(door_ & 0xFF));
rom.Write(startingentrance_floor + entrance_id, (uint8_t)(floor_ & 0xFF));
rom.Write(startingentrance_ladderbg + entrance_id,
(uint8_t)(ladder_bg_ & 0xFF));
rom.Write(startingentrance_scrolling + entrance_id,
(uint8_t)(scrolling_ & 0xFF));
rom.Write(startingentrance_scrollquadrant + entrance_id,
(uint8_t)(scroll_quadrant_ & 0xFF));
rom.Write(startingentrance_scrolledge + 0 + (entrance_id * 8),
camera_boundary_qn_);
rom.Write(startingentrance_scrolledge + 1 + (entrance_id * 8),
camera_boundary_fn_);
rom.Write(startingentrance_scrolledge + 2 + (entrance_id * 8),
camera_boundary_qs_);
rom.Write(startingentrance_scrolledge + 3 + (entrance_id * 8),
camera_boundary_fs_);
rom.Write(startingentrance_scrolledge + 4 + (entrance_id * 8),
camera_boundary_qw_);
rom.Write(startingentrance_scrolledge + 5 + (entrance_id * 8),
camera_boundary_fw_);
rom.Write(startingentrance_scrolledge + 6 + (entrance_id * 8),
camera_boundary_qe_);
rom.Write(startingentrance_scrolledge + 7 + (entrance_id * 8),
camera_boundary_fe_);
RETURN_IF_ERROR(
rom.WriteShort(startingentrance_room + (entrance_id * 2), room_));
RETURN_IF_ERROR(rom.WriteShort(
startingentrance_yposition + (entrance_id * 2), y_position_));
RETURN_IF_ERROR(rom.WriteShort(
startingentrance_xposition + (entrance_id * 2), x_position_));
RETURN_IF_ERROR(rom.WriteShort(
startingentrance_yscroll + (entrance_id * 2), camera_y_));
RETURN_IF_ERROR(rom.WriteShort(
startingentrance_xscroll + (entrance_id * 2), camera_x_));
RETURN_IF_ERROR(
rom.WriteShort(startingentrance_cameraxtrigger + (entrance_id * 2),
camera_trigger_x_));
RETURN_IF_ERROR(
rom.WriteShort(startingentrance_cameraytrigger + (entrance_id * 2),
camera_trigger_y_));
RETURN_IF_ERROR(
rom.WriteShort(startingentrance_exit + (entrance_id * 2), exit_));
RETURN_IF_ERROR(rom.Write(startingentrance_blockset + entrance_id,
(uint8_t)(blockset_ & 0xFF)));
RETURN_IF_ERROR(rom.Write(startingentrance_music + entrance_id,
(uint8_t)(music_ & 0xFF)));
RETURN_IF_ERROR(rom.Write(startingentrance_dungeon + entrance_id,
(uint8_t)(dungeon_id_ & 0xFF)));
RETURN_IF_ERROR(rom.Write(startingentrance_door + entrance_id,
(uint8_t)(door_ & 0xFF)));
RETURN_IF_ERROR(rom.Write(startingentrance_floor + entrance_id,
(uint8_t)(floor_ & 0xFF)));
RETURN_IF_ERROR(rom.Write(startingentrance_ladderbg + entrance_id,
(uint8_t)(ladder_bg_ & 0xFF)));
RETURN_IF_ERROR(rom.Write(startingentrance_scrolling + entrance_id,
(uint8_t)(scrolling_ & 0xFF)));
RETURN_IF_ERROR(rom.Write(startingentrance_scrollquadrant + entrance_id,
(uint8_t)(scroll_quadrant_ & 0xFF)));
RETURN_IF_ERROR(
rom.Write(startingentrance_scrolledge + 0 + (entrance_id * 8),
camera_boundary_qn_));
RETURN_IF_ERROR(
rom.Write(startingentrance_scrolledge + 1 + (entrance_id * 8),
camera_boundary_fn_));
RETURN_IF_ERROR(
rom.Write(startingentrance_scrolledge + 2 + (entrance_id * 8),
camera_boundary_qs_));
RETURN_IF_ERROR(
rom.Write(startingentrance_scrolledge + 3 + (entrance_id * 8),
camera_boundary_fs_));
RETURN_IF_ERROR(
rom.Write(startingentrance_scrolledge + 4 + (entrance_id * 8),
camera_boundary_qw_));
RETURN_IF_ERROR(
rom.Write(startingentrance_scrolledge + 5 + (entrance_id * 8),
camera_boundary_fw_));
RETURN_IF_ERROR(
rom.Write(startingentrance_scrolledge + 6 + (entrance_id * 8),
camera_boundary_qe_));
RETURN_IF_ERROR(
rom.Write(startingentrance_scrolledge + 7 + (entrance_id * 8),
camera_boundary_fe_));
}
return absl::OkStatus();
}
uint16_t entrance_id_;