• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Forum moderator applications are now open! Click here for details.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Development: Cutscenes

knizz

192
Posts
16
Years
  • Seen Oct 28, 2020
Is it possible to make "cutscenes" (like in the intro) in a 3rd gen game using the ASM-command? As far as I know the asm-command stops the music- and graphic-updates. The code for the cutscene would have to call the correct parts of the main loop. (How can they be found?) And does backuping the graphic-memory guarantee that there are no glitches afterwards? (Or is there a function the refills the graphic-memory, so there's no need to do a backup)

I hope you understand what I mean.

knizz
 

Full Metal

C(++) Developer.
810
Posts
16
Years
well, idk about everyone else, but i'm fairly certain that there isn't an asm command 'cutscene' or anything like that...
 

knizz

192
Posts
16
Years
  • Seen Oct 28, 2020
well, idk about everyone else, but i'm fairly certain that there isn't an asm command 'cutscene' or anything like that...

That's not what I meant. I thought about using the ASM command to start a ASM-Program that shows some animations while continuing playing the music.

btw On the standard theme your text is unreadable (black on gray)
 

Full Metal

C(++) Developer.
810
Posts
16
Years
well, i use 'seeds of platinum' and it reads fine (which is also black on gray)
ontopic: ohhh that asm command 'callasm' :P
yea...that should be doable, just long and tedious and not fun
 

colcolstyles

Yours truly
1,588
Posts
15
Years
Yes, I'm sure it's manageable. Though I don't think you have to go so far as calling the game's main loop just to get it to work. I would guess that remaining "inside" a callasm command for more than one frame might de-sync the game and screw things up but when I did something similar to this a while ago, I did it by returning from the "ASM level" to the "script level" each frame. So yeah, it's totally possible but you're going to need knowledge of ASM and a good chunk of time in order to pull it off.

Also, does the callasm command really stop the music? I thought that the sound data was copied over via DMA so that it would continue playing, which explains why people often describe the game freezing as "the screen goes black but I can still hear the music." :\
 

Darthatron

巨大なトロール。
1,152
Posts
18
Years
Yes, I'm sure it's manageable. Though I don't think you have to go so far as calling the game's main loop just to get it to work. I would guess that remaining "inside" a callasm command for more than one frame might de-sync the game and screw things up but when I did something similar to this a while ago, I did it by returning from the "ASM level" to the "script level" each frame. So yeah, it's totally possible but you're going to need knowledge of ASM and a good chunk of time in order to pull it off.

Also, does the callasm command really stop the music? I thought that the sound data was copied over via DMA so that it would continue playing, which explains why people often describe the game freezing as "the screen goes black but I can still hear the music." :\

I was thinking the same thing about the music. I've never experienced the music stopping or skipping. At least, not by accident. >_<
 

knizz

192
Posts
16
Years
  • Seen Oct 28, 2020
Yes, I'm sure it's manageable. Though I don't think you have to go so far as calling the game's main loop just to get it to work. I would guess that remaining "inside" a callasm command for more than one frame might de-sync the game and screw things up but when I did something similar to this a while ago, I did it by returning from the "ASM level" to the "script level" each frame. So yeah, it's totally possible but you're going to need knowledge of ASM and a good chunk of time in order to pull it off.

Also, does the callasm command really stop the music? I thought that the sound data was copied over via DMA so that it would continue playing, which explains why people often describe the game freezing as "the screen goes black but I can still hear the music." :\

How did you switch to script-level in every frame?
In my case that's not useful because I want to draw something entirely different onto the screen.

Also the DMA alone can't be responsible for the music to continue.
1) The DMA-Buffer only holds enough samples for maybe half a second.
2) New samples have to be created from the notes in the same interval.

Probably it's because of a timer... (what else does this timer trigger?)
 

colcolstyles

Yours truly
1,588
Posts
15
Years
How did you switch to script-level in every frame?
In my case that's not useful because I want to draw something entirely different onto the screen.

Instead of waiting for the next frame by continually checking the VCount register until it enters the VBlank in a callasm routine, you can just return to the script and the use "pause 0x1" in order to utilize the game's built-in "wait x frames" function. If you're animating something or need to move something over the course of multiple frames, you can use a loop in the script and at each pass, use callasm to call a routine that changes the location or graphic of a sprite or something.

I believe I used something like this:

Code:
...

setvar LOOP_COUNTER 0x0
call @loop

...

