本帖最后由 判仔团 于 2015-10-3 18:30 编辑
声明:本帖代码非原创,经过本人测试微改可用
那么大家是否记得我呢?我是泡泡!上次的原创特性由于脑洞问题所以暂时没有更新了(说的好像你还记得!!)。。。那么这次我就写一个关于鬼龙携带白金玉切换形态特性的帖子吧,也是答应版主的
本来呢,我是打算从每次玩家给宠物携带道具的时候提示文本,然后切入更改!但是我发现老外居然没有那么麻烦.....深感惭愧.
替换宠物
由于不是直接该图像,而且考虑到种族的切换,所以我们需要替换一直其他形态的鬼龙精灵,这里就不多说(没素材?!我也没有 )
代码部分
这次只有一个代码,很容易的说- .text
- .align 2
- .thumb
- .thumb_func
- .global change
- ks:
- ldrb r1, [r4]
- ldrb r0, [r4, #0x1]
- lsl r0, r0, #0x8
- add r1, r1, r0
- mov r0, r8
- strh r1, [r0, #0x2]
- push {r0-r7}
- Initialising:
- ldrh r2, [r0]
- ldr r6, GiratinaO
- cmp r2, r6
- beq GrisCheck
- ldr r6, Giratina
- cmp r2, r6
- beq GrisCheck2
- LoadGivenItem:
- b Changing
- GrisCheck:
- ldr r6, GriseousOrb
- cmp r1, r6
- beq LoadGivenItem
- ldr r4, Giratina
- b Changing
- GrisCheck2:
- ldr r6, GriseousOrb
- cmp r1, r6
- bne LoadGivenItem
- ldr r4, GiratinaO
- b Changing
- Return:
- pop {r0-r7}
- Return3:
- ldr r0, Back
- bx r0
- Return2:
- ldr r0, Back2
- bx r0
- Changing:
- strh r4, [r0]
- pop {r0-r7}
- ldr r3, Limit
- cmp r0, r3
- bhi Return3
- mov r0, r7
- ldr r3, pokemon_calc_checksum
- bl Call
- strh r0, [r7, #0x1C]
- mov r0, r7
- ldr r3, pokemon_encrypt
- bl Call
- mov r0, r7
- ldr r3, pokemon_calculate_stats
- bl Call
- b Return2
- Call:
- mov pc, r3
- .align 2
- GriseousOrb: .word 0x000000E4//这里修改成白金玉的道具编号
- Giratina: .word 0x000000F9//这里修改成普通形态的鬼龙编号
- GiratinaO: .word 0x0000112//这里修改成改变形态后的鬼龙编号
- pokemon_calc_checksum: .word 0x08068C78
- pokemon_encrypt: .word 0x0806A228
- pokemon_calculate_stats: .word 0x08068D0C
- Back: .word 0x0806B3D8+1
- Back2: .word 0x0806B3EC+1
- Limit: .word 0x02024744
复制代码 使用方法:在0806B04C处写入00490841xxxxxx08,这里的xxxxxx08是你的代码地址+1
这么长的代码看不懂?没关系,我们分开来看看......- ks:
- ldrb r1, [r4]
- ldrb r0, [r4, #0x1]
- lsl r0, r0, #0x8
- add r1, r1, r0
- mov r0, r8
- strh r1, [r0, #0x2]
- push {r0-r7}
- 这一段基本无视,一些原本的代码操作,值得注意的是把r8的值弄到了r0使用
复制代码 接着重点代码:- Initialising:
- ldrh r2, [r0]
- ldr r6, GiratinaO
- cmp r2, r6
- beq GrisCheck
- ldr r6, Giratina
- cmp r2, r6
- beq GrisCheck2
- 这里读取了操控道具的宠物的编号,如果是普通形态,跳转判断目前的道具,如果是原始形态也一样,只是最后返回的改变的宠物的编号不同
复制代码 接着这里是决定变换的宠物代码,不多解释:- GrisCheck:
- ldr r6, GriseousOrb
- cmp r1, r6
- beq LoadGivenItem
- ldr r4, Giratina
- GrisCheck2:
- ldr r6, GriseousOrb
- cmp r1, r6
- bne LoadGivenItem
- ldr r4, GiratinaO
- b Changing
复制代码 最后执行切换:- Changing:
- strh r4, [r0]
- pop {r0-r7}
- ldr r3, Limit
- cmp r0, r3
- bhi Return3
- mov r0, r7
- ldr r3, pokemon_calc_checksum
- bl Call
- strh r0, [r7, #0x1C]
- mov r0, r7
- ldr r3, pokemon_encrypt
- bl Call
- mov r0, r7
- ldr r3, pokemon_calculate_stats
- bl Call
- b Return2
- 类似于Ta聚说过的一个效果,但是有个Limit不懂,详细请参考:http://tieba.baidu.com/p/3507142617
复制代码 测试效果:
那么火红版本源码:- .text
- .align 2
- .thumb
- .thumb_func
- .global change
- ks:
- ldrb r1, [r4]
- ldrb r0, [r4, #0x1]
- lsl r0, r0, #0x8
- add r1, r1, r0
- mov r0, r8
- strh r1, [r0, #0x2]
- push {r0-r7}
- Initialising:
- ldrh r2, [r0]
- ldr r6, GiratinaO
- cmp r2, r6
- beq GrisCheck
- ldr r6, Giratina
- cmp r2, r6
- beq GrisCheck2
- LoadGivenItem:
- b Changing
- GrisCheck:
- ldr r6, GriseousOrb
- cmp r1, r6
- beq LoadGivenItem
- ldr r4, Giratina
- b Changing
- GrisCheck2:
- ldr r6, GriseousOrb
- cmp r1, r6
- bne LoadGivenItem
- ldr r4, GiratinaO
- b Changing
- Return:
- pop {r0-r7}
- Return3:
- ldr r0, Back
- bx r0
- Return2:
- ldr r0, Back2
- bx r0
- Changing:
- strh r4, [r0]
- pop {r0-r7}
- ldr r3, Limit
- cmp r0, r3
- bhi Return3
- mov r0, r7
- ldr r3, pokemon_calc_checksum
- bl Call
- strh r0, [r7, #0x1C]
- mov r0, r7
- ldr r3, pokemon_encrypt
- bl Call
- mov r0, r7
- ldr r3, pokemon_calculate_stats
- bl Call
- b Return2
- Call:
- mov pc, r3
- .align 2
- GriseousOrb: .word 0x000000E4
- Giratina: .word 0x000000F9
- GiratinaO: .word 0x0000112
- pokemon_calc_checksum: .word 0x0803E3E8+1
- pokemon_encrypt: .word 0x0803F8F8+1
- pokemon_calculate_stats: .word 0x0803E47C+1
- Back: .word 0x08040ADA+1
- Back2: .word 0x08040AEE+1
- Limit: .word 0x02024540
复制代码 使用方法:在08040780处写入00490841xxxxxx08,这里的xxxxxx08是你的代码地址+1
其实也就是地址不同....
最后分享一下老外的原帖代码,带了多重属性(然而我测试不对.....)- .text
- .align 2
- .thumb
- .thumb_func
- .global multitypekeepsplates
- Start:
- ldrb r1, [r4]
- ldrb r0, [r4, #0x1]
- lsl r0, r0, #0x8
- add r1, r1, r0
- mov r0, r8
- strh r1, [r0, #0x2]
- push {r0-r7}
- Initialising:
- ldrh r2, [r0]
- ldr r6, GiratinaO
- cmp r2, r6
- beq GrisCheck
- ldr r6, Giratina
- cmp r2, r6
- beq GrisCheck2
- LoadGivenItem:
- mov r6, #0x6
- ldr r5, Table
- add r5, #0x4
- mov r7, r1
- bl LoopLoad
- cmp r6, #0x0
- bne ItemInTable
- ItemNotInTable:
- ldr r5, Table
- add r5, #0x6
- mov r6, #0x6
- mov r7, r2
- bl LoopLoad
- cmp r6, #0x1
- bne Return
- ldrh r4, [r5, #0x2]
- b Changing
- GrisCheck:
- ldr r6, GriseousOrb
- cmp r1, r6
- beq LoadGivenItem
- ldr r4, Giratina
- b Changing
- GrisCheck2:
- ldr r6, GriseousOrb
- cmp r1, r6
- bne LoadGivenItem
- ldr r4, GiratinaO
- b Changing
- ItemInTable:
- ldrh r3, [r5, #0x2]
- mov r7, r2
- mov r6, #0x6
- ldr r5, Table
- bl LoopLoad
- cmp r6, #0x1
- bne Return
- mov r4, r3
- b Changing
- Return:
- pop {r0-r7}
- Return3:
- ldr r0, Back
- bx r0
- Return2:
- ldr r0, Back2
- bx r0
- Changing:
- strh r4, [r0]
- pop {r0-r7}
- ldr r3, Limit
- cmp r0, r3
- bhi Return3
- mov r0, r7
- ldr r3, pokemon_calc_checksum
- bl Call
- strh r0, [r7, #0x1C]
- mov r0, r7
- ldr r3, pokemon_encrypt
- bl Call
- mov r0, r7
- ldr r3, pokemon_calculate_stats
- bl Call
- b Return2
- LoopLoad:
- push {lr}
- Looping:
- ldrh r4, [r5]
- cmp r4, #0x0
- beq Nope
- cmp r4, r7
- beq Yep
- add r5, r6
- b Looping
- Nope:
- mov r6, #0x0
- pop {pc}
- Yep:
- mov r6, #0x1
- pop {pc}
- Call:
- mov pc, r3
- .align 2
- GriseousOrb: .word 0x000000E4
- Giratina: .word 0x000000F9
- GiratinaO: .word 0x0000112
- pokemon_calc_checksum: .word 0x08068C78
- pokemon_encrypt: .word 0x0806A228
- pokemon_calculate_stats: .word 0x08068D0C
- Back: .word 0x0806B3D8+1
- Back2: .word 0x0806B3EC+1
- Limit: .word 0x02024744
- Table: .hword 0x101, 0x101, 0xEB, 0x102, 0x101, 0xEC, 0x103, 0x101, 0xED, 0x104, 0x101, 0xEE, 0x105,
- 0x101, 0xEF, 0x106, 0x101, 0xF0, 0x107, 0x101, 0xF1, 0x108, 0x101, 0xF2, 0x109, 0x101, 0xF3, 0x10A,
- 0x101, 0xF4, 0x10B, 0x101, 0xF5, 0x10C, 0x101, 0xF6, 0x10D, 0x101, 0xF7, 0x10E, 0x101, 0xF8, 0x10F,
- 0x101, 0xF9, 0x110, 0x101, 0xFA, 0x111, 0x101, 0xEA, 0x199, 0x101, 0x0, 0x0, 0x0
- 我修改了其中挤出错误.....
复制代码 飞走~大家国庆假期快乐 |