This project is read-only.

PSX fixes from pSXAuthor in MAME

Apr 11, 2010 at 4:45 PM

In MAME 0.137, check out src/emu/cpu/mips/psx.c

There are some fixes in the PSX core thanks to pSXAuthor.

Maybe it can be also added to PCSX-Reloaded?.

 * GTE divider reverse engineering by pSXAuthor.
static const UINT16 reciprocals[ 32768 ]=
INLINE UINT32 gte_divide( INT16 numerator, UINT16 denominator )
	if( numerator >= 0 && numerator < ( denominator * 2 ) )
		UINT32 offset = denominator;
		int shift = 0;
		UINT64 reciprocal;
		while( offset <= 0x8000 )
			offset <<= 1;

		reciprocal = (UINT64)( 0x10000 | reciprocals[ offset & 0x7fff ] ) << shift;

		return (UINT32)( ( ( reciprocal * numerator ) + 0x8000 ) >> 16 );

	return 0xffffffff;

Apr 12, 2010 at 5:23 AM
Edited Apr 12, 2010 at 5:24 AM

well, looks like I won't be able to include that large array (which has to be copied directly) due to licensing issues.

Apr 12, 2010 at 10:55 AM
Why you are not able to include the array? Due to MAME license? MAME license does not allow it? Maybe the array can be located in specific .h file with a header refering to the MAME license, and include the MAME license in the documentation...
Apr 17, 2010 at 5:50 PM
Edited Apr 17, 2010 at 6:26 PM

GPLv2 license allow to sold at any price, I don't know if this still compatible... but GPL isn't a commercial license, right?

"VI. Reuse of Source Code"

Apr 18, 2010 at 12:33 PM

After seeing the link provided by BadPotato i don't see any problem to include the large array...

Apr 18, 2010 at 1:36 PM

I don't think this code should be included into the pcsxr project. Why don't you like the current gte?

Apr 18, 2010 at 9:02 PM

There is nothing wrong with the current GTE. You are doing a great work! :-)

But i saw the fix done by pSXAuthor in MAME, and it is reverse engineering applied to correct some problems in the GTE emulation.

I really have not seen the PCSX-R source code deeply yet and i don't know if it is useful or not. But i though it would be a good idea to share it here.

Cheers to everyone involved in PSCX-R, it is a really promising open source PSX emulator!!!. ;-)

Apr 22, 2010 at 3:56 AM
Edited Apr 22, 2010 at 3:57 AM

no, I'm sure the mame license is incompatible with GPL so code from MAME cannot be copied directly (using the information from MAME is ok though).

shalma has created an alternative division code and posted it here: