Benvenuto Visitatore!  / Create an account

Valutazione discussione:
  • 1 voto(i) - 5 media
  • 1
  • 2
  • 3
  • 4
  • 5
[Gba] Routine of the "thinking event"
#1
hello to everybody, most people use writebytetooffset to do a simple thing that it is:
[Immagine: GUDpjAs.png]

There are more wbto, specially to change the palette ¿no?
Well i made a routine that do it, that is the next:

Codice:
.align 2
.thumb

main:
    push {r0-r2,lr}
    ldr r0,.dispcnt
    ldrh r1, .dispcntv
    strh r1,[r0]
    ldr r0, .textbox_pos
    mov r1, #0x5f
    strb r1,[r0]
    ldr r0, .textbox_data
    ldrh r1, .ff
    strh r1, [r0]
    mov r2, #0x0
    b bucle

bucle:
    add r2, #0x2
    mov r1, #0x00
    strh r1, [r0, r2]
    cmp r2, #0x1C
    beq end
    b bucle

end:
    pop {r0-r2,pc}

.align 2
.textbox_data: .word 0x0202f0aa    
.ff: .word 0x0000ffff    
.dispcnt: .word 0x04000000    
.dispcntv: .word 0x00006161    
.textbox_pos: .word 0x04000012

And after that, how to push it normal.

Codice:
.align 2
.thumb

main:
    push {r0-r3,lr}
    ldr r0, .dispcnt
    ldr r1, .dispcntv
    strh r1,[r0]
    ldr r0, .textbox_pos
    mov r1, #0x0
    strb r1,[r0]
    mov r2, #0x0
    ldr r0, .textbox
    ldr r1, .textboxv
    b change
    
change:
    ldr r3,[r1] @valor xxxx xxxx r1
    str r3,[r0,r2]
    add r2,#0x2
    add r1,#0x2
    cmp r2, #0x1c
    beq fin
    b change
    
fin:
    pop {r0-r3,pc}
    

.align 2
.textbox: .word 0x0202f0aa    
.dispcnt: .word 0x04000000
.dispcntv: .word 0x00001F70    
.textboxv: .word 0x0202ECA8    
.textbox_pos: .word 0x04000012

If you use this routine, you need to give credits to me, Eing.
 Mi Piace Ricevuti: 
Stygian, Boh, Flygon, bonzi like this post
Cita messaggio
#2
Thank you so much!!! Pokéball Smile
[Immagine: support-drab.gif]
 Mi Piace Ricevuti: 
Cita messaggio
#3
Thanks for this tutorial. This'll be surely very useful!
 Mi Piace Ricevuti: 
Cita messaggio
#4
It's a good and simple Tutorial *Q* I'll certainly use these routines in my Hack, so thank you very much :Q____
[Immagine: 2_SPRAGO.png]
[Immagine: 3_MAPSET.png]
 Mi Piace Ricevuti: 
Cita messaggio
#5
Hello to everybody, today i gonna post the same routine but for FR, because FR is quite diferent than ruby..

So, i'll stop to speak, and let's go to the action!!

First of all, you need to paste this routine in some free space in your rom.
Codice:
.align 2
.thumb

main:
    push {r0,r3}
    ldr r0, .var
    ldrh r0, [r0,#0x0]
    cmp r0, #0x0
    beq normal
    ldr r0,.dispcnt
    ldrh r3, .dispcntv
    strh r3,[r0]
    ldr r0, .textbox_pos
    mov r3, #0x5f
    strb r3,[r0]    
    pop {r0,r3}
    ldr r1, .black_box
    add r0,r0,r1
    pop {r1}
    bx r1
    
normal:
    ldr r0,.dispcnt
    ldrh r3, .dispcntvn
    strh r3,[r0]
    ldr r0, .textbox_pos
    mov r3, #0x0
    strb r3,[r0]
    pop {r0,r3}
    ldr r1, .normal_msgbox
    add r0,r0,r1
    pop {r1}
    bx r1
    

.align 2
.var: .word 0x020370c0 @var 0x8004
.dispcnt: .word 0x04000000    
.dispcntv: .word 0x00006161
.dispcntvn: .word 0x00007f60  
.textbox_pos: .word 0x04000012
.normal_msgbox: .word 0x08471dec
.black_box: .word 0x089F3A10

Here compilated:
Codice:
09 B4 0D 48 00 88 00 28 0A D0 0C 48 0C 4B 03 80 0D 48 5F 23 03 70 09 BC 0D 49 40 18 02 BC 08 47 06 48 08 4B 03 80 08 48 00 23 03 70 09 BC 07 49 40 18 02 BC 08 47 C0 46 C0 70 03 02 00 00 00 04 61 61 00 00 60 7F 00 00 12 00 00 04 EC 1D 47 08 XX XX XX 08

Then, you need to search for 32 bytes of free space, to copy this new colours of the textbox, and paste the offset in the above XX XX XX

Codice:
2E 53 00 00 FF 7F 00 00 FF 7F FF 7F FF 7F FF 7F FF 7F FF 00 00 00 00 00 00 00 00 00 00 00 00 00

when you finish it, you need to edit the load_palettes_textbox routine, that is in the next offset: 08150448

When you are here, you need to paste this:
Codice:
00 4F 38 47 XX XX XX 08

Where XX XX XX is the offset+1 where you paste the routine.

Finally, you need a simple script like that:
Codice:
#org 0xoffset
setvar 0x8004 0x1
msgbox 0x8offset
callstd 0x6
setvar 0x8004 0x0
callasm 0xyour_routine+1
end

As you can see, to determine what type of textbox you will load, we will use a setvar 0x8004. (0x1 for "thinkin events", and 0x0 to back normal..)
Also, if you know asm or are learing, this routine allow to you, edit and add new properties to the default textbox, for example semitransparents textboxes.

To end, i only need that if you have some bug, notific me.

Credits to eing if you use that.
 Mi Piace Ricevuti: 
Flygon likes this post
Cita messaggio
#6
Wow! Es fantàstico... Muchas Gracias para el tutorial, lo enserterò seguramente en mi rom de rojo fuego Wink
"Non tutto ciò che può essere contato conta e non tutto ciò che conta può essere contato..."
Albert Einstein

[Immagine: banner1.png]
[Immagine: k5FOKvm.png]
 Mi Piace Ricevuti: 
Cita messaggio
#7
I never thought that there were english threads here, anyway i was ALMOST desperate to find a way to implement this in my hack so a big thanks to you for sharing!
 Mi Piace Ricevuti: 
Cita messaggio
#8
(01-04-2022, 09:06 AM)juniorxen Ha scritto: I never thought that there were english threads here, anyway i was ALMOST desperate to find a way to implement this in my hack so a big thanks to you for sharing!
If you need an engilsh translation of other threads, drop a message. I'd be happy to translate them for you.
 Mi Piace Ricevuti: 
Boh and Bonnox like this post
Cita messaggio




Utenti che stanno guardando questa discussione: 1 Ospite(i)