Skip to content
View in the app

A better way to browse. Learn more.

ResHax

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Help us keep the site running.

Space Marine 2 - Swarm Engine - SDC: Shader Definition Cache

Featured Replies

The Swarm Engine SDC file is basically a cache of shader groups, their entries and each group's bulk compressed data, that when uncompressed, contains the bulk data of the group which the entry then has reference for the size of each entry's uncompressed data in the then uncompressed bulk data, which is each entry's DXBC shader ( bytecode, not source ).

The hierarchy:
- Header
     > Group Count
     > Entry Count
     > Bulk Data Size
     > Sanity Check
- Group
     > Group Bulk Data Size ( Compressed )
     > Group Entry Count
     - Entry
          - Entry Hash ( CRC32 )
          - Entry Bulk Data Size ( Uncompressed )
          - EntryStringLength
- Group Bulk Data ( Based On An Group's Compressed Size )
     - Entry Bulk Data ( Based On An Entry's Uncompressed Size ) ( DXBC Shader / Data Files / Unknown 4 Byte Files )

ImHex Pattern
```

import std.core;

struct SDCHeader {
    u32 GroupTotal;
    u32 EntryTotal;
    u32 BulkDataSize;
    u32 SanityCheck;
    };
    
struct SDCEntry {
    u32 EntryHashCRC32;
    u32 EntryUncompressedSize;
    u32 EntryStringLength;
    };
    
struct SDCGroup {
    u32 GroupBulkDataSize;
    u32 GroupEntryTotal;
    SDCEntry Entry [GroupEntryTotal];
    };

struct SDCGroupData {
    u8 ZLibCompressedData [parent.Group[std::core::array_index()].GroupBulkDataSize];
    };

struct SDCFormat {
    SDCHeader Header;
    SDCGroup Group [Header.GroupTotal];
    SDCGroupData BulkData [Header.GroupTotal];
    };
    
SDCFormat Format @ 0x00;
```
Python Script Included For Extraction Of Data Files, might not be as up to date with the findings above.
Thank you again, Jumanji144.

Command in Powershell:
python3 scp.py <sdc file> <output folder>

Thank You:
- Jumanji144 ( ImHex Discord )
- WerWolv ( ImHex Discord )
- Haus ( Halo Archive Discord )

sdc_working.py

Edited by GameBreaker
Addition of python script command.

  • Supporter

Thanks.

But (other than for the hierarchy structs) it would make more sense to attach the python code as a py file rather than displaying the code in the post, too, imho.

Also having test.scd as a sample would be nice. 

Edited by shak-otay

  • Author
8 minutes ago, shak-otay said:

Thanks.

But (other than for the hierarchy structs) it would make more sense to attach the python code as a py file rather than displaying the code in the post, too, imho.

Also having test.scd as a sample would be nice. 

Apologies, doing this between my laptop and remote-ed in desktop, so easier to copy and paste text in this case, but will edit this post as I get this all put together in files.

  • GameBreaker changed the title to Space Marine 2 - Swarm Engine - SDC: Shader Definition Cache
  • Author
On 9/18/2024 at 3:30 PM, shak-otay said:

Thanks.

But (other than for the hierarchy structs) it would make more sense to attach the python code as a py file rather than displaying the code in the post, too, imho.

Also having test.scd as a sample would be nice. 

Included the python script now, and some changes are made to the pattern file, thanks to Haus, the script is not fully up to date with the pattern, but it should be mostly fine for research purposes.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.