Conversation
Easily buildable For Linux: g++ main.cpp -llz4 For Windows: x86_64-w64-mingw32-g++ main.cpp -llz4 -static
| try { | ||
| f.seekg(0x18310000, std::ios::beg); | ||
| } catch (std::exception const& e) { | ||
| std::cout << "File not big enough to be a Redump style image." << std::endl; |
There was a problem hiding this comment.
nit: Why are we flushing on almost every cout, and some cerr's where we immediately exit, are we not trusting the OS?
| const std::string CISO_MAGIC = "CISO"; | ||
| const uint32_t CISO_HEADER_SIZE = 0x18; | ||
| const uint32_t CISO_BLOCK_SIZE = 0x800; | ||
| const uint32_t CISO_PLAIN_BLOCK = 0x80000000; |
|
|
||
| void detect_iso_type(std::ifstream& f) { | ||
| try { | ||
| f.seekg(0x18310000, std::ios::beg); |
| if (f.tellg() == 0x18310000) { | ||
| std::string buf(20, '\0'); | ||
| f.read(&buf[0], 20); | ||
| if (buf == "MICROSOFT*XBOX*MEDIA") { |
There was a problem hiding this comment.
nit: Used more than once should probably be a constexpr var
|
|
||
| uint32_t get_block_size() { return block_size; }; | ||
| uint32_t get_total_blocks() { return total_blocks; }; | ||
| uint32_t get_align() { return align; }; |
|
|
||
| void write_block_index(std::ofstream& f, std::vector<uint32_t> const& block_index) { | ||
| for (uint32_t i: block_index) { | ||
| f.write((char*)&i, sizeof(i)); |
| std::cerr << "CompressionContext creation failed, exiting..."; | ||
| exit(2); | ||
| } | ||
| std::ofstream fout_1(infile + ".1.cso", std::ios::binary); |
There was a problem hiding this comment.
nit: Output file should truncate the .iso.
|
Non-functional Produces a ~2.6GB ISO that does not work. |
Do you get a different result if you use the mingw64 packages ( |
|
Same thing. |
|
Same thing on WSL. Untested? |
Works fine on my machines, both under Linux and MinGW64. Sorry, not sure what to tell you. |
|
Ah, damn. I had looked into this PR before and confirmed the issue that @GXTX was running into. It appears related to large files, but I must have forgotten to track which flags must be set to build the code correctly. |
|
|
||
| ciso (std::ifstream &f) { | ||
| f.seekg(0, std::ios::end); | ||
| uint32_t file_size = (int32_t)f.tellg() - image_offset; |
There was a problem hiding this comment.
This seems to be causing issues, should (probably) be uint64_t instead?
There was a problem hiding this comment.
That brings us closer at least; now redump input results in two files with reasonable sizes. Output doesn't match the python script past the header though...
Easily buildable
For Linux:
g++ main.cpp -llz4
For Windows:
x86_64-w64-mingw32-g++ main.cpp -llz4 -static