Skip to content

Commit

Permalink
Allow raw read request to xiso images
Browse files Browse the repository at this point in the history
  • Loading branch information
ergo720 committed Aug 13, 2024
1 parent e75baa1 commit f7a3dfa
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 4 deletions.
9 changes: 7 additions & 2 deletions src/io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ namespace io {
}

static cpu_t *lc86cpu;
static input_t dvd_input_type;
static std::jthread jthr;
static std::deque<std::unique_ptr<io_request>> curr_io_queue;
static std::vector<std::unique_ptr<io_request>> pending_io_vec;
Expand All @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions src/io.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 4 additions & 0 deletions src/kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ namespace kernel {
value = static_cast<uint32_t>(curr_us / 1000);
break;

case DVD_INPUT_TYPE:
value = static_cast<uint32_t>(io::dvd_input_type);
break;

case IO_CHECK_ENQUEUE:
value = io::pending_packets;
break;
Expand Down
2 changes: 1 addition & 1 deletion src/kernel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace kernel {
IO_START,
IO_RETRY,
IO_QUERY,
UNUSED1,
DVD_INPUT_TYPE,
IO_CHECK_ENQUEUE,
UNUSED2,
UNUSED3,
Expand Down
1 change: 0 additions & 1 deletion src/xiso.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;


Expand Down
1 change: 1 addition & 0 deletions src/xiso.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit f7a3dfa

Please sign in to comment.