Index | FAQ | Search | Memberlist | Usergroups | Profile | Log in to check your private messages | Log in | Register

Descriptive Modding: The PSP Engine Goto page Previous 1, 2, 3, 4, 5 Next

| Inside3d Forums Forum Index -> Engine Programming

View previous topic :: View next topic
Author | Message
--- | ---
Baker Joined: 14 Mar 2006 Posts: 1538 |

Posted: Thu Jan 28, 2010 7:28 am Post subject: |

Back to the mp3 playback issue. Kurok does not seem to crash on the mp3s in Kurok. I waited for 5 minutes to see what Kurok did with the Kurok mp3s ... nothing happened. Using the Quake soundtrack as mp3s, it crashes in a couple of minutes. Perhaps the mp3s must be looped?
_________________
Tomorrow Never Dies. I feel this Tomorrow knocking on the door ...

Back to top |

LonePossum. Joined: 02 Nov 2009 Posts: 38 |

Posted: Thu Jan 28, 2010 7:53 am Post subject: |

From my Understanding the PSP Engine that Kurok Started of as PSP Quake 1.1 by Juraj Styk had the MP3 Support Built in Previously to when MDave started his work on building kurok. I ran that engine a few mins ago with a mp3 or two in the folder un looped, and they worked fine. Im pretty sure that they do not need to be looped as the song kept playing longer than how it is so from my understanding it must have been codded to go 01 - 02 - 04 and so forth and then once it reachs the last track it starts again from 01.
Hope I am correct on the matter.

Back to top |

Baker Joined: 14 Mar 2006 Posts: 1538 |

Posted: Thu Jan 28, 2010 8:10 am Post subject: |

LonePossum. wrote:
From my Understanding the PSP Engine that Kurok Started of as PSP Quake 1.1 by Juraj Styk had the MP3 Support Built in Previously to when MDave started his work on building kurok. I ran that engine a few mins ago with a mp3 or two in the folder un looped, and they worked fine. Im pretty sure that they do not need to be looped as the song kept playing longer than how it is so from my understanding it must have been codded to go 01 - 02 - 04 and so forth and then once it reachs the last track it starts again from 01.
Hope I am correct on the matter.

I copied a Kurok mp3 over and used it with the current revision: crash at end of song. The same Kurok mp3 plays fine in a self-compiled Kurok build and doesn't crash at the end of the song.
So, I'll have to investigate that and do a bit more research on it. Should be simple enough to solve.
_________________
Tomorrow Never Dies. I feel this Tomorrow knocking on the door ...

Back to top |

Team Xlink Joined: 25 Jun 2009 Posts: 320 |

Posted: Thu Jan 28, 2010 4:50 pm Post subject: |

The Kurok MP3 code is differn't then the MP3 code in PSPQuake 1.1 If you win merge it is is really easy to see the changes. _________________

Anonymous wrote:
if it works, it works. if it doesn't, HAHAHA!

Back to top |

MDave Joined: 17 Dec 2007 Posts: 75 |

Posted: Thu Jan 28, 2010 5:18 pm Post subject: |

I thought I'd chime in. The MP3 code in Kurok is based on an implementation by cpasjuste. It's hardware coded mp3 support The MP3 code included with PSPQuake 1.1 uses the libmad library, which is software based. This causes quite a performance decrease.
However, the hardware mp3 code has a bug somewhere. I tried fixing it but I'm clueless where the issue is. I asked for help in the past but had no luck. In the end I had to work around this bug by hard coding the track times in the qc code so when it's about to end the track, it will play a new track. Sucks, but that was the only way to do it Thus I had to modify some of the engine code a bit too so the music stops and plays when you enter / exit the menu in single player.
It's all a tangled mess.

Back to top |

Baker Joined: 14 Mar 2006 Posts: 1538 |

Posted: Thu Jan 28, 2010 5:26 pm Post subject: |

MDave wrote:
I thought I'd chime in. The MP3 code in Kurok is based on an implementation by cpasjuste. It's hardware coded mp3 support The MP3 code included with PSPQuake 1.1 uses the libmad library, which is software based. This causes quite a performance decrease.
However, the hardware mp3 code has a bug somewhere. I tried fixing it but I'm clueless where the issue is. I asked for help in the past but had no luck. In the end I had to work around this bug by hard coding the track times in the qc code so when it's about to end the track, it will play a new track. Sucks, but that was the only way to do it Thus I had to modify some of the engine code a bit too so the music stops and plays when you enter / exit the menu in single player.
It's all a tangled mess.

MDave, thanks for that info, it is much appreciated and will save me a lot of time. I had assumed it was something I did wrong. Maybe I can make the workaround a 100% engine-side fix.
/I'm using 100% Kurok for the mp3 support so I'm not using the PSP Quake 1.1 software mp3.
_________________
Tomorrow Never Dies. I feel this Tomorrow knocking on the door ...

Back to top |

Baker Joined: 14 Mar 2006 Posts: 1538 |

Posted: Fri Jan 29, 2010 5:21 am Post subject: |

I know where this is failing. Now just to find out if there is a reasonable way to stop it, entrap it or otherwise make it at least not crash ... mp3 ...

Code:
static int read_next_frame(int which_buffer) { int i, bytes_read, frame_offset; int bitrate, padding, frame_size = 0; for (i = 0; i < 32; i++)
{
bytes_read = sceIoRead(mp3_handle, mp3_src_buffer[which_buffer], sizeof(mp3_src_buffer[which_buffer]));
mp3_src_pos += bytes_read;
if (bytes_read < MIN_INFRAME_SIZE) {
mp3_src_pos = mp3_src_size;
return 0; // EOF/IO failure
}
frame_offset = find_sync_word(mp3_src_buffer[which_buffer], bytes_read);
if (frame_offset < 0) {
printf("missing syncword, foffs=%i\n", mp3_src_pos - bytes_read);
mp3_src_pos--;
sceIoLseek32(mp3_handle, mp3_src_pos, PSP_SEEK_SET);
continue;
}
if (bytes_read - frame_offset < 4) {
printf("syncword @ EOB, foffs=%i\n", mp3_src_pos - bytes_read);
mp3_src_pos--;
sceIoLseek32(mp3_handle, mp3_src_pos, PSP_SEEK_SET);
continue;
}
bitrate = mp3_src_buffer[which_buffer][frame_offset+2] >> 4;
padding = (mp3_src_buffer[which_buffer][frame_offset+2] & 2) >> 1;
frame_size = 144000*bitrates[bitrate]/44100 + padding;
if (frame_size <= 0) {
printf("bad frame, foffs=%i\n", mp3_src_pos - bytes_read);
continue; // bad frame
}
if (bytes_read - frame_offset < frame_size)
{
printf("unfit, foffs=%i\n", mp3_src_pos - bytes_read);
mp3_src_pos -= bytes_read - frame_offset;
if (mp3_src_size - mp3_src_pos < frame_size) {
mp3_src_pos = mp3_src_size;
return 0; // EOF
}
sceIoLseek32(mp3_handle, mp3_src_pos, PSP_SEEK_SET);
continue; // didn't fit, re-read..
}
if (frame_offset) {
//printf("unaligned, foffs=%i, offs=%i\n", mp3_src_pos - bytes_read, frame_offset);
memmove(mp3_src_buffer[which_buffer], mp3_src_buffer[which_buffer] + frame_offset, frame_size);
}
// align for next frame read
mp3_src_pos -= bytes_read - (frame_offset + frame_size);
sceIoLseek32(mp3_handle, mp3_src_pos, PSP_SEEK_SET);
break;
}
return frame_size > 0 ? frame_size : -1;
}

Specifically ....

Code:
for (i = 0; i < 32; i++) { bytes_read = sceIoRead(mp3_handle, mp3_src_buffer[which_buffer], sizeof(mp3_src_buffer[which_buffer])); mp3_src_pos += bytes_read; if (bytes_read < MIN_INFRAME_SIZE) {
mp3_src_pos = mp3_src_size;
return 0; // EOF/IO failure
}

We are getting EOF/IO failure.
Now ...
Why is this crashing us?
_________________
Tomorrow Never Dies. I feel this Tomorrow knocking on the door ...

Back to top |

Baker Joined: 14 Mar 2006 Posts: 1538 |

Posted: Fri Jan 29, 2010 5:52 am Post subject: |

Revision "KurokQuake 9": source End of MP3 music no longer causes crash. mp3 music goes in id1\music folder as track01.mp3, track02.mp3 and such. _________________ Tomorrow Never Dies. I feel this Tomorrow knocking on the door ...

Back to top |

Biodude Joined: 27 Aug 2008 Posts: 83 |

Posted: Sun Jan 31, 2010 2:33 am Post subject: |

can I get a compiled version ?

Back to top |

Baker Joined: 14 Mar 2006 Posts: 1538 |

Posted: Sun Jan 31, 2010 2:35 am Post subject: |

It's in the revision 9 source .rar download in the psp/normal folder. _________________ Tomorrow Never Dies. I feel this Tomorrow knocking on the door ...

Back to top |

Team Xlink Joined: 25 Jun 2009 Posts: 320 |

Posted: Sat Feb 06, 2010 8:21 pm Post subject: |

What did you change to make it work with standard Quake Servers? _________________

Anonymous wrote:
if it works, it works. if it doesn't, HAHAHA!

Back to top |

Baker Joined: 14 Mar 2006 Posts: 1538 |

Posted: Sun Feb 07, 2010 1:20 am Post subject: |

The short version is that I removed the ProQuake aim. ProQuake aim uses a short (2 bytes). Quake aim uses a byte. ProQuake only uses a short when connected to a ProQuake server. Kurok was always using a short. _________________ Tomorrow Never Dies. I feel this Tomorrow knocking on the door ...

Back to top |

Team Xlink Joined: 25 Jun 2009 Posts: 320 |

Posted: Sun Feb 07, 2010 1:54 am Post subject: |

Alright, thank you. Also about the Pro Quake aim, all it did was make the aiming more exact/precise it wasn't auto aim, right? _________________

Anonymous wrote:
if it works, it works. if it doesn't, HAHAHA!

Back to top |

Baker Joined: 14 Mar 2006 Posts: 1538 |

Posted: Sun Feb 07, 2010 1:58 am Post subject: |

ProQuake aim uses a short (2 bytes) to allow 65536 angles so more aim precision. Kurok used this as well. I believe Quakeworld uses shorts as well. Single byte aim (Quake) only allows 256 angles and original Quake has some bad rounding, so original Quake might not always shoot where the crosshair is pointing but the one side or the other a little or up a little or down a little etc.
Has nothing to do with autoaim at all.
Standard unmodified Quake has several long distance shots that are simply impossible to make usually due to the angle limitations. For instance on a large map if you try to shoot a far away healthbox it might be impossible no matter what you do to actually try to shoot it directly with a rocket because the angle(s) you need gets rounded off (poorly) and too imprecisely.
_________________
Tomorrow Never Dies. I feel this Tomorrow knocking on the door ...

Back to top |

Spike Joined: 05 Nov 2004 Posts: 944 Location: UK |

Posted: Sun Feb 07, 2010 2:24 am Post subject: |

note that rounding will cause aiming to be shifted on average by 1/512th of a rotation to the left, as its rounded down. You'll still get the effect with 2-byte angles, just not noticably so. So yeah, you can improve accuracy without breaking networking. Just not by much. :)
_________________
What's a signature?

Back to top |

Display posts from previous:

| Inside3d Forums Forum Index -> Engine Programming | All times are GMT Goto page Previous 1, 2, 3, 4, 5 Next
Page 4 of 5

Jump to:

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2004 phpBB Group