Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#26 2015-10-18 15:22:43

Halfshadow
Member
From: Italy - Lucca
Registered: 2012-04-24
Post 62/283

Re: Pokemon G/S Flags

Checking with Gen II Trainer Script Editor the rockets that have a sight range I have found 32 rocket flags that I can reuse, but not are enough for all new Kanto trainers, legendary birds/Mewtwo events and items to find on the floors of the new areas. There are other unused flags that I can reuse safely? Or other rockets scripts flags? Otherwise for be sure I should recycle also the traps flags in the Rocket hideout, replacing with scripts that first search only a one flag after Goldenrod tower, for use their and like 2nd bit search original flag. Then after the tower if you haven't walked over the traps you'll lose there, because the first flag check will be for a only flag, that will be set after defeated rockets in the Radio tower.


The italian Pokémon Green creator.

Offline

#27 2015-10-18 16:28:52

Miksy91
Member
Registered: 2010-10-16
Post 2,189/2,339

Re: Pokemon G/S Flags

Check my two earlier posts in this thread.

Offline

#28 2015-10-18 21:04:40

Halfshadow
Member
From: Italy - Lucca
Registered: 2012-04-24
Post 63/283

Re: Pokemon G/S Flags

But what you mean with $DEC0 to DF00? Are actually a flags ready to use with a script editor or a ram address? I haven't understood this. However I have found all the flags that I need, recycling also hideout cameras and traps. The traps will stop to work after the battle tower, but not is a problem, IMHO is better, the pokémon will flee after a while after rocket's run, now I have flags for the events of the birds, Mewtwo, Pokéflute, new trainers and the items in the new areas, not are enough for all the items that can be found on HG/SS but I have to insert some item also in the Safari Zone that don't exists in HG/SS and then if I cut out some useless item not is a big problem, Pokémon Mansion have only two items (remain only the hidden underground after volcano explosion) Safari Zone 4 items, Cerulean cave 14 and Seafom Islands 9. Are enough I think. Thanks a lot however, for your ideas about the flag recycling.


The italian Pokémon Green creator.

Offline

#29 2015-10-18 21:30:44

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 3,069/3,578

Re: Pokemon G/S Flags

Also, please note that those flags after $DEC0 are not 100% safe unless you disable link features. When you trade with another player, those addreses get used to store some information, and that will mess up whatever flags you stored there.

