| Author |
Message |
|
Ver Greeneyes
Joined: 2009-04-10 at 04:38 PM Posts: 1033 Location: The Netherlands
|
 bsnes compilation guide for Windows
This step-by-step guide assumes you're using Windows XP or up, with no previous compilation environment installed. 1a) Download the latest version of the TDM-GCC - either the Bundle or the On-Demand Installer. 1b) Install 'MinGW/TDM (32-bit)' (this guide assumes the default destination of 'C:\MinGW32' is chosen); on the Choose Components screen, enable 'openmp' in the 'gcc' section (this is needed for the multi-threaded HQ2x filter). 2a) Download and install the DirectX SDK (June 2010); only the Headers and Libs are strictly required. Note: direct link at time of writing (24 June, 2010).2b) Navigate to the DirectX SDK's Include directory and copy and paste all the files there into MinGW's include directory ('C:\MinGW32\include' by default). 2c) Grab MinGW-compatible versions of ddraw.h, dsound.h and xinput.h from here or here and overwrite the versions contained in MinGW's include directory ('C:\MinGW32\include' by default). 3) Download the OpenGL glext.h and drop it in MinGW's include\GL directory ('C:\MinGW32\include\GL' by default). 4a) Download the Qt libraries 4.6.0 beta 1 (source package). 4b) Extract the package to a directory of your choice (this guide will assume a default of 'C:\Qt'). Note: since the archive includes a base directory, make sure you extract the files inside it to the location you chose, rather than the directory itself.4c) Add Qt's bin directory ('C:\Qt\bin' by default) to your PATH environment variable. 4d) Create a new environment variable called QTDIR and set it to Qt's base directory ('C:\Qt' by default). Note: this is required for the 'configure' command below to work.5a) Open a cmd window and navigate to the directory where you installed Qt. 5b) Configure and build Qt using the following commands: Code: configure -release -opensource -confirm-license -platform win32-g++ -ltcg -nomake tools -nomake examples -nomake demos -no-exceptions -no-accessibility -no-stl -plugin-sql-sqlite -no-qt3support -no-vcproj -no-rtti -no-openssl -no-dbus -no-phonon -no-phonon-backend -no-webkit -no-scripttools -no-style-plastique -no-style-cleanlooks -no-style-motif -no-style-cde
mingw32-make -s -j 4 sub-src 6a) Download and extract the latest cross-platform source code for bsnes from here or here (beta versions). 6b) Run 'cc.bat' to compile bsnes. Note 1: If the package you downloaded included them, remove 'mingwm10.dll', 'QtCore4.dll' and 'QtGui4.dll' or replace them with your own.Note 2: Likewise, bsnes' multithreaded HQ2x filter requires 'libgomp-1.dll', which can be found in MinGW's lib\gcc\mingw32\bin directory ('C:\MinGW32\lib\gcc\mingw32\bin' by default).Note 3: If you wish to compile bsnes to use SSE instructions, you must also add -fno-tree-vectorize to the makefile, due to stack alignment issues involving certain SSE instructions and Qt.7) Profit! Note: to get the full functionality out of bsnes, you will need to compile the supergameboy, snesfilter and snesreader extensions, all of which are included in the source package. If you have followed this guide, they should compile just fine.
_________________ bsnes compilation guide for Windows (need to add x64 build instructions) Frequency Test 1.6, or Frequency Test 2.0 (for use with my updated Direct3D driver)
Last edited by Ver Greeneyes on 2010-07-11 at 10:27 PM, edited 105 times in total.
|
| 2009-05-11 at 01:34 PM |
|
 |
|
Jipcy
Joined: 2009-04-11 at 02:31 AM Posts: 74
|
 Re: bsnes compilation guide for Windows
Just to be sure, what are the main benefits of compiling for oneself? Processor-specific optimizations?
|
| 2009-05-11 at 02:58 PM |
|
 |
|
Ver Greeneyes
Joined: 2009-04-10 at 04:38 PM Posts: 1033 Location: The Netherlands
|
 Re: bsnes compilation guide for Windows
