Random Questions Pertaining to Zelda 3 Hacking

View previous topic View next topic Go down

Random Questions Pertaining to Zelda 3 Hacking

Post by Jeimuzu on Mon 23 Oct 2017 - 12:22

I figured since I ask a lot of questions, I should keep them within the confines of a single thread. I have many questions to ask, but I will try to ask no more than a handful at a time. Moreover, I’ll do my best to search the forum just to be sure my questions haven’t been answered already. I’ll start off by discussing items obtained by sprites.

I'd like to change the items provided by the Catfish, the blue chest, the Great Fairies, King Zora, and a couple of shops. Is there any documentation already available on this?

I did manage to find a thread posted by con that covers some items obtained by sprites including the bug-catching kid which I also needed. I was able to change the items, but not the corresponding ram bytes as I don’t have a list of those (apparently they’re not the same as the bytes representing the items themselves). Here’s Con’s post: [You must be registered and logged in to see this link.]

According to con, the Catfish and King Zora are a bit more difficult. But to me, it doesn't seem as though the great fairies and the blue chest would be much harder than the bug-catching kid. I could see the shops being a bit more difficult because many of them use the same sprite despite offering different items. That said, I’d like for one shop to sell the net while another one sells the shovel.
avatar
Jeimuzu



Since : 2015-10-01

Back to top Go down

Re: Random Questions Pertaining to Zelda 3 Hacking

Post by Puzzledude on Mon 23 Oct 2017 - 16:45

This is not so easy as you think. You need to not only hack the actualy gaining sprite/item, you need to hack the gfx of the sprite, which is a pain to do. This was yet not done in ALTTP, but Karkat has mannaged to do this on Japan version while making randomizers. He used heavy ASM to pull this of. Thus now in the randomizers you can see King Zora throwing another item with correct gfx and then Link holding it above his head. Same for other things given by other sprites. This is a difficult task unfortunately and will require a coder (ASM person) and a good one too.
avatar
Puzzledude



Since : 2012-06-20

Back to top Go down

Re: Random Questions Pertaining to Zelda 3 Hacking

Post by Conn on Mon 23 Oct 2017 - 17:16

I definitely won't let me draw into another zelda game project (from this I am surely retired), but if it helps I did something that you require some years ago. Dunnno whether it can be adapted to your needs.

In this patch:
[You must be registered and logged in to see this link.]

I also added a short tutorial how you can replace the flute to dig up to the book mudora (the item thrown at you should be similar, in Conker I made it that the dog (king zora) throws the bug catching net (feather at you). But this is too long ago to remember what I did..

Anyways, my notes to change flute to book mudora to dig (check the readme in above patch:

3.1 Get the new sprite to dig up
This address let’s you dig up the Book Mudora:
Load GFX:
First the screen the tile is loaded at pc: 04/8C98: 0c (snes 09/8C98)
$09/8C97 A9 0C       LDA #$0C
0c is the hex key for the flute (dunno about which key it uses, you need to try it out).

Then the palette is loaded with pc: 04/5027: 04 (snes 08/d027)
$08/D026 A9 04       LDA #$04          
04 means blue palette. 02=red, 08=green

3.2 Hold the correct sprite in your hand after pick up
The flute value is 14. You can check which value your item has by using HM; place an item in your chest:

The flute is Dec=20, calculate to Hex=14. That easy.
You can set up the item to hold in your hand (and get in your inventory) by changing pc: 04/4ff6: 14 (snes: $08/CFF6)
$08/CFF5 A0 14       LDY #$14  
14 means the flute is addressed. Book mudora for example  is dec=23, hex=17 and so on.

avatar
Conn



Since : 2013-06-30

Back to top Go down

Re: Random Questions Pertaining to Zelda 3 Hacking

Post by Jeimuzu on Mon 23 Oct 2017 - 22:53

Puzzledude wrote:This is not so easy as you think. You need to not only hack the actualy gaining sprite/item, you need to hack the gfx of the sprite, which is a pain to do. This was yet not done in ALTTP, but Karkat has mannaged to do this on Japan version while making randomizers. He used heavy ASM to pull this of. Thus now in the randomizers you can see King Zora throwing another item with correct gfx and then Link holding it above his head. Same for other things given by other sprites. This is a difficult task unfortunately and will require a coder (ASM person) and a good one too.
You are correct.  I didn’t realize ASM would be required for this. Embarassed   And if King Zora is difficult then I’d imagine the same applies to the Catfish.  Do shops and great fairies require ASM?

Conn wrote:I definitely won't let me draw into another zelda game project (from this I am surely retired), but if it helps I did something that you require some years ago. Dunnno whether it can be adapted to your needs.
No worries.  I actually plan on using this for heart pieces, and perhaps other items.  So it will suit a number of needs quite nicely.  I also plan on using countless other ASM and bugfixes you’ve developed.  For that, I’m sincerely grateful. Smile

Conn wrote:In Conker I made it that the dog (king zora) throws the bug catching net (feather at you). But this is too long ago to remember what I did..
Hmmm… Would you happen to know where this ASM might be?  It doesn’t seem to be included with the Conker ASM files (unless it’s labeled something I wasn’t expecting).  If not, then it’s no big deal.  Odds are I wouldn’t even know what to do with it as I’m sure it involves more than just changing a couple of bytes.
avatar
Jeimuzu



Since : 2015-10-01

Back to top Go down

Re: Random Questions Pertaining to Zelda 3 Hacking

Post by Conn on Tue 24 Oct 2017 - 0:12

well, it is only a change of a couple of bytes, but it is all hardcoded. I traced for flippers, to give you a green flute:

First part: trigger the zora king sprite:
$06/8F0F AF 56 F3 7E LDA $7EF356[$7E:F356]

This one checks whether you already have the flippers, if, king zora will not appear (spawn).
-> change pc 03/0f0f to af 4c f3 7e (note, you cannot have flute/shovel in your inventory then to let Zora appear of course

Second part: flute sprite on screen:

$1D/E1E4 A9 11       LDA #$11                A:0030
$1D/E1E6 22 ED D4 00 JSL $00D4ED[$00:D4ED]  
11 is the flippers. From my digging code I know that 0c is the flute, so I change pc 0e/e1e5 to 0c
(I do not know where these values come from, could be a graphic index which you may find out (count) with zcompress).


$1D/E1D2 A9 54       LDA #$54
This determines the color (04 means blue palette. 02=red, 08=green) , we want green so change pc $0E/E1D3 54 ->58

If you did everything right, Zora throws the green flute at you:

[You must be registered and logged in to see this link.]

Third part: item in your hand and inventory:



$1D/E1C2 A9 1E       LDA #$1E              
$1D/E1C4 9D 90 0D    STA $0D90,x[$05:0D9D]
1e is the hm code for flippers, item 30. We want the flute 74 (hex 4a), so
pc 0e/e1c3: 1e -> 4a
This automatically sets the correct flute ram (7ef34c-03)


$08/C6A4 BF 9C 84 09 LDA $09849C,x[$09:84E6] A:0024
$08/C6A8 10 02       BPL $02    [$C6AC]      A:0002
$08/C6AC 0A          ASL A                   A:0002
$08/C6AD 09 30       ORA #$30                A:0004
04 means blue palette. 02=red, 08=green but be careful as the value gets doubled with ASL A. So to get a green palette, you need to change snes 09:84e6 (pc 04/84e6: 02 -> 04)

Now you are done:
[You must be registered and logged in to see this link.]

If you encounter problems following this trace instructions, you need to find somebody with deeper asm knowlege...
avatar
Conn



Since : 2013-06-30

Back to top Go down

Re: Random Questions Pertaining to Zelda 3 Hacking

Post by Jeimuzu on Tue 24 Oct 2017 - 16:15

I got it to work!

I also managed to get King Zora to give you the moon pearl.  Of course it's a red flute until Link picks it up. Very Happy

I may consider asking MathOnNapkins if he happens to have a graphic index.  That said, I'm already looking into making my own by changing one byte at a time, and seeing what item graphics load.

Thanks for the help Conn. Smile
avatar
Jeimuzu



Since : 2015-10-01

Back to top Go down

Re: Random Questions Pertaining to Zelda 3 Hacking

Post by qwertymodo on Tue 24 Oct 2017 - 16:42

There is a decent chance that the graphic index matches the inventory offsets.  You might try #$12 since #$11 is the flippers and the moon pearl is directly after the flippers in the inventory.
avatar
qwertymodo



Since : 2014-10-21

Back to top Go down

Re: Random Questions Pertaining to Zelda 3 Hacking

Post by Conn on Tue 24 Oct 2017 - 16:53

   $1D/E1E4 A9 11       LDA #$11                A:0030
   $1D/E1E6 22 ED D4 00 JSL $00D4ED[$00:D4ED]  

11 is the flippers. From my digging code I know that 0c is the flute, so I change pc 0e/e1e5 to 0c
(I do not know where these values come from, could be a graphic index which you may find out (count) with zcompress).
Moonpearl would be 17, so 0e/e1e5 to 17

Color red:
pc $0E/E1D3 54 ->52


For later use, here's how I found 17 as value for the moon pearl starting from the 11 for flippers (image zcompress, offset 0x67340. (don't ask however, why flute is 0c
[You must be registered and logged in to see this link.]
item in hand is 0e/e1c3: 1f, then you get hold the red moon pearl, the item is written to ram and the correct monologue shows up (but guess you know that already) Wink
avatar
Conn



Since : 2013-06-30

Back to top Go down

Re: Random Questions Pertaining to Zelda 3 Hacking

Post by Jeimuzu on Tue 24 Oct 2017 - 18:08

I'm currently putting an index together, and the bytes representing the graphics are almost entirely out of order.  That said, the bytes that check whether or not you've obtained a particular item from King Zora appear to be in order.  I set 030F10 to 57, and he never reappeared after the initial encounter. Smile

That image explains a lot. Any items that use no more than two 8x8 tiles will not display properly. For example, a heart and small pot will display side-by-side. Same goes for the cane and hookshot, and the rod and hammer. Of course this doesn't impede what I'm doing. Just something I thought I'd make note of. Wink
avatar
Jeimuzu



Since : 2015-10-01

Back to top Go down

Re: Random Questions Pertaining to Zelda 3 Hacking

Post by Conn on Tue 24 Oct 2017 - 19:10

Yes, you also can determine the sprite size somehow, I went down this road for Conker as well (so thate.g., a 4x4 hammer emerges out of a chest).
I hope you do not wanna go down that road in your hack as well. As you see it can get complex Wink
avatar
Conn



Since : 2013-06-30

Back to top Go down

Re: Random Questions Pertaining to Zelda 3 Hacking

Post by Jeimuzu on Wed 25 Oct 2017 - 11:38

I don't see myself going down that road as I would look for an alternative first, lol. I would like the shovel to be purchased from a shop, but I feel like this wouldn't be an issue if I'm replacing a heart or some other 8x16 sprite.

Now I have noticed that you obtain one 16x16 (red shield/silver arrows) and one 8x16 (magic boomerang/golden sword) item from both trading fairies. Would two 16x16 items from one fairy cause any problems? In other words, would I only see half of a 16x16 item if it's replacing the sword or the boomerang?
avatar
Jeimuzu



Since : 2015-10-01

Back to top Go down

Re: Random Questions Pertaining to Zelda 3 Hacking

Post by superskuj on Wed 25 Oct 2017 - 12:41

I happened to have this list already indexed in case you still need it:

Code:
==============================================================================
$7EBD40[0x80]  -    Sprite tiles for receive item (4 8x8 tiles)
==============================================================================

00 - Filled Bottle
01 - 3 Bombs
02 - 10 arrows
03 - Heart Container
04 - Tunic
05 - Bow and Sword
06 - Sword and Cane
07 - Cane and Hook
08 - Hook and Rod
09 - Rod and Hammer
0A - Hammer and Half of Powder
0B - Powder
0C - Flute
0D - Glove (Mitts?)
0E - Book
0F - Small Key and Boomerang
10 - Boom and Half of Flippers
11 - Flippers
12 - Mirror
13 - Single Bomb
14 - Lamp
15 - Cape
16 - Compass
17 - Moon Pearl
18 - Sword and Shovel
19 - Shovel and Half Of Ether
1A - Ether
1B - Bombos
1C - Quake
1D - Bottle
1E - Mushroom
1F - Cauldron
20 - Fire Shield
21 - Letter (Mirror lvl1)
22 - Big Key
23 - Green Pendant
24 - Rupee and Rupee
25 - Rupee and Rupee
26 - Rupee and Half Of Net
27 - Net
28 - Crystal
29 - Bow and Arrow
2A - Bow and Silver Arrow
2B - Bottle With Fairy?
2C - Bottle With Bee
2D - Fighter Shield and Half Of Heart Piece
2E - Mirror Shield
2F - Heart Piece
30 - 10 Bombs
31 - Heart and Small Magic
32 - Small Magic and Arrow
33 - Arrow and Rupee
34 - 100 Rupees
35 - 50 Rupees
36 - 300 Rupees
37 - 20 Rupees
38 - Boots
39 - Invisible Item? (Has Shadow)
3A - Invisible Item? (Has Shadow)
3B - Garbage
3C - Invisible Item? (Has Shadow)
3D - Garbage
3E - Invisible Item? (Has Shadow)
3F - Garbage

Probably goes on like that

superskuj



Since : 2015-07-07

Back to top Go down

Re: Random Questions Pertaining to Zelda 3 Hacking

Post by superskuj on Wed 25 Oct 2017 - 12:49

When we were first looking into changing the non-chest items for randomizer we did a lot of research into this stuff to see what the best option was. In the end karkat just made a whole new "chameleon" sprite which replaced all of them and can change depending on separate tables in the rom. This is the only other relevant info I could find in my notes (i'm not even 100% sure if this refers to US or JP version offsets...):

Code:
Quake:
0E/E1A2 - Graphics
0E/E185 - Item
0E/E19A -
    The layout of this variable is the same as the 4th byte of each OAM entry.
    That is,
   
    vhoopppN
   
    v - vflip
    h - hflip
    o - priority
    p - palette
    N - name table
   
    The 'N' bit operates as the the top bit of the CHR index in our case,
    because the game has the two name tables placed consecutively in vram.

Flippers:
0E/E1E5 - Graphics
0E/E1C3 - Item
0E/E1D8 -
    The layout of this variable is the same as the 4th byte of each OAM entry.
    That is,
   
    vhoopppN
   
    v - vflip
    h - hflip
    o - priority
    p - palette
    N - name table
   
    The 'N' bit operates as the the top bit of the CHR index in our case,
    because the game has the two name tables placed consecutively in vram.

Flute:
04/8C98 - Graphics
04/4FF6 - Item
04/5027 - Palette?

Mushroom:
02/EE60 - Graphics? (pulls from loaded spriteset, not a universal one so there's limited options)
02/EE8D - Item
02/EE53-EE58 - AF 44 F3 7E C9 02 -
   checks if you have powder to not spawn shroom (44 F3 7E = 7EF344 = shroom/powder),
   change check to inventory item placed here and check if non-zero should work

Powder:
02/F65E - Item

superskuj



Since : 2015-07-07

Back to top Go down

Re: Random Questions Pertaining to Zelda 3 Hacking

Post by Conn on Wed 25 Oct 2017 - 13:10

Here are my notes for the item out of chest notes (palette, making small tiles like hammer to 16x16 tiles, and centering them).
It will work for the zora part when holding up your item I think but not when he throws them at you.

Possibly it will help you nevertheless... and apologies if the notes are hard to understand, it was the very first request SePH had on Conker for me and that was years ago.

Code:


Palette tracing:
$08/C6A4 BF 9C 84 09 LDA $09849C,x[$09:84A3] A:0024
04: green, 02: blue, 01:red
ice rod: 04:84A4 02, ok
byrna: 04:84B4 02 -> 04
somaria: 04:84B1 01 -> 04
shovel: 84AF 01,ok
hammer: 04:84A5 01,ok matches with 01 the pic but the menu hammer is grey or golden
fire rod: 01, ok
boomerang: 01,02 (normal magic, ok)


16x16 - 8x8 tracing
$08/C6BA BF 50 84 09 LDA $098450,x[$09:846D] A:0000
02: 16x16 tile
00: 8x8 tile
ice rod: 04:8458 00 -> 02
byrna: 04:8468 00 -> 02
somaria: 04:8465 00 -> 02
shovel: 04:8463 00 -> 02
hammer: 04:8459 00 -> 02
fire rod: 04:8457 00 -> 02
normal boomerang: 04:845C 00 -> 02
magic boomerang: 04:847A 00 -> 02

Centering items when they come out of chest:
$09/886F B9 B8 83    LDA $83B8,y[$09:83D5]   A:1874
04 -> 00 centers the 16 bit items
ice rod: 04:83C0 04 -> 00
byrna: 04:83D0 04 -> 00
somaria: 04:83CD 04 -> 00
shovel: 04:83CB 04 -> 00
hammer: 04:83C1 04 -> 00
fire rod: 04:83BF 04 -> 00
normal boomerang: 04:83C4 05 -> 00
magic boomerang: 04:83E2 05 -> 00

EDIT:
To understand the notes:
1. Make a breakpoint at the given address, e.g., palette tracing $08/C6A4
2. It points to a table, e.g., the palette table starts LDA $09849C,x (pc 04:849c)
3. the x (or at center items the y) value is the HM index, e.g., cane byrna is HM index 24, hex 18,
so you find its palette at 04:849c +18 = 04/8fb4

If you make an item to 16x16, you must place it in free rom space and also point to it so it can be transferred to vram.
avatar
Conn



Since : 2013-06-30

Back to top Go down

Re: Random Questions Pertaining to Zelda 3 Hacking

Post by Jeimuzu on Thu 26 Oct 2017 - 17:18

superskuj wrote:I happened to have this list already indexed in case you still need it:
Thank you.  I had already made a list, but I only included what showed up properly.  So this does help.

Conn wrote:Here are my notes for the item out of chest notes (palette, making small tiles like hammer to 16x16 tiles, and centering them).
It will work for the zora part when holding up your item I think but not when he throws them at you.

Possibly it will help you nevertheless... and apologies if the notes are hard to understand, it was the very first request SePH had on Conker for me and that was years ago.
Right.  I'm not sure whether or not I'll need it just yet, but I appreciate you giving me access to it. Wink
avatar
Jeimuzu



Since : 2015-10-01

Back to top Go down

Re: Random Questions Pertaining to Zelda 3 Hacking

Post by Jeimuzu on Sun 5 Nov 2017 - 18:46

My next question is fairly similar as it involves obtaining an item from a sprite. It might be too difficult, but I'm curious to find out. For the past week, I've been wondering if obtaining a different item from a medallion tablet would be too difficult. I wouldn't be surprised if changing the item itself involves changing a handful of bytes just like King Zora, but what about disabling the ether/bombos effect? Is that something you could just turn off by changing a handful of bytes, or is it far more complicated than that?
avatar
Jeimuzu



Since : 2015-10-01

Back to top Go down

Re: Random Questions Pertaining to Zelda 3 Hacking

Post by Conn on Sun 5 Nov 2017 - 19:11

It should be nothing more than a byte change as well. It's like when using the item, you just have to break the item use routine early, that's all.

I think you need somebody with asm skills to help on your project. Your stuff is really easy, it was my daily work on conker/all-in. I think I could trace that down in less than 30 minutes. But as said, I cannot handle dozens projects, and really want to slow down so please don't be mad with me if I'm not of help with your requests.
avatar
Conn



Since : 2013-06-30

Back to top Go down

Re: Random Questions Pertaining to Zelda 3 Hacking

Post by Jeimuzu on Mon 6 Nov 2017 - 14:13

Conn wrote:It should be nothing more than a byte change as well. It's like when using the item, you just have to break the item use routine early, that's all.

I think you need somebody with asm skills to help on your project. Your stuff is really easy, it was my daily work on conker/all-in. I think I could trace that down in less than 30 minutes. But as said, I cannot handle dozens projects, and really want to slow down so please don't be mad with me if I'm not of help with your requests.

You were a tremendous help to me when I was working on version 1.0 of Master Quest.  So I could never get mad at you.  Though I would never get mad at anyone for turning down free work. Wink

That said, I’m really just trying to figure out what I can and can’t do at the moment, and build my ideas around that.  So answering this question was particularly helpful to me.  Because depending on whether or not it could be done would determine how I shift quite a number of items around (namely medallions).

Though I’m not in a hurry, I am looking to form a collaboration with someone who can do ASM work.  I’m just not quite sure where to look just yet.
avatar
Jeimuzu



Since : 2015-10-01

Back to top Go down

Re: Random Questions Pertaining to Zelda 3 Hacking

Post by Conn on Mon 6 Nov 2017 - 17:10

Maybe it is not that easy... I traced a bit.
If you give 7e005d-08, Link happily performs the ether.

However, when receiving ether from the stone panel, it will get a 19 and not a 08:
$07/8563 A9 19       LDA #$19              
$07/8565 85 5D       STA $5D    [$00:005D]  
If I now change at pc 03/8564: 19 -> 00 the panel gets destroyed, but no item falls down (but also no ether is displayed). If I give at 03/8564: 19 -> 1a, bombos will be displayed.

I think the routine must be breaked at a later point. It would be easy if you'd be able to reset it if it was $5d:08, but with the 19, it appears to be more complex Sad
avatar
Conn



Since : 2013-06-30

Back to top Go down

Re: Random Questions Pertaining to Zelda 3 Hacking

Post by Jeimuzu on Mon 6 Nov 2017 - 19:30

Right. The crumbling tablet seems to be separate from the actual sequence of Link raising his sword, and receiving the item falling from the sky. The tablet crumbles, but no item falls and Link can walk around while it's crumbling.
avatar
Jeimuzu



Since : 2015-10-01

Back to top Go down

Re: Random Questions Pertaining to Zelda 3 Hacking

Post by Conn on Tue 7 Nov 2017 - 1:31

I think I found it:
$03/85D3: 18 -> 00 (disable ether animation at panel)

not tested:
$03/865B 19 -> 00 (disable bombos animation at panel)

the medallion falls nevertheless, if you wanna change it you need to make that similar to Zora giving you the moonpearl.
avatar
Conn



Since : 2013-06-30

Back to top Go down

Re: Random Questions Pertaining to Zelda 3 Hacking

Post by Jeimuzu on Tue 7 Nov 2017 - 15:28

Conn wrote:I think I found it:
$03/85D3: 18 -> 00 (disable ether animation at panel)

not tested:
$03/865B 19 -> 00 (disable bombos animation at panel)

the medallion falls nevertheless, if you wanna change it you need to make that similar to Zora giving you the moonpearl.

Yep, you found it!
Thank you sir! Smile
avatar
Jeimuzu



Since : 2015-10-01

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum