The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Fan Games > Binary ROM Hacking
Reload this Page Other Var location

Notices
For all updates, view the main page.

Binary ROM Hacking Need a helping hand or just want to talk about binary ROM hacks? Get comments and answers to any ROM Hacking-related problems, questions or thoughts you have here.

Ad Content
Reply
 
Thread Tools
  #1   Link to this post, but load the entire thread.  
Old August 11th, 2014 (5:35 AM).
Mickey` Mickey` is offline
 
Join Date: May 2011
Posts: 88
Hi everyone, I'm sorry if I'm not in the good section, and I'm sorry for my bad English too, I'm French... :(

After many researches, I haven't been able to find the location where variables are stored.

For example, I know thanks to many tuts that the var 0x8000 is stored at 0x20370B8. But I want to find, for example, the location where the var 0x4200 is stored.

Can someone help me ?

Thanks ! :)
Reply With Quote
  #2   Link to this post, but load the entire thread.  
Old August 11th, 2014 (8:18 AM). Edited August 11th, 2014 by esperance.
esperance's Avatar
esperance esperance is offline
 
Join Date: Mar 2010
Location: OH
Age: 26
Gender: Male
Nature: Relaxed
Posts: 3,830
I believe the variables start at 0x020275D8 for Emerald and 0x020270B8 for FireRed. To get the correct offset, you need to multiply the desired number by 2, because each variable is a half-word stored in the RAM.

Although, not every offset is actually a variable, so be careful with what you use.


EDIT: If you wanna access a variable you don't know the address to, try using the variable decrypter. It's documented here: Click
__________________
What are you so afraid of?
Reply With Quote
  #3   Link to this post, but load the entire thread.  
Old August 11th, 2014 (12:19 PM).
Mickey` Mickey` is offline
 
Join Date: May 2011
Posts: 88
So if I want to find the location of the var 0x4200 :

20270B8 + (4200 * 2) = 202F4B8

But the value at 0x202F4B8 doesn't change when I set the var 0x4200 to any value.

I don't understand how to use the variable decrypter...
Reply With Quote
  #4   Link to this post, but load the entire thread.  
Old August 11th, 2014 (8:15 PM).
esperance's Avatar
esperance esperance is offline
 
Join Date: Mar 2010
Location: OH
Age: 26
Gender: Male
Nature: Relaxed
Posts: 3,830
Well, assuming we're talking ASM here, and you want to use the variable decrypter, you would need to load the number of your variable into r0, call the routine, and the appropriate RAM location would be returned in r0.
__________________
What are you so afraid of?
Reply With Quote
  #5   Link to this post, but load the entire thread.  
Old August 12th, 2014 (5:37 AM).
Mickey` Mickey` is offline
 
Join Date: May 2011
Posts: 88
I can't understand the problem... What's wrong in my routine ?

Code:
.align 2
.thumb

main:
	push {r0-r1}
	ldr r0, var4200
	ldr r1, decrypt
	bx r1
	pop {r0-r1}

.align 2
var4200:
	.word 0x4200

decrypt:
	.word 0x0806E455
Ps : Is it possible that the offset of the variable decrypter is different in a French ROM ? Because I found the same data at 0x6E454 in the English ROM and at 0x6E478 in the French ROM. But even with this second offset, the routine doesn't work...
Reply With Quote
  #6   Link to this post, but load the entire thread.  
Old August 15th, 2014 (7:13 AM).
daniilS's Avatar
daniilS daniilS is offline
busy trying to do stuff not done yet
 
Join Date: Aug 2013
Age: 23
Gender: Male
Posts: 409
Quote:
Originally Posted by Mickey` View Post
I can't understand the problem... What's wrong in my routine ?

Code:
.align 2
.thumb

main:
	push {r0-r1}
	ldr r0, var4200
	ldr r1, decrypt
	bx r1
	pop {r0-r1}

.align 2
var4200:
	.word 0x4200

decrypt:
	.word 0x0806E455
Ps : Is it possible that the offset of the variable decrypter is different in a French ROM ? Because I found the same data at 0x6E454 in the English ROM and at 0x6E478 in the French ROM. But even with this second offset, the routine doesn't work...
Yes, the routine is probably located somewhere else in the French ROM.
Another thing with your routine is that while it works, it will never return. So if you want to know the var address, you'll have to find the end of the var decrypter. To make it return so you can read the addres with a break at the end of your routine (and let the game safely continue after) you will need something like this:

Code:
.text
.align 2
.thumb
.thumb_func
.global getvar

main:
	push {lr}
	ldr r0, var4200
	ldr r1, decrypt
	bl bxr1
	pop {pc}
bxr1:
	bx r1

.align 2
var4200:	.word 0x4200
decrypt:	.word 0x0806E478+1
Also, why hack a French ROM? Foreign ROMs aren't usually documented that well and some tools don't support them.
__________________
Reply With Quote
  #7   Link to this post, but load the entire thread.  
Old August 25th, 2014 (2:34 PM).
Mickey` Mickey` is offline
 
Join Date: May 2011
Posts: 88
Oh, sorry, I was in holidays. Thanks a lot for your help !

I'm French, so I usually use French ROMs :)
Reply With Quote
  #8   Link to this post, but load the entire thread.  
Old August 26th, 2014 (2:39 AM).
daniilS's Avatar
daniilS daniilS is offline
busy trying to do stuff not done yet
 
Join Date: Aug 2013
Age: 23
Gender: Male
Posts: 409
Quote:
Originally Posted by Mickey` View Post
Oh, sorry, I was in holidays. Thanks a lot for your help !

I'm French, so I usually use French ROMs :)
Yeah, I understand that. I just personally think it would be easier to translate an English ROM to French than to find all offsets we know in BPRE in BPRF.
__________________
Reply With Quote
  #9   Link to this post, but load the entire thread.  
Old August 26th, 2014 (3:59 AM).
Mickey` Mickey` is offline
 
Join Date: May 2011
Posts: 88
Yeah, I think so, but I realized that when my projet was aleready started...
Reply With Quote
Reply

Quick Reply

Join the conversation!

Create an account to post a reply in this thread, participate in other discussions, and more!

Create a PokéCommunity Account
Ad Content

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 9:09 AM.