What's new

N64 Glide Plugin

Status
Not open for further replies.
OP
Dave2001

Dave2001

Moderator
The method of 2d clipping that I'm using is percentage based. It checks the percent of the line on one side of the edge of the screen, and uses that to calculate the intersection point. Here's how it works with one line (this is right side clipping only, it does the other sides afterwords, with code almost exactly the same):
 

Quvack

Member
I've got a Voodoo Banshee :) and ur plugin runs well :)

/me loves watching progress and helping with where possinble ;)
 
OP
Dave2001

Dave2001

Moderator
Ok, so what's been happening recently:
* Fixed mario cannon bug in snow level that used to freeze (actually had to do with pushing/popping the matrices!!! It took me 2 days to find the source of this bug)
* Added support for texture cache using any size texture memory
* Fixed the 2MB texture memory boundary bug

The next thing I need is to fix my matrices. I think that is why SF Rush and Tetrisphere don't work well. I think I'm reversing something and I absolutely cannot figure it out, considering I'm not very good with matrices in the first place. I'll post my code here, and PLEEEASSE help me :cry: (look down for main uc0:matrix function, look at post on a previous page to see how I'm using matrices to draw):

in rdp:
// Matrices
float model[4][4];
float proj[4][4];
float model_stack[10][4][4]; // 10 deep, will warn if overflow
int model_i; // index in the model matrix stack

void modelview_load (float m[4][4])
{
memcpy (rdp.model, m, 64); // 4*4*4(float)
}

void modelview_mul (float m[4][4])
{
float m_src[4][4];
memcpy (m_src, rdp.model, 64);

for (int i=0; i<4; i++) // row in result
{
for (int j=0; j<4; j++) // column in result
{
rdp.model[j] =
m_src[0] * m[0][j] +
m_src[1] * m[1][j] +
m_src[2] * m[2][j] +
m_src[3] * m[3][j];
}
}
}

void modelview_push ()
{
if (rdp.model_i == 9)
{
RDP_E ("** Model matrix stack overflow ** > 32 push");
return;
}

memcpy (rdp.model_stack[rdp.model_i], rdp.model, 64);
rdp.model_i ++;
}

void modelview_pop ()
{
if (rdp.model_i == 0)
{
RDP_E ("** Model matrix stack failed** too many pops");
return;
}

rdp.model_i --;
memcpy (rdp.model, rdp.model_stack[rdp.model_i], 64);
}

void modelview_load_push (float m[4][4])
{
modelview_push ();
modelview_load (m);
}

void modelview_mul_push (float m[4][4])
{
modelview_push ();
modelview_mul (m);
}

void projection_load (float m[4][4])
{
memcpy (rdp.proj, m, 64); // 4*4*4(float)
}

void projection_mul (float m[4][4])
{
float m_src[4][4];
memcpy (m_src, rdp.proj, 64);

for (int i=0; i<4; i++) // row in result
{
for (int j=0; j<4; j++) // column in result
{
rdp.proj[j] =
m_src[0] * m[0][j] +
m_src[1] * m[1][j] +
m_src[2] * m[2][j] +
m_src[3] * m[3][j];
}
}
}

static void rsp_uc00_matrix()
{
RDP("uc0:matrix ");

// Use segment offset to get the address
DWORD addr = segoffset(rdp.cmd1) & 0x003FFFFF;
BYTE command = (BYTE)((rdp.cmd0 >> 16) & 0xFF);

float m[4][4];
int x,y; // matrix index

addr >>= 1;

for (x=0; x<16; x+=4) { // Adding 4 instead of one, just to remove mult. later
for (y=0; y<4; y++) {
m[x>>2][y] = (float)(
(((__int32)((WORD*)gfx.RDRAM)[(addr+x+y)^1]) << 16) |
((WORD*)gfx.RDRAM)[(addr+x+y+16)^1]
) / 65536.0f;
}
}

switch (command)
{
case 0: // modelview mul nopush
RDP ("modelview mul\n");
modelview_mul (m);
break;

case 1: // projection mul nopush
case 5: // projection mul push, can't push projection
RDP ("projection mul\n");
projection_mul (m);
break;

case 2: // modelview load nopush
RDP ("modelview load\n");
modelview_load (m);
break;

case 3: // projection load nopush
case 7: // projection load push, can't push projection
RDP ("projection load\n");
projection_load (m);
break;

case 4: // modelview mul push
RDP ("modelview mul push\n");
modelview_mul_push (m);
break;

case 6: // modelview load push
RDP ("modelview load push\n");
modelview_load_push (m);
break;

default:
FRDP_E ("Unknown matrix command, %02lx", command);
}
}
 

Hacktarux

Emulator Developer
Moderator
The algorithm seems to be right but are you sure that a tab like model[4][4] can be linearly accessed (that you can use the memcpy function). I know that in gnu compilers it's not. If it is the problem, it should work until it erased some other important data. The solution is to use a tab like : float model[16].

I know I had this problem but maybe your compiler handle it correct :)
 

