dolphin/docs/DSP/prefix_replace.py
Soren Jorvang 664cea45c7 Meta:
Using Unix tools to operate on a tree containing filename with spaces in them
is really annoying, so rename the handful of instances where there were spaces.

Host.cpp has never been used.

Games tend to lookup the following directories that we don't yet have anything
to put in, so prepopulate them in Data/User/Wii:

title/00010001
title/00010002
title/00010003
title/00010004
title/00010005
title/00010006
title/00010007
meta
shared2/title
 
Set eol-style native on a number of text files which didn't already have it.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5572 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-06-02 18:00:22 +00:00

45 lines
1 KiB
Python

# this can be used to upgrade disassemblies that aren't too annotated.
# won't do very well on the current zelda disasm.
import os
import sys
def GetPrefixLine(l, a):
for s in a:
if s[0:len(l)] == l:
return s
return ""
def GetComment(l):
comment_start = l.find("//")
if comment_start < 0:
comment_start = l.find("->")
if comment_start < 0:
return ""
while (l[comment_start-1] == ' ') or (l[comment_start-1] == '\t'):
comment_start -= 1
return l[comment_start:]
def main():
old_lines = open("DSP_UC_Zelda.txt", "r").readlines()
# for l in old_lines:
# print l
new_lines = open("zeldanew.txt", "r").readlines()
for i in range(0, len(old_lines)):
prefix = old_lines[i][0:14]
comment = GetComment(old_lines[i])
new_line = GetPrefixLine(prefix, new_lines)
if new_line:
old_lines[i] = new_line[:-1] + comment[:-1] + "\n"
for i in range(0, len(old_lines)):
print old_lines[i],
new_file = open("output.txt", "w")
new_file.writelines(old_lines)
main()