Fixing the DDS headers

Results 1 to 11 of 11
  1. #1
    Moooooooooooooooo alphaest is offline
    MemberRank
    Jul 2006 Join Date
    WorldLocation
    2,026Posts

    Post Fixing the DDS headers

    Someone asked me about this so i post the source:

    Code:
        Sub Main()
            Dim nHeader As Byte() = {&H44, &H44, &H53, &H20}
            Dim iDir As String = ".\\"
            Dim rylClient As System.Collections.ObjectModel.ReadOnlyCollection(Of String) = My.Computer.FileSystem.GetFiles(iDir, FileIO.SearchOption.SearchTopLevelOnly, "Client.exe")
            If rylClient.Count <> 1 Then
                Console.WriteLine("Place this tool in your ryl2 directory")
                Console.WriteLine("")
                Console.WriteLine("Hit enter to exit")
                Console.ReadLine()
                Exit Sub
            End If
    
            Console.WriteLine("Parsing files....")
            Dim files As System.Collections.ObjectModel.ReadOnlyCollection(Of String) = My.Computer.FileSystem.GetFiles(iDir, FileIO.SearchOption.SearchAllSubDirectories, "*.dds")
    
            Console.WriteLine("Number of found files: " & files.Count)
            Console.WriteLine("")
            Console.WriteLine("Hit enter to continue or Ctrl+C to exit")
            Console.ReadLine()
            Dim changedF As Integer = 0
            Console.WriteLine("Editing DDS files... Please wait.")
            For Each f As String In files
                Try
                    Dim bw As IO.FileStream = IO.File.Open(f, IO.FileMode.Open, IO.FileAccess.ReadWrite, IO.FileShare.None)
                    'Dim bb As New IO.BinaryWriter(bw)
                    Dim header(4) As Byte
                    Dim readed As Integer = bw.Read(header, 0, 5)
                    If readed = 5 Then
                        If header(0) = &H0 AndAlso header(1) = &H0 AndAlso header(2) = &H0 AndAlso header(3) = &H0 AndAlso header(4) = &H7C Then
                            Console.WriteLine(f)
                            bw.Seek(0, IO.SeekOrigin.Begin)
                            bw.Write(nHeader, 0, nHeader.Length)
                            bw.Flush()
                            changedF += 1
                        End If
                    End If
                    bw.Close()
                Catch ex As Exception
                    Console.WriteLine("Error happened: " & ex.Message)
                    Console.WriteLine()
                    Console.WriteLine("Exiting...")
                    GoTo x
                End Try
            Next
    x:      Console.WriteLine("Edited " & changedF & " files. " & (files.Count - changedF) & " files had already DDS header. Hit enter to exit")
            Console.ReadLine()
        End Sub
    In short what it does:

    1. Check if client.exe is in the current directory
    2. Find all *.dds files in the current and all subdirectorys
    3. Check if the header is what gama/youxi changed it to (you may want to disable this one)
    4. Write the correct bytes ("DDS ")
    5. Save the file


  2. #2
    Account Upgraded | Title Enabled! oskdemon is offline
    MemberRank
    May 2005 Join Date
    CanadaLocation
    634Posts

    Re: Fixing the DDS headers

    simple but effective. great.

  3. #3
    Noob IzzdihaR is offline
    MemberRank
    Jun 2010 Join Date
    MALAYSIA!!!!!!!Location
    633Posts

    Re: Fixing the DDS headers

    im not understand what you say..:(...

  4. #4
    Account Upgraded | Title Enabled! ryl1single is offline
    MemberRank
    Dec 2009 Join Date
    216Posts

    Re: Fixing the DDS headers

    dds ?

  5. #5
    Member fatin is offline
    MemberRank
    Sep 2010 Join Date
    In Cyber WorldLocation
    73Posts

    Re: Fixing the DDS headers

    what this??
    anti-ddos?
    or what im newbies so im dont know~~

  6. #6
    Novice Z3UZ is offline
    MemberRank
    Dec 2010 Join Date
    3Posts

    Re: Fixing the DDS headers

    dds is the extension for texture file in ryl

  7. #7
    Moooooooooooooooo alphaest is offline
    MemberRank
    Jul 2006 Join Date
    WorldLocation
    2,026Posts

  8. #8
    Apprentice masteranu84 is offline
    MemberRank
    May 2011 Join Date
    7Posts

    Re: Fixing the DDS headers

    help me out ...

  9. #9
    Advance User fadfunky is offline
    MemberRank
    Nov 2009 Join Date
    SEALocation
    423Posts

    Re: Fixing the DDS headers

    thx for the source

  10. #10
    Member oralb is offline
    MemberRank
    Sep 2011 Join Date
    C:/ServerLocation
    98Posts

    Re: Fixing the DDS headers

    look like a C++ code? i'm still not expert on C++ . But in Visual Basic not bad.

  11. #11
    Moooooooooooooooo alphaest is offline
    MemberRank
    Jul 2006 Join Date
    WorldLocation
    2,026Posts

    Re: Fixing the DDS headers

    Quote Originally Posted by oralb View Post
    look like a C++ code? i'm still not expert on C++ . But in Visual Basic not bad.
    Fail.

    This is visual basic.



Advertisement