2007-02-05, 03:01
Im currently writing a script that reads apps/emu directories and tries to match them against the corresponding UDATA directory.
This works but in some instances the XBE Title does not match the Text in TitleMeta.xbx
Here is my Sample code:
Here is my Output:
Heres the problematic ones..
XbeTitle = Dvd 2 Xbox - TitleMeta = dvd2xbox
XbeTitle = Web Browser - TitleMeta = LinksBoks
XbeTitle = UnleashX Dash - TitleMeta = UnleashX Xbox Launcher
Basically What im asking is what links the xbe to the gamesave directory. Is there something in the xbe header that identifies the directory to create. I have looked at alot of xbe header info but cannot find anything that states a link between the two..
Any Help appreciated..
I know that the latest version does support getting the xbetitle in python but for those on 2.0.1 this feature will not be present..
This works but in some instances the XBE Title does not match the Text in TitleMeta.xbx
Here is my Sample code:
Code:
import os,struct,operator,codecs,string
home = os.getcwd()
apps = home +'\\apps'
emus = home +'\\emus'
tdata = home +'\\UDATA'
def GetXbeName(path,XbeTitle,XbePath):
for i in os.listdir(path):
mybase = path+'\\'+ i
if os.path.isdir(mybase):
mydef = mybase +'\\default.xbe'
if os.path.isfile(mydef):
RealName = ''
xbe = open(mydef,'rb')
xbe.seek(0x0184,0)
for dta in struct.unpack(operator.repeat('H',40),xbe.read(0x0050)):
try :
if dta != 00 : RealName += str(unichr(dta))
except : pass
XbeTitle.append(RealName)
XbePath.append(mybase)
xbe.close()
return XbeTitle,XbePath
def GetXbeSave(path):
Title = []
Id = []
for i in os.listdir(path):
mybase = path+'\\'+ i
if os.path.isdir(mybase):
mydef = mybase +'\\TitleMeta.xbx'
if os.path.isfile(mydef):
try :
xbe = codecs.open(mydef,'r','utf-16')
data = xbe.read()
except :
xbe.close()
xbe = open(mydef,'r')
data = xbe.read()
if data[0:10] == 'TitleName=':
Title.append(string.strip(data[10:60],'\n\r'))
Id.append(mybase)
xbe.close()
return Title,Id
XbeTitle,XbePath = GetXbeName(apps,[],[])
XbeTitle,XbePath = GetXbeName(emus,XbeTitle,XbePath)
Title,Id = GetXbeSave(tdata)
FullArray = []
for Item in range(len(XbeTitle)):
try : Result = Title.index(XbeTitle[Item])
except : Result = -1
if Result == -1 : print 'Cannot Find: '+ str(XbeTitle[Item])
else : FullArray.append([XbeTitle[Item],XbePath[Item],Title[Result],os.path.basename(Id[Result])])
for i in FullArray:
print i[0],i[1],i[2],i[3]
Here is my Output:
Code:
Cannot Find: Dvd 2 Xbox
Cannot Find: DVD Player
Cannot Find: Evo-X Dash
Cannot Find: Web Browser
Cannot Find: UnleashX Dash
Cannot Find: z26x
Xbox Media Center E:\XBOX - Stuff\XBOX-E\apps\XBMC Xbox Media Center 0face008
vicex E:\XBOX - Stuff\XBOX-E\emus\Commodore-64 vicex 07162006
MAMEoX Launcher E:\XBOX - Stuff\XBOX-E\emus\MAMEoX MAMEoX Launcher 4d414d45
Surreal 64 E:\XBOX - Stuff\XBOX-E\emus\N64 Surreal 64 a64fea57
mednafenx_nes E:\XBOX - Stuff\XBOX-E\emus\Nintendo mednafenx_nes 03182006
NeoGenesis E:\XBOX - Stuff\XBOX-E\emus\SegaMegaDrive NeoGenesis 02282006
ZsnexBox E:\XBOX - Stuff\XBOX-E\emus\SuperNintendo ZsnexBox 00000000
Heres the problematic ones..
XbeTitle = Dvd 2 Xbox - TitleMeta = dvd2xbox
XbeTitle = Web Browser - TitleMeta = LinksBoks
XbeTitle = UnleashX Dash - TitleMeta = UnleashX Xbox Launcher
Basically What im asking is what links the xbe to the gamesave directory. Is there something in the xbe header that identifies the directory to create. I have looked at alot of xbe header info but cannot find anything that states a link between the two..
Any Help appreciated..
I know that the latest version does support getting the xbetitle in python but for those on 2.0.1 this feature will not be present..