Registrarse

[ASM] R, FR | Realistic DNS

Andrea

Usuario mítico
Hi!
In these days i developed a variant of PrimeDialga's DNS.
While in the first version there were only 6 possible filters to distinguish the various parts of the day, in this version we could decide how many filters have and realize a transition effect between one period and another.
Here is the asm routine:
.THUMB
.ALIGN 2

MOV R6, #1
AND R6, R7
CMP R6, #1
BEQ CHANGE

PUSH {R2}
MOV R2, R3
LSR R2, R2, #2
SWI 0xC
POP {R2}

CHANGE:
PUSH {R2-R7}
MOV R4, #0
LDR R2, .HOUR
LDRB R7, [R2, #1]
LDRB R6, [R2]

MOV R3, #60
MUL R7, R3
MOV R5, R3
MUL R3, R5
MUL R6, R3
ADD R6, R7

PUSH {R0-R6}
MOV R0, R6
MOV R1, #135
LSL R1, R1, #4

SWI 0x6
LDR R7, .FILTRI
LSL R0, R0, #1
ADD R7, R0
LDR R7, [R7]
POP {R0-R6}

LOOP:
LDRH R5, [R0, R4]
LSL R2, R5, #27
LSR R2, R2, #27
LSL R6, R7, #27
LSR R6, R6, #27

SUB R2, R6
BPL GREEN

MOV R2, #0

GREEN:
LSL R3, R5, #22
LSR R3, R3, #27
LSL R6, R7, #22
LSR R6, R6, #27

SUB R3, R6
BPL BLUE

MOV R3, #0

BLUE:
LSL R5, R5, #17
LSR R5, R5, #27
LSL R6, R6, #17
LSR R6, R6, #27

SUB R5, R6
BPL SHIFT

MOV R5, #0

SHIFT:
LSL R3, R3, #5
LSL R5, R5, #10
EOR R5, R2
EOR R5, R3
STRH R5, [R1, R4]
ADD R4, #2
CMP R4, #4
BNE LOOP

END:
POP {R2-R7}
ADD R0, #4
ADD R1, #4
SUB R3, #1
BPL CHANGE
LDR R6, .RETURN
BX R6

.ALIGN 2
.FILTRI: .word 0x08F00000
.RETURN: .word 0x08B000C4+1
.HOUR: .word 0x03005542

Each filter follows the same format of GBA palettes:
[0] - [5 bit blue] - [5 bit green] - [5 red bit]
The first bit is unused, while the remaining fields occupy 5 bits.
In each field, you must specify how much blue/green/red subtract from the palette.
For example, to get a blue-tinted filter, you have to subtract red and green:
[0] - [0] - [8] - [8] -> [0] - [01000] - [01000] - [01000] -> 0x2108
I used these filters:
E8 00 C7 00 A6 00 86 00 65 00 44 00 24 00 03 00 02 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 20 04 40 08 60 0C 80 10 A0 14 C0 18 E0 1C 00 21 01 1D 02 19 03 15 04 11 05 0D 06 09 07 05 08 01
In this specific case, there are 40 filters.
This number is obtained from the following formula: ((24 * 3600) / 2160) = [40]
To increase the number of filters, replace the red highlighted part of the code with:
LDR R1, = VAL, where instead of VAL will be entered the denominator of the previous division, in my case 2160.
For example, to use 144 filters, you must be raplce VAL with 600 -> (24 hours * 3600) / 600 = 144.
In the last part of the routine, where the various offsets are marked, one is highlighted in blue and corresponds to the table where the filters are placed.
You can change it the offset where filters will insert.
To insert it we must go to 0x98 bytes later than the offset of the original DNS routine, and then overwrite the bytes with 00 4E 30 47 XX XX XX 08, where XX will be raplced by the offset of the new routine in little endian + 1.
Here's a little video to show the end result:

Hope you like it!
 
Última edición:

KleinStudio

Un plato es un plato
Miembro del equipo
Webmaster
Respuesta: RUBY - Realistic DNS

Amazing, I'm sure this is gonna help a lot of people.
I'm not a ROM hacker but I'm so impressed after looking at your Youtube channel, what talent!
 

Katherine

Omnipresente
Miembro de honor
Respuesta: RUBY - Realistic DNS

Wow, I'm very happy of seeing you that you haven't stoppped in the ROM Hacking. Thought it, i don't know why. Anyways, this routine is awesome, but it's in Ruby. Port this to Emerald or Fire Red would be nice!

Thank you! This things are always very useful :)

Au revoir~.
 

Gold

Porrero a tiempo parcial
Miembro insignia
Respuesta: RUBY/FIRE RED - Realistic DNS

The routine is amazing! I'm really annoyed with the original routine due the poor amount of filters, in some cases the transition of the filters looks so ugly. Thanks for share this amazing routine with us!
 

H.B.P

Emperador Kaktiácero
Miembro de honor
Respuesta: RUBY/FIRE RED - Realistic DNS

Hey, great mate, I was starting to find weird that you could only add few filters, although be careful everyone, as using too many filters could be tiring for the gaming experience.
 
Respuesta: RUBY/FIRE RED - Realistic DNS

@Andrea
It would be awesome, if I could compile the code, when the segment is replaced by custom value of fadings.
Anyways I like to know, which value is needed, when I use the value between times already used by DNS.
 

KanaCn

由紀カクタス
Looks really cool!
Thanks for giving us your awesome tutorial's i wish seeing more of you.
¡I wish you luck!

-Yuki!
 

Saisar

Hago lo que puedo para ayudar a los demás ;)
Respuesta: RUBY/FIRE RED - Realistic DNS

El offset que tenemos que ir al byte 0x98, es donde dice "DAN" y abajo dice Offset (needs 0x12C bytes) (por defecto es B00000)? y cuando insertas el DAN dice: "sytem is already installled? o donde es? perdon si pregunto mucho pero es que me rendedo muy facil xd
 
Arriba