diff --git a/src/io.cpp b/src/io.cpp index 4a83f89..f017d74 100755 --- a/src/io.cpp +++ b/src/io.cpp @@ -172,7 +172,6 @@ namespace io { } static cpu_t *lc86cpu; - static input_t dvd_input_type; static std::jthread jthr; static std::deque> curr_io_queue; static std::vector> pending_io_vec; @@ -195,12 +194,18 @@ namespace io { return false; } else { - auto pair = xbox_handle_map[handle].emplace(handle, io_file_info{ std::move(*opt), resolved_path.string(), 0 }); + auto pair = xbox_handle_map[handle].emplace(handle, io_file_info{ std::move(*opt), resolved_path.string(), handle == CDROM_HANDLE ? xiso::image_offset : 0 }); assert(pair.second == true); return true; } }; + if (dvd_input_type == input_t::xiso) { + if (!lambda((xiso::dvd_image_path).make_preferred(), CDROM_HANDLE)) { + return false; + } + } + if (!lambda((eeprom_path / "eeprom.bin").make_preferred(), EEPROM_HANDLE)) { return false; } diff --git a/src/io.hpp b/src/io.hpp index 357a1a1..7309d38 100644 --- a/src/io.hpp +++ b/src/io.hpp @@ -14,6 +14,7 @@ namespace io { inline bool pending_packets = false; inline util::xbox_string xbe_name; inline util::xbox_string xbe_path; + inline input_t dvd_input_type; bool init(const init_info_t &init_info, cpu_t *cpu); void stop(); diff --git a/src/kernel.cpp b/src/kernel.cpp index a4702a4..7268d92 100644 --- a/src/kernel.cpp +++ b/src/kernel.cpp @@ -59,6 +59,10 @@ namespace kernel { value = static_cast(curr_us / 1000); break; + case DVD_INPUT_TYPE: + value = static_cast(io::dvd_input_type); + break; + case IO_CHECK_ENQUEUE: value = io::pending_packets; break; diff --git a/src/kernel.hpp b/src/kernel.hpp index 6ca376a..c070a67 100644 --- a/src/kernel.hpp +++ b/src/kernel.hpp @@ -22,7 +22,7 @@ namespace kernel { IO_START, IO_RETRY, IO_QUERY, - UNUSED1, + DVD_INPUT_TYPE, IO_CHECK_ENQUEUE, UNUSED2, UNUSED3, diff --git a/src/xiso.cpp b/src/xiso.cpp index f7c25a2..e1cf207 100644 --- a/src/xiso.cpp +++ b/src/xiso.cpp @@ -49,7 +49,6 @@ namespace xiso { static_assert(sizeof(volume_desc_t) == 2048); static constexpr char magic[] = { 'M', 'I', 'C', 'R', 'O', 'S', 'O', 'F', 'T', '*', 'X', 'B', 'O', 'X', '*', 'M', 'E', 'D', 'I', 'A' }; - static size_t image_offset; // offset to add to reach the game partition static uint32_t root_dirent_first_sector; diff --git a/src/xiso.hpp b/src/xiso.hpp index a012ac2..30b2816 100644 --- a/src/xiso.hpp +++ b/src/xiso.hpp @@ -18,6 +18,7 @@ namespace xiso { }; inline std::filesystem::path dvd_image_path; + inline size_t image_offset; // offset to add to reach the game partition bool validate(std::string_view arg_str); file_info_t search_file(std::string_view arg_str);