Example #1
0
    f = open(InitFile, 'w')
    locale_code = ''
    for locale in ET.parse(LocaleFilePath).getroot():
        locale_code += ('DEFINE_LOCALE(%s, %u, "%s")\n' %
                        (locale.get('id').upper().replace(
                            '-', '_'), int(locale.get('LCID')), locale.text))
    f.write(locale_code)
    f.close()

    # Output String Id
    print('Saving locale string id...')
    f = open(StringIdFile, 'w')
    f.write('namespace STR {\n')
    i = 0
    for sid in StringIdSet:
        f.write(('\tconst uint32_t %s = 0x%08X;\n' % (sid, i)))
        i = i + 1
    f.write('}\n')
    f.close()


#    if DEBUG:
#        DecryptorsGenerate()

if __name__ == '__main__':
    if (not DEBUG and not checkmod.check(StringFilePath)
            and not checkmod.check(LocaleFilePath)):
        print('GenerateString: No change, skip.')
    else:
        Main()
Example #2
0
    XMLPath = '../Package.xml'
    EmbedFile = 'Embed.inc'
    CodeFile = 'Files.inc'


def Init():
    # XML Data
    root = ET.parse(XMLPath).getroot()
    f = open(EmbedFile, 'w')
    fc = open(CodeFile, 'w')
    i = 0
    for file in root:
        i = i + 1
        name = file.get('name')
        path = file.text
        f.write('%d\tRCDATA\t"%s"\n' % (i, path))
        fc.write('{L"%s", %d},\n' % (name, i))
    fc.close()
    f.close()


def Main():
    Init()


if __name__ == '__main__':
    if (not checkmod.check(XMLPath) and not DEBUG):
        print('PackFiles: No change on xml, skip.')
    else:
        Main()
Example #3
0
    i = 0
    for sid in StringIdSet:
        i = i + 1
        f.write(StringIdFormat % (sid, i))
    f.close()


def SaveString():
    f = open(CodePath, 'w', -1, 'utf-16')
    for lang in LanguageSet:
        i = 0
        for sid in StringIdSet:
            i = i + 1
            f.write(StringFormat %
                    (int(Locales[lang]), i,
                     (StringData[lang][sid]).replace('\"', '\\"')))
    f.close()


def Main():
    Init()
    SaveId()
    SaveString()


if __name__ == '__main__':
    if (not checkmod.check(StringFilePath)):
        print('GenerateResString: No change on xml, skip.')
    else:
        Main()
Example #4
0
    f.writelines('\n'.join(Lines))
    f.close()
    
    #Parse
    for ver in Lines[0].split('|'):
        if ver:
            Versions.append(ver)
            Data[ver] = []
            
    for i in range(1, len(Lines)):
        line_elements = Lines[i].split('|')
        for ioffset in range(1, len(line_elements) - 1):
            offset = line_elements[ioffset]
            Data[Versions[ioffset-1]].append(offset)

    for ver in Data:
        f = open(OutputPath % ver, 'wb')
        out = array.array('L')
        for offset in Data[ver]:
            out.append(int(offset, 16))
        f.write(out)
        f.close()

    os.system('cscript //NoLogo "Build Tools/GenerateOffsets.js"')

if __name__ == '__main__':
    if checkmod.check(DefFilePath):
        Main()
    else:
        print("Offset not changed, skip.")