I found that out the hard way, because I used that space in Christmas, and found out that those flags (most immediately noticeable being the player's gender) got overwritten, so I had to disable link features.

Last edited by Mateo (2015-10-18 21:31:28)

Offline

#30 2015-10-18 23:51:02

Halfshadow
Member
From: Italy - Lucca
Registered: 2012-04-24
Post 65/283

Re: Pokemon G/S Flags

Then is better the way to use the traps of the hideout, after the Radio Tower will stop to workswithout beat the trap pokémon, but not is a bad thing and I have gained 22 flags! And also other 5 for the cameras that however stop work also if is set the flag of the run of the rockets, then if I clear all the flags after Clair nothing bad should be happen.


The italian Pokémon Green creator.

Offline

#31 2015-10-19 18:07:02

Miksy91
Member
Registered: 2010-10-16
Post 2,190/2,339

Re: Pokemon G/S Flags

Halfshadow wrote:

But what you mean with $DEC0 to DF00? Are actually a flags ready to use with a script editor or a ram address?

All flags are pointers to a bit in ram. What I meant with ram area between $DEC0 and $DF00 being unused (apparently it totally isn't) is that you can use flags that point to bits between those two ram addresses. Each byte is formed of 8 bits, so in total, you can have ($DF00 - $DEC0) * 0x8 = 0x200 = 512 new flags that point to those addresses.

Since a part of that space is used and if you don't intend to disable link battles in your hack, you can only use a part of that space if you like.

Mateo wrote:

Also, please note that those flags after $DEC0 are not 100% safe unless you disable link features. When you trade with another player, those addreses get used to store some information, and that will mess up whatever flags you stored there.

I found that out the hard way, because I used that space in Christmas, and found out that those flags (most immediately noticeable being the player's gender) got overwritten, so I had to disable link features.

Didn't know that.

Might be a good idea to list sometime, where does that "link feature" code store data in ram, or specifically, which addresses starting at $DEC0 shouldn't be used if the hacker wants to keep the link features in the hack. Good thing I didn't - wouldn't probably even have enough data for all the things I have planned :)
Not that many new G/S/C hackers should hack Gold or Silver anyway because of the disassembly making things much easier. I would possibly switch over as well if it was easy to take all the changes there but as I understand, it wouldn't be. Not that I feel like I would need the features of disassembly that much but one thing that I feel like I'm lacking the most about features of disassembly is that I can't write in perfect English, and once I want to change the text to be more natural and take the grammar errors away, I may run out of space and have to repoint the text data somewhere... :\

Last edited by Miksy91 (2015-10-19 18:13:45)

Offline

#32 2015-10-19 18:26:01

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 3,070/3,578

Re: Pokemon G/S Flags

I'd have to look again, but I want to say that entire block gets used, which explains why it is even saved in the first place. But like I say, I'd need to look into it again. I just got reports that people were suddenly the wrong gender and stuff after trading, investigated, and saw that area of RAM was getting overwritten during the trading stuff, so I disabled them since I didn't care about link trading anyway. Aught to be simple enough to debug though.


EDIT: Related to your final comments, I do wish I hadn't been stubborn and had used Pokecrystal as the base for Christmas. Probably would have made several things simpler, for sure, but at this point it would be pretty time consuming and annoying to port everything over (plus I've been swearing up and down for a year that I won't do anything to break compatibility so people can continue their saves, and I'm pretty sure swapping the rombase entirely would do that lol)

Last edited by Mateo (2015-10-19 18:28:29)

Offline

#33 2015-10-19 19:21:43

Halfshadow
Member
From: Italy - Lucca
Registered: 2012-04-24
Post 66/283

Re: Pokemon G/S Flags

However with the traps flags I have finished today totally Seafom Islands. With trainers, items hidden and visible and Articuno. That can't flee because in the table of the fleeing pokémon I have replaced 90 with 00 and now can't run away. ^^


The italian Pokémon Green creator.

Offline

#34 2015-10-20 12:22:26

Miksy91
Member
Registered: 2010-10-16
Post 2,191/2,339

Re: Pokemon G/S Flags

Mateo wrote:

I'd have to look again, but I want to say that entire block gets used, which explains why it is even saved in the first place. But like I say, I'd need to look into it again. I just got reports that people were suddenly the wrong gender and stuff after trading, investigated, and saw that area of RAM was getting overwritten during the trading stuff, so I disabled them since I didn't care about link trading anyway. Aught to be simple enough to debug though.

I'd assume that they hardcoded the stack area to start at $DFFF and reserved 0x100 bytes for that ($DFFF - $DF00), and the usage of the rest of the wram just comes from addressing the ram addresses  (or sometimes arrays) with text in order just like is done in pokered and pokecrystal disassemblies.
Not sure how to explain this properly, but just like no rom bank is filled with used data in any pokemon g/s/c rom file, the wram isn't probably used totally either.
When writing a "disassembly" for the game, Gamefreak didn't know where the data would be stored, but they probably took in account by summing, how much wram does their "disassembly code" need when building the rom file. If they ended up with solution of for example, the built rom file using 0x1ED0 bytes of wram in total, that would mean there is still 0x30 bytes of unused data there (+ the stack area that was intentionally put starting at a hardcoded position, at the end of wram).

This is just my assumption though :)

Last edited by Miksy91 (2015-10-20 12:24:47)

Offline

#35 2015-10-20 17:11:01

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 3,071/3,578

Re: Pokemon G/S Flags

I don't think the issue was the stack growing too high, I think it was the other trainer's party names being written there but I don't remember for sure. But we can guess and assume all we want, it won't matter until we actually look at it and see what is going on lol.

Offline

#36 2015-10-21 22:40:36

Miksy91
Member
Registered: 2010-10-16
Post 2,193/2,339

Re: Pokemon G/S Flags

Mateo wrote:

I don't think the issue was the stack growing too high

That's not what I meant actually but no matter :)
What I referred to with stack there is that they hardcoded the stack area to be between DF00 and DFFF.

Mateo wrote:

I think it was the other trainer's party names being written there but I don't remember for sure. But we can guess and assume all we want, it won't matter until we actually look at it and see what is going on lol.

True. But yeah, the trading probably uses a part of the ram area between DEC0 and DEFF. Without trying it out in some way, it's impossible to say how much.

Offline

#37 2015-10-30 08:31:28

Skurbert
Member
Registered: 2012-12-16
Post 85/95

Re: Pokemon G/S Flags

I'm confused again.

You said there were 512 flags to use between DEC0 to DF00. But I can't seem to get more than 64.

DEC0
DEC1
DEC2
DEC3
etc...

That's 16 alternatives (0-9 + A-F) x 4 (DEC*, DED*,DEE*, DEF*) = 64. Am I missing something crucial here? (Obviously I do...)

Offline

#38 2015-10-30 12:45:19

Tauwasser
Member
Registered: 2010-10-16
Post 439/452

Re: Pokemon G/S Flags

Those aren't flag ID numbers, those are WRAM addresses. Hence, every byte at each address has eight bits, so 64 address locations * 8 bits per byte = 512 bits. Each flag ID addresses a single bit within this WRAM space.

cYa,

Tauwasser

Offline

#39 2015-10-31 01:06:29

Skurbert
Member
Registered: 2012-12-16
Post 86/95

Re: Pokemon G/S Flags

Tauwasser wrote:

Those aren't flag ID numbers, those are WRAM addresses. Hence, every byte at each address has eight bits, so 64 address locations * 8 bits per byte = 512 bits. Each flag ID addresses a single bit within this WRAM space.

cYa,

Tauwasser

Ok. So let's just assume I want to take advantage of these 512 bits, which adresses do I start with and how do I count? Can you give me an example. I tried to google it, but found nothing that related to actually writing WRAM adresses into hex (flags).

Offline

#40 2015-10-31 19:40:03

Miksy91
Member
Registered: 2010-10-16
Post 2,200/2,339

Re: Pokemon G/S Flags

Just check my earlier post in this thread when you asked about it in August.

Each flag number happens to point to a single bit starting at address $D7B7. And since you can use 65536 (FF FF + 1) different values for a flag, you can point to 65536 bits starting at address $D7B7. That region happens to cover WRAM between DEC0 and DEFF.

Offline

#41 2015-11-01 07:40:52

Skurbert
Member
Registered: 2012-12-16
Post 87/95

Re: Pokemon G/S Flags

D7B7. Oh, okay.

When I have added 512 bits (leading up to DF00), I must stop, otherwise I'll overwrite something in WRAM, right?
Btw, how did you calculate DEC0 to D7B7? Any easy way to do that?
I feel like a first grader in a university class. :-)

I only want to make sure that I don't do anything really stupid that would blank up the game. And last time I was too quick, so now I have to redo the flags for 30 trainers for a second time.

Last edited by Skurbert (2015-11-01 07:41:45)

Offline

#42 2015-11-01 12:45:09

comet
Member
Registered: 2012-04-09
Post 614/679

Re: Pokemon G/S Flags

I think he's saying that the table starts at d7b7, so the first flag would be (0xdec0 - 0xd7b7) * 8, which is 0x3848

Last edited by comet (2015-11-01 12:46:05)

Offline

#43 2015-11-02 14:54:54

Miksy91
Member
Registered: 2010-10-16
Post 2,201/2,339

Re: Pokemon G/S Flags

Yeah, like comet said there.
Anyway, are you using Windows or some other operating system for rom hacking? If Windows, you can use VBA's Memory Viewer to see contents of RAM, and specifically, which bit in ram is modified when you use setbit1 command or clearbit1 (Gold/Silver scripting command).

setbit1 0x3848 should set the first bit in address $dec0. So make some person's script execute this command when talked to and make sure the contents of DEC0 doesn't have first bit as set (for example, DEC0 = 00). During the script, the value in DEC0 should be its original value + 1. For another test to see how things work, make some person event have 0x3848 as its flag/bit number. Make that person disappear in a script and it should write to DEC0 the same way it does by executing command 'setbit1 0x3848'.

Until you get the hang of it, you should beforehand calculate, which byte should change when some 'setbit1' or 'clearbit1' command is executed during a script. Then make sure that command does exactly what you want it to do by having Memory Viewer on with 'automatic update' setting enabled.

Last edited by Miksy91 (2015-11-02 14:56:37)

Offline

#44 2015-11-02 14:55:57

LeaderKoko
Member
From: Majalengka-West Java,Indonesia
Registered: 2015-09-28
Post 25/81
Website

Re: Pokemon G/S Flags

Miksy, can u help me ??


Find Me In Facebook
Koko Robert
I Was Hacking
|GOLD| Pokemon Jewel Version

Offline

#45 2015-11-02 15:00:53

Miksy91
Member
Registered: 2010-10-16
Post 2,202/2,339

Re: Pokemon G/S Flags

LeaderKoko wrote:

Miksy, can u help me ??

You could start off by watching my video tutorials for instance. Or if you can't watch any, or feel like reading instead to learn, check the other tutorials in gen II section and start off simple.

Offline

#46 2015-11-02 15:09:41

LeaderKoko
Member
From: Majalengka-West Java,Indonesia
Registered: 2015-09-28
Post 26/81
Website

Re: Pokemon G/S Flags

Miksy91 wrote:
LeaderKoko wrote:

Miksy, can u help me ??

You could start off by watching my video tutorials for instance. Or if you can't watch any, or feel like reading instead to learn, check the other tutorials in gen II section and start off simple.

its only textbox problem, how to change textbox color ?


Find Me In Facebook
Koko Robert
I Was Hacking
|GOLD| Pokemon Jewel Version

Offline

#47 2015-11-02 16:00:39

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 3,138/3,578

Re: Pokemon G/S Flags

LeaderKoko wrote:
Miksy91 wrote:
LeaderKoko wrote:

Miksy, can u help me ??

You could start off by watching my video tutorials for instance. Or if you can't watch any, or feel like reading instead to learn, check the other tutorials in gen II section and start off simple.

its only textbox problem, how to change textbox color ?

No offense, but... why on earth would you ask about textboxes in a thread dealing with flags used in scripting?

Offline

#48 2015-11-02 16:26:08

Skurbert
Member
Registered: 2012-12-16
Post 88/95

Re: Pokemon G/S Flags

Miksy91 wrote:

Yeah, like comet said there.
Anyway, are you using Windows or some other operating system for rom hacking? If Windows, you can use VBA's Memory Viewer to see contents of RAM, and specifically, which bit in ram is modified when you use setbit1 command or clearbit1 (Gold/Silver scripting command).

setbit1 0x3848 should set the first bit in address $dec0. So make some person's script execute this command when talked to and make sure the contents of DEC0 doesn't have first bit as set (for example, DEC0 = 00). During the script, the value in DEC0 should be its original value + 1. For another test to see how things work, make some person event have 0x3848 as its flag/bit number. Make that person disappear in a script and it should write to DEC0 the same way it does by executing command 'setbit1 0x3848'.

Until you get the hang of it, you should beforehand calculate, which byte should change when some 'setbit1' or 'clearbit1' command is executed during a script. Then make sure that command does exactly what you want it to do by having Memory Viewer on with 'automatic update' setting enabled.

Yes, I'm a Windows guy.

Problem is, I do the scripting directly in hex, I don't use PKSV or any scripting utilities outside of hex. And when you write 'setbit 1' I don't quite understand how I would translate that into hex. But, yeah, I think I'm just about to the the hang off this. One Address = 8 bits - Must point to each different bits - Must specify through setbit commands, which, in turn is written BEFORE the bitnumber. Right?

