{"id":1099,"date":"2020-09-21T17:27:17","date_gmt":"2020-09-21T17:27:17","guid":{"rendered":"http:\/\/appleofeden.de-doc.com\/?p=1099"},"modified":"2020-09-21T18:53:02","modified_gmt":"2020-09-21T18:53:02","slug":"resident-evil-2-will-say-goodbye-to-deprecated-tech","status":"publish","type":"post","link":"https:\/\/classicrebirth.com\/index.php\/2020\/09\/21\/resident-evil-2-will-say-goodbye-to-deprecated-tech\/","title":{"rendered":"Resident Evil 2 will say goodbye to deprecated tech"},"content":{"rendered":"<p style=\"text-align: justify;\">As those following my recent twitter updates may have noticed, I&#8217;ve been rewriting a huge deal of code recently. So what does this translate to? Find out after the jump.<\/p>\n<p style=\"text-align: justify;\"><!--more-->Like the title implies, I&#8217;ve been migrating Resident Evil 2 to more modern graphical and audio technology: I got XAudio2 in one corner for the sound and DirectX9 for the graphics. Long story short, it will not depend anymore on deprecated or non-working pre-Windows XP modules.<\/p>\n<p style=\"text-align: justify;\">Here&#8217;s a list of what DirectX9 does compared to DirectDraw.<\/p>\n<ul style=\"text-align: justify;\">\n<li style=\"text-align: justify;\">It provides native support to modern GPUs, instead of relying on some sort of hardware-software mixed emulation, effectively making rendering lightweight and more precise in general.<\/li>\n<li style=\"text-align: justify;\">It allows to rewrite the whole rendering code in a manner closer to the original PlayStation sorted list approach, which removes the need of hacks used for approximated depth simulation. In other words, on PC it&#8217;s currently using a real z-buffer for depth while it&#8217;s internally emulating the PSX transformation engine (the GTE) and uses draw lists in order to keep everything in place.<\/li>\n<li style=\"text-align: justify;\">Blending for texture mapping has been greatly revamped to support what the PlayStation was capable of. To give an example of the more advanced alpha blending used, here&#8217;s the player shadow (left original, right new one):<a href=\"http:\/\/appleofeden.de-doc.com\/wp-content\/uploads\/2020\/09\/shadow-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1110 size-full\" src=\"http:\/\/appleofeden.de-doc.com\/wp-content\/uploads\/2020\/09\/shadow-1.png\" alt=\"\" width=\"452\" height=\"173\" srcset=\"https:\/\/classicrebirth.com\/wp-content\/uploads\/2020\/09\/shadow-1.png 452w, https:\/\/classicrebirth.com\/wp-content\/uploads\/2020\/09\/shadow-1-300x115.png 300w\" sizes=\"auto, (max-width: 452px) 100vw, 452px\" \/><\/a>The trick used on PlayStation with shadows was a grey texture that renders in reverse colors and subtracts what&#8217;s underneath it. The original PC blending approximates that by reversing the texture color in software and simply draws it as semi-transparent, while the new one can effectively produce subtractive blending and achieves the original intended effect. This applies to other effects, such as smoke clouds, water, etc.<\/li>\n<li style=\"text-align: justify;\">It finally allows us to implement HD texture packs such as RE2 SHDP with very little effort or extra steps.<\/li>\n<\/ul>\n<p style=\"text-align: justify;\">And now for sound with XAudio2, which replaces DirectSound:<\/p>\n<ul style=\"text-align: justify;\">\n<li style=\"text-align: justify;\">In terms of raw power, the biggest advantage of XAudio2 is that it makes non-trivial tasks, such as looping music, completely painless. This will be used to fix a number of details that don&#8217;t quite match with the original sound, like a bunch of BGM tracks which can&#8217;t loop seamlessly by repeating the whole song.<\/li>\n<li style=\"text-align: justify;\">The worst thing about the original engine is that it relied heavily on msacm (aka Windows Multimedia), a sorta deprecated Windows module responsible for codecs and other things. This module would be used to decompress and resample the game&#8217;s ADPCM audio. The problem with msacm is that it seems to fail in some scenarios for unknown reasons since it just won&#8217;t boot sometimes on Windows 8. This module was completely removed and replaced with a custom ADPCM decompressor and ffmpeg for resampling.<\/li>\n<li style=\"text-align: justify;\">Native support for OGG decoding with ffmpeg and support for vanilla OGG with sound files that only have one sample (voices and BGMs). This used to be a little hacky before, since it would override the mmi modules (Windows Multimedia RIFF wave parser) and generated intermediate data, but now it&#8217;s entirely working with straight data feeding the XAudio2 driver, so it&#8217;s faster, uses less memory, and works even on audio files not intended for mods.<\/li>\n<li>It removes the need to use sound quality settings, since stereo 44KHz sound is nowadays the most common audio format and isn&#8217;t that CPU intensive to process.<\/li>\n<\/ul>\n<p style=\"text-align: justify;\">All this stuff will be coming to version 1.1.0 of RE2 Classic REbirth. Yes, I&#8217;m skipping 1.0.9 as this is technically a major milestone. Also, most of the code being used for this rewrite will be recycled on the first Resident Evil as well.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As those following my recent twitter updates may have noticed, I&#8217;ve been rewriting a huge deal of code recently. So what does this translate to? Find out after the jump.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[38],"tags":[],"class_list":["post-1099","post","type-post","status-publish","format-standard","hentry","category-classic-rebirth"],"_links":{"self":[{"href":"https:\/\/classicrebirth.com\/index.php\/wp-json\/wp\/v2\/posts\/1099","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/classicrebirth.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/classicrebirth.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/classicrebirth.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/classicrebirth.com\/index.php\/wp-json\/wp\/v2\/comments?post=1099"}],"version-history":[{"count":0,"href":"https:\/\/classicrebirth.com\/index.php\/wp-json\/wp\/v2\/posts\/1099\/revisions"}],"wp:attachment":[{"href":"https:\/\/classicrebirth.com\/index.php\/wp-json\/wp\/v2\/media?parent=1099"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/classicrebirth.com\/index.php\/wp-json\/wp\/v2\/categories?post=1099"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/classicrebirth.com\/index.php\/wp-json\/wp\/v2\/tags?post=1099"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}