Page 1 of 1

libnds IPC - gone?

Posted: Tue Apr 13, 2010 10:44 pm
by neunon
Hi all,

A friend and I are working on taking up development of the seemingly abandoned DScent project (DS port of Descent). We grabbed the latest source we could find and tried to compile it. Unfortunately, the code makes use of some things which are now gone in more recent libnds versions. For instance, the "IPC" struct. What's not clear here is what the upgrade path is for those that make use of the IPC struct. Can someone point me to a before-and-after example or something? Or at least to what API -should- be used?

Re: libnds IPC - gone?

Posted: Wed Apr 14, 2010 4:22 am
by coreyh2
If you look at the examples that come with libnds for audio and input you'll see how the library works now. Those are the things the IPC structure was used for. Initiation and some other variable names have also changed.

I agree that its frustrating looking at old code. Most of the code I have from completed 2d tiled projects doesn't compile. You'll have to port your project to the new interface if you want to take over old code.

I'm not a expert on the process myself. I'm still a newbie.

Re: libnds IPC - gone?

Posted: Wed Apr 14, 2010 3:36 pm
by WinterMute
It really depends on what was being done with the old IPC struct - fwiw, this was always slated for deprecation and should never have been public in the first place. If at all possible the best place to start is to remove the custom arm7 code and rework the project for arm9 only.

If you can provide some code snppets it might be easier to suggest replacements.

Re: libnds IPC - gone?

Posted: Wed Apr 14, 2010 10:39 pm
by neunon
Well, here's the function I'm dealing with at the moment:

Code: Select all

void VcountHandler (void)
{
	static int lastbut = -1;
	uint16 but = 0, x = 0, y = 0, xpx = 0, ypx = 0, z1 = 0, z2 = 0;

	but = REG_KEYXY;

	if (!( (but ^ lastbut) & (1 << 6)))
	{
 		touchReadXY ( &tempPos );

		if (tempPos.rawx == 0 || tempPos.rawy == 0)
		{
			but |= (1 <<6);
			lastbut = but;
		}
		else
		{
			x = tempPos.rawx;
			y = tempPos.rawy;
			xpx = tempPos.px;
			ypx = tempPos.py;
			z1 = tempPos.z1;
			z2 = tempPos.z2;
		}
	}
	else
	{
		lastbut = but;
		but |= (1 << 6);
	}
	if (but & (1 << 7))
		needSleep = 1;

	if (vcount == 80)
		first = tempPos;
	else
	{
		if (abs (xpx - first.px) > 10 || abs (ypx - first.py) > 10 || (but & (1 << 6)))
		{
			but |= (1 << 6);
			lastbut = but;
		}
		else
		{
			IPC->mailBusy = 1;
			IPC->touchX = x;
			IPC->touchY = y;
			IPC->touchXpx = xpx;
			IPC->touchYpx = ypx;
			IPC->touchZ1 = z1;
			IPC->touchZ2 = z2;
			IPC->mailBusy = 0;
		}
	}
	IPC->buttons = but;
	vcount ^= (80 ^ 130);
	SetYtrigger (vcount);
}
Incidentally, to resolve another problem in the same file, what's the replacement for "SOUND_CR = SOUND_ENABLE | SOUND_VOL (0x7F);"? Just "powerOn(PM_SOUND_AMP);"?

Re: libnds IPC - gone?

Posted: Wed Apr 14, 2010 10:41 pm
by neunon
WinterMute wrote:If at all possible the best place to start is to remove the custom arm7 code and rework the project for arm9 only.
Don't you have to have both the ARM7 and ARM9 working in tandem to implement WiFi support in applications? Because that's the next step after debugging this thing.

Re: libnds IPC - gone?

Posted: Thu Apr 15, 2010 12:15 am
by vuurrobin
you need the arm7 to use wifi, but the default arm7 binary has DSwifi included, so you can just use the default arm7 binary and DSwifi.
WinterMute wrote:project for arm9 only.
you might want to rename that to "project that uses the default arm7 binary", to make it less ambiguous.

Re: libnds IPC - gone?

Posted: Wed May 05, 2010 4:53 am
by Jens
As far as I could see, there was no special-cases in the code you posted above. That was all basic input code and is well handled by the default ARM7 core. You just have to change your ARM9 side to work with it, and that's should be well documented in the nice input examples. Regarding the sound stuff, my take is that you should throw your sound support out and just rewrite it using maxmod or something that's compatible with the new toolchain.