Registrarse

[Problem]Branch for automatic transparent textboxes

Estado
Cerrado para nuevas respuestas.

jiangzhengwenjz

Usuario mítico
I've found @Andrea's script codes to make the textbox transparent in Pokemon Ruby, so I decided to make it automatic.

I will explain what I did: (1,2 are done correctly, 3 is the problem)

1. I found the script pointer table in Ruby, so I found the ASM code of "preparemsg" "waitmsg" "yesnobox" "end". I decide to activate the I/O and WRAM modification through it.

2. I decided to modify "waitmsg" to activate and "end" to deactivate.
Here's the code: (These are right so I only provide the compiled code)
@0x080670A4
Código:
00 49 08 47 01 00 80 08
@0x08065806
Código:
00 00 00 49 08 47 01 00 81 08
@0x08800000
Código:
11 49 09 68 03 B4 3F 20 10 49 08 70 48 72 1F 20 48 70 41 20 08 72 0F 20 88 72 0A 20 C8 72 0C 49 FF 20 08 70 48 70 00 20 48 80 0A 49 08 80 C8 80 88 60 C8 60 08 82 03 BC 00 F0 03 F8 01 20 02 BC 08 47 05 4A 10 47 C0 46 B0 70 06 08 48 00 00 04 AA F0 02 02 B8 F0 02 02 DD 53 06 08
@0x08810000
Código:
01 B4 1F 20 1B 49 08 70 48 70 40 20 08 72 1E 20 48 72 10 20 88 72 00 20 C8 72 17 49 C8 70 29 20 08 70 25 20 48 70 1F 20 88 70 5A 20 13 49 08 70 67 20 48 70 9C 20 88 71 77 20 C8 71 FF 20 08 72 88 73 7F 20 48 72 C8 72 C8 73 33 20 88 72 3F 20 08 73 72 20 48 73 0E 20 08 74 53 20 48 74 01 BC 00 F0 03 F8 00 20 02 BC 08 47 01 49 08 47 C0 46 E5 53 06 08 48 00 00 04 AA F0 02 02 B8 F0 02 02
3. After that all things go right except "yesnobox", whose asm routine is also called in "msgbox @msgpointer 0x5" in XSE's scripting style. But I have no idea now about it, though I know that I must deactive in this routine. if I do it at the beginning, the text won't be shown as transparent.
Here's the code:

Branch:
@0x08067100
Código:
.thumb
ldr r3, newcode
bx r3

