zjzj1118 发表于 2013-10-14 14:48:41

绿宝石早晚遇不同的怪

本帖最后由 zjzj1118 于 2013-11-8 10:38 编辑

有朋友让我帮忙研究Jambo精灵时间分布帖子,这里做下分享
原帖:www.pokecommunity.com/showthread.php?t=237951

稍后具体写
我直接拿Jambo的代码试了一下 ,好像对于绿宝石还是有点问题,稍作修改后,供大家看看


使用方式
这样在AM中每块地图可遇的12只怪,就被分成2组,前6个在06点~17点可遇到,后6个在00点~06点 和 17点~24点 可以遇到


000B4C76h: 01 4A 10 47 00 00 01 00 95 09 红色为读取等级代码的指针地址

读取等级代码
0195000040 1A C9 08 89 00 40 18 13 4A 12 78 11 2A 01 DA
0195001006 2A 02 DA 18 22 82 18 00 E0 02 1C D1 78 FF 29
0195002012 D0 08 29 00 D1 10 68 14 1C 60 78 21 78 88 42
0195003002 D3 27 78 06 1C 01 E0 67 78 26 78 F4 1B 01 34
0195004024 06 24 0E 05 4A 10 47 12 1A 0C 2A E2 D0 E4 E7
0195005002 1D E3 E7 02 49 08 47 FA 5C 00 03 93 4C 0B 08
0195006089 F5 02 08 00 00 00 00 00 00 00 00 00 00 00 00



000B500Ah:01 B4 00 48 00 47 01 01 95 09红色为读取精灵代码的指针地址

读取精灵代码
0195010001 BC 00 78 18 B4 40 08 84 00 68 68 0E 49 09 78
0195011011 29 01 DA 06 29 02 DA 18 21 41 18 01 E0 01 1C
01950120FF E7 CB 78 FF 2B 08 D0 08 2B 00 D1 08 68 08 19
0195013040 88 18 BC 21 1C 03 4E 30 47 12 1A 0C 2A EB D0
01950140ED E7 C0 46 15 50 0B 08 C4 0D 00 03 29 00 00 00


最后给出源码

等级读取.text
.align 2
.thumb
.thumb_func
.global daynightlevelswitch

main:
sub r0, r0, r1
lsr r1, r1, #0x3
lsl r1, r1, #0x2
add r0, r0, r1
ldr r2, hour
ldrb r2,
cmp r2, #0x11
bge night
cmp r2, #0x6
bge day
night: mov r2, #0x18
add r2, r0, r2
b check
day: add r2, r0, #0x0
check: ldrb r1,
cmp r1, #0xFF
beq nodata
cmp r1, #0x8
bne nextnormal
ldr r0,
nextnormal: add r4, r2, #0x0
ldrb r0,
ldrb r1,
cmp r0, r1
bcc here
ldrb r7,
add r6, r0, #0x0
b here2
here: ldrb r7,
ldrb r6,
here2: sub r4, r6, r7
add r4, #0x1
lsl r4, r4, #0x18
lsr r4, r4, #0x18
ldr r2, return
bx r2
nodata: sub r2, r2, r0
cmp r2, #0xC
beq night
b day
night2: add r2, r0, #0x4
b check
timeupdate: ldr r1, time
bx r1
.align
hour: .word 0x03005CFA
return: .word 0x080B4C93
time: .word 0x0802F589
精灵读取.text
.align 2
.thumb
.thumb_func
.global daynightwildswitch
main:
pop {r0}
ldrb r0,
push {r3,r4}
lsr r0, r0, #0x1
lsl r4, r0, #0x2
ldr r0,
daynight: ldr r1, hour
ldrb r1,
cmp r1, #0x11
bge night
cmp r1, #0x6
bge day
night: mov r1, #0x18
add r1, r0, r1
b check
day: add r1, r0, #0x0
b check
check: ldrb r3,
cmp r3, #0xFF
beq nodata
cmp r3, #0x8
bne nextnormal
ldr r0,
nextnormal: add r0, r1, r4
ldrh r0,
pop {r3,r4}
add r1, r4, #0x0
ldr r6, Back
bx r6
nodata: sub r2, r2, r0
cmp r2, #0xC
beq night
b day
.align
Back:.word 0x080B5015
hour:.word 0x03000DC4

百般折磨之下 发表于 2013-10-14 17:30:14

如此甚好   

X-hole 发表于 2013-10-14 19:09:41

