Tuesday, August 4, 2009

Porting DeSmuME to Wii - Part 2 -

This post has been updated since it was originally posted and a new source revision is available for download at the bottom of the post.

So now that we're set up to compile under libogc, let's get to porting the main (or "core") part of DeSmuME.

If we just make, a few of the files will compile fine and then we'll get an error that 'PATH_MAX' is not defined. To take care of this error, go into types.h and comment out or remove the following code:
#ifdef __GNUC__
#include

#define MAX_PATH PATH_MAX
#endif


Then, in NDSSystem.h, add the following line of code:
#define MAX_PATH 200

MAX_PATH represents the maximum number of characters that can be in a path (a path is a location such as sd:/apps/myapp/boot.dol). Because we don't have access to the library that defines PATH_MAX, we need to define MAX_PATH on our own. I'm using the number 200 for now for simplicity, but we could extend that to something that allows for paths with a much higher character count.

So now a few more files will compile fine... And then we'll get errors in MMU.h that std::wstring doesn't exist. We can correct this with the following line of code in movie.h:
#define wstring basic_string

We must do this because libogc lacks proper wstring support.

Now a few more files will compile fine (remember, we can ignore warnings)... Until we get to problems with OGLRender.cpp and OGLRender.h To correct these errors, we'll have to replace the OpenGL dependent code with code dependent on libogc's GX. This shouldn't be particularly difficult since most of the GX code looks strikingly similiar to OpenGL. We may have to switch up some parameters though, and of course, we'll have to properly link in GX.

So, at this point about 1/4th of the "core" of the emulator has been successfully ported to the Wii. I hope other people will take a stab at this (so I can come home from work tonight and see someone has already ported the OpenGL code ;) ) so we can get DeSmuME up and running on the Wii sooner.

You can download the latest revision of the source code of my port of DeSmuME to Wii by clicking here.

Click here to read the next part of the port.
Click here to read the previous part of porting DeSmuME.

No comments:

Post a Comment