예제 #1
0
def scan_rom_for_tx_fars(printer=True):
    """find TX_FARs
    search only addresses that are INCBINed
    keep only TX_FARs that are valid
    
    returns a list of [TX_FAR target address, TX_FAR address]"""
    rom = extract_maps.rom

    analyze_incbins.load_asm()
    analyze_incbins.isolate_incbins()
    analyze_incbins.process_incbins()

    possible_tx_fars = []
    possible_tx_far_targets = []

    for incbin_line_number in analyze_incbins.processed_incbins.keys():
        incbin = analyze_incbins.processed_incbins[incbin_line_number]
        start_address = incbin["start"]
        end_address = incbin["end"]
        if incbin["interval"] == 0: continue  #skip this one

        subrom = rom[start_address:end_address]
        for address in range(start_address, end_address):
            current_byte = ord(rom[address])
            if current_byte == 0x17:
                if ord(rom[address + 4]) == 0x50:
                    byte1 = ord(rom[address + 1])
                    byte2 = ord(rom[address + 2])
                    address2 = byte1 + (byte2 << 8)
                    if address2 > 0x3fff:
                        address2 = extract_maps.calculate_pointer(
                            address2, ord(rom[address + 3]))
                    #print "possible TX_FAR at " + hex(address) + " to " + hex(address2)

                    possible_tx_fars.append(address)
                    possible_tx_far_targets.append([address2, address])

    if printer:
        pre_handled = []
        #address_bundle is [TX_FAR target address, TX_FAR address]
        for address_bundle in possible_tx_far_targets:
            if address_bundle[0] in [0xa82f8, 0xa8315]:
                continue  #bad
            if address_bundle[0] in pre_handled:
                continue  #already did this

            print "-------"
            print "TX_FAR is at: " + hex(address_bundle[1])

            #let's try printing out the TX_FAR?
            text_pretty_printer_at(address_bundle[1], "blah")

            text_pretty_printer_at(address_bundle[0], "_blah")
            print "-------"
            pre_handled.append(address_bundle[0])
    return possible_tx_far_targets
def scan_rom_for_tx_fars(printer=True):
    """find TX_FARs
    search only addresses that are INCBINed
    keep only TX_FARs that are valid
    
    returns a list of [TX_FAR target address, TX_FAR address]"""
    rom = extract_maps.rom

    analyze_incbins.load_asm()
    analyze_incbins.isolate_incbins()
    analyze_incbins.process_incbins()

    possible_tx_fars = []
    possible_tx_far_targets = []
    
    for incbin_line_number in analyze_incbins.processed_incbins.keys():
        incbin = analyze_incbins.processed_incbins[incbin_line_number]
        start_address = incbin["start"]
        end_address = incbin["end"]
        if incbin["interval"] == 0: continue #skip this one

        subrom = rom[start_address:end_address]
        for address in range(start_address, end_address):
            current_byte = ord(rom[address])
            if current_byte == 0x17:
                if ord(rom[address+4]) == 0x50:
                    byte1 = ord(rom[address+1])
                    byte2 = ord(rom[address+2])
                    address2 = byte1 + (byte2 << 8)
                    if address2 > 0x3fff:
                        address2 = extract_maps.calculate_pointer(address2, ord(rom[address+3]))
                    #print "possible TX_FAR at " + hex(address) + " to " + hex(address2)

                    possible_tx_fars.append(address)
                    possible_tx_far_targets.append([address2, address])

    if printer:
        pre_handled = []
        #address_bundle is [TX_FAR target address, TX_FAR address]
        for address_bundle in possible_tx_far_targets:
            if address_bundle[0] in [0xa82f8, 0xa8315]:
                continue #bad
            if address_bundle[0] in pre_handled:
                continue #already did this
    
            print "-------"
            print "TX_FAR is at: " + hex(address_bundle[1])
            
            #let's try printing out the TX_FAR?
            text_pretty_printer_at(address_bundle[1], "blah")

            text_pretty_printer_at(address_bundle[0], "_blah")
            print "-------"
            pre_handled.append(address_bundle[0])
    return possible_tx_far_targets
