Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2012-11-26 01:06:30

delpo
Member
Registered: 2012-11-26
Post 1/40

Can you expand the rom (GSC)?

I'm worried that when I change the graphics for trainers that the new data will be larger than the original data being overwritten.  I can't find any free spaces in the rom that are large enough to contain new graphics data.

Can you expand the rom so that you can just add new things at the end?

Offline

#2 2012-11-26 01:34:18

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 1,967/3,512

Re: Can you expand the rom (GSC)?

Considering there are several banks near the end that are almost (or completely) empty, I highly doubt that you will have trouble finding free space just to insert trainer sprites.

However, if you are coming from hacking the advance games and think that you need to search for "FF" as free space, that would explain why you think there is no free space. In Gameboy roms, free space is "00" not "FF".
I've never had to expand the rom, and most people don't have to either. Koolboyman did with Prism, and it is possible, but you will lose the RealTime Clock, and it is usually not necessary.

Offline

#3 2012-11-26 02:40:54

delpo
Member
Registered: 2012-11-26
Post 2/40

Re: Can you expand the rom (GSC)?

Mateo wrote:

Considering there are several banks near the end that are almost (or completely) empty, I highly doubt that you will have trouble finding free space just to insert trainer sprites.

However, if you are coming from hacking the advance games and think that you need to search for "FF" as free space, that would explain why you think there is no free space. In Gameboy roms, free space is "00" not "FF".
I've never had to expand the rom, and most people don't have to either. Koolboyman did with Prism, and it is possible, but you will lose the RealTime Clock, and it is usually not necessary.

Okay I see what you're talking about.

So now im confused about some other things.  Take this example.  Let's say I am editing a gym leader's pokemon who originally has 4 pokemon, but I want him to have 6.  I would need to repoint this data elsewhere because there is no room to add 2 more pokemon's data in this location of the rom. In order to do this, do I need to find where the pointer for this leader's pokemon data is, and change that pointer to point elsewhere?  Or do I need to put my own pointer in the area where the leader's pokemon data originally was in?

Also, i think i remember reading that graphics data had to be in a particular bank, not just any bank?  Also, by bank, do you mean, for example, F bank would be the region from offset F0000 to FFFFF?  Lastly, why does expansion lose the rtc?

Offline

#4 2012-11-26 02:53:38

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 1,969/3,512

Re: Can you expand the rom (GSC)?

Banks are discussed more fully in a separate thread, so I won't go into that here. But I'll try to answer the other questions.

Whether or not graphics have to be in the same bank or not depends on the routine they are being called from. Tilesets, Pokemon pics, and Trainer pics can be anywhere, because each of them is referenced by a 3-byte pointer (meaning that the bank is specified with the pointer). Some others, such as the player's back sprite need to be in the same bank because they are referenced by a 2-byte pointer, which can only point within the same bank.

Trainer editing has an entire tutorial dedicated to it already in the Gen II section. Since a Gym Leader is the only trainer listed for his class, you would just repoint that class and you would be able to add new Pokemon to his or her roster easily. Other trainers would be more time consuming, since you have to repoint the entire trainer group, not just individual trainers.

The reason expansion loses the rtc is because of the way the gameboy's memory mapping works. The memory maps that support 4mb cartridges do not support an rtc the way the one the game currently uses does.

A good place for you to start (which has links to the threads I mentioned in this post) is kkj1116's Global FAQ and Resource Thread

Offline

#5 2012-11-26 03:15:07

delpo
Member
Registered: 2012-11-26
Post 3/40

Re: Can you expand the rom (GSC)?

Mateo wrote:

Banks are discussed more fully in a separate thread, so I won't go into that here. But I'll try to answer the other questions.

Whether or not graphics have to be in the same bank or not depends on the routine they are being called from. Tilesets, Pokemon pics, and Trainer pics can be anywhere, because each of them is referenced by a 3-byte pointer (meaning that the bank is specified with the pointer). Some others, such as the player's back sprite need to be in the same bank because they are referenced by a 2-byte pointer, which can only point within the same bank.

Trainer editing has an entire tutorial dedicated to it already in the Gen II section. Since a Gym Leader is the only trainer listed for his class, you would just repoint that class and you would be able to add new Pokemon to his or her roster easily. Other trainers would be more time consuming, since you have to repoint the entire trainer group, not just individual trainers.

The reason expansion loses the rtc is because of the way the gameboy's memory mapping works. The memory maps that support 4mb cartridges do not support an rtc the way the one the game currently uses does.

A good place for you to start (which has links to the threads I mentioned in this post) is kkj1116's Global FAQ and Resource Thread

Okay, thanks for your help thusfar.  I'll definitely check out that faq.

Offline

#6 2012-11-26 03:18:49

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 1,971/3,512

Re: Can you expand the rom (GSC)?

No problem, and good luck with your hacking.

Offline

#7 2012-11-29 00:18:30

delpo
Member
Registered: 2012-11-26
Post 4/40

Re: Can you expand the rom (GSC)?

Alright so I really want to remove the different music that plays when you switch to your bike or when you surf and just have the normal bgm continue to play.  I've tried searching for a way to do this, but I don't think there is anything about it specifically.  While IIMarckus does have a thread about changing battle music, I don't think this is the same kind of thing and also the surf music isn't even on the list he provided here http://hax.iimarck.us/post/6561/#p6561 although it does have the bicycle music.  Thank you.

Offline

#8 2012-12-01 06:26:41

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

Re: Can you expand the rom (GSC)?

a good place to start with surf music is part of the script special that plays it (special $3c):

GetContextMusic: ; 3d62
; return carry if matched context

; surfing?
    ld a, [PlayerState]
    cp PLAYER_SURF
    jr z, .surf
    cp PLAYER_SURF_PIKA
    jr z, .surf
    
; bug contest time up?
    ld a, [$d84d]
    bit 2, a
    jr nz, .checkcontest
    
.quit
    and a
    ret
    
; 3d0ea
    ld de, MUSIC_BICYCLE
    scf
    ret
    
.surf
    ld de, MUSIC_SURF
    scf
    ret
.checkcontest
    ld a, [MapGroup]
    cp GROUP_ROUTE_35_NATIONAL_PARK_GATE
    jr nz, .quit
    ld a, [MapNumber]
    cp MAP_ROUTE_35_NATIONAL_PARK_GATE
    jr z, .contest
    cp MAP_ROUTE_36_NATIONAL_PARK_GATE
    jr nz, .quit
.contest
    ld de, MUSIC_BUG_CATCHING_CONTEST_RANKING
    scf
    ret
; 3d97

this function checks whether the music should be changed and sets the carry flag (scf) if so. so all you would need to do is replace the scf under .surf with

and a

, which resets the carry flag instead.

as for the bike, you can see there's code for it in this function, but it's not actually used. if it was you'd have the bike music starting up seemingly at random in some scripts.

instead, it's built directly into the bike item code at $d0bc (crystal)

ItemBicycle: ; d0bc
call $5121
...

; d0da
    xor a
    ld [MusicFade], a
    ld de, MUSIC_NOTHING
    call StartMusic
    call DelayFrame
    call MaxVolume
    ld de, MUSIC_BICYCLE
    ld a, e
    ld [CurMusic], a
    call StartMusic

...

deleting this part will do the trick

Offline

#9 2012-12-01 22:30:06

delpo
Member
Registered: 2012-11-26
Post 8/40

Re: Can you expand the rom (GSC)?

comet wrote:

a good place to start with surf music is part of the script special that plays it (special $3c):

GetContextMusic: ; 3d62
; return carry if matched context

; surfing?
    ld a, [PlayerState]
    cp PLAYER_SURF
    jr z, .surf
    cp PLAYER_SURF_PIKA
    jr z, .surf
    
; bug contest time up?
    ld a, [$d84d]
    bit 2, a
    jr nz, .checkcontest
    
.quit
    and a
    ret
    
; 3d0ea
    ld de, MUSIC_BICYCLE
    scf
    ret
    
.surf
    ld de, MUSIC_SURF
    scf
    ret
.checkcontest
    ld a, [MapGroup]
    cp GROUP_ROUTE_35_NATIONAL_PARK_GATE
    jr nz, .quit
    ld a, [MapNumber]
    cp MAP_ROUTE_35_NATIONAL_PARK_GATE
    jr z, .contest
    cp MAP_ROUTE_36_NATIONAL_PARK_GATE
    jr nz, .quit
.contest
    ld de, MUSIC_BUG_CATCHING_CONTEST_RANKING
    scf
    ret
; 3d97

this function checks whether the music should be changed and sets the carry flag (scf) if so. so all you would need to do is replace the scf under .surf with

and a

, which resets the carry flag instead.

as for the bike, you can see there's code for it in this function, but it's not actually used. if it was you'd have the bike music starting up seemingly at random in some scripts.

instead, it's built directly into the bike item code at $d0bc (crystal)

ItemBicycle: ; d0bc
call $5121
...

; d0da
    xor a
    ld [MusicFade], a
    ld de, MUSIC_NOTHING
    call StartMusic
    call DelayFrame
    call MaxVolume
    ld de, MUSIC_BICYCLE
    ld a, e
    ld [CurMusic], a
    call StartMusic

...

deleting this part will do the trick

Wow, thanks for this!  So to make these edits, do I just need to find and modify the scripts using PKSV, or do I need to change it using ASM?  If it's the scripts, what are the exact script locations in Gold/Silver?

Thanks a lot!

Offline

#10 2012-12-02 02:52:15

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

Re: Can you expand the rom (GSC)?

They don't look like scripts to me. It's asm.

GetContextMusic is at $3f40 in Gold. ItemBicycle is at $d0c9, so the part that changes the music is at $d0e7.

Last edited by comet (2012-12-02 02:52:56)

Offline

#11 2012-12-02 04:52:37

delpo
Member
Registered: 2012-11-26
Post 10/40

Re: Can you expand the rom (GSC)?

Thank you very much Comet, I got both to work!

Last edited by delpo (2012-12-02 08:48:26)

Offline

Board footer

Powered by FluxBB