PocketMatrix forums

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

PQ for CE2.11 HPC's

Let me tell you a story...

Been a bit busy recently (read: New Nintendo Gamecube & A-level revision!) and with people wanting a GZip-PQL I started looking at the headers and documentation to GZip...

...5 hours later...I had got completely sidetracked and was playing PQ on the HPC emulator. Well...almost! It compiles and works 100% when compiled for the PPC and the same code appears to work on the HPC (It gets to the "Can't find GFX.wad", see below) Ho hum!

Here's the problem...How the hell do I get the PQ PAK's onto the emulator? The Object store is only 16Mb, and so I can't get the files onto it. Will I have to pad out the object store with another 16Mb of null charactors?
This won't be a problem on the real device because it will almost certainly have to be on a 16-32Mb CF card. You'll struggle to get it into RAM on a 16Mb HPC.

Other than that, things are going great. I'll post a screenie later!

The next task is to get it to use GAPI HPC rather than Microsoft GAPI. Wish me luck!
well, good luck!
The object store is proving to be a real problem. I don't want to start with HPC GAPI untill I am 100% sure the current build will work on CE2.11.

Last night I wrote a program that added 16Mb of \o to the object store. It doesn't work. filesys.exe just crashes.

Does anyone know of a very good pack editing utility that I can use to strip down the PAK file.
Also, can someone tell me what can and can't be removed from the PAK file.
OK we're up and running on the emulator!

I would pos a screenie but I can't be arsed to install my FTP software!
Maybe later!

Don't get excited yet though, Iv'e still got to implement GAPI HPC and tidy up the interface, but that shouldn't be too bad.

Oh yeah could Rob (AKA: Muffinman) please send me his Quake720 source? It would make my life a lot easier.
E-mail me at 82.00.curric.regent@regent-college.ac.uk
Next!

Seems to work fine. So far so good. Now I need to get it to recognise storage cards.

I 'think' this code should be where Dan East's storage card code was. COM_InitFileSystem(), however the only directory it seems to recognise is "/Quake".
I can add any path to AllSearchDirs[count], but only "/Quake" will work.

Since WinCE 2.11's storage cards are treated as normal folders, I will have to hard-code the paths. (I don't think there are any Flash card-finding functions)
However when I try any other path than the default "/Quake", it wont find the quake directory at all.

Any suggestions?
Have you tried it anyways? Because On Pocket PCs, if you want it on your Storage Card, you have to have it in the root of your Storage Card in the folder QUAKE, so it would look like this in the file system: /Storage Card/QUAKE/ , which is the same as WinCE 2.11, right?
Nope...it's different. On CE3.0 (PPC) you have the FindFirstFlashCard() function. This is not on CE2.11.

I've sorted it now anyway. Its funny how at 1:00am in the morning a piece of code can seem bewidering cryptic, yet the next day, it's clear as a bell!

Sorted & Tested. Storages cards are ok. It'll check main memory first, then it'll go through your storage cards...
Ok then. I run it and we get the blank screen. (on the device)

Am I right in thinking that the GAPI functions that have a _ (underscore) at the end of them are pointers to functions in the dynamicly loaded GX.dll. Since the HPC version links to a GAPI lib, not a dll, this code is not required.

When you try replacing the pointers with calls to the function, it throws a link error. After reading the 720 port thread (posted ages ago) I think that it is because the lib is not compatible with 'C' and the functions must be called from 'C++' code.

Is it correct to create a new .cpp file and call the functions from there and return the values to the original 'C' code in 'vip_ppc.c'?

Eg: Replace (*GXOpenDisplay_)(hWnd,GX_FULLSCREEN);
with ToC_GXOpenDisplay(hWnd,GX_FULLSCREEN);
and have a function like this in the .cpp file:

int ToC_GXOpenDisplay(HANDLE h,DWORD d)
{
return GXOpenDisplay(h,d)
}

This way the 'C' code gets the values returned to it and the net effect is the same as calling it directly.
Well...nope. Just sticking the files in a .CPP file and passing it back doesn't work. At all.

However I have got it to compile and GAPI HPC initilises. And then not a lot happens. This may be because I dont have enough RAM available. Still, good progress...
Ok we're buggered!
I've got GAPI to work fine in 'C' using 'extern' but the game still doesn't work. We get the "Trial version, not for resale" box so GAPI is being started.

I compiled the demo and that doesn't work either (we just get a blank screen) :evil:

Any ideas?

I'll e-mail Larry and see if he knows anything about it, because it seems that GAPI isn't getting the screen access right. Could this be the same problem as we are getting on the German 720's and the 710's?
(Program keeps calling GXBeginDraw() because it keeps returning an incorrect pointer.)
Blank screen, hun?

Well, first, I assume you are using Larry's library.

Ok, here are some answers to your questions.

All of the GAPI functions with _ are because they are loaded through dll, and Dan did this so he could instantly tell if the problem was that the GX.dll file was missing. I recoded this (well, deleted it is a better way of saying it I guess) and just used capital letters at the end of each function (which I renamed through the c wrapper).

Well, for the blank screen...
1. Does the trial message come up?
2. When you click ok, does it come up again?
3. Can you hear sound? (You may have commented sound out for the moment, I just know that the 720 was fulling compatible with the sound in quake).
4. What res are you starting it at?
5. are you sure that your are setting the pointer returned by GXBeginDraw to what ever car Dan has used?
6.Do you have an arm device? If not, you have to call GXBeginDraw at the beginning of everyframe (I know this is true for pocketpc's). So, if you have the sharewear version, this can be very anoying, but should at least let you see a pic.
7. Make sure you defined your device correctly in the source. Check in the blitting section of the code, and you will see what definition you have to define depending on your processor.
8. Not sure, but maybe your processor isn't defined there, and if that is the case, I am not sure how it would react. Try out Larry's GAPI demo (compiled with the trial lib) and see if it gets the video buffer before every frame, if not, the ignore sug 6, and define your device as an arm processor in the source (note: this is not what type you want to compile it for, but rather a little thing that Dan has included to tell how to work the graphics for a given device, again check the code where he blits to the screen).

Very sorry, I do still have the glide wrapper, but my source for PQ was also lost. I had all of my projects on one disk, and it was lost in my backup process. On the otherhand, I know that I had sent it to like 2 different people, and if they would kindly come forword, then you can get a copy of the source. Also, I will be happy to help with any problems that arise.
Thanks for taking the time to reply. :D

I got rid of the code that gets the functions from gx.dll, I created a seperate .CPP file and called all of the gx.lib using extern "C". (As you will know this is required)
Now I call the functions from my .CPP file instead of the pointers to the gx.dll functions.

1) Yup we get the nag-screen on startup.
2) Yeah...again and again. Presumably this is because GXBeginDraw() is not retuning a valid pointer. In the drawing code 'pDisplay' (or whatever it is called) checks it's validity. "if (!pDisplay)"
If it is a NULL value it'll call GXBeginDraw again, so we keep getting the nag screen.
3)I've (gulp!) dumped the sound code! I was getting around GlobalAlloc() when I thought that since the sound on a J680 is so shitty (excuse me french!) I didn't see the point in leaving it in. All it will do is take up CPU time, valuable ram and battery power. I'vejust commented it out so that when I have got GAPI HPC to work, I may put it back in.
4)Other than where GXBeginDraw() is called, I have not touched the video code. Presuably it will start at 240x180.
5)Pretty much certain. I just call:
pDisplay = GXBeginDraw();
in place of:
if (GXBeginDraw_)
pDisplay = (*GXBeginDraw_)();

6)Its actually the ARM device that does not require getting the pointer every frame. The J680 is SH-3 and so (this is for the PPC gx.dll) does require this.
I've tried with and without this. No effect.

7) I've not touched the blitting code. It wasn't needed in the PPC versions. The only drawing defines are for Calling GXBeginDraw() every frame and seperating Intel _X86_ emulation builds from device builds. (Emulation uses a HDC to draw each frame because it doesn't support GAPI.)

8)Tried Larry's demo. Doesn't work either. I also tried editing it to call GXBeginDraw() every frame.


I have however found something that could be very useful on another forum in another place...

I've finally figured out a solution for Jornada 680.
First of all, I've found a video buffer address for this HPC. It's 0x06130000. But I'm afraid, it's not enough just to set
vbuff = (short *)(0x06130000);
instead of calling GXBeginDraw() (this approach works for Jornada 720 though).
Probably a more correct way is to patch gx.lib, which is used to compile Jornada 680 SH3 EXE, to support all the versions of the Jornada. I used this approach (but I patched EXE itself), so you can download the fixed EXE, which should work on all the devices.
[/url]
felixdd · 27 May 2002, 06:08 UTC — MIPS
Will you port this to MIPS HPC's after you finish with making it for the 680? I'm just curious.
I'll release all my builds later anyway. It'll only work on your HPC if GAPI HPC works on it.
I never thought I would get this far...GameX has taken care of my drawing problems!

Im running off a storage card with a Gzipped pak. It takes about 5 minuts to load, gets to the demo and then...crashes with a bad surface extents error! Yuk. Don't stress though. Im 99% sure that this is a problem with the speed of the storage card or the lack of memory. It's also possible that I have a corrupt pak file on there.
Ooops...I'll try logging in next time...
You probably won't beleive this but i'll tell you anyway...I was running Quake on my J680 (16Mb Ram, 133Mhz SH-3 CPU) and the 'Necropolis' demo was running at around 10-12 fps. WOW! The graphics are perfect, no artifacts etc.
It'll be completely playable on this slow device. The only parameters I used was '-heapsize 5500' (to limit memory usesage)
The bad thing is that it is very unstable at the moment. Thats probably because I have a dodgy pak on my device. (Uploading 18Mb over a serial connection is bloody slow.
I'll do a i've-got-to-have-it-now-cuz-I-can't-wait-for-it-to-be-finished release tonight.

I'd be interested to see how it fairs on other devices.
Ahhhh...why can't I ever remember to log-in??!!!
If you still need a stripped down PAK, you can get a good 7MB or so by getting rid of all the maps except for start. Or get rid of all maps but e1m1, and start quake with the +map e1m1 parameter. Both ways save about the same space.
Gr8 idea. Cheerz!
Oh yes! Im fragging monsters on my Jornada 680. The framerate is very dissapointing. Im just not sure why the demo was running fast.
Graphics are superb.
I've also done some wrapper function that convert GAPI calls to GameX calls. If this would be any use to anyone i'll post them.

But quake on my Jornada 680 is just too good to be true!

Should work on pretty much any device with 16Mb ram and a MIPS or SH-3 cpu.
Hmmm...If you run it from RAM it's slow because it has less memory to play with. My 680 is only 16Mb so with it's pak in RAM it only has around 8.5Mb free.
If I put it on the storage card it runs much faster.

Ok. I've done a MIPS and SH-3 build. Since GameX only supports these CPU's I can't do a ARM build.

Heres the links:

SH-3: (Tested)
http://home.freeuk.com/gamefreaks/pq_sh3.zip

MIPS: (untested)
http://home.freeuk.com/gamefreaks/pq_mips.zip

Please note that these are early builds, there may still be bugs.

Happy fragging HPC owners!!! :twisted:
felixdd · 10 Jun 2002, 03:38 UTC — well...
Bug #1: links are dead =P

I think the host doesn't like the word "Quake" or sth -- in any case good work!! =)
I took the files down to put them on my PQL site.
There's been loads of updates since I uploaded them. You can now play in 640x240. hehehehe!!! (as well as 320x200 and 320x240)

Please be patient. I've carried away with a Doom port too...
felixdd · 10 Jun 2002, 23:27 UTC — cool
Yay! Heheh I can give you some input on the mips aspect of things, cuz I have the MP770 (mips)...but you probably don't need it -- you sound quite ahead with the development -- keep it going!! :D :D :D
will it run on my old 620lx too? :D
I've put the files on my site:

http://home.freeuk.com/gamefreaks/pql/

The best way to find out if it'll work is to suck it and see! :D

Should work on the HP620 and 770 tho...
felixdd · 11 Jun 2002, 23:47 UTC — Nope
Doesn't work for the MP770 -- the display becomes weird and seems to stretch across the screen in bands (but the bands don't line up). I've only been able to launch under 320×200 -- 320×240 and 640×240 doesn't even launch.

It's sorta like if you try to run PalmGB on an HPC with GameX on -- it'll show something similar to this.

I think maybe it's GameX, or maybe GameX with the MP770, or maybe just the MP770. In any case, it probably is related to GameX, because PalmGB can run on the 770 if I disable GameX acceleration, but it ends up emulating slower than my Nino (which has a 75 MHz processor compared to the 131 on the NEC 770).

I'm not sure, but I think GameX has to be written differently for different machines, but don't take my word for it.
Tenchi · 28 Jul 2002, 08:19 UTC — PQ on HPC2000?
Will Pocket Quake work on the HPC2000? I have an Intermec 6651. I'll be happy to assist in testing the port.

Tenchi818@hotmail.com
An ARM HPC build of PQ has already been made.
I have used GameX rather than GAPI HPC for HPC Quake. If HPC Doom works on your device, Robs Quake720 should too.
Theres a link somewhere on the PQ site:
http://quake.pocketmatrix.com/