def insert_all_objects():
    for map_id in extract_maps.map_headers.keys():
        if map_id not in extract_maps.bad_maps:
            insert_object(map_id)

            analyze_incbins.asm = None
            analyze_incbins.incbin_lines = []
            analyze_incbins.processed_incbins = {}
            load_asm()
            isolate_incbins()
            process_incbins()
def insert_all_objects():
    for map_id in extract_maps.map_headers.keys():
        if map_id not in extract_maps.bad_maps:
            insert_object(map_id)

            analyze_incbins.asm = None
            analyze_incbins.incbin_lines = []
            analyze_incbins.processed_incbins = {}
            load_asm()
            isolate_incbins()
            process_incbins()
예제 #5
0
def local_reset_incbins():
    asm = None
    incbin_lines = []
    processed_incbins = {}
    analyze_incbins.asm = None
    analyze_incbins.incbin_lines = []
    analyze_incbins.processed_incbins = {}

    #reload
    load_asm()
    isolate_incbins()
    process_incbins()
def local_reset_incbins():
    asm = None
    incbin_lines = []
    processed_incbins = {}
    analyze_incbins.asm = None
    analyze_incbins.incbin_lines = []
    analyze_incbins.processed_incbins = {}
    
    #reload
    load_asm()
    isolate_incbins()
    process_incbins()
def insert_all_labels():
    "this is very buggy, don't use it"
    # limit = 200 #0:150
    for map in extract_maps.map_headers.keys():
        mapmap = extract_maps.map_headers[map]
        if mapmap["name"] == "FREEZE":
            continue  # skip this one
        if "Ash's" in mapmap["name"]:
            continue
        if "Gary's" in mapmap["name"]:
            continue
        if not ("cat" in mapmap["name"]) and "copy" in mapmap["name"].lower():
            continue  # skip this one

        # bill's house breaks things?
        # if mapmap["name"] == "Bill's House": continue
        if mapmap["name"] == "Viridian Forest":
            continue
        # if mapmap["name"] == "Cerulean Mart": continue
        if mapmap["name"] == "Virdian Forest Exit":
            continue
        # if "copy" in mapmap["name"].lower(): continue #skip this one too..

        if mapmap["map_pointer"] in used_map_pointers:
            continue  # skip for sure

        # reset asm
        analyze_incbins.asm = None
        analyze_incbins.incbin_lines = []
        analyze_incbins.processed_incbins = {}

        # reload asm each time
        load_asm()

        # check if this label is already in there
        cleaned_name, label_text, filename, full_filepath = make_labels(mapmap["name"])
        if label_text in "\n".join(line for line in analyze_incbins.asm):
            print "skipping (found label text in asm already)"
            used_map_pointers.append(mapmap["map_pointer"])
            continue  # skip this one

        isolate_incbins()
        process_incbins()

        print "XYZ|" + mapmap["name"]
        insert_map_block_label(map)

        used_map_pointers.append(mapmap["map_pointer"])
예제 #8
0
def insert_all_texts_labels():
    for map_id in extract_maps.map_headers.keys():
        if map_id not in extract_maps.bad_maps:
            if len(extract_maps.map_headers[map_id]["referenced_texts"]) > 0:
                insert_texts_label(map_id)

                reset_incbins()
                analyze_incbins.reset_incbins()
                asm = None
                incbin_lines = []
                processed_incbins = {}
                analyze_incbins.asm = None
                analyze_incbins.incbin_lines = []
                analyze_incbins.processed_incbins = {}

                load_asm()
                isolate_incbins()
                process_incbins()
def insert_all_texts_labels():
    for map_id in extract_maps.map_headers.keys():
        if map_id not in extract_maps.bad_maps:
            if len(extract_maps.map_headers[map_id]["referenced_texts"]) > 0:
                insert_texts_label(map_id)
        
                reset_incbins()
                analyze_incbins.reset_incbins()
                asm = None
                incbin_lines = []
                processed_incbins = {}
                analyze_incbins.asm = None
                analyze_incbins.incbin_lines = []
                analyze_incbins.processed_incbins = {}
        
                load_asm()
                isolate_incbins()
                process_incbins()
예제 #10
0
def insert_all_base_stats():
    for id in range(0, 151):
        #if id < 62: continue #skip
        insert_base_stats(id)

        #reset everything
        reset_incbins()
        analyze_incbins.reset_incbins()
        asm = None
        incbin_lines = []
        processed_incbins = {}
        analyze_incbins.asm = None
        analyze_incbins.incbin_lines = []
        analyze_incbins.processed_incbins = {}

        #reload
        load_asm()
        isolate_incbins()
        process_incbins()
def insert_all_base_stats():
    for id in range(0, 151):
        #if id < 62: continue #skip
        insert_base_stats(id)
        
        #reset everything
        reset_incbins()
        analyze_incbins.reset_incbins()
        asm = None
        incbin_lines = []
        processed_incbins = {}
        analyze_incbins.asm = None
        analyze_incbins.incbin_lines = []
        analyze_incbins.processed_incbins = {}

        #reload
        load_asm()
        isolate_incbins()
        process_incbins()
예제 #12
0
def insert_all_text_labels():
    for map_id in extract_maps.map_headers.keys():
        if map_id <= 100: continue #skip
        if map_id not in extract_maps.bad_maps:
            for text_id in extract_maps.map_headers[map_id]["referenced_texts"]:
                insert_text_label_tx_far(map_id, text_id)
        
                reset_incbins()
                analyze_incbins.reset_incbins()
                asm = None
                incbin_lines = []
                processed_incbins = {}
                analyze_incbins.asm = None
                analyze_incbins.incbin_lines = []
                analyze_incbins.processed_incbins = {}
        
                load_asm()
                isolate_incbins()
                process_incbins()
예제 #13
0
def insert_all_labels():
    "this is very buggy, don't use it"
    #limit = 200 #0:150
    for map in extract_maps.map_headers.keys():
        mapmap = extract_maps.map_headers[map]
        if mapmap["name"] == "FREEZE": continue  #skip this one
        if "Ash's" in mapmap["name"]: continue
        if "Gary's" in mapmap["name"]: continue
        if not ("cat" in mapmap["name"]) and "copy" in mapmap["name"].lower():
            continue  #skip this one

        #bill's house breaks things?
        #if mapmap["name"] == "Bill's House": continue
        if mapmap["name"] == "Viridian Forest": continue
        #if mapmap["name"] == "Cerulean Mart": continue
        if mapmap["name"] == "Virdian Forest Exit": continue
        #if "copy" in mapmap["name"].lower(): continue #skip this one too..

        if mapmap["map_pointer"] in used_map_pointers: continue  #skip for sure

        #reset asm
        analyze_incbins.asm = None
        analyze_incbins.incbin_lines = []
        analyze_incbins.processed_incbins = {}

        #reload asm each time
        load_asm()

        #check if this label is already in there
        cleaned_name, label_text, filename, full_filepath = make_labels(
            mapmap["name"])
        if label_text in "\n".join(line for line in analyze_incbins.asm):
            print "skipping (found label text in asm already)"
            used_map_pointers.append(mapmap["map_pointer"])
            continue  #skip this one

        isolate_incbins()
        process_incbins()

        print "XYZ|" + mapmap["name"]
        insert_map_block_label(map)

        used_map_pointers.append(mapmap["map_pointer"])
예제 #14
0
def insert_all_tx_far_targets():
    for tx_far in tx_fars:
        map_id = tx_far[0]
        text_id = tx_far[1]
        #if map_id <= 185: continue #i'm just trying to get it going faster

        insert_tx_far(map_id, text_id, tx_far_line=tx_far)

        reset_incbins()
        analyze_incbins.reset_incbins()
        asm = None
        incbin_lines = []
        processed_incbins = {}
        analyze_incbins.asm = None
        analyze_incbins.incbin_lines = []
        analyze_incbins.processed_incbins = {}

        load_asm()
        isolate_incbins()
        process_incbins()
def insert_all_tx_far_targets():
    for tx_far in tx_fars:
        map_id = tx_far[0]
        text_id = tx_far[1]
        #if map_id <= 185: continue #i'm just trying to get it going faster

        insert_tx_far(map_id, text_id, tx_far_line=tx_far)

        reset_incbins()
        analyze_incbins.reset_incbins()
        asm = None
        incbin_lines = []
        processed_incbins = {}
        analyze_incbins.asm = None
        analyze_incbins.incbin_lines = []
        analyze_incbins.processed_incbins = {}

        load_asm()
        isolate_incbins()
        process_incbins()
예제 #16
0
def insert_all_08s():
    all_08s = find_all_08s()
    for the_08_line in all_08s:
        map_id = the_08_line[0]
        if map_id <= 86: continue  #speed things up
        text_id = the_08_line[1]
        line_id = the_08_line[2]

        print "processing map_id=" + str(map_id) + " text_id=" + str(text_id)
        insert_08_asm(map_id, text_id, line_id)

        #reset everything
        analyze_incbins.reset_incbins()
        asm = None
        incbin_lines = []
        processed_incbins = {}
        analyze_incbins.asm = None
        analyze_incbins.incbin_lines = []
        analyze_incbins.processed_incbins = {}

        #reload
        load_asm()
        isolate_incbins()
        process_incbins()
def insert_all_08s():
    all_08s = find_all_08s()
    for the_08_line in all_08s:
        map_id = the_08_line[0]
        if map_id <= 86: continue #speed things up
        text_id = the_08_line[1]
        line_id = the_08_line[2]

        print "processing map_id=" + str(map_id) + " text_id=" + str(text_id)
        insert_08_asm(map_id, text_id, line_id)
        
        #reset everything
        analyze_incbins.reset_incbins()
        asm = None
        incbin_lines = []
        processed_incbins = {}
        analyze_incbins.asm = None
        analyze_incbins.incbin_lines = []
        analyze_incbins.processed_incbins = {}

        #reload
        load_asm()
        isolate_incbins()
        process_incbins()
