Mips port difficulties
Hey dan, im stuck with PocketQuake. I thought i only had to modify the 2 funcions you said but there seems to be more work to be done.
The thing is that PocketQuake hangs right after "Starting quake".
I don't know where the problem might be, i just know that it doesn't get to load the .gz because if i remove it i get no warning about not finding it.
I don't know what happens, but when you start it at first you can hear your screen taps, and then a while after you can't.
Now, if i remove the bitblting line that draws the menu, i can always here the screentaps but it still seems to reamain inside an infinite loop.
Do you have any clue where the problem might be?
It still hangs even after removing the functions that im supposed to change. And debugging is crazy on such a big program, besides it's terribly slow.
Make sure you have at least 8 MB program RAM free. If that still doesn't work, keep increasing it up to at least 10 MB. Debugging is really the only option in a project like this. Ethernet debugging works extremely well (at least 5 times faster than USB), however USB is acceptable and usable.
Dan East
Also, if you are not debugging, then try using a release build instead of a debug build. What is the exact device you're trying this on?
Dan East
Im trying it on a MIPS release build.
The Emulator debug build seems to work just fine, the only thing is that it tells me it can't find the wad file and quits. Something that the MIPS build doesn't tell me even when there's no pak0 on the device. It just crashes before loading the wad file i think.
Jacco said he'd help me out but im not sure how are we going to get past this point since we have no clue what the problem is.
by the way, is there another developer trying to port it to mips?
Dan, do you at all use GXBeginDraw() somewhere else other than in Vid_update() ?
I mean what type of device, Casio E-115, E-500, etc.
I think you're going to have to debug on the device.

Besides the sluggish response you shouldn't have any problems debugging. Set a breakpoint in host.c at the start of the Host_Init function. From there all the various subsystems are initialized. If you don't even get to that point then it fails initializing the stack (6.5 MB is allocated via malloc). You could try inserting message boxes to track how far along you get in the code, but I still think debugging would be easier!
Yes, that's the only place GXBeginDraw is called. And yep, you're the only person I know of working on a MIPS build.
To get the emulator to work find the location of your Pocket PC SDK installation and copy the pak0.pak.gz into the emulator storage space in quake\ID1\. Here's what my path looks like:
D:\Windows CE Tools\wce300\MS Pocket PC\emulation\palm300\quake\ID1
Dan East
Hey buddy, i've done what you told me. It gets to the begining of host_init(). But if i want to run it up to the end of host_init(). i set a breakpoint in:
Sys_Printf ("========Quake Initialized========= \n");
i get this message from the debugger:
First chance exeption in pocketquake: (some address): Access Violation.
And then it takes me to some function called:
pack_t *COM_LoadPackFile (char *packfile)
I have 16 megabytes of program memory so...
Any ideas?
Okay, now were getting somewhere! It should take you to the exact line that failed (sometimes it indicates the line after). Tell me what line that is. You can hover your mouse over the various variables and it will tell you their values. Let me know those too for that line.
Dan East
BTW, hold off on modifying VID_Update. I've rewritten it to allow fullscreen landscape, so while I was at it I wrote it to work on all
devices supporting GAPI (except devices less than 8 bpp). If you can find the bug causing the MIPS version to crash then I think everything will be set.
Dan East
Wow now we are talking!
i found the problematic function, it's called:
COM_Init (parms->basedir);
and it's found on Host_Init();
I don't have a clue of what it does, but i hope it has something to do with networking and stuff. Because i commented it out and now i get the famous "i can't find the wad file" messagebox.
Anyway... i don't yet know where to place the .gz on my pocket pc so as soon as i figure it out i'll let you know.
But Hey!, it's not crashing anymore!
Nope, looks like COM_init is a relevant function since I always get "Couln't load gfx.wad", and i have the .gz on my root directory on /quake/ID1
Looks like it's gonna take a little more work.
Download and decompress pak0.pak.gz.zip once so it is pak0.pak.gz (~8.3 MB). Copy that onto your device:
/quake/id/pak0.pak.gz
Make sure it is in the root, not in My Documents.
Filesystem initialization occurs in COM_Init (it has nothing to do with the networking), so it is critical for game play (it will never find the pak file unless that is called). It should indicate the exact line that fails, and we could go from there.
Dan East
Ok, im tracking it down right now.
Anyway, if you have ICQ we can figure it out faster. Mi UIN is 3612259
Ok, the problem tree that i have built so far is this:
Host_Init();
COM_init();
COM_InitFilesystem ();
for (i=0; i<allSearchDirsCount; i++)
if (COM_AddGameDirectory (va("%s/"GAMENAME, allSearchDirs[i]) )) break;
Looks like there's trouble finding the wad file.
Im gonna get something to eat and then get back to work.
I can't ICQ with the proxy I'm using here at home (AnalogX). When eVC shows you the access violation there will be a little yellow arrow on the left side of the line in which the violation occured. I need to know that line. Thanks.
Dan East
Last modification: Dan East - 02/22/01 at 15:56:59
Well, i already told you where it points. It points to:
pack_t *COM_LoadPackFile (char *packfile)
{
Just points to that line. Not to any actual code or instruction.
Well i have found where the error is:
The error comes from a line of code found in COM_AddGameDirectory (char *dir)
the line is:
pak = COM_LoadPackFile (pakfile);
pakfile contains "/quake/id1/pak0.pak"
right after entering the funcion y get the error i mentioned and the arrow points as follows:
pack_t *COM_LoadPackFile (char *packfile)
-> {
Very weird error if you ask me... Any clue of why this happens Dan?
Well, Call me insane but the sistem crashes when the function creates this variables:
dpackheader_t header;
int i;
packfile_t *newfiles;
int numpackfiles;
int packhandle;
dpackfile_t info[MAX_FILES_IN_PACK];
unsigned short crc;
Im not joking, i know, this is crazy but it happens.
Something that i've done to prove that variable declaration hangs the program is to declare these variables in the function prior to the problematic one. And it crashes too.
Are we gonna be able to get past this bug?
Because that's what we should call it i think. A microsoft bug.
Well actually what i did to see if that was the cause of the crash is not just to add more variables to the function, but to replace:
pak = COM_LoadPackFile (pakfile);
With lines of code equivalent to that line, so that the function wouldn't be called.
And there comes the crash, now even the debugger won't detect the problem, when the PPC crashes it will just say that connection was lost.
ok, THIS IS INSANITY!!!!!!!!!!
I just made the variables GLOBAL, and erased the problematic variables.
And now this thing works.
Or at least i think it does, i see an about box but im afraid to click ok.
OK, After closing the about box the thing Crashes again, but maybe this time it's because of the drawing routines.
What do you think bro?
Okay, you just reminded me of something. Pocket Quake is running out of stack space. You have to increase the stack size for the MIPS builds. Go into the project settings, Select WCE MIPS in the "Settings For:" drop box. Make sure the PocketQuake root branch is selected in the tree. Select the Link tab. Select the Output Category. Change the Reserve value to 0x3d090. Go ahead and do this for both the release and debug builds. That will solve that problem.
Dan East
CASIO owners rejoice!, i have a semi working Pocketquake MIPS version running on my E-125 @ 180!
I can hear sound perfectly but i can't see anything since i commented out the drawing line.
Im gonna put it right in place and see what happens.
Dan, I suspected that it was running out of Stack space but i never imagined you could increase it like you just showed me how.
Hey, the screen appears blank. But when i command it to close, a messagebox pops ups and then underneath, the screen is drawn and i see PocketQuake (the screen is a little displaced but what the heck).
I'll keep working on it.
Email your email address to
pocketquake@pocketmatrix.com and I'll send you the new source with the new display code.
Dan East
This includes Jacco's 3D optimization.
Dan
Jacco's optimization increased fps by 24% on the iPaq, which of course is a huge improvement. This currently results in some perspective problems (the walls looked warped when you are up against them), which isn't a big deal. The performance increase freed me to produce a landscape mode (it would have been worthless before because it would have been too slow). The landscape mode is now as fast as the portrait used to be. Hopefully this will give you a good fps on the MIPS devices. To get a rough benchmark (once you get this thing going - I have faith), start a new single player game. Do not move the character at all. Pull up the console and execute TIMEREFRESH. Let us know the fps you get.
To the rest of you following this thread; the new iPaq version will be available for download very soon.
Dan East
Once you get the video going it may slow things down to the point that the sound is intermittent. If so, you can increase the _snd_mixahead value in the autoexec.cfg file. BTW, make sure you put the autoexec.cfg file in the same dir as the pak file on your device if you haven't already.
Dan East
Reading your exchange was truly amazing. Some times you read little tidbits of information in manuals and just dont realize how significant they are untill you have to use them.
Keep up the good work guys and dont let the fanatics that think opensource means I own your soul you work for me.
Now I can play quake on my Casio, it's a good thing I just got my 1GB MicroDrive!
hmm.. i was testing it out and i noticed that when you move up against walls odd effects happen. the walls seem to be bubbling away from the player... im doin this on my overclocked em500
This is an odd feature with some of the speed tweaks Jacco has implemented in build .04. Perhaps Jacco or Dan can shed more light on this for us

Otherwise, you don't really notice it unless you're close to a wall. Additionally, this tweak has increased the iPAQ's overall performance by 24%, bringing the overall FPS to a
much more playable level. Well worth the trade off IMHO, and prolly a good reason why Jacco implemented it in the first place

Nice work Jacco!

Now does the bubble effect speed things up, or does the speed cause the bubble effect? We may never know;).
It only sped things up by .3 FPS for me, but that's still 33%. And, the bubble effect causes the speed, because the Quake engine no longer does that perspective correction stuff.
Thanks, i thought it was one of those Chicken/Egg things. That would be funny... stir up a PPC philosophy class or something!