Answered by:
[Vb.net] Converting from txt to gct?

Question
-
Basically I need help on a function that converts a [B]text [/B]file into a [B]gct [/B]file.
Here is the text in textfile that i want to convert into gct file:
[code]00907A6D 0000003D
00907A6E 00000001
00907A6F 0000003E
00907A70 00000001
00907A71 000000A0
00907A72 000000A1
00907A73 000000B0
00907A74 00000066
00907A75 00000000[/code]
When i make this into a gct file and decode it with hex editor I get this:
As you can see the only addition code added is:
00D0C0DE00D0C0DE (at the beginning)
and
F000000000000000 (at the end)
[IMG]http://i41.tinypic.com/2zhp2c0.png[/IMG]
File Downloads (both txt file and gct file):
[url]http://www.m e d i a fire.com/?mgeheoyrzd4[/url]
remove spaces
Is it possible to create a txt to gct converter in vb.net?
If so, how?- Moved by Martin_Xie Friday, May 14, 2010 10:38 AM (From:Visual Basic General)
Sunday, May 9, 2010 3:09 PM
Answers
-
I dont know if this might help. This is a python script to convert txt file to gct.
import sys, binascii
if len(sys.argv) < 3 or sys.argv[1] not in ['f','c']:
print 'Usage: python gct.py <command> <data>'
print 'Commands:'
print '\tf\tRead codes from a file.'
print '\tc\tRead codes from command line.'
print '\t\tExample: python gct.py c 04337f18 05f5e0ff'
sys.exit(1)
if sys.argv[1] == 'f':
raw = open(sys.argv[2]).read().split('\n')
codes = ''
for c in raw:
c = c.replace(' ','')
if len(c) == 16:
try:
binascii.unhexlify(c)
codes += c
except:
print 'Error: Non-hex digit found in "%s %s"' % (c[:8], c[8:])
sys.exit(1)
elif sys.argv[1] == 'c':
try: codes = ''.join(sys.argv[2:])
except:
print 'Error: Non-hex digit found.'
sys.exit(1)
else:
print 'How did you get this far?'
sys.exit(1)
data = '\x00\xd0\xc0\xde\x00\xd0\xc0\xde'
data += binascii.unhexlify(codes)
data += '\xf0\x00\x00\x00\x00\x00\x00\x00'
while 1:
title = raw_input('Enter game ID: ')
if len(title) < 6: print 'Game ID too short!'
else: break
open('%s.gct' % title,'w').write(data)
print '%s.gct created.' % title- Proposed as answer by Ed Price - MSFTMicrosoft employee Sunday, June 10, 2012 8:10 AM
- Marked as answer by Ed Price - MSFTMicrosoft employee Sunday, June 17, 2012 11:44 PM
Sunday, May 9, 2010 4:07 PM
All replies
-
How did you get it in the GCT file with copy and paste or with some VB Code?
Success
CorSunday, May 9, 2010 3:56 PM -
I used another program to convert the txt file into gct.Sunday, May 9, 2010 4:05 PM
-
I dont know if this might help. This is a python script to convert txt file to gct.
import sys, binascii
if len(sys.argv) < 3 or sys.argv[1] not in ['f','c']:
print 'Usage: python gct.py <command> <data>'
print 'Commands:'
print '\tf\tRead codes from a file.'
print '\tc\tRead codes from command line.'
print '\t\tExample: python gct.py c 04337f18 05f5e0ff'
sys.exit(1)
if sys.argv[1] == 'f':
raw = open(sys.argv[2]).read().split('\n')
codes = ''
for c in raw:
c = c.replace(' ','')
if len(c) == 16:
try:
binascii.unhexlify(c)
codes += c
except:
print 'Error: Non-hex digit found in "%s %s"' % (c[:8], c[8:])
sys.exit(1)
elif sys.argv[1] == 'c':
try: codes = ''.join(sys.argv[2:])
except:
print 'Error: Non-hex digit found.'
sys.exit(1)
else:
print 'How did you get this far?'
sys.exit(1)
data = '\x00\xd0\xc0\xde\x00\xd0\xc0\xde'
data += binascii.unhexlify(codes)
data += '\xf0\x00\x00\x00\x00\x00\x00\x00'
while 1:
title = raw_input('Enter game ID: ')
if len(title) < 6: print 'Game ID too short!'
else: break
open('%s.gct' % title,'w').write(data)
print '%s.gct created.' % title- Proposed as answer by Ed Price - MSFTMicrosoft employee Sunday, June 10, 2012 8:10 AM
- Marked as answer by Ed Price - MSFTMicrosoft employee Sunday, June 17, 2012 11:44 PM
Sunday, May 9, 2010 4:07 PM -