예제 #18
0
def scan_for_map_scripts_pointer():
    for map_id in extract_maps.map_headers.keys(
    ):  #skip id=0 (Pallet Town) because the naming conventions are wonky
        map2 = extract_maps.map_headers[map_id]
        if map_id in extract_maps.bad_maps or map_id in [0, 39, 37, 38]:
            continue  #skip
        script_pointer = int(map2["script_pointer"], 16)

        main_asm_output, offset, last_hl_address, last_a_address, used_3d97 = output_bank_opcodes(
            script_pointer)
        hl_pointer = "None"

        first_script_text = ""
        if last_hl_address != None and last_hl_address != "None" and used_3d97 == True:
            if last_hl_address > 0x3fff:
                hl_pointer = extract_maps.calculate_pointer(
                    last_hl_address, int(map2["bank"], 16))
            else:
                hl_pointer = last_hl_address
            byte1 = ord(extract_maps.rom[hl_pointer])
            byte2 = ord(extract_maps.rom[hl_pointer + 1])
            address = byte1 + (byte2 << 8)

            if address > 0x3fff:
                first_script_pointer = extract_maps.calculate_pointer(
                    address, int(map2["bank"], 16))
            else:
                first_script_pointer = address

            #for later output
            first_script_text = " first_script=" + hex(first_script_pointer)

            #go ahead and insert this script pointer
            insert_asm(first_script_pointer,
                       map_name_cleaner(map2["name"], None)[:-2] + "Script0")

            #reset everything
            #analyze_incbins.reset_incbins()
            asm = None
            incbin_lines = []
            processed_incbins = {}
            analyze_incbins.asm = None
            analyze_incbins.incbin_lines = []
            analyze_incbins.processed_incbins = {}

            #reload
            load_asm()
            isolate_incbins()
            process_incbins()

            a_numbers = [0]
            last_a_id = 0
            script_pointers = [hex(first_script_pointer)]
            latest_script_pointer = first_script_pointer
            while last_a_id == (max(a_numbers)) or last_a_id == 0:
                asm_output, offset, last_hl_address2, last_a_id, byte1, byte2, address = None, None, None, None, None, None, None
                asm_output, offset, last_hl_address2, last_a_id, used_3d97_2 = output_bank_opcodes(
                    latest_script_pointer)

                if last_a_id == (max(a_numbers) + 1):
                    a_numbers.append(last_a_id)
                else:
                    break

                byte1 = ord(extract_maps.rom[hl_pointer + (2 * last_a_id)])
                byte2 = ord(extract_maps.rom[hl_pointer + (2 * last_a_id) + 1])
                address2 = byte1 + (byte2 << 8)
                if address2 > 0x3fff:
                    latest_script_pointer = extract_maps.calculate_pointer(
                        address2, int(map2["bank"], 16))
                else:
                    latest_script_pointer = address2

                script_pointers.append(hex(latest_script_pointer))
                #print "latest script pointer (part 1): " + hex(address2)
                #print "latest script pointer: " + hex(latest_script_pointer)

                #go ahead and insert the asm for this script
                result = insert_asm(
                    latest_script_pointer,
                    map_name_cleaner(map2["name"], None)[:-2] + "Script" +
                    str(len(script_pointers) - 1))

                if result:
                    #reset everything
                    #analyze_incbins.reset_incbins()
                    asm = None
                    incbin_lines = []
                    processed_incbins = {}
                    analyze_incbins.asm = None
                    analyze_incbins.incbin_lines = []
                    analyze_incbins.processed_incbins = {}

                    #reload
                    load_asm()
                    isolate_incbins()
                    process_incbins()

            print "map_id=" + str(map_id) + " scripts are: " + str(
                script_pointers)

        if last_hl_address == None: last_hl_address = "None"
        else: last_hl_address = hex(last_hl_address)

        if hl_pointer != None and hl_pointer != "None":
            hl_pointer = hex(hl_pointer)

        print "map_id=" + str(
            map_id) + " " + map2["name"] + " script_pointer=" + hex(
                script_pointer
            ) + " script_pointers=" + hl_pointer + first_script_text
        print main_asm_output
        print "\n\n"

        #insert asm for the main script
        result = insert_asm(
            script_pointer,
            map_name_cleaner(map2["name"], None)[:-2] + "Script")

        if result:
            #reset everything
            #analyze_incbins.reset_incbins()
            asm = None
            incbin_lines = []
            processed_incbins = {}
            analyze_incbins.asm = None
            analyze_incbins.incbin_lines = []
            analyze_incbins.processed_incbins = {}

            #reload
            load_asm()
            isolate_incbins()
            process_incbins()

        #insert script pointer list asm if there's anything of value
        if hl_pointer != None and hl_pointer != "None" and used_3d97 == True:
            start_address = int(hl_pointer, 16)  #where to insert this list
            total_size = len(a_numbers) * 2

            script_label = map_name_cleaner(map2["name"], None)[:-2] + "Script"
            scripts_label = script_label + "s"
            script_asm = scripts_label + ": ; " + hex(start_address) + "\n"
            script_asm += spacing + "dw"

            first = True
            for id in a_numbers:
                if first:
                    script_asm += " "
                    first = False
                else:
                    script_asm += ", "
                script_asm += script_label + str(id)
            script_asm += "\n"  #extra newline?

            result = insert_asm(start_address,
                                scripts_label,
                                text_asm=script_asm,
                                end_address=start_address + total_size)
            if result:
                #reset everything
                #analyze_incbins.reset_incbins()
                asm = None
                incbin_lines = []
                processed_incbins = {}
                analyze_incbins.asm = None
                analyze_incbins.incbin_lines = []
                analyze_incbins.processed_incbins = {}

                #reload
                load_asm()
                isolate_incbins()
                process_incbins()
            else:
                print "trouble inserting map script pointer list"
                print script_asm
                sys.exit(0)