#org @loop    // Moves a sprite to the left 1px per frame over 30 frames (~0.5 sec)
callasm 0xXXXXXX    // Moves sprite 1 pixel to the left or whatever

addvar LOOP_COUNTER 0x1
pause 0x1    // Wait for next frame
compare LOOP_COUNTER 30
if B_< goto @loop
return

... where the routine called only changes something small before quickly returning to the script. If you really want to see an example of something that uses that idea, you can take a look at this video. It's pretty crude as it was just a test to see if I had the basic concept right for a project I was working on for this one guy's hack. However, things like the text fade-in and the expanding, semi-transparent bar use the above code more or less.


Also the DMA alone can't be responsible for the music to continue.
1) The DMA-Buffer only holds enough samples for maybe half a second.
2) New samples have to be created from the notes in the same interval.

Probably it's because of a timer... (what else does this timer trigger?)

Hm, interesting. I honestly haven't looked into sound hacking so I really wouldn't know. I'll take a look at it tomorrow but I'm gonna go to bed now, seeing how I've got final exams this upcoming week.
 
Last edited:

knizz

192
Posts
16
Years
  • Seen Oct 28, 2020
Thanks a LOT! That was exactly what I was looking for.
 

colcolstyles

Yours truly
1,588
Posts
15
Years
I'd like to be able to do that, unfortunately I have no knowledge of ASM or how to do it :(. That's pretty cool! But, was there sound with that? That would be interesting to see.

Yes, there was sound but my screen capture program doesn't capture sound because apparently it doesn't work with Intel Macs. Anyways, I didn't change the music when transitioning from the map to the cutscene. It was probably still playing Pallet Town's music. If different music was needed in a cutscene, you could just use 'playsong' to change the song. Again, there's no need to do anything in a 'callasm' routine that you can't do in a script. In fact, if you really wanted to, you could simply create a map with the image that you wanted to display in the tileset and then use Overworlds to create moving objects. Though that would probably be a lot less efficient.
 

Xenesis

Syogun Changer
55
Posts
17
Years
Also the DMA alone can't be responsible for the music to continue.
1) The DMA-Buffer only holds enough samples for maybe half a second.
2) New samples have to be created from the notes in the same interval.

Probably it's because of a timer... (what else does this timer trigger?)

A subroutine (or nested subroutine) from the main loop at some level should call what is essentially the 'music engine'. You'll find that the game should (through every loop) update the buffer to include the audio data in a timely fashion.

Regardless of anything else, whenever you run a script the main loop is still occurring at a fundamental level every frame that the game runs. If you want to control what audio is playing, the most direct method would be to send commands to the game's sound engine. (Which is basically what any music change commands in scripts, etc. would do anyhow)
 

U.Flame

Maker of Short Games
1,326
Posts
15
Years
Argh! Why can't I understand scipting!? Cutscenes like in that video would be so perfect with my hack! But then again, DestinedJagold created a cutscene using titles to form an image, that can work too.
 

Shiny Quagsire

I'm Still Alive, Elsewhere
697
Posts
14
Years
Argh! Why can't I understand scipting!? Cutscenes like in that video would be so perfect with my hack! But then again, DestinedJagold created a cutscene using titles to form an image, that can work too.

It would be easier and faster just to use ASM. With a script, the event would be laggy and slow, and you'd be limited to what you can do.

And about the music, even during the ASM, the music plays. When I executed my signpost, it loops until a key is pressed, and I never modified anything in the music. I think it has to do with the IO registers that hold the location of the music.
 

colcolstyles

Yours truly
1,588
Posts
15
Years
It would be easier and faster just to use ASM. With a script, the event would be laggy and slow, and you'd be limited to what you can do.
I'm not so sure about this. I don't know why the event would be "laggy" and I can't think of any ways in which the hacker would "limited". Plus, though I haven't tested it, I'm fairly certain that remaining in a 'callasm' command for longer than one frame will at least have some minor ramifications.

And about the music, even during the ASM, the music plays. When I executed my signpost, it loops until a key is pressed, and I never modified anything in the music. I think it has to do with the IO registers that hold the location of the music.

Sorta. I didn't understand this completely the last time I visited this thread but since then, I've learned a thing or two about music hacking. The gist is that the game uses DMA1 and DMA2 to continuously copy over music data to the I/O registers. knizz was correct in that the DMA buffers can only hold enough data for a split second. However, DMAs 1 & 2 have a special setting for music that will copy over a new byte once the "sound buffer" has been emptied. Basically, it's complicated.
 
Back
Top