Jachin Shen
Jachin Shen

Categories

Tags

Noita 眼睛谜题: 从 Ghidra 反编译入手

背景: Noita 是一款藏了很多秘密的游戏,其中神秘眼睛的谜题还没有得到解答,笔者希望通过分析生成眼睛的反编译代码找到线索。

反编译代码整体分析

  1. 刚开始有一个很大的条件判断嵌套,都是根据 eye_group_ 的值进入不同的分支,然后将一个64位的数字加进数组,应该就是9种模式背后的数据
  2. LAB_005b013f: 之后,有一个大的 while 循环遍历数组,里面有另一个 do-while 循环,应该是对数组进行某种计算,结果存在 computed_string
  3. 之后就是对 computed_string 进行处理,得到 computed_string_2,不过应该就是一些常规处理,不是很重要

原始数组分析

顺着条件判断,我们可以很容易地收集到不同 eye_group_ 值对应的数组:

eye_group = {
    0: [
        0x5634505c, 0xacf68674,
        0x2c9ac076, 0x981e2346,
        0x2e474a1f, 0x29848a73,
        0xc220213a, 0x75a31019,
        0x01fecf4e, 0x2c7aa564,
        0x2bf7569a, 0xf9b307f9,
        0x3e145ee9, 0xeb76f050,
        0xb54a6af2, 0x993474bb,
        0x5eea05e8, 0x43ea988d,
        0xadde7d91, 0x4136e1da,
        0x0101ef86, 0x472533a7,
        0x3fe75e9e, 0x90a4b336,
        0xc9b9c908, 0x863f83a7,
        0x52329ab4, 0x20c91280, # size = 112
    ], 1: [
        0xb1c95194, 0xeaf95a7c,
        0x2ca1eeba, 0x981e2346,
        0x2e474a1f, 0x29848a73,
        0xac567db9, 0x75a31019,
        0x56f0b2ae, 0x2c7a8998,
        0x9dfd44ec, 0xf9b30744,
        0x7b7555aa, 0x48353272,
        0xcc6a521c, 0x993f346f,
        0xe9153d2e, 0x53c3db0d,
        0x7293312c, 0x628375f9,
        0xe49c1fef, 0xb40dac02,
        0xccc378b2, 0x537dbb53,
        0x4d4eaf5f, 0xf319978d,
        0x40e1fc47, 0xbca3f152,
        0xbf905626, # size = 116
    ], 2: [
        0x1cf72f99, 0x8634c1ef,
        0x2ca1f81b, 0x981e2346,
        0x2e474a1f, 0x29848a73,
        0xe1637be9, 0x75a31019,
        0xb914ade3, 0xe2cfe1d3,
        0xb723d349, 0x786f45ab,
        0x48c7c97b, 0xbee5b2a5,
        0xef63311a, 0x2cbc058b,
        0x655c358a, 0xae1bc859,
        0x797cd4b3, 0x805b0e68,
        0x64bf17b9, 0x87eb66f8,
        0xc737f7dd, 0x40a4cabc,
        0x4f299b43, 0x8dfe0c08,
        0xe0b4b2f4, 0x2aabf66d,
        0xfae456c4, 0x5a0d593c,
        0x072a8e6a, 0x2b885f6a,
        0x616cf703, 0x2d28,     # size = 134
    ], 3: [
        0xba591cfd, 0xe339e9b5,
        0x9f5fdb97, 0x40aa767c,
        0x6a205b2d, 0x292a2b08,
        0xe906ad86, 0x2819fcb0,
        0x2d7097c7, 0xb3ad535d,
        0x5f701c14, 0xe25103af,
        0x3d510e03, 0x7941b070,
        0x0e4ab73f, 0x7d50d317,
        0x71e3af41, 0x2a497ecf,
        0xc25d5cb0, 0x87dfd311,
        0x00ae0a79, 0xed860703,
        0x07cb6914, 0x31468f6d,
        0x856d0002, 0xfac360d1,
        0x9449c363, 0x47499296,
        0x4b209af6, # size = 116
    ], 5: [
        0x9445728a, 0x7e7550ff,
        0x0d0f6513, 0xf30328d5,
        0x9d27ce70, 0x292a0d5c,
        0x52a05d69, 0xbfca758c,
        0xe8109a74, 0x251a1f3f,
        0x5dedc516, 0x24d30587,
        0x44e5f584, 0xb3d39014,
        0x5790c997, 0x82380e0a,
        0xb411f01b, 0xe2449c62,
        0x7ebe9feb, 0xb5e7969a,
        0x4471d7ec, 0x4a9c0282,
        0x866a064b, 0x313a62bf,
        0xa8f7fe37, 0x29b312b3,
        0xeccf2773, 0x79186c2a,
        0x3f22c3ac, 0xb85b08f3,
        0xf689a796, 0x286b232d,
        0x0577b0f1, 0x4eeb3967,
        0x42200715, 0x020c,     # size = 142
    ], 6: [
        0xd85141c4, 0x76b4f66f,
        0x910a0cde, 0x8f93f5f0,
        0x84925ae2, 0x2929e6c7,
        0x29a68a25, 0x40933e6d,
        0xc75f5618, 0xc57372ac,
        0x794787b0, 0xbb64926d,
        0xb2dbe0fe, 0xf1fe39ca,
        0x936186e5, 0x474efd70,
        0x6cad7fcf, 0xc342342e,
        0x81bafa5d, 0xe7a638fd,
        0x40004d4a, 0x29a2c904,
        0x5cdb6750, 0xb62839cb,
        0xfd8931dd, 0x8dfa2566,
        0x030d69c9, 0xee71ed89,
        0x22f7029a, 0xce69520b,
        0x4f349ac3, 0x4748bf1d,
        0x9690947d, 0x013c03,  # size = 135
    ], 8: [
        0xe3c3e1eb, 0x7e7550f0,
        0x67eb65a7, 0x8f93f5f3,
        0x84925ae2, 0x2929e6c7,
        0x5d0b8d5d, 0x40935218,
        0xa3e4e814, 0xc671e036,
        0xdc181d46, 0x5047870a,
        0x3dbac96b, 0x85653473,
        0xaa9846f1, 0x24ee71d2,
        0xc9269dc8, 0x76ba6749,
        0xa9c340c6, 0x8da82039,
        0x32d0143b, 0x802c4c1b,
        0xb02e0347, 0x77df0666,
        0x5cb83226, 0x8fbb8712,
        0x99246bfc, 0x569c4f81,
        0xa564670b, 0xb4e02af6,
        0xeb81e037, 0x5159ba32,
        0x8c,       # size = 129
    ], 7: [
        0x789603e6, 0xe339e97e,
        0xb2c91190, 0x8f93f5e9,
        0x84925ae2, 0x2929e6c7,
        0x4feb4015, 0x409374a5,
        0xf7e604ea, 0x94979e7e,
        0x01bcc357, 0x4a96793f,
        0x36f40675, 0xc355c0a8,
        0xb0f85513, 0x2a752013,
        0x1b30e279, 0xbc7decdd,
        0x8a93175e, 0xc62c6bc0,
        0x63dafb6f, 0x9781e76a,
        0xf3ba1e66, 0xb0a58e3b,
        0x641fde95, 0x297c940b,
        0x7874c807, 0x95120e03,
        0x1017d733, 0xf6a5f2ff,
        0xdf851acf, 0x9540156f,
        0x2fdb567c, 0x2167abfb, # size = 136
    ], 4: [
        0x3f7f2d6f, 0xbc7824f9,
        0xd99610d2, 0xec6ae62e,
        0x9c10ea2f, 0x2929e6c7,
        0xaf3a9d6b, 0x3f77f101,
        0x72274d9d, 0x867e7502,
        0x89efd32a, 0x888f5ab2,
        0x80a77a7b, 0xae3ea520,
        0x1bcfa31f, 0x7d640202,
        0xc2abe496, 0x40c36cc3,
        0x8a590904, 0x2584e684,
        0xeb45f210, 0xe9d5b567,
        0x1f571e0d, 0x40d17965,
        0x7628b91f, 0xec75a14d,
        0x70e3ed4a, 0x7ee7240c,
        0xd76e5ea0, 0xb536c25e,
        0xd4da8afe, 0x2a9c303c,
        0xec314373, 0xedaf6daf,
        0x96eca434, 0x61f5113b,
        0x9fb1a087, 0x281000c2,
        0x08a797d1, # size = 156
    ],
}

数组里每个元素都是32位数,每两个组合就是64位数(左边是低32位,右边是高32位)。 这里我按照反编译代码里出现的顺序记录,不过 Ghidra 反编译结果不能保证原始数据的顺序,所以还是以 eye_group_ 的顺序为准。

长度

首先统计一下每组原始数据的字节数,放在数组最后的注释里,表格如下:

eye_group 0 1 2 3 4 5 6 7 8
size 112 116 134 116 156 142 135 136 129

对照 神秘眼睛密文彩蛋研究 中的9种模式,长度上基本能对应(后面发现末尾会缺失一部分数据,应该是Ghidra没有找全数据,所以长度并不能完全对应)。

重复数据

观察前3组数据,可以发现

..., 0x981e2346,
..., 0x29848a73,
..., 0x75a31019,

都出现了,应该就是对应到前3种模式中重复出现的眼睛。

do-while 循环分析

原始数据本身基本可以确定对应到9种眼睛模式了,但是具体怎么对应还是没有头绪,所以还是分析一下循环。

原作者提供了很多注释,看到 a 一会儿除以7,一会儿模7,突然有了思路,难道是把数据以7进制的形式藏在数组中吗?但是眼睛只有5种,5进制要怎么对应上7进制?先不管那么多,写个程序验证一下:

for key, value in eye_group.items():
    alist = []
    print(f"{key}: ")
    for i in range(0, len(value)-1, 2):
        u64 = value[i] + (value[i+1] << 32)
        bits = []
        for _ in range(24):
            u64, a = u64 // 7, u64 % 7 - 1
            bits.append(a)
        print(bits[::-1])

运行得到结果:

0: 
[-1, 2, 0, 1, 0, 1, 3, 2, 2, 3, 3, 0, 4, 0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上!也就是说, Noita 的开发者是用 7 进制减一后的中间 5 个数 (0, 1, 2, 3, 4) 来储存不同的眼睛模式。但是问题也来了,剩下的头尾两个数 (-1, 5) 怎么办呢?(每行数据头尾的 -1 是进制转换后产生的,那个循环应该会有处理)

继续往下对应,到第二行的 0005 时,出现了 5 ,对应到眼睛模式里,原来是换行。

继续到第三行的 -1412 ,出现了 -1 ,貌似是直接跳过了。但是巧合的一点是,这个位置刚好是不同模式之间开始出现不同的地方。

猜测: -1 可能是某种分割符

  1. 数组中的元素都能被7整除,所以每行最后一个元素都是 -1,开发者应该是用来作为边界。
  2. 除此之外,-1 只出现在开头,开发者很有可能是先把一条句子编码成几个64位数,然后通过直接拼接的方式得到一整个段落,这里 -1 就起到了 padding 的作用,可以复用之前对边界的处理逻辑。

最后,一直到末尾的 3135 都能对应上。继续检查其他模式也能对应上,(除了一些模式的结尾有缺失),所以确定 Noita 中出现的眼睛模式就是这样生成的。

总结

  1. 好消息:原始数据到眼睛模式的对应关系确定了,是通过7进制减一取中间5个数的方式编码眼睛方向的,剩余的头尾两个数 (-1, 5) 用来表达排版信息。
  2. 坏消息:原始数据是硬编码在代码中的,所以无法在代码上找到开发者藏的彩蛋,还是只能从数据本身入手。
  3. 思路:利用 -1 的位置,把一大段切分成几条句子,是否可能找到新的规律?

附录

完整的结果:

0: 
[-1, 2, 0, 1, 0, 1, 3, 2, 2, 3, 3, 0, 4, 0, 4, 1, 1, 3, 0, 2, 3, 2, 1, -1]
[-1, 1, 4, 3, 1, 3, 0, 3, 3, 0, 0, 4, 0, 2, 4, 0, 0, 0, 5, 0, 3, 2, 0, -1]
[-1, -1, 4, 1, 2, 2, 0, 0, 0, 1, 4, 2, 2, 2, 4, 2, 1, 2, 2, 2, 2, 0, 1, -1]
[-1, 1, 0, 0, 0, 3, 2, 0, 1, 3, 4, 1, 1, 1, 3, 5, 3, 1, 0, 2, 2, 1, 0, -1]
[-1, -1, 4, 4, 0, 0, 0, 2, 0, 0, 1, 0, 4, 0,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