Demon's Souls fonts and textures, .tpf archives

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
gerald007
Posts: 10
Joined: Tue Apr 02, 2019 9:00 am

Demon's Souls fonts and textures, .tpf archives

Post by gerald007 »

I need help unpack and repack fonts, textures.
Files:
https://ufile.io/qx92f
Acewell
Posts: 706
Joined: Fri Aug 08, 2014 1:06 am

Re: Demon's Souls fonts and textures, .tpf archives

Post by Acewell »

gerald007
Posts: 10
Joined: Tue Apr 02, 2019 9:00 am

Re: Demon's Souls fonts and textures, .tpf archives

Post by gerald007 »

Acewell wrote:you tried Yabber? :)
https://github.com/JKAnderson/Yabber

Yeap. Not unpacked.

Code: Select all

Unpacking TPF: dsfont24.tpf...
Unhandled exception: System.NotSupportedException: Yabber does not support console TPFs at the moment.
   location: Yabber.YTPF.Unpack(TPF tpf, String sourceName, String targetDir)
   location: Yabber.Program.UnpackFile(String sourceFile)
   location: Yabber.Program.Main(String[] args)

One or more errors were encountered and displayed above.
Press any key to exit.
Acewell
Posts: 706
Joined: Fri Aug 08, 2014 1:06 am

[PS3] Demon's Souls (.tpf)

Post by Acewell »

gerald007 wrote:I need help unpack .... fonts, textures.

here is Noesis python script to get you halfway there, modding is not my area. :D
tex_DemonsSouls_PS3_tpf.zip

supports dxt1 and dxt5
gerald007
Posts: 10
Joined: Tue Apr 02, 2019 9:00 am

Re: [PS3] Demon's Souls (.tpf)

Post by gerald007 »

Acewell wrote:
gerald007 wrote:I need help unpack .... fonts, textures.

here is Noesis python script to get you halfway there, modding is not my area. :D
tex_DemonsSouls_PS3_tpf.zip
supports dxt1 and dxt5

Yes, unpacked textures and fonts but not support import. :(
gerald007
Posts: 10
Joined: Tue Apr 02, 2019 9:00 am

Re: Demon's Souls fonts and textures, .tpf archives

Post by gerald007 »

Can somebody help me?
Acewell
Posts: 706
Joined: Fri Aug 08, 2014 1:06 am

Re: Demon's Souls fonts and textures, .tpf archives

Post by Acewell »

here use this bms script for reimport only. :)

Code: Select all

# script for QuickBMS http://aluigi.altervista.org/quickbms.htm

endian big
idstring "TPF\x00"
get TOTAL_DATA_SZ long
get NUM_TEX long
goto 0x10
for i = 0 < NUM_TEX
    get OFFSET long
    get SIZE long
    get FORMAT byte
    goto 0x3 0 seek_cur
    get WIDTH short
    get HEIGHT short
    goto 0x8 0 seek_cur
    get STR_OFF long
    get UNK long
    savepos TMP
    goto STR_OFF
    get NAME string
    string NAME + .dds
    log NAME OFFSET SIZE
    goto TMP
next i


save extracted files from Noesis as dds.
edit your image, but keep same dimensions, format and mips when saving.
create a new folder and throw all your edited images in there.
open your edited images and delete the 128 byte dds header.
reimport to tpf with the provided bms script and select the new folder as output folder when prompted.
gerald007
Posts: 10
Joined: Tue Apr 02, 2019 9:00 am

Re: Demon's Souls fonts and textures, .tpf archives

Post by gerald007 »

Acewell wrote:here use this bms script for reimport only. :)

Code: Select all

# script for QuickBMS http://aluigi.altervista.org/quickbms.htm

endian big
idstring "TPF\x00"
get TOTAL_DATA_SZ long
get NUM_TEX long
goto 0x10
for i = 0 < NUM_TEX
    get OFFSET long
    get SIZE long
    get FORMAT byte
    goto 0x3 0 seek_cur
    get WIDTH short
    get HEIGHT short
    goto 0x8 0 seek_cur
    get STR_OFF long
    get UNK long
    savepos TMP
    goto STR_OFF
    get NAME string
    string NAME + .dds
    log NAME OFFSET SIZE
    goto TMP
next i


save extracted files from Noesis as dds.
edit your image, but keep same dimensions, format and mips when saving.
create a new folder and throw all your edited images in there.
open your edited images and delete the 128 byte dds header.
reimport to tpf with the provided bms script and select the new folder as output folder when prompted.


Thank you. Import successful. Can you show me delete the 128 byte dds header?
Acewell
Posts: 706
Joined: Fri Aug 08, 2014 1:06 am

Re: Demon's Souls fonts and textures, .tpf archives

Post by Acewell »

gerald007 wrote:Can you show me delete the 128 byte dds header?

Code: Select all

get EXT extension
if EXT == dds
    get NAME basename
    get SIZE asize
    math SIZE - 0x80
    log NAME 0x80 SIZE
else
    cleanexit
endif

:)
gerald007
Posts: 10
Joined: Tue Apr 02, 2019 9:00 am

Re: Demon's Souls fonts and textures, .tpf archives

Post by gerald007 »

Acewell wrote:
gerald007 wrote:Can you show me delete the 128 byte dds header?

Code: Select all

get EXT extension
if EXT == dds
    get NAME basename
    get SIZE asize
    math SIZE - 0x80
    log NAME 0x80 SIZE
else
    cleanexit
endif

:)

Thanks, fonts is worked but loading screen, menu, you died, you revived textrues not worked.
When i edit textrues, Demon's Souls stick on loading screen. How can i fix this problem?
Acewell
Posts: 706
Joined: Fri Aug 08, 2014 1:06 am

Re: Demon's Souls fonts and textures, .tpf archives

Post by Acewell »

gerald007 wrote:
Acewell wrote:How can i fix this problem?

don't know, modding is not my area as i said, it sounds like you made
error in the steps, or you didn't keep with same format, size etc or the
game just doesn't want to be modded. :)
there is nothing more i can do here.
gerald007
Posts: 10
Joined: Tue Apr 02, 2019 9:00 am

Re: Demon's Souls fonts and textures, .tpf archives

Post by gerald007 »

Acewell wrote:
gerald007 wrote:
Acewell wrote:How can i fix this problem?

don't know, modding is not my area as i said, it sounds like you made
error in the steps, or you didn't keep with same format, size etc or the
game just doesn't want to be modded. :)
there is nothing more i can do here.

Hi Acewell. I need your help again.
Can you edit the Ccm files? I want to enlarge the size of the characters and change them but the characters won't show at hex. Someone prepared a template for Dark Souls before. I send you both Dark Souls and Demons Souls CCM files now. Can you compare and adapt it to Demons Souls? If you can Convert them it will be much better. It will do the job greatly if the characters are unpacked and packed up as XML or TXT files.
Dark Souls template

Code: Select all

//--------------------------------------
//--- 010 Editor v5.0 Binary Template
//
// File: Dark Souls .CCM (Font Definition)
// Author: Jed "Nyxojaele" Lang
// Revision: 1
//--------------------------------------
typedef struct
{
int FirstCode;
int LastCode;
int FirstGlyphIndex;
} CodeGroup <read=ReadCodeGroup>;
string ReadCodeGroup(CodeGroup &cg)
{
string ret;
SPrintf(ret, "%d-%d @ %d", cg.FirstCode, cg.LastCode, cg.FirstGlyphIndex);
return ret;
}

typedef struct
{
float U1;
float V1;
float U2;
float V2;
short PreSpace;
short Width;
short Advance;
short ImageIndex;
} GlyphStruct <optimize=false>;


byte Signature[4] <format=hex>;
int FileSize <format=hex>;
short HorizontalStretch; //Lower number = stretched more
short ImageWidth; //Not sure if width or height, since they all use 512x512
short ImageHeight; //Not sure if width or height, since they all use 512x512
short Unknown2 <format=hex>;
short CodeGroupCount;
short GlyphCount;
int CodeGroupsOffset <format=hex>;
int GlyphsOffset <format=hex>;
short Unknown3 <format=hex>;
byte ImageCount;
byte Unknown5 <format=hex>;
CodeGroup CodeGroups[CodeGroupCount];
struct
{
GlyphStruct Glyph[GlyphCount];
} Glyphs;