Jump to content


Member Since 11 Jun 2017
Offline Last Active Mar 22 2018 01:01 PM

#57898 [TOOL] KotOR Stuff

Posted by ApanLoon on 18 July 2017 - 03:39 PM

UPDATE: v0.3


The tpc tool can now convert PNG files to uncompressed TPC files.


The following example creates an uncompressed RGB file with two sub images (One full scale and one half-scale mip map) and a couple of TXI attributes:

tpc -o tpc -s2 --outpath PO_PFHA3d.tpc -txi="proceduretype cycle" -txi="channelscale 4 0.1 0.2 0.3 0.4" PO_PFHA3d.png

Note that it might still not be possible to create cyclic procedurals with this tool, I just added those TXI attributes to illustrate how it should be done.


To get some more info about what TXI attributes are used in game and how they need to be formatted for this tool, use the following command to examine an existing TPC file:

tpc -o none -t PO_PFHA3d.tpc

Run this on one, some or all the files in the texture pack to see what's in there.

#57888 [TOOL] KotOR Stuff

Posted by ApanLoon on 17 July 2017 - 07:28 PM

I started to work on a set of small tools for extracting assets from KotOR. These tools are not in any way competing with more complex tools such as "KotOR Tool" or "KotOR Toolset". Those focus on giving a complete experience - a complete solution for all your modding needs. KotOR Stuff does the opposite.


KotOR Stuff provides several tiny command-line tools that each perform a small task. With scripting, these tools could be used to simplify batch processing or support other tools that perform more complex tasks.


Currently three tools are included:

  • bif - Extract assets from KeyTable/BIF repositories
  • erf - Extract assets from ERF/MOD/SAV and HAK repositories
  • tpc - Convert TPC files to PNG. Use command line options to select which side of a cubemap, what frame of a cycle animation or which mip map to convert. Can also list TXI attributes if any are present.

Future releases of this project may include:

  • Creating new BIF/ERF/MOD/SAV and HAK repositories
  • Adding resources to BIF/ERF/MOD/SAV and HAK repositories
  • Convert PNG to TPC given additional information on the command line
  • Improved TPC support: Even though the tpc tool can correctly convert some TPC types that "KotOR Tool" can't, some image types are still not handled correctly. For example, cube maps with only four sides exist but can't be converted yet.

Future releases of this project will probably not include:

  • Pretty GUIs that makes modding a breeze for anyone (That is what "KotOR Tool" and "KotOR Toolset" are for.)

C# source code can be found here:




Binary version for Windows (might also work with mono on other platforms) can be found here:



#57249 Apan Loon joined the forum

Posted by ApanLoon on 16 June 2017 - 11:55 AM

Actually, both. :-)


I used older versions of these tools years ago but now I have a new pet project for which I would like to use the up-to-date and beyond versions of the tools. If there is anything I can do to help improve the tools, I would be happy to try.

#57243 Apan Loon joined the forum

Posted by ApanLoon on 16 June 2017 - 10:00 AM

Hi, I am interested in the tools used for modding KotOR. I consider myself to be a decent programmer and hope that I can find a way to be useful to this community.