Homebrew TgaVerifiy - A Tga Verifier

mike087

Well-Known Member
Member
Joined
Jan 6, 2017
Messages
214
Trophies
0
Age
39
XP
1,238
Country
Ecuador
Hello, i have cbhc and haxchi installed, everything was working fine until i decided to make a different icon (iconTex.tga) for my haxhi, i made it and replaced through ftpiiu but i doesnt worked, i shows a ??? and a grey question mark icon. And the problem is that even placing the original iconTex.tga doesnt work. Help please.
 
D

Deleted User

Guest
I run the program and it closes it doesnt show anything
Are you running it from a command pompt? It should spit out "All TGAs Verified" on exit, regardless of whether or not there are errors in your images.
 

V10lator

Well-Known Member
Member
Joined
Apr 21, 2019
Messages
2,654
Trophies
1
Age
36
XP
5,540
Country
Germany
MetaVerifiy for Python 3.x
Made it Linux compatible:

Python:
#!//bin/env python
import struct
import os
try:
    import msvcrt as m
except:
    import getch as m

def wait():
    m.getch()
    
def readByte(file):
    return struct.unpack("B", file.read(1))[0]
 
def readu16le(file):
    return struct.unpack("<H", file.read(2))[0]
 
def readu32le(file):
    return struct.unpack("<I", file.read(4))[0]


tgas = ["iconTex.tga","bootLogoTex.tga","bootDrcTex.tga","bootTvTex.tga"]
dimensions = [[128,128,32],[170,42,32],[854,480,24],[1280,720,24]]
for i in range(len(tgas)):
    tga = tgas[i]
    dimension = dimensions[i]
    if os.path.exists(tga):
        with open(tga,"rb+") as f:
            header = readu32le(f)
            if header != 0x00020000:
                print (tga + "is compressed. it cant be compressed!")
                break
            f.seek(12)
            actDimensions = [readu16le(f),readu16le(f),readByte(f)]
            hasHadBadDiment = False
            for j in range(len(actDimensions)):
                if j == 0:
                    type = "width"
                elif j == 1:
                    type = "height"
                else:
                    type = "depth"
                diment = dimension[j]
                actDiment = actDimensions[j]
                if diment != actDiment:
                    if not hasHadBadDiment:
                        hasHadBadDiment = True
                        print ("dimensions are not valid for: " + tga)
                    print (type + " is: " + str(actDiment) + " should be: " + str(diment))
            if hasHadBadDiment:
                break
            f.seek(1,1)
            f.seek(actDimensions[0]*actDimensions[1]*int(actDimensions[2]/8),1)
            f.write(b"\x00\x00\x00\x00\x00\x00\x00\x00TRUEVISION-XFILE\x2E\x00")
    else:
        print (tga + " could not be found!")
print ("All TGA's verified!")
print ("press any key to exit...")
#todo verifiy bootovie.h264
wait()
 
  • Like
Reactions: ber71

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • ZeroT21 @ ZeroT21:
    :toot:blow me then @K3Nv2
  • K3Nv2 @ K3Nv2:
    Nah I'm straight but you're more than welcome to blow ancientboi
  • ZeroT21 @ ZeroT21:
    LOL, which straight person does not make gay jokes?
    +1
  • K3Nv2 @ K3Nv2:
    I'm straight but we can whack dicks together
  • ZeroT21 @ ZeroT21:
    nah, I'm gud over here, no need for sword fights

    :glare:
    +1
  • K3Nv2 @ K3Nv2:
    Dick slang
  • K3Nv2 @ K3Nv2:
    See ancientboi already has a crush on you
  • AncientBoi @ AncientBoi:
    [brings my ⚔️ ] On Guard :D:evil::wub:
  • K3Nv2 @ K3Nv2:
    Looks more like a dagger to me
  • AncientBoi @ AncientBoi:
    Pffffft I have a crush on everybody
  • ZeroT21 @ ZeroT21:
    I see no problem, unless i happen to grow another gender one day. Too bad it ain't now
  • K3Nv2 @ K3Nv2:
    Thought you already had both hotswappable gender fluid
  • ZeroT21 @ ZeroT21:
    Enjoy whatever life chucks your way

    :teach:
    +1
  • K3Nv2 @ K3Nv2:
    Deeze nuts
  • AncientBoi @ AncientBoi:
    Dem Nutz
  • ZeroT21 @ ZeroT21:
    'Em nutters
  • AncientBoi @ AncientBoi:
    M&M nutz
    +1
  • K3Nv2 @ K3Nv2:
    Slim anus nutter
  • AncientBoi @ AncientBoi:
    :unsure::unsure::unsure: I might go buy them M&M w/nuts. I gotta go out to pay the rent anyway
    +2
  • Psionic Roshambo @ Psionic Roshambo:
    Eat a Snickers!
  • Psionic Roshambo @ Psionic Roshambo:
    Almond Joys got nuts!
  • Xdqwerty @ Xdqwerty:
    Good afternoon
    Xdqwerty @ Xdqwerty: Good afternoon