PDA

View Full Version : Research: Mugshots


Crimson5M
November 14th, 2011, 06:25 AM
I'm not good with all the posting stuff so I'mma make this short and sweet.
In Pokemon Ruby, a sprite can be displayed on the screen via showpokepic, but it can also be displayed without the box around it, like so:
showpokepic 0x1 0x1 0x1
hidebox 0x1 0x1 0xF 0xF
pause 0x1
hidepokepic
showpokepic 0xFE 0x2 0x7
hidebox 0x2 0x7 0xE 0xE
This allows for things like mugshots. Here is an example:
http://i760.photobucket.com/albums/xx242/altariaking/DarkGreyV2_119.png

HOWEVER. (You know stuffs about to go down when I say that in all caps) This cannot be done in FireRed. So that is why I am posting this thread. :)

AustinWolff
December 11th, 2011, 03:24 PM
cool! is that script for XSE or Pokescript?

Shiny Quagsire
December 13th, 2011, 06:32 PM
cool! is that script for XSE or Pokescript?

I'm sorry, but I'm going to have to give you my XSE speech.

Pokescript is an old, outdated, buggy, and stupid scripting engine used by n00bs, old youtube videos, and Whack a Hack. XSE is a newer, easier, more up-to-date, better scripter than Pokescript. There's more support and documentation on it, and is the main scripting program used. If you try to help script another hack with pokescript, they will tell you the same.

Basically, it's for XSE.

Crimson5M
December 14th, 2011, 10:05 AM
I'm sorry, but I'm going to have to give you my XSE speech.

Pokescript is an old, outdated, buggy, and stupid scripting engine used by n00bs, old youtube videos, and Whack a Hack. XSE is a newer, easier, more up-to-date, better scripter than Pokescript. There's more support and documentation on it, and is the main scripting program used. If you try to help script another hack with pokescript, they will tell you the same.

Basically, it's for XSE.

If you are implying that people from WAH are n00bs, you are very much mistaken. I've seen better hacks there in a week than I've seen here all year. Well, other than, like, two.

Anyway, yes it's for XSE. However it only works for Ruby, and as most people hack FireRed and my ASM knowledge is very limited (and also the fact I am way too busy with school to learn it), that's why I posted this thread.

AustinWolff
December 25th, 2011, 02:37 AM
sweet! and yah, waaaaay to many people hack fire red, which is way it is nice to play a good old ruby hacked game. BUT for showpokepic, doesnt it show the sprite used in a battle? so for the pic of patrat, is that its battle sprite or did you make a custom sprite for it?

droomph
December 29th, 2011, 02:00 PM
sweet! and yah, waaaaay to many people hack fire red, which is way it is nice to play a good old ruby hacked game. BUT for showpokepic, doesnt it show the sprite used in a battle? so for the pic of patrat, is that its battle sprite or did you make a custom sprite for it?

I believe it uses whatever sprite the Pokédex uses, as showpokepic (or whatever) does that (I think).

redriders180
August 10th, 2012, 07:09 PM
After about two hours tinkering with the ASM, I managed to make a fairly bulky routine that will accomplish what hidebox can do in Ruby/Sapphire. At the expense of hopefully not incurring the wrath of an Admin for bumping a very old thread, I'm posting the hex, since this seems to be something that plenty of people might want to have. Like I said, this routine is a little bulky, because my knowledge of ASM doesn't extend to streamlining code...For me, if it works, it works.

This code is mainly optimized for use with Special 0x18B, which shows the images of the fossils. It also works after showpokepic, but there's a detectable flash of the box appearing and then being hidden. To remedy that, I'm posting another code, with a tiny change, that should work for showpokepic:

For Special 0x18B:
.align 2
.thumb

Main:
push {r0-r2,lr}
mov r0, #0x0
bl SUB

SUB:
add r0, r0, #0x1
ldr r1, .COMP
cmp r0, r1
bne SUB
ldr r0, .VAL_1
ldr r1, .DEST
ldr r2, .WORD_AMT
swi 0xC
ldr r0, .VAL_2
ldr r1, .DEST2
ldr r2, .WORD_AMT2
swi 0xC
pop {r0-r2,pc}

.hword 0x0000
.VAL_1: .word 0x0600C3A0
.DEST: .word 0x0600c280
.WORD_AMT: .word 0x00000048
.VAL_2: .word 0x06008F00
.DEST2: .word 0x06008700
.WORD_AMT2: .word 0x00000640
.COMP: .word 0x000017FF

The last value, .COMP, is part of a timer. For showpokepic, 0x000012AF is the lowest it can be...below that, and routine erases the box before the box even exists. However, the slight flash persists for showpokepic. For special 0x18B, there's absolutely no flash ^^

Edit: COMP absolutely has to be 0x000017FF for Special 0x18B, or the routine won't work.

Double Edit: Words make liars out of us...there actually is a small flash for both. My game must've been running at double speed, so the flash didn't show. Sorry v.v

Triple Edit: I forgot to mention, this is intended to be used with callasm, and used immediately after special 0x18B, like how it's done in Ruby. Make sure to add one to the offset called with callasm!

NarutoActor
August 10th, 2012, 08:05 PM
Maybe you can work the code into the special to remove the slight flash, well it works, and here is the hex code if any one is lazy


07 B5 00 20 00 F0 00 F8 01 30 0C 49 88 42 FB D1 04 48 05 49 05 4A 0C DF 05 48 06 49 06 4A 0C DF 07 BD 00 00 A0 C3 00 06 80 C2 00 06 48 00 00 00 00 8F 00 06 00 87 00 06 40 06 00 00 7F 14 00 00

For a total length of 40 bytes (hex)

If it doesn't work, first try this code instead before posting about the problem.

07 B5 00 20 00 F0 00 F8 01 30 0C 49 88 42 FB D1 04 48 05 49 05 4A 0C DF 05 48 06 49 06 4A 0C DF 07 BD 00 00 A0 C3 00 06 80 C2 00 06 48 00 00 00 00 8F 00 06 00 87 00 06 40 06 00 00 FF 17 00 00

redriders180
August 10th, 2012, 08:21 PM
The code I made is definitely not a complete solution, but it is a small stepping stone at least. When I was first making the routine, I had been testing it out with showpokepic, and I didn't want to start rooting around in the ASM of each command and breaking something. I'll try and look into integrating this into the special at some point, although I have JPANs hack engine, so it'll end up having to be different for everyone.

If anyone's curious, there's a large block of 64 8x8 white tiles that get created at 0x6008700, which fill up the entire body of the picture. Internally, there's a routine in the game that writes a long string of 11s to make those squares appear. If we could figure out how to toggle between having a string of 11s to a string of 00s, this code could be improved, since it would change the white tiles to become invisible tiles.

NarutoActor
August 10th, 2012, 08:35 PM
Why not write an asm routine that changes all those bytes to 00's, before the image is shown of course.

redriders180
August 10th, 2012, 08:53 PM
Why not write an asm routine that changes all those bytes to 00's, before the image is shown of course.

That's the tricky bit, unfortunately. The routine I currently have works by changing those tiles to 00. But if you do it too soon, then the original ASM will overwrite the changes with 11, and it won't have any effect. That's why I had to make a sort of timer, so the routine would wait a tick before covering up the 11s. That's why there's always a flash, because the 11s have to exist before they can be replaced.

I also don't know where in the original special that the changing-to-11 bit appears. If we found that, it'd be a very simple matter to make a branch, to check if, say, variable 0x8003 was 0x1, and if it is, change those bytes to 00, and continue on with the special. Writing routines always leaves me exhausted, though, so I'll investigate it a little more at some other point, unless someone else figures it out faster.

Darthatron
August 11th, 2012, 09:59 AM
That's the tricky bit, unfortunately. The routine I currently have works by changing those tiles to 00. But if you do it too soon, then the original ASM will overwrite the changes with 11, and it won't have any effect. That's why I had to make a sort of timer, so the routine would wait a tick before covering up the 11s. That's why there's always a flash, because the 11s have to exist before they can be replaced.

I also don't know where in the original special that the changing-to-11 bit appears. If we found that, it'd be a very simple matter to make a branch, to check if, say, variable 0x8003 was 0x1, and if it is, change those bytes to 00, and continue on with the special. Writing routines always leaves me exhausted, though, so I'll investigate it a little more at some other point, unless someone else figures it out faster.

0809D3A0 BL sub_080F7750
If you change that to 00 00 00 00 it will not draw the box. Hope this helps.

Edit: Sorry, this is for ShowPokePic. Not the special.

NarutoActor
August 11th, 2012, 06:35 PM
Not sure if any of this is useful information, but might as well share it.
The Showpokepic routine is located at 0x0806BB9C
Try calling it using a script, callasm 0x0806BB9D

The routine in hex
30 B5 05 1C FD F7 AA FE 00 04 00 0C 02 F0 DE FC 04 1C 24 04 24 0C A8 68 01 78 01 30 A8 60 02 78 01 30 A8 60 20 1C 31 F0 95 FB 20 1C 00 21 06 F0 AB F9 00 20 30 BC 02 BC 08 47 00 00 10

