Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#51 2011-01-21 02:44:16

Riverside
Member
Registered: 2010-12-12
Post 19/55

Re: Noob trying to hack Crystal (Help)

IIMarckus wrote:
Riverside wrote:
IIMarckus wrote:

The event data is always in the same bank as the blockdata. Notice that the blockdata is in bank 6A.

Yeah but... hmmm... what I mean it's that the Event Data Pointer it's in 94DE1 in form 4D 43, because it's 2 byte pointer shouldnt the Event Data (where it's pointing) be in bank 25 aswell?

Don’t think of it as a “two‐byte pointer,” think of it as “part of a five‐byte set of two pointers.” Two pointers, both of which are in the same bank.

Oh, oh, I think I got it >_<

Let me see, so the Script header and the Event header share the same Bank byte, right?

That means if I repoint the event header like I'm going to, I'll have to repoint the script header to the same bank

If I'm right, sorry for troubling you all, and thanks.

Last edited by Riverside (2011-01-21 02:44:52)

Offline

#52 2011-01-21 03:01:01

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

Re: Noob trying to hack Crystal (Help)

RIght, if you repoint one to another bank you will have to repoint the other as well.

Offline

#53 2011-01-21 14:19:22

Riverside
Member
Registered: 2010-12-12
Post 20/55

Re: Noob trying to hack Crystal (Help)

EDIT: I tried again and this time I only repointed the Event Header. It worked fine this time :) I'll have to try with the Script header too though, because I may end up using it someday... even so, I still don't know where I messed up before
EDIT 2: I repointed the Event header and then replaced the Script header ($1A8000 - $1A800C) with 00's. Nothing really happens :S the game runs normally

--------------------------------------------------------------------------------------------------------------------

Hmm...

I suspected something like this would happen, damnit.

In the end I decided to repoint the data to $1AB88B since it's in bank 6A...

First, I went to the 2nd map header and followed the pointers to both the Script header and Event header, I ended up discovering that the Script header is in $1A8000 and the Event Header in $1A834D, then I figured out how many bytes composed each header. I ended up getting a Script Header of only 12 bytes and an Event Header of 104 bytes (including 5 extra bytes I added (I wanted to add a warp to a house))

Long story short, I replaced $1A8000  and $1A834D with 00's and copied the bytes to $1AB88B and $1AB897 and now everytime I try to enter New Bark Town the game freezes. Any idea about what's going on?

Because I repointed the data to the same bank, it shouldn't affect all the 2-byte pointers included in the headers...

I'm guessing the problem may be in the pointers I used in the secondary map header because even without events and scripts, the map should still load right?

I calculated and 6A 8B78 for $1AB88B and 6A 9778 for $1AB897 (It has to start here because the pointer for the event header is supposed to point 2 bytes before the actual structure starts, according to the guide and what I've seen) and it seems like the pointers are right, so... I dont know...

In this post I've explained all I did. If there's any pointer that I have to replace and I missed or something, then please tell me

Last edited by Riverside (2011-01-22 00:05:29)

Offline

#54 2011-01-23 01:15:56

Riverside
Member
Registered: 2010-12-12
Post 21/55

Re: Noob trying to hack Crystal (Help)

Hmm... quick question...

I want to decompress the map for Elm's house ($1B43E) so I can make a little twist there... but I don't know how Agixp or Lunar compress works. Any little guide for dummies? :S

Also thanks, I repointed the events successfully. I still need work to do, but I finally learned how to add events to a map.

Last edited by Riverside (2011-01-23 01:17:15)

Offline

#55 2011-01-23 07:56:29

Miksy91
Member
Registered: 2010-10-16
Post 264/2,306

Re: Noob trying to hack Crystal (Help)

Decompress ???

If you're about to put some other data in there, just repoint the map data to another bank as the pointer is of 3-bytes.
Then, tell the game specifics of the map (X,Y) and start re-forming the map :)