I guess it's time for some repointing again. Damn it. I made the perfect Gyarados script from scratch using, as you would say, an "incorrect bitnumber", pointing to conflicting parts in WRAM. There's no room for any extra bytes so I would have to use the flag 38 48 and "waste" 7 bytes on that script. Not to mention all the trainers out there who needs a new bitnumber AND repointing. Yeah, I'm sooo EXCITED about changing that. :-)

I turned on the Automatic setting anyway. Better! Something's actually happening now!

Anyway, I'm tired. Goodnight.

Offline

#49 2015-11-03 22:05:41

Miksy91
Member
Registered: 2010-10-16
Post 2,203/2,339

Re: Pokemon G/S Flags

Skurbert wrote:

Problem is, I do the scripting directly in hex, I don't use PKSV or any scripting utilities outside of hex. And when you write 'setbit 1' I don't quite understand how I would translate that into hex. But, yeah, I think I'm just about to the the hang off this.

See here: http://hax.iimarck.us/files/scriptingco … tm#Marke33
That's 'setbit1' command you can write with pksv. So in other words, just byte '33' in a script.

Feel free to ask more questions if you need. But anyway, scripting with pksv is rather simple and besides, it's practically impossible to write complicated routines with a hex editor without any kind of simpler way to read what the byte code you write does.

Code like this is easy: 6A 47 4C xx yy 4E 09 zz zz 4C xx yy... which is just making somebody face you, talk a few words, ask you to say yes or no and if you answer no, tells you a few more words and the script continues somehow. However, when you want to make something more complicated (like several choices during the script depending on where you for example face at the moment, or by the location of the player (or some flag values that may or may not be set at the time when the script is run), you can't really follow what will happen in the game if you write the script code with a hex editor.

So try to learn to write script code with pksv instead. You can check some existing scripts and see, what are the names of different commands that refer to those of scripting compendium. For example, checking if 'RAM' (= a specific address in ram where several predefined scripting routines that you can call with those byte codes) equals '03', jump to address determined by pointer '2A 56' can be done with pksv by saying 'if == 0x3, 0x562A'.
Same in hex (from the compendium): 06 03 2A 56 (where 06 refers to script code '06').

Last edited by Miksy91 (2015-11-03 22:07:10)

Offline

#50 2015-11-05 07:09:42

Skurbert
Member
Registered: 2012-12-16
Post 89/95

Re: Pokemon G/S Flags

Miksy91 wrote:

So try to learn to write script code with pksv instead. You can check some existing scripts and see, what are the names of different commands that refer to those of scripting compendium. For example, checking if 'RAM' (= a specific address in ram where several predefined scripting routines that you can call with those byte codes) equals '03', jump to address determined by pointer '2A 56' can be done with pksv by saying 'if == 0x3, 0x562A'.
Same in hex (from the compendium): 06 03 2A 56 (where 06 refers to script code '06').

It tend to overthink/overanalyze too much, when the solution is mostly very simple and right there in front of my nose. When I re-read your earlier posts, much of it makes perfectly sense, while some of it seems utter confusing. Now that I understand how a single address consists of 8 bytes, it's easy to understand , but it was very hard to understand before I got this.

Let's say I start with the first 'safe' usable flag 0x3848. Should I write it [38][48] or should I write it [48][38]?

Example:

[33][38][48] or [33][38][48]? Should I even use a 'checkbit' command somewhere in between? An example would be nice. Also, the Little Endian confuses me how to count the next address (after using the first 8 ones). Would I count it 38 48, then 38 49, or is it 38 48 then 39 48, etc.

I have another quick question: Would I also have to disable the NPC-trades in my hack, or would it affect the linkbattle stuff/trades only?

I will learn to use Pksv in the future, but right now I'm going with the more "basic" (i.e. less advanced) stuff, so PKSV in not my main priority at the moment. I'm just scratching the surface, but If I win a couple millions on a lottery, I would definitely hire someone to add important ASM-stuff to my hack. :-)

Offline

Board footer

Powered by FluxBB