Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

s&box map support #106

Open
izzint opened this issue Aug 5, 2021 · 19 comments
Open

s&box map support #106

izzint opened this issue Aug 5, 2021 · 19 comments

Comments

@izzint
Copy link

izzint commented Aug 5, 2021

Whenever I try to load a s&box VPK map file it gives me this error:


Python: Traceback (most recent call last):
  File "C:\Users\zoome\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\SourceIO\source2_operators.py", line 109, in execute
    world.load(vpk_path.stem)
  File "C:\Users\zoome\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\SourceIO\source2\resouce_types\valve_world.py", line 43, in load
    self.load_entities()
  File "C:\Users\zoome\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\SourceIO\source2\resouce_types\valve_world.py", line 56, in load_entities
    handler.load_entities()
  File "C:\Users\zoome\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\SourceIO\source2\entities\abstract_entity_handlers.py", line 78, in load_entities
    self.load_all_entities()
  File "C:\Users\zoome\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\SourceIO\source2\entities\abstract_entity_handlers.py", line 99, in load_all_entities
    self.handle_child_lump(proper_path.stem, ValveCompiledFile(elump_file))
  File "C:\Users\zoome\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\SourceIO\source2\entities\abstract_entity_handlers.py", line 103, in handle_child_lump
    self.load_entity_lump(name, child_lump)
  File "C:\Users\zoome\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\SourceIO\source2\entities\abstract_entity_handlers.py", line 122, in load_entity_lump
    a.read(reader)
  File "C:\Users\zoome\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\SourceIO\source2\utils\entity_keyvalues.py", line 11, in read
    version = reader.read_int32()
  File "C:\Users\zoome\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\SourceIO\utilities\byte_io_mdl.py", line 171, in read_int32
    return self._read('i')
  File "C:\Users\zoome\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\SourceIO\utilities\byte_io_mdl.py", line 156, in _read
    return struct.unpack(t, self.file.read(struct.calcsize(t)))[0]
struct.error: unpack requires a buffer of 4 bytes

location: <unknown location>:-1
@REDxEYE
Copy link
Owner

REDxEYE commented Aug 5, 2021

Please, provide VPK file

@izzint
Copy link
Author

izzint commented Aug 5, 2021

@REDxEYE
Copy link
Owner

REDxEYE commented Aug 5, 2021

Fixed in 84a6639

@REDxEYE
Copy link
Owner

REDxEYE commented Aug 5, 2021

Please verify and close ticket

@izzint
Copy link
Author

izzint commented Aug 6, 2021

seems like it is still not working (used addon from source code instead of releases)
error:

Python: Traceback (most recent call last):
  File "C:\Users\zoome\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\SourceIO\source2_operators.py", line 109, in execute
    world.load(vpk_path.stem)
  File "C:\Users\zoome\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\SourceIO\source2\resouce_types\valve_world.py", line 43, in load
    self.load_entities()
  File "C:\Users\zoome\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\SourceIO\source2\resouce_types\valve_world.py", line 56, in load_entities
    handler.load_entities()
  File "C:\Users\zoome\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\SourceIO\source2\entities\abstract_entity_handlers.py", line 78, in load_entities
    self.load_all_entities()
  File "C:\Users\zoome\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\SourceIO\source2\entities\abstract_entity_handlers.py", line 99, in load_all_entities
    self.handle_child_lump(proper_path.stem, ValveCompiledFile(elump_file))
  File "C:\Users\zoome\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\SourceIO\source2\entities\abstract_entity_handlers.py", line 103, in handle_child_lump
    self.load_entity_lump(name, child_lump)
  File "C:\Users\zoome\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\SourceIO\source2\entities\abstract_entity_handlers.py", line 122, in load_entity_lump
    a.read(reader)
  File "C:\Users\zoome\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\SourceIO\source2\utils\entity_keyvalues.py", line 11, in read
    version = reader.read_int32()
  File "C:\Users\zoome\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\SourceIO\utilities\byte_io_mdl.py", line 171, in read_int32
    return self._read('i')
  File "C:\Users\zoome\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\SourceIO\utilities\byte_io_mdl.py", line 156, in _read
    return struct.unpack(t, self.file.read(struct.calcsize(t)))[0]
struct.error: unpack requires a buffer of 4 bytes

location: <unknown location>:-1

@izzint
Copy link
Author

izzint commented Aug 6, 2021

it seems like it is the same error

@REDxEYE
Copy link
Owner

REDxEYE commented Aug 10, 2021

The map you provided loads fine for me, are you trying to load a different map? If so, can you send it?

@REDxEYE
Copy link
Owner

REDxEYE commented Aug 16, 2021

Should be fixed now

@REDxEYE REDxEYE closed this as completed Aug 25, 2021
@PiperManiaDeluxe
Copy link
Contributor

PiperManiaDeluxe commented Dec 3, 2024

I'm still having issues with this:

