SR Textool (SR3/SR4)

SR Textool is a complete rewrite of Scanti's SR3 Texture Utilities. It started out as simple Linux port, but I wasn't satisfied with the code quality, so I decided to make my own implementation. After some weeks of work I'm glad to finally have something that's good enough for a release. Please report any bugs and features you want to see.

Features

  • Extract, add, update, delete and modify textures from cvbm_pc/cpeg_pc files
  • Can show detailed information about each entry like size, format, mip levels and flags
  • Supports checking files for errors
  • Extract and update only selected files
  • Create new PEG files
  • Open source license to encourage contributions

Prerequisites

  1. Put the cpeg_pc, gpeg_pc and maybe dds files in a single folder. It should look like this:
    QLyQKLq.png
  2. We need some way to call the srtextool binary. You can either copy srtextool.exe to that same folder or do it the proper way and add its install location to the PATH environment variable. Beginners should choose the first option, but regular users would probably benefit from having the tool available everywhere. You can find a tutorial here for example.
  3. Shift + right click in the Explorer window and select "Open command windows here"
    hKLAKn2.png
  4. Type your commands in that window.
    b9uUiSd.png

Commands

Help

Every command has a help flag to print out its usage information. Use this if you want to know all the available arguments and how to specify them.
Code:
srtextool --help
srtextool x --help
srtextool a --help

Extract textures

Extract all textures to the current directory.
Code:
srtextool x professorgenki.cpeg_pc

Extract only "professorgenki_sm_n.tga" and "professorgenki_sm_dp.tga".
Code:
srtextool x professorgenki.cpeg_pc professorgenki_sm_n.tga professorgenki_sm_dp.tga

Extract everything to the folder "extracted" (needs to be created first).
Code:
srtextool x professorgenki.cpeg_pc -o extracted

Update or add textures

Textures get automatically added it they don't exist. There's no need to specify which action to use.

Update "professorgenki_sm_n.tga.dds" and add "new_texture.tga.dds"
Code:
srtextool a professorgenki.cpeg_pc professorgenki_sm_n.tga.dds new_texture.tga.dds

Update everything in the current directory
Code:
srtextool a professorgenki.cpeg_pc -i .

Create a new cpeg file
Code:
srtextool a new.cpeg_pc new_texture.tga.dds

Linux only: Update all textures matching "*.dds"
Code:
srtextool a professorgenki.cpeg_pc *.dds

Note: New textures with an alpha channel require the "BM_F_ALPHA" flag to be set. This can be done using the modify command. Existing textures already have it and don't need to be modified.

Delete textures

Delete "new_texture.tga.dds"
Code:
srtextool d professorgenki.cpeg_pc new_texture.tga.dds

Modify texture

Change name of "new_texture.tga" to "new_texture2.tga"
Code:
srtextool m professorgenki.cpeg_pc new_texture.tga -n new_texture2.tga

Set alpha flag. A complete list of flags can be found in the Peg file format thread.
Code:
srtextool m professorgenki.cpeg_pc new_texture.tga -f 0x1

List contents

Code:
srtextool l professorgenki.cpeg_pc

Check file for errors

This command only prints errors. No output means the file is good.
Code:
srtextool c professorgenki.cpeg_pc

Planned features

  • Creating new peg files directly, without a clean header file.
  • Adding textures with an alpha channel
  • More file error checks
  • Scripts for drag and drop extraction/updating

Credits


Source code

https://github.com/Yepoleb/srtextool

License

LGPL-3.0+. You can check TLDRLegal if you want a short summary of what that means.

Downloads

There are three download targets: Windows (win), Linux (lin) and source code (src). The Windows and Linux archives contain a 32 and 64 bit build. If you are unsure if your computer supports 64 bit, choose the 32 bit version.
 

Attachments

  • srtextool-1.1.0-lin.tar.gz
    1.7 MB · Views: 868
  • srtextool-1.1.0-win.zip
    1.4 MB · Views: 1,097
  • srtextool-1.1.0-src.zip
    54.1 KB · Views: 464
Last edited:
So, I'm using this to unpack some textures so I can edit them, and it extracted the cvbm_pc file I needed just fine. However, that file also came with a gvbm_pc file as well, (the difference being starting with a g instead of a c,) and the software didn't seem to know what to do with that. When I try to extract the file in that format, it responds with "[ERROR] Invalid file extension".

Now quite frankly, I don't know exactly what the .gvbm_pc companion file is for either, but I'm assuming that if it was included in the original str2_pc file I unpacked, it had a purpose. Since the cvbm_pc file is a diffuse texture, I'm guessing the gvbm_pc is the normal map data, in which case being able to edit that to go with the diffuse changes is fairly important. But whatever that file is, am I doing something wrong or is this incapable of opening gvbm_pc files?
 
So, I'm using this to unpack some textures so I can edit them, and it extracted the cvbm_pc file I needed just fine. However, that file also came with a gvbm_pc file as well, (the difference being starting with a g instead of a c,) and the software didn't seem to know what to do with that. When I try to extract the file in that format, it responds with "[ERROR] Invalid file extension".

Now quite frankly, I don't know exactly what the .gvbm_pc companion file is for either, but I'm assuming that if it was included in the original str2_pc file I unpacked, it had a purpose. Since the cvbm_pc file is a diffuse texture, I'm guessing the gvbm_pc is the normal map data, in which case being able to edit that to go with the diffuse changes is fairly important. But whatever that file is, am I doing something wrong or is this incapable of opening gvbm_pc files?

Cvbm_pc and gvbm_pc files always come in pairs. The cvbm file contains the metadata, like texture name, size or format and the gvbm contains the actual pixel data. All you have to worry about is keeping them in the same folder whenever making any changes. The tool automatically reads and writes the corresponding gvbm when you modify the cvbm.
 
Cvbm_pc and gvbm_pc files always come in pairs. The cvbm file contains the metadata, like texture name, size or format and the gvbm contains the actual pixel data. All you have to worry about is keeping them in the same folder whenever making any changes. The tool automatically reads and writes the corresponding gvbm when you modify the cvbm.

Oh, I see. So I only needed to extract the one I could, and the other is metadata that doesn't need to be extracted at all. That probably would have been more obvious had I paid attention to how tiny the cvbm file is, no way a texture of any sort would fit there. I understand how this works better now, though on the other hand I'm left wondering just where the corresponding normal map data for the texture I'm editing is. Seems editing textures this time around might be more complicated than it was in the previous game. But regardless, this isn't the place to discuss all that. The important thing is that your texture tool is indeed working correctly (thanks a lot for taking the time to make it,) and I really appreciate the prompt and helpful reply to my confused question. Now I'm doing one less thing wrong at least.
 
Back
Top