Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- """
- Creates a sorttxt.txt from a gaming session GD-M log (stripped of crap) and a
- list of all the files for the game.
- The last file on disc will be the first one loaded (the bootbin typically) and
- the others will follow toward the inner radius.
- Files that were not loaded in the gaming session will be sorted alphabetically
- as it seems the devs named their stuff logically by level; it should thus be
- good to have likely-named files next ot each others to reduce seek times.
- allfiles.txt was build doing
- mv data/NOTICE.TXT .
- cd data/
- find . > ../allfiles.txt
- cd ..
- sed -i -e "1d" allfiles.txt
- sed -i 's/\.\//\//g' allfiles.txt
- mv NOTICE.TXT data/
- Files NOTICE.TXT and 0.0 will be added and put last ones.
- NOTICE.TXT is used as a legal warning & sorting would be useless without 0.0 !
- For the Dreamcast Beta build of Toe Jam & Earl III
- FamilyGuy 2013
- """
- a=loadtxt('session.LOG',usecols=[-1],dtype=str).T
- b=''
- c=[]
- j=1
- for i in range(len(a)):
- if b.find(a[i])==-1:
- b=b+a[i]+' '+str(j)+'\n'
- c.append(a[i].replace('\\','/'))
- j=j+1
- b=b.replace('\\','/')
- d=loadtxt('allfiles.txt',dtype=str).T
- d=sorted(d)
- for i in range(len(d)):
- if d[i] not in c:
- b=b+d[i]+' '+str(j)+'\n'
- c.append(d[i].replace('\\','/'))
- j=j+1
- for i in ['/0.0','/NOTICE.TXT']:
- b=b+i+' '+str(j)+'\n'
- c.append(i)
- j=j+1
- e=''
- for i in range(len(c)):
- e=e+'data'+c[i]+' '+str(i+1)+'\n' # Dirty but I forgot the 'data' prefix...
- f=open('sorttxt.txt','wb')
- f.write(e)
- f.close()
Advertisement
Add Comment
Please, Sign In to add comment