Jipcy wrote: Just to be sure, what are the main benefits of compiling for oneself? Processor-specific optimizations? No benefits, really. Bsnes is pretty optimised as it is. But if you want to mess around with the source code.. (as I have in the past)
_________________ bsnes compilation guide for Windows (need to add x64 build instructions) Frequency Test 1.6, or Frequency Test 2.0 (for use with my updated Direct3D driver)
|
| 2009-05-11 at 03:41 PM |
|
 |
|
byuu
Joined: 2009-04-10 at 03:00 PM Posts: 3094
|
 Re: bsnes compilation guide for Windows
Thanks for the guide. If you want to perfectly match my build size, you'd also want to edit the Qt mkspecs to add -Os -fomit-frame-pointer in place of -O2. I wouldn't bother for personal use. Optimizing for your native architecture (-march=foo) could add up to a ~10-15% speedup over the vanilla builds (amd64 users get most of this by default, since the oldest amd64 chip has eg SSE3), but you'd also have to profile it. Quite a bit of work for an ordinary user. Quote: 8) Navigate to the DirectX SDK's Lib directory and open the x86 subdirectory, then find 'XInput.lib'. Copy and paste it into MinGW's lib directory, then rename it to 'libxinput.a'. Yeah, this part sucks. But any time I try and call XInputGetState from a pointer via GetProcAddress, the whole program crashes. It must be conflicting with some other driver already loaded. EDIT: found it. I was binding to: DWORD (*XInputGetState)(DWORD, XINPUT_STATE*); I omitted the WINAPI part, which was corrupting the stack. Needs to be: DWORD WINAPI (*XInputGetState)(DWORD, XINPUT_STATE*); WINAPI = __stdcall, it changes the calling convention to Windows' style, whereas -O2 defaults the convention to __fastcall. Unfortunately, nall::function<> can't bind with different calling conventions specified, so I'll have to do that call the old fashioned way as above. Next build shouldn't require xinput1_3.dll, but won't support Xbox 360 triggers properly without it. It also won't require libxinput.a either way.
_________________ Elements of the past and the future, combining to make something not quite as good as either.
|
| 2009-05-11 at 04:14 PM |
|
 |
|
Ver Greeneyes
Joined: 2009-04-10 at 04:38 PM Posts: 1033 Location: The Netherlands
|
 Re: bsnes compilation guide for Windows
Quote: Optimizing for your native architecture (-march=foo) could add up to a ~10-15% speedup over the vanilla builds (amd64 users get most of this by default, since the oldest amd64 chip has eg SSE3), but you'd also have to profile it. Quite a bit of work for an ordinary user. I'm not seeing a lot of difference between a build without any processor-specific features and one with all the bells and whistles enabled - is profiling needed before the difference will show up?
_________________ bsnes compilation guide for Windows (need to add x64 build instructions) Frequency Test 1.6, or Frequency Test 2.0 (for use with my updated Direct3D driver)
|
| 2009-05-11 at 07:05 PM |
|
 |
|
byuu
Joined: 2009-04-10 at 03:00 PM Posts: 3094
|
 Re: bsnes compilation guide for Windows
Well, I get ~152fps with no profling on Win32 and Linux32, and ~168fps with no profiling on Linux64. Nach's theory was that the default march is higher. It could be the 64-bitness that helps. bsnes should also be compilable as 64-bit on Windows, but I don't have the compiler to do it myself.
_________________ Elements of the past and the future, combining to make something not quite as good as either.
|
| 2009-05-11 at 07:07 PM |
|
 |
|
Ver Greeneyes
Joined: 2009-04-10 at 04:38 PM Posts: 1033 Location: The Netherlands
|
 Re: bsnes compilation guide for Windows
byuu wrote: bsnes should also be compilable as 64-bit on Windows, but I don't have the compiler to do it myself. Pity TDM/MinGW doesn't include x64 support..
_________________ bsnes compilation guide for Windows (need to add x64 build instructions) Frequency Test 1.6, or Frequency Test 2.0 (for use with my updated Direct3D driver)
|
| 2009-05-11 at 07:57 PM |
|
 |
|
Screwtape
Joined: 2009-04-11 at 04:21 AM Posts: 390
|
 Re: bsnes compilation guide for Windows
