What's new

rsp_hle endian issues?

tehpola

New member
Hey, I'm working on a port of Mupen64 to the Gamecube/Wii and it runs a PPC processor (big endian as opposed to x86 which is LE). For the most part, I've noticed that the mupen code does a pretty decent job of working on either endian machines (I had to rewrite the framebuffer code in the software graphics, but that wasn't a big deal). Anyways, when I couldn't get sound to work properly (just garbage) I came to the conclusion that it is most likely an endian issue. I believes it originates in the rsp_hle plugin because it seems that it doesn't handle endian the way the rest of the code does. Can anyone confirm this for me? If so, what is actually the correct logic, and what is byte-swapping? If anyone can help me rewrite the RSP to be endian-aware, we would greatly appreciate it.
Thanks,
tehpola
 

nmn

Mupen64Plus Dev.
Wow, you mean its working on the GC?

-AND-

Byteswapping is when you swap the order of the bytes of something, usually on the n64 from every four bytes. Imagine a psuedo swap copy op being:
Code:
dest = (int*)
src = (int*)
length = (int)
--
for(int i=0; i<length/4; i++)
{
  dest[0] = src[3];
  dest[1] = src[2];
  dest[2] = src[1];
  dest[3] = src[0];
  dest++; // Because its an int pointer, thats the equivalent of 4 bytes.
  src++;
}
 
OP
T

tehpola

New member
Yes, we do have it running on the GC (not very well yet though): http://code.google.com/p/mupen64gc/ for screenshots, downloads, etc. I'm sorry, I should have phrased my question more clearly. I'm aware of what byte-swapping is, its purpose, etc. However, there are several places in the rsp_hle code in which xor is being used in such a way that it could be byte-swapping, but it could also be the logic of the way the audio is being mixed/decoded. I was hoping that someone here knew the rsp_hle plugin well enough to help me go through the plugin and correct it to be endian aware by helping me distinguish what part of the code is performing relevant calculations, and what is doing byte-swapping. Thanks for your reply though, and hopefully we can figure this out because I know it'll benefit the PPC-Mac community as well.
 
OP
T

tehpola

New member
Wow, I feel dumb. I totally forgot about the PPC port, I just figured they didn't have it because when I was looking it at I wasn't even thinking about audio/rsp and I didn't see anything useful at the time. Turns out there's a rsp_hle-ppc. Going to give it a try. Thanks.
 

Top