WiiRd forum

USB Gecko Related => USB Gecko Dev => Topic started by: stormshellx on December 05, 2010, 02:57:57 AM

Title: Custom GCT Creator Source Code For those using .NET
Post by: stormshellx on December 05, 2010, 02:57:57 AM
This might come in useful. it converts a text file from the Code Manager from this website to the same type of GCT File that will work perfectly on the wii..Heres the code:
VB.net:

   Sub Process(ByVal FilePath As String, ByVal GCTPath as string)
       Dim R As String
       Dim len As Integer
       Dim codes As String = ""
       Dim data As String = ""
       Dim Reader As New StreamReader(FilePath)
       Dim Raw() As String = Reader.ReadToEnd.Split(Environment.NewLine)
       Reader.Close()
       For i As Integer = 0 To Raw.Length - 1
           R = Raw(i).Replace(" ", "").Replace("*", "")
           len = R.Length
           If len = 17 Then
               R = R.Remove(0, 1)
               R = Data_Hex_Asc(R)
               codes += R
           End If
       Next
       data = Data_Hex_Asc("00D0C0DE00D0C0DE")
       data += codes
       data += Data_Hex_Asc("F000000000000000")
       Dim Writer As New StreamWriter(GCTPath)
       Writer.Write(data)
       Writer.Close()
   End Sub
   Public Function Data_Hex_Asc(ByRef Data As String) As String
       Dim Data1 As String = ""
       Dim sData As String = ""
       While Data.Length > 0
           Data1 = System.Convert.ToChar(System.Convert.ToUInt32(Data.Substring(0, 2), 16)).ToString()
           sData = sData & Data1
           Data = Data.Substring(2, Data.Length - 2)
       End While
       Return sData
   End Function