Oggplayer thread issues

support for the powerpc toolchain
Post Reply
Lin
Posts: 18
Joined: Sat Feb 20, 2010 5:20 pm
Location: Salt Lake City

Oggplayer thread issues

Post by Lin » Sat May 01, 2010 7:40 am

Does anyone here know of a thread problem with oggplayer and any workarounds?

I just added oggplayer to my game application based on the oggplayer example code that came with devkitPro. Before my main loop, I call PlayOgg to begin a long-running background music track. The program compiles and runs, but it crashes at a couple of places and dumps core. These crashes did not occur before I added oggplayer. They do not occur if I leave the program in its initial state, before entering the main loop, and let the track play to completion. They only occur after playing the game for about a minute while the track is playing.

Apologies for the "help me" thread. Without posting my whole 1000+ lines of (otherwise single-threaded) code, there's little to be gained from the context. Anyway, here's one of the cases on which it consistently crashes. It crashes on the "else" case of (turncounter < turnlength); in this case, it only modifies some variables local to the main function. Why would that fuss with the memory state of the oggplayer thread?

Code: Select all

if (nextmove == 5) // it's P1's turn
{
	determineHLTile(hlcursor0, cursor0_x, cursor0_y);
	if ((wdown0 & WPAD_BUTTON_A) && (moves[hlcursor0[1]][hlcursor0[0]] == 17))
	{
		moves[hlcursor0[1]][hlcursor0[0]] = nextmove;
		nextmove ^= 2;	// flip the second-rightmost bit
		turncounter = 0;
	}
						
	if (turncounter < turnlength)
	{
		turncounter++;
	}
	else
	{
		if (moves[hlcursor0[1]][hlcursor0[0]] == 17)
		{
			moves[hlcursor0[1]][hlcursor0[0]] = nextmove;
		}
		else
		{
			badmoveflag = 1;
		}
		nextmove ^= 2;	// flip the second-rightmost bit
		turncounter = 0;
	}
}

Lin
Posts: 18
Joined: Sat Feb 20, 2010 5:20 pm
Location: Salt Lake City

Re: Oggplayer thread issues

Post by Lin » Tue May 04, 2010 7:08 pm

Well, I figured it out: when I drew pixels on the framebuffer I was writing off the end of it and, I assume, into memory that oggplayer was using. The memory gets corrupted, oggplayer tries to play COLOR_RED, shit gets ugly, crash.

I'm a big doofus, don't be like me. Don't write off the end of the framebuffer.

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests