<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>siwu's blog &#187; Development</title>
	<atom:link href="http://siwu.info/category/development/feed" rel="self" type="application/rss+xml" />
	<link>http://siwu.info</link>
	<description>sir, i'm certified cpr !</description>
	<pubDate>Fri, 12 Sep 2008 16:51:30 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
	<language>en</language>
			<item>
		<title>GTA2 Classics Stuck at 640&#215;480 (and fix!)</title>
		<link>http://siwu.info/80/gta2-classics-stuck-at-640x480-and-fix.html</link>
		<comments>http://siwu.info/80/gta2-classics-stuck-at-640x480-and-fix.html#comments</comments>
		<pubDate>Fri, 23 May 2008 00:35:40 +0000</pubDate>
		<dc:creator>siwu</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<category><![CDATA[Research]]></category>

		<guid isPermaLink="false">http://siwu.info/80/gta2-classics-stuck-at-640x480-and-fix.html</guid>
		<description><![CDATA[Lately with friends we've been having some multiplayer fun at GTA 2 Classics Edition (the free one that you can download at Rockstar Classics). I'm amazed to see how cool this game still is in multiplayer. BUT, there was a but. As of now it was impossible to make it run at more than 640x480, [...]]]></description>
			<content:encoded><![CDATA[<p>Lately with friends we've been having some multiplayer fun at GTA 2 Classics Edition (the free one that you can download at <a href="http://www.rockstargames.com/classics/" >Rockstar Classics</a>). I'm amazed to see how cool this game still is in multiplayer. BUT, there was a but. As of now it was impossible to make it run at more than 640x480, despite setting higher resolutions on the GTA 2 Manager. While it's not a <strong>big</strong> issue, it's still annoying nonetheless.<br />
So I've looked and looked and looked and looked on the net to find some kind of answer. While I did find some people who had the same problem as me (and <strong>all</strong> my friends for that matter), I did not find any answer.<br />
Because I'm not desperate, I've took my tools and started decompiling GTA 2 (;))<br />
Long story short, here is a patch to activate high resolution on GTA 2 Classics Edition (aka 9.6F) <strong>only</strong>:</p>
<p><a href='http://siwu.info/wp-content/gta2patch.exe' title='gta2patch.exe'>gta2patch.exe</a> (7 kb)</p>
<p>Please bear in mind that this patch is VERY ghetto. It doesn't even check if you are patching the right version, so <strong>USE AT YOU OWN RISK</strong>!<br />
For the details, the source code and the alternate methods (if you don't feel like downloading and launching an executable from an unknown source), hit the jump.<br />
<span id="more-80"></span><br />
I won't go into big details but it seems at some point the code to detect whether or not your graphic card is capable of handling high resolution <strike>screws up</strike> decides that it can't and falls back into "safe mode" by setting a flag. For another <strike>weird</strike> reason, the flag is not set when a registry key is.<br />
Try to set the <code>DWORD</code> key <code>skip_frontend</code> to <code>1</code> under <code>HKEY_LOCAL_MACHINE\SOFTWARE\DMA Design Ltd\GTA2\Debug</code> and it should launch the game at high resolution. The problem is, the game fails telling you that it can't open some file. Whatever.<br />
So what did I do, well, I simply patched the fail-safe code, by forcing high-res.</p>
<p>If you want to patch it yourself, take you favorite hex editor and open <code>gta2.exe</code>. Go at offset <code>0x000CB2C9</code>, and replace <code>74 1D</code> by <code>EB 1D</code> (forced <code>jmp</code> ftw).</p>
<p>Finally, if you want to compile the patch yourself (some people do I guess!), here is the code! I told you it was ghetto!</p>
<div class="syntax_hilite">
<div id="c-2">
<div class="c">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #339933;">#include &lt;windows.h&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #339933;">#include &lt;stdio.h&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #339933;">#include &lt;conio.h&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">int</span>&nbsp;&nbsp;main<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">int</span> argc, <span style="color: #993333;">char</span> **argv<span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #993333;">char</span> *patchFile = <span style="color: #ff0000;">"gta2.exe"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #993333;">char</span> *backupFile = <span style="color: #ff0000;">"gta2.original.exe"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #993333;">long</span> patchOffset = 0x000CB2C9;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #993333;">unsigned</span> <span style="color: #993333;">char</span> patchData<span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\x</span>EB"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html" ><span style="color: #000066;">printf</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"GTA2 Classics Edition High Resolution Patch<span style="color: #000099; font-weight: bold;">\n</span>"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html" ><span style="color: #000066;">printf</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"by siwu (siwuzzz@gmail.com)<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html" ><span style="color: #000066;">printf</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"This program will patch %s to allow high resolutions<span style="color: #000099; font-weight: bold;">\n</span>"</span>, patchFile<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html" ><span style="color: #000066;">printf</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"on systems that don't work.<span style="color: #000099; font-weight: bold;">\n</span>"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html" ><span style="color: #000066;">printf</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"It will also create a backup file called %s<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>"</span>, backupFile<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html" ><span style="color: #000066;">printf</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"Press any key to patch!<span style="color: #000099; font-weight: bold;">\n</span>"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; getch<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>CopyFile<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>LPCSTR<span style="color: #66cc66;">&#41;</span>patchFile, <span style="color: #66cc66;">&#40;</span>LPCSTR<span style="color: #66cc66;">&#41;</span>backupFile, <span style="color: #000000; font-weight: bold;">FALSE</span><span style="color: #66cc66;">&#41;</span> == <span style="color: #000000; font-weight: bold;">FALSE</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html" ><span style="color: #000066;">printf</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"Unable to copy %s to %s! Press a key to quit!<span style="color: #000099; font-weight: bold;">\n</span>"</span>, patchFile, backupFile<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; getch<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; FILE *gtaFile = fopen<span style="color: #66cc66;">&#40;</span>patchFile, <span style="color: #ff0000;">"r+"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>gtaFile == <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html" ><span style="color: #000066;">printf</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"Unable to open %s! Press a key to quit!<span style="color: #000099; font-weight: bold;">\n</span>"</span>, patchFile<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; getch<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; fseek<span style="color: #66cc66;">&#40;</span>gtaFile, patchOffset, SEEK_SET<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; fwrite<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333;">const</span> <span style="color: #993333;">void</span> *<span style="color: #66cc66;">&#41;</span>patchData, <span style="color: #993333;">sizeof</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333;">unsigned</span> <span style="color: #993333;">char</span><span style="color: #66cc66;">&#41;</span>, <span style="color: #993333;">sizeof</span><span style="color: #66cc66;">&#40;</span>patchData<span style="color: #66cc66;">&#41;</span> - <span style="color: #cc66cc;color:#800000;">1</span>, gtaFile<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; fclose<span style="color: #66cc66;">&#40;</span>gtaFile<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html" ><span style="color: #000066;">printf</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"Succesfully patched %s! Press a key to quit!<span style="color: #000099; font-weight: bold;">\n</span>"</span>, patchFile<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; getch<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://siwu.info/80/gta2-classics-stuck-at-640x480-and-fix.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>DWMaxx: Back to business</title>
		<link>http://siwu.info/79/dwmaxx-back-to-business.html</link>
		<comments>http://siwu.info/79/dwmaxx-back-to-business.html#comments</comments>
		<pubDate>Wed, 14 May 2008 12:28:27 +0000</pubDate>
		<dc:creator>siwu</dc:creator>
		
		<category><![CDATA[DWMaxx]]></category>

		<category><![CDATA[Development]]></category>

		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://siwu.info/79/dwmaxx-back-to-business.html</guid>
		<description><![CDATA[It's been a solid 3 months since I've last worked on DWMaxx. I am just posting this quick post to tell everyone that I'm resuming work on it. I've had a LOT of computer problems (my 2 computers died), and a lot of real life stuff to take care of.
Moreover, after my computer died and [...]]]></description>
			<content:encoded><![CDATA[<p>It's been a solid 3 months since I've last worked on DWMaxx. I am just posting this quick post to tell everyone that I'm resuming work on it. I've had a LOT of computer problems (my 2 computers died), and a lot of real life stuff to take care of.<br />
Moreover, after my computer died and I pretty changed everything in it (cpu, mobo, ram), my <em>second</em> computer died too. Which left me unable to work on DWMaxx at all (2 computers needed, as one is for debug).<br />
So what's to be expected?<br />
<span id="more-79"></span><br />
First of all, moving to <code>uDWM.dll</code> from Vista SP1. DWMaxx will be distributed with it's own <code>uDWM.dll</code> because finding RVAs using a PDB download process of <code>msdl.microsoft.com</code> is a <strong>pain in the ass</strong>. And let's not even talk about compiler optimizations.<br />
Second, I've been trying to have 3D transformations on windows working, as well as improving stability. 3D transformations is pretty tricky: for instance, <code>CWindow3D::ValidateVisual()</code> forces the 3D version to be displayed ONLY when doing the minimize/maximize animations. If it finds it's not animating, it will force the original 2D window to show and hide itself. It's hard in the code. That's also why Flip3D has it's own 3D window class. But I can't use it since the class asks for a <code>CFlip3D</code> object.<br />
So what can I do? Well, do it the hard way in the MIL protocol itself.<br />
At the moment, here's what I have:</p>
<ul>
<li>Creating a new 3D object (<strong>not</strong> <code>CWindow3D</code>)</li>
<li>Tying it to the original 2D <code>CVisual</code> Window</li>
<li>Creating the 3D viewport</li>
<li>Setting the 3D viewport view matrices</li>
</ul>
<p>What's missing is the command to tell MIL to <strong>display</strong> the viewport. And of course everytime I test I have to restart the DWM because it crashes (hence the 2nd computer).<br />
Anyway, I'll keep you guys informed of how everything falls into place, and release a DWMaxx demo pretty soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://siwu.info/79/dwmaxx-back-to-business.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>Computer Outage - Not?</title>
		<link>http://siwu.info/75/computer-outage.html</link>
		<comments>http://siwu.info/75/computer-outage.html#comments</comments>
		<pubDate>Mon, 11 Feb 2008 11:48:16 +0000</pubDate>
		<dc:creator>siwu</dc:creator>
		
		<category><![CDATA[DWMaxx]]></category>

		<category><![CDATA[Stuff]]></category>

		<guid isPermaLink="false">http://siwu.info/75/computer-outage.html</guid>
		<description><![CDATA[There may be a stall in the development of DWMaxx for the next two weeks, because I think my motherboard is dying (Asus P4P800 Deluxe). I spent the whole weekend trying to revive it, it works sometimes, sometimes it doesn't.... Well, after 3 days and nights and 100€ on a new hard drive, it seems [...]]]></description>
			<content:encoded><![CDATA[<p><strike>There may be a stall in the development of DWMaxx for the next two weeks, because I think my motherboard is dying (Asus P4P800 Deluxe). I spent the whole weekend trying to revive it, it works sometimes, sometimes it doesn't.... Well, after 3 days and nights and 100€ on a new hard drive, it seems I'll have to let it go... After all, it's been on 24h/24 for the last 5 years... And because everything has evolved, I can't just buy a new mobo, I'll need a complete upgrade (from the CPU to the GPU). And I'll do it when I have the money, that is probably at the end of the month!<br />
In the mean time, I'm still trying to make it work again, because I'm not as coffy on the laptop <img src='http://siwu.info/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </strike><br />
<strong>UPDATE 12/02/2008:</strong> It's alive! True magic involved here. Read on for the whole story.<br />
<span id="more-75"></span><br />
So yesterday, when I got back from work, I gave a try to boot the computer, and this time it started, but it did the same as it would do with it would boot: boot, but being INCREDIBLY slow on the BIOS screens. Anyway, it booted, sweet. But when I unplugged it to put it back in it's proper place, and plugged it in, it wouldn't boot anymore, with the dreaded "System fail CPU test" in a loop on the speakers.<br />
For the story, there is a small LED light on the mobo, and when you turn the computer off, it should turn off too, but it wouldn't (the PSU was fully unplugged). Also, the reset CMOS procedure wasn't working (I would try to reset the CMOS, and when it would boot, the settings were the same as before). So what I tried was to left it unplugged without any juice whatsoever, removed the battery, and went to work. When I got back, the LED was still on, after a whole day without juice... Something was weird. I guess in a desperate move (and with some true magic), I unplugged my external hard drive. And bam, the computer booted! Without being slow in the BIOS! So my guess is a ground issue. The USB hard drive perhaps was supplying current to the mobo through the USB port. Anyway, it's alive now, and I'll try to keep it that way for a while <img src='http://siwu.info/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
			<wfw:commentRss>http://siwu.info/75/computer-outage.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>DWMaxx going Open Source</title>
		<link>http://siwu.info/74/dwmaxx-going-open-source.html</link>
		<comments>http://siwu.info/74/dwmaxx-going-open-source.html#comments</comments>
		<pubDate>Mon, 04 Feb 2008 10:32:38 +0000</pubDate>
		<dc:creator>siwu</dc:creator>
		
		<category><![CDATA[DWMaxx]]></category>

		<category><![CDATA[Development]]></category>

		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://siwu.info/74/dwmaxx-going-open-source.html</guid>
		<description><![CDATA[I've decided that for the good of this project, I may be best for it to go open source. So that's it, DWMaxx is open sourced! It is distributed under GPLv2 (to prevent people from using it for commercial purposes). Of course, it doesn't mean that I'm letting this project down, not at all! But [...]]]></description>
			<content:encoded><![CDATA[<p>I've decided that for the good of this project, I may be best for it to go open source. So that's it, DWMaxx is open sourced! It is distributed under GPLv2 (to prevent people from using it for commercial purposes). Of course, it doesn't mean that I'm letting this project down, not at all! But I don't want it to finish like SPrintWindow (I still have to commit the sources somewhere...).<br />
I'll try to comment the code as often as I can, and write documentations too.</p>
<p>Anyway, you can now find everything on the <a href="http://code.google.com/p/dwmaxx/" >DWMaxx Google Code project page</a>.</p>
<p>On a side note, I've been working pretty hard to get 3D window rotations working. I think I'm on something, but it might be trickier than I thought (because theses things are quite hard-wired inside the DWM). I'll keep you guys posted.</p>
]]></content:encoded>
			<wfw:commentRss>http://siwu.info/74/dwmaxx-going-open-source.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>DWMaxx: Z Rotation</title>
		<link>http://siwu.info/73/dwmaxx-z-rotation.html</link>
		<comments>http://siwu.info/73/dwmaxx-z-rotation.html#comments</comments>
		<pubDate>Wed, 19 Dec 2007 00:53:40 +0000</pubDate>
		<dc:creator>siwu</dc:creator>
		
		<category><![CDATA[DWMaxx]]></category>

		<category><![CDATA[Development]]></category>

		<category><![CDATA[Projects]]></category>

		<category><![CDATA[Sinapse]]></category>

		<guid isPermaLink="false">http://siwu.info/73/dwmaxx-z-rotation.html</guid>
		<description><![CDATA[So yesterday I spent most the evening and night rewriting some of the low level code, to interact more directly with MIL (on which DWM sits). The result is a much faster code, and thus creates smoother animations. This also allowed me to implemented Z Rotation  
Once again, pardon my AGP card for the [...]]]></description>
			<content:encoded><![CDATA[<p>So yesterday I spent most the evening and night rewriting some of the low level code, to interact more directly with MIL (on which DWM sits). The result is a much faster code, and thus creates smoother animations. This also allowed me to implemented Z Rotation <img src='http://siwu.info/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Once again, pardon my AGP card for the slow capture framerate <img src='http://siwu.info/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /><br />
<object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/uvGHjI4dXuk&#038;rel=0&#038;color1=0x006699&#038;color2=0x54abd6&#038;border=0"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/uvGHjI4dXuk&#038;rel=0&#038;color1=0x006699&#038;color2=0x54abd6&#038;border=0" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://siwu.info/73/dwmaxx-z-rotation.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>Sinapse running DWMaxx</title>
		<link>http://siwu.info/72/sinapse-running-dwmaxx.html</link>
		<comments>http://siwu.info/72/sinapse-running-dwmaxx.html#comments</comments>
		<pubDate>Fri, 14 Dec 2007 21:19:40 +0000</pubDate>
		<dc:creator>siwu</dc:creator>
		
		<category><![CDATA[DWMaxx]]></category>

		<category><![CDATA[Development]]></category>

		<category><![CDATA[Projects]]></category>

		<category><![CDATA[Sinapse]]></category>

		<guid isPermaLink="false">http://siwu.info/72/sinapse-running-dwmaxx.html</guid>
		<description><![CDATA[Quick video of one of the first shots of Sinapse running in pair with DWMaxx, hope you'll like it 

]]></description>
			<content:encoded><![CDATA[<p>Quick video of one of the first shots of Sinapse running in pair with DWMaxx, hope you'll like it <img src='http://siwu.info/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
<object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/l-RyY-MiRX0&#038;rel=0&#038;color1=0x006699&#038;color2=0x54abd6&#038;border=0"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/l-RyY-MiRX0&#038;rel=0&#038;color1=0x006699&#038;color2=0x54abd6&#038;border=0" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://siwu.info/72/sinapse-running-dwmaxx.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>DWMaxx: Another Quick Tech Demo</title>
		<link>http://siwu.info/70/dwmaxx-another-quick-tech-demo.html</link>
		<comments>http://siwu.info/70/dwmaxx-another-quick-tech-demo.html#comments</comments>
		<pubDate>Thu, 13 Dec 2007 02:19:19 +0000</pubDate>
		<dc:creator>siwu</dc:creator>
		
		<category><![CDATA[DWMaxx]]></category>

		<category><![CDATA[Development]]></category>

		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://siwu.info/70/dwmaxx-another-quick-tech-demo.html</guid>
		<description><![CDATA[So tonight I tried to make Sinapse run with DWMaxx. The two mains issues were that Sinapse is old, and that I was running into some kind of lags.
Basically, when I would resize the window in the animation loop, the window would not resize. After tweaking everything in my code, something came to light.
DWM uses [...]]]></description>
			<content:encoded><![CDATA[<p>So tonight I tried to make Sinapse run with DWMaxx. The two mains issues were that Sinapse is <strong>old</strong>, and that I was running into some kind of lags.<br />
Basically, when I would resize the window in the animation loop, the window would not resize. After tweaking everything in my code, something came to light.</p>
<p>DWM uses timing magic to minimize the number of scene rendering is has to do! When idle, for instance, my desktop runs at 2 fps (according to Fraps). And indeed, when I change the size of the my window, the scene doesn't get redrawn. But thankfully, the DWM has also the less known <a href="http://msdn2.microsoft.com/en-us/library/aa969539.aspx" >DWM Frame Timing API</a>. Basically, this API allows you to control the rendering frame-rate of the screen, according mostly to "refreshes" (V-Sync) signals. So, indeed, I requested my frame to get redrawn after I change a window size.</p>
<p>Also, I've added the possibility to change the window's position (<strong>regardless of it's real position</strong>, it's only graphic).</p>
<p>And here's what it looks like, running inside Sinapse (which is being rewritten):<br />
<object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/pSaN5Ruypfk&#038;rel=0&#038;color1=0x006699&#038;color2=0x54abd6&#038;border=0"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/pSaN5Ruypfk&#038;rel=0&#038;color1=0x006699&#038;color2=0x54abd6&#038;border=0" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://siwu.info/70/dwmaxx-another-quick-tech-demo.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>DWMaxx: Unleashing your DWM ;)</title>
		<link>http://siwu.info/69/dwmaxx-unleashing-your-dwm.html</link>
		<comments>http://siwu.info/69/dwmaxx-unleashing-your-dwm.html#comments</comments>
		<pubDate>Wed, 12 Dec 2007 01:56:12 +0000</pubDate>
		<dc:creator>siwu</dc:creator>
		
		<category><![CDATA[DWMaxx]]></category>

		<category><![CDATA[Development]]></category>

		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://siwu.info/69/dwmaxx-unleashing-your-dwm.html</guid>
		<description><![CDATA[Hey folks, tonight (actually before going to bed), I want to introduce you to a tech preview of my new library: DWMaxx. It is using my weeks of research into the DWM, and at the moment I'm quite happy with the first results 
By the way, I want to thank you all for your kind [...]]]></description>
			<content:encoded><![CDATA[<p>Hey folks, tonight (actually before going to bed), I want to introduce you to a tech preview of my new library: DWMaxx. It is using my weeks of research into the DWM, and at the moment I'm quite happy with the first results <img src='http://siwu.info/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
By the way, I want to thank you all for your kind words about this project, thank you folks. I'm sorry I'm not replying all the emails, but at the moment I'm really hooked into real-life stuff. But fear not, I will reply!<br />
Also, <strong>A BIG THANK YOU TO AVE</strong>, without him, much of the current design would not the way it is!</p>
<p>Everything you see is running on a P4E 3.0 GHz with a GeForce 7600 GS (it's an <strong>AGP</strong> card, hence the 15-20 FPS only).</p>
<p>So, here we go, first demo: <strong>True Zooming</strong><br />
<object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/Zf1EsgWHV54&#038;rel=0&#038;color1=0x006699&#038;color2=0x54abd6&#038;border=0"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/Zf1EsgWHV54&#038;rel=0&#038;color1=0x006699&#038;color2=0x54abd6&#038;border=0" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://siwu.info/69/dwmaxx-unleashing-your-dwm.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>Hacking into Vista&#8217;s Desktop Window Manager (DWM)</title>
		<link>http://siwu.info/66/hacking-into-vistas-desktop-window-manager-dwm.html</link>
		<comments>http://siwu.info/66/hacking-into-vistas-desktop-window-manager-dwm.html#comments</comments>
		<pubDate>Sat, 08 Dec 2007 17:23:39 +0000</pubDate>
		<dc:creator>siwu</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<category><![CDATA[Research]]></category>

		<guid isPermaLink="false">http://siwu.info/66/hacking-into-vistas-desktop-window-manager-dwm.html</guid>
		<description><![CDATA[Window texture is soooo last week, when you can manipulate the windows themselves 
  
Jump for the (quite long I admit) story 

Last year (Oct. 2006) I started playing with the Windows Vista's Destkop Window Manager (DWM) API. Like a lot of people, I was really disappointed by the library. The only thing it [...]]]></description>
			<content:encoded><![CDATA[<p>Window texture is soooo last week, when you can manipulate the windows themselves <img src='http://siwu.info/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
<a href='http://siwu.info/wp-content/dwm_hack3.jpg' title='dwm_hack3.jpg'><img src='http://siwu.info/wp-content/dwm_hack3.thumbnail.jpg' alt='dwm_hack3.jpg' /></a> <a href='http://siwu.info/wp-content/firefox_zoomed.jpg' title='firefox_zoomed.jpg'><img src='http://siwu.info/wp-content/firefox_zoomed.thumbnail.jpg' alt='firefox_zoomed.jpg' /></a> <a href='http://siwu.info/wp-content/dwm_hack2.jpg' title='dwm_hack2.jpg'><img src='http://siwu.info/wp-content/dwm_hack2.thumbnail.jpg' alt='dwm_hack2.jpg' /></a></p>
<p>Jump for the (quite long I admit) story <img src='http://siwu.info/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
<span id="more-66"></span><br />
Last year (Oct. 2006) I started playing with the <a href="http://msdn2.microsoft.com/en-us/library/aa969540.aspx" >Windows Vista's Destkop Window Manager (DWM) API</a>. Like a lot of people, I was really disappointed by the library. The only thing it permits you to do is to have your own live thumbnails... Come on Microsoft! The DWM uses freaking Direct3D, why don't you let us mess around with that!<br />
I knew there a way to extract the window texture (since DWM uses Direct3D9Ex and its marvelous shared resources), so I <a href="http://www.aeroxp.org/board/index.php?showtopic=6286" >started a thread</a> on <a href="http://www.aeroxp.org/" >AeroXP.org</a> to expose my progress on this.</p>
<p>I started of by disassembling <code>dwmapi.dll</code>, and it paid off. Here it was, in front of me: <code>DwmpDxGetWindowSharedSurface()</code>! ...and its 32 bytes signature! Damn, that's <strong>8</strong> parameters maximum to reverse! Arg.<br />
But after spending almost 2 months reverse engineering, it eventually paid off. I had a (almost) complete function signature, and <a href="http://www.aeroxp.org/board/index.php?s=&#038;showtopic=6286&#038;view=findpost&#038;p=85115" >even a way to use it</a>.</p>
<pre>
int __stdcall DwmpDxGetWindowSharedSurface(HWND hWnd,
                                           LUID adapterLuid,
                                           LUID someLuid,
                                           DWORD *pD3DFormat,
                                           HANDLE *pSharedHandle,
                                           unsigned __int64 *arg7);
</pre>
<p>But there is a "but", the function would return me a correct texture handle but to a black texture! After weeks of trying to tweak the code, I was facing a dead end.<br />
So, taking my courage, I mailed the WPF Architect, <a href="http://blogs.msdn.com/greg_schechter/" >Greg Schechter</a> to ask him for help, without much hope about a response. But he did reply (and that was very kind of him to do so), thanking me for my interest into the DWM, but that he couldn't comment on such things (and it's understandable).</p>
<p>And here I was, lonely, facing a dead end. Eventually the project was forgotten on my hard drive (as many others).</p>
<p>But after some months, <a href="http://jmorrill.hjtcentral.com/Default.aspx" >Jeremiah Morrill</a> followed by work, and <a href="http://jmorrill.hjtcentral.com/Home/tabid/428/EntryID/111/Default.aspx" >scratched some more dust</a>, finding that the texture wasn't black when the window used a Direct3D device, like WPF. And after all, it makes perfect sense. Direct3D applications render to a shared texture given by the DWM, as stated in <a href="http://blogs.msdn.com/greg_schechter/archive/2006/05/02/588934.aspx" >Greg Schechter's blog</a>:</p>
<blockquote><p>
DirectX window redirection is handled by having the DirectX system, when it's determining what surface to provide the app with to render to, make calls to the DWM in order to share a surface between the DirectX client application process, and the DWM process.  This "shared surface" support is unique to DirectX atop the WDDM, and is another key reason why WDDM is an absolute requirement for running the DWM.
</p></blockquote>
<p>But there we were facing the same problem: how the f*ck do we extract the window texture, for all windows?</p>
<p>A few months later, I started talking to <a href="http://avedesk.aqua-soft.org/" >Andreas Verhoeven</a> about this (he was doing some reverse on other parts of DWM on his own), and eventually, I revived the project. After a few nights of work, there it was:<br />
<object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/hRTgFTMnT_U&#038;rel=0&#038;color1=0xd6d6d6&#038;color2=0xf0f0f0&#038;border=0"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/hRTgFTMnT_U&#038;rel=0&#038;color1=0xd6d6d6&#038;color2=0xf0f0f0&#038;border=0" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object></p>
<p>The texture relies on hooking IDirect3D9::CreateTexture() to watch out for newly created textures by the DWM, and mark them as shared (GDI texture are <strong>not</strong created as shared), and then transmit this handle to my D3D application, to create the proper texture.</p>
<p>However, the technique is flawed. The main problem is that the render loop is done asynchronously of windows creation (synchronous with v-sync), there was no direct way to establish a <code>HWND <-> TextureHandle</code> relationship. More importantly, the rendering is done though MIL (<code>milcore.dll</code>), and MIL doesn't have any clue of windows objects, that are handled by <code>uDWM.dll</code>. Pseudo dead end again.</p>
<p>But I didn't stop here, and thank to Andreas, I dug deeper into the DWM. And the results, you saw them at the top of the post <img src='http://siwu.info/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
I won't expose exactly what's involved (yet), but it's a combination of internal calls, and API hooking <img src='http://siwu.info/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>And for those of you who wonder, yes, I'm working on a library to do all this!</p>
]]></content:encoded>
			<wfw:commentRss>http://siwu.info/66/hacking-into-vistas-desktop-window-manager-dwm.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>DWM Hacking, Extracting the Window Texture</title>
		<link>http://siwu.info/64/dwm-hacking-extracting-the-window-texture.html</link>
		<comments>http://siwu.info/64/dwm-hacking-extracting-the-window-texture.html#comments</comments>
		<pubDate>Sun, 25 Nov 2007 18:36:21 +0000</pubDate>
		<dc:creator>siwu</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<category><![CDATA[Research]]></category>

		<guid isPermaLink="false">http://siwu.info/64/dwm-hacking-extracting-the-window-texture.html</guid>
		<description><![CDATA[Lately I've been working with Ave on this, and here are the first results:

]]></description>
			<content:encoded><![CDATA[<p>Lately I've been working with Ave on this, and here are the first results:<br />
<object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/hRTgFTMnT_U&#038;rel=1"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/hRTgFTMnT_U&#038;rel=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://siwu.info/64/dwm-hacking-extracting-the-window-texture.html/feed</wfw:commentRss>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.857 seconds -->