.align 2
newcode: .word 0x08820001
Newcode:
@0x08820000
Código:
.thumb
ldrb r3, [r2]
add r2, #0x1
str r2, [r0, #0x8]
ldrb r1, [r2]
add r2, #0x1
main:
push {r0, r1}
mov r0, #0x1F
ldr r1, offset1
strb r0, [r1, #0x0]
strb r0, [r1, #0x1]
mov r0, #0x40
strb r0, [r1, #0x8]
mov r0, #0x1E
strb r0, [r1, #0x9]
mov r0, #0x10
strb r0, [r1, #0xA]
mov r0, #0x0
strb r0, [r1, #0xB]
ldr r1, offset2
strb r0, [r1, #0x3]
mov r0, #0x29
strb r0, [r1, #0x0]
mov r0, #0x25
strb r0, [r1, #0x1]
mov r0, #0x1F
strb r0, [r1, #0x2]
mov r0, #0x5A
ldr r1, offset3
strb r0, [r1, #0x0]
mov r0, #0x67
strb r0, [r1, #0x1]
mov r0, #0x9C
strb r0, [r1, #0x6]
mov r0, #0x77
strb r0, [r1, #0x7]
mov r0, #0xFF
strb r0, [r1, #0x8]
strb r0, [r1, #0xE]
mov r0, #0x7F
strb r0, [r1, #0x9]
strb r0, [r1, #0xB]
strb r0, [r1, #0xF]
mov r0, #0x33
strb r0, [r1, #0xA]
mov r0, #0x3F
strb r0, [r1, #0xC]
mov r0, #0x72
strb r0, [r1, #0xD]
mov r0, #0xE
strb r0, [r1, #0x10]
mov r0, #0x53
strb r0, [r1, #0x11]
ldr r0, backaddr
bx r0

.align 2
offset1: .word 0x04000048
offset2: .word 0x0202F0AA
offset3: .word 0x0202F0B8
backaddr: .word 0x08067109
Of course, there's another instruction in 0x08067108
Código:
.thumb
pop {r0, r1}
I think the code is without any problem. The problem maybe that I branch too early in this function but I have no idea when to get out of the code.

It will be very appreciated if anyone can help. ;)
If someone can tell me how to make the yesnobox transparent, that will be better!

P.S. I know that my code is not efficient but it's just for test.
 
Última edición:

cosarara97

Dejad de cambiar de nick
Miembro de honor
(These are right so I only provide the compiled code)
You are just making this more difficult for us to understand, and making it more difficult for us to help you...

3. After that all things go right except "yesnobox", whose asm routine is also called in "msgbox @msgpointer 0x5" in XSE's scripting style. But I have no idea now about it, though I know that I must deactive in this routine. if I do it at the beginning, the text won't be shown as transparent.
Here's the code:

Branch:
@0x08067100
Código:
.thumb
ldr r3, newcode
bx r3

.align 2
newcode: .word 0x08820001
Newcode:
@0x08820000
Código:
.thumb
ldrb r3, [r2]
add r2, #0x1
str r2, [r0, #0x8]
ldrb r1, [r2]
add r2, #0x1
main:
push {r0, r1}
mov r0, #0x1F
ldr r1, offset1
strb r0, [r1, #0x0]
strb r0, [r1, #0x1]
mov r0, #0x40
strb r0, [r1, #0x8]
mov r0, #0x1E
strb r0, [r1, #0x9]
mov r0, #0x10
strb r0, [r1, #0xA]
mov r0, #0x0
strb r0, [r1, #0xB]
ldr r1, offset2
strb r0, [r1, #0x3]
mov r0, #0x29
strb r0, [r1, #0x0]
mov r0, #0x25
strb r0, [r1, #0x1]
mov r0, #0x1F
strb r0, [r1, #0x2]
mov r0, #0x5A
ldr r1, offset3
strb r0, [r1, #0x0]
mov r0, #0x67
strb r0, [r1, #0x1]
mov r0, #0x9C
strb r0, [r1, #0x6]
mov r0, #0x77
strb r0, [r1, #0x7]
mov r0, #0xFF
strb r0, [r1, #0x8]
strb r0, [r1, #0xE]
mov r0, #0x7F
strb r0, [r1, #0x9]
strb r0, [r1, #0xB]
strb r0, [r1, #0xF]
mov r0, #0x33
strb r0, [r1, #0xA]
mov r0, #0x3F
strb r0, [r1, #0xC]
mov r0, #0x72
strb r0, [r1, #0xD]
mov r0, #0xE
strb r0, [r1, #0x10]
mov r0, #0x53
strb r0, [r1, #0x11]
ldr r0, backaddr
bx r0

.align 2
offset1: .word 0x04000048
offset2: .word 0x0202F0AA
offset3: .word 0x0202F0B8
backaddr: .word 0x08067109
Of course, there's another instruction in 0x08067108
Código:
.thumb
pop {r0, r1}
I think the code is without any problem. The problem maybe that I branch too early in this function but I have no idea when to get out of the code.

It will be very appreciated if anyone can help. ;)
If someone can tell me how to make the yesnobox transparent, that will be better!

P.S. I know that my code is not efficient but it's just for test.
I won't even try to understand what "newcode" is. I'll just tell you the two easy ways to do what you are trying to do.
First one:
Modify the standard function number 5, to deactivate after the waitmsg. To this:
  • In the command table, where you found the code for "preparemsg", "waitmsg", "yesnobox" and "end", find callstd or gotostd/jumpstd
  • This will lead you to the table of std functions. Take number 5.
  • That will be a pointer to a script. Decompile it, add the callasm to the deactivation routine where you want it, compile elsewhere, put the new pointer in entry number 5.

Second one (I think this is just what you are trying to do):
Change the pointer for your command to your new function, where all you have to do is run the deactivation code and call the old function.
I have no idea what 0x08067108 is supposed to be.
Now, the schema for what I just explained would be, more or less:
Código:
.thumb
yesnobox_new_prelude:
push {lr}
ldr r3, deactivate
bl plscall
ldr r3, old_yesnobox
bl plscall
pop {r1}
bx r1

plscall:
bx r3

.align 2
deactivate: .word (the deactivation routine from andrea)
old_yesnobox: .word (the original 0x6E command address)
You'd put the address of yesnobox_new_prelude in the 0x6E entry in the command table.
 

jiangzhengwenjz

Usuario mítico
Re: Respuesta: [Problem]Branch for automatic transparent textboxes

You are just making this more difficult for us to understand, and making it more difficult for us to help you...



I won't even try to understand what "newcode" is. I'll just tell you the two easy ways to do what you are trying to do.
First one:
Modify the standard function number 5, to deactivate after the waitmsg. To this:
  • In the command table, where you found the code for "preparemsg", "waitmsg", "yesnobox" and "end", find callstd or gotostd/jumpstd
  • This will lead you to the table of std functions. Take number 5.
  • That will be a pointer to a script. Decompile it, add the callasm to the deactivation routine where you want it, compile elsewhere, put the new pointer in entry number 5.

Second one (I think this is just what you are trying to do):
Change the pointer for your command to your new function, where all you have to do is run the deactivation code and call the old function.
I have no idea what 0x08067108 is supposed to be.
Now, the schema for what I just explained would be, more or less:
Código:
.thumb
yesnobox_new_prelude:
push {lr}
ldr r3, deactivate
bl plscall
ldr r3, old_yesnobox
bl plscall
pop {r1}
bx r1

plscall:
bx r3

.align 2
deactivate: .word (the deactivation routine from andrea)
old_yesnobox: .word (the original 0x6E command address)
You'd put the address of yesnobox_new_prelude in the 0x6E entry in the command table.
I haven't tried the first way yet, but I think that the second one is almost the same as my way, though it's really much simpler to edit the pointer. ;)

Maybe I didn't convey what I wanted to express to you clearly, so I will explain it in details:

If not deactivated:
the text box is transparent as normal, but the yesnobox looks strange, as some parts of it is transparent and some are not.

If deactivated in the function "yesnobox", or before it as you said:
Both the yesnobox and the textbox are not transparent, which is not we want to do as we want the textbox to be transparent.
 
Estado
Cerrado para nuevas respuestas.
Arriba