def scan_for_map_scripts_pointer():
    for map_id in extract_maps.map_headers.keys(): #skip id=0 (Pallet Town) because the naming conventions are wonky
        map2 = extract_maps.map_headers[map_id]
        if map_id in extract_maps.bad_maps or map_id in [0, 39, 37, 38]: continue #skip
        script_pointer = int(map2["script_pointer"], 16)

        main_asm_output, offset, last_hl_address, last_a_address, used_3d97 = output_bank_opcodes(script_pointer)
        hl_pointer = "None"
        
        first_script_text = ""
        if last_hl_address != None and last_hl_address != "None" and used_3d97==True:
            if last_hl_address > 0x3fff:
                hl_pointer = extract_maps.calculate_pointer(last_hl_address, int(map2["bank"], 16))
            else:
                hl_pointer = last_hl_address
            byte1 = ord(extract_maps.rom[hl_pointer])
            byte2 = ord(extract_maps.rom[hl_pointer+1])
            address = byte1 + (byte2 << 8)

            if address > 0x3fff:
                first_script_pointer = extract_maps.calculate_pointer(address, int(map2["bank"], 16))
            else:
                first_script_pointer = address

            #for later output
            first_script_text = " first_script=" + hex(first_script_pointer)

            #go ahead and insert this script pointer
            insert_asm(first_script_pointer, map_name_cleaner(map2["name"], None)[:-2] + "Script0")
            
            #reset everything
            #analyze_incbins.reset_incbins()
            asm = None
            incbin_lines = []
            processed_incbins = {}
            analyze_incbins.asm = None
            analyze_incbins.incbin_lines = []
            analyze_incbins.processed_incbins = {}
    
            #reload
            load_asm()
            isolate_incbins()
            process_incbins()

            a_numbers = [0]
            last_a_id = 0
            script_pointers = [hex(first_script_pointer)]
            latest_script_pointer = first_script_pointer
            while last_a_id == (max(a_numbers)) or last_a_id==0:
                asm_output, offset, last_hl_address2, last_a_id, byte1, byte2, address = None, None, None, None, None, None, None
                asm_output, offset, last_hl_address2, last_a_id, used_3d97_2 = output_bank_opcodes(latest_script_pointer)
                
                if last_a_id == (max(a_numbers) + 1):
                    a_numbers.append(last_a_id)
                else:
                    break
                
                byte1 = ord(extract_maps.rom[hl_pointer + (2*last_a_id)])
                byte2 = ord(extract_maps.rom[hl_pointer + (2*last_a_id) + 1])
                address2 = byte1 + (byte2 << 8)
                if address2 > 0x3fff:
                    latest_script_pointer = extract_maps.calculate_pointer(address2, int(map2["bank"], 16))
                else:
                    latest_script_pointer = address2

                script_pointers.append(hex(latest_script_pointer))
                #print "latest script pointer (part 1): " + hex(address2)
                #print "latest script pointer: " + hex(latest_script_pointer)

                #go ahead and insert the asm for this script
                result = insert_asm(latest_script_pointer, map_name_cleaner(map2["name"], None)[:-2] + "Script" + str(len(script_pointers) - 1))
                
                if result:
                    #reset everything
                    #analyze_incbins.reset_incbins()
                    asm = None
                    incbin_lines = []
                    processed_incbins = {}
                    analyze_incbins.asm = None
                    analyze_incbins.incbin_lines = []
                    analyze_incbins.processed_incbins = {}
            
                    #reload
                    load_asm()
                    isolate_incbins()
                    process_incbins()

            print "map_id=" + str(map_id) + " scripts are: " + str(script_pointers)
        
        if last_hl_address == None: last_hl_address = "None"
        else: last_hl_address = hex(last_hl_address)

        if hl_pointer != None and hl_pointer != "None": hl_pointer = hex(hl_pointer)

        print "map_id=" + str(map_id) + " " + map2["name"] + " script_pointer=" + hex(script_pointer) + " script_pointers=" + hl_pointer + first_script_text
        print main_asm_output
        print "\n\n"

        #insert asm for the main script
        result = insert_asm(script_pointer, map_name_cleaner(map2["name"], None)[:-2] + "Script")
        
        if result:
            #reset everything
            #analyze_incbins.reset_incbins()
            asm = None
            incbin_lines = []
            processed_incbins = {}
            analyze_incbins.asm = None
            analyze_incbins.incbin_lines = []
            analyze_incbins.processed_incbins = {}
    
            #reload
            load_asm()
            isolate_incbins()
            process_incbins()

        #insert script pointer list asm if there's anything of value
        if hl_pointer != None and hl_pointer != "None" and used_3d97==True:
            start_address = int(hl_pointer, 16) #where to insert this list
            total_size = len(a_numbers) * 2
            
            script_label = map_name_cleaner(map2["name"], None)[:-2] + "Script"
            scripts_label = script_label  + "s"
            script_asm = scripts_label + ": ; " + hex(start_address) + "\n"
            script_asm += spacing + "dw"

            first = True
            for id in a_numbers:
                if first:
                    script_asm += " "
                    first = False
                else:
                    script_asm += ", "
                script_asm += script_label + str(id)
            script_asm += "\n" #extra newline?

            result = insert_asm(start_address, scripts_label, text_asm=script_asm, end_address=start_address + total_size)
            if result:
                #reset everything
                #analyze_incbins.reset_incbins()
                asm = None
                incbin_lines = []
                processed_incbins = {}
                analyze_incbins.asm = None
                analyze_incbins.incbin_lines = []
                analyze_incbins.processed_incbins = {}
        
                #reload
                load_asm()
                isolate_incbins()
                process_incbins()
            else:
                print "trouble inserting map script pointer list"
                print script_asm
                sys.exit(0)
예제 #20
0
        #reload
        load_asm()
        isolate_incbins()
        process_incbins()


if __name__ == "__main__":
    #load map headers and object data
    extract_maps.load_rom()
    extract_maps.load_map_pointers()
    extract_maps.read_all_map_headers()
    load_labels()
    #print base_data_pretty_printer(0)
    load_asm()
    isolate_incbins()
    process_incbins()
    #insert_base_stats(1)
    insert_all_base_stats()

    #load texts (these two have different formats)
    #all_texts = pretty_map_headers.analyze_texts.analyze_texts()
    #pretty_map_headers.all_texts = all_texts
    #tx_fars = pretty_map_headers.find_all_tx_fars()

    #load incbins
    #reset_incbins()

    #scan_for_map_scripts_pointer()
    #scan_rom_for_tx_fars_and_insert()
    #insert_text(0xa586b, "_VermilionCityText14")
예제 #21
0
#date: 2012-01-10
#show me an image
import Image
from math import floor
import extract_maps
import analyze_incbins

print "loading rom.."
extract_maps.load_rom()
#extract_maps.load_map_pointers()
#extract_maps.read_all_map_headers()

print "analyzing incbins.."
analyze_incbins.load_asm()
analyze_incbins.isolate_incbins()
analyze_incbins.process_incbins()

width = 1024
height = 1024

im = Image.new("P", (width, height), 0)

im.putpalette([
    0,
    0,
    0,
    126,
    30,
    156,
])
#date: 2012-01-10
#show me an image
import Image
from math import floor
import extract_maps
import analyze_incbins

print "loading rom.."
extract_maps.load_rom()
#extract_maps.load_map_pointers()
#extract_maps.read_all_map_headers()

print "analyzing incbins.."
analyze_incbins.load_asm()
analyze_incbins.isolate_incbins()
analyze_incbins.process_incbins()

width = 1024
height = 1024

im = Image.new("P", (width, height), 0)

im.putpalette([
    0, 0, 0,
    126, 30, 156,
])

print "drawing incbins..."
for incbin_key in analyze_incbins.processed_incbins:
    incbin = analyze_incbins.processed_incbins[incbin_key]
    start = incbin["start"]
    #confirm it's working
    subprocess.check_call("cd ../; make clean; LC_CTYPE=UTF-8 make", shell=True)

def insert_all_objects():
    for map_id in extract_maps.map_headers.keys():
        if map_id not in extract_maps.bad_maps:
            insert_object(map_id)

            analyze_incbins.asm = None
            analyze_incbins.incbin_lines = []
            analyze_incbins.processed_incbins = {}
            load_asm()
            isolate_incbins()
            process_incbins()

if __name__ == "__main__":
    #load map headers and object data
    extract_maps.load_rom()
    extract_maps.load_map_pointers()
    extract_maps.read_all_map_headers()

    #load incbins
    load_asm()
    isolate_incbins()
    process_incbins()

    #insert_object(1)
    insert_all_objects()