Howdy,
Since the Wii U is progressing nicely I thought maybe getting a couple of command line tools into a more friendly interface might be something fun to do.
So we have DiscU (@ 2.1b) I thought the first thing would be to convert Hex strings to binary and write them to a file, eliminating doing this manually. I am working in VB / VS 2013, writing code that should be compatible back to 2010. SO far this is a form with a button ( I have more completed
**There will be no posting of actual keys to anything in this thread**
Only issue is how it is creating the binary file. Its been a while so I am sure the mistake is simple, at first I couldn't get it to handle a hexstring that large, now it will write file but it is padding like 4 0's between.
Anyone know where I went wrong?
(also I will include the source (- naughty bits) when this tiny issue gets solved.)
Since the Wii U is progressing nicely I thought maybe getting a couple of command line tools into a more friendly interface might be something fun to do.
So we have DiscU (@ 2.1b) I thought the first thing would be to convert Hex strings to binary and write them to a file, eliminating doing this manually. I am working in VB / VS 2013, writing code that should be compatible back to 2010. SO far this is a form with a button ( I have more completed
**There will be no posting of actual keys to anything in this thread**
Code:
Public Function Hex2ByteArr(ByVal sHex As String) As Byte()
Dim n As Long
Dim nCount As Long
Dim bArr() As Byte
'First of all, make sure the length of the hex string is even, if it is not then
'put a "0" at the beginning
nCount = Len(sHex)
If (nCount And 1) = 1 Then
sHex = "0" & sHex
nCount = nCount + 1
End If
'ReDim the Byte array
ReDim bArr(nCount \ 2 - 1) 'we subtract 1 since the array is zero based
For n = 1 To nCount Step 2
'Convert the hex numbers into decimal values and store them in the byte array
bArr((n - 1) \ 2) = CByte("&H" & Mid$(sHex, n, 2))
Next
'Return the array
Hex2ByteArr = bArr
End Function
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim bArr() As Byte
Dim hFile As Integer
bArr = Hex2ByteArr("027C9557648A1A996D25BFCC40F63856")
'You should of course pass the whole hex string to the function above.
'--
'Save it to a file
hFile = FreeFile()
Using writer As BinaryWriter = New BinaryWriter(File.Open("diskkey.bin", FileMode.Create))
' Write each integer.
For Each value As Int32 In bArr
writer.Write(value)
Next
End Using
End Sub
Only issue is how it is creating the binary file. Its been a while so I am sure the mistake is simple, at first I couldn't get it to handle a hexstring that large, now it will write file but it is padding like 4 0's between.
Anyone know where I went wrong?
(also I will include the source (- naughty bits) when this tiny issue gets solved.)