Thread: [Tutorial] HackMew's Knowledge
View Single Post
  #90    
Old July 31st, 2010, 11:10 AM
colcolstyles's Avatar
colcolstyles
Yours truly
 
Join Date: May 2008
Location: The Bay Area
Gender: Male
Nature: Lonely
Quote:
Originally Posted by IntrOutro View Post
Hi, how exactly the extended script looks like regarding to the Trainer ID + Secret ID in the 1st ASM Lesson? I just manage to get the Trainer ID to show up but not the Secret ID.

I'll just recopy the script part from the 1st Lesson so anyone of you don't have to look back:
Spoiler:
Code:
#dynamic 0x800000

#org @start
callasm YourOffset
buffernumber 0x0 LASTRESULT
msgbox @secret 0x2
end

#org @secret
= Sshh! I'll tell you a secret[.]\nYour Secret ID is [buffer1]!


and the ASM that I'm based on (Emerald):
Spoiler:
Code:
.text
.align 2
.thumb
.thumb_func
.global lesson1

main:
	push {r0-r1, lr}
	ldr r0, .PLAYER_DATA
	ldr r0, [r0]
	ldr r1, .VAR
	ldrh r0, [r0, #0xA]
	strh r0, [r1]
	ldr r0, .PLAYER_DATA
	ldr r0, [r0]
	ldrh r0, [r0, #0xC]
	strh r0, [r1, #0x2]
	pop {r0-r1, pc}


.align 2
.PLAYER_DATA:
	.word 0x03005D90
.VAR:
	.word 0x020275D6 + (0x800D * 2)


And, do you set the [buffer1] twice in the strings area or split it to something like [buffer1] and [buffer2]?

I really like to know how it's done because the extended script isn't covered in any of the tutorials (only the crucial asm part was covered in the end of 2nd ASM Lesson).
The ASM looks fine as far as I can tell. Here's how I would do the script:
Code:
#dynamic 0x800000

#org @start
callasm YourOffset
buffernumber 0x0 0x800D
buffernumber 0x1 0x800E
msgbox @secret 0x2
end

#org @secret
= Sshh! I'll tell you a secret[.]\nYour Secret ID is [buffer1]! Also, your Trainer ID is [buffer2].
So, yes, you would use 'buffer2'. Just remember that you have to buffer the second number and use '0x01' as the first parameter. It's a little counterintuitive because the number stored in 'buffer 0x0' is accessed via 'buffer1' and the number stored in 'buffer 0x1' is accessed via 'buffer2' but you'll get the hang of it. Also note that since you stored the second number at 'r0 + #0x02', the number would be contained in the variable after LASTRESULT (0x800D), i.e., 0x800E.
__________________

Brother of Vrai
Reply With Quote