I might have over reached at little, if that code doesn't work try this
30 B5 05 1C FD F7 AA FE 00 04 00 0C 02 F0 DE FC 04 1C 24 04 24 0C A8 68 01 78 01 30 A8 60 02 78 01 30 A8 60 20 1C 31 F0 95 FB 20 1C 00 21 06 F0 AB F9 00 20 30 BC 02 BC 08 47



Decomplied it with PKSV

#org 0x6BB9C
#thumb
-PUSH {R5,R4,LR}
-ADD R5,R0,0
-BL_PART1 7FD000
-BLH 6AA
-LSL R0,R0,10
-LSR R0,R0,10
-BL_PART1 2000
-BLH 4DE
-ADD R4,R0,0
-LSL R4,R4,10
-LSR R4,R4,10
-LDR R0,[R5,2]
-LDRB R1,[R0,0]
-ADD R0,1
-STR R0,[R5,2]
-LDRB R2,[R0,0]
-ADD R0,1
-STR R0,[R5,2]
-ADD R0,R4,0
-BL_PART1 31000
-BLH 395
-ADD R0,R4,0
-MOV R1,0
-BL_PART1 6000
-BLH 1AB
-MOV R0,0
-POP {R5,R4}
-POP {R1}
-BX R1

Darthatron
August 20th, 2012, 10:29 PM
If you guys want to keep using Special 0x18B, I suggest you stop it from drawing the box all together.

0809D494 @ =============== S U B R O U T I N E =======================================
0809D494
0809D494
0809D494 c3_Special0x18C: @ DATA XREF: sp18B_ShowFossilPicture+14o
0809D494 @ sp18B_ShowFossilPicture:off_0809D548o ...
0809D494 PUSH {R4,R5,LR}
0809D496 LSLS R0, R0, #0x18
0809D498 LSRS R5, R0, #0x18
0809D49A LSLS R0, R5, #2
0809D49C ADDS R0, R0, R5
0809D49E LSLS R0, R0, #3
0809D4A0 LDR R1, =callback3table
0809D4A2 ADDS R4, R0, R1
0809D4A4 MOVS R1, #8
0809D4A6 LDRSH R0, [R4,R1]
0809D4A8 CMP R0, #1
0809D4AA BEQ loc_0809D4FC
0809D4AC CMP R0, #1
0809D4AE BGT loc_0809D4BC
0809D4B0 CMP R0, #0
0809D4B2 BEQ loc_0809D4DE
0809D4B4 B loc_0809D4FC
0809D4B4 @ ---------------------------------------------------------------------------
0809D4B6 .byte 0
0809D4B7 .byte 0
0809D4B8 off_0809D4B8: .long callback3table @ DATA XREF: c3_Special0x18C+Cr
0809D4BC @ ---------------------------------------------------------------------------
0809D4BC
0809D4BC loc_0809D4BC: @ CODE XREF: c3_Special0x18C+1Aj
0809D4BC CMP R0, #2
0809D4BE BEQ ClearOAM
0809D4C0 CMP R0, #3
0809D4C2 BEQ ClearBoxMaybe
0809D4C4 B loc_0809D4FC
0809D4C6 @ ---------------------------------------------------------------------------
0809D4C6
0809D4C6 ClearOAM: @ CODE XREF: c3_Special0x18C+2Aj
0809D4C6 MOVS R0, #0xC
0809D4C8 LDRSH R1, [R4,R0]
0809D4CA LSLS R0, R1, #4
0809D4CC ADDS R0, R0, R1
0809D4CE LSLS R0, R0, #2
0809D4D0 LDR R1, =oam_pre_buffer
0809D4D2 ADDS R0, R0, R1
0809D4D4 BL sub_08007280
0809D4D8 LDR R0, =0x1B58
0809D4DA BL sub_0800874C
0809D4DE
0809D4DE loc_0809D4DE: @ CODE XREF: c3_Special0x18C+1Ej
0809D4DE LDRH R0, [R4,#8]
0809D4E0 ADDS R0, #1
0809D4E2 STRH R0, [R4,#8]
0809D4E4 B loc_0809D4FC
0809D4E4 @ ---------------------------------------------------------------------------
0809D4E6 .byte 0
0809D4E7 .byte 0
0809D4E8 off_0809D4E8: .long oam_pre_buffer @ DATA XREF: c3_Special0x18C+3Cr
0809D4EC dword_0809D4EC: .long 0x1B58 @ DATA XREF: c3_Special0x18C+44r
0809D4F0 @ ---------------------------------------------------------------------------
0809D4F0
0809D4F0 ClearBoxMaybe: @ CODE XREF: c3_Special0x18C+2Ej
[S-HIGHLIGHT]0809D4F0 LDRB R0, [R4,#0x12]
0809D4F2 BL ClearBoxMaybe[/S-HIGHLIGHT]
0809D4F6 MOVS R0, R5
0809D4F8 BL del_c3_from_linked_list
0809D4FC
0809D4FC loc_0809D4FC: @ CODE XREF: c3_Special0x18C+16j
0809D4FC @ c3_Special0x18C+20j ...
0809D4FC POP {R4,R5}
0809D4FE POP {R0}
0809D500 BX R0
0809D500 @ End of function c3_Special0x18C
0809D500
0809D500 @ ---------------------------------------------------------------------------

0809D504 @ =============== S U B R O U T I N E =======================================
0809D504
0809D504
0809D504 sp18B_ShowFossilPicture: @ DATA XREF: ROM:special_tableo
0809D504 PUSH {R4-R6,LR}
0809D506 MOV R6, R8
0809D508 PUSH {R6}
0809D50A LDR R0, =(sub_0809D6D4+1)
0809D50C BL sub_081119D4
0809D510 LSLS R0, R0, #0x18
0809D512 LSRS R0, R0, #0x18
0809D514 CMP R0, #1
0809D516 BEQ Ret_1
0809D518 LDR R0, =(c3_Special0x18C+1)
0809D51A BL position_in_c3_list
0809D51E LSLS R0, R0, #0x18
0809D520 LSRS R0, R0, #0x18
0809D522 CMP R0, #0xFF
0809D524 BNE Ret_0
0809D526 LDR R0, =var_8004
0809D528 LDRH R0, [R0]
0809D52A CMP R0, #0x8D
0809D52C BNE loc_0809D558
0809D52E LDR R0, =off_083E17C0
0809D530 BL sub_08008720
0809D534 LDR R0, =unk_083E17A0
0809D536 MOVS R1, 0x1D0
0809D53A MOVS R2, #0x20
0809D53C BL use_unfaded_pal_and_a_bit_of_R0
0809D540 B loc_0809D572
0809D540 @ ---------------------------------------------------------------------------
0809D542 .byte 0
0809D543 .byte 0
0809D544 off_0809D544: .long sub_0809D6D4+1 @ DATA XREF: sp18B_ShowFossilPicture+6r
0809D548 off_0809D548: .long c3_Special0x18C+1 @ DATA XREF: sp18B_ShowFossilPicture+14r
0809D54C off_0809D54C: .long var_8004 @ DATA XREF: sp18B_ShowFossilPicture+22r
0809D550 off_0809D550: .long off_083E17C0 @ DATA XREF: sp18B_ShowFossilPicture+2Ar
0809D554 off_0809D554: .long unk_083E17A0 @ DATA XREF: sp18B_ShowFossilPicture+30r
0809D558 @ ---------------------------------------------------------------------------
0809D558
0809D558 loc_0809D558: @ CODE XREF: sp18B_ShowFossilPicture+28j
0809D558 CMP R0, #0x8E
0809D55A BEQ loc_0809D560
0809D55C
0809D55C Ret_0: @ CODE XREF: sp18B_ShowFossilPicture+20j
0809D55C MOVS R0, #0
0809D55E B End
0809D560 @ ---------------------------------------------------------------------------
0809D560
0809D560 loc_0809D560: @ CODE XREF: sp18B_ShowFossilPicture+56j
0809D560 LDR R0, =off_083E17D0
0809D562 BL sub_08008720
0809D566 LDR R0, =unk_083E0F80
0809D568 MOVS R1, 0x1D0
0809D56C MOVS R2, #0x20
0809D56E BL use_unfaded_pal_and_a_bit_of_R0
0809D572
0809D572 loc_0809D572: @ CODE XREF: sp18B_ShowFossilPicture+3Cj
0809D572 LDR R0, =stru_083E0768
0809D574 LDR R1, =var_8005
0809D576 MOV R8, R1
0809D578 LDRH R1, [R1]
0809D57A LSLS R1, R1, #0x13
0809D57C MOVS R2, 0x280000
0809D580 ADDS R1, R1, R2
0809D582 ASRS R1, R1, #0x10
0809D584 LDR R6, =var_8006
0809D586 LDRH R2, [R6]
0809D588 LSLS R2, R2, #0x13
0809D58A MOVS R3, 0x280000
0809D58E ADDS R2, R2, R3
0809D590 ASRS R2, R2, #0x10
0809D592 MOVS R3, #0
0809D594 BL uns_to_oam_pre_buf
0809D598 MOVS R5, R0
0809D59A LSLS R5, R5, #0x18
0809D59C LSRS R5, R5, #0x18
0809D59E LDR R1, =oam_pre_buffer
0809D5A0 LSLS R0, R5, #4
0809D5A2 ADDS R0, R0, R5
0809D5A4 LSLS R0, R0, #2
0809D5A6 ADDS R0, R0, R1
0809D5A8 LDRB R2, [R0,#5]
0809D5AA MOVS R1, #0xF
0809D5AC ANDS R1, R2
0809D5AE MOVS R2, #0xD0
0809D5B0 ORRS R1, R2
0809D5B2 STRB R1, [R0,#5]
0809D5B4 LDR R0, =(c3_Special0x18C+1)
0809D5B6 MOVS R1, #0x50
0809D5B8 BL add_to_callback3_list
0809D5BC MOVS R4, R0
0809D5BE LSLS R4, R4, #0x18
0809D5C0 LSRS R4, R4, #0x18
0809D5C2 MOV R1, R8
[S-HIGHLIGHT]0809D5C4 LDRB R0, [R1] @ x
0809D5C6 LDRB R1, [R6] @ y
0809D5C8 MOVS R2, #8 @ width
0809D5CA MOVS R3, #8 @ height
0809D5CC BL DrawBox[/S-HIGHLIGHT]
0809D5D0 LDR R2, =callback3table
0809D5D2 LSLS R1, R4, #2
0809D5D4 ADDS R1, R1, R4
0809D5D6 LSLS R1, R1, #3
0809D5D8 ADDS R1, R1, R2
0809D5DA LSLS R0, R0, #0x18
0809D5DC LSRS R0, R0, #0x18
0809D5DE MOVS R2, #0
0809D5E0 STRH R0, [R1,#0x12]
0809D5E2 STRH R2, [R1,#8]
0809D5E4 STRH R5, [R1,#0xC]
0809D5E6 MOVS R1, #1
0809D5E8 BL sub_080F7750
0809D5EC MOVS R0, #0
0809D5EE BL sub_080F67A4
0809D5F2
0809D5F2 Ret_1: @ CODE XREF: sp18B_ShowFossilPicture+12j
0809D5F2 MOVS R0, #1
0809D5F4
0809D5F4 End: @ CODE XREF: sp18B_ShowFossilPicture+5Aj
0809D5F4 POP {R3}
0809D5F6 MOV R8, R3
0809D5F8 POP {R4-R6}
0809D5FA POP {R1}
0809D5FC BX R1
0809D5FC @ End of function sp18B_ShowFossilPicture

Simply make a branch to check a variable and don't call the DrawBox function if it matches a certain value. Easy.

PokemonMasters
September 2nd, 2012, 08:40 PM
which part of the script do you put
showpokepic 0x1 0x1 0x1
hidebox 0x1 0x1 0xF 0xF
pause 0x1
hidepokepic
showpokepic 0xFE 0x2 0x7
hidebox 0x2 0x7 0xE 0xE ?

NarutoActor
September 2nd, 2012, 08:42 PM
Well if you are using firered no, you need to use asm, and in the script you would use the callasm command.

PokemonMasters
September 2nd, 2012, 08:49 PM
no, im using ruby, and i was wondering where in a script do you put it in :3

supersoursky
June 24th, 2013, 07:12 PM
i dont et any of this how did you get how you get the mugshot when you just basically write the script cansomeone please make a video tutorial of this?

Shiny Quagsire
June 30th, 2013, 05:40 PM
i dont et any of this how did you get how you get the mugshot when you just basically write the script cansomeone please make a video tutorial of this?

no, im using ruby, and i was wondering where in a script do you put it in :3

It's a script fragment. You put it wherever you want the mugshot to show. If you don't understand how to script, I'd suggest taking a journey to the Q&A thread in the parent section or to the Tutorials section. I'm sure you'll find something there to guide you along the way. :)

trafalgar
August 30th, 2013, 06:02 AM
0809D3A0 BL sub_080F7750If you change that to 00 00 00 00 it will not draw the box. Hope this helps.

Edit: Sorry, this is for ShowPokePic. Not the special.
And to eliminate it in Pokémon Ruby?

Shiny Quagsire
August 31st, 2013, 12:41 PM
And to eliminate it in Pokémon Ruby?

Ruby already works with the above method. This workaround is only needed in Fire Red.

VerdeWare
December 5th, 2013, 11:41 AM
I need to know asm as well it would help on the rom that Im working on

how did you do the asm? what asm are you doing?

is it ARM asm or pp32? cause my friend could help me if it was pp32

my friend aka fishguybubbleblower is a great coder who is known for mario kart hacks