byuu wrote: It could be the 64-bitness that helps. I believe the common wisdom is that speed-up from x86_64's reasonably-sized set of general-purpose registers more than compensates for the slow-down caused by L1/L2 cache being wasted on enormous pointers. In every other architecture with 32-bit and 64-bit variants, the 64-bit version was much slower. The only reason x86 is different is that x86_32 was such a dog to begin with.
|
| 2009-05-12 at 01:14 AM |
|
 |
|
Dullaron
Joined: 2009-04-10 at 06:40 PM Posts: 99
|
 Re: bsnes compilation guide for Windows
I updated my page with downloads. I notice bsnes.exe size got bigger after I remake it with the newest QT and TDM.
_________________ Window 7 Home Premium 32-bit / Intel Core 2 Quad Q6600 2.40Ghz / 3.00 GB RAM / ATI Radeon HD 4670 1GB Memories bsnes compilation guide for Windows by Ver Greeneyes - viewtopic.php?f=3&t=74
|
| 2009-05-13 at 01:59 AM |
|
 |
|
Ver Greeneyes
Joined: 2009-04-10 at 04:38 PM Posts: 1033 Location: The Netherlands
|
 Re: bsnes compilation guide for Windows
Dullaron wrote: I updated my page with downloads. I notice bsnes.exe size got bigger after I remake it with the newest QT and TDM. Yeah, that's because of this: byuu wrote: If you want to perfectly match my build size, you'd also want to edit the Qt mkspecs to add -Os -fomit-frame-pointer in place of -O2. I'm not sure how to do that and I figured it wasn't important for the guide.
_________________ bsnes compilation guide for Windows (need to add x64 build instructions) Frequency Test 1.6, or Frequency Test 2.0 (for use with my updated Direct3D driver)
|
| 2009-05-13 at 10:48 AM |
|
 |
|
Nach
Joined: 2009-04-13 at 05:50 AM Posts: 104
|
 Re: bsnes compilation guide for Windows
Anyone interested in bget?
_________________ "When we (the MPAA) finally employ unbreakable DRM on our content, it will be using tools provided to us by the free and open source community."
|
| 2009-05-13 at 09:02 PM |
|
 |
|
panzeroceania
Joined: 2009-04-10 at 10:30 PM Posts: 766 Location: Salem, Oregon
|
 Re: bsnes compilation guide for Windows
Nach wrote: Anyone interested in bget? YES I used to swear by zget, that would be awesome. and if you're joking.... that's just cruel. although it really doesn't matter with bsnes considering how byuu releases. basically I'm actually just broken up about zsnes being MIA. zget makes sense for zsnes.
_________________ if you don't know who my avatar is, his name is Paet. He is a mechanic.
|
| 2009-05-13 at 09:49 PM |
|
 |
|
Dullaron
Joined: 2009-04-10 at 06:40 PM Posts: 99
|
 Re: bsnes compilation guide for Windows
Last time I try zget it no longer let me download the zsnes updates or what ever. Seem totally dead.
But if byuu keep it alive and working then I will use bget.
_________________ Window 7 Home Premium 32-bit / Intel Core 2 Quad Q6600 2.40Ghz / 3.00 GB RAM / ATI Radeon HD 4670 1GB Memories bsnes compilation guide for Windows by Ver Greeneyes - viewtopic.php?f=3&t=74
|
| 2009-05-14 at 05:01 AM |
|
 |
|
Screwtape
Joined: 2009-04-11 at 04:21 AM Posts: 390
|
 Re: bsnes compilation guide for Windows
I'm not familiar with zget, but I expect it's based on pulling the latest version from zsnes' public source repository. As far as I know bsnes doesn't have such a thing, so automation would likely be... difficult.
|
| 2009-05-14 at 05:34 AM |
|
 |
|
Jipcy
Joined: 2009-04-11 at 02:31 AM Posts: 74
|
 Re: bsnes compilation guide for Windows
Also, I think the current ZSNES source is not available to the public. I don't think they use SourceForge or BountySource anymore.
|
| 2009-05-15 at 02:06 AM |
|
|