PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

SH-3 VERSION OF PQ UP AND RUNNING!

I got a version of PQ for SH-3 (Jornadas) running!  It runs smoothly.  Button mapping, menus, console, and input devices work perfectly.  It gets 3.7 to 3.9 FPS, but is very playable.  Walls, textures, weapons, and everything show perfectly!  I will try to put a package together for Jornada users.
Dan will post the Jornada version on the website as soon as he contacts me.
Moose or Chuck · 28 Mar 2001, 19:08 UTC
Ahhh.. no plug about me ??? =...(
Oh, and Moose helped me to acquire the FPS on the Jornada device.
:)
Give the following a try (we really need a release version):

Go to Project->Settings
Change Settings For to Win32 (WCE SH3) Release
Make sure the root branch (PocketQuake) is selected in the file tree.
Click on the C++ tab.
Select the category Optimizations
Change the Optimizations: drop list to Maximize Speed.
Hit OK

Build using the SH3 Release config and see if that one works.

Thanks.

Dan East
Congrats. This is amazing. :)
building and testing as we speak . . .
no good, release ver. just won't work, fatal error
exception: 0x80000002
address: 00019558
Try settings the optimizations to Disable (Debug).

Dan East
just tried that, that's no good either.
Go to the link tab, Output category, and change the Stack reserve to 0x3d090.

Dan East
still not working . . .
By the way, if debug builds do run at least half as fast as release builds, it should run pretty damn fast if we can get a release build working.
any other ideas dan?
Not really. You can try playing with the struct alignment values under C/C++ tab, Code Generation category.

With a Debug build special debug versions of various functions (particularly memory allocation / deallocation) are linked to. These functions do a whole lot of extra stuff to verify that memory is properly deallocated, not written past what is allocated, etc. The use of the debug versions of those functions may work around the real problem.

The final thing to do would be to modify the Release config so that it contains browse info. Then you could debug into a release build to see where it fails. I've had to do that a few times, but I don't exactly know every setting that needs to be changed off the top of my head. I beleive you need to (this is changing the SH3 release config of course):
C/C++ tab, Listing Files category.
Check Generate browse info
Browse Info tab.
Check Build browse info file.

You should then be able to launch a debug session on a release build on your device. Try some different struct alignment settings just for the heck of it first.

Dan East

Jay, i got your message.
I'm not sure what problem my first sh3 release had, i think the problem was that only monsters and items were displaying and the scenery was gray.
I don't know what other problem the second SH3 release had since i don't have a jornada.
So what problem are you experiencing?
the first problem was that an error kept coming up right after it loaded the demo and was starting to attempt to display it, then in your second release, it wasn't drawing the walls and floors etc.
I keep getting that error
All the debugger says when I run it with my release version is there is a datatype misalignment error.  Then, it gives me some assembly code.  However, I don't think we're going to figure it out from that.
well i only released the build where walls weren't displayed. That was my build and the first, the second one was just a 0.05 build that i didn't modify to see if it worked.

It's very hard for me to tell you how to get around the error, when i was actually working on pocketquake i made dozens of small changes in the code to see if i could get it to run faster. In the process the sh3 error disappeared.

Perhaps you should try disabling sprites and the sky and see if you have any luck there. If it doesn't work then i don't know what else can i do for you since i put my hands on many other places in the code. Perhaps i still have a copy of the old pocketquake source that i modified.
Ohhh, one more thing, look for a function called recursive world node or something like that and try commenting the whole content out. Of course this is not a way to fix this but to track if the problem lies in that function.
I'm telling you to do this because now i remembered that i intentionally aborted that funcion prematurely in a fool attempt to increase performance.
Actually, i would bet on recursive world node. Give it a try.

Thanks, I'll try that tomorrow.  I'm really tired.
don't you have an icq number?
i never tried ver 0.41b on a jornada i think. Perhaps it works. would you try it for me?
what?
It's very hard for me to tell you how to get around the error, when i was actually working on pocketquake i made dozens of small changes in the code to see if i could get it to run faster. In the process the sh3 error disappeared.

Actually, I'm certain the error was still there. Windows CE has poor exception handling (does not support ANSI C catch and throw, instead uses MS's proprietary version which does not support stack unwinding). What that means is that the exception handling is unreliable and does not always get thrown completely to the top. This was just happening with another project I'm working on today. When the error occurs it kicks out of the call stack a few levels, but the Application Error dialog is never displayed and the app keeps running. That explains why there was no rendering and the FPS was super high with your SH3 version. The error still occured, it's just that whatever changes you made happened to throw a wrench in MS's exception code so that the exception didn't make it all the way out.

