Radnen / spherestudio

A .NET based editor for your Sphere RPG games.
MIT License
16 stars 3 forks source link

Full 64-bit support #43

Closed fatcerberus closed 9 years ago

fatcerberus commented 9 years ago

So I went in a different direction than I originally intended and greatly simplified things in the process. There are no more separate x86 and x64 builds, just one unified "Any CPU" (MSIL) build which runs in long mode (64-bit) on any system that supports it and falls back to 32-bit if it's not.

I added an extra pulldown next to the engine selector to switch between testing games with either 32- or 64-bit versions of the selected engine.

As mentioned in the thread, proprietary IrrKlang was replaced with NAudio. It's open source and can be updated through NuGet.

fatcerberus commented 9 years ago

So, one caveat: NAudio seemingly doesn't support mod/it/s3m music. mp3, Ogg and WAV are supported (and MIDI with a little extra work), but no module formats. :disappointed: Your call whether you want to merge this as-is or wait and see if I can find an alternative (there don't appear to be any MOD libraries on NuGet).

fatcerberus commented 9 years ago

Follow-up: An alternative I just thought of would be to return to using irrKlang and include both 32- and 64-bit DLLs, dynamically load the correct one at runtime instead of using a direct project reference. I already know this is possible since it's how Sphere Studio loads plugins.

Radnen commented 9 years ago

Dude dude dude.... You could create an NAudio Plugin and an IrrKlang Plugin. If you want, you can treat the IrrKlang plugin as the default, and the NAudio as an additional plugin.

Plus a reworking for 64bit build for IrrKlang, if you want to still be adventurous.

fatcerberus commented 9 years ago

Hm, good point. I try to keep things simple when I can, but audio backends are one of those finicky things where it's beneficial to support more than one. I'll see about doing something with this idea.

fatcerberus commented 9 years ago

Okay, how's this? It will use (64bit) irrKlang when it can, and fall back to NAudio otherwise. If neither one can load the sound, an error popup will be shown. We can add more engines if needed in the future by inheriting the IPlayer interface.

I still can't figure out how to get it to dynamically use either 32- or 64-bit irrKlang, so I just used the 64bit one. Since the IDE launches as a 64-bit process by default now, that seems like the most common scenario. On a 32bit system it will just fail to load the IrrKlang assembly and have to fall back to NAudio (actual sound loading is done in a try/catch so it won't crash).

fatcerberus commented 9 years ago

Don't merge this just yet, I want to do a bit more GUI polishing first. Since I'm including it with minisphere now, I felt I should start whipping it into shape and try to make the dialogs and stuff consistent. :)

fatcerberus commented 9 years ago

Okay, that should be good now.