Also, I would change all the map blocks of elm's house to 00 so that you can clearly tell where the data starts and where it ends in case you want to use it.

Offline

#56 2011-01-23 09:24:27

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

Re: Noob trying to hack Crystal (Help)

I'm also thinking when he said decompress the map, he actually meant the tileset. Agixp (at least for me anyways) Tends to not work with Crystal. Lunar Compress I've never used, so I can't actually help you there but I would think someone else here would be able to.

Offline

#57 2011-01-23 10:03:51

Riverside
Member
Registered: 2010-12-12
Post 22/55

Re: Noob trying to hack Crystal (Help)

Oh yeah, I want to decompress the tileset >_< what I want to do is modify one existing tile like I did with new bark town.

Offline

#58 2011-01-25 02:37:22

Riverside
Member
Registered: 2010-12-12
Post 23/55

Re: Noob trying to hack Crystal (Help)

Forget the decompressing stuff. I got another way to do what I wanted (kinda)

Anyways, I got a little problem using scripts...

I repointed the Event Header for Hiro's house upstairs to $7B740.

I added a signpost in the place where the PC is and now I want it to say "You shouldn't mess with someone else's PC!", but I can't... I don't know how.

I tried this...

The "signpost structure" I want to add to the PC 0B 02 00 [2BYTEPOINTER 1] (2 byte pointer to script)  and its located in 7B76D

Then, there's a structure for each... script? I dont know how it's called (47, 4C, 4B, etc) but all of them have a byte called 2byte text pointer, I'll call it [2BYTEPOINTER 2] (2byte text pointer) and its located in 7B7B0

Also, in the guide it says the form for the text is [00][Text][0x50 (ends code)]

So if I want it to say "sdfsdf" or any other random word (just to test) the form should be [00] ["bytes for sdfsdf"] [50] right? This is located in 7B7C0. Im not sure about what "0x50 means though... Im not familiar with the terminology yet (I only know $ means offset) and maybe I'm wrong there.

What I've done so far is finding a 2 byte pointer for the text (7B7C0), the [2BYTEPOINTER] 2 and once I find it, find a 2 byte pointer for 7B7B0, [2BYTEPOINTER 1] and put it into the [2 byte pointer to script byte] in "signpost structure" which begins at 7B76D

So far I've been able to load the text, but it loads in a glitchy way and it can't be canceled. Once the text starts it never ends and sometimes the ROM crashes.

I've been trying with the "scripts" (Im still not sure if thats how they're called) 47, 4B, 4C, 51, 52, 53 and some of them kinda worked as I said (they glitch but I can see part of the text I want to insert) but no one of them can be seen like it should be and can't be cancelled with the bottom B

Offline

#59 2011-01-25 04:10:41

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

Re: Noob trying to hack Crystal (Help)

The easiest way to make a sign that just says something is to have the signposts script pointer point to 52 XX XX, where XX XX is a 2byte pointer to the text, in the format 00 (text) 57 00

Offline

#60 2011-01-25 07:25:10

Tauwasser
Member
Registered: 2010-10-16
Post 86/447

Re: Noob trying to hack Crystal (Help)

Actually, and I think I documented this somewhere, it works as follows:

The 0x00 is an in-text-command. It will actually just write regular text. In-Text-Commands 0x00 is cancelled via 0x50. After that, another in-text-command can be placed (like 0x08 for ASM, or 0x01 for writing a string from RAM etc.). However, if you want to end text display, you will need to cancel out of that option, too, which is what another 0x50 will do. 0x57 will set the routine up so it exits command 0x00 and then reads a 0x50 for the next script code, so the in-text routine therefore ends and with it text display. 0x58, for that matter, does the same, but waits for a key press or a delay. It seems there is a register, D042 (valid values 00―03):

  • 00 - Wait for key press, blinking cursor

  • 01 - cursor, wait delay

  • 02 - cursor, wait delay

  • 03 - no cursor, wait delay