EeeK

New member
Wo.....great work Dave2001! I think I can keep my Voodoo3 2K a few more yrs with this plugin. :)

Anyway if you need any help pls let me know.
 
OP
Dave2001

Dave2001

Moderator
I think my compiler handles it correctly. I'm using Microsoft Visual C++ 5.0. I tried replacing the memcpys with for statements and it acted exactly the same. I'm almost positive that the problem is that I have the matrices flipped somehow. Check if my code here is consistent with the matrix transformations posted earlier.
 
OP
Dave2001

Dave2001

Moderator
I fixed it i fixed it I FixED it I FIxeD it I FIXED IT!!!!!!!!!!!!!!!!!!! :D :) :colgate:

By the way, I'm talking about the clipping problem (texture warping)!!! It's completely fixed! The problem (totally unobvious) was that I needed to, during screen edge clipping, use the q value instead of z. I guess q interpolates better or something. There's no more artifacts either. You can see the water now (although it's not translucent yet).

Now there's only one known problem with the current version of Glide64 (aside from several texture offset things, ex. Nintendo copyright), the matrix problem! :devil: Everything else that doesn't work just hasn't been implemented yet.

Since this is a big update, I'll post Glide64 v0.01b with the fixed clipping on my webpage in a few minutes.

http://www.emuxhaven.net/~glide64/

By the way, I'm pretty sure that my plugin runs faster on Voodoo cards than Jabo's, since in Hazy Maze Cave using Jabo's the sound would skip, and using mine it runs smoothly.
 
Last edited:

Eddy

I Run This
congrats 200000000000x damn now when i want a voodoo, i cant have one :-( i can i just dont have another agp port :-(
 

2fast4u

New member
Eddy said:
congrats 200000000000x damn now when i want a voodoo, i cant have one :-( i can i just dont have another agp port :-(

i think u mean pci slot. there's no motherboard w/ 2 agp slots existing. hehe, i bought a v2 extra for ultrahle ... :D
 

linker

Emutalk Member
Dave, I see that you are working hard on your plugin and I wish you luck. The problem is that I don't have Voodoo, so is there any wrapper for glide3x (just like glide2x wrapper for uhle).
 
OP
Dave2001

Dave2001

Moderator
If you don't have a Voodoo, you would probably be better off just using a Direct3d plugin. There's no point to my plugin unless you have a Voodoo. You could run it through a glide wrapper, but it would just make it go slower and lose texture blending.
 

Rice

Emulator Developer
Does it work under win xp?

I tried 0.1b under XP with my voodoo3, does not work. I know I need to wait a bit longer, but does it work under win xp, or my voodoo3 driver in win XP does not support Glide very well?
 

Harteex

Harteex das Brot
I downloaded some drivers for my VooDoo2 and the drivers installed glide3x.dll...
But pj64 crashes in glide3x when I try to play.
 

BatBoy

New member
Rice:
The Glide64 Plugin will work in XP. Im using v0.1b in XP with a Voodoo 3 but I had to update the drivers. The XP default drivers don't support Glide. I tried to post the file but it's over the upload limit. Ill try to Span it over 2 images.

Dave2001:
Great job on the plugin it's working well. Good luck with the project
 

milen

New member
I have Savage4 video card and Jabo's plugin hangs on my computer. So I'll be very happy to use glide wrapper with your plugin. There isn't good plugin that works for me.
Only TrWin is fast and compitable enough for Savage4.
 

mesman00

What's that...?
you know, there are other plugins other than jabo's, such as icepir8, and there are a few others, such as the 1964 ogl plugin, and it seems as azimer is workin on a graphics plugin, and icepir8 is starting a new direct3d plugin.
 
OP
Dave2001

Dave2001

Moderator
#1. Ok, anyone that has had problems, update your drivers and tell me if it worked (www.voodoofiles.com).

#2. Try checking AND unchecking "go to fullscreen on rom load"

#3. I've heard of crashes on Voodoo 2, I think I need to have a debugging session with somebody that owns this type of card.

Tell me if #1 or #2 fixed it for you
 
OP
Dave2001

Dave2001

Moderator
Ok, I decided it would be a good idea to fix the matrix problem before implementing lighting, considering lighting may use the matrices.

Does anyone have any idea what (with matrices) might cause things to spin around me instead of their origin? I think in tetrisphere I saw that happening.
 
Status
Not open for further replies.

Top