{"id":29,"date":"2009-06-14T16:20:07","date_gmt":"2009-06-14T16:20:07","guid":{"rendered":"https:\/\/blogs.scummvm.org\/nolange\/?p=29"},"modified":"2022-05-22T16:20:24","modified_gmt":"2022-05-22T16:20:24","slug":"weekend-exposure","status":"publish","type":"post","link":"https:\/\/blogs.scummvm.org\/nolange\/2009\/06\/14\/weekend-exposure\/","title":{"rendered":"Weekend exposure"},"content":{"rendered":"<p>I dint so much coding work, but I researched a bit on the inner workings of ScummVM and Monkey Island.<\/p>\n<p>A TFMX-Song doesnt need to have an end, it can loop a section indefinitly or even just repeat the same sample all over. Yet Monkey Island has a coulple of scenes like the intro where the game waits a preset time to show up the MI-Logo and then waits for the song to stop before loading the next scene.<br \/>\nYet the corresponding TFMX-Song (#4) has no ending, the only reason it does end is because I added some additional checks that did work nicely in the case of the intro. The same checks fail on another Song (#3) which runs endlessly. So its time to explore how this kind of timing works in the original Amiga-Version and how ScummVM expects it to work.<\/p>\n<p>Timing on the Intro is twofold, I could not find any reference in the TFMX-Player that would signal the time the song &#8220;really starts&#8221; (after just some ambient sound, sorry cant express this better \ud83d\ude09 ), even if that would be easy to archive it hasnt be done. Instead the original executable must have a own counter which runs independent of the music-playback, but Im not going to reverse the whole executeable to find out how this is done exactly.<br \/>\nScummVM does poll regulary for a &#8220;musictimer&#8221; and counting 1\/25 seconds since songstart seems to just about work (guess the timer is a multiple of the 50 VBlank interrupts per second). Still would be good to hear from some ScummVM Devs if there are some custom hacks for MI Amiga already in place.<\/p>\n<p>Ending of songs however is something thats controlled indirectly by the TFMX-Player. A TFMX-Song has special commands to talk back to the application &#8211; writing values to a shared block of Memory, perfect to notify if a specific pattern has be reached. And the songs in question (#3 and #4) both use them to signal the end of the Song. They do so by writing a 1 to a shared Memory Block at start and writing a 0 to the same position at the end. (and song #3 just loops and overrides the value with 1 again!?).<br \/>\nSince ScummVM aint providing a function which directly correspond to that I will have to figure out a way to make this work seemlessly, it already polls if a song is still running so I will try putting a check for this flag. Still that might not be enough as not all Songs set this flag to 1.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I dint so much coding work, but I researched a bit on the inner workings of ScummVM and Monkey Island. A TFMX-Song doesnt need to have an end, it can loop a section indefinitly or even just repeat the same sample all over. Yet Monkey Island has a coulple of scenes like the intro where [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-29","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.scummvm.org\/nolange\/wp-json\/wp\/v2\/posts\/29","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.scummvm.org\/nolange\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.scummvm.org\/nolange\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/nolange\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/nolange\/wp-json\/wp\/v2\/comments?post=29"}],"version-history":[{"count":2,"href":"https:\/\/blogs.scummvm.org\/nolange\/wp-json\/wp\/v2\/posts\/29\/revisions"}],"predecessor-version":[{"id":31,"href":"https:\/\/blogs.scummvm.org\/nolange\/wp-json\/wp\/v2\/posts\/29\/revisions\/31"}],"wp:attachment":[{"href":"https:\/\/blogs.scummvm.org\/nolange\/wp-json\/wp\/v2\/media?parent=29"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/nolange\/wp-json\/wp\/v2\/categories?post=29"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/nolange\/wp-json\/wp\/v2\/tags?post=29"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}