The delay is 0x41 vblanks. It seems to be related to link battles, probably as part of synchronizing with the rest of the engine, so it doesn't depend on the player input.
Anything after that does not play a role in showing text, so the last 0x00 in Mateo's format is superfluous.

cYa,

Tauwasser

Last edited by Tauwasser (2011-01-25 07:32:34)

Offline

#61 2011-01-25 15:07:50

Riverside
Member
Registered: 2010-12-12
Post 24/55

Re: Noob trying to hack Crystal (Help)

Mateo wrote:

The easiest way to make a sign that just says something is to have the signposts script pointer point to 52 XX XX, where XX XX is a 2byte pointer to the text, in the format 00 (text) 57 00

Well, I tried it and it doesn't work... when I press A in front of the PC it shows a lot of "???????" and then when I press B to close that text box, the game crashes.

Here's a more graphical example of what I did.

http://img62.imageshack.us/img62/742/654q.png

Tauwasser wrote:

Actually, and I think I documented this somewhere, it works as follows:

The 0x00 is an in-text-command. It will actually just write regular text. In-Text-Commands 0x00 is cancelled via 0x50. After that, another in-text-command can be placed (like 0x08 for ASM, or 0x01 for writing a string from RAM etc.). However, if you want to end text display, you will need to cancel out of that option, too, which is what another 0x50 will do.

So in other words I should replace the 57 00 Mateo told me for 50 50?

0x57 will set the routine up so it exits command 0x00 and then reads a 0x50 for the next script code, so the in-text routine therefore ends and with it text display. 0x58, for that matter, does the same, but waits for a key press or a delay. It seems there is a register, D042 (valid values 00―03):

  • 00 - Wait for key press, blinking cursor

  • 01 - cursor, wait delay

  • 02 - cursor, wait delay

  • 03 - no cursor, wait delay

The delay is 0x41 vblanks. It seems to be related to link battles, probably as part of synchronizing with the rest of the engine, so it doesn't depend on the player input.
Anything after that does not play a role in showing text, so the last 0x00 in Mateo's format is superfluous.

cYa,

Tauwasser

Well, I didnt understand what you say enterely since I dont know what is a vblank or what does that D042 means, but oh well...

Offline

#62 2011-01-25 20:52:49

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

Re: Noob trying to hack Crystal (Help)

Well part of your problem would be that the pointer to 7B7B0 is B077 not B070.

the 57 00 as opposed to 50 is not the problem. Practically every person or sign in the game ends their text with 57 00. If I remember, 57 00 ends the string and then is just done, wheras 50 would also try to load the next string immediately following it or something, but I might be wrong. Either way, try fixing the pointer first and let us know what happens.

Offline

#63 2011-01-25 22:07:13

Riverside
Member
Registered: 2010-12-12
Post 25/55

Re: Noob trying to hack Crystal (Help)

EDIT: OK I GOT THIS.

It was really easy in the end. the script code 52 seems to be missing something. it works like this

[52] [Text bank] [2byte text pointer], in the guide it was missing the [text bank]

So yeah, now it finally works!

---------------------------------------------

oh wow, I must be really tired (I am)

Anyways, fixing the pointer + using the script code form 4B 1E C077 ([4B] [Text bank] [2byte text pointer]) results in this

http://img441.imageshack.us/img441/9448/whym.png

(Yeah, I want it to test this with the word "hola amigos")

So it kinda reads the text, but it does this for like 1 second and then the game crashes. (Plus it havent readed it right)

If I use the script code 52 (52 C077) the game reads a lot of "?????" and then craches when I press B

Last edited by Riverside (2011-01-25 22:11:36)

Offline

#64 2011-01-25 22:16:00

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

Re: Noob trying to hack Crystal (Help)

Glad you got it working mate. I'm sorry about not mentioning the bank byte, it doesn't need it in Gold so I'm guessing that must be one of the ones that changed a bit in Crystal

Offline

#65 2011-01-25 22:44:47

Tauwasser
Member
Registered: 2010-10-16
Post 87/447

Re: Noob trying to hack Crystal (Help)

Riverside wrote:

EDIT: OK I GOT THIS.

It was really easy in the end. the script code 52 seems to be missing something. it works like this

[52] [Text bank] [2byte text pointer], in the guide it was missing the [text bank]

See here. Crystal has some stuff changed...

Basically, you can add all those things to little changed in the code that really mess scripting up if you script according to my Gold/Silver only doc. Try looking at some other scripts to get the gist of it.

Also, as I have mentioned before, you only need 0x57 at the end of a string, no 0x00 after it. Usually text is compiled into one big chunk, therefore a lot of 0x57 0x00 combinations occur, due to the fact that one string ends and another one with code 0x00 stats.

cYa,

Tauwasser

Offline

#66 2011-01-28 06:44:59

Riverside
Member
Registered: 2010-12-12
Post 26/55

Re: Noob trying to hack Crystal (Help)

Ok, so now I want to create an event...

I got the bytes to create events from the compendium, but I want to insert an overworld sprite into the game and I dont know how. Guige's guide only says how to replace an existing sprite.

I'm guessing I will have to repoint the graphics data or something like that, but I'm not sure...

Also, what's the size of an overworld sprite? I don't want to make my sprites too big.

Offline

#67 2011-01-28 11:41:44

Tauwasser
Member
Registered: 2010-10-16
Post 88/447

Re: Noob trying to hack Crystal (Help)

If you want to create a new overworld sprite from scratch, you will have to mess with the sprite definition lists (German).

Basically, go to the offset for the first sprite definition list (05:4736). You will have to find all pointers (05:4240, 05:42AD) to this list and repoint the list to somewhere with more available space (the end of the rom bank suffices, luckily). Then add one entry to it for your new sprite. The graphics can literally be anywhere in the rom, as long as you follow the same order of tiles. A person is usually 2×2 tiles, so you have 16×16 pixels to work with for each animation (standing front, standing side, standing back, walking front, walking side, walking back).
There might be complications inasmuch as the game might check if some event uses a legal sprite number. I'm not sure if it does, so be aware of that. Also, use an indoor map for debugging this, so you don't have to mess with sprite sets.

cYa,

Tauwasser

Last edited by Tauwasser (2011-01-28 11:43:46)

Offline

#68 2011-01-28 14:56:44

Riverside
Member
Registered: 2010-12-12
Post 27/55

Re: Noob trying to hack Crystal (Help)

Tauwasser wrote:

If you want to create a new overworld sprite from scratch, you will have to mess with the sprite definition lists (German).

Basically, go to the offset for the first sprite definition list (05:4736). You will have to find all pointers (05:4240, 05:42AD) to this list and repoint the list to somewhere with more available space (the end of the rom bank suffices, luckily). Then add one entry to it for your new sprite. The graphics can literally be anywhere in the rom, as long as you follow the same order of tiles. A person is usually 2×2 tiles, so you have 16×16 pixels to work with for each animation (standing front, standing side, standing back, walking front, walking side, walking back).
There might be complications inasmuch as the game might check if some event uses a legal sprite number. I'm not sure if it does, so be aware of that. Also, use an indoor map for debugging this, so you don't have to mess with sprite sets.

cYa,

Tauwasser

Well, it's not "from the scratch" at all... I got my sprites already done, don't know if that helps

mariru.png

Also, a quick noob question just to be sure.

When the guide says "offset 05:4736" it means Bank 5 (14000) + 4736 right? ($18736)

Offline

#69 2011-01-28 16:53:39

Tauwasser
Member
Registered: 2010-10-16
Post 89/447

Re: Noob trying to hack Crystal (Help)

Riverside wrote:

Well, it's not "from the scratch" at all...

But the data you want is essentially made from scratch, since you don't want to replace something. That's what I meant.

Riverside wrote:

When the guide says "offset 05:4736" it means Bank 5 (14000) + 4736 right? ($18736)

No. I keep using the term "offset", although technically there is no offset (as in between 0x0200 and 0x0534 is an offset of 0x0334) involved at all. Address would be the correct term. Addressing is essentially done (from the perspective of the code that gets executed) in the following way: They request a rom bank be mapped to the region 0x4000 thru 0x7FFF and do all their reading in this area when they want to read from ROM. The notation BB:HHLL reflects this. It's in bank BB and accessed via pointer HHLL. GB mappers (or MBCs, memory bank controllers) map from the rom chips in a known and easy way.
Some have quirks in them, such as MBC1, that cannot address certain memory in the ROM. However, MBC3 (the one Gold/Silver use) does linear addressing: Every 16kiB (0x4000 bytes) constitutes a rom bank from the beginning of the file through the end.
Therefore, address 05:4736 is actually 0x05 * 0x4000 + (0x4736 AND 0x3FFF) = 0x14000 + 0x0736 = 0x14736.

Be careful: rom bank 0x00 is always mapped to 0x0000 thru 0x3FFF, no matter what. MBC3 cannot map rom bank 0x00 to 0x4000 thru 0x7FFF, instead it will map rom bank 0x01 there upon request of rom bank 0x00. So working with pointers can be tricky when you don't know the exact programming behind it. For instance address 05:3245 always means offset 0x003245, since 3245 can always be read, no matter which rom bank gets mapped to what memory range.
However, address 00:4567 is ambiguous, since it is not clear what it would mean if you don't know the programming behind the routine.

cYa,

Tauwasser

Offline

#70 2011-01-28 22:02:11

Riverside
Member
Registered: 2010-12-12
Post 28/55

Re: Noob trying to hack Crystal (Help)

Tauwasser wrote:
Riverside wrote:

Well, it's not "from the scratch" at all...

But the data you want is essentially made from scratch, since you don't want to replace something. That's what I meant.

Riverside wrote:

When the guide says "offset 05:4736" it means Bank 5 (14000) + 4736 right? ($18736)

No. I keep using the term "offset", although technically there is no offset (as in between 0x0200 and 0x0534 is an offset of 0x0334) involved at all. Address would be the correct term. Addressing is essentially done (from the perspective of the code that gets executed) in the following way: They request a rom bank be mapped to the region 0x4000 thru 0x7FFF and do all their reading in this area when they want to read from ROM. The notation BB:HHLL reflects this. It's in bank BB and accessed via pointer HHLL. GB mappers (or MBCs, memory bank controllers) map from the rom chips in a known and easy way.
Some have quirks in them, such as MBC1, that cannot address certain memory in the ROM. However, MBC3 (the one Gold/Silver use) does linear addressing: Every 16kiB (0x4000 bytes) constitutes a rom bank from the beginning of the file through the end.
Therefore, address 05:4736 is actually 0x05 * 0x4000 + (0x4736 AND 0x3FFF) = 0x14000 + 0x0736 = 0x14736.

Be careful: rom bank 0x00 is always mapped to 0x0000 thru 0x3FFF, no matter what. MBC3 cannot map rom bank 0x00 to 0x4000 thru 0x7FFF, instead it will map rom bank 0x01 there upon request of rom bank 0x00. So working with pointers can be tricky when you don't know the exact programming behind it. For instance address 05:3245 always means offset 0x003245, since 3245 can always be read, no matter which rom bank gets mapped to what memory range.
However, address 00:4567 is ambiguous, since it is not clear what it would mean if you don't know the programming behind the routine.

cYa,

Tauwasser

Ok, thanks. I think I got it... but...

Excuse me if this is the dumbest question ever, but how did you get these 2 pointers?

Basically, go to the offset for the first sprite definition list (05:4736). You will have to find all pointers (05:4240, 05:42AD) to this list and repoint the list to somewhere with more available space

