{"id":60,"date":"2021-07-06T05:37:13","date_gmt":"2021-07-06T05:37:13","guid":{"rendered":"https:\/\/blogs.scummvm.org\/djsrv\/?p=60"},"modified":"2021-07-06T22:15:20","modified_gmt":"2021-07-06T22:15:20","slug":"various-fixes","status":"publish","type":"post","link":"https:\/\/blogs.scummvm.org\/djsrv\/2021\/07\/06\/various-fixes\/","title":{"rendered":"Various Fixes"},"content":{"rendered":"\n<p>There&#8217;s no cohesive theme to what I did this last week, so sorry for the undescriptive title. \ud83d\ude42<\/p>\n\n\n\n<p>First I was tasked with fixing digital video in L-Zone. Previously, the videos in this game were being rendered entirely black, which is a rather suboptimal viewing experience. After a bit of investigation, I discovered that there were actually two issues present. First, there was a recent regression which prevented video sprites from refreshing, breaking video in every Director game. After I fixed this general issue, I started searching for the second, specific issue affecting L-Zone.<\/p>\n\n\n\n<p>I found my answer in the video subsystem&#8217;s QuickTime decoder. When paletted QuickTime videos were implemented about a decade ago, support for the default QuickTime palettes was left out. Without the proper default palettes, the L-Zone videos, which did not come with custom palettes, were left with a palette consisting entirely of black. I borrowed the QuickTime palettes from FFmpeg, solving this rendering issue:<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-4-3 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"L-Zone digital video in ScummVM\" width=\"500\" height=\"375\" src=\"https:\/\/www.youtube.com\/embed\/CLab9mEGuBY?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>Next I did some more refactoring. Until Director 4, a movie could only have one cast, so cast members were referred to by a single integer ID. Director 5 introduced multiple casts, requiring cast member references to specify two IDs &#8211; one for the cast member and one for the cast which contains it. In preparation for Director 5 support, I replaced every use of cast member IDs with a struct consisting of these two integers.<\/p>\n\n\n\n<p>After that, I began work on font maps. We already supported the Director 2 and 3 font map chunk (VWFM), a rather simple map associating Macintosh font names with integer IDs. In Director 4, the first version with a Windows port, font handling got more complicated. The VWFM chunk was replaced with Fmap, which included a platform ID along with the font name and ID. In addition, Director 4 movies include a FXmp chunk, which maps Macintosh fonts to similar-looking Windows fonts and vice versa. Interestingly, this is the only Director movie chunk I&#8217;ve seen which has a text-based format instead of binary. Director game developers could specify mappings like &#8220;<code>Mac:Helvetica =&gt; Win:Arial<\/code>&#8220;, placing these in a text file. Then they would import this text file into Director, and it would be saved as-is in the movie&#8217;s FXmp chunk. This made FXmp much easier to decipher than Director&#8217;s normal binary messes. \ud83d\ude42<\/p>\n\n\n\n<p>Now that I&#8217;ve implemented Fmap and FXmp, the next step is to handle different text encodings. For languages which use the Latin alphabet, movies could use either Mac Roman or Windows-1252 (or a combination of the two!). Then, of course, there were different encodings for Japanese and Korean before Director finally switched to UTF-8 in version 11.<\/p>\n\n\n\n<p>I&#8217;ll see you next week with news on that!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There&#8217;s no cohesive theme to what I did this last week, so sorry for the undescriptive title. \ud83d\ude42 First I was tasked with fixing digital video in L-Zone. Previously, the videos in this game were being rendered entirely black, which is a rather suboptimal viewing experience. After a bit of investigation, I discovered that there [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-60","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.scummvm.org\/djsrv\/wp-json\/wp\/v2\/posts\/60","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.scummvm.org\/djsrv\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.scummvm.org\/djsrv\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/djsrv\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/djsrv\/wp-json\/wp\/v2\/comments?post=60"}],"version-history":[{"count":25,"href":"https:\/\/blogs.scummvm.org\/djsrv\/wp-json\/wp\/v2\/posts\/60\/revisions"}],"predecessor-version":[{"id":85,"href":"https:\/\/blogs.scummvm.org\/djsrv\/wp-json\/wp\/v2\/posts\/60\/revisions\/85"}],"wp:attachment":[{"href":"https:\/\/blogs.scummvm.org\/djsrv\/wp-json\/wp\/v2\/media?parent=60"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/djsrv\/wp-json\/wp\/v2\/categories?post=60"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/djsrv\/wp-json\/wp\/v2\/tags?post=60"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}