Romhacking.net

Romhacking => ROM Hacking Discussion => Topic started by: lancuster on December 23, 2017, 05:34:08 am

Title: How to make fireballs in smb1 could ruin the bricks?
Post by: lancuster on December 23, 2017, 05:34:08 am
Tell me, please, what and where to change to fireballs could break bricks. Thanks. :)
Title: Re: How to make fireballs in smb1 could ruin the bricks?
Post by: FAST6191 on December 23, 2017, 05:47:31 am
So bricks already have a break feature, fireballs have a collision one. Should not be too taxing to unite the two. It is usually the sort of thing you would want to figure out yourself as it is not entirely trivial.
Bonus for you is Mario is very well documented.

http://datacrystal.romhacking.net/wiki/Super_Mario_Bros.:ROM_map#Fireballs covers some of the behaviour of fireballs. The bounces off blocks thing has me interested but I don't know if that is jump mapping it to the behaviour of shells.

http://datacrystal.romhacking.net/wiki/Super_Mario_Bros.:ROM_map#Palettes covers some of the palettes, now that is just palettes but anything that uses it will hopefully reference it. That means you can use it as a start of a debugging session -- the thing that tells it to use that being hit/breaking palette (which is different to the static brick palette) will likely also be handling the breaking actions or be right around there. Find the breaking brick check/action and make the fireball explosion effect also trigger that. You may have to have some fun with the return jumps but cross that bridge as and when.
Title: Re: How to make fireballs in smb1 could ruin the bricks?
Post by: lancuster on December 23, 2017, 08:04:21 am
I read but did not understand. The behavior of the balls is changed, but the units do not explode. I do not understand how to implement it. :(
Title: Re: How to make fireballs in smb1 could ruin the bricks?
Post by: nesrocks on December 23, 2017, 08:37:36 am
I read but did not understand. The behavior of the balls is changed, but the units do not explode. I do not understand how to implement it. :(
Learn assembly, analyze the code, read the documentation and figure it out. I think you also need to expand the rom for extra rom space so you can insert your new code, as I recall this game has no free space.
edit: oh you know assembly, okay, what he means is you need to understand the game's code. When mario hits a block the block breaks, the game already has code for breaking blocks. So you tell the game to use that same code when a fireball hits a block.
Title: Re: How to make fireballs in smb1 could ruin the bricks?
Post by: lancuster on December 23, 2017, 08:52:42 am
Learn assembly, analyze the code, read the documentation and figure it out. I think you also need to expand the rom for extra rom space so you can insert your new code, as I recall this game has no free space.
edit: oh you know assembly, okay, what he means is you need to understand the game's code. When mario hits a block the block breaks, the game already has code for breaking blocks. So you tell the game to use that same code when a fireball hits a block.
I only made fireballs that makes solid blocks invisible:
(https://b.radikal.ru/b12/1712/97/69bbb46b29a1.png) (https://radikal.ru)
Title: Re: How to make fireballs in smb1 could ruin the bricks?
Post by: nesrocks on December 23, 2017, 04:42:49 pm
I wanted to find a complete cdl file for use with fceux that had every byte usage covered but I was surprised there isn't one for this game. I thought there should be, this being one of the most well documented games ever.
Title: Re: How to make fireballs in smb1 could ruin the bricks?
Post by: nesrocks on December 23, 2017, 05:54:16 pm
Well, cool but that cdl file seems to be largely incomplete.
Title: Re: How to make fireballs in smb1 could ruin the bricks?
Post by: phalanX on December 23, 2017, 07:27:13 pm
What the hell is a cdl file, guys?
Title: Re: How to make fireballs in smb1 could ruin the bricks?
Post by: nesrocks on December 23, 2017, 07:32:15 pm
What the hell is a cdl file, guys?
It is the file generated by the code data logger. When you have the code data logger running it generates a file that contains information for what bytes in the rom were read/executed, etc. So when you open the hex editor you can see which bytes are unused (probably, considering you didn't miss executing/reading any while playing, which is why it is good to make backups and notes so if a bug appears you can fix it with ease).

http://www.fceux.com/web/help/fceux.html?HexEditor.html

edit: I have painstakingly generated a cdl file as complete as I can make for the original game, just for the sake of curiosity. It has $195 (1,24%) free bytes on PRG and $36 (0,66%) on CHR. I have no idea if it can be improved but I did go through every level, sub area, warp zone 2 player mode etc that I could think of. As expected, going to minus world doesn't do anything. Of the bg CHR, the tiles letter J, F are unused, and tile $9A. Tile $FF was partially used, meaning it was read from instead of used as a tile. All of the sprite tiles were used.
Title: Re: How to make fireballs in smb1 could ruin the bricks?
Post by: Psyklax on December 24, 2017, 01:52:33 am
code data logger

Now that's a handy little tool, think I might use that in future. I'd still be wary of touching anything though, but I can see how it'd be tempting in a game with so little free space. Then again, in my experience it's not the point whether it has free space in the ROM but whether there's free space in the part that's loaded into RAM at the moment you need it.
Title: Re: How to make fireballs in smb1 could ruin the bricks?
Post by: lancuster on December 24, 2017, 04:00:22 am
nesrocks, so it does not fix it? I'm not good at code, so I asked to help out. I can not understand how to implement it correctly.
Title: Re: How to make fireballs in smb1 could ruin the bricks?
Post by: nesrocks on December 24, 2017, 07:45:23 am
So you always expand your roms or hack only games with clearly unused bytes like sequences of 00 or $FF? The code data logger is really useful to get the most of the rom, specially without expanding it. Sometimes you can check the unused code itself to see that there's no way it can be called and is just leftover code. Some other times there are branches that never go to it, and you can analyze that to know if there's a chance it will be used or not. But this is why I always take notes of which bytes I changed, so if a bug happens I can move my code to a new place.

About the topic, add 20EDBC60 to 0x6204 and the block will be destroyed, but there are a few more things going on. You will need to create an exclusive routine that is like the one at BCED that doesn't do the extra stuff and then call it instead.
Title: Re: How to make fireballs in smb1 could ruin the bricks?
Post by: Teeporage777 on December 24, 2017, 10:38:15 am
I believe MasaYuu made a patch for it. i have it.  http://www.romhacking.net/scratchpad/10707/
Title: Re: How to make fireballs in smb1 could ruin the bricks?
Post by: lancuster on December 24, 2017, 12:57:37 pm
So you always expand your roms or hack only games with clearly unused bytes like sequences of 00 or $FF? The code data logger is really useful to get the most of the rom, specially without expanding it. Sometimes you can check the unused code itself to see that there's no way it can be called and is just leftover code. Some other times there are branches that never go to it, and you can analyze that to know if there's a chance it will be used or not. But this is why I always take notes of which bytes I changed, so if a bug happens I can move my code to a new place.

About the topic, add 20EDBC60 to 0x6204 and the block will be destroyed, but there are a few more things going on. You will need to create an exclusive routine that is like the one at BCED that doesn't do the extra stuff and then call it instead.
Unfortunately, the bounce up after the destruction of the bricks by fireball is not the worst. If you go ahead and try to destroy the pipes - the screen will turn grey, the hero will disappear and sprites of Bowser will be jumping. How to deal with this problem?
(https://a.radikal.ru/a00/1712/97/e2023f3bd69c.png) (https://radikal.ru)




December 25, 2017, 09:34:04 am - (Auto Merged - Double Posts are not allowed before 7 days.)
Teeporage777, in this hack Mario can shoot blocks or didn't?
Title: Re: How to make fireballs in smb1 could ruin the bricks?
Post by: Teeporage777 on December 25, 2017, 08:07:05 pm
with the patch i provided, fireballs destroy bricks.
Title: Re: How to make fireballs in smb1 could ruin the bricks?
Post by: lancuster on December 26, 2017, 06:27:21 am
with the patch i provided, fireballs destroy bricks.
Okay, but where is it? Page is forbidden.
And yet. How to erase a sprite reverse? I plan to do a hack with Chuck Norris. :)
Title: Re: How to make fireballs in smb1 could ruin the bricks?
Post by: KingMike on December 26, 2017, 02:25:17 pm
I believe MasaYuu made a patch for it. i have it.  http://www.romhacking.net/scratchpad/10707/
Do not upload anything to the Scratchpad unless it is for a RHDN sumbission. Nobody but the Staff will be able to see it.
Find one of the file hosting sites on the Internet and upload it there.
Title: Re: How to make fireballs in smb1 could ruin the bricks?
Post by: Teeporage777 on December 26, 2017, 06:47:12 pm
Do not upload anything to the Scratchpad unless it is for a RHDN sumbission. Nobody but the Staff will be able to see it.
Find one of the file hosting sites on the Internet and upload it there.
Thank you for informing me.
Title: Re: How to make fireballs in smb1 could ruin the bricks?
Post by: lancuster on December 28, 2017, 10:17:17 am
I appeal to all who made Mario hack. Anyone know how to remove reverse of the sprites in some frames, Mario and some enemies? How to find these values?
Title: Re: How to make fireballs in smb1 could ruin the bricks?
Post by: edale on December 31, 2017, 01:45:30 am
https://gist.github.com/1wErt3r/4048722

Looks like that is a 100% complete disassembly of SMB1, not sure how it compares to the one on datacrystal.

I don't know ASM, so I can't really help with this too much, but shouldn't this be as simple as locating the code that runs when a collision between a brick and a fireball happens, and changing the routine to jump to where the block destruction code is. That's what, a single 3-4 byte change?

*edit- Looks like the brick shatter code is at line 7379 in the link I gave you. Though I can't find the section for fireball collisions with bricks.
Title: Re: How to make fireballs in smb1 could ruin the bricks?
Post by: Psyklax on December 31, 2017, 07:32:47 am
So you always expand your roms or hack only games with clearly unused bytes like sequences of 00 or $FF?

Yep. :D I'm too scared of messing with whatever's already there.

The code data logger is really useful to get the most of the rom, specially without expanding it. Sometimes you can check the unused code itself to see that there's no way it can be called and is just leftover code. Some other times there are branches that never go to it, and you can analyze that to know if there's a chance it will be used or not.

Tell me more: how can I analyse code to be sure it'll never be used? Having the CDL recording will be useful, sure, but I'd have to play through the entire game and in every possible situation, and even then I wouldn't be sure. As for knowing there are no branches or jumps to it, sure, but how can you search for that?
Title: Re: How to make fireballs in smb1 could ruin the bricks?
Post by: nesrocks on December 31, 2017, 07:45:54 am
Yes, you need to play the entire game in every possible situation and you still won't be sure. I have only hacked games for small roms so far, so it wasn't a big deal to:
1 - play it all
2 - use judgement to what was used and what wasn't. usually unused bytes that looked like code would be in small chunks, like 5-10 bytes, so it isn't usable anyway.

As for searching, if your routine starts at 0xDE53 a simple search for 2043DE or 4C43DE could give you some confidence that it isn't used, but it could still be partially used or indirectly used, so even then you can't be sure.

Anyway, in my experience, code is usually used. There isn't always a lot of sequencial bytes of unused code, but there are of data, and that is more easily identifiable.
Title: Re: How to make fireballs in smb1 could ruin the bricks?
Post by: lancuster on December 31, 2017, 09:20:24 am
edale, how to compare asm code with machine code? Which program use for that?
Title: Re: How to make fireballs in smb1 could ruin the bricks?
Post by: nesrocks on December 31, 2017, 02:38:48 pm
I think you forget machine code, just use the disassembly, make the modifications in asm and recompile.
Title: Re: How to make fireballs in smb1 could ruin the bricks?
Post by: lancuster on January 06, 2018, 03:19:28 pm
I think you forget machine code, just use the disassembly, make the modifications in asm and recompile.
Romhacking documents didn't compiled. :(
I successfully fixed the frames of character (but not the enemies), and some of this is remain to fix.
I need to erase "world number" to correct display "get ready" and wanna to fix this tile:
(https://a.radikal.ru/a03/1801/f4/5db622651784.png) (https://radikal.ru)
Title: Re: How to make fireballs in smb1 could ruin the bricks?
Post by: Eden.GT on January 07, 2018, 07:23:25 am
The direct link to the patch of which fireballs can destroy brick blocks: http://www.geocities.jp/masa_yuu_kaimari/support/BreakBrickb.zip
This patch uses castle loop processing for the data, so you can no longer use that feature upon patching. If using an expanded ROM you can get the code to be inserted in the free space though.

Side effects, according to the author:
· Block fragments can appear at random positions when blocks are hit.
· When striking a hole, part of the screen may change in colour.
· When you hit hidden coin blocks, the used block cannot be seen after coin deposits.
· In rare cases, only hit judgment disappears, and the block sometimes remains visible.
Title: Re: How to make fireballs in smb1 could ruin the bricks?
Post by: lancuster on January 07, 2018, 10:38:59 am
The direct link to the patch of which fireballs can destroy brick blocks: http://www.geocities.jp/masa_yuu_kaimari/support/BreakBrickb.zip
This patch uses castle loop processing for the data, so you can no longer use that feature upon patching. If using an expanded ROM you can get the code to be inserted in the free space though.

Side effects, according to the author:
· Block fragments can appear at random positions when blocks are hit.
· When striking a hole, part of the screen may change in colour.
· When you hit hidden coin blocks, the used block cannot be seen after coin deposits.
· In rare cases, only hit judgment disappears, and the block sometimes remains visible.
I already have a patch with the same effects and the same bugs. I've only want to fix sprites on black screen, wanna fix phrase "get ready" and want make breakable all of blocks, except of pipes and flagpole (now ALL is breakable). Current version (patch): http://dropmefiles.com/KEWPv
Title: Re: How to make fireballs in smb1 could ruin the bricks?
Post by: Eden.GT on January 08, 2018, 01:25:00 am
I already have a patch with the same effects and the same bugs. I've only want to fix sprites on black screen, wanna fix phrase "get ready" and want make breakable all of blocks, except of pipes and flagpole (now ALL is breakable). Current version (patch): http://dropmefiles.com/KEWPv

So I tested your hack out, and the green-blue title screen looks kind of sloppy, so I'm offering you the change if you want.
And really, using U1's music patches for your hack? I suggest some original music. I know you may not have a perfect pitch, but what would you change the overworld and other music to if you have the choice?
Title: Re: How to make fireballs in smb1 could ruin the bricks?
Post by: lancuster on January 08, 2018, 02:01:08 pm
So I tested your hack out, and the green-blue title screen looks kind of sloppy, so I'm offering you the change if you want.
And really, using U1's music patches for your hack? I suggest some original music. I know you may not have a perfect pitch, but what would you change the overworld and other music to if you have the choice?
Example? :D
I don't know how to write music on NES :-\
Title: Re: How to make fireballs in smb1 could ruin the bricks?
Post by: edale on January 10, 2018, 09:25:32 pm
edale, how to compare asm code with machine code? Which program use for that?
I have absolutely no idea. I don't know machine code, and I don't know ASM. What I am good at is digging around for the raw data that more experienced/knowledgeable people can use. The only mod I've ever personally made was done 10% with a tool, and 90% through raw hex editing of the ROM.
Title: Re: How to make fireballs in smb1 could ruin the bricks?
Post by: lancuster on January 21, 2018, 06:44:34 am
There is a patch that allows you to break bricks/blocks under water?
Title: Re: How to make fireballs in smb1 could ruin the bricks?
Post by: Eden.GT on January 21, 2018, 08:18:20 pm
There is a patch that allows you to break bricks/blocks under water?

Yes, there're two patches, actually. One of them only change two bytes of the whole ROM:
Change $5CED and $5CEE's default values ($F0, $13) to $EA, $EA.

From the SMB disassembly:

bcs SolidOrClimb         ;if player collided with solid metatile, branch
                          ldy AreaType                ;otherwise check area type
                           beq NYSpd                   ;if water level, branch ahead
Title: Re: How to make fireballs in smb1 could ruin the bricks?
Post by: lancuster on January 22, 2018, 05:55:02 am
Eden.GT, thanks, all is working. :)

January 23, 2018, 11:59:16 am - (Auto Merged - Double Posts are not allowed before 7 days.)
I did a screen move to the next level(where Mario himself goes forward) as ordinary level. What the numbering a bit off. How to disable the numbering in this case, in this level?
(https://a.radikal.ru/a25/1801/df/c808f53d3ab7.png) (https://radikal.ru)
Title: Re: How to make fireballs in smb1 could ruin the bricks?
Post by: lancuster on January 30, 2018, 12:21:47 pm
Does anyone know how to change the properties of the coins to "killing coins"?
And how to find properties of other blocks to make them like bricks?