wwylele/mhrice

other game search-path problem

ioritree opened this issue · 9 comments

你好,這是我遇到的錯誤訊息,因為訊息太長,只有擷取部分

devil may cry
D:\BaiduYunDownload\DEVIL MAY CRY 5\Devil May Cry 5\Devil May Cry 5 Vergil>mhrice search-path --pak re_chunk_000.pak > 12345.list
thread 'thread 'thread 'thread '' panicked at 'called Result::unwrap() on an Err value: Unsupported format: 1' panicked at '' panicked at '' panicked at '', called Result::unwrap() on an Err value: Unsupported format: 1called Result::unwrap() on an Err value: Unsupported format: 1called Result::unwrap() on an Err value: Unsupported format: 1src\main.rs', ', ', :src\main.rssrc\main.rssrc\main.rs508::::50850850849:::
494949note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

thread '' panicked at 'called Result::unwrap() on an Err value: Unsupported format: 1', src\main.rs:508:49
thread 'thread 'thread '' panicked at '' panicked at '' panicked at 'called Result::unwrap() on an Err value: Unsupported format: 1called Result::unwrap() on an Err value: Unsupported format: 1called Result::unwrap() on an Err value: Unsupported format: 1', ', ', src\main.rssrc\main.rssrc\main.rs:::508508508:::494949

thread '' panicked at 'called Result::unwrap() on an Err value: Unsupported format: 1', src\main.rs:508thread ':49' panicked at '
thread 'called Result::unwrap() on an Err value: Unsupported format: 1', ' panicked at 'src\main.rscalled Result::unwrap() on an Err value: Unsupported format: 1thread ':', 508src\main.rs' panicked at '::called Result::unwrap() on an Err value: Unsupported format: 149508',
src\main.rs:thread ':49508
:' panicked at 'thread '49called Result::unwrap() on an Err value: Unsupported format: 1
', ' panicked at 'thread 'src\main.rscalled Result::unwrap() on an Err value: Unsupported format: 1:', ' panicked at '508src\main.rscalled Result::unwrap() on an Err value: Unsupported format: 1::', 49508src\main.rs
::49508
:49thread '
thread '' panicked at 'called Result::unwrap() on an Err value: Unsupported format: 1' panicked at '', called Result::unwrap() on an Err value: Unsupported format: 1src\main.rs', :src\main.rs508::50849:
49thread '
' panicked at 'thread 'called Result::unwrap() on an Err value: Unsupported format: 1', ' panicked at 'called Result::unwrap() on an Err value: Unsupported format: 1src\main.rs', src\main.rs::508508::4949

thread '' panicked at 'called Result::unwrap() on an Err value: Unsupported format: 1', src\main.rs:508:49
thread '' panicked at 'called Result::unwrap() on an Err value: Unsupported format: 1', src\main.rs:508:49
thread '' panicked at 'called Result::unwrap() on an Err value: Unsupported format: 1', src\main.rs:508:49
thread '' panicked at 'called Result::unwrap() on an Err value: Unsupported format: 1', src\main.rs:508:49
thread '' panicked at 'called Result::unwrap() on an Err value: Unsupported format: 1', src\main.rs:508:49
thread '' panicked at 'called Result::unwrap() on an Err value: Unsupported format: 1', src\main.rs:508:49
thread '' panicked at 'called Result::unwrap() on an Err value: Unsupported format: 1', src\main.rs:508:49
thread '' panicked at 'called Result::unwrap() on an Err value: Unsupported format: 1', src\main.rs:508:49

Ghosts 'n Goblins Resurrection

thread '' panicked at 'called Result::unwrap() on an Err value: Unsupported format: 1' panicked at '', called Result::unwrap() on an Err value: Unsupported format: 1src\main.rs', :src\main.rs508::50849:
49thread '
thread '' panicked at 'called Result::unwrap() on an Err value: Unsupported format: 1' panicked at '', called Result::unwrap() on an Err value: Unsupported format: 1src\main.rs', :src\main.rs508::50849:
49thread '
thread '' panicked at '' panicked at 'called Result::unwrap() on an Err value: Unsupported format: 1called Result::unwrap() on an Err value: Unsupported format: 1', ', src\main.rssrc\main.rs::508508::4949

thread 'thread '' panicked at '' panicked at 'called Result::unwrap() on an Err value: Unsupported format: 1called Result::unwrap() on an Err value: Unsupported format: 1', ', src\main.rssrc\main.rs::508508::4949

thread 'thread '' panicked at '' panicked at 'called Result::unwrap() on an Err value: Unsupported format: 1called Result::unwrap() on an Err value: Unsupported format: 1', ', src\main.rssrc\main.rs::508508::4949
thread '
thread '' panicked at 'called Result::unwrap() on an Err value: Unsupported format: 1' panicked at '', src\main.rscalled Result::unwrap() on an Err value: Unsupported format: 1:', 508src\main.rs::49508
thread ':49' panicked at '
called Result::unwrap() on an Err value: Unsupported format: 1thread '', src\main.rs' panicked at ':called Result::unwrap() on an Err value: Unsupported format: 1508:', 49src\main.rs
thread ':508' panicked at ':called Result::unwrap() on an Err value: Unsupported format: 149',
src\main.rsthread ':508' panicked at ':called Result::unwrap() on an Err value: Unsupported format: 149',
src\main.rs:thread '508:' panicked at '49called Result::unwrap() on an Err value: Unsupported format: 1
', thread 'src\main.rs:508' panicked at ':called Result::unwrap() on an Err value: Unsupported format: 149',
thread 'src\main.rs:508:49' panicked at '
called Result::unwrap() on an Err value: Unsupported format: 1thread '', src\main.rs' panicked at ':called Result::unwrap() on an Err value: Unsupported format: 1508', :src\main.rs49:
thread '508:' panicked at '49called Result::unwrap() on an Err value: Unsupported format: 1
', thread 'src\main.rs:' panicked at '508called Result::unwrap() on an Err value: Unsupported format: 1:', 49src\main.rs
:thread '508:' panicked at '49called Result::unwrap() on an Err value: Unsupported format: 1
', thread 'src\main.rs:' panicked at '508called Result::unwrap() on an Err value: Unsupported format: 1:', 49src\main.rs
:thread '508:' panicked at '49called Result::unwrap() on an Err value: Unsupported format: 1
', thread 'src\main.rs:' panicked at '508called Result::unwrap() on an Err value: Unsupported format: 1:', 49src\main.rs
:thread '508:' panicked at '49called Result::unwrap() on an Err value: Unsupported format: 1
', thread 'src\main.rs:' panicked at '508called Result::unwrap() on an Err value: Unsupported format: 1:', 49src\main.rs
:thread '508' panicked at 'called Result::unwrap() on an Err value: Unsupported format: 1', :49
thread '' panicked at 'called Result::unwrap() on an Err value: Unsupported format: 1', src\main.rs:508:49src\main.rs:
508thread ':49
' panicked at 'thread 'called Result::unwrap() on an Err value: Unsupported format: 1', ' panicked at 'src\main.rscalled Result::unwrap() on an Err value: Unsupported format: 1:', 508src\main.rs::49508
:thread '49
' panicked at 'thread 'called Result::unwrap() on an Err value: Unsupported format: 1', ' panicked at 'src\main.rscalled Result::unwrap() on an Err value: Unsupported format: 1:', 508src\main.rs::49508
:thread '49
thread '' panicked at 'called Result::unwrap() on an Err value: Unsupported format: 1' panicked at '', src\main.rs:508:49called Result::unwrap() on an Err value: Unsupported format: 1
', thread '' panicked at 'called Result::unwrap() on an Err value: Unsupported format: 1', src\main.rs:508:49src\main.rs
thread ':508' panicked at ':called Result::unwrap() on an Err value: Unsupported format: 149',
src\main.rsthread ':508' panicked at ':called Result::unwrap() on an Err value: Unsupported format: 149',
src\main.rsthread ':508' panicked at ':called Result::unwrap() on an Err value: Unsupported format: 149',
src\main.rsthread ':508' panicked at ':called Result::unwrap() on an Err value: Unsupported format: 149',
thread 'src\main.rs:' panicked at '508called Result::unwrap() on an Err value: Unsupported format: 1:', src\main.rs49:
508thread ':49
thread '' panicked at 'called Result::unwrap() on an Err value: Unsupported format: 1' panicked at 'called Result::unwrap() on an Err value: Unsupported format: 1', src\main.rs:', 508src\main.rs::49508
:thread '49
thread '' panicked at 'called Result::unwrap() on an Err value: Unsupported format: 1' panicked at '', called Result::unwrap() on an Err value: Unsupported format: 1src\main.rs', :src\main.rs508::50849:
49thread '
thread '' panicked at '' panicked at 'called Result::unwrap() on an Err value: Unsupported format: 1called Result::unwrap() on an Err value: Unsupported format: 1', ', src\main.rssrc\main.rs::508508::4949
thread '
thread '' panicked at 'called Result::unwrap() on an Err value: Unsupported format: 1' panicked at '', called Result::unwrap() on an Err value: Unsupported format: 1src\main.rs', :src\main.rs508::50849:
thread '49
thread '' panicked at 'called Result::unwrap() on an Err value: Unsupported format: 1' panicked at '', called Result::unwrap() on an Err value: Unsupported format: 1src\main.rs:508:49
thread '', src\main.rs' panicked at 'called Result::unwrap() on an Err value: Unsupported format: 1', src\main.rs::508:508:4949
thread '' panicked at 'called Result::unwrap() on an Err value: Unsupported format: 1', src\main.rs:508:49
thread '' panicked at 'called Result::unwrap() on an Err value: Unsupported format: 1', src\main.rs:508:49
thread '' panicked at 'called Result::unwrap() on an Err value: Unsupported format: 1', src\main.rs:508:49
thread '' panicked at 'called Result::unwrap() on an Err value: Unsupported format: 1', src\main.rs:508:49
thread '' panicked at 'called Result::unwrap() on an Err value: Unsupported format: 1', src\main.rs:508:49
thread '' panicked at 'called Result::unwrap() on an Err value: Unsupported format: 1', src\main.rs:508:49
thread '' panicked at 'called Result::unwrap() on an Err value: Unsupported format: 1', src\main.rs:508:49
thread '' panicked at 'called Result::unwrap() on an Err value: Unsupported format: 1', src\main.rs:508:49
thread '' panicked at 'called Result::unwrap() on an Err value: Unsupported format: 1', src\main.rs:508:49
thread '' panicked at 'called Result::unwrap() on an Err value: Unsupported format: 1', src\main.rs:508:49

