static uint FindSkillPointer(string type) { SkillSystemsTableSt[] table = new SkillSystemsTableSt[] { new SkillSystemsTableSt { name = "ASSIGN", skip = 16, data = new byte[] { 0x01, 0x35, 0x02, 0x36, 0xF1, 0xE7, 0x00, 0x20, 0x28, 0x70, 0x29, 0x1C, 0x02, 0x48, 0x09, 0x1A } }, new SkillSystemsTableSt { name = "LEVELUP", skip = 16 + 8, data = new byte[] { 0x01, 0x35, 0x02, 0x36, 0xF1, 0xE7, 0x00, 0x20, 0x28, 0x70, 0x29, 0x1C, 0x02, 0x48, 0x09, 0x1A } }, new SkillSystemsTableSt { name = "ASSIGN", skip = 16, data = new byte[] { 0x29, 0x1C, 0xFF, 0xF7, 0xFA, 0xFF, 0x01, 0x1C, 0x08, 0x78, 0x00, 0x28, 0xEF, 0xD0, 0x01, 0x31, 0xFA, 0xE7, 0x00, 0x00 } }, new SkillSystemsTableSt { name = "LEVELUP", skip = 0, data = new byte[] { 0x0A, 0xD0, 0x1A, 0x78, 0x00, 0x2A, 0x07, 0xD0, 0x8A, 0x42, 0x01, 0xD0, 0x02, 0x33, 0xF8, 0xE7, 0x5A, 0x78, 0x22, 0x70, 0x01, 0x34, 0xF9, 0xE7, 0x00, 0x20, 0x20, 0x70, 0x31, 0xBC, 0x70, 0x47 } }, new SkillSystemsTableSt { name = "ANIME", skip = 32, data = new byte[] { 0x00, 0x2B, 0x00, 0xD1, 0x06, 0x4B, 0x38, 0x1C, 0x9E, 0x46, 0x00, 0xF8, 0x05, 0x48, 0x00, 0x47 } }, new SkillSystemsTableSt { name = "ICON", skip = 24, data = new byte[] { 0x02, 0x40, 0x09, 0x4C, 0x05, 0x48, 0x00, 0x47, 0x05, 0x48, 0x00, 0x47, 0x05, 0x48, 0x00, 0x47 } }, new SkillSystemsTableSt { name = "ICON", skip = 8, data = new byte[] { 0x08, 0x42, 0x04, 0xD1, 0x12, 0x79, 0xAA, 0x42, 0x01, 0xD1, 0x01, 0x20, 0x03, 0xE0, 0x01, 0x34, 0xBF, 0x2C, 0xEA, 0xDD, 0x00, 0x20, 0x30, 0xBC, 0x02, 0xBC, 0x08, 0x47 } }, new SkillSystemsTableSt { name = "TEXT", skip = 16, data = new byte[] { 0x07, 0x49, 0x40, 0x00, 0x40, 0x18, 0x00, 0x88, 0x00, 0x28, 0x00, 0xD1, 0x06, 0x48, 0x21, 0x1C } }, new SkillSystemsTableSt { name = "LEVELUP", skip = 0, data = new byte[] { 0xE4, 0x58, 0x00, 0x2C, 0x0C, 0xD0, 0x23, 0x78, 0x00, 0x2B, 0x09, 0xD0, 0x8B, 0x42, 0x01, 0xDD, 0x93, 0x42, 0x01, 0xDD, 0x02, 0x34, 0xF6, 0xE7, 0x63, 0x78, 0x33, 0x70, 0x01, 0x36, 0xF9, 0xE7, 0x00, 0x20, 0x30, 0x70, 0x71, 0xBC, 0x70, 0x47 } }, }; foreach (SkillSystemsTableSt t in table) { if (t.name != type) { continue; } //チェック開始アドレス uint start = 0xB00000; uint found = U.Grep(Program.ROM.Data, t.data, start, 0, 4); if (found == U.NOT_FOUND) { continue; } return((uint)(found + t.data.Length + t.skip)); } return(U.NOT_FOUND); }
static uint FindSkillPointer(string type, uint skip) { SkillSystemsTableSt[] table = new SkillSystemsTableSt[] { new SkillSystemsTableSt { name = "ASSIGN", skip = 16, data = new byte[] { 0x01, 0x35, 0x02, 0x36, 0xF1, 0xE7, 0x00, 0x20, 0x28, 0x70, 0x29, 0x1C, 0x02, 0x48, 0x09, 0x1A } }, new SkillSystemsTableSt { name = "LEVELUP", skip = 16 + 8, data = new byte[] { 0x01, 0x35, 0x02, 0x36, 0xF1, 0xE7, 0x00, 0x20, 0x28, 0x70, 0x29, 0x1C, 0x02, 0x48, 0x09, 0x1A } }, new SkillSystemsTableSt { name = "ASSIGN", skip = 16, data = new byte[] { 0x29, 0x1C, 0xFF, 0xF7, 0xFA, 0xFF, 0x01, 0x1C, 0x08, 0x78, 0x00, 0x28, 0xEF, 0xD0, 0x01, 0x31, 0xFA, 0xE7, 0x00, 0x00 } }, new SkillSystemsTableSt { name = "LEVELUP", skip = 0, data = new byte[] { 0x0A, 0xD0, 0x1A, 0x78, 0x00, 0x2A, 0x07, 0xD0, 0x8A, 0x42, 0x01, 0xD0, 0x02, 0x33, 0xF8, 0xE7, 0x5A, 0x78, 0x22, 0x70, 0x01, 0x34, 0xF9, 0xE7, 0x00, 0x20, 0x20, 0x70, 0x31, 0xBC, 0x70, 0x47 } }, new SkillSystemsTableSt { name = "ANIME", skip = 32, data = new byte[] { 0x00, 0x2B, 0x00, 0xD1, 0x06, 0x4B, 0x38, 0x1C, 0x9E, 0x46, 0x00, 0xF8, 0x05, 0x48, 0x00, 0x47 } }, new SkillSystemsTableSt { name = "ICON", skip = 24, data = new byte[] { 0x02, 0x40, 0x09, 0x4C, 0x05, 0x48, 0x00, 0x47, 0x05, 0x48, 0x00, 0x47, 0x05, 0x48, 0x00, 0x47 } }, new SkillSystemsTableSt { name = "ICON", skip = 8, data = new byte[] { 0x08, 0x42, 0x04, 0xD1, 0x12, 0x79, 0xAA, 0x42, 0x01, 0xD1, 0x01, 0x20, 0x03, 0xE0, 0x01, 0x34, 0xBF, 0x2C, 0xEA, 0xDD, 0x00, 0x20, 0x30, 0xBC, 0x02, 0xBC, 0x08, 0x47 } }, new SkillSystemsTableSt { name = "ICON", skip = 0, data = new byte[] { 0x38, 0x00, 0x00, 0xF0, 0xFB, 0xF9, 0x80, 0x22, 0x0E, 0x49, 0x16, 0x48, 0x16, 0x4B, 0x00, 0xF0, 0xF5, 0xF9, 0x2B, 0x34, 0x29, 0x00, 0x38, 0x00, 0x14, 0x4B, 0x00, 0xF0, 0xEF, 0xF9, 0x26, 0x70, 0xF8, 0xBC, 0x01, 0xBC, 0x00, 0x47, 0x01, 0x33, 0xCD, 0xE7, 0xC0, 0x46 } }, new SkillSystemsTableSt { name = "TEXT", skip = 16, data = new byte[] { 0x07, 0x49, 0x40, 0x00, 0x40, 0x18, 0x00, 0x88, 0x00, 0x28, 0x00, 0xD1, 0x06, 0x48, 0x21, 0x1C } }, new SkillSystemsTableSt { name = "LEVELUP", skip = 0, data = new byte[] { 0xE4, 0x58, 0x00, 0x2C, 0x0C, 0xD0, 0x23, 0x78, 0x00, 0x2B, 0x09, 0xD0, 0x8B, 0x42, 0x01, 0xDD, 0x93, 0x42, 0x01, 0xDD, 0x02, 0x34, 0xF6, 0xE7, 0x63, 0x78, 0x33, 0x70, 0x01, 0x36, 0xF9, 0xE7, 0x00, 0x20, 0x30, 0x70, 0x71, 0xBC, 0x70, 0x47 } }, new SkillSystemsTableSt { name = "LEVELUP", skip = 0, data = new byte[] { 0x06, 0xDD, 0x14, 0x3B, 0x8B, 0x42, 0x01, 0xDD, 0x93, 0x42, 0x01, 0xDD, 0x02, 0x34, 0xEF, 0xE7, 0x63, 0x78, 0x33, 0x70, 0x01, 0x36, 0xF9, 0xE7, 0x0B, 0x4C, 0x43, 0x68, 0x1B, 0x79, 0x9B, 0x00, 0xE4, 0x58, 0x00, 0x2C, 0x0C, 0xD0, 0x23, 0x78, 0x00, 0x2B, 0x09, 0xD0, 0x8B, 0x42, 0x01, 0xDD, 0x93, 0x42, 0x01, 0xDD, 0x02, 0x34, 0xF6, 0xE7, 0x63, 0x78, 0x33, 0x70, 0x01, 0x36, 0xF9, 0xE7, 0x00, 0x20, 0x30, 0x70, 0x71, 0xBC, 0x70, 0x47 } }, new SkillSystemsTableSt { name = "LEVELUP", skip = 0, data = new byte[] { 0xF0, 0xE7, 0x02, 0x2B, 0x12, 0xD0, 0x03, 0x2B, 0x06, 0xD1, 0x0D, 0x48, 0x42, 0x21, 0x41, 0x5C, 0x20, 0x22, 0x11, 0x42, 0x0A, 0xD1, 0xE5, 0xE7, 0x04, 0x2B, 0x06, 0xD1, 0x08, 0x48, 0x14, 0x21, 0x41, 0x5C, 0x40, 0x22, 0x11, 0x42, 0x01, 0xD1, 0xDC, 0xE7, 0xDB, 0xE7, 0x63, 0x78, 0x33, 0x70, 0x01, 0x36, 0xD7, 0xE7, 0x00, 0x20, 0x30, 0x70, 0x06, 0xBC, 0xF1, 0xBC, 0x70, 0x47, 0x00, 0x00, 0xF0, 0xBC, 0x02, 0x02 } }, new SkillSystemsTableSt { name = "ANIME", skip = 32, data = new byte[] { 0x00, 0x2B, 0x00, 0xD1, 0x06, 0x4B, 0x38, 0x1C, 0x9E, 0x46, 0x00, 0xF8, 0x05, 0x48, 0x00, 0x47 } }, new SkillSystemsTableSt { name = "ANIME", skip = 16, data = new byte[] { 0x00, 0xD1, 0x33, 0x1C, 0x01, 0x33, 0x38, 0x1C, 0x00, 0xF0, 0x09, 0xF8, 0xF0, 0xBC, 0x11, 0x48, 0x00, 0x47, 0xF0, 0xBC, 0x10, 0x48, 0x00, 0x47, 0xF0, 0xBC, 0x10, 0x48, 0x00, 0x47, 0x18, 0x47, 0x6D, 0xA1, 0x05, 0x08, 0x35, 0x8A, 0x05, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x10, 0xE3, 0x06, 0x08, 0x8C, 0xE5, 0x06, 0x08, 0xC4, 0xAE, 0x02, 0x08, 0x55, 0xA1, 0x05, 0x08 } }, }; foreach (SkillSystemsTableSt t in table) { if (t.name != type) { continue; } //チェック開始アドレス uint start = 0xB00000; uint end = 0xC00000; uint found = U.Grep(Program.ROM.Data, t.data, start, end, 4); if (found == U.NOT_FOUND) { continue; } uint a = (uint)(found + t.data.Length + t.skip); a = a + skip; if (!U.isSafetyOffset(a)) { continue; } uint p = Program.ROM.u32(a); if (!U.isSafetyPointer(p)) { continue; } if (type == "LEVELUP") {//昔のROMには紛らわしいデータがあるらしいので、もっと詳しく見ています //LEVELUPはポインタリストなので、それっぽいか確認していきます。 //0th data uint data0th = Program.ROM.u32(U.toOffset(p)); uint data1st = Program.ROM.u32(U.toOffset(p + 4)); if (!U.isPadding4(data0th)) { continue; } if (!U.isSafetyPointerOrNull(data0th)) { continue; } if (!U.isPadding4(data1st)) { continue; } if (!U.isSafetyPointerOrNull(data1st)) { continue; } } //ポインタで返す. return(a); } return(U.NOT_FOUND); }