diff options
| author | Hannes Schulze <haschu0103@outlook.de> | 2025-02-04 23:11:08 +0100 |
|---|---|---|
| committer | Hannes Schulze <haschu0103@outlook.de> | 2025-02-04 23:11:08 +0100 |
| commit | 79553ab1fa3d707612e80dd03bf95ca65fa0c411 (patch) | |
| tree | f44bec41548d569cfca43c44e0e4ffa7b72ed4ed /lib/nes/app/application.cc | |
| parent | 9c45e9c7df1efa5bc1c8e73b6eaef4726b828d3e (diff) | |
refactor file browser
Diffstat (limited to 'lib/nes/app/application.cc')
| -rw-r--r-- | lib/nes/app/application.cc | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/nes/app/application.cc b/lib/nes/app/application.cc index b528e61..6b7253e 100644 --- a/lib/nes/app/application.cc +++ b/lib/nes/app/application.cc @@ -46,7 +46,7 @@ namespace nes::app // display_proxy::switch_buffers). console_->step(elapsed_time); - if (console_->get_status() != sys::status::success) + if (console_->get_status() != status::success) { std::cerr << "Invalid state: " << to_string(console_->get_status()) << std::endl; std::abort(); @@ -93,10 +93,15 @@ namespace nes::app case action::type::launch_game: { u8 buffer[sys::cartridge::max_file_size]; - auto const length = file_browser_.load(a.get_file_name(), buffer); + auto length = u32{ 0 }; + if (auto const s = file_browser_.load(a.get_file_name(), buffer, &length); s != status::success) + { + std::cerr << "Unable to open cartridge file: " << to_string(console_->get_status()) << std::endl; + std::abort(); + } - console_.emplace(display_, span<u8 const>{ buffer, length }); - if (console_->get_status() != sys::status::success) + console_.emplace(display_, span{ buffer, length }); + if (console_->get_status() != status::success) { std::cerr << "Unable to load cartridge: " << to_string(console_->get_status()) << std::endl; std::abort(); @@ -105,6 +110,11 @@ namespace nes::app display_.screen = nullptr; break; } + case action::type::show_error: + { + // TODO + break; + } } } } // namespace nes::app
\ No newline at end of file |
