The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > ROM Hacking > Research & Development
Sign Up Rules/FAQ Live Battle Blogs Mark Forums Read

Notices

Research & Development Got a well-founded knack with ROM hacking? Love reverse-engineering the Pokémon games? Or perhaps you love your assembly language. This is the spot for polling and gathering your ideas, and then implementing them! Share your hypothesis, get ideas from others, and collaborate to create!
Research & Development programs in this forum are subject to moderator approval before they are displayed.


Reply
Click here to go to the first staff post in this thread.  
Thread Tools
  #1    
Old June 5th, 2010, 02:38 PM
knizz's Avatar
knizz
 
Join Date: Aug 2007
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
__________________
Firered IDA 6.1 DB: https://www.dropbox.com/s/hvvmxxoo1dkmdzc/firered.idb
VBA-M with lua scripting support (no longer in development)
Reply With Quote
  #2    
Old June 5th, 2010, 03:23 PM
Full Metal's Avatar
Full Metal
C(++) Developer.
Community Supporter
 
Join Date: Jan 2008
Location: In my mind.
Age: 18
Gender: Male
Nature: Timid
Send a message via Windows Live Messenger to Full Metal
well, idk about everyone else, but i'm fairly certain that there isn't an asm command 'cutscene' or anything like that...
__________________

★ full metal.

I like to push it,
and push it,
until my luck is over.
Reply With Quote
  #3    
Old June 5th, 2010, 03:26 PM
knizz's Avatar
knizz
 
Join Date: Aug 2007
Quote:
Originally Posted by Full Metal View Post
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)
__________________
Firered IDA 6.1 DB: https://www.dropbox.com/s/hvvmxxoo1dkmdzc/firered.idb
VBA-M with lua scripting support (no longer in development)
Reply With Quote
  #4    
Old June 5th, 2010, 03:30 PM
Full Metal's Avatar
Full Metal
C(++) Developer.
Community Supporter
 
Join Date: Jan 2008
Location: In my mind.
Age: 18
Gender: Male
Nature: Timid
Send a message via Windows Live Messenger to Full Metal
well, i use 'seeds of platinum' and it reads fine (which is also black on gray)
ontopic: ohhh that asm command 'callasm'
yea...that should be doable, just long and tedious and not fun
__________________

★ full metal.

I like to push it,
and push it,
until my luck is over.
Reply With Quote
  #5    
Old June 5th, 2010, 03:53 PM
colcolstyles's Avatar
colcolstyles
Yours truly
 
Join Date: May 2008
Location: The Bay Area
Gender: Male
Nature: Lonely
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." :\
__________________

Brother of Vrai
Reply With Quote
  #6    
Old June 5th, 2010, 04:12 PM
Darthatron's Avatar
Darthatron
巨大なトロール。
Community Supporter Tier 2
 
Join Date: Jan 2006
Location: Melbourne, Australia
Age: 22
Gender: Male
Nature: Modest
Quote:
Originally Posted by colcolstyles View Post
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. >_<
__________________
あなた は しきしゃ です
わたし は ばか です
Reply With Quote
  #7    
Old June 5th, 2010, 04:20 PM
altariaking's Avatar
altariaking
Needs NO VMs...
 
Join Date: Dec 2009
Location: Scotland, Lesmahagow
Age: 39
Gender: Male
Nature: Naive
Send a message via Windows Live Messenger to altariaking
by cutscenes do you mean lije the rayquazza one in emerald?
__________________
http://www.pokecommunity.com/member.php?u=253113
Reply With Quote
  #8    
Old June 5th, 2010, 10:02 PM
knizz's Avatar
knizz
 
Join Date: Aug 2007
Quote:
Originally Posted by colcolstyles View Post
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?)
__________________
Firered IDA 6.1 DB: https://www.dropbox.com/s/hvvmxxoo1dkmdzc/firered.idb
VBA-M with lua scripting support (no longer in development)
Reply With Quote
  #9    
Old June 5th, 2010, 10:25 PM
colcolstyles's Avatar
colcolstyles
Yours truly
 
Join Date: May 2008
Location: The Bay Area
Gender: Male
Nature: Lonely
Quote:
Originally Posted by knizz View Post
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.


Quote:
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.
__________________

Brother of Vrai

Last edited by colcolstyles; June 12th, 2010 at 09:25 AM. Reason: Way to be mature, guys
Reply With Quote
  #10    
Old June 6th, 2010, 12:44 AM
knizz's Avatar
knizz
 
Join Date: Aug 2007
Thanks a LOT! That was exactly what I was looking for.
__________________
Firered IDA 6.1 DB: https://www.dropbox.com/s/hvvmxxoo1dkmdzc/firered.idb
VBA-M with lua scripting support (no longer in development)
Reply With Quote
  #11    
Old June 6th, 2010, 10:56 AM
Team Fail's Avatar
Team Fail
A Little Bit Of Sparkle
Community Supporter
 
Join Date: May 2009
Age: 19
Gender: Male
Nature: Brave
Quote:
Originally Posted by colcolstyles View Post
... 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.
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.
__________________

Pairs:
Kevin, Echidna
Follow me on Twitter! @TeamFail
Alt 1, リザードン
Miiverse
Pokémon Hackers Online
Alt 2: Jack Cayman



[04:20.39] <@GoGo> I WILL INSERT WITH PLEASURE
[04:20.45] <@GoGo> shut it Bela

[05:41.55] <Team_Fail> Blue Spider is interesting, but #MEHMasterRace
[05:42.20] <diegoisawesome> Team_Fail: Sounds like a bunch of unmotivated people that still want to try to take over the world
Reply With Quote
  #12    
Old June 6th, 2010, 11:40 AM
colcolstyles's Avatar
colcolstyles
Yours truly
 
Join Date: May 2008
Location: The Bay Area
Gender: Male
Nature: Lonely
Quote:
Originally Posted by Team Fail View Post
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.
__________________

Brother of Vrai
Reply With Quote
  #13    
Old June 9th, 2010, 09:31 PM
kittopian's Avatar
kittopian
The Kittopian CREATOR
 
Join Date: Mar 2010
Location: KITTOPIA
This whole concept is exiting! Adding new cutscenes will allow hacks to become more unique... Good luck!
__________________
The planet KITTOPIA... I belong there... I will return...
Reply With Quote
  #14    
Old August 9th, 2010, 05:43 PM
Funfat.'s Avatar
Funfat.
Working on scripts that fail
 
Join Date: Apr 2009
Location: At home
Gender: Male
Nature: Bold
Hm... You could stop the music and play different music...
__________________
Cna yuo raed tihs? Olny 55% of plepoe can.

I cdnuolt blveiee taht I cluod aulaclty uesdnatnrd waht I was rdanieg.
The phaonmneal pweor of the hmuan mnid, aoccdrnig to a rscheearch
at Cmabrigde Uinervtisy, it dseno't mtaetr in waht oerdr the ltteres in a
wrod are, the olny iproamtnt tihng is taht the frsit and lsat ltteer be in the
rghit pclae. The rset can be a taotl mses and you can sitll raed it whotuit
a pboerlm. Tihs is bcuseae the huamn mnid deos not raed ervey lteter
by istlef, but the wrod as a wlohe. Azanmig huh? yaeh and I awlyas tghuhot
slpeling was ipmorantt!
fi yuo cna raed tihs, palce it in yuor siantugre
I feogrt who ollanirigy had tihs but wohveer did. TAHNKS
Reply With Quote[/sig-reason]
Reply With Quote
  #15    
Old August 10th, 2010, 07:30 AM
Xenesis's Avatar
Xenesis
Syogun Changer
 
Join Date: May 2006
Location: Australia
Nature: Sassy
Send a message via AIM to Xenesis Send a message via Windows Live Messenger to Xenesis
Quote:
Originally Posted by knizz View Post
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)
Reply With Quote
  #16    
Old October 15th, 2010, 06:55 PM
U_Flame's Avatar
U_Flame
Brony Hacker
 
Join Date: Jun 2008
Location: UnderwaterSapphire in Hoenn 100 years in the future
Age: 18
Gender: Male
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.
__________________
Computer broke not a month after. Jesus. Still got everything backed up though!

Times I've been ninja'd: 16
Times I've ninja'd people: 3

Quote:
Originally Posted by drarixio View Post
Unbeatable Flame would make a pokemon trainer run outta breath in the anime:
Unbeatable Flame, Flamethrower.
Unbeatable Flame, Sky Uppercut.
Unbeatable Flame, this.
Unbeatable Flame, that.
Un*pant*beatable---Flame, hooollaaa
Un-un-un-un--bea-bee....*Pokemon trainer fainted*
Reply With Quote
  #17    
Old October 15th, 2010, 07:16 PM
Shiny Quagsire's Avatar
Shiny Quagsire
Unexpectedly Gone until Aug 13
 
Join Date: May 2009
Location: Hoenn Safari Zone
Age: 16
Gender: Male
Nature: Jolly
Quote:
Originally Posted by U_Flame View Post
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.
__________________



Reply With Quote
  #18    
Old October 18th, 2010, 11:02 PM
colcolstyles's Avatar
colcolstyles
Yours truly
 
Join Date: May 2008
Location: The Bay Area
Gender: Male
Nature: Lonely
Quote:
Originally Posted by shiny quagsire View Post
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.

Quote:
Originally Posted by shiny quagsire View Post
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.
__________________

Brother of Vrai
Reply With Quote
Reply
Quick Reply

Sponsored Links
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Minimum Characters Per Post: 25



All times are UTC -8. The time now is 07:31 AM.


Style by Nymphadora, artwork by Sa-Dui.
Like our Facebook Page Follow us on Twitter © 2002 - 2014 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2014 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.