Because a 2 byte pointer for offset 14736 would be 36 47 and neither of those (05:4240 - Offset 14240) and (05:42AD - Offset 142AD) use 36 47

...now that I think about it, I think I didn't got it at all... but let's see >_<

Offline

#71 2011-01-28 22:32:46

Tauwasser
Member
Registered: 2010-10-16
Post 90/447

Re: Noob trying to hack Crystal (Help)

Umm, I looked for the pointers and found them for you. The two offsets are where the pointers are located ;)

cYa,

Tauwasser

Offline

#72 2011-01-29 17:45:14

Riverside
Member
Registered: 2010-12-12
Post 29/55

Re: Noob trying to hack Crystal (Help)

Ok, let's see... I was trying to figure this out...

There's 2 sprite definition list.

1.- 05:4736 (Offset 14736) (0x05 * 0x4000 + (0x4736 - 0x4000) = 0x14000 + 0x0736 = 0x14736)
2.- 05:4495 (Offset 14495)

We won't use the 2nd sprite definition list for now.

Basically, go to the offset for the first sprite definition list (05:4736). You will have to find all pointers (05:4240, 05:42AD) to this list and repoint the list to somewhere with more available space

The 2byte pointer for the first one it's 3647, located in offset 14241 (05:4241), not in 05:4240 so I assume you got confused in the other one too, which would be 05:42AE (offset 142AE) instead of 05:42AD.

Now, the structure of the sprite definition list it's:

[2byte pointer to Graphics] [length of the data] [Rombank graphics] [Image type] [standard-range]

If we start from offset 14736 that would mean the form of the 1st sprite definition list is [0040] [60] [30] [01] [00]

Now what... I got a 2byte pointer for the first sprite definition list (3647) and a 2byte pointer for the [image type] byte inside the 1st sprite definition list (3A47)... I have to repoint 0040 60 30 01 00 to somewhere else and then change those pointers?

sorry if Im not being very clear or if I misunderstood something, but I have to go in a moment and I'm in a hurry because of that

Offline

#73 2011-01-29 17:57:59

Tauwasser
Member
Registered: 2010-10-16
Post 91/447

Re: Noob trying to hack Crystal (Help)

Riverside wrote:

I assume you got confused

I posted the offsets of the ASM commands that deal with the pointers. It should be 0x21 LL HH at those offsets, which is ld hl, HHLL

Riverside wrote:

If we start from offset 14736 that would mean the form of the 1st sprite definition list is [0040] [60] [30] [01] [00]

It's a list of sprite definitions, therefore this is the first sprite definition. In Gold/Silver there are 0x60 of these in this list, in Crystal there are 0x67. So you will have to find space for at least 0x67 (the original ones) + 0x01 (the one you add) and put the whole list there.

Riverside wrote:

I got a 2byte pointer for the first sprite definition list (3647) and a 2byte pointer for the [image type] byte inside the 1st sprite definition list (3A47)[...]

Exactly. Change these two pointers so they access the data where you put the enhanced list.

cYa,

Tauwasser

Offline

#74 2011-01-30 01:05:51

Riverside
Member
Registered: 2010-12-12
Post 30/55

Re: Noob trying to hack Crystal (Help)

Ok, so I repointed the whole thing and surprisingly (for me) it worked, but now what should I do to create my sprite in the ROM? from the structure of the sprite definition thing, all I know it's that the "Image type" it's 0x01. Do I need to use the script compendium or something in order to create the sprites?

Offline

#75 2011-01-30 09:12:46

Tauwasser
Member
Registered: 2010-10-16
Post 92/447

Re: Noob trying to hack Crystal (Help)

You need to put your graphics into the ROM and calculate a 3byte pointer to the offset where you put it. Then determine image type and data length and standard palette and put it into a new entry in the list. Then put it on some map and you're done.

cYa,

Tauwasser

Offline

Board footer

Powered by FluxBB