SR Textool (SR3/SR4)

Discussion in 'Tool Releases' started by Yepoleb, Jan 28, 2017.

  1. 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.


    • 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


    1. Put the cpeg_pc, gpeg_pc and maybe dds files in a single folder. It should look like this:
    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"
    4. Type your commands in that window.



    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 (Text):

    srtextool --help
    srtextool x --help
    srtextool a --help
    Extract textures

    Extract all textures to the current directory.
    Code (Text):
    srtextool x professorgenki.cpeg_pc
    Extract only "professorgenki_sm_n.tga" and "professorgenki_sm_dp.tga".
    Code (Text):
    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 (Text):
    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 "" and add ""
    Code (Text):
    srtextool a professorgenki.cpeg_pc
    Update everything in the current directory
    Code (Text):
    srtextool a professorgenki.cpeg_pc -i .
    Create a new cpeg file
    Code (Text):
    srtextool a new.cpeg_pc
    Linux only: Update all textures matching "*.dds"
    Code (Text):
    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 ""
    Code (Text):
    srtextool d professorgenki.cpeg_pc
    Modify texture

    Change name of "new_texture.tga" to "new_texture2.tga"
    Code (Text):
    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 (Text):
    srtextool m professorgenki.cpeg_pc new_texture.tga -f 0x1
    List contents

    Code (Text):
    srtextool l professorgenki.cpeg_pc
    Check file for errors

    This command only prints errors. No output means the file is good.
    Code (Text):
    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


    Source code


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


    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.

    Attached Files:

    Last edited: Feb 25, 2017
  2. uh. That's just what I need:D
  3. 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?
  4. 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.
  5. 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.
  6. Just uploaded a new version. It allows creating new peg files and adds a modify command. I'll update the main post tomorrow and upload the source archive.
    MOTOSXORPIO and Fan of Saints like this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice