libnds IPC - gone?

Post Reply
neunon
Posts: 3
Joined: Tue Apr 13, 2010 10:39 pm

libnds IPC - gone?

Post by neunon » Tue Apr 13, 2010 10:44 pm

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?

User avatar
coreyh2
Posts: 33
Joined: Tue Feb 02, 2010 12:43 am

Re: libnds IPC - gone?

Post by coreyh2 » Wed Apr 14, 2010 4:22 am

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.

WinterMute
Site Admin
Posts: 1845
Joined: Tue Aug 09, 2005 3:21 am
Location: UK
Contact:

Re: libnds IPC - gone?

Post by WinterMute » Wed Apr 14, 2010 3:36 pm

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.
Help keep devkitPro toolchains free, Donate today

Personal Blog

neunon
Posts: 3
Joined: Tue Apr 13, 2010 10:39 pm

Re: libnds IPC - gone?

Post by neunon » Wed Apr 14, 2010 10:39 pm

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);"?

neunon
Posts: 3
Joined: Tue Apr 13, 2010 10:39 pm

Re: libnds IPC - gone?

Post by neunon » Wed Apr 14, 2010 10:41 pm

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.

User avatar
vuurrobin
Posts: 219
Joined: Fri Jul 11, 2008 8:49 pm
Location: The Netherlands
Contact:

Re: libnds IPC - gone?

Post by vuurrobin » Thu Apr 15, 2010 12:15 am

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.

Jens
Posts: 21
Joined: Tue Jun 09, 2009 5:13 am
Contact:

Re: libnds IPC - gone?

Post by Jens » Wed May 05, 2010 4:53 am

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.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 18 guests