[DEBUG]--[ContentManager:find_file]: Requesting maps/devroom01.vmap_c file
[DEBUG]--[ContentManager:find_file]: Found in LooseFilesContentProvider("D:/Project.Files.2025.Q1/TwMCProject/twmc_sbox_levels/Assets")!
[DEBUG]--[ContentManager:find_file]: Requesting maps/devroom01/worldnodes/node000.vrman_c file
[DEBUG]--[ContentManager:find_file]: Found in VPKContentProvider("D:/Project.Files.2025.Q1/TwMCProject/twmc_sbox_levels/Assets/maps/devroom01.vpk")!
[DEBUG]--[ContentManager:find_file]: Requesting maps/devroom01/world.vwrld_c file
[DEBUG]--[ContentManager:find_file]: Found in VPKContentProvider("D:/Project.Files.2025.Q1/TwMCProject/twmc_sbox_levels/Assets/maps/devroom01.vpk")!
[DEBUG]--[ContentManager:find_file]: Requesting maps/devroom01/worldnodes/node000.vwnod_c file
[DEBUG]--[ContentManager:find_file]: Found in VPKContentProvider("D:/Project.Files.2025.Q1/TwMCProject/twmc_sbox_levels/Assets/maps/devroom01.vpk")!
[DEBUG]--[ContentManager:find_file]: Requesting maps/devroom01/entities/default_ents.vents_c file
[DEBUG]--[ContentManager:find_file]: Found in VPKContentProvider("D:/Project.Files.2025.Q1/TwMCProject/twmc_sbox_levels/Assets/maps/devroom01.vpk")!
Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\SourceIO\blender_bindings\operators\source2_operators.py", line 149, in execute
    load_map(model, content_manager, self.scale)
  File "C:\Users\Administrator\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\SourceIO\blender_bindings\source2\vwrld\loader.py", line 48, in load_map
    return import_world(world_resource, map_resource, cm, scale)
  File "C:\Users\Administrator\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\SourceIO\blender_bindings\source2\vwrld\loader.py", line 79, in import_world
    load_entities(world_resource, master_collection, scale, content_manager)
  File "C:\Users\Administrator\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\SourceIO\blender_bindings\source2\vwrld\loader.py", line 149, in load_entities
    load_entity_lump(entity_resource, handler, collection, scale, cm)
  File "C:\Users\Administrator\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\SourceIO\blender_bindings\source2\vwrld\loader.py", line 154, in load_entity_lump
    handler = handler_class(list(entity_resource.get_entities()), collection, cm, scale)
  File "C:\Users\Administrator\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\SourceIO\library\source2\resource_types\compiled_world_resource.py", line 22, in get_entities
    yield EntityKeyValues.from_buffer(buffer)
  File "C:\Users\Administrator\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\SourceIO\library\source2\utils\entity_keyvalues.py", line 142, in from_buffer
    assert version == 1, f"Unknown version of entity keyvalues:{version}"
AssertionError: Unknown version of entity keyvalues:0

@REDxEYE
Copy link
Owner

REDxEYE commented Dec 3, 2024

SBox is constantly updating, they can change anything about map format.
I update sourceio from time to time to support their changes

@PiperManiaDeluxe
Copy link
Contributor

Thanks for the quick reply, would you like more insight on the errors im getting? (even a simple map with a basic mesh and a point light is not importing) or would you like to stop here? I can see how sbox's constant updates can make something like this very frustrating.

@REDxEYE
Copy link
Owner

REDxEYE commented Dec 3, 2024

You can help by uploading example map

@PiperManiaDeluxe
Copy link
Contributor

Sure!
maps.zip

Importing simpletest.vpk on the main branch gives me the following exception:

Python: Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\SourceIO\blender_bindings\operators\source2_operators.py", line 148, in execute
    model = CompiledMapResource.from_buffer(map_buffer, vpk_path)
  File "C:\Users\Administrator\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\SourceIO\library\source2\resource_types\resource.py", line 61, in from_buffer
    header = CompiledHeader.from_buffer(inmemory_buffer)
  File "C:\Users\Administrator\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\SourceIO\library\source2\data_types\compiled_file_header.py", line 39, in from_buffer
    assert header_version == 0x0000000c
AssertionError

And on the better_errors branch:

Python: Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\SourceIO\blender_bindings\operators\source2_operators.py", line 149, in execute
    load_map(model, content_manager, self.scale)
  File "C:\Users\Administrator\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\SourceIO\blender_bindings\source2\vwrld\loader.py", line 48, in load_map
    
  File "C:\Users\Administrator\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\SourceIO\blender_bindings\source2\vwrld\loader.py", line 79, in import_world
    
  File "C:\Users\Administrator\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\SourceIO\blender_bindings\source2\vwrld\loader.py", line 149, in load_entities
    
  File "C:\Users\Administrator\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\SourceIO\blender_bindings\source2\vwrld\loader.py", line 154, in load_entity_lump
    handler.load_entities()
  File "C:\Users\Administrator\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\SourceIO\library\source2\resource_types\compiled_world_resource.py", line 22, in get_entities
    yield EntityKeyValues.from_buffer(buffer)
  File "C:\Users\Administrator\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\SourceIO\library\source2\utils\entity_keyvalues.py", line 142, in from_buffer
    assert version == 1, f"Unknown version of entity keyvalues:{version}"
AssertionError: Unknown version of entity keyvalues:0

@REDxEYE
Copy link
Owner

REDxEYE commented Dec 3, 2024

Interesting, better_errors branch should be the same for parsing code.....

@REDxEYE REDxEYE reopened this Dec 3, 2024
@PiperManiaDeluxe
Copy link
Contributor

Yeah, I've seen that the error the main branch spits out is different on different runs

@REDxEYE
Copy link
Owner

REDxEYE commented Dec 4, 2024

I think i fixed it, can you please try again?

@PiperManiaDeluxe
Copy link
Contributor

Will do once I can

@PiperManiaDeluxe
Copy link
Contributor

Its not giving me any errors this time but all that gets imported is a single empty with the name of one of the world nodes, no entities or meshes get imported.

@REDxEYE
Copy link
Owner

REDxEYE commented Dec 5, 2024

It did work for me, could you please share the blend file and logs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants