cleanup a little

This commit is contained in:
CrazyRedMachine 2024-06-18 00:35:43 +02:00
parent adadae9067
commit ceb015ce8a

View File

@ -239,11 +239,8 @@ for (WORD SectionIndex = 0; SectionIndex < headers->FileHeader.NumberOfSections;
LOG("Disassemble .text section... ");
x86_init(opt_none, NULL, NULL);
unsigned int num_insn = x86_disasm_range( (unsigned char *)text, (uint32_t) buf, 0, text_size, &add_xref, NULL);
LOG("done (%u instructions)\n", num_insn);
x86_cleanup();
/* instruction table is done */
x86_cleanup();
LOG("done (%u instructions)\n", num_insn);
LOG("<?xml version='1.0' encoding='shift-jis'?>\n");
LOG("<patches target=\"20xxxxxx00\">\n");
@ -277,34 +274,6 @@ g_tables[STYLE_IDX].limit = get_table_size_by_xref(data, data_size, g_tables[STY
g_tables[FLAVOR_IDX].limit = get_table_size_by_xref(data, data_size, g_tables[FLAVOR_IDX].addr, g_tables[FLAVOR_IDX].size);
g_tables[CHARA_IDX].limit = get_table_size_by_xref(data, data_size, g_tables[CHARA_IDX].addr, g_tables[CHARA_IDX].size);
/*
# Modify the entry sizes as required
buffer_addrs = [
# entry type, table address, entry size
[MUSIC_IDX, music_table_addr, 0xac],
[CHART_IDX, chart_table_addr, 0x20], # Probably won't change?
[STYLE_IDX, style_table_addr, 0x10], # Unlikely to change
[FLAVOR_IDX, flavor_table_addr, 0x60],
[CHARA_IDX, chara_table_addr, 0x4C],
]
limit_info_list = [
# buffer_addr + (buffer_entry_size * limit) should give you the very end of the array (after the last entry)
[MUSIC_IDX, get_table_size_by_xref(*buffer_addrs[MUSIC_IDX][1:])],
[CHART_IDX, get_table_size_by_xref(*buffer_addrs[CHART_IDX][1:])],
[STYLE_IDX, get_table_size_by_xref(*buffer_addrs[STYLE_IDX][1:])],
[FLAVOR_IDX, get_table_size_by_xref(*buffer_addrs[FLAVOR_IDX][1:])],
[CHARA_IDX, get_table_size_by_xref(*buffer_addrs[CHARA_IDX][1:])],
]
for limit_info in limit_info_list:
patch_target, limit_value = limit_info
if TARGETS[patch_target] == "music":
music_limit = limit_value
LOG("\t\t<%s __type=\"u32\">%d</%s>\n", TARGETS[patch_target], limit_value, TARGETS[patch_target]);
LOG("\t</limits>\n");
*/
LOG("\t<limits>\n");
for (int i=0; i < NUM_IDX; i++)
{