@海のLUGIA
必有大用?
話說現在奧秘和收藏版普通會員都能直接發帖了?

海のLUGIA 发表于 2013-10-14 19:32:51

X-hole 发表于 2013-10-14 19:09
@海のLUGIA
必有大用?
話說現在奧秘和收藏版普通會員都能直接發帖了?

确实有大用,不过XY在即,短期内不会延续gba的diy……

saac 发表于 2013-10-14 22:40:00

好技术+1
如果绿宝石精灵扩充的话会有很大用途的说
现阶段的数量分昼夜捕捉还是有点捉襟见肘了

gujiahao12 发表于 2014-1-2 12:17:11

本帖最后由 gujiahao12 于 2014-1-2 12:19 编辑

好像有BUG,有时冲浪会卡住,如果是原来Jambo的,虽然读取精灵和等级上有问题,不过加上Jambo的的RTC系统后就没有冲浪会卡住的BUG了。

小坏 发表于 2014-1-19 22:47:34

完全看不懂是社么呀。。。。。。

a825876612 发表于 2014-2-6 21:40:01

同上我也看不懂

jiangzhengwenjz 发表于 2015-7-7 00:32:58

本帖最后由 jiangzhengwenjz 于 2015-7-11 16:00 编辑

update:.thumb
.align 2

main:
ldr r6, =0x080b5000
mov r2, lr
cmp r2, r6
bge secondroutine
sub r0, r0, r1 @get the initial table pointer
mov r4, r1
b adjust

secondroutine:
sub r0, r0, r4 @get the initial table pointer
mov r1, r4

adjust:
lsr r1, r1, #3
lsl r1, r1, #2

@r5 contains the pointer location - 4
getlength:
sub r6, r5, r0
cmp r6, #0x14
beq fivesets
cmp r6, #0x28
beq tensets

twelvesets:
mov r7, #0x18
b compare

fivesets:
mov r1, r4
b day

tensets:
mov r7, #0x14

compare:
ldr r2, =0x03005CFA
ldrb r2,
cmp r2, #0x11
bge night
cmp r2, #0x6
bge day

night:
add r0, r0, r7

day:
add r4, r0, r1

originalroutine:
ldrb r0,
ldrb r1,
cmp r0, r1
bcc location
ldrb r7,
add r6, r0, #0
b back

location:
ldrb r7,
ldrb r6,

back:
ldr r4, =0x080B4C8B
bx r4.thumb
.align 2

main:
pop {r0}
ldrb r0,
ldr r1, @get the table pointer
lsl r0, r0, #2
push {r3, r7}
mov r3, r0

adjust:
lsr r0, r0, #3
lsl r0, r0, #2

getlength:
sub r6, r5, r1
cmp r6, #0x14
beq fivesets
cmp r6, #0x28
beq tensets

twelvesets:
mov r7, #0x18
b compare

fivesets:
mov r0, r3
b day

tensets:
mov r7, #0x14

compare:
ldr r6, =0x3005cfa
ldrb r6,
cmp r6, #0x11
bge night
cmp r6, #0x6
bge day

night:
add r1, r1, r7

day:
add r0, r0, r1

back:
pop {r3, r7}
ldrh r0, @get the species num
ldr r1, =0x80b5015
bx r1增加叫声昼夜:.thumb
.align 2

push {r2, r7, lr}
@r1, r4, r5, r6 can be freely used, r1=table pointer
lsr r0, r0, #0x16 @ogcode
ldr r6,
cmp r1, r6
bne adjust2 @r5 is pointer location - 4
@r4 is pointer location - 4

adjust:
add r5, r4, #0 @r5 is pointer location - 4

adjust2:
add r2, r0, #0 @r2 = not adjusted
lsr r0, r0, #3
lsl r0, r0, #2 @adjust r0

getlength:
sub r6, r5, r1
cmp r6, #0x14
beq fivesets
cmp r6, #0x28
beq tensets

twelvesets:
mov r7, #0x18
b compare

fivesets:
add r0, r2, #0 @restore r0
b day

tensets:
mov r7, #0x14

compare:
ldr r4, =0x3005cfa
ldrb r4,
cmp r4, #0x11
bge night
cmp r4, #0x6
bge day

night:
add r1, r1, r7

day:
add r0, r0, r1
pop {r2, r7, pc}于080B5820h处用bl跳转至此程序
页: [1]
查看完整版本: 绿宝石早晚遇不同的怪