This is due to unimplemented compression format (1). To resolve this, one should implement the format here

mhrice/src/pak.rs

Lines 110 to 125 in cb0ab6a

0 => {
if len != len_compressed {
bail!("Uncompressed file should have len == len_compressed")
}
let mut data = vec![0; len.try_into()?];
file.read_exact(&mut data)?;
Ok(data)
}
2 => {
let decoded = zstd::decode_all(file.by_ref().take(len_compressed))?;
if u64::try_from(decoded.len()).unwrap() != len {
bail!("Expected size {}, actual size {}", len, decoded.len());
}
Ok(decoded)
}
_ => bail!("Unsupported format: {}", format),

According to other information online, the format 1 is deflate (see QuickBMS comtype deflate)

This is due to unimplemented compression format (1). To resolve this, one should implement the format here

mhrice/src/pak.rs

Lines 110 to 125 in cb0ab6a

0 => {
if len != len_compressed {
bail!("Uncompressed file should have len == len_compressed")
}
let mut data = vec![0; len.try_into()?];
file.read_exact(&mut data)?;
Ok(data)
}
2 => {
let decoded = zstd::decode_all(file.by_ref().take(len_compressed))?;
if u64::try_from(decoded.len()).unwrap() != len {
bail!("Expected size {}, actual size {}", len, decoded.len());
}
Ok(decoded)
}
_ => bail!("Unsupported format: {}", format),

According to other information online, the format 1 is deflate (see QuickBMS comtype deflate)

謝謝,我試著增加"1" 於 pak.rs 但是編譯不了
use compress::flate;
use std::fs::File;
use std::path::Path;
use std::io::Read;

.
.
1 => {
let stream = file.by_ref().take(len_compressed);
let mut decompressed = Vec::new();
flate::Decoder::new(stream).read_to_end(&mut decompressed);
if u64::try_from(decompressed.len()).unwrap() != len {
bail!("Expected size {}, actual size {}", len, decompressed.len());
}
Ok(decompressed)
}

Not sure what you mean. That code compiles on my end. Also the first rule of problem reporting: could you paste the error message?

I pushed your code in 2486fd9 (Thanks!) could you test if it works?

Not sure what you mean. That code compiles on my end. Also the first rule of problem reporting: could you paste the error message?

--> src\pak.rs:11:5
|
7 | use std::io::{Read, Seek, SeekFrom};
| ---- previous import of the trait Read here
...
11 | use std::io::Read;
| ^^^^^^^^^^^^^ Read reimported here
|
= note: Read must be defined only once in the type namespace of this module

error[E0432]: unresolved import compress
--> src\pak.rs:8:5
|
8 | use compress::flate;
| ^^^^^^^^ use of undeclared crate or module compress

warning: unused import: std::fs::File
--> src\pak.rs:9:5
|
9 | use std::fs::File;
| ^^^^^^^^^^^^^
|
= note: #[warn(unused_imports)] on by default

warning: unused import: std::path::Path
--> src\pak.rs:10:5
|
10 | use std::path::Path;
| ^^^^^^^^^^^^^^^

warning: unused import: std::io::Read
--> src\pak.rs:11:5
|
11 | use std::io::Read;
| ^^^^^^^^^^^^^

error: aborting due to 2 previous errors; 3 warnings emitted

Some errors have detailed explanations: E0252, E0432.
For more information about an error, try rustc --explain E0252.
error: could not compile mhrice

sorry

I pushed your code in 2486fd9 (Thanks!) could you test if it works?

測試魔界村兩次,進度停在10200就不在動了 ^^

https://drive.google.com/file/d/1f9SisfUorIGZaf27QfMdGL8ePdUt7Uvx/view?usp=sharing
我傳一些小容量search-path有問題的文件上來。
mhr dlc >不知道是不是文件太小解析不出path。其他遊戲的dlc可以解析出path
re_chunk_000.pak.patch_00x.pak>>開始解析時出現錯誤訊息,error訊息在文件裡頭
Ghosts n Goblins Resurrection>>停在100200 ,CPU已經沒有滿載感覺像是停止了,文件我沒上傳。

The way search-path works is based on inter-referencing between files, which doesn't guarantee to find all files and is expected to perform poorly for a very small subset of components like DLC.

Devil May Cry seems to be using some compression format unknown to me (17 & 18)

I am not sure what happened to Ghosts n Goblins Resurrection.

Overall, even though these game uses the same engine, there can be subtle difference between their data. I only have MHRise as the sample to research. Supporting other games is something nice to have accidentally, but it is really out of my scope to fix for them.

The way search-path works is based on inter-referencing between files, which doesn't guarantee to find all files and is expected to perform poorly for a very small subset of components like DLC.

Devil May Cry seems to be using some compression format unknown to me (17 & 18)

I am not sure what happened to Ghosts n Goblins Resurrection.

Overall, even though these game uses the same engine, there can be subtle difference between their data. I only have MHRise as the sample to research. Supporting other games is something nice to have accidentally, but it is really out of my scope to fix for them.

^_^ i see , thank for your hard work.