Dan East
Jay, you're almost there. It's just that the source was not embedded in the exe. Go to the C++ tab, General category and change the Debug Info to "Program Database". Then when the exception occurs it should take you right into the source. I thought that I had forgot another debug setting.

Dan East
Ok, I'm debugging now.  Don't you have an ICQ or something Dan?
I mean:

Don't you have an ICQ Dan?
Ok!  Here's where the problem is!  Yay!
/*
================
D_PolysetRecursiveTriangle
================
*/
void D_PolysetRecursiveTriangle (int *lp1, int *lp2, int *lp3)
{
    int            *temp;
    int            d;
    int            new[6];
    int            z;
    short      *zbuf;

---> d = lp2[0] - lp1[0];
    if (d < -1 || d > 1)
          goto split;
    d = lp2[1] - lp1[1];
    if (d < -1 || d > 1)
          goto split;

    d = lp3[0] - lp2[0];
    if (d < -1 || d > 1)
          goto split2;
    d = lp3[1] - lp2[1];
    if (d < -1 || d > 1)
          goto split2;

    d = lp1[0] - lp3[0];
    if (d < -1 || d > 1)
          goto split3;
    d = lp1[1] - lp3[1];
    if (d < -1 || d > 1)
    {
split3:
          temp = lp1;
          lp1 = lp3;
          lp3 = lp2;
          lp2 = temp;

          goto split;
    }

    return;                  // entire tri is filled

split2:
    temp = lp1;
    lp1 = lp2;
    lp2 = lp3;
    lp3 = temp;

split:
// split this edge
    new[0] = (lp1[0] + lp2[0]) >> 1;
    new[1] = (lp1[1] + lp2[1]) >> 1;
    new[2] = (lp1[2] + lp2[2]) >> 1;
    new[3] = (lp1[3] + lp2[3]) >> 1;
    new[5] = (lp1[5] + lp2[5]) >> 1;

// draw the point if splitting a leading edge
    if (lp2[1] > lp1[1])
          goto nodraw;
    if ((lp2[1] == lp1[1]) && (lp2[0] < lp1[0]))
          goto nodraw;


    z = new[5]>>16;
    zbuf = zspantable[new[1] + new[0];
    if (z >= *zbuf)
    {
          int            pix;
           
          *zbuf = z;
          pix = d_pcolormap[skintable[new[3]>>16][new[2]>>16];
          d_viewbuffer[d_scantable[new[1] + new[0] = pix;
    }

nodraw:
// recursively continue
    _PolysetRecursiveTriangle (lp3, lp1, new);
    _PolysetRecursiveTriangle (lp3, new, lp2);
}
there, can you help Dan?
ah yes, take out that function and what do you get?  Carpediem's sh-3 build!  lol
No, I can't ICQ. Start debugging again so you get the error. Then hold your mouse over the lp2 and lp1 variables. A tooltip should appear telling you the values. I need those please. Also, I need to know what called that func (if it was through recursion or not, might be running out of stack space). When it stops with the error, click on View->Debug Windows->Call Stack. At the top of the list you will see the current function, and down below is the stack of functions called to get to that point. Please copy the top several functions and paste them here for me.
Thanks!

Dan East
ok, one sec
lp2[0]=0x00000022
lp1[0]=0x00000000

D_PolysetRecursiveTriangle(int * 0x00000000, int * 0x00000022, int * 0x00000035) line 335
D_DrawSubdiv() line 245
D_PolysetDraw() line 139
R_AliasPrepareUnclippedPoints() line 1070
R_AliasDrawModel(alight_t * 0x45d3ae00) line 1417
R_DrawEntitiesOnList() line 1005
R_RenderView_() line 1895
R_RenderView() line 2060
V_RenderView() line 1683
SCR_UpdateScreen() line 971
_Host_Frame(float 4.20390e-045) line 861
Host_Frame(float 0.000000) line 902
WinMain(HINSTANCE__ * 0x00000000, HINSTANCE__ * 0x00000000, unsigned short * 0x00000000, int 0) line 938
WinMainCRTStartup(HINSTANCE__ * 0x00000000, HINSTANCE__ * 0x00000000, unsigned short * 0x00000000, int 0) line 8 + 12 bytes
21fae0d8()
Okay, the real problem is in D_DrawSubdiv. It's passing bad int pointers to Recursive Triangle. I'm looking...

Dan East
Next step :), I need you to tell me the value of the pfv var in D_DrawSubdiv. That var is assigned in the begging of the function. You can set a breakpoint to the line after the assignment using the Hand toolbar button. Or, you can let it crash as it has been, then double click the D_DrawSubdiv function in the call stack.

Dan East
pfv isn't giving me a value, it's not even in the context window for the func.  ???  By the way, when I do look at the context menu, it says error expression cannot be evaluated for vertindex and facesfront
Make sure you have the D_DrawSubdiv function selected in the call stack (there will be a yellow arrow next to it). You can also just type in pfv in the watch window (in the name column).

Dan East
it says error, symbol pfv not found
Did you try setting a breakpoint on the line after pfv is assigned in D_DrawSubdiv?

Dan East
no, let me try that
it won't give me that
it'll give me all the other variables, just not that
Add r_affinetridesc.pfinalverts to the watch list and see if it gives you a value.

Dan East
yes, the value is 0x2013f640
Okay, let it run until you get the exception. Then double click on D_DrawSubdiv in the call stack. See if it will give you the values for index0, index1, index2 and i.

Dan East
nope, won't give me the values for any of them
Stupid CE debugger. Add this in before the D_DrawSubdiv function (don't put it in the function):

int d_i;
finalvert_t            *d_pfv, *d_index0, *d_index1, *d_index2;


Then insert this in the D_DrawSubdiv function just after the 3 lines where index0-3 are assigned values:
d_i=i; d_index0=index0; d_index1=index1; d_index2=index2;

Try letting it crash again, and see if the debugger will give you those d_ values.

Dan East
Moose or Chuck · 29 Mar 2001, 11:17 UTC
just a stupid suggestion, Dan y don't u get the code from him. Then you wouldn't have to keep msg'ing each other.
he doesn't have a Jornada 548
Moose or Chuck · 29 Mar 2001, 13:48 UTC
That's been the problem all along, and the code is identical I thought. I bet Dan has only work in progress code though.
what do you mean?
ok ready dan?

d_i = 3
d_index0 = 0x201398a0
d_index1 = 0x201398f0
d_index2 = 0x201399b8
by the way, I'm on AIM all of today if you want to IM me
Super Great, sooooooooo cooooooooool, your my favorti. Plaese hurry, cant wait to play it.

Thanks, keep going on. Mr.Superprogrammer.:-)
I'm glad to see someone is supporting us :)
For (Jay, Dan all else working on this) are jolly good fellows,  
for (Jay, Dan all else working on this) are Jolly good Fellows,
for (Jay, Dan all else working on this) are Jolly good Fellllllooooooooowwwws! (short pause)

That nobody can deny!!!

Keep it up!!!  Thanks a ton!
I'd like to see SH3 supported, and I don't even own a Jornada. Woohoo!
I GOT A RELEASE VERSION OF POCKET QUAKE FOR SH-3 WORKING!  I will create a package and get it on this site as soon as Dan contacts me.  Thanks to Carpediem, Dan, and everyone else who helped me to release this.  YAY!
Moose or Chuck · 29 Mar 2001, 17:50 UTC
Now just think, you'll have to do whatever you did for each release of PQ. Everyone will expect you to. ;D

Oh ya, any difference in FPS with a release build?
Last modification: Moose Master - 03/29/01 at 15:50:08
Last modification: Moose Master - 03/29/01 at 15:50:52
I'm testing the two optimizations that are currently working.  So far, it's still 3.3 fps but I've seen it get up to 5.5 so let's see.

Give me a break people, it's my first release and it was a pain too!
Ok, I finished it and it runs at 3.9 FPS although when you're actually playing it seems faster.  (to me at least)
In the big main hall? or on the timedemo tests?
In the big main hall? or on the timedemo tests?
timedemo demo1.dem
OK FINAL BENCHMARKS ON SH-3 RELEASE BUILD:

BENCHMARKS DONE WITH TIMEDEMO DEMO1.DEM

Portrait: 3.9fps
Landscape: 2.8fps

However, it seems to run faster in mu opinion when you're actually playing.  Well, at least that's the case for portrait.  I'm not so sure about landscape.
Sorry about that repeated post, my connetion died, then came back, and re-sent all my info!
Good work! What did you have to change, so I can modify the 0.06 source? We'll need a build without the debug settings. Also, enabling speed optimizations and function inlining in the C/C++ settings should speed it up some.

Dan East
Dan, could you talk to me on AIM or something, it'll be a lot easier.  I have a lot of stuff to explain.
you get stars for explaining stuff here. can your AIM do that?
haha, no
ok, I'll make this brief.  Inlining works, speed opt doesn't.  All debugging code is out.  Whenever you want it Dan.
its cool, the more i think about the net, the cooler it is. wow, i havent been awed by a computer since i bought my palm pilot... 3rd grade was fun with that thing. US Robotics, 1996, OJ Simpson. Ahhh, thank you Pocketmatrix.com