Descriptive Modding: The PSP Engine
Moderator: InsideQC Admins
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?
Perhaps the mp3s must be looped?
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
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 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.
- LonePossum.
- Posts: 38
- Joined: Mon Nov 02, 2009 11:07 am
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.
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
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.
PSPQuake 1.1
If you win merge it is is really easy to see the changes.
- Team Xlink
- Posts: 368
- Joined: Thu Jun 25, 2009 4:45 am
- Location: Michigan
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.
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
It's all a tangled mess.
-

MDave - Posts: 76
- Joined: Mon Dec 17, 2007 7:08 pm
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 itThus 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.
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
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 ...
Specifically ....
We are getting EOF/IO failure.
Now ...
Why is this crashing us?
mp3 ...
- Code: Select all
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: Select all
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?
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
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.
End of MP3 music no longer causes crash.
mp3 music goes in id1\music folder as track01.mp3, track02.mp3 and such.
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
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.
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.
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
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?
Also about the Pro Quake aim, all it did was make the aiming more exact/precise it wasn't auto aim, right?
- Team Xlink
- Posts: 368
- Joined: Thu Jun 25, 2009 4:45 am
- Location: Michigan
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.
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.
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
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. :)
So yeah, you can improve accuracy without breaking networking. Just not by much. :)
- Spike
- Posts: 2892
- Joined: Fri Nov 05, 2004 3:12 am
- Location: UK
Who is online
Users browsing this forum: No registered users and 1 guest
