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!

TrollandToad.com
Reply
 
Thread Tools
  #1    
Old June 5th, 2010 (2:38 PM).
knizz's Avatar
knizz knizz is offline
     
    Join Date: Aug 2007
    Posts: 192
    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.6 DB: https://www.dropbox.com/s/d856o3pyndyr5sr/firered.idb
    VBA-M with lua scripting support
    Reply With Quote

    Relevant Advertising!

      #2    
    Old June 5th, 2010 (3:23 PM).
    Full Metal's Avatar
    Full Metal Full Metal is offline
    C(++) Developer.
    • Silver Tier
     
    Join Date: Jan 2008
    Location: In my mind.
    Age: 22
    Gender: Male
    Nature: Timid
    Posts: 806
    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 (3:26 PM).
    knizz's Avatar
    knizz knizz is offline
       
      Join Date: Aug 2007
      Posts: 192
      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.6 DB: https://www.dropbox.com/s/d856o3pyndyr5sr/firered.idb
      VBA-M with lua scripting support
      Reply With Quote
        #4    
      Old June 5th, 2010 (3:30 PM).
      Full Metal's Avatar
      Full Metal Full Metal is offline
      C(++) Developer.
      • Silver Tier
       
      Join Date: Jan 2008
      Location: In my mind.
      Age: 22
      Gender: Male
      Nature: Timid
      Posts: 806
      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 (3:53 PM).
      colcolstyles's Avatar
      colcolstyles colcolstyles is offline
      Yours truly
      • Crystal Tier
       
      Join Date: May 2008
      Location: The Bay Area
      Gender: Male
      Nature: Lonely
      Posts: 1,590
      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 (4:12 PM).
      Darthatron's Avatar
      Darthatron Darthatron is offline
      巨大なトロール。
      • Silver Tier
       
      Join Date: Jan 2006
      Location: Melbourne, Australia
      Age: 26
      Gender: Male
      Nature: Modest
      Posts: 1,152
      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 (4:20 PM).
      altariaking's Avatar
      altariaking altariaking is offline
      Needs NO VMs...
         
        Join Date: Dec 2009
        Location: Scotland, Lesmahagow
        Age: 43
        Gender: Male
        Nature: Naive
        Posts: 1,098
        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 knizz is offline
           
          Join Date: Aug 2007
          Posts: 192
          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.6 DB: https://www.dropbox.com/s/d856o3pyndyr5sr/firered.idb
          VBA-M with lua scripting support
          Reply With Quote
            #9    
          Old June 5th, 2010 (10:25 PM). Edited June 12th, 2010 by colcolstyles.
          colcolstyles's Avatar
          colcolstyles colcolstyles is offline
          Yours truly
          • Crystal Tier
           
          Join Date: May 2008
          Location: The Bay Area
          Gender: Male
          Nature: Lonely
          Posts: 1,590
          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
          Reply With Quote
            #10    
          Old June 6th, 2010 (12:44 AM).
          knizz's Avatar
          knizz knizz is offline
             
            Join Date: Aug 2007
            Posts: 192
            Thanks a LOT! That was exactly what I was looking for.
            __________________
            Firered IDA 6.6 DB: https://www.dropbox.com/s/d856o3pyndyr5sr/firered.idb
            VBA-M with lua scripting support
            Reply With Quote
              #11    
            Old June 6th, 2010 (10:56 AM).
            Incineroar's Avatar
            Incineroar Incineroar is offline
            the spirit of the fighter
            • Moderator
            • Platinum Tier
            • Developer
             
            Join Date: May 2009
            Location: Iki Town
            Age: 22
            Gender: Male
            Nature: Brave
            Posts: 13,552
            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.
            __________________
            Reply With Quote
              #12    
            Old June 6th, 2010 (11:40 AM).
            colcolstyles's Avatar
            colcolstyles colcolstyles is offline
            Yours truly
            • Crystal Tier
             
            Join Date: May 2008
            Location: The Bay Area
            Gender: Male
            Nature: Lonely
            Posts: 1,590
            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 (9:31 PM).
            kittopian's Avatar
            kittopian kittopian is offline
            Source engine coder
               
              Join Date: Mar 2010
              Location: Lost in a poorly sorted filesystem
              Nature: Docile
              Posts: 11
              This whole concept is exiting! Adding new cutscenes will allow hacks to become more unique... Good luck!
              Reply With Quote
                #14    
              Old August 9th, 2010 (5:43 PM).
              Funfat.'s Avatar
              Funfat. Funfat. is offline
              Working on scripts that fail
                 
                Join Date: Apr 2009
                Location: At home
                Gender: Male
                Nature: Bold
                Posts: 17
                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 (7:30 AM).
                Xenesis's Avatar
                Xenesis Xenesis is offline
                Syogun Changer
                   
                  Join Date: May 2006
                  Location: Australia
                  Nature: Sassy
                  Posts: 55
                  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 (6:55 PM).
                  U.Flame's Avatar
                  U.Flame U.Flame is offline
                  Suuuper Busy
                  • Crystal Tier
                   
                  Join Date: Jun 2008
                  Location: Sapphire City in future Hoenn
                  Age: 22
                  Gender: Male
                  Nature: Jolly
                  Posts: 1,258
                  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.
                  __________________
                  Hacks I'm working on:
                  Pokemon Sapphire Hoenn's Rebirth - My own hack, making progress whenever possible.
                  3rd Gen Multiplayer Project - Research and development, occasionally testing, sometimes with support.
                  Pokemon Cursed/Creepy White - Group project, on hiatus for now with plans to return eventually.
                  Animal Crossing Wild World playing as an animal - experimental, messing with models and textures

                  Hacks I've worked on in the past:
                  Pokemon Ruby Destiny Broken Timeline (pre-reboot) - Assisted with maps
                  Pokemon HeartGold Prince Boo Edition - Experimental project with three small changes. Made at the request of YouTube LPer PrinceBoo21.

                  Been super busy with work, life, and laptop problems. Hopefully I can get back into it soon, I fear I'm already rusty. Meanwhile I'm considering writing some of my hacks as a series of fanfics.

                  Times I've been ninja'd: 18
                  Times I've ninja'd people: 3
                  Reply With Quote
                    #17    
                  Old October 15th, 2010 (7:16 PM).
                  Shiny Quagsire's Avatar
                  Shiny Quagsire Shiny Quagsire is offline
                  I'm Still Alive, Elsewhere
                     
                    Join Date: May 2009
                    Location: Hoenn Safari Zone
                    Age: 19
                    Gender: Male
                    Nature: Jolly
                    Posts: 700
                    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 colcolstyles is offline
                    Yours truly
                    • Crystal Tier
                     
                    Join Date: May 2008
                    Location: The Bay Area
                    Gender: Male
                    Nature: Lonely
                    Posts: 1,590
                    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

                    Join the conversation!

                    Create an account to post a reply in this thread, participate in other discussions, and more!

                    Create a PokéCommunity Account

                    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

                    Forum Jump


                    All times are GMT -8. The time now is 11:41 PM.