Compare commits

...

2 Commits
master ... snf

Author SHA1 Message Date
f81ce21bdc change textures path on my pc 2024-07-26 15:41:50 -07:00
c0fe3f71cc read snf map 2024-07-25 17:47:55 -07:00
2 changed files with 12 additions and 4 deletions

View File

@ -4,6 +4,8 @@ use std::io::Read;
pub enum ReadError{
Roblox(strafesnet_rbx_loader::ReadError),
Source(strafesnet_bsp_loader::ReadError),
StrafesNET(strafesnet_snf::Error),
StrafesNETMap(strafesnet_snf::map::Error),
Io(std::io::Error),
UnknownFileFormat,
}
@ -16,15 +18,20 @@ impl std::error::Error for ReadError{}
pub enum DataStructure{
Roblox(strafesnet_rbx_loader::Dom),
Source(strafesnet_bsp_loader::Bsp)
Source(strafesnet_bsp_loader::Bsp),
StrafesNET(strafesnet_common::map::CompleteMap),
}
pub fn read<R:Read>(input:R)->Result<DataStructure,ReadError>{
pub fn read<R:Read+std::io::Seek>(input:R)->Result<DataStructure,ReadError>{
let mut buf=std::io::BufReader::new(input);
let peek=std::io::BufRead::fill_buf(&mut buf).map_err(ReadError::Io)?;
match &peek[0..4]{
b"<rob"=>Ok(DataStructure::Roblox(strafesnet_rbx_loader::read(buf).map_err(ReadError::Roblox)?)),
b"VBSP"=>Ok(DataStructure::Source(strafesnet_bsp_loader::read(buf).map_err(ReadError::Source)?)),
b"SNFM"=>Ok(DataStructure::StrafesNET(
strafesnet_snf::read_map(buf).map_err(ReadError::StrafesNET)?
.into_complete_map().map_err(ReadError::StrafesNETMap)?
)),
_=>Err(ReadError::UnknownFileFormat),
}
}
@ -46,6 +53,7 @@ pub fn load<P:AsRef<std::path::Path>>(path:P)->Result<strafesnet_common::map::Co
//blocking because it's simpler...
let file=std::fs::File::open(path).map_err(LoadError::File)?;
match read(file).map_err(LoadError::ReadError)?{
DataStructure::StrafesNET(map)=>Ok(map),
DataStructure::Roblox(dom)=>{
let mut loader=strafesnet_deferred_loader::roblox_legacy();

View File

@ -1 +1 @@
/run/media/quat/Files/Documents/map-files/verify-scripts/textures/dds/
/run/media/quat/Files/Documents